REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDetectorDriftVolume.cxx
1 
2 #include "TRestDetectorDriftVolume.h"
3 
4 using namespace REST_Units;
5 using namespace std;
6 
8 
9 TRestDetectorDriftVolume::TRestDetectorDriftVolume() { Initialize(); }
10 TRestDetectorDriftVolume::TRestDetectorDriftVolume(const char* configFilename, string name)
11  : TRestMetadata(configFilename) {
12  LoadConfigFromFile(configFilename, name);
13 }
14 
16  SetSectionName(this->ClassName());
17  SetLibraryVersion(LIBRARY_VERSION);
18 
19  fMaterial = "";
20  fW = -1;
21 
22  fElectricField = 0;
23  fDriftVelocity = 0;
24  fElectronLifeTime = 0;
25  fLongitudinalDiffusion = 0;
26  fTransversalDiffusion = 0;
27  fTownsendCoefficient = 0;
28  fAttachmentCoefficient = 0;
29 
30  fPressureInAtm = 1;
31  fTemperatureInK = 300;
32 }
33 
35  fMaterial = GetParameter("material", "");
36  fW = StringToDouble(GetParameter("W_value", "-1"));
37 
38  fElectricField = GetDblParameterWithUnits("electricField", 0.);
39  fDriftVelocity = GetDblParameterWithUnits("driftVelocity", 0.);
40  fElectronLifeTime = GetDblParameterWithUnits("electronLifeTime", 0.);
41  fLongitudinalDiffusion = GetDblParameterWithUnits("longitudinalDiffusion", 0.);
42  fTransversalDiffusion = GetDblParameterWithUnits("transversalDiffusion", 0.);
43  fTownsendCoefficient = GetDblParameterWithUnits("townsendCoefficient", 0.);
44  fAttachmentCoefficient = GetDblParameterWithUnits("attachmentCoefficient", 0.);
45 
46  fPressureInAtm = GetDblParameterWithUnits("pressure");
47  fTemperatureInK = GetDblParameterWithUnits("temperature");
48 }
49 
52 
53  RESTMetadata << "Drift Volume Material : " << fMaterial << ", W-value : " << fW << " eV" << RESTendl;
54  RESTMetadata << "Electric Field : " << fElectricField * V / cm << " V/cm " << RESTendl;
55  RESTMetadata << "Drift Speed : " << fDriftVelocity * mm / us << " mm/us" << RESTendl;
56  RESTMetadata << "Electron LifeTime : " << fElectronLifeTime * ns << " ns" << RESTendl;
57  RESTMetadata << "Longitudinal Diffusion : " << fLongitudinalDiffusion << " (cm)^1/2" << RESTendl;
58  RESTMetadata << "Transversal Diffusion : " << fTransversalDiffusion << " (cm)^1/2" << RESTendl;
59  RESTMetadata << "******************************************" << RESTendl;
60  RESTMetadata << RESTendl;
61  RESTMetadata << RESTendl;
62 }
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
void Initialize() override
Making default settings.
A base class for any REST metadata class.
Definition: TRestMetadata.h:74
virtual void PrintMetadata()
Implemented it in the derived metadata class to print out specific metadata information.
endl_t RESTendl
Termination flag object for TRestStringOutput.
void SetLibraryVersion(TString version)
Set the library version of this metadata class.
void SetSectionName(std::string sName)
set the section name, clear the section content
std::string GetParameter(std::string parName, TiXmlElement *e, TString defaultValue=PARAMETER_NOT_FOUND_STR)
Returns the value for the parameter named parName in the given section.
Double_t StringToDouble(std::string in)
Gets a double from a string.
This namespace defines the unit conversion for different units which are understood by REST.