17#include "TRestDetectorSetup.h"
19#include "TRestManager.h"
26TRestDetectorSetup::TRestDetectorSetup() :
TRestMetadata() { Initialize(); }
28TRestDetectorSetup::TRestDetectorSetup(
const char* configFilename,
const string& name)
32 LoadConfigFromFile(fConfigFileName, name);
37TRestDetectorSetup::~TRestDetectorSetup() {
51 fDetectorPressure = 0;
53 fElectronicsGain =
"";
57 fSamplingInMicroSec = 0;
68 if (r->GetInputFileNumber() > 0) InitFromFileName(r->GetInputFileName(0));
73void TRestDetectorSetup::InitFromFileName(TString fName) {
74 string fullName = (string)fName;
76 unsigned int startPos = fullName.find_last_of(
"/") + 1;
77 unsigned int length = fullName.length();
78 string name = fullName.substr(startPos, length - startPos);
82 unsigned int pos = name.find(
"_") + 1;
83 unsigned int len = name.find(
"_Vm") - pos;
84 fRunTag = (TString)name.substr(pos, len);
86 pos = name.find(
"Vm_") + 3;
87 len = name.find(
"_Vd") - pos;
90 pos = name.find(
"Vd_") + 3;
91 len = name.find(
"_Pr") - pos;
94 pos = name.find(
"Pr_") + 3;
95 len = name.find(
"_Gain") - pos;
98 pos = name.find(
"Gain_") + 5;
99 len = name.find(
"_Shape") - pos;
100 fElectronicsGain = name.substr(pos, len);
102 pos = name.find(
"Shape_") + 6;
103 len = name.find(
"_Clock") - pos;
104 fShapingTime = name.substr(pos, len);
106 pos = name.find(
"Clock_") + 6;
107 len = name.find(
"-") - pos;
108 fSamplingTime = name.substr(pos, len);
110 TString samplingReduced = fSamplingTime(2, fSamplingTime.Length());
111 fSamplingInMicroSec =
112 (Double_t)strtol(samplingReduced.Data(),
nullptr, 16) / 100.;
114 pos = name.find(
"-") + 1;
115 len = name.find(
".aqs") - pos;
121 cout <<
"+++++++++++++++++++++++++++++++++++++++++++++" << endl;
122 cout <<
"TRestDetectorSetup content" << endl;
123 cout <<
"+++++++++++++++++++++++++++++++++++++++++++++" << endl;
124 cout <<
" Run number : " << fRunNumber << endl;
125 cout <<
" Run sub number : " << fSubRunNumber << endl;
126 cout <<
" Run tag : " << fRunTag << endl;
127 cout <<
" --------------------------------------------" << endl;
128 cout <<
" Mesh voltage : " << fMeshVoltage <<
" V" << endl;
129 cout <<
" Drift field : " << fDriftField <<
" V/cm/bar" << endl;
130 cout <<
" Detector pressure : " << fDetectorPressure <<
" bar" << endl;
131 cout <<
" --------------------------------------------" << endl;
132 cout <<
" Electronics gain register : " << fElectronicsGain << endl;
133 cout <<
" Shaping time register : " << fShapingTime << endl;
134 cout <<
" Sampling rate register : " << fSamplingTime << endl;
135 cout <<
" Sampling rate : " << fSamplingInMicroSec <<
" us " << endl;
136 cout <<
" --------------------------------------------" << endl;
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
void Initialize() override
Making default settings.
Data provider and manager in REST.
Double_t StringToDouble(std::string in)
Gets a double from a string.
Int_t StringToInteger(std::string in)
Gets an integer from a string.