BmnRoot 26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Loading...
Searching...
No Matches
BmnFunctionSet.cxx
Go to the documentation of this file.
1#include "BmnFunctionSet.h"
2
3#include "FairFileHeader.h"
4#include "FairLogger.h"
5#include "FairRootManager.h"
6#include "TChain.h"
7#include "TChainElement.h"
8#include "TKey.h"
9#include "TObjString.h"
10#include "TPRegexp.h"
11#include "TSystem.h"
12#include "TTree.h"
13
14#include <TMath.h>
15#include <fstream>
16#include <iomanip>
17#include <iostream>
18#include <sstream>
19using namespace std;
20using namespace std::chrono;
21using namespace std::chrono_literals;
22
23// check whether file exists: 1 - exists, 0 - not exists, -1 - exists but cannot access with the mode (default:
24// kFileExists)
25int BmnFunctionSet::CheckFileExist(TString& fileName, int iVerbose, EAccessMode mode)
26{
27 gSystem->ExpandPathName(fileName);
28 if (gSystem->AccessPathName(fileName.Data(), kFileExists) == true) {
29 if (iVerbose)
30 cout << "ERROR: no specified file: " << fileName << endl;
31 return 0;
32 }
33 if ((mode != kFileExists) && (gSystem->AccessPathName(fileName.Data(), mode) == true)) {
34 if (iVerbose)
35 cout << "ERROR: no required permissions to access the file: " << fileName << endl;
36 return -1;
37 }
38
39 return 1;
40}
41
42// check whether directory exists: 1 - exists, 0 - not exists, -1 - exists but cannot access with the mode (default:
43// kFileExists)
45{
46 gSystem->ExpandPathName(fileName);
47 TString dirName(gSystem->DirName(fileName.Data()));
48 if (gSystem->AccessPathName(dirName.Data(), kFileExists) == true) {
49 if (iVerbose)
50 cout << "ERROR: no specified directory: " << dirName << endl;
51 return 0;
52 }
53 if ((mode != kFileExists) && (gSystem->AccessPathName(dirName.Data(), mode) == true)) {
54 if (iVerbose)
55 cout << "ERROR: no required permissions to access the directory: " << dirName << endl;
56 return -1;
57 }
58
59 return 1;
60}
61
62// create directory tree for the file name if not exists: 1 - exists, 0 - created
63// error codes: -1 - exists but cannot access with the mode (default: kWritePermission), -2 - cannot be created, -3 -
64// empty file name
66{
67 if (fileName == "") {
68 if (iVerbose)
69 cout << "ERROR: the specified file name is empty" << endl;
70 return -3;
71 }
72
73 int status = CheckDirectoryExist(fileName, 0, mode);
74 if (status < 0) {
75 if (iVerbose)
76 cout << "ERROR: the directory of the specified file (\"" << fileName
77 << "\") does not provide required permissions" << endl;
78 return status;
79 }
80 if (status == 0) {
81 TString dirName(gSystem->DirName(fileName.Data()));
82 int status_parent = CreateDirectoryTree(dirName, 0, mode);
83 if (status_parent < 0)
84 return status_parent;
85 if (gSystem->MakeDirectory(dirName) != 0) {
86 if (iVerbose)
87 cout << "ERROR: the directory of the specified file (\"" << fileName << "\") could not be created"
88 << endl;
89 return -2;
90 }
91 return 0;
92 }
93
94 return 1;
95}
96
97// get the list of input ROOT files for the given input file, which can be a ROOT file with data, a ROOT file with
98// a TChain object or a text file (extension is not '.root') with a list of ROOT files
99// return value: number of files in the list, < 0 - error codes
100int BmnFunctionSet::GetInputFileList(TString inputFileName, vector<TString>& fileList)
101{
102 fileList.clear();
103 if (CheckFileExist(inputFileName) != 1) {
104 LOG(error) << "BmnFunctionSet::GetInputFileList: no specified file: " << inputFileName;
105 return -1;
106 }
107
108 if (inputFileName.EndsWith(".root")) {
109 TFile* rootFile = TFile::Open(inputFileName.Data());
110 if (!rootFile || rootFile->IsZombie()) {
111 LOG(error) << "BmnFunctionSet::GetInputFileList: opening the ROOT file failed: " << inputFileName;
112 delete rootFile;
113 return -2;
114 }
115
116 // search for a TChain object, otherwise the ROOT file itself contains the data
117 TChain* chain = nullptr;
118 TIter next(rootFile->GetListOfKeys());
119 TKey* key;
120 while ((key = (TKey*)next()) != nullptr) {
121 if (strcmp(key->GetClassName(), "TChain") == 0) {
122 chain = rootFile->Get<TChain>(key->GetName());
123 break;
124 }
125 }
126 if (chain == nullptr)
127 fileList.push_back(inputFileName);
128 else {
129 TIter nextElement(chain->GetListOfFiles());
130 TChainElement* element;
131 while ((element = (TChainElement*)nextElement()) != nullptr)
132 fileList.push_back(element->GetTitle());
133 }
134 rootFile->Close(); // the chain object is deleted together with the file
135 delete rootFile;
136 } else {
137 ifstream listFile(inputFileName.Data());
138 if (!listFile.is_open()) {
139 LOG(error) << "BmnFunctionSet::GetInputFileList: the file list could not be opened: " << inputFileName;
140 return -2;
141 }
142
143 string line;
144 while (getline(listFile, line)) {
145 istringstream lineStream(line);
146 string word;
147 if ((lineStream >> word) && (word[0] != '#'))
148 fileList.push_back(word);
149 }
150 }
151
152 // the check also expands the paths, so the files can be given as, e.g., "$VMCWORKDIR/bmndst.root"
153 for (auto& fileName : fileList) {
154 if (CheckFileExist(fileName) != 1) {
155 LOG(error) << "BmnFunctionSet::GetInputFileList: no specified file: " << fileName << " (listed in "
156 << inputFileName << ")";
157 fileList.clear();
158 return -3;
159 }
160 }
161 if (fileList.empty()) {
162 LOG(error) << "BmnFunctionSet::GetInputFileList: no input files found in: " << inputFileName;
163 return -4;
164 }
165
166 return fileList.size();
167}
168
170{
171 TFile* fRootFile = nullptr;
172 if (fileName == "") {
173 FairRootManager* ioman = FairRootManager::Instance();
174 if (ioman == nullptr) {
175 LOG(error) << "isSimulationFile(): FairRootManager is not instantiated";
176 return -1;
177 }
178 TTree* cur_tree = ioman->GetInTree();
179 if (cur_tree == nullptr) {
180 LOG(error) << "isSimulationFile(): There is no current tree opened";
181 return -2;
182 }
183
184 fRootFile = cur_tree->GetCurrentFile();
185 } else {
186 gSystem->ExpandPathName(fileName);
187 if (gSystem->AccessPathName(fileName.Data()) == true) {
188 LOG(error) << "isSimulationFile(): no specified file: " << fileName;
189 return -3;
190 }
191
192 fRootFile = TFile::Open(fileName.Data());
193 if (!fRootFile || fRootFile->IsZombie()) {
194 LOG(error) << "isSimulationFile(): opening the input file failed: " << fileName;
195 if (fRootFile) {
196 fRootFile->Close();
197 delete fRootFile;
198 }
199 return -4;
200 }
201 }
202
203 TObject* branch_list = fRootFile->Get("BranchList");
204 if (branch_list != nullptr) {
205 TObject* mctrack_find = branch_list->FindObject("MCTrack");
206 if (mctrack_find != nullptr) {
207 if (fileName != "") {
208 fRootFile->Close();
209 delete fRootFile;
210 }
211
212 return 1;
213 }
214 }
215
216 if (fileName != "") {
217 fRootFile->Close();
218 delete fRootFile;
219 }
220 return 0;
221}
222
223int BmnFunctionSet::GetPeriodNumber(TFile* root_file, int method_number)
224{
225 if (!root_file || root_file->IsZombie()) {
226 LOG(error) << "BmnFunctionSet::GetPeriodNumber: ROOT-file is not opened " << root_file->GetName();
227 return -2;
228 }
229
230 int period_number = -1;
231 switch (method_number) {
232 // method number: 0
233 case 0: {
234 TIter next(root_file->GetListOfKeys());
235 TKey* key;
236 while ((key = (TKey*)next())) {
237 if (std::string(key->GetClassName()) == "FairRtdbRun") {
238 TString str_period_number = key->GetName();
239 if (str_period_number.IsDigit()) {
240 period_number = str_period_number.Atoi();
241 break;
242 } // if (str_period_number.IsDigit())
243 } // if "FairRtdbRun" class
244 } // while TKey*)next()
245
246 if (period_number == -1) {
247 LOG(error) << "BmnFunctionSet::GetPeriodNumber: FairRtdbRun object not found in ROOT-file "
248 << root_file->GetName();
249 return -3;
250 }
251 return period_number;
252 } // method number == 0
253 // method number: 1
254 case 1: {
255 FairFileHeader* header = root_file->Get<FairFileHeader>("FileHeader");
256 if (!header) {
257 LOG(error) << "BmnFunctionSet::GetPeriodNumber: 'FileHeader' branch not found in ROOT-file "
258 << root_file->GetName();
259 return -4;
260 }
261
262 period_number = (int)header->GetRunId();
263 return period_number;
264 }
265 default:
266 return -5;
267 }
268
269 return -6;
270}
271
272TString BmnFunctionSet::JoinKeys(const std::vector<std::pair<TString, TString>>& dict)
273{
274 TString result;
275 for (size_t i = 0; i < dict.size(); ++i) {
276 if (i > 0)
277 result += "|";
278 result += dict[i].first;
279 }
280 return result;
281}
282
283// get magnetic field value (mV) for the given beam and its energy (e.g. parsed by ParseFileName)
284// beam: beam particle name; energy: beam energy (GeV)
285// return value: magnetic field value (mV), < 0 - in case of errors
286double BmnFunctionSet::GetMagneticFieldByEnergy(const TString& beam, double energy)
287{
288 double field_value = -1;
289 if (beam == "Xe") {
290 // comparison tolerance between doubles
291 const Double_t kEnergyTolerance = 1e-4;
292 // known energy -> field value in mV
293 const vector<pair<Double_t, Double_t>> energy_to_field = {{1.6, 51.5}, {2.2, 64.3}, {3.0, 85.0}, {3.8, 103.8}};
294
295 if ((energy < 1) || (energy > 6)) {
296 LOG(error) << "BmnFunctionSet::GetMagneticFieldByEnergy: defined energy is out of range: " << energy;
297 return -3;
298 }
299
300 // compare with known energies (in tolerance) or use approximate formula if energy not found in the table
301 size_t i = 0;
302 for (; i < energy_to_field.size(); ++i) {
303 const auto& entry = energy_to_field[i];
304
305 // check the exact energy value from the known table
306 if (TMath::Abs(energy - entry.first) < kEnergyTolerance) {
307 field_value = entry.second;
308 break;
309 }
310
311 if (entry.first > energy) {
312 LOG(warning) << "BmnFunctionSet::GetMagneticFieldByEnergy: " << energy
313 << " GeV is not table value, using approximate formula for the magnetic field";
314 // get nearest energy value from the table
315 const auto& ref =
316 (i > 0 && TMath::Abs(energy_to_field[i - 1].first - energy) < TMath::Abs(entry.first - energy))
317 ? energy_to_field[i - 1]
318 : entry;
319
320 // formula to calculate magnetic field using base (known) "energy - magnetic field" (ignoring B0)
321 field_value =
322 ref.second * TMath::Sqrt(energy * (energy + 1.862)) / TMath::Sqrt(ref.first * (ref.first + 1.862));
323 break;
324 }
325 }
326
327 // if given energy greater than maximum value in the table
328 if (i == energy_to_field.size()) {
329 LOG(warning) << "BmnFunctionSet::GetMagneticFieldByEnergy: " << energy
330 << " GeV is not table value, using approximate formula for the magnetic field";
331 const auto& entry = energy_to_field[i - 1];
332 // formula to calculate magnetic field using base (known) "energy - magnetic field" (ignoring B0)
333 field_value = entry.second * TMath::Sqrt(energy * (energy + 1.862))
334 / TMath::Sqrt(entry.first * (entry.first + 1.862));
335 }
336 } else
337 LOG(warning) << "BmnFunctionSet::GetMagneticFieldByEnergy: field value is not defined for the beam: " << beam;
338
339 return field_value;
340}
341
342// get the correction factor for the magnetic field map scale calculated as 'field voltage / map voltage'
343// energy: beam energy (GeV)
344// return value: correction factor to multiply the field map scale by, 1 - for the energies without correction
346{
347 // comparison tolerance between doubles
348 const Double_t kEnergyTolerance = 1e-4;
349 // known energy (GeV) -> correction factor of the field map scale (AZ-070826)
350 const vector<pair<Double_t, Double_t>> energy_to_correction = {{1.6, 1.01}, {2.2, 1. / 1.005}, {3.0, 1. / 1.02}};
351
352 for (const auto& entry : energy_to_correction)
353 if (TMath::Abs(energy - entry.first) < kEnergyTolerance) {
354 LOG(debug) << "BmnFunctionSet::GetFieldScaleCorrection: the field map scale is corrected by "
355 << entry.second << " for the beam energy: " << energy << " GeV";
356 return entry.second;
357 }
358
359 // the correction is known for several energies only, the field map scale is not changed for the others
360 return 1.;
361}
362
363// parsing file name to define beam, target and energy of the run
364// the file name is parsed with the '_' separator, if it does not fit then with the '.' separator
365// file_name: name of the file to parse
366// result (beam, target, energy (GeV)) returns via links, energy is < 0 in case of errors
367// return value: 0 - success, < 0 - error codes
368Int_t BmnFunctionSet::ParseFileName(const TString& file_name, TString& beam, TString& target, Double_t& energy)
369{
370 Int_t rc = ParseFileNameBySeparator(file_name, "_", beam, target, energy);
371 if (rc == 0)
372 return 0;
373
374 // the dot can be used as a separator in the file name, then it also breaks a float energy value into 2 parts
375 LOG(debug) << "BmnFunctionSet::ParseFileName: trying to use '.' separator instead of '_' to parse the file name: "
376 << file_name;
377 rc = ParseFileNameBySeparator(file_name, ".", beam, target, energy);
378 if (rc != 0) {
379 LOG(error) << "BmnFunctionSet::ParseFileName: beam, target and energy were not defined by the file name: "
380 << file_name;
381 // clean the values, which could be defined by the partial parsing
382 beam = "";
383 target = "";
384 }
385
386 return rc;
387}
388
389// parsing the geometry tag, which can contain the path to an XML file with a local customization of the setup
390// geometry after the ';' separator, e.g. "run9_26.09.0;$VMCWORKDIR/my_setup.xml"
392{
393 local_settings = "";
394 if (!geometry_tag.Contains(';'))
395 return 0;
396
397 TString setup_tag = "", unexpected_part = "";
398 TObjArray* tag_tokens = geometry_tag.Tokenize(";");
399 for (Int_t i = 0; i < tag_tokens->GetEntriesFast(); i++) {
400 TString token = ((TObjString*)tag_tokens->At(i))->GetString().Strip(TString::kBoth);
401 if (token.IsNull())
402 continue;
403
404 bool is_xml_file = token.EndsWith(".xml", TString::kIgnoreCase);
405 if (is_xml_file && local_settings.IsNull())
406 local_settings = token;
407 else if (!is_xml_file && setup_tag.IsNull())
408 setup_tag = token;
409 else if (unexpected_part.IsNull()) // e.g. a second XML file or a second setup tag
410 unexpected_part = token;
411 }
412 delete tag_tokens;
413
414 // the separator without an XML file after it is considered as a part of the setup tag itself
415 if (local_settings.IsNull()) {
416 LOG(warning) << "BmnFunctionSet::ParseGeometryTag: no XML file with a geometry customization was found after "
417 "';', the whole value is used as the setup tag: "
418 << geometry_tag;
419 return 0;
420 }
421 if (!unexpected_part.IsNull()) {
422 LOG(error) << "BmnFunctionSet::ParseGeometryTag: unexpected part '" << unexpected_part
423 << "' in the geometry tag: " << geometry_tag;
424 local_settings = "";
425 return -1;
426 }
427
428 geometry_tag = setup_tag;
429 // the check expands a copy of the path, so the file can be given as, e.g., "$VMCWORKDIR/my_setup.xml",
430 // while the path is returned as given to be valid on another computer
431 TString local_settings_path = local_settings;
432 if (CheckFileExist(local_settings_path) != 1) {
433 LOG(error) << "BmnFunctionSet::ParseGeometryTag: no XML file with a geometry customization: "
434 << local_settings_path;
435 local_settings = "";
436 return -2;
437 }
438
439 return 0;
440}
441
442// parsing file name with the given separator (used by ParseFileName)
443// separator: symbol to split the file name into tokens
444// return value: 0 - success, < 0 - error codes
446 const TString& separator,
447 TString& beam,
448 TString& target,
449 Double_t& energy)
450{
451 energy = -1;
452
453 static const vector<pair<TString, TString>> beam_to_particle = {
454 {"bi", "Bi"}, {"pb", "Pb"}, {"au", "Au"}, {"xe", "Xe"}, {"ag", "Ag"},
455 {"kr", "Kr"}, {"ar", "Ar"}, {"c", "C"}, {"d", "d"}, {"p", "p"}};
456 static const vector<pair<TString, TString>> target_to_particle = {
457 {"csi", "CsI"}, {"pb", "Pb"}, {"au", "Au"}, {"cs", "Cs"}, {"xe", "Xe"}, {"sn", "Sn"},
458 {"ag", "Ag"}, {"cu", "Cu"}, {"al", "Al"}, {"c", "C"}, {"p", "p"}};
459
460 // split file name by separation symbol
461 TObjArray* file_tokens = file_name.Tokenize(separator);
462 if (!file_tokens) {
463 LOG(error) << "BmnFunctionSet::ParseFileNameBySeparator: failed to tokenize file name: " << file_name;
464 return -1;
465 }
466 const Int_t n_tokens = file_tokens->GetEntriesFast();
467 Int_t token_num = 0;
468
469 // lambda: get token as TString
470 auto GetToken = [&](Int_t i) -> TString { return static_cast<TObjString*>(file_tokens->At(i))->GetString(); };
471
472 // parse beam and target: group #1 — beam, group #3 — target
473 TPRegexp beam_target_re(TString::Format("^(?P<beam>(%s))(?P<target>(%s))$", JoinKeys(beam_to_particle).Data(),
474 JoinKeys(target_to_particle).Data()));
475
476 TString beam_key, target_key;
477 Bool_t found = kFALSE;
478 while (!found) {
479 if (token_num >= n_tokens)
480 break;
481 TString token_lower = GetToken(token_num);
482 token_lower.ToLower();
483
484 TObjArray* match = beam_target_re.MatchS(token_lower);
485 if (match && match->GetEntriesFast() >= 3) {
486 beam_key = static_cast<TObjString*>(match->At(1))->GetString();
487 target_key = static_cast<TObjString*>(match->At(3))->GetString();
488 found = kTRUE;
489 }
490
491 delete match;
492 ++token_num;
493 }
494
495 if (!found) {
496 LOG(debug) << "BmnFunctionSet::ParseFileNameBySeparator: Beam and Target were not found in the file name: "
497 << file_name << " (separator: " << separator << ")";
498 delete file_tokens;
499 return -2;
500 }
501
502 for (const auto& kv : beam_to_particle) {
503 if (kv.first == beam_key)
504 beam = kv.second;
505 }
506 for (const auto& kv : target_to_particle) {
507 if (kv.first == target_key)
508 target = kv.second;
509 }
510
511 // parse energy: \d+\.?\d*
512 TPRegexp energy_re("\\d+\\.?\\d*");
513 found = kFALSE;
514 bool isUnit = false;
515 TString energy_str;
516 while (!found) {
517 if (token_num >= n_tokens)
518 break;
519 TString token = GetToken(token_num);
520
521 TObjArray* energy_gr = energy_re.MatchS(token);
522 if (energy_gr) {
523 energy_str = static_cast<TObjString*>(energy_gr->At(0))->GetString();
524 found = kTRUE;
525 // check if there is GeV or AGeV
526 token.ToLower();
527 if (token.Contains("gev"))
528 isUnit = true;
529 }
530
531 delete energy_gr;
532 ++token_num;
533 }
534
535 if (!found) {
536 LOG(debug) << "BmnFunctionSet::ParseFileNameBySeparator: Energy was not found in the file name: " << file_name
537 << " (separator: " << separator << ")";
538 delete file_tokens;
539 return -3;
540 }
541
542 // if dot is separator then it breaks float value of the energy into 2 parts
543 if (separator == "." && token_num < n_tokens) {
544 TString token = GetToken(token_num);
545 TPRegexp digits_re("^\\d+");
546 TObjArray* digits_gr = digits_re.MatchS(token);
547 if (digits_gr && digits_gr->GetEntriesFast() > 0) {
548 energy_str += ".";
549 energy_str += static_cast<TObjString*>(digits_gr->At(0))->GetString();
550 // check if there is GeV or AGeV
551 token.ToLower();
552 if (token.Contains("gev"))
553 isUnit = true;
554
555 delete digits_gr;
556 ++token_num;
557 }
558 }
559
560 // if there is no GeV or AGeV label (before or in the next token), then raise error
561 if (!isUnit) {
562 TString token = (token_num < n_tokens) ? GetToken(token_num) : TString("");
563 // check if there is GeV or AGeV
564 token.ToLower();
565 if (!token.Contains("gev")) {
566 LOG(debug) << "BmnFunctionSet::ParseFileNameBySeparator: energy units (gev) were not found in the file "
567 "name: "
568 << file_name << " (separator: " << separator << ")";
569 delete file_tokens;
570 return -4;
571 }
572 }
573
574 delete file_tokens;
575
576 // convert the parsed energy to the number
577 const Double_t energy_value = energy_str.Atof();
578 if (energy_value <= 0) {
579 LOG(debug) << "BmnFunctionSet::ParseFileNameBySeparator: energy value is not correct in the file name: "
580 << file_name << " (separator: " << separator << ")";
581 return -5;
582 }
583 energy = energy_value;
584
585 return 0;
586}
587
588// check whether path is a directory
590{
591 FileStat_t file_stat;
592 gSystem->GetPathInfo(path.Data(), file_stat);
593 if (R_ISDIR(file_stat.fMode))
594 return true;
595 else
596 return false;
597}
598
600{
601 Int_t nans = duration_cast<nanoseconds>(p.time_since_epoch()).count() % 1000000000;
602 Long64_t sec = duration_cast<nanoseconds>(p.time_since_epoch()).count() / 1000000000;
603 return TTimeStamp{time_t(sec), nans};
604}
605
607{
608 Int_t nans = t.GetNanoSec();
609 Int_t sec = t.GetSec();
610 return SysPoint{sec * 1s + nans * 1ns};
611}
612
614{
615 LOG(info) << TimePoint2String(p);
616}
617
619{
620 time_t tt = SysClock::to_time_t(p);
621 auto nans = duration_cast<nanoseconds>(p.time_since_epoch()).count() % 1000000000;
622 std::stringstream sst;
623 sst << std::put_time(std::gmtime(&tt), "%a, %d %b %Y %T %z (%Z)"); // as TTimeStamp
624 // sst << std::put_time(std::localtime(&tt), "%a, %d %b %Y %T %z (%Z)"); // as TTimeStamp
625 sst << " +" << std::setw(9) << nans;
626 return sst.str();
627}
628
629SysPoint BmnFunctionSet::TDatime2GMT(TDatime& tdatime, Int_t timezoneOffsetHours)
630{
631 std::tm tm = {};
632 tm.tm_year = tdatime.GetYear() - 1900;
633 tm.tm_mon = tdatime.GetMonth() - 1;
634 tm.tm_mday = tdatime.GetDay();
635 tm.tm_hour = tdatime.GetHour();
636 tm.tm_min = tdatime.GetMinute();
637 tm.tm_sec = tdatime.GetSecond();
638 time_t t = std::time(nullptr);
639 std::tm* local = std::localtime(&t);
640 int offset = local->tm_gmtoff;
641 return (SysClock::from_time_t(std::mktime(&tm) + offset) - 1h * timezoneOffsetHours);
642}
int i
Definition P4_F32vec4.h:22
bool Bool_t
int Int_t
constexpr Bool_t kFALSE
double Double_t
long long Long64_t
constexpr Bool_t kTRUE
EAccessMode
kFileExists
Bool_t R_ISDIR(Int_t mode)
R__EXTERN TSystem * gSystem
static double GetMagneticFieldByEnergy(const TString &beam, double energy)
static void PrintTimePoint(SysPoint p)
static int CreateDirectoryTree(TString &fileName, int iVerbose=0, EAccessMode mode=kWritePermission)
static SysPoint TDatime2GMT(TDatime &tdatime, Int_t timezoneOffsetHours=0)
static int CheckDirectoryExist(TString &fileName, int iVerbose=0, EAccessMode mode=kFileExists)
static double GetFieldScaleCorrection(double energy)
static Int_t ParseGeometryTag(TString &geometry_tag, TString &local_settings)
static TString JoinKeys(const std::vector< std::pair< TString, TString > > &dict)
static Int_t ParseFileName(const TString &file_name, TString &beam, TString &target, Double_t &energy)
static std::string TimePoint2String(SysPoint p)
static int isSimulationFile(TString fileName="")
static SysPoint TimeStamp2TP(TTimeStamp p)
static bool isDirectory(TString path)
static TTimeStamp TimePoint2TS(SysPoint p)
static int GetPeriodNumber(TFile *root_file, int method_number=0)
static int CheckFileExist(TString &fileName, int iVerbose=0, EAccessMode mode=kFileExists)
static int GetInputFileList(TString inputFileName, std::vector< TString > &fileList)
static Int_t ParseFileNameBySeparator(const TString &file_name, const TString &separator, TString &beam, TString &target, Double_t &energy)
TObjArray * GetListOfFiles() const
Int_t GetMonth() const
Int_t GetDay() const
Int_t GetHour() const
Int_t GetSecond() const
Int_t GetYear() const
Int_t GetMinute() const
T * Get(const char *namecycle)
TList * GetListOfKeys() const override
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
void Close(Option_t *option="") override
const char * GetName() const override
const char * GetTitle() const override
Int_t GetEntriesFast() const
TObject * At(Int_t idx) const override
const TString & GetString() const
virtual TObject * FindObject(const char *name) const
R__ALWAYS_INLINE Bool_t IsZombie() const
TObjArray * MatchS(const TString &s, const TString &mods="", Int_t start=0, Int_t nMaxMatch=10)
void ToLower()
Int_t Atoi() const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Double_t Atof() const
const char * Data() const
Bool_t IsDigit() const
TObjArray * Tokenize(const TString &delim) const
Bool_t IsNull() const
static TString Format(const char *fmt,...)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
time_t GetSec() const
Int_t GetNanoSec() const
TFile * GetCurrentFile() const
std::chrono::time_point< SysClock > SysPoint
Double_t Sqrt(Double_t x)
Double_t Abs(Double_t d)
Definition json.hpp:4446