KaliVeda
Toolkit for HIC analysis
KVExpDB.cpp
1 //Created by KVClassFactory on Tue Jul 12 11:43:52 2016
2 //Author: bonnet,,,
3 
4 #include "KVExpDB.h"
5 #include "KVDBSystem.h"
6 #include "KVNumberList.h"
7 #include "TSystem.h"
8 #include <KVFileReader.h>
9 #include <iostream>
10 #include "KVUnownedList.h"
11 using namespace std;
12 
13 KVExpDB* gExpDB = nullptr;
14 
16 
17 
18 
21 void KVExpDB::init()
22 {
23  //default initialisations
24 
25  fRuns = AddTable("Runs", "List of available runs");
26  fRuns->SetDefaultFormat("Run %d"); // default format for run names
27  fSystems = AddTable("Systems", "List of available systems");
28  index_multiplier = KVBase::GetDataSetEnv(fDataSet, "DataSet.RunFileIndexMultiplier.raw", 1);
29  with_index_multiplier = index_multiplier != 1;
30  raw_files_have_index = KVBase::GetDataSetEnv(fDataSet, "DataSet.RunFileName.raw", "").Contains("%I");
31 }
32 
33 
34 
37 
39  : KVDataBase()
40 {
41  // Default constructor
42 }
43 
44 
45 
46 
49 
51  : KVDataBase(name), fDataSet(name)
52 {
53  // Constructor inherited from KVDataBase
54  init();
55 }
56 
57 
58 
59 
62 
63 KVExpDB::KVExpDB(const Char_t* name, const Char_t* title)
64  : KVDataBase(name, title), fDataSet(name)
65 {
66  // Constructor inherited from KVDataBase
67  init();
68 }
69 
70 
71 
72 
75 
77 {
78  // Destructor
79  if (gExpDB == this) gExpDB = nullptr;
80 }
81 
82 
83 
89 
91  UInt_t last_run)
92 {
93  //If the KVDBRecord 'rec' (i.e. set of calibration parameters, reaction system, etc.) is
94  //associated to, or valid for, a range of runs, we use this method in order to link the record
95  //and the runs. The list of associated runs will be kept with the record, and each of the runs
96  //will have a link to the record.
97 
98  std::map<int, int> one_shot; //make sure each run is only linked once
99  for (UInt_t ii = first_run; ii <= last_run; ii++) {
100  Int_t rr = ii;
101  if (rr > index_multiplier) rr /= index_multiplier;
102  if (!one_shot[rr]) LinkRecordToRun(rec, ii);
103  ++one_shot[rr];
104  }
105 }
106 
107 
113 
115 {
116  //If the KVDBRecord 'rec' (i.e. set of calibration parameters, reaction system, etc.) is
117  //associated to, or valid for, a range of runs, we use this method in order to link the record
118  //and the runs. The list of associated runs will be kept with the record, and each of the runs
119  //will have a link to the record.
120  nl.Begin();
121  std::map<int, int> one_shot; //make sure each run is only linked once
122  while (!nl.End()) {
123  Int_t rr = nl.Next();
124  if (rr > index_multiplier) rr /= index_multiplier;
125  if (!one_shot[rr]) LinkRecordToRun(rec, rr);
126  ++one_shot[rr];
127  }
128 }
129 
130 
131 
133 
135 {
136 
137  KVDBRecord* run = 0;
138  if ((run = fRuns->GetRecord(rnumber)))
139  rec->AddLink("Runs", run);
140 
141 }
142 
143 
144 
152 
154  UInt_t run_ranges[][2])
155 {
156  //Call LinkRecordToRunRange for a set of run ranges stored in the two-dimensional array
157  //in the following way:
158  // run_ranges[0][0] = first run of first run range
159  // run_ranges[0][1] = last run of first run range
160  // run_ranges[1][0] = first run of second run range etc. etc.
161  //rr_number is the number of run ranges in the array
162 
163  for (UInt_t i = 0; i < rr_number; i++) {
164  LinkRecordToRunRange(rec, run_ranges[i][0], run_ranges[i][1]);
165  }
166 }
167 
168 
169 
172 
174  UInt_t run_ranges[][2])
175 {
176  //Link the records contained in the list to the set of runs (see LinkRecordToRunRanges).
177 
178  if (!list) {
179  Error("LinkListToRunRanges",
180  "NULL pointer passed for parameter TList");
181  return;
182  }
183  if (list->GetSize() == 0) {
184  Error("LinkListToRunRanges(TList*,UInt_t,UInt_t*)",
185  "The list is empty");
186  return;
187  }
188  TIter next(list);
189  KVDBRecord* rec;
190  while ((rec = (KVDBRecord*) next())) {
191  LinkRecordToRunRanges(rec, rr_number, run_ranges);
192  }
193 }
194 
195 
198 
200 {
201  //Link the records contained in the list to the set of runs (see LinkRecordToRunRanges).
202 
203  if (!list) {
204  Error("LinkListToRunRange",
205  "NULL pointer passed for parameter TList");
206  return;
207  }
208  if (list->GetSize() == 0) {
209  Error("LinkListToRunRange(TList*,KVNumberList)",
210  "The list is empty");
211  return;
212  }
213  TIter next(list);
214  KVDBRecord* rec;
215  while ((rec = (KVDBRecord*) next())) {
217  }
218 }
219 
220 
221 
247 
249 {
250  //Reads list of systems with associated run ranges, creates KVDBSystem
251  //records for these systems, and links them to the appropriate KVDBRun
252  //records using LinkListToRunRanges.
253  //
254  //There are 2 formats for the description of systems:
255  //
256  //+129Xe + natSn 25 MeV/A '+' indicates beginning of system description
257  //129 54 119 50 0.1 25.0 A,Z of projectile and target, target thickness (mg/cm2), beam energy (MeV/A)
258  //Run Range : 614 636 runs associated with system
259  //Run Range : 638 647 runs associated with system
260  //
261  //This is sufficient in the simple case where the experiment has a single
262  //layer target oriented perpendicular to the beam. However, for more
263  //complicated targets we can specify as follows :
264  //
265  //+155Gd + 238U 36 MeV/A
266  //155 64 238 92 0.1 36.0
267  //Target : 3 0.0 target with 3 layers, angle 0 degrees
268  //C 0.02 1st layer : carbon, 20 g/cm2
269  //238U 0.1 2nd layer : uranium-238, 100 g/cm2
270  //C 0.023 3rd layer : carbon, 23 g/cm2
271  //Run Range : 770 804
272  //
273  //Lines beginning '#' are comments.
274 
275 
276  std::ifstream fin;
277  if (OpenCalibFile("Systems", fin)) {
278  Info("ReadSystemList()", "Reading Systems parameters ...");
279 
280  TString line;
281 
282  char next_char = fin.peek();
283  while (next_char != '+' && fin.good()) {
284  line.ReadLine(fin, kFALSE);
285  next_char = fin.peek();
286  }
287 
288  while (fin.good() && !fin.eof() && next_char == '+') {
289  KVDBSystem* sys = new KVDBSystem("NEW SYSTEM");
290  AddSystem(sys);
291  sys->Load(fin, index_multiplier);
292  next_char = fin.peek();
293  }
294  fin.close();
295  }
296  else {
297  Error("ReadSystemList()", "Could not open file %s",
298  GetCalibFileName("Systems").Data());
299  }
300  // if any runs are not associated with any system
301  // we create an 'unknown' system and associate it to all runs
302  KVDBSystem* sys = 0;
303  TIter nextRun(GetRuns());
304  KVDBRun* run;
305  while ((run = (KVDBRun*)nextRun())) {
306  if (!run->GetSystem()) {
307  if (!sys) {
308  sys = new KVDBSystem("[unknown]");
309  AddSystem(sys);
310  }
311  sys->AddRun(run);
312  }
313  }
314 
315  // rehash the record table now that all names are set
316  fSystems->Rehash();
317 }
318 
319 
320 
327 
329 {
330  //Write the 'Systems.dat' file for this database.
331  //The actual name of the file is given by the value of the environment variable
332  //[dataset_name].INDRADB.Systems (if it exists), otherwise the value of
333  //INDRADB.Systems is used. The file is written in the
334  //$KVROOT/[dataset_directory] directory.
335 
336  ofstream sysfile;
337  KVBase::SearchAndOpenKVFile(GetDBEnv("Systems"), sysfile, fDataSet.Data());
338  TIter next(GetSystems());
339  KVDBSystem* sys;
340  TDatime now;
341  sysfile << "# " << GetDBEnv("Systems") << " file written by "
342  << ClassName() << "::WriteSystemsFile on " << now.AsString() << endl;
343  cout << GetDBEnv("Systems") << " file written by "
344  << ClassName() << "::WriteSystemsFile on " << now.AsString() << endl;
345  while ((sys = (KVDBSystem*)next())) {
346  if (strcmp(sys->GetName(), "[unknown]")) { //do not write dummy 'unknown' system
347  sys->Save(sysfile);
348  sysfile << endl;
349  }
350  }
351  sysfile.close();
352 }
353 
354 
355 
360 
361 void KVExpDB::Save(const Char_t* what)
362 {
363  //Save (in the appropriate text file) the informations on:
364  // what = "Systems" : write Systems.dat file
365  // what = "Runlist" : write Runlist.csv
366  if (!strcmp(what, "Systems")) WriteSystemsFile();
367  else if (!strcmp(what, "Runlist")) WriteRunListFile();
368 }
369 
370 
371 
372 
380 
382 {
383  //Write a file containing a line describing each run in the database.
384  //The delimiter symbol used in each line is '|' by default.
385  //The first line of the file will be a header description, given by calling
386  //KVDBRun::WriteRunListHeader() for the first run in the database.
387  //Then we call KVDBRun::WriteRunListLine() for each run.
388  //These are virtual methods redefined by child classes of KVDBRun.
389 
390  ofstream rlistf;
391  KVBase::SearchAndOpenKVFile(GetDBEnv("Runlist"), rlistf, fDataSet.Data());
392  TDatime now;
393  rlistf << "# " << GetDBEnv("Runlist") << " file written by "
394  << ClassName() << "::WriteRunListFile on " << now.AsString() << endl;
395  cout << GetDBEnv("Runlist") << " file written by "
396  << ClassName() << "::WriteRunListFile on " << now.AsString() << endl;
397  if (GetRuns() && GetRuns()->GetEntries() > 0) {
398  TIter next_run(GetRuns());
399  //write header in file
400  ((KVDBRun*) GetRuns()->At(0))->WriteRunListHeader(rlistf, GetDBEnv("Runlist.Separator")[0]);
401  KVDBRun* run;
402  while ((run = (KVDBRun*) next_run())) {
403 
404  run->WriteRunListLine(rlistf, GetDBEnv("Runlist.Separator")[0]);
405 
406  }
407  }
408  else {
409  Warning("WriteRunListFile()", "run list is empty !!!");
410  }
411  rlistf.close();
412 }
413 
414 
415 
431 
432 Bool_t KVExpDB::OpenCalibFile(const Char_t* type, ifstream& fs) const
433 {
434  //Find and open calibration parameter file of given type. Return kTRUE if all OK.
435  //types are defined in $KVROOT/KVFiles/.kvrootrc by lines such as (use INDRA as example)
436  //
437  //# Default name for file describing systems for each dataset.
438  //INDRADB.Systems: Systems.dat
439  //
440  //A file with the given name will be looked for in the dataset calibration file
441  //directory given by GetDataSetDir()
442  //
443  //Filenames specific to a given dataset may also be defined:
444  //
445  //INDRA_camp5.INDRADB.Pedestals: Pedestals5.dat
446  //
447  //where 'INDRA_camp5' is the name of the dataset in question.
448 
450 }
451 
452 
453 
485 
486 Bool_t KVExpDB::FindCalibFile(const Char_t* type, TString& fullpath, const TString& array_name) const
487 {
488  //Find calibration parameter file of given type. Return kTRUE if all OK.
489  //In this case fullpath contains the full path to the file.
490  //
491  //Types are defined in $KVROOT/KVFiles/.kvrootrc by lines such as (use INDRA as example)
492  //
493  //~~~~
494  //# Default name for file describing systems for each dataset.
495  //INDRADB.Systems: Systems.dat
496  //~~~~
497  //
498  //A file with the given name will be looked for in the dataset calibration file
499  //directory given by GetDataSetDir()
500  //
501  //Filenames specific to a given dataset may also be defined:
502  //
503  //~~~~
504  //INDRA_camp5.INDRADB.Pedestals: Pedestals5.dat
505  //~~~~
506  //
507  //where 'INDRA_camp5' is the name of the dataset in question.
508  //
509  //If 'array_name' is given and no file is found with this filename,
510  //we try looking for a file called 'array_name.filename', i.e. if a filename
511  //
512  //~~~~
513  //INDRADB.Pressures: ChIoPressures.dat
514  //~~~~
515  //
516  //is defined, but no ChIoPressures.dat file exists for the dataset, if array_name="INDRA"
517  //then we look for a file called INDRA.ChIoPressures.dat
518 
519  auto cal_file_name = GetCalibFileName(type);
520  if (cal_file_name.IsNull()) return kFALSE;
521  if (KVBase::SearchKVFile(cal_file_name, fullpath, GetDataSetDir()))
522  return kTRUE;
523  if (!array_name.IsNull()) {
524  cal_file_name.Prepend(Form("%s.", array_name.Data()));
525  return KVBase::SearchKVFile(cal_file_name, fullpath, GetDataSetDir());
526  }
527  return kFALSE;
528 }
529 
530 
531 
532 
545 
547 {
548  // Print compact listing of runs in the number list like this:
549  //
550  // root [9] gIndraDB->PrintRuns("8100-8120")
551  // RUN SYSTEM TRIGGER EVENTS COMMENTS
552  // ------------------------------------------------------------------------------------------------------------------
553  // 8100 129Xe + 58Ni 8 MeV/A M>=2 968673
554  // 8101 129Xe + 58Ni 8 MeV/A M>=2 969166
555  // 8102 129Xe + 58Ni 8 MeV/A M>=2 960772
556  // 8103 129Xe + 58Ni 8 MeV/A M>=2 970029
557  // 8104 129Xe + 58Ni 8 MeV/A M>=2 502992 disjonction ht chassis 1
558  // 8105 129Xe + 58Ni 8 MeV/A M>=2 957015 intensite augmentee a 200 pA
559 
560  printf("RUN\tSYSTEM\t\t\t\tTRIGGER\t\tEVENTS\t\tCOMMENTS\n");
561  printf("------------------------------------------------------------------------------------------------------------------\n");
562  nl.Begin();
563  while (!nl.End()) {
564  KVDBRun* run = GetDBRun(nl.Next());
565  if (!run) continue;
566  printf("%4d\t%-30s\t%s\t\t%llu\t\t%s\n",
567  run->GetNumber(), (run->GetSystem() ? run->GetSystem()->GetName() : " "), run->GetTriggerString(),
568  run->GetEvents(), run->GetComments());
569  }
570 }
571 
572 
573 
575 
577 {
578  gExpDB = this;
579 }
580 
581 
582 
583 
597 
598 KVExpDB* KVExpDB::MakeDataBase(const Char_t* name, const Char_t* datasetdir)
599 {
600  //Static function which will create and 'Build' the database object corresponding to 'name'
601  //These are defined as 'Plugin' objects in the file $KVROOT/KVFiles/.kvrootrc :
602  //
603  // Plugin.KVExpDB: INDRA_camp1 KVDataBase1 KVIndra "KVDataBase1()"
604  // +Plugin.KVExpDB: INDRA_camp2 KVDataBase2 KVIndra "KVDataBase2()"
605  // +Plugin.KVExpDB: INDRA_camp4 KVDataBase4 KVIndra "KVDataBase4()"
606  // +Plugin.KVExpDB: INDRA_camp5 KVDataBase5 KVIndra5 "KVDataBase5()"
607  //
608  //The 'name' ("INDRA_camp1" etc.) corresponds to the name of a dataset in $KVROOT/KVFiles/manip.list
609  //This name is stored in member variable fDataSet.
610  //The constructors/macros used have arguments (const Char_t* name)
611 
612  //does plugin exist for given name ?
613  TPluginHandler* ph;
614  if (!(ph = KVBase::LoadPlugin("KVExpDB", name))) {
615  return 0;
616  }
617  //execute constructor/macro for database
618  KVExpDB* mda = (KVExpDB*) ph->ExecPlugin(1, name);
619  mda->SetDataSetDir(datasetdir);
620 
621  mda->Build();
622 
623  return mda;
624 }
625 
626 
627 
631 
632 ULong64_t KVExpDB::GetTotalEvents(int first_run, int last_run) const
633 {
634  // Return total number of events in range [first_run,last_run]
635  // (if last_run=-1, go to last known run)
636 
637  ULong64_t total = 0;
638  TIter next(GetRuns());
639  KVDBRun* dbr;
640  while ((dbr = (KVDBRun*)next())) {
641  if (dbr->GetNumber() >= first_run) {
642  if ((last_run > 0 && dbr->GetNumber() <= last_run)
643  || last_run == -1) total += dbr->GetEvents();
644  }
645  }
646  return total;
647 }
648 
649 
650 
653 
655 {
656  // Return total number of events for given system
657 
658  if (!GetSystem(system)) {
659  Error("GetTotalEvents", "No system with name : %s", system.Data());
660  return 0;
661  }
662  TIter it(GetSystem(system)->GetRuns());
663  ULong64_t total = 0;
664  KVDBRun* dbr;
665  while ((dbr = (KVDBRun*)it())) {
666  total += dbr->GetEvents();
667  }
668  return total;
669 }
670 
671 
672 
679 
681 {
682  // \param[in] glob_runfile global runfile number of a runfile (given by KVDBRunFile::GetGlobalRunFileNumber())
683  // \returns run/index information of runfile with given global runfile number
684  //
685  // \note only _good_ runfiles (with KVDBRunFile::IsBad() == kFALSE) have a global runfile number,
686  // the _bad_ runfiles are not included in the list
687 
688  if (fMapGlobRunFileNumberToRunIndex.empty()) {
689  // have to regenerate map on first call after reading database in from file.
690  // this is because no Streamer can be generated for run_index_t and so the
691  // structure cannot be written to disk
692  TIter it_run(GetRuns());
693  KVDBRun* r;
694  while ((r = (KVDBRun*)it_run())) {
695  for (auto& ri : r->GetRunIndexList()) {
696  auto& rf = GetDBRunFile(ri);
697  if (!rf.IsBad())
698  fMapGlobRunFileNumberToRunIndex[rf.GetGlobalRunFileNumber()] = ri;
699  }
700  }
701  }
702  return fMapGlobRunFileNumberToRunIndex[glob_runfile];
703 }
704 
705 
706 
734 
735 run_index_list KVExpDB::SetRunIndexListFromString(const TString& rlist) const
736 {
737  // \param[in] rlist string containing run numbers, runfile identifiers (run+index), and ranges of both
738  // \returns run_index_list containing the sequence of all _good_ runfiles corresponding to the input string
739  //
740  // \note any _bad_ runfiles (with KVDBRunFile::IsBad() == kTRUE) are excluded.
741  //
742  // The string can contain individual run numbers, runfile (runindex) identifiers,
743  // either in sequences (separated by spaces and/or commas), or as part of a range,
744  // i.e. two values separated by '-'.
745  //
746  // A number without a '.index' index suffix is interpreted as a run number,
747  // and corresponds to all runfiles of the given run. A number _with_ '.index'
748  // suffix is interpreted as meaning the given individual runfile of the corresponding
749  // run.
750  //
751  // A number with a '.0' (zero) index is interpreted as the first runfile of the
752  // given run (note that normally such a runfile is represented by the run number alone,
753  // without a suffix).
754  //
755  // Examples:
756  //
757  //~~~
758  //"40-43" => all good runfiles from runs 40, 41, 42 & 43
759  //
760  //"40-43.0" => all good runfiles from runs 40, 41 & 42, plus the first runfile of run 43
761  //
762  //"40.3-42.7" => all good runfiles from 40.3 to 42.7
763 
764  run_index_list rilist;
765 
766  KVString _the_list(rlist);
767  _the_list.Begin(" ,");
768  while (!_the_list.End()) {
769  KVString item = _the_list.Next(kTRUE);
770  if (item.GetNValues("-") == 2) {
771  // this is a range
772  item.Begin("-");
773  std::vector<int> limits(2);
774  for (int i = 0; i < 2; ++i) {
775  auto titbit = item.Next(kTRUE);
776  if (titbit.Contains(".")) {
777  // this is a runindex identifier
778  limits[i] = GetDBRunFile(titbit).GetGlobalRunFileNumber();
779  }
780  else {
781  // this is a run number
782  // if at beginning of range, we start from first good file
783  // if at end of range, we include everything up to last good file
784  run_index_t ri(titbit);
785  if (i == 0)
786  limits[i] = GetDBRun(ri.run())->GetFirstGoodFile().value().get().GetGlobalRunFileNumber();
787  else limits[i] = GetDBRun(ri.run())->GetLastGoodFile().value().get().GetGlobalRunFileNumber();
788  }
789  }
790  for (int ri = limits[0]; ri <= limits[1]; ++ri)
791  rilist.Add(GetRunIndexFromGlobalRunFileNumber(ri));
792  }
793  else {
794  // individual run number (no index) or runfile identifier
795  if (item.Contains(".")) {
796  // this is a runindex identifier
797  rilist.Add(run_index_t{item});
798  }
799  else {
800  // run number: add all files from first to last (good) file of run
801  auto run_num = run_index_t{item}.run();
802  for (int i = GetDBRun(run_num)->GetFirstGoodFile().value().get().GetGlobalRunFileNumber();
803  i <= GetDBRun(run_num)->GetLastGoodFile().value().get().GetGlobalRunFileNumber(); ++i)
804  rilist.Add(GetRunIndexFromGlobalRunFileNumber(i));
805  }
806  }
807  }
808  return rilist;
809 }
810 
811 
812 
813 
818 
819 TString KVExpDB::GetDBEnv(const Char_t* type) const
820 {
821  //Will look for gEnv->GetValue name "name_of_dataset.fDBType.type",
822  //then "fDBType.type" if no dataset-specific value is found,
823  //then "EXPDB.type" if no database-specific value is found
824 
825  if (fDataSet == "") return "";
826  auto p = KVBase::GetDataSetEnv(fDataSet, Form("%s.%s", fDBType.Data(), type), "");
827  if (!p.Length()) return KVBase::GetDataSetEnv(fDataSet, Form("EXPDB.%s", type), "");
828  return p;
829 }
830 
831 
832 
844 
846 {
847  // Looks for file with name given by one of the following variables:
848  //
849  // [DBtype].Comments
850  // [dataset].[DBtype].Comments
851  //
852  // and opens it to read and add comments on runs.
853  // Format of file is:
854  //
855  // run=3830-3836 | really amazing data in these runs
856  //
857 
858  TString comments_file = GetCalibFileName("Comments");
859  if (comments_file == "") return;
860  TString fullpath;
861  if (!FindCalibFile("Comments", fullpath)) return;
862  Info("ReadComments", "Reading run comments in file %s...", fullpath.Data());
863 
864  KVFileReader fr;
865  if (!fr.OpenFileToRead(fullpath)) {
866  Error("ReadComments", "Problem opening file %s", fullpath.Data());
867  return;
868  }
869 
870  while (fr.IsOK()) {
871  fr.ReadLine("|");
872  if (fr.GetCurrentLine().BeginsWith("#")) {
873 
874  }
875  else if (fr.GetCurrentLine() == "") {
876 
877  }
878  else {
879  if (fr.GetNparRead() == 2) {
880  KVString srun(fr.GetReadPar(0));
881  srun.Begin("=");
882  srun.Next();
883  KVNumberList lruns(srun.Next());
884  KVString comments(fr.GetReadPar(1));
885  lruns.Begin();
886  while (!lruns.End()) {
887  Int_t run = lruns.Next() / index_multiplier;
888  KVDBRun* dbrun = GetDBRun(run);
889  if (dbrun)
890  dbrun->SetComments(comments.Data());
891  }
892  }
893  }
894  }
895 }
896 
897 
898 
int Int_t
unsigned int UInt_t
ROOT::R::TRInterface & r
bool Bool_t
char Char_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize fs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
char * Form(const char *fmt,...)
static ValType GetDataSetEnv(const KVString &dataset, const KVString &type, const ValType &defval)
Definition: KVBase.h:304
static Bool_t SearchKVFile(const Char_t *name, TString &fullpath, const Char_t *kvsubdir="")
Definition: KVBase.cpp:517
static Bool_t SearchAndOpenKVFile(const Char_t *name, KVSQLite::database &dbfile, const Char_t *kvsubdir="")
Definition: KVBase.cpp:628
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
Definition: KVBase.cpp:772
Record folder for the database.
Definition: KVDBRecord.h:43
virtual Int_t GetNumber() const
Definition: KVDBRecord.h:73
Int_t GetGlobalRunFileNumber() const
Definition: KVDBRunFile.h:245
Description of an experimental run in database ,,.
Definition: KVDBRun.h:41
ULong64_t GetEvents() const
Definition: KVDBRun.h:198
std::optional< std::reference_wrapper< const KVDBRunFile > > GetFirstGoodFile() const
Definition: KVDBRun.h:125
std::optional< std::reference_wrapper< const KVDBRunFile > > GetLastGoodFile() const
Definition: KVDBRun.h:142
void SetComments(const KVString &comments)
Definition: KVDBRun.h:273
KVDBSystem * GetSystem() const
Definition: KVDBRun.cpp:239
virtual void WriteRunListLine(std::ostream &, Char_t delim='|') const
Definition: KVDBRun.cpp:93
const Char_t * GetTriggerString() const
Definition: KVDBRun.h:254
const Char_t * GetComments() const
Definition: KVDBRun.h:264
Database class used to store information on different colliding systems studied during an experiment....
Definition: KVDBSystem.h:52
void Save(std::ostream &) const
Definition: KVDBSystem.cpp:293
void AddRun(KVDBRecord *)
Definition: KVDBSystem.cpp:486
void Load(std::istream &, int=1)
Definition: KVDBSystem.cpp:341
void Rehash(void)
Definition: KVDBTable.cpp:172
virtual KVDBRecord * GetRecord(const Char_t *rec_name) const
Definition: KVDBTable.h:58
Simple cross-referenced database structure.
Definition: KVDataBase.h:137
Base class to describe database of an experiment ,,.
Definition: KVExpDB.h:20
void AddSystem(KVDBSystem *r)
Definition: KVExpDB.h:119
virtual void Build()
Definition: KVExpDB.h:169
run_index_list SetRunIndexListFromString(const TString &) const
run_index_t GetRunIndexFromGlobalRunFileNumber(int glob_runfile) const
Definition: KVExpDB.cpp:680
virtual ~KVExpDB()
Destructor.
Definition: KVExpDB.cpp:76
virtual KVDBSystem * GetSystem(const Char_t *system) const
Definition: KVExpDB.h:110
virtual void ReadSystemList()
Definition: KVExpDB.cpp:248
virtual void cd()
Definition: KVExpDB.cpp:576
KVDBTable * fRuns
table of runs
Definition: KVExpDB.h:28
virtual void ReadComments()
virtual void LinkRecordToRun(KVDBRecord *rec, Int_t run)
Definition: KVExpDB.cpp:134
KVDBRun * GetDBRun(Int_t number) const
Definition: KVExpDB.h:90
virtual KVSeqCollection * GetRuns() const
Definition: KVExpDB.h:86
TString GetCalibFileName(const Char_t *type) const
Definition: KVExpDB.h:134
virtual void LinkListToRunRanges(TList *list, UInt_t rr_number, UInt_t run_ranges[][2])
Link the records contained in the list to the set of runs (see LinkRecordToRunRanges).
Definition: KVExpDB.cpp:173
KVDBTable * fSystems
table of systems
Definition: KVExpDB.h:29
virtual void PrintRuns(KVNumberList &) const
Definition: KVExpDB.cpp:546
ULong64_t GetTotalEvents(int first_run, int last_run=-1) const
Definition: KVExpDB.cpp:632
virtual KVSeqCollection * GetSystems() const
Definition: KVExpDB.h:114
virtual void Save(const Char_t *)
Definition: KVExpDB.cpp:361
const KVDBRunFile & GetDBRunFile(const run_index_t &r) const
Definition: KVExpDB.h:94
TString fDBType
used by GetDBEnv
Definition: KVExpDB.h:25
virtual void LinkRecordToRunRanges(KVDBRecord *rec, UInt_t rr_number, UInt_t run_ranges[][2])
Definition: KVExpDB.cpp:153
std::map< int, run_index_t > fMapGlobRunFileNumberToRunIndex
Definition: KVExpDB.h:33
virtual void LinkListToRunRange(TList *list, const KVNumberList &nl)
Link the records contained in the list to the set of runs (see LinkRecordToRunRanges).
Definition: KVExpDB.cpp:199
void WriteSystemsFile() const
Definition: KVExpDB.cpp:328
KVExpDB()
Default constructor.
Definition: KVExpDB.cpp:38
const Char_t * GetDataSetDir() const
Definition: KVExpDB.h:161
void init()
default initialisations
Definition: KVExpDB.cpp:21
virtual TString GetDBEnv(const Char_t *) const
virtual void LinkRecordToRunRange(KVDBRecord *rec, UInt_t first_run, UInt_t last_run)
Definition: KVExpDB.cpp:90
int index_multiplier
Definition: KVExpDB.h:30
void SetDataSetDir(const Char_t *d)
Definition: KVExpDB.h:165
static KVExpDB * MakeDataBase(const Char_t *name, const Char_t *datasetdir)
Definition: KVExpDB.cpp:598
void WriteRunListFile() const
Definition: KVExpDB.cpp:381
Bool_t OpenCalibFile(const Char_t *type, std::ifstream &fs) const
cannot be saved, no streamer for run_index_t
Definition: KVExpDB.cpp:432
TString fDataSet
the name of the dataset to which this database is associated
Definition: KVExpDB.h:23
Bool_t FindCalibFile(const Char_t *type, TString &fullpath, const TString &array_name="") const
Definition: KVExpDB.cpp:486
Handle reading columns of numeric data in text files.
Definition: KVFileReader.h:121
KVString GetCurrentLine()
Definition: KVFileReader.h:320
ReadStatus ReadLine(const KVString &pattern="")
Definition: KVFileReader.h:243
Int_t GetNparRead() const
Definition: KVFileReader.h:325
Bool_t IsOK()
Definition: KVFileReader.h:231
KVString GetReadPar(Int_t pos) const
Definition: KVFileReader.h:342
Bool_t OpenFileToRead(const KVString &filename)
Definition: KVFileReader.h:210
Strings used to represent a set of ranges of values.
Definition: KVNumberList.h:85
Bool_t End(void) const
Definition: KVNumberList.h:199
void Begin(void) const
Int_t Next(void) const
TObject * At(Int_t idx) const override
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
void Begin(TString delim) const
Definition: KVString.cpp:565
KVString Next(Bool_t strip_whitespace=kFALSE) const
Definition: KVString.cpp:695
Int_t GetNValues(TString delim) const
Definition: KVString.cpp:886
virtual Int_t GetSize() const
const char * AsString() const
const char * GetName() const override
virtual const char * ClassName() const
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Error(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
Longptr_t ExecPlugin(int nargs)
const char * Data() const
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Bool_t IsNull() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Specifies a runfile according to run number and file index ,.
Definition: run_index.h:31
unsigned long long ULong64_t
TLine * line
rec
ClassImp(TPyArg)