9#include <unordered_map>
33std::unordered_map<unsigned int, TChannel*>*
TChannel::fChannelMap =
new std::unordered_map<unsigned int, TChannel*>;
53 if(strlen(tempName) > 0) {
SetName(tempName); }
97 *(fMnemonic.Value()) = *(chan.fMnemonic.Value());
98 SetAddress(chan.GetAddress());
99 SetIntegration(chan.fIntegration);
100 SetNumber(chan.fNumber);
101 SetStream(chan.fStream);
102 SetName(chan.GetName());
103 SetDigitizerType(chan.fDigitizerTypeString);
104 SetTimeOffset(chan.fTimeOffset);
105 SetTimeDrift(chan.fTimeDrift);
106 SetAllENGCoefficients(chan.fENGCoefficients);
107 SetENGRanges(chan.fENGRanges);
108 SetAllENGChi2(chan.fENGChi2);
109 SetENGDriftCoefficents(chan.fENGDriftCoefficents);
110 SetCFDCoefficients(chan.fCFDCoefficients);
111 SetLEDCoefficients(chan.fLEDCoefficients);
112 SetTIMECoefficients(chan.fTIMECoefficients);
113 SetEFFCoefficients(chan.fEFFCoefficients);
114 SetCTCoefficients(chan.fCTCoefficients);
115 SetEnergyNonlinearity(chan.fEnergyNonlinearity);
116 SetCFDChi2(chan.fCFDChi2);
117 SetLEDChi2(chan.fLEDChi2);
118 SetTIMEChi2(chan.fTIMEChi2);
119 SetEFFChi2(chan.fEFFChi2);
120 SetUseCalFileIntegration(chan.fUseCalFileInt);
121 SetWaveParam(chan.GetWaveParam());
122 SetDetectorNumber(chan.GetDetectorNumber());
123 SetSegmentNumber(chan.GetSegmentNumber());
124 SetCrystalNumber(chan.GetCrystalNumber());
126 SetClassType(chan.GetClassType());
210 *(fMnemonic.Value()) = *(rhs.fMnemonic.Value());
211 SetAddress(rhs.GetAddress());
212 SetIntegration(rhs.fIntegration);
213 SetNumber(rhs.fNumber);
214 SetStream(rhs.fStream);
215 SetName(rhs.GetName());
216 SetDigitizerType(rhs.fDigitizerTypeString);
217 SetTimeOffset(rhs.fTimeOffset);
218 SetTimeDrift(rhs.fTimeDrift);
219 SetAllENGCoefficients(rhs.fENGCoefficients);
220 SetENGRanges(rhs.fENGRanges);
221 SetAllENGChi2(rhs.fENGChi2);
222 SetENGDriftCoefficents(rhs.fENGDriftCoefficents);
223 SetCFDCoefficients(rhs.fCFDCoefficients);
224 SetLEDCoefficients(rhs.fLEDCoefficients);
225 SetTIMECoefficients(rhs.fTIMECoefficients);
226 SetEFFCoefficients(rhs.fEFFCoefficients);
227 SetCTCoefficients(rhs.fCTCoefficients);
228 SetEnergyNonlinearity(rhs.fEnergyNonlinearity);
229 SetCFDChi2(rhs.fCFDChi2);
230 SetLEDChi2(rhs.fLEDChi2);
231 SetTIMEChi2(rhs.fTIMEChi2);
232 SetEFFChi2(rhs.fEFFChi2);
233 SetUseCalFileIntegration(rhs.fUseCalFileInt);
234 SetWaveParam(rhs.GetWaveParam());
235 SetDetectorNumber(rhs.GetDetectorNumber());
236 SetSegmentNumber(rhs.GetSegmentNumber());
237 SetCrystalNumber(rhs.GetCrystalNumber());
239 SetClassType(rhs.GetClassType());
246 if(strlen(tmpName) == 0) {
return; }
247 TNamed::SetName(tmpName);
249 if(strcmp(tmpName,
"DefaultTChannel") != 0) {
257 if(gFile !=
nullptr) {
258 std::cout <<
"Successfully read " << channels_found <<
" TChannels from " <<
CYAN << gFile->GetName() <<
RESET_COLOR << std::endl;
260 std::cout <<
"Successfully read " << channels_found <<
" TChannels" << std::endl;
268 std::string namea(chana->GetName());
270 return namea.compare(chanb->GetName()) < 0;
279 iter.second =
nullptr;
293 if(chan ==
nullptr) {
297 if(strcmp(opt,
"overwrite") == 0) {
311 std::cout <<
"Trying to add a channel that already exists!" << std::endl;
314 if((chan->
GetAddress() & 0x00ffffff) == 0x00ffffff) {
371 if(strcmp(chan->GetName(),
"DefaultTChannel") != 0) {
SetName(chan->GetName()); }
401 if(chan ==
nullptr) {
405 if(oldchan ==
nullptr) {
444 fENGRanges.Reset(std::vector<std::pair<double, double>>());
445 fENGChi2.Reset(std::vector<double>());
467 if(warn && chan ==
nullptr) {
471 std::ostringstream str;
472 str <<
RED <<
"Failed to find channel for address " <<
hex(temp_address, 4) <<
", this channel won't get sorted properly!" <<
RESET_COLOR << std::endl;
473 std::cerr << str.str();
477 ++(*fMissingChannelMap)[temp_address];
488 }
catch(
const std::out_of_range& oor) {
498 if(ccName ==
nullptr) {
502 std::string name = ccName;
503 if(name.length() == 0) {
509 std::string channelName = chan->GetName();
510 if(channelName.compare(0, name.length(), name) == 0) {
521 std::vector<TChannel*> result;
522 if(ccName ==
nullptr) {
526 std::regex regex(ccName);
531 std::string channelName = chan->GetName();
532 if(std::regex_match(channelName, regex)) {
533 result.push_back(chan);
544 if(iter1.second ==
this) {
545 std::cout <<
"Channel at address: " <<
hex(
fAddress, 4)
546 <<
" already exists. Please use AddChannel() or OverWriteChannel() to change this TChannel"
547 << std::dec << std::endl;
622 return CalibrateENG(
static_cast<double>(charge) + gRandom->Uniform(), temp_int);
643 return CalibrateENG((charge) /
static_cast<double>(temp_int));
656 size_t currentRange = 0;
662 bool foundRange =
false;
663 for(currentRange = 0; currentRange + 1 <
fENGRanges.size(); ++currentRange) {
665 if(
fENGRanges.Value()[currentRange].first < charge && charge <
fENGRanges.Value()[currentRange].second) {
667 if(
fENGRanges.Value()[currentRange + 1].first < charge && charge <
fENGRanges.Value()[currentRange + 1].second &&
668 gRandom->Uniform() > 0.5) {
678 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;
694 cal_chg +=
fENGCoefficients[currentRange][i] * pow((charge),
static_cast<double>(i));
702 return CalibrateCFD(
static_cast<double>(cfd) + gRandom->Uniform());
713 double cal_cfd = 0.0;
727 return CalibrateLED(
static_cast<double>(led) + gRandom->Uniform());
738 double cal_led = 0.0;
763 double timeCorrection = 0.0;
767 return timeCorrection;
781 std::unordered_map<unsigned int, TChannel*>::iterator mapit;
783 for(mapit = chanmap->begin(); mapit != chanmap->end(); mapit++) {
784 if(mnemonic.empty() || (strncmp(mapit->second->GetName(), mnemonic.c_str(), mnemonic.size()) == 0)) {
795 std::unordered_map<unsigned int, TChannel*>::iterator mapit;
797 for(mapit = chanmap->begin(); mapit != chanmap->end(); mapit++) {
798 if(mnemonic.empty() || (strncmp(mapit->second->GetName(), mnemonic.c_str(), mnemonic.size()) == 0)) {
809 std::unordered_map<unsigned int, TChannel*>::iterator mapit;
811 for(mapit = chanmap->begin(); mapit != chanmap->end(); mapit++) {
812 if(mnemonic.empty() || (strncmp(mapit->second->GetName(), mnemonic.c_str(), mnemonic.size()) == 0)) {
821 std::cout << GetName() <<
"\t{\n";
822 std::cout <<
"Name: " << GetName() << std::endl;
823 std::cout <<
"Number: " <<
fNumber << std::endl;
824 std::cout <<
"Address: " <<
hex(
fAddress, 8) << std::endl;
826 std::cout << fCTCoefficient <<
"\t";
828 std::cout << std::endl;
830 std::cout <<
"//====================================//\n";
843 buffer.append(GetName());
844 buffer.append(
"\t{\n");
845 buffer.append(
"Name: ");
846 buffer.append(GetName());
849 buffer.append(Form(
"Address: 0x%08x\n",
fAddress));
851 buffer.append(
"CTCoeff: ");
853 buffer.append(Form(
"%f\t", fCTCoefficient));
857 buffer.append(
"}\n");
859 buffer.append(
"//====================================//\n");
866 std::ostringstream str;
868 str << GetName() <<
"\t{" << std::endl;
873 str <<
"None" << std::endl;
876 str <<
"Name: " << GetName() << std::endl;
877 str <<
"Number: " <<
fNumber << std::endl;
878 str <<
"Address: " <<
hex(
fAddress, 4) << std::dec << std::endl;
883 str <<
"TimeDrift: " <<
fTimeDrift << std::endl;
890 str <<
"ENGCoeff: range " << i <<
"\t";
893 str << coeff <<
"\t";
899 for(
size_t i = 0; i <
fENGChi2.size(); ++i) {
901 str <<
"ENGChi2: " <<
fENGChi2[i] << std::endl;
903 str <<
"ENGChi2: range " << i <<
"\t" <<
fENGChi2[i] << std::endl;
908 for(
size_t i = 0; i <
fENGRanges.size(); ++i) {
909 str <<
"ENGRange: " << i <<
"\t" <<
fENGRanges[i].first <<
" " <<
fENGRanges[i].second << std::endl;
914 auto oldPrecision = str.precision();
917 str << coeff <<
"\t";
919 str.precision(oldPrecision);
925 str << coeff <<
"\t";
930 str <<
"EFFChi2: " <<
fEFFChi2 << std::endl;
935 str << coeff <<
"\t";
940 str <<
"EnergyNonlinearity: ";
944 str << x[i] <<
"\t" << y[i] <<
"\t";
951 str << coeff <<
"\t";
956 str <<
"TIMECoeff: ";
958 str << coeff <<
"\t";
970 str <<
"}" << std::endl;
971 str <<
"//====================================//" << std::endl;
972 std::string buffer = str.str();
979 std::vector<TChannel*> chanVec;
981 if(iter.second !=
nullptr) {
982 chanVec.push_back(iter.second);
1001 if(outfilename.length() > 0) {
1002 std::ofstream calout;
1003 calout.open(outfilename.c_str());
1004 for(
auto* iter_vec : chanVec) {
1005 std::string chanstr = iter_vec->PrintToString();
1006 calout << chanstr.c_str();
1007 calout << std::endl;
1009 calout << std::endl;
1012 for(
auto* iter_vec : chanVec) {
1022 if(outfilename.length() > 0) {
1023 std::ofstream calout;
1024 calout.open(outfilename.c_str());
1025 for(
auto* iter_vec : chanVec) {
1026 if(iter_vec->fCTCoefficients.empty()) {
continue; }
1027 std::string chanstr = iter_vec->PrintCTToString();
1028 calout << chanstr.c_str();
1029 calout << std::endl;
1031 calout << std::endl;
1034 for(
auto* iter_vec : chanVec) {
1035 iter_vec->PrintCTCoeffs();
1050 for(
auto* iter_vec : chanVec) {
1051 data.append(iter_vec->PrintToString());
1063 TFile* tempf = gFile->CurrentFile();
1071 if(tempf ==
nullptr) {
1081 if(tree ==
nullptr) {
1085 TFile* tempf = tree->GetCurrentFile();
1092 TList* list = tempf->GetListOfKeys();
1094 while(TKey* key =
static_cast<TKey*
>(iter.Next())) {
1095 if((key ==
nullptr) || (strcmp(key->GetClassName(),
"TChannel") != 0)) {
1106 if(!infile.is_open()) {
1107 std::cout <<
DRED <<
"could not open file." <<
RESET_COLOR << std::endl;
1111 infile.seekg(0, std::ios::end);
1112 int64_t length = infile.tellg();
1117 auto* buffer =
new char[length + 1];
1118 infile.seekg(0, std::ios::beg);
1119 infile.read(buffer, length);
1120 buffer[length] =
'\0';
1128 fChannelNumberMap->insert(std::make_pair(mapiter.second->GetNumber(), mapiter.second));
1131 return channelsFound;
1138 std::string infilename(filename);
1140 if(infilename.length() == 0) {
1144 std::cout <<
"Reading from calibration file: " <<
CYAN << filename <<
RESET_COLOR <<
".....";
1145 std::ifstream infile(infilename.c_str());
1151 return channelsFound;
1158 std::ostringstream buffer;
1159 std::streambuf* std_out = std::cout.rdbuf(buffer.rdbuf());
1162 std::cout.rdbuf(std_out);
1167 std::istringstream infile(inputdata);
1173 int newchannels = 0;
1176 bool brace_open =
false;
1182 while(std::getline(infile, line)) {
1185 size_t comment = line.find(
"//");
1186 if(comment != std::string::npos) {
1187 line = line.substr(0, comment);
1189 if(line.length() == 0u) {
1192 size_t openbrace = line.find(
'{');
1193 size_t closebrace = line.find(
'}');
1194 size_t colon = line.find(
':');
1196 if(openbrace == std::string::npos && closebrace == std::string::npos && colon == std::string::npos) {
1201 if(closebrace != std::string::npos) {
1203 if(channel !=
nullptr) {
1205 if(currentchan ==
nullptr) {
1220 if(openbrace != std::string::npos) {
1222 name = line.substr(0, openbrace);
1225 if(!name.empty()) { channel->
SetName(name.c_str()); }
1229 size_t ntype = line.find(
':');
1230 if(ntype != std::string::npos) {
1231 std::string type = line.substr(0, ntype);
1232 line = line.substr(ntype + 1, line.length());
1234 std::istringstream str(line);
1236 std::transform(type.begin(), type.end(), type.begin(), ::toupper);
1237 if(type ==
"NAME") {
1238 channel->
SetName(line.c_str());
1239 }
else if(type ==
"ADDRESS") {
1240 unsigned int tempadd = 0;
1243 std::stringstream newss;
1244 newss << std::hex << line;
1247 tempadd = tempadd & 0x00ffffff;
1249 }
else if(type ==
"INTEGRATION") {
1253 }
else if(type ==
"NUMBER") {
1257 }
else if(type ==
"TIMEOFFSET") {
1258 Long64_t tempoff = 0;
1261 }
else if(type ==
"TIMEDRIFT") {
1262 double tempdrift = 0.;
1265 }
else if(type ==
"STREAM") {
1269 }
else if(type ==
"DIGITIZER") {
1271 }
else if(type ==
"ENGCHI2") {
1272 size_t range = line.find(
"range");
1273 if(range != std::string::npos) {
1274 line = line.substr(range + 5, line.length());
1281 double tempdbl = 0.;
1284 }
else if(type ==
"CFDCHI2") {
1285 double tempdbl = 0.;
1288 }
else if(type ==
"LEDCHI2") {
1289 double tempdbl = 0.;
1292 }
else if(type ==
"TIMECHI2") {
1293 double tempdbl = 0.;
1296 }
else if(type ==
"EFFCHI2") {
1297 double tempdbl = 0.;
1300 }
else if(type ==
"ENGCOEFF") {
1301 size_t range = line.find(
"range");
1302 if(range != std::string::npos) {
1303 line = line.substr(range + 5, line.length());
1315 while(!(str >> value).fail()) {
1318 }
else if(type ==
"ENGRANGE") {
1322 str >> range >> low >> high;
1323 channel->
SetENGRange(std::make_pair(low, high), range);
1324 }
else if(type ==
"ENGDRIFT") {
1327 while(!(str >> value).fail()) {
1330 }
else if(type ==
"LEDCOEFF") {
1334 while(!(str >> value).fail()) {
1337 }
else if(type ==
"CFDCOEFF") {
1341 while(!(str >> value).fail()) {
1344 }
else if(type ==
"TIMECOEFF" || type ==
"WALK") {
1348 while(!(str >> value).fail()) {
1351 }
else if(type ==
"CTCOEFF") {
1355 while(!(str >> value).fail()) {
1358 }
else if(type ==
"ENERGYNONLINEARITY") {
1363 while(!(str >> x >> y).fail()) {
1367 }
else if(type ==
"EFFCOEFF") {
1371 while(!(str >> value).fail()) {
1374 }
else if(type ==
"FILEINT") {
1377 if(tempstream > 0) {
1382 }
else if(type ==
"RISETIME") {
1383 double tempdbl = 0.;
1386 }
else if(type ==
"DECAYTIME") {
1387 double tempdbl = 0.;
1390 }
else if(type ==
"BASELINE") {
1391 double tempdbl = 0.;
1399 if(strcmp(opt,
"q") != 0) {
1400 std::cout <<
"parsed " << linenumber <<
" lines." << std::endl;
1406void TChannel::Streamer(TBuffer& R__b)
1411 if(R__b.IsReading()) {
1412 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1415 TNamed::Streamer(R__b);
1421 R__str.Streamer(R__b);
1425 R__str.Streamer(R__b);
1429 R__b.CheckByteCount(R__s, R__c, TChannel::IsA());
1431 R__c = R__b.WriteVersion(TChannel::IsA(),
true);
1432 TNamed::Streamer(R__b);
1438 R__str.Streamer(R__b);
1440 R__b.SetByteCount(R__c,
true);
1450 TDirectory* savdir = gDirectory;
1452 if(chan ==
nullptr) {
1453 std::cout <<
"No TChannels found to write." << std::endl;
1456 if(fileptr ==
nullptr) {
1457 fileptr = gDirectory->GetFile();
1461 if(fileptr ==
nullptr) {
1462 std::cout <<
"Error, no file provided and no file open (gDirectory = " << gDirectory->GetName() <<
")!" << std::endl;
1466 std::string oldoption = std::string(fileptr->GetOption());
1467 if(oldoption ==
"READ") {
1468 fileptr->ReOpen(
"UPDATE");
1471 std::cout <<
"No file opened to write TChannel to." << std::endl;
1473 TIter iter(gDirectory->GetListOfKeys());
1476 std::string defaultName =
"Channel";
1477 std::string defaultTitle =
"TChannel";
1482 FILE* originalstdout = stdout;
1483 int fd = open(
"/dev/null", O_WRONLY);
1484 stdout = fdopen(fd,
"w");
1486 while(TKey* key =
static_cast<TKey*
>(iter.Next())) {
1487 if((key ==
nullptr) || (strcmp(key->GetClassName(),
"TChannel") != 0)) {
1492 auto* curCh =
static_cast<TChannel*
>(key->ReadObj());
1493 defaultName.assign(curCh->GetName());
1494 defaultTitle.assign(curCh->GetTitle());
1496 std::string cname = key->ReadObj()->GetName();
1498 gDirectory->Delete(cname.c_str());
1502 stdout = originalstdout;
1508 chan->SetNameTitle(defaultName.c_str(), defaultTitle.c_str());
1509 chan->Write(
"Channel", TObject::kOverwrite);
1514 std::cout <<
" " <<
GetNumberOfChannels() <<
" TChannels saved to " << gDirectory->GetFile()->GetName() << std::endl;
1515 if(oldoption ==
"READ") {
1516 std::cout <<
" Returning " << gDirectory->GetFile()->GetName() <<
" to \"READ\" mode." << std::endl;
1517 fileptr->ReOpen(
"READ");
1540 std::string name = GetName();
1541 if(name.length() < 10) {
1544 TString str = name[9];
1548 buf.assign(name, 7, 3);
1587 TList* list = file->GetListOfKeys();
1589 while(TKey* key =
static_cast<TKey*
>(iter.Next())) {
1590 TClass* cls = TClass::GetClass(key->GetClassName());
1591 if(!cls->InheritsFrom(TGraph::Class()) || strncmp(key->GetName(), graphName, strlen(graphName)) != 0) {
1595 std::stringstream str;
1596 str << std::hex << key->GetName() + strlen(graphName);
1597 unsigned int address = 0;
1603 auto* newChannel =
new TChannel(
"");
1604 newChannel->SetAddress(address);
1605 newChannel->fEnergyNonlinearity.Set(*(
static_cast<TGraph*
>(key->ReadObj())),
EPriority::kRootFile);
1606 newChannel->SetupEnergyNonlinearity();
1618 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)
static int WriteToRoot(TFile *fileptr=nullptr)
static std::unordered_map< unsigned int, int > * fMissingChannelMap
int GetDetectorNumber() const
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
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)
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")
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
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="")
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)
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)