8#include <unordered_map>
34std::unordered_map<unsigned int, TChannel*>*
TChannel::fChannelMap =
new std::unordered_map<unsigned int, TChannel*>;
57 if(strlen(tempName) > 0) {
SetName(tempName); }
102 *(fMnemonic.Value()) = *(chan.fMnemonic.Value());
103 SetAddress(chan.GetAddress());
104 SetIntegration(chan.fIntegration);
105 SetNumber(chan.fNumber);
106 SetStream(chan.fStream);
107 SetName(chan.GetName());
108 SetDigitizerType(chan.fDigitizerTypeString);
109 SetTimeOffset(chan.fTimeOffset);
110 SetTimeDrift(chan.fTimeDrift);
111 SetAllENGCoefficients(chan.fENGCoefficients);
112 SetENGRanges(chan.fENGRanges);
113 SetAllENGChi2(chan.fENGChi2);
114 SetENGDriftCoefficents(chan.fENGDriftCoefficents);
115 SetCFDCoefficients(chan.fCFDCoefficients);
116 SetLEDCoefficients(chan.fLEDCoefficients);
117 SetTIMECoefficients(chan.fTIMECoefficients);
118 SetEFFCoefficients(chan.fEFFCoefficients);
119 SetCTCoefficients(chan.fCTCoefficients);
120 SetEnergyNonlinearity(chan.fEnergyNonlinearity);
121 SetTimeNonlinearity(chan.fTimeNonlinearity);
122 SetCFDChi2(chan.fCFDChi2);
123 SetLEDChi2(chan.fLEDChi2);
124 SetTIMEChi2(chan.fTIMEChi2);
125 SetEFFChi2(chan.fEFFChi2);
126 SetUseCalFileIntegration(chan.fUseCalFileInt);
127 SetWaveParam(chan.GetWaveParam());
128 SetDetectorNumber(chan.GetDetectorNumber());
129 SetSegmentNumber(chan.GetSegmentNumber());
130 SetCrystalNumber(chan.GetCrystalNumber());
132 SetClassType(chan.GetClassType());
218 *(fMnemonic.Value()) = *(rhs.fMnemonic.Value());
219 SetAddress(rhs.GetAddress());
220 SetIntegration(rhs.fIntegration);
221 SetNumber(rhs.fNumber);
222 SetStream(rhs.fStream);
223 SetName(rhs.GetName());
224 SetDigitizerType(rhs.fDigitizerTypeString);
225 SetTimeOffset(rhs.fTimeOffset);
226 SetTimeDrift(rhs.fTimeDrift);
227 SetAllENGCoefficients(rhs.fENGCoefficients);
228 SetENGRanges(rhs.fENGRanges);
229 SetAllENGChi2(rhs.fENGChi2);
230 SetENGDriftCoefficents(rhs.fENGDriftCoefficents);
231 SetCFDCoefficients(rhs.fCFDCoefficients);
232 SetLEDCoefficients(rhs.fLEDCoefficients);
233 SetTIMECoefficients(rhs.fTIMECoefficients);
234 SetEFFCoefficients(rhs.fEFFCoefficients);
235 SetCTCoefficients(rhs.fCTCoefficients);
236 SetEnergyNonlinearity(rhs.fEnergyNonlinearity);
237 SetTimeNonlinearity(rhs.fTimeNonlinearity);
238 SetCFDChi2(rhs.fCFDChi2);
239 SetLEDChi2(rhs.fLEDChi2);
240 SetTIMEChi2(rhs.fTIMEChi2);
241 SetEFFChi2(rhs.fEFFChi2);
242 SetUseCalFileIntegration(rhs.fUseCalFileInt);
243 SetWaveParam(rhs.GetWaveParam());
244 SetDetectorNumber(rhs.GetDetectorNumber());
245 SetSegmentNumber(rhs.GetSegmentNumber());
246 SetCrystalNumber(rhs.GetCrystalNumber());
248 SetClassType(rhs.GetClassType());
255 if(strlen(tmpName) == 0) {
return; }
256 TNamed::SetName(tmpName);
258 if(strcmp(tmpName,
"DefaultTChannel") != 0) {
266 if(gFile !=
nullptr) {
267 std::cout <<
"Successfully read " << channels_found <<
" TChannels from " <<
CYAN << gFile->GetName() <<
RESET_COLOR << std::endl;
269 std::cout <<
"Successfully read " << channels_found <<
" TChannels" << std::endl;
277 std::string namea(chana->GetName());
279 return namea.compare(chanb->GetName()) < 0;
288 iter.second =
nullptr;
302 if(chan ==
nullptr) {
306 if(strcmp(opt,
"overwrite") == 0) {
320 std::cout <<
"Trying to add a channel that already exists!" << std::endl;
323 if((chan->
GetAddress() & 0x00ffffff) == 0x00ffffff) {
381 if(strcmp(chan->GetName(),
"DefaultTChannel") != 0) {
SetName(chan->GetName()); }
412 if(chan ==
nullptr) {
416 if(oldchan ==
nullptr) {
460 fENGRanges.Reset(std::vector<std::pair<double, double>>());
461 fENGChi2.Reset(std::vector<double>());
484 if(warn && chan ==
nullptr) {
488 std::ostringstream str;
489 str <<
RED <<
"Failed to find channel for address " <<
hex(temp_address, 4) <<
", this channel won't get sorted properly!" <<
RESET_COLOR << std::endl;
490 std::cerr << str.str();
494 ++(*fMissingChannelMap)[temp_address];
505 }
catch(
const std::out_of_range& oor) {
515 if(ccName ==
nullptr) {
519 std::string name = ccName;
526 std::string channelName = chan->GetName();
527 if(channelName.compare(0, name.length(), name) == 0) {
538 std::vector<TChannel*> result;
539 if(ccName ==
nullptr) {
543 std::regex regex(ccName);
548 std::string channelName = chan->GetName();
549 if(std::regex_match(channelName, regex)) {
550 result.push_back(chan);
561 if(iter1.second ==
this) {
562 std::cout <<
"Channel at address: " <<
hex(
fAddress, 4)
563 <<
" already exists. Please use AddChannel() or OverWriteChannel() to change this TChannel"
564 << std::dec << std::endl;
644 return CalibrateENG(
static_cast<double>(charge) + gRandom->Uniform(), temp_int);
665 return CalibrateENG((charge) /
static_cast<double>(temp_int));
678 size_t currentRange = 0;
684 bool foundRange =
false;
685 for(currentRange = 0; currentRange + 1 <
fENGRanges.size(); ++currentRange) {
687 if(
fENGRanges.Value()[currentRange].first < charge && charge <
fENGRanges.Value()[currentRange].second) {
689 if(
fENGRanges.Value()[currentRange + 1].first < charge && charge <
fENGRanges.Value()[currentRange + 1].second &&
690 gRandom->Uniform() > 0.5) {
700 std::cerr <<
"Charge " << charge <<
" outside all ranges of calibration (first " <<
fENGRanges.front().first <<
" - " <<
fENGRanges.front().second <<
", last " <<
fENGRanges.back().first <<
" - " <<
fENGRanges.back().second <<
")" << std::endl;
716 cal_chg +=
fENGCoefficients[currentRange][i] * pow((charge),
static_cast<double>(i));
724 return CalibrateCFD(
static_cast<double>(cfd) + gRandom->Uniform());
735 double cal_cfd = 0.0;
749 return CalibrateLED(
static_cast<double>(led) + gRandom->Uniform());
760 double cal_led = 0.0;
785 double timeCorrection = 0.0;
789 return timeCorrection;
803 std::unordered_map<unsigned int, TChannel*>::iterator mapit;
805 for(mapit = chanmap->begin(); mapit != chanmap->end(); mapit++) {
806 if(mnemonic.empty() || (strncmp(mapit->second->GetName(), mnemonic.c_str(), mnemonic.size()) == 0)) {
817 std::unordered_map<unsigned int, TChannel*>::iterator mapit;
819 for(mapit = chanmap->begin(); mapit != chanmap->end(); mapit++) {
820 if(mnemonic.empty() || (strncmp(mapit->second->GetName(), mnemonic.c_str(), mnemonic.size()) == 0)) {
831 std::unordered_map<unsigned int, TChannel*>::iterator mapit;
833 for(mapit = chanmap->begin(); mapit != chanmap->end(); mapit++) {
834 if(mnemonic.empty() || (strncmp(mapit->second->GetName(), mnemonic.c_str(), mnemonic.size()) == 0)) {
843 std::cout << GetName() <<
"\t{\n";
844 std::cout <<
"Name: " << GetName() << std::endl;
845 std::cout <<
"Number: " <<
fNumber << std::endl;
846 std::cout <<
"Address: " <<
hex(
fAddress, 8) << std::endl;
848 std::cout << fCTCoefficient <<
"\t";
850 std::cout << std::endl;
852 std::cout <<
"//====================================//\n";
865 buffer.append(GetName());
866 buffer.append(
"\t{\n");
867 buffer.append(
"Name: ");
868 buffer.append(GetName());
871 buffer.append(Form(
"Address: 0x%08x\n",
fAddress));
873 buffer.append(
"CTCoeff: ");
875 buffer.append(Form(
"%f\t", fCTCoefficient));
879 buffer.append(
"}\n");
881 buffer.append(
"//====================================//\n");
888 std::ostringstream str;
890 str << GetName() <<
"\t{" << std::endl;
895 str <<
"None" << std::endl;
898 str <<
"Name: " << GetName() << std::endl;
899 str <<
"Number: " <<
fNumber << std::endl;
900 str <<
"Address: " <<
hex(
fAddress, 4) << std::dec << std::endl;
905 str <<
"TimeDrift: " <<
fTimeDrift << std::endl;
912 str <<
"ENGCoeff: range " << i <<
"\t";
915 str << coeff <<
"\t";
921 for(
size_t i = 0; i <
fENGChi2.size(); ++i) {
923 str <<
"ENGChi2: " <<
fENGChi2[i] << std::endl;
925 str <<
"ENGChi2: range " << i <<
"\t" <<
fENGChi2[i] << std::endl;
930 for(
size_t i = 0; i <
fENGRanges.size(); ++i) {
931 str <<
"ENGRange: " << i <<
"\t" <<
fENGRanges[i].first <<
" " <<
fENGRanges[i].second << std::endl;
936 auto oldPrecision = str.precision();
939 str << coeff <<
"\t";
941 str.precision(oldPrecision);
947 str << coeff <<
"\t";
952 str <<
"EFFChi2: " <<
fEFFChi2 << std::endl;
957 str << coeff <<
"\t";
962 str <<
"EnergyNonlinearity: ";
966 str << x[i] <<
"\t" << y[i] <<
"\t";
971 str <<
"TimeNonlinearity: ";
975 str << x[i] <<
"\t" << y[i] <<
"\t";
982 str << coeff <<
"\t";
987 str <<
"TIMECoeff: ";
989 str << coeff <<
"\t";
1001 str <<
"}" << std::endl;
1002 str <<
"//====================================//" << std::endl;
1003 std::string buffer = str.str();
1010 std::vector<TChannel*> chanVec;
1012 if(iter.second !=
nullptr) {
1013 chanVec.push_back(iter.second);
1032 if(!outfilename.empty()) {
1033 std::ofstream calout;
1034 calout.open(outfilename.c_str());
1035 for(
auto* iter_vec : chanVec) {
1036 std::string chanstr = iter_vec->PrintToString();
1037 calout << chanstr.c_str();
1038 calout << std::endl;
1040 calout << std::endl;
1043 for(
auto* iter_vec : chanVec) {
1053 if(!outfilename.empty()) {
1054 std::ofstream calout;
1055 calout.open(outfilename.c_str());
1056 for(
auto* iter_vec : chanVec) {
1057 if(iter_vec->fCTCoefficients.empty()) {
continue; }
1058 std::string chanstr = iter_vec->PrintCTToString();
1059 calout << chanstr.c_str();
1060 calout << std::endl;
1062 calout << std::endl;
1065 for(
auto* iter_vec : chanVec) {
1066 iter_vec->PrintCTCoeffs();
1081 for(
auto* iter_vec : chanVec) {
1082 data.append(iter_vec->PrintToString());
1094 TFile* tempf = gFile->CurrentFile();
1102 if(tempf ==
nullptr) {
1112 if(tree ==
nullptr) {
1116 TFile* tempf = tree->GetCurrentFile();
1123 TList* list = tempf->GetListOfKeys();
1125 while(TKey* key =
static_cast<TKey*
>(iter.Next())) {
1126 if((key ==
nullptr) || (strcmp(key->GetClassName(),
"TChannel") != 0)) {
1137 if(!infile.is_open()) {
1138 std::cout <<
DRED <<
"could not open file." <<
RESET_COLOR << std::endl;
1142 infile.seekg(0, std::ios::end);
1143 int64_t length = infile.tellg();
1148 auto* buffer =
new char[length + 1];
1149 infile.seekg(0, std::ios::beg);
1150 infile.read(buffer, length);
1151 buffer[length] =
'\0';
1161 fChannelNumberMap->insert(std::make_pair(mapiter.second->GetNumber(), mapiter.second));
1164 return channelsFound;
1171 std::string infilename(filename);
1173 if(infilename.empty()) {
1177 std::cout <<
"Reading from calibration file: " <<
CYAN << filename <<
RESET_COLOR <<
".....";
1178 std::ifstream infile(infilename.c_str());
1184 return channelsFound;
1191 std::ostringstream buffer;
1192 std::streambuf* std_out = std::cout.rdbuf(buffer.rdbuf());
1195 std::cout.rdbuf(std_out);
1200 std::istringstream infile(inputdata);
1206 int newchannels = 0;
1209 bool brace_open =
false;
1215 while(std::getline(infile, line)) {
1218 size_t comment = line.find(
"//");
1219 if(comment != std::string::npos) {
1220 line = line.substr(0, comment);
1225 size_t openbrace = line.find(
'{');
1226 size_t closebrace = line.find(
'}');
1227 size_t colon = line.find(
':');
1229 if(openbrace == std::string::npos && closebrace == std::string::npos && colon == std::string::npos) {
1234 if(closebrace != std::string::npos) {
1236 if(channel !=
nullptr) {
1238 if(currentchan ==
nullptr) {
1253 if(openbrace != std::string::npos) {
1255 name = line.substr(0, openbrace);
1258 if(!name.empty()) { channel->
SetName(name.c_str()); }
1262 size_t ntype = line.find(
':');
1263 if(ntype != std::string::npos) {
1264 std::string type = line.substr(0, ntype);
1265 line = line.substr(ntype + 1, line.length());
1267 std::istringstream str(line);
1269 std::transform(type.begin(), type.end(), type.begin(), ::toupper);
1270 if(type ==
"NAME") {
1271 channel->
SetName(line.c_str());
1272 }
else if(type ==
"ADDRESS") {
1273 unsigned int tempadd = 0;
1276 std::stringstream newss;
1277 newss << std::hex << line;
1280 tempadd = tempadd & 0x00ffffff;
1282 }
else if(type ==
"INTEGRATION") {
1286 }
else if(type ==
"NUMBER") {
1290 }
else if(type ==
"TIMEOFFSET") {
1291 Long64_t tempoff = 0;
1294 }
else if(type ==
"TIMEDRIFT") {
1295 double tempdrift = 0.;
1298 }
else if(type ==
"STREAM") {
1302 }
else if(type ==
"DIGITIZER") {
1304 }
else if(type ==
"ENGCHI2") {
1305 size_t range = line.find(
"range");
1306 if(range != std::string::npos) {
1307 line = line.substr(range + 5, line.length());
1314 double tempdbl = 0.;
1317 }
else if(type ==
"CFDCHI2") {
1318 double tempdbl = 0.;
1321 }
else if(type ==
"LEDCHI2") {
1322 double tempdbl = 0.;
1325 }
else if(type ==
"TIMECHI2") {
1326 double tempdbl = 0.;
1329 }
else if(type ==
"EFFCHI2") {
1330 double tempdbl = 0.;
1333 }
else if(type ==
"ENGCOEFF") {
1334 size_t range = line.find(
"range");
1335 if(range != std::string::npos) {
1336 line = line.substr(range + 5, line.length());
1348 while(!(str >> value).fail()) {
1351 }
else if(type ==
"ENGRANGE") {
1355 str >> range >> low >> high;
1356 channel->
SetENGRange(std::make_pair(low, high), range);
1357 }
else if(type ==
"ENGDRIFT") {
1360 while(!(str >> value).fail()) {
1363 }
else if(type ==
"LEDCOEFF") {
1367 while(!(str >> value).fail()) {
1370 }
else if(type ==
"CFDCOEFF") {
1374 while(!(str >> value).fail()) {
1377 }
else if(type ==
"TIMECOEFF" || type ==
"WALK") {
1381 while(!(str >> value).fail()) {
1384 }
else if(type ==
"CTCOEFF") {
1388 while(!(str >> value).fail()) {
1391 }
else if(type ==
"ENERGYNONLINEARITY") {
1396 while(!(str >> x >> y).fail()) {
1400 }
else if(type ==
"TIMENONLINEARITY") {
1405 while(!(str >> x >> y).fail()) {
1409 }
else if(type ==
"EFFCOEFF") {
1413 while(!(str >> value).fail()) {
1416 }
else if(type ==
"FILEINT") {
1419 if(tempstream > 0) {
1424 }
else if(type ==
"RISETIME") {
1425 double tempdbl = 0.;
1428 }
else if(type ==
"DECAYTIME") {
1429 double tempdbl = 0.;
1432 }
else if(type ==
"BASELINE") {
1433 double tempdbl = 0.;
1441 if(strcmp(opt,
"q") != 0) {
1442 std::cout <<
"parsed " << linenumber <<
" lines." << std::endl;
1448void TChannel::Streamer(TBuffer& R__b)
1453 if(R__b.IsReading()) {
1454 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1457 TNamed::Streamer(R__b);
1463 R__str.Streamer(R__b);
1467 R__str.Streamer(R__b);
1471 R__b.CheckByteCount(R__s, R__c, TChannel::IsA());
1473 R__c = R__b.WriteVersion(TChannel::IsA(),
true);
1474 TNamed::Streamer(R__b);
1480 R__str.Streamer(R__b);
1482 R__b.SetByteCount(R__c,
true);
1492 TDirectory* savdir = gDirectory;
1494 if(chan ==
nullptr) {
1495 std::cout <<
"No TChannels found to write." << std::endl;
1498 if(fileptr ==
nullptr) {
1499 fileptr = gDirectory->GetFile();
1503 if(fileptr ==
nullptr) {
1504 std::cout <<
"Error, no file provided and no file open (gDirectory = " << gDirectory->GetName() <<
")!" << std::endl;
1508 std::string oldoption = std::string(fileptr->GetOption());
1509 if(oldoption ==
"READ") {
1510 fileptr->ReOpen(
"UPDATE");
1513 std::cout <<
"No file opened to write TChannel to." << std::endl;
1515 TIter iter(gDirectory->GetListOfKeys());
1518 std::string defaultName =
"Channel";
1519 std::string defaultTitle =
"TChannel";
1524 FILE* originalstdout = stdout;
1525 int fd = open(
"/dev/null", O_WRONLY);
1526 stdout = fdopen(fd,
"w");
1528 while(TKey* key =
static_cast<TKey*
>(iter.Next())) {
1529 if((key ==
nullptr) || (strcmp(key->GetClassName(),
"TChannel") != 0)) {
1534 auto* curCh =
static_cast<TChannel*
>(key->ReadObj());
1535 defaultName.assign(curCh->GetName());
1536 defaultTitle.assign(curCh->GetTitle());
1538 std::string cname = key->ReadObj()->GetName();
1540 gDirectory->Delete(cname.c_str());
1544 stdout = originalstdout;
1550 chan->SetNameTitle(defaultName.c_str(), defaultTitle.c_str());
1551 chan->Write(
"Channel", TObject::kOverwrite);
1556 std::cout <<
" " <<
GetNumberOfChannels() <<
" TChannels saved to " << gDirectory->GetFile()->GetName() << std::endl;
1557 if(oldoption ==
"READ") {
1558 std::cout <<
" Returning " << gDirectory->GetFile()->GetName() <<
" to \"READ\" mode." << std::endl;
1559 fileptr->ReOpen(
"READ");
1582 std::string name = GetName();
1583 if(name.length() < 10) {
1586 TString str = name[9];
1590 buf.assign(name, 7, 3);
1644 TList* list = file->GetListOfKeys();
1646 while(TKey* key =
static_cast<TKey*
>(iter.Next())) {
1647 TClass* cls = TClass::GetClass(key->GetClassName());
1648 if(!cls->InheritsFrom(TGraph::Class()) || strncmp(key->GetName(), graphName, strlen(graphName)) != 0) {
1652 std::stringstream str;
1653 str << std::hex << key->GetName() + strlen(graphName);
1654 unsigned int address = 0;
1660 auto* newChannel =
new TChannel(
"");
1661 newChannel->SetAddress(address);
1662 newChannel->fEnergyNonlinearity.Set(*(
static_cast<TGraph*
>(key->ReadObj())),
EPriority::kRootFile);
1663 newChannel->SetupEnergyNonlinearity();
1672 TList* list = file->GetListOfKeys();
1674 while(TKey* key =
static_cast<TKey*
>(iter.Next())) {
1675 TClass* cls = TClass::GetClass(key->GetClassName());
1676 if(!cls->InheritsFrom(TGraph::Class()) || strncmp(key->GetName(), graphName, strlen(graphName)) != 0) {
1680 std::stringstream str;
1681 str << std::hex << key->GetName() + strlen(graphName);
1682 unsigned int address = 0;
1688 auto* newChannel =
new TChannel(
"");
1689 newChannel->SetAddress(address);
1690 newChannel->fTimeNonlinearity.Set(*(
static_cast<TGraph*
>(key->ReadObj())),
EPriority::kRootFile);
1691 newChannel->SetupTimeNonlinearity();
1703 std::cerr << __PRETTY_FUNCTION__ <<
": mnemonic not set, can't set digitizer type and timestamp unit from " <<
fDigitizerTypeString << std::endl;
std::string hex(T val, int width=-1)
void trimWS(std::string &line)
static bool AnyThreadRunning()
TPriorityValue< double > fCFDChi2
Chi2 of the CFD calibration.
TPriorityValue< std::string > fDigitizerTypeString
TPriorityValue< std::vector< double > > fCFDCoefficients
CFD calibration coeffs (low to high order)
void SetWaveDecay(const double &temp)
TPriorityValue< bool > fUseCalFileInt
void SetWaveRise(const double &temp)
void SetENGRanges(const TPriorityValue< std::vector< std::pair< double, double > > > &tmp)
static TChannel * GetDefaultChannel()
double CalibrateENG(double) const
void AddLEDCoefficient(double temp)
TPriorityValue< std::vector< double > > fENGChi2
Chi2 of the energy calibration.
std::vector< double > GetEFFCoeff() const
void AddCFDCoefficient(double temp)
void DestroyTimeNonlinearity()
static int WriteToRoot(TFile *fileptr=nullptr)
static std::unordered_map< unsigned int, int > * fMissingChannelMap
int GetDetectorNumber() const
void SetTimeNonlinearity(const TPriorityValue< TGraph > &tmp)
std::string PrintToString(Option_t *opt="") const
void SetTIMEChi2(const TPriorityValue< double > &tmp)
static std::unordered_map< unsigned int, TChannel * > * GetChannelMap()
std::vector< double > GetTIMECoeff() const
int GetCrystalNumber() const
void AddCTCoefficient(double temp)
static int UpdateChannel(TChannel *, Option_t *opt="")
void SetENGDriftCoefficents(const TPriorityValue< std::vector< Float_t > > &tmp)
static void WriteCalFile(const std::string &outfilename="")
static bool CompareChannels(const TChannel *, const TChannel *)
std::vector< double > GetCTCoeff() const
TPriorityValue< Long64_t > fTimeOffset
TPriorityValue< TGraph > fTimeNonlinearity
static void WriteCalBuffer(Option_t *opt="")
TPriorityValue< std::vector< double > > fCTCoefficients
Cross talk coefficients.
TPriorityValue< TMnemonic * > fMnemonic
static TClassRef fMnemonicClass
void AddEFFCoefficient(double temp)
void SetCTCoefficients(const TPriorityValue< std::vector< double > > &tmp)
void SetTimeDrift(const TPriorityValue< double > &tmp)
static std::unordered_map< unsigned int, TChannel * > * fChannelMap
static void DeleteAllChannels()
void SetCFDChi2(const TPriorityValue< double > &tmp)
static Int_t ParseInputData(const char *inputdata="", Option_t *opt="", EPriority prio=EPriority::kUser)
void SetAllENGCoefficients(const TPriorityValue< std::vector< std::vector< Float_t > > > &tmp)
void SetLEDCoefficients(const TPriorityValue< std::vector< double > > &tmp)
void OverWriteChannel(TChannel *)
std::vector< double > GetLEDCoeff() const
void SetStream(const TPriorityValue< int > &tmp)
void SetLEDChi2(const TPriorityValue< double > &tmp)
void SetSegmentNumber(int tempint)
double CalibrateLED(double) const
void SetAddress(unsigned int tmpadd)
void SetTimeOffset(const TPriorityValue< Long64_t > &tmp)
double GetTime(Long64_t timestamp, Float_t cfd, double energy) const
void SetClassType(TClass *cl_type)
void SetTIMECoefficients(const TPriorityValue< std::vector< double > > &tmp)
TPriorityValue< std::vector< double > > fTIMECoefficients
Time calibration coeffs (low to high order)
int GetSegmentNumber() const
unsigned int GetAddress() const
void SetEFFCoefficients(const TPriorityValue< std::vector< double > > &tmp)
void AddTimeNonlinearityPoint(double x, double y)
const TMnemonic * GetMnemonic() const
TPriorityValue< std::vector< Float_t > > fENGDriftCoefficents
Energy drift coefficents (applied after energy calibration has been applied)
static Int_t ReadCalFromCurrentFile(Option_t *opt="overwrite")
static TChannel * FindChannelByName(const char *ccName)
static Int_t ReadCalFile(std::ifstream &infile)
void SetUseCalFileIntegration(const TPriorityValue< bool > &tmp=TPriorityValue< bool >(true, EPriority::kUser))
TGraph GetEnergyNonlinearity() const
static std::unordered_map< int, TChannel * > * fChannelNumberMap
std::vector< Float_t > GetENGDriftCoefficents() const
WaveFormShapePar WaveFormShape
static Int_t ReadCalFromFile(TFile *tempf, Option_t *opt="overwrite")
static void ReadTimeNonlinearities(TFile *, const char *graphName="TimeNonlinearity0x", bool all=false)
void SetENGChi2(const TPriorityValue< double > &tmp, const size_t &range=0)
std::string PrintCTToString(Option_t *opt="") const
bool UseCalFileIntegration()
double CalibrateTIME(double) const
TPriorityValue< EDigitizer > fDigitizerType
std::vector< double > GetAllENGChi2() const
void AddENGDriftCoefficent(Float_t temp)
static std::vector< TChannel * > SortedChannels()
static TChannel * GetChannel(unsigned int temp_address, bool warn=false)
TChannel & operator=(const TChannel &rhs)
std::vector< double > GetCFDCoeff() const
double CalibrateEFF(double) const
void SetupEnergyNonlinearity()
void AppendChannel(TChannel *)
Long64_t GetTimeOffset() const
TGraph GetTimeNonlinearity() const
TClass * GetClassType() const
double GetTimeDrift() const
TPriorityValue< int > fStream
TPriorityValue< double > fEFFChi2
Chi2 of Efficiency calibration.
static Int_t ReadCalFromTree(TTree *, Option_t *opt="overwrite")
TPriorityValue< double > fTimeDrift
Time drift factor.
TPriorityValue< std::vector< std::pair< double, double > > > fENGRanges
Range of energy calibrations.
static void WriteCTCorrections(const std::string &outfilename="")
void SetupTimeNonlinearity()
TPriorityValue< int > fIntegration
void Print(Option_t *opt="") const override
void DestroyCalibrations()
void PrintCTCoeffs(Option_t *opt="") const
void SetIntegration(const TPriorityValue< int > &tmp)
TPriorityValue< int > fTimeStampUnit
void Clear(Option_t *opt="") override
TPriorityValue< double > fTIMEChi2
Chi2 of the Time calibration.
double CalibrateCFD(double) const
double GetTIMEChi2() const
void SetNumber(const TPriorityValue< int > &tmp)
void AddTIMECoefficient(double temp)
TPriorityValue< double > fLEDChi2
Chi2 of LED calibration.
std::vector< std::vector< Float_t > > GetAllENGCoeff() const
TPriorityValue< std::vector< std::vector< Float_t > > > fENGCoefficients
Energy calibration coeffs (low to high order)
double GetLEDChi2() const
static TChannel * GetChannelByNumber(int temp_num)
void AddENGCoefficient(Float_t temp, size_t range=0)
static Int_t ReadFile(TFile *tempf)
static void InitChannelInput()
const char * GetDigitizerTypeString() const
void SetName(const char *tmpName) override
void SetCrystalNumber(int tempint)
TPriorityValue< TGraph > fEnergyNonlinearity
Energy nonlinearity as TGraph, is used as E=E+GetEnergyNonlinearity(E), so y should be E(source)-cali...
void SetDetectorNumber(int tempint)
void DestroyEnergyNonlinearity()
void AddEnergyNonlinearityPoint(double x, double y)
TPriorityValue< std::vector< double > > fLEDCoefficients
LED calibration coeffs (low to high order)
TPriorityValue< int > fNumber
TPriorityValue< std::vector< double > > fEFFCoefficients
Efficiency calibration coeffs (low to high order)
bool UseWaveParam() const
double GetCFDChi2() const
double GetEFFChi2() const
static void AddChannel(TChannel *, Option_t *opt="")
void SetAllENGChi2(const TPriorityValue< std::vector< double > > &tmp)
static size_t GetNumberOfChannels()
void SetWaveParam(WaveFormShapePar temp)
static void ReadEnergyNonlinearities(TFile *, const char *graphName="EnergyNonlinearity0x", bool all=false)
void SetEnergyNonlinearity(const TPriorityValue< TGraph > &tmp)
static std::vector< TChannel * > FindChannelByRegEx(const char *ccName)
void SetENGRange(const std::pair< double, double > &tmp, const size_t &range)
void SetWaveBaseLine(double temp)
int GetIntegration() const
void SetDigitizerType(const TPriorityValue< std::string > &tmp)
static std::string fFileData
void SetCFDCoefficients(const TPriorityValue< std::vector< double > > &tmp)
std::vector< std::pair< double, double > > GetENGRanges() const
void SetEFFChi2(const TPriorityValue< double > &tmp)
WaveFormShapePar GetWaveParam() const
virtual int NumericArraySubPosition() const
virtual void EnumerateDigitizer(TPriorityValue< std::string > &, TPriorityValue< EDigitizer > &, TPriorityValue< int > &)
virtual void Parse(std::string *name)
void Clear(Option_t *opt="") override
virtual TClass * GetClassType() const
virtual void SetClassType(TClass *classType) const
virtual double GetTime(Long64_t timestamp, Float_t cfd, double energy, const TChannel *channel) const
void Set(const T &val, EPriority priority)
void SetPriority(EPriority priority)