KaliVeda
Toolkit for HIC analysis
KVDataSet.cpp
1 /*
2 $Id: KVDataSet.cpp,v 1.41 2009/03/11 14:22:41 franklan Exp $
3 $Revision: 1.41 $
4 $Date: 2009/03/11 14:22:41 $
5 $Author: franklan $
6 */
7 
8 #include "TMethodCall.h"
9 #include "KVDataSet.h"
10 #include "KVDataRepository.h"
11 #include "KVDataRepositoryManager.h"
12 #include "KVDataSetManager.h"
13 #include "TSystem.h"
14 #include "TObjArray.h"
15 #include "TObjString.h"
16 #include "KVDBSystem.h"
17 #include "KVDBRun.h"
18 #include "TEnv.h"
19 #include "KVAvailableRunsFile.h"
20 #include "KVNumberList.h"
21 #include "TPluginManager.h"
22 #include "TClass.h"
23 #include "KVRunFile.h"
24 
25 using namespace std;
26 
28 
29 KVDataSet* gDataSet;
30 
31 
34 
36 {
37  //Default constructor
38  fRepository = nullptr;
39  fDataBase = nullptr;
40  fAllTasks.SetOwner(kTRUE);
41  fTasks.SetOwner(kFALSE);
42 }
43 
44 
45 
49 
51 {
52  //Returns available runs file object for given data 'type' (="raw", "recon", "ident", "root")
53  //Object will be created and added to internal list if it does not exist
54 
55  if (!fRepository) return nullptr;
56  KVAvailableRunsFile* avrf =
57  (KVAvailableRunsFile*) fAvailableRuns.FindObjectByName(type);
58  if (!avrf) {
59  avrf = fRepository->NewAvailableRunsFile(type, this);
60  fAvailableRuns.Add(avrf);
61  }
62  return avrf;
63 }
64 
65 
66 
81 
83 {
84  //Returns name of file containing database for dataset.
85  //
86  //This is fixed as `DataBase.root.M.mm` where
87  // - `M` is the current major version number
88  // - `m` is the current minor version number
89  //
90  //(fixed to be consistent with CMake function INSTALL_KALIVEDA_DATASETS which sets up
91  //the Makefile for each dataset which automatically triggers rebuilding of the ROOT file
92  //when source files change: thus we must have the right file name!)
93  //
94  //This in order to avoid problems if several different versions of KaliVeda
95  //use the same working directory (in user's `$HOME/.kaliveda`) to write the
96  //database files, which are often incompatible between versions
97 
98  TString n = "DataBase.root";
99  n.Append(Form(".%d.%d", GetKVMajorVersion(),
100  GetKVMinorVersion()));
101  return n;
102 }
103 
104 
105 
109 
111 {
112  //Returns name of database object in database file.
113  //If this is not set explicitly with SetDBName(), we use the name of the dataset by default
114 
115  return (fDBName != "" ? fDBName.Data() : GetName());
116 }
117 
118 
119 
120 
123 
124 void KVDataSet::OpenDBFile(const Char_t* full_path_to_dbfile) const
125 {
126  //Open the database from a file on disk.
127 
128  TDirectory* work_dir = gDirectory; //keep pointer to current directory
129  fDBase.reset(new TFile(full_path_to_dbfile, "READ"));
130 
131  if (fDBase->IsOpen()) {
132  fDataBase = dynamic_cast<KVExpDB*>(fDBase->Get(GetDBName()));
133  if (!fDataBase) {
134  Error("OpenDBFile", "%s not found in file %s", GetDBName().Data(),
135  GetDBFileName().Data());
136  }
137  else {
138  fDataBase->ReadObjects(fDBase.get()); // read any associated objects
139  }
140  work_dir->cd(); //back to initial working directory
141  }
142 }
143 
144 
145 
146 
149 
151 {
152  // Returns full path to file where database is written on disk
153 
154  TString dbfile = GetDBFileName();
155  TString dbfile_fullpath;
156  TString tmp;
157 
158  // If this dataset is just an alias for another dataset i.e. if DataSet.Directory
159  // is set with just the name of another dataset (not a full path to dataset files)
160  // then the database file should be written/found under the name of the alias.
161  TString dataset_alias = GetDataSetEnv("DataSet.Directory", GetName());
162  TString db_alias = GetName();
163  if (!gSystem->IsAbsoluteFileName(dataset_alias)) db_alias = dataset_alias;
164 
165  AssignAndDelete(tmp, gSystem->ConcatFileName(GetDATABASEFilePath(), db_alias.Data()));
166  AssignAndDelete(dbfile_fullpath, gSystem->ConcatFileName(tmp.Data(), dbfile.Data()));
167  return dbfile_fullpath;
168 }
169 
170 
171 
177 
179 {
180  //PROTECTED METHOD
181  //Called by KVDataSet::SetAnalysisTasks
182  //Check environment variables (i.e. .kvrootrc) to see if the task parameters
183  //have been "tweaked" for the dataset.
184 
185  KVString envar = GetDataSetEnv(Form("%s.DataAnalysisTask.Title", t->GetName()));
186  if (envar != "") t->SetTitle(envar);
187  envar = GetDataSetEnv(Form("%s.DataAnalysisTask.Analyser", t->GetName()));
188  if (envar != "") t->SetDataAnalyser(envar);
189  envar = GetDataSetEnv(Form("%s.DataAnalysisTask.UserClass.Base", t->GetName()));
190  if (envar != "") t->SetUserBaseClass(envar);
191  envar = GetDataSetEnv(Form("%s.DataAnalysisTask.Prereq", t->GetName()));
192  if (envar != "") t->SetPrereq(envar);
193  envar = GetDataSetEnv(Form("%s.DataAnalysisTask.UserClass.ExtraACliCIncludes", t->GetName()));
194  if (envar != "") t->SetExtraAClicIncludes(envar);
195  Int_t nev = (Int_t)GetDataSetEnv(Form("%s.DataAnalysisTask.StatusUpdateInterval", t->GetName()), 0.0);
196  if (nev > 0) t->SetStatusUpdateInterval(nev);
197 }
198 
199 
200 
201 
212 
214 {
215  // Write the database to disk (ROOT file).
216  // It will be written in the directory
217  // $KVROOT/db/[dataset name]
218  // If the directory does not exist, it will be created. Permissions are set to 775 (rwxrwxr-x).
219  //
220  // # Default name of database file containing informations on runs, systems, calibration parameters etc.
221  // DataSet.DatabaseFile: DataBase.root
222  // # Default name of database object in file
223  // DataSet.DatabaseName: DataBase
224 
225  TString dbfile_fullpath = GetFullPathToDB();
226  TString tmp = gSystem->DirName(dbfile_fullpath.Data()); //full path to directory $KVROOT/db/[dataset name]
227 
228  if (gSystem->AccessPathName(tmp.Data())) { // directory $KVROOT/db/[dataset name] does not exist
229 
230  if (gSystem->mkdir(tmp.Data()) == -1) { // problem creating $KVROOT/db/[dataset name]
231 
232  TString tmp2 = gSystem->DirName(tmp.Data());// full path to directory $KVROOT/db
233 
234  if (gSystem->AccessPathName(tmp2.Data())) { // directory $KVROOT/db does not exist
235 
236  if (gSystem->mkdir(tmp2.Data()) == -1) { // problem creating $KVROOT/db
237  Error("SaveDataBase", "Cannot create directory %s required to save database",
238  tmp2.Data());
239  return;
240  }
241  gSystem->Chmod(tmp2.Data(), 0775);
242  }
243  else {
244  Error("SaveDataBase", "Cannot create directory %s required to save database, even though %s exists: check disk space ?",
245  tmp.Data(), tmp2.Data());
246  return;
247  }
248  //try again
249  if (gSystem->mkdir(tmp.Data()) == -1) {
250  Error("SaveDataBase", "Cannot create directory %s required to save database",
251  tmp.Data());
252  return;
253  }
254  else {
255  gSystem->Chmod(tmp.Data(), 0775);
256  }
257  }
258  else {
259  gSystem->Chmod(tmp.Data(), 0775);
260  }
261  }
262 
263  WriteDBFile(dbfile_fullpath.Data());
264 }
265 
266 
267 
268 
273 
274 void KVDataSet::WriteDBFile(const Char_t* full_path_to_dbfile) const
275 {
276  //PRIVATE METHOD
277  //Write the database to disk.
278  //Set permissions to rw for user & group
279 
280  TDirectory* work_dir = gDirectory; //keep pointer to current directory
281  if (!fDataBase) {
282  Error("WriteDBFile", "Database has not been built");
283  return;
284  }
285  fDBase.reset(new TFile(full_path_to_dbfile, "recreate"));
286  fDBase->cd(); //set as current directory (maybe not necessary)
287  fDataBase->Write(GetDBName()); //write database to file with given name
288  fDataBase->WriteObjects(fDBase.get()); //write any associated objects
289  fDBase->Write(); // write file header etc.
290  fDBase->Close(); // close file
291  gSystem->Chmod(full_path_to_dbfile, 0664); // set permissions to rw-rw-r--
292  work_dir->cd(); //back to initial working directory
293 }
294 
295 
296 
307 
309 {
310  //Returns pointer to database associated with this dataset.
311  //Opens, updates or creates database file if necessary
312  //(the database is automatically rebuilt if the source files are
313  //more recent than the last database file).
314  //
315  //If opt="update":
316  // close and delete database if already open
317  // regenerate database from source files
318  //Use this option to force the regeneration of the database.
319 
320  TString _opt(opt);
321  _opt.ToUpper();
322  if (_opt == "UPDATE") {
323  OpenDataBase(_opt.Data());
324  }
325  else {
326  OpenDataBase();
327  }
328  return fDataBase;
329 }
330 
331 
332 
353 
355 {
356  //Open the database for this dataset.
357  //If the database does not exist or is older than the source files
358  //the database is automatically rebuilt
359  //(see DataBaseNeedUpdate()).
360  //Use opt="UPDATE" to force rebuilding of the database.
361  //
362  //First, we look in to see if the database file exists
363  //(if no database file name given, use default name for database file defined in
364  //.rootrc config files).
365  //If so, we open the database contained in the file, after first loading the required plugin
366  //library if needed.
367  //
368  //The name of the dataset must correspond to the name of one of the Plugin.KVDataBase
369  //plugins defined in the .rootrc configuration files
370  //
371  //WARNING: if the database needs to be (re)built, we set gDataSet to
372  //point to this dataset in case it was not already done,
373  //as in order to (re)build the database it may be necessary for
374  //gDataSet to point to the current dataset.
375 
376  Bool_t is_glob_db = kFALSE;
377  //if option="update" or database out of date or does not exist, (re)build the database
378  if ((!strcmp(opt, "UPDATE")) || DataBaseNeedsUpdate()) {
379  //check if it is the currently active database (gDataBase),
380  //in which case we must 'cd()' to it after rebuilding
381  Info("OpenDataBase", "Updating database file");
382  fDataBaseUpdateInProgress = true;
383  is_glob_db = (fDataBase == gExpDB);
384  if (fDataBase) {
385  delete fDataBase;
386  fDataBase = 0;
387  }
388  // make sure gDataSet is set & points to us
389  gDataSet = const_cast<KVDataSet*>(this);
390  fDataBase = KVExpDB::MakeDataBase(GetDBName(), GetDataSetDir());
391  if (!fDataBase) {
392  // no database defined for dataset
393  Info("OpenDataBase", "No database defined for dataset");
394  return;
395  }
396  SaveDataBase();
397  if (fDataBase && is_glob_db) fDataBase->cd();
398  fDataBaseUpdateInProgress = false;
399  }
400  else if (!fDataBase) {
401  // if database is not in memory at this point, we need to
402  // open the database file and read in the database
403 
404  //load plugin for database
405  if (!LoadPlugin("KVExpDB", GetDBName())) {
406  Error("GetDataBase", "Cannot load required plugin library");
407  return;
408  }
409  //look for database file in dataset subdirectory
410  TString dbfile_fullpath = GetFullPathToDB();
411  //open database file
412  OpenDBFile(dbfile_fullpath.Data());
413  }
414 }
415 
416 
417 
418 
421 
423 {
424  //Print dataset information
425  cout << "Dataset name=" << GetName() << " (" << GetTitle() << ")";
426  if (IsAvailable()) {
427  cout << " [ AVAILABLE: ";
428  cout << fDatatypes.Data();
429  cout << "]";
430  }
431  else
432  cout << " [UNAVAILABLE]";
433  cout << endl;
434 }
435 
436 
437 
442 
443 void KVDataSet::Print(Option_t* opt) const
444 {
445  //Print dataset information
446  //If option string contains "tasks", print numbered list of tasks that can be performed
447  //If option string contains "data", print list of available data types
448 
449  TString Sopt(opt);
450  Sopt.ToUpper();
451  if (Sopt.Contains("TASK")) {
452  if (!GetNtasks()) {
453  cout << " *** No available analysis tasks ***"
454  << endl;
455  return;
456  }
457  else {
458  for (int i = 1; i <= GetNtasks(); i++) {
459  KVDataAnalysisTask* dat = GetAnalysisTask(i);
460  cout << "\t" << i << ". " << dat->GetTitle() << endl;
461  }
462  }
463  cout << endl;
464  }
465  else if (Sopt.Contains("DATA")) {
466  cout << "Available data types: " << fDatatypes.Data() << endl;
467  }
468  else {
469  ls(opt);
470  }
471 }
472 
473 
474 
493 
495 {
496  //Check if this data set is physically present and available for analysis.
497  //In other words we check if the value of GetDatapathSubdir() is a subdirectory
498  //of the given data repository
499  //If so, we proceed to check for the existence of any of the datatypes defined in
500  //
501  //KVDataSet.DataTypes:
502  //
503  //by checking for the associated sudirectories defined in the corresponding variables:
504  //
505  //KVDataSet.DataType.Subdir.[type]:
506  //
507  //If none of them exists, the dataset will be reset to 'unavailable'
508  //Otherwise the corresponding flags are set.
509  //
510  //Note that if SetUserGroups has been called with a list of groups allowed to read this data,
511  //the current user's name (gSystem->GetUserInfo()->fUser) will be used to check if the
512  //dataset is available. The user name must appear in the group defined by SetUserGroups.
513 
514  if (!fRepository) // for a stand-alone KVDataSetManager not linked to a KVDataRepository,
515  SetAvailable(); // all known datasets are 'available'
516  else
517  SetAvailable(fRepository->CheckSubdirExists(GetDataPathSubdir()));
518  if (!IsAvailable())
519  return;
520  //check subdirectories
521  KVString data_types = GetDataSetEnv("KVDataSet.DataTypes", "");
522  if (data_types == "") {
523  Warning("CheckAvailable", "No datatypes defined for this dataset: %s\nCheck value of KVDataSet.DataTypes or %s.KVDataSet.DataTypes",
524  GetName(), GetName());
525  SetAvailable(kFALSE);
526  }
527  fDatatypes = "";
528  // loop over data types
529  data_types.Begin(" ");
530  while (!data_types.End()) {
531  KVString type = data_types.Next(kTRUE);
532  if (!fRepository ||
533  (fRepository && fRepository->CheckSubdirExists(GetDataPathSubdir(), GetDataTypeSubdir(type.Data())))
534  ) {
535  AddAvailableDataType(type.Data());
536  }
537  }
538  //check at least one datatype exists
539  SetAvailable(fDatatypes != "");
540  //check user name against allowed groups
541  if (!CheckUserCanAccess()) {
542  SetAvailable(kFALSE);
543  return;
544  }
545 }
546 
547 
548 
550 
552 {
553  if (fDatatypes != "") fDatatypes += " ";
554  KVString _type = type;
555  _type.Remove(TString::kBoth, ' '); //strip whitespace
556  fDatatypes += _type;
557 }
558 
559 
560 
567 
569 {
570  // Add to fAllTasks list any data analysis task in list 'task_list'
571  //
572  // Add to fTasks list any data analysis task in list 'task_list' whose pre-requisite datatype is present for this dataset.
573  //
574  // Any dataset-specific "tweaking" of the task (including the prerequisite datatype) is done here.
575 
576  TString availables = gEnv->GetValue(Form("%s.DataAnalysisTask", GetName()), "");
577  fAllTasks.Clear();
578  fTasks.Clear();
579  TIter nxt(task_list);
580  KVDataAnalysisTask* dat;
581  while ((dat = (KVDataAnalysisTask*) nxt())) {
582  //make new copy of default analysis task
583  if (availables == "" || availables.Contains(dat->GetName())) {
584  KVDataAnalysisTask* new_task = new KVDataAnalysisTask(*dat);
585  //check if any dataset-specific parameters need to be changed
586  SetDataSetSpecificTaskParameters(new_task);
587  fAllTasks.Add(new_task);
588  // add tasks with available prerequisite data to fTasks
589  if (HasDataType(new_task->GetPrereq())) {
590  fTasks.Add(new_task);
591  }
592  }
593  }
594 }
595 
596 
597 
601 
603 {
604  //Returns the number of tasks associated to dataset which are compatible
605  //with the available data
606 
607  return fTasks.GetSize();
608 }
609 
610 
611 
616 
618 {
619  //Return kth analysis task in list of available tasks.
620  //k=[1, GetNtasks()] and corresponds to the number shown next to the title of the task when
621  //KVDataSet::Print("tasks") is called
622  return (KVDataAnalysisTask*) fTasks.At(k - 1);
623 }
624 
625 
626 
640 
641 std::unique_ptr<TList> KVDataSet::GetListOfAvailableSystems(const Char_t* datatype, KVDBSystem* systol)
642 {
643  //Create and fill a list of available systems for this dataset and the given datatype
644  //
645  //This uses the database associated to the dataset.
646  //
647  //For each system in the list we set the number of available runs : this number
648  //can be retrieved with KVDBSystem::GetNumberRuns()
649  //
650  //If systol!=0 then in fact the list contains a list of runs for the given system which are available.
651  //
652  //If no systems are defined for the dataset then we return a list of available runs
653  //for the given datatype
654 
655  //open the available runs file for the data type
656  if (!GetAvailableRunsFile(datatype)) {
657  Error("GetListOfAvailableSystems(const Char_t*)",
658  "No available runs file for type %s", datatype);
659  return 0;
660  }
661  return GetAvailableRunsFile(datatype)->GetListOfAvailableSystems(systol);
662 }
663 
664 
665 
678 
680 {
681  //Create and fill a list of available systems for this dataset and the prerequisite
682  //datatype for the given data analysis task.
683  //This uses the database associated to the dataset.
684  //
685  //For each system in the list we set the number of available runs : this number
686  //can be retrieved with KVDBSystem::GetNumberRuns()
687  //
688  //If systol!=0 then in fact the list contains a list of runs for the given system which are available.
689  //
690  //If no systems are defined for the dataset then we return a list of available runs
691  //for the given datatype
692 
693  return GetListOfAvailableSystems(datan->GetPrereq(), systol);
694 }
695 
696 
697 
711 
712 void KVDataSet::SetName(const char* name)
713 {
714  // Set name of dataset.
715  // Also sets path to directory containing database informations
716  // for this dataset, i.e. list of runs, systems, calibration files etc.
717  // By default, just the name of the dataset is used, i.e.
718  // [DATADIR]/name
719  // (where DATADIR = path given by KVBase::GetDATADIRFilePath())
720  // However, if the variable
721  // [name].DataSet.Directory: [path]
722  // has been set, the value of [path] will be used.
723  // If [path] is an absolute path name, it will be used as such.
724  // If [path] is an incomplete or relative path, it will be prepended
725  // with [DATADIR]/
727  TString path = GetDataSetEnv("DataSet.Directory", name);
728  if (gSystem->IsAbsoluteFileName(path)) fCalibDir = path;
729  else {
730  // in this case (not an absolute path but just the name of another dataset)
731  // this dataset is an alias for another dataset.
732  fCalibDir = GetDATADIRFilePath(path);
733  // the name of the database object is the name of the "true" dataset
734  SetDBName(path);
735  }
736 }
737 
738 
739 
743 
745 {
746  //Returns full path to directory containing database and calibration/identification parameters etc.
747  //for this dataset.
748  return fCalibDir.Data();
749 }
750 
751 
752 
759 
760 void KVDataSet::cd() const
761 {
762  //Data analysis can only be performed if the data set in question
763  //is "activated" or "selected" using this method.
764  //At the same time, the data repository, dataset manager and database associated with
765  //this dataset also become the "active" ones (pointed to by the respective global
766  //pointers, gDataRepository, gDataBase, etc. etc.)
767 
768  gDataSet = const_cast<KVDataSet*>(this);
769  if (fRepository) fRepository->cd();
770  KVExpDB* db = GetDataBase();
771  if (db) db->cd();
772 }
773 
774 
775 
776 
781 
782 KVString KVDataSet::GetDataSetEnv(const Char_t* type, const Char_t* defval) const
783 {
784  //Will look for gEnv->GetValue "name_of_dataset.type"
785  //then simply "type" if no dataset-specific value is found.
786  //If neither resource is defined, return the "defval" default value (="" by default)
787 
788  return KVBase::GetDataSetEnv(GetName(), type, KVString(defval));
789 }
790 
791 
792 
793 
798 
800 {
801  //Will look for gEnv->GetValue "name_of_dataset.type"
802  //then simply "type" if no dataset-specific value is found.
803  //If neither resource is defined, return the "defval" default value
804 
805  return KVBase::GetDataSetEnv(GetName(), type, defval);
806 }
807 
808 
809 
810 
815 
816 Int_t KVDataSet::GetDataSetEnv(const Char_t* type, Int_t defval) const
817 {
818  //Will look for gEnv->GetValue "name_of_dataset.type"
819  //then simply "type" if no dataset-specific value is found.
820  //If neither resource is defined, return the "defval" default value
821 
822  return KVBase::GetDataSetEnv(GetName(), type, defval);
823 }
824 
825 
826 
827 
832 
833 Bool_t KVDataSet::GetDataSetEnv(const Char_t* type, Bool_t defval) const
834 {
835  //Will look for gEnv->GetValue "name_of_dataset.type"
836  //then simply "type" if no dataset-specific value is found.
837  //If neither resource is defined, return the "defval" default value
838 
839  return KVBase::GetDataSetEnv(GetName(), type, defval);
840 }
841 
842 
843 
844 
845 
873 
875 {
876  // Open file containing data of given datatype for given run number of this dataset.
877  //
878  // Returns a pointer to the opened file; if the file is not available, we return nullptr.
879  //
880  // The user must cast the returned pointer to the correct class, which will
881  // depend on the data type and the dataset (see `$KVROOT/KVFiles/.kvrootrc`)
882  //
883  // **SPECIAL CASE: MFM data with EBYEDAT frames**
884  //
885  // If the variable
886  //
887  //~~~~~~~~~~~~~~~~~~~~~~~~~
888  // [dataset].MFM.WithEbyedat: yes
889  //~~~~~~~~~~~~~~~~~~~~~~~~~
890  //
891  // is set, then we expect to find the necessary `ACTIONS_*` files in the dataset directory
892  // in subdirectory `ebyedat` (they should have the same names as the data files prefixed by
893  // `ACTIONS_[expname].CHC_PAR.`).
894  //
895  // If in addition the variable
896  //
897  //~~~~~~~~~~~~~~~~~~~~~~~~~
898  // [dataset].MFM.EbyedatActionsExpName: [expname]
899  //~~~~~~~~~~~~~~~~~~~~~~~~~
900  //
901  // is set, then we use the same `ACTIONS` file for all runs, with name `ACTIONS_[expname].CHC_PAR`
902 
903 
904  if (!strcmp(type, "raw") && !strcmp(GetDataSetEnv("MFM.WithEbyedat", ""), "yes")) {
905  TString ebydir = GetDataSetDir();
906  ebydir += "/ebyedat";
907  gEnv->SetValue("KVMFMDataFileReader.ActionsDirectory", ebydir);
908  if (strcmp(GetDataSetEnv("MFM.EbyedatActionsExpName", ""), ""))
909  gEnv->SetValue("KVMFMDataFileReader.ActionsExpName", GetDataSetEnv("MFM.EbyedatActionsExpName", ""));
910  TObject* f = GetRepository()->OpenDataSetRunFile(this, type, run, GetName());
911  // reset in case another dataset opens a raw MFM file without EBYEDAT data
912  gEnv->SetValue("KVMFMDataFileReader.ActionsDirectory", "");
913  gEnv->SetValue("KVMFMDataFileReader.ActionsExpName", "");
914  return f;
915  }
916  return GetRepository()->OpenDataSetRunFile(this, type, run, GetName());
917 }
918 
919 
920 
921 
928 
930  const run_index_t& run) const
931 {
932  //Return full path to file containing data of given datatype for given run number
933  //of this dataset. NB. only works for available run files, if their is no file in the repository for this run,
934  //the returned path will be empty.
935  //This path should be used with e.g. TChain::Add.
936 
937  //get name of file from available runs file
938  TString file("");
939  if (fRepository) file = GetRunfileName(type, run);
940  if (file == "")
941  return file.Data();
942  return fRepository->GetFullPathToOpenFile(this, type, file.Data());
943 }
944 
945 
946 
947 
954 
956 {
957  //Return name of file containing data of given datatype
958  //for given run number of this dataset.
959  //NB. only works for available run files, if there is no file in the repository for this run,
960  //the returned path will be empty.
961 
962  //check data type is available
963  if (!HasDataType(type)) {
964  Error("GetRunfileName",
965  "No data of type \"%s\" available for dataset %s", (const char*)type,
966  GetName());
967  return 0;
968  }
969  //get name of file from available runs file
970  return GetAvailableRunsFile(type)->GetFileName(run);
971 }
972 
973 
974 
975 
982 
984 {
985  //Return date of file containing data of given datatype
986  //for given run number of this dataset.
987  //NB. only works for available run files, if there is no file in the repository for this run,
988  //an error will be printed and the returned data is set to "Sun Jan 1 00:00:00 1995"
989  //(earliest possible date for TDatime class).
990 
991  static TDatime date;
992  date.Set(1995, 1, 1, 0, 0, 0);
993  //check data type is available
994  if (!HasDataType(type)) {
995  Error("GetRunfileDate",
996  "No data of type \"%s\" available for dataset %s", (const char*)type,
997  GetName());
998  return date;
999  }
1000  //get date of file from available runs file
1001  TString filename;
1002  if (!GetAvailableRunsFile(type)->GetRunInfo(run, date, filename)) {
1003  Error("GetRunfileDate",
1004  "Runfile not found for run %d index %d (data type: %s)", run.run(), run.index(), (const char*)type);
1005  }
1006  return date;
1007 }
1008 
1009 
1010 
1011 
1016 
1018 {
1019  //We check the availability of the run by looking in the available runs file associated
1020  //with the given datatype.
1021 
1022  //check data type is available
1023  if (!HasDataType(type)) {
1024  Error("CheckRunfileAvailable",
1025  "No data of type \"%s\" available for dataset %s", (const char*)type,
1026  GetName());
1027  return 0;
1028  }
1029  return GetAvailableRunsFile(type)->CheckAvailable(run);
1030 }
1031 
1032 
1033 
1034 
1049 
1050 const Char_t* KVDataSet::GetBaseFileName(const Char_t* type, const run_index_t& run) const
1051 {
1052  //PRIVATE METHOD: Returns base name of data file containing data for the run of given datatype.
1053  //The filename corresponds to one of the formats defined in $KVROOT/KVFiles/.kvrootrc
1054  //by variables like:
1055  //
1056  //~~~
1057  //[dataset].DataSet.RunFileName.[type]: run%R.dat
1058  //~~~
1059  //
1060  //%R will be replaced with the run number
1061  //
1062  //IF the format contains '%D' it will be replaced with the current date and time
1063  //
1064  // Any index will be appended at the end: ".index"
1065 
1066  static TString tmp;
1067  //get format string
1068  TString fmt = GetDataSetEnv(Form("DataSet.RunFileName.%s", type));
1069  TString run_num(Form("%d", run.run()));
1070  KVDatime now;
1071  TString date(now.AsSQLString());
1072  tmp = fmt;
1073  tmp.ReplaceAll("%R", run_num);
1074  if (fmt.Contains("%D")) {
1075  tmp.ReplaceAll("%D", date);
1076  }
1077  if (run.has_index()) tmp += Form(".%d", run.index());
1078  return tmp.Data();
1079 }
1080 
1081 
1082 
1083 
1087 
1089 {
1090  //Update list of available runs for given data 'type'
1091 
1092  //check data type is available
1093  if (!HasDataType(type)) {
1094  Error("UpdateAvailableRuns",
1095  "No data of type \"%s\" available for dataset %s", (const char*)type,
1096  GetName());
1097  }
1098  KVAvailableRunsFile* a = GetAvailableRunsFile(type);
1099  a->Update();
1100 }
1101 
1102 
1103 
1104 
1109 
1111 {
1112  // Create a new runfile for the dataset of given datatype.
1113  // (only if this dataset is associated with a data repository)
1114  // Once the file has been filled, use CommitRunfile to submit it to the repository.
1115 
1116  if (!fRepository) return nullptr;
1117  TString tmp = GetBaseFileName(type, run);
1118  //turn any spaces into "_"
1119  tmp.ReplaceAll(" ", "_");
1120  return fRepository->CreateNewFile(this, type, tmp.Data());
1121 }
1122 
1123 
1124 
1125 
1134 
1135 void KVDataSet::DeleteRunfile(const KVString& type, const run_index_t& run, Bool_t confirm)
1136 {
1137  // Delete the file for the given run/index of data type "type" from the repository.
1138  // By default, confirm=kTRUE, which means that the user will be asked to confirm
1139  // that the file should be deleted. If confirm=kFALSE, no confirmation will be asked
1140  // for and the file will be deleted straight away.
1141  //
1142  // WARNING: this really does DELETE files in the repository, they cannot be
1143  // retrieved once they have been deleted.
1144 
1145  if (!fRepository) return;
1146 
1147  //get name of file to delete
1148  TString filename = GetAvailableRunsFile(type)->GetFileName(run);
1149  if (filename == "") {
1150  Error("DeleteRunfile", "Run %s of type %s does not exist.",
1151  run.as_string().Data(), (const char*)type);
1152  return;
1153  }
1154  //delete file
1155  //prevent accidental deletion of certain types of runfiles
1156  KVString doNotDelete = GetDataSetEnv("DataSet.RunFile.DoNotDelete", "all");
1157  if (doNotDelete == "all" || doNotDelete.Contains(type)) {
1158  Error("DeleteRunFile", "%s files cannot be deleted", (const char*)type);
1159  return;
1160  }
1161  fRepository->DeleteFile(this, type, filename.Data(), confirm);
1162  //was file deleted ? if so, remove entry from available runs file
1163  if (!fRepository->CheckFileStatus(this, type, filename.Data()))
1164  GetAvailableRunsFile(type)->Remove(run);
1165 }
1166 
1167 
1168 
1169 
1181 
1182 void KVDataSet::DeleteRunfiles(const Char_t* type, const run_index_list& nl, Bool_t confirm)
1183 {
1184  // Delete files corresponding to a list of runs/index of data type "type" from the repository.
1185  //
1186  // By default, confirm=kTRUE, which means that the user will be asked to confirm
1187  // that each file should be deleted.
1188  //
1189  // If confirm=kFALSE, no confirmation will be asked for and the file will be deleted straight away.
1190  //
1191  // if "nl" is empty (default value) all runs of the dataset corresponding to the given type will be deleted
1192  //
1193  // WARNING: this really does DELETE files in the repository, they cannot be retrieved once they have been deleted.
1194 
1195  auto NL = nl;
1196  if (NL.IsEmpty()) NL = GetRunList(type);
1197  if (NL.IsEmpty()) return;
1198  for (auto& r : NL)
1199  DeleteRunfile(type, r, confirm);
1200 }
1201 
1202 
1203 
1204 
1212 
1213 run_index_list KVDataSet::GetRunList_DateSelection(const Char_t* type, TDatime* min, TDatime* max)
1214 {
1215  // Prints out and returns list of runs after date / time selection
1216  //
1217  // Runs generated between ]min;max[ are selected
1218  // - if min=NULL runs with date <max are selected
1219  // - if max=NULL runs with date >min are selected
1220  // - if max and min are NULL returns empty list
1221 
1222  if (!min && !max) return {};
1223 
1224  if (min) printf("date minimum %s\n", min->AsString());
1225  if (max) printf("date maximum %s\n", max->AsString());
1226 
1227  run_index_list numb;
1228 
1229  auto ll = GetListOfAvailableSystems(type);
1230  KVDBSystem* sys = 0;
1231  KVRunFile* run = 0;
1232  for (Int_t nl = 0; nl < ll->GetEntries(); nl += 1) {
1233  sys = (KVDBSystem*)ll->At(nl);
1234  auto lrun = GetListOfAvailableSystems(type, sys);
1235  auto oldList = numb;
1236  for (Int_t nr = 0; nr < lrun->GetEntries(); nr += 1) {
1237  run = (KVRunFile*)lrun->At(nr);
1238 
1239  if (min && max) {
1240  if (*min < run->GetFileWrittenDatime() && run->GetFileWrittenDatime() < *max) {
1241  numb.Add(run->GetRunIndex());
1242  }
1243  }
1244  else if (min) {
1245  if (*min < run->GetFileWrittenDatime()) {
1246  numb.Add(run->GetRunIndex());
1247  }
1248  }
1249  else if (max) {
1250  if (run->GetFileWrittenDatime() < *max) {
1251  numb.Add(run->GetRunIndex());
1252  }
1253  }
1254  }
1255  // print runs for system if any
1256  if (numb.GetEntries() > oldList.GetEntries())
1257  printf("%s : %s\n", sys->GetName(), (numb - oldList).AsString().Data());
1258  }
1259  return numb;
1260 
1261 }
1262 
1263 
1264 
1265 
1274 
1275 run_index_list KVDataSet::GetRunList_StageSelection(const Char_t* type, const Char_t* ref_type, KVDBSystem* system, Bool_t OnlyCol)
1276 {
1277  // Returns list of runs which are present for data type "base_type" but not for "other_type"
1278  //
1279  // if type is NULL or ="" returns empty KVNumberList
1280  //
1281  // If pointer to system is given, only runs for the system are considered.
1282  //
1283  // If OnlyCol=kTRUE (kFALSE default) only systems with KVDBSystem::IsCollision()=kTRUE are considered
1284 
1285  run_index_list manquant;
1286  auto ll = GetListOfAvailableSystems(ref_type);
1287  if (!ll || !ll->GetEntries()) {
1288  //numb.Clear();
1289  Info("GetRunList_StageSelection", "No data available of type \"%s\"", ref_type);
1290  return manquant;
1291  }
1292  if (system && !ll->FindObject(system)) {
1293  Info("GetRunList_StageSelection", "No data available of type \"%s\" for system %s", ref_type, system->GetName());
1294  return manquant;
1295  }
1296 
1297  Info("GetRunList_StageSelection", "Liste des runs presents dans \"%s\" mais absent dans \"%s\"", ref_type, type);
1298 
1299  KVDBSystem* sys = 0;
1300 
1301  for (Int_t nl = 0; nl < ll->GetEntries(); nl += 1) {
1302 
1303  sys = (KVDBSystem*)ll->At(nl);
1304  if (system && sys != system) continue;
1305  if (OnlyCol && !sys->IsCollision()) continue;
1306  auto nsys = GetRunList(type, sys);
1307  auto nsys_ref = GetRunList(ref_type, sys);
1308  Int_t nref = nsys_ref.GetNValues();
1309 
1310  nsys_ref.Remove(nsys);
1311 
1312  Info("GetRunList_StageSelection", "\nKVDBSystem : %s --> %d runs manquants sur %d : %s",
1313  sys->GetName(),
1314  nsys_ref.GetNValues(),
1315  nref,
1316  nsys_ref.AsString().Data()
1317  );
1318  manquant.Add(nsys_ref);
1319  }
1320  return manquant;
1321 }
1322 
1323 
1324 
1328 
1329 run_index_list KVDataSet::GetRunList_VersionSelection(const Char_t* type, const Char_t* version, KVDBSystem* sys)
1330 {
1331  // Returns list of runs of given type that were created with the given version of KaliVeda.
1332  // If system!="" then only runs for the given system are considered
1333 
1334  run_index_list runs;
1335  if (sys) {
1336  unique_ptr<TList> lrun(GetListOfAvailableSystems(type, sys));
1337  TIter next(lrun.get());
1338  KVRunFile* run;
1339  while ((run = (KVRunFile*)next())) {
1340  if (!strcmp(run->GetVersion(), version)) runs.Add(run->GetRunIndex());
1341  }
1342  return runs;
1343  }
1344  unique_ptr<TList> ll(GetListOfAvailableSystems(type));
1345  if (!ll.get() || !ll->GetEntries()) {
1346  //numb.Clear();
1347  Info("GetRunList_VersionSelection", "No data available of type \"%s\"", type);
1348  return runs;
1349  }
1350  Int_t nsys = ll->GetEntries();
1351  for (Int_t nl = 0; nl < nsys; nl += 1) {
1352  sys = (KVDBSystem*)ll->At(nl);
1353  unique_ptr<TList> lrun(GetListOfAvailableSystems(type, sys));
1354  TIter next(lrun.get());
1355  KVRunFile* run;
1356  while ((run = (KVRunFile*)next())) {
1357  if (!strcmp(run->GetVersion(), version)) runs.Add(run->GetRunIndex());
1358  }
1359  }
1360  return runs;
1361 }
1362 
1363 
1364 
1369 
1370 void KVDataSet::CommitRunfile(const KVString& type, const run_index_t& run, TFile* file)
1371 {
1372  // Commit a runfile previously created with NewRunfile() to the repository.
1373  // Any previous version of the runfile will be deleted.
1374  // The available runs list for this data 'type' is updated.
1375 
1376  if (!fRepository) return;
1377 
1378  //keep name of file for updating available runs list
1379  TString newfile = gSystem->BaseName(file->GetName());
1380 
1381  fRepository->CommitFile(file, type, this);
1382  //update list of available datatypes of dataset,
1383  //in case this addition has created a new subdirectory
1384  CheckAvailable();
1385  //check if previous version of file exists
1386  //get name of file from available runs file
1387  //note that when the file is the first of a new subdirectory, GetAvailableRunsFile->GetFileName
1388  //will cause the available runs file to be created, and it will contain one entry:
1389  //the new file!
1390  TString oldfile = GetAvailableRunsFile(type)->GetFileName(run);
1391  if (oldfile != "" && oldfile != newfile) {
1392  //delete previous version - no confirmation
1393  fRepository->DeleteFile(this, type, oldfile.Data(),
1394  kFALSE);
1395  //was file deleted ? if so, remove entry from available runs file
1396  if (!fRepository->CheckFileStatus(this, type, oldfile.Data()))
1397  GetAvailableRunsFile(type)->Remove(run);
1398  }
1399  if (oldfile != newfile) {
1400  //add entry for new run in available runs file
1401  GetAvailableRunsFile(type)->Add(run, newfile.Data());
1402  }
1403 }
1404 
1405 
1406 
1407 
1413 
1415 {
1416  //if fUserGroups has been set with SetUserGroups(), we check that the current user's name
1417  //(gSystem->GetUserInfo()->fUser) appears in at least one of the groups in the list.
1418  //Returns kFALSE if user's name is not found in any of the groups.
1419  //if fUserGroups="" (default), we return kTRUE for all users.
1420 
1421  if (fUserGroups == "")
1422  return kTRUE; /* no groups set, all users have access */
1423 
1424  //split into array of group names
1425  unique_ptr<TObjArray> toks(fUserGroups.Tokenize(' '));
1426  TObjString* group_name;
1427  TIter next_name(toks.get());
1428  while ((group_name = (TObjString*) next_name())) {
1429  //for each group_name, we check if the user's name appears in the group
1430  if (!fRepository || (fRepository && fRepository->GetDataSetManager()->
1431  CheckUser(group_name->String().Data()))
1432  ) {
1433  return kTRUE;
1434  }
1435  }
1436  return kFALSE;
1437 }
1438 
1439 
1440 
1441 
1444 
1446 {
1447  //Set pointer to data repository in which dataset is stored
1448  fRepository = dr;
1449 }
1450 
1451 
1452 
1453 
1456 
1458 {
1459  //Get pointer to data repository in which dataset is stored
1460  return fRepository;
1461 }
1462 
1463 
1464 
1465 
1470 
1472 {
1473  //Check all runs for a given datatype and make sure that only one version
1474  //exists for each runfile. If not, we print a report on the runfiles which occur
1475  //multiple times, with the associated date and file name.
1476 
1477  auto doubles = GetAvailableRunsFile(data_type)->CheckMultiRunfiles();
1478  if (doubles.empty()) {
1479  cout << "OK. No runs appear more than once." << endl;
1480  }
1481  else {
1482  cout << "Runs which appear more than once: " << endl << endl;
1483  //print dates and filenames for each run
1484 
1485  for (auto& rr : doubles) {
1486  KVList filenames, dates;
1487 
1488  //get infos for current run
1489  GetAvailableRunsFile(data_type)->GetRunInfos(rr, &dates, &filenames);
1490 
1491  cout << "Run " << rr << " : " << dates.GetEntries() << " files >>>>>>" << endl;
1492  for (int i = 0; i < dates.GetEntries(); i++) {
1493 
1494  cout << "\t" << ((TObjString*) filenames.At(i))->String().
1495  Data() << "\t" << ((TObjString*) dates.At(i))->String().
1496  Data() << endl;
1497 
1498  }
1499  }
1500  }
1501 }
1502 
1503 
1504 
1505 
1514 
1515 void KVDataSet::CleanMultiRunfiles(const Char_t* data_type, Bool_t confirm)
1516 {
1517  // Check all runs for a given datatype and make sure that only one version
1518  // exists for each run. If not, we print a report on the runfiles which occur
1519  // multiple times, with the associated date and file name, and then we
1520  // destroy all but the most recent version of the file in the repository, and
1521  // update the runlist accordingly.
1522  // By default, we ask for confirmation before deleting each file.
1523  // Call with confirm=kFALSE to delete WITHOUT CONFIRMATION (DANGER!! WARNING!!!)
1524 
1525  if (!fRepository) return;
1526 
1527  KVAvailableRunsFile* ARF = GetAvailableRunsFile(data_type);
1528  auto doubles = ARF->CheckMultiRunfiles();
1529  if (doubles.empty()) {
1530  cout << "OK. No runs appear more than once." << endl;
1531  }
1532  else {
1533  cout << "Runs which appear more than once: " << endl << endl;
1534  //print dates and filenames for each run
1535 
1536  KVList filenames, dates;
1537  for (auto& rr : doubles) {
1538  //get infos for current run
1539  ARF->GetRunInfos(rr, &dates, &filenames);
1540  TDatime most_recent("1998-12-25 00:00:00");
1541  Int_t i_most_recent = 0;
1542  cout << "Run " << rr << " : " << dates.GetEntries() << " files >>>>>>" << endl;
1543  for (int i = 0; i < dates.GetEntries(); i++) {
1544  //check if run is most recent
1545  TDatime rundate(((TObjString*) dates.At(i))->String().Data());
1546  if (rundate > most_recent) {
1547  most_recent = rundate;
1548  i_most_recent = i;
1549  }
1550  }
1551  //Now, we loop over the list again, this time we destroy all but the most recent
1552  //version of the runfile
1553  for (int i = 0; i < dates.GetEntries(); i++) {
1554  if (i == i_most_recent) {
1555  cout << "KEEP : ";
1556  }
1557  else {
1558  cout << "DELETE : ";
1559  }
1560  cout << "\t" << ((TObjString*) filenames.At(i))->String().
1561  Data() << "\t" << ((TObjString*) dates.At(i))->String().
1562  Data() << endl;
1563  if (i != i_most_recent) {
1564  //delete file from repository forever and ever
1565  fRepository->DeleteFile(this, data_type,
1566  ((TObjString*) filenames.At(i))->
1567  String().Data(), confirm);
1568  //remove file entry from available runlist
1569  ARF->Remove(rr,
1570  ((TObjString*) filenames.At(i))->String());
1571  }
1572  }
1573  }
1574  }
1575 }
1576 
1577 
1578 
1579 
1585 
1587  KVDataRepository* other_repos)
1588 {
1589  //Use this method to check whether the file of type "data_type" for run number "run"
1590  //in the data repository "other_repos" is more recent than the file contained in the data
1591  //repository corresponding to this dataset.
1592  //Returns kFALSE if file in other repository is more recent.
1593 
1594  if (!other_repos)
1595  return kTRUE;
1596  //get dataset with same name as this one from dataset manager of other repository
1597  KVDataSet* ds = other_repos->GetDataSetManager()->GetDataSet(GetName());
1598  if (!ds) {
1599  Error("CheckRunfileUpToDate",
1600  "Dataset \"%s\" not found in repository \"%s\"", GetName(),
1601  other_repos->GetName());
1602  return kFALSE;
1603  }
1604  //compare dates of the two runfiles
1605  if (GetRunfileDate(data_type, run) < ds->GetRunfileDate(data_type, run))
1606  return kFALSE;
1607  return kTRUE;
1608 }
1609 
1610 
1611 
1612 
1619 
1621  const KVString& other_repos)
1622 {
1623  //Use this method to check whether the file of type "data_type" for run number "run"
1624  //in the data repository "other_repos" is more recent than the file contained in the data
1625  //repository corresponding to this dataset.
1626  //Returns kTRUE if no repository with name "other_repos" exists.
1627  //Returns kFALSE if file in other repository is more recent.
1628 
1629  KVDataRepository* _or =
1630  gDataRepositoryManager->GetRepository(other_repos);
1631  if (_or)
1632  return CheckRunfileUpToDate(data_type, run, _or);
1633  Error("CheckRunfileUpToDate",
1634  "No data repository known with this name : %s", (const char*) other_repos);
1635  return kTRUE;
1636 }
1637 
1638 
1639 
1640 
1644 
1645 void KVDataSet::CheckUpToDate(const Char_t* data_type,
1646  const Char_t* other_repos)
1647 {
1648  //Check whether all files of type "data_type" for run number "run" in the data repository
1649  //are up to date (i.e. at least as recent) as compared to the files in data repository "other_repos".
1650 
1651  if (!fRepository) return;
1652 
1653  KVDataRepository* _or =
1654  gDataRepositoryManager->GetRepository(other_repos);
1655  if (!_or) {
1656  Error("CheckUpToDate",
1657  "No data repository known with this name : %s", other_repos);
1658  return;
1659  }
1660  auto runlist = GetAvailableRunsFile(data_type)->GetRunList();
1661  Int_t need_update = 0;
1662  for (auto& rr : runlist) {
1663  //check run
1664  if (!CheckRunfileUpToDate(data_type, rr, _or)) {
1665  cout << " *** run " << rr << " needs update ***" <<
1666  endl;
1667  cout << "\t\tREPOSITORY: " << fRepository->
1668  GetName() << "\tDATE: " << GetRunfileDate(data_type,
1669  rr).
1670  AsString() << endl;
1671  cout << "\t\tREPOSITORY: " << other_repos << "\tDATE: " << _or->
1672  GetDataSetManager()->GetDataSet(GetName())->
1673  GetRunfileDate(data_type,
1674  rr).AsString() << endl;
1675  need_update++;
1676  }
1677  }
1678  if (!need_update) {
1679  cout << " *** All runfiles are up to date for data type " <<
1680  data_type << endl;
1681  }
1682 }
1683 
1684 
1685 
1686 
1690 
1691 run_index_list KVDataSet::GetUpdatableRuns(const Char_t* data_type,
1692  const Char_t* other_repos)
1693 {
1694  //Returns list of all runs of type "data_type" which may be updated
1695  //from the repository named "other_repos". See CheckUpToDate().
1696 
1697  run_index_list updates;
1698  if (!fRepository) return updates;
1699 
1700  KVDataRepository* _or =
1701  gDataRepositoryManager->GetRepository(other_repos);
1702  if (!_or) {
1703  Error("CheckUpToDate",
1704  "No data repository known with this name : %s", other_repos);
1705  return updates;
1706  }
1707  auto runlist = GetAvailableRunsFile(data_type)->GetRunList();
1708  for (auto& rr : runlist) {
1709  //check run
1710  if (!CheckRunfileUpToDate(data_type, rr, _or)) {
1711  //run is out of date
1712  updates.Add(rr);
1713  }
1714  }
1715  return updates;
1716 }
1717 
1718 
1719 
1720 
1725 
1726 run_index_list KVDataSet::GetRunList(const Char_t* data_type,
1727  const KVDBSystem* system) const
1728 {
1729  //Returns list of all files available for given "data_type"
1730  //
1731  //If a pointer to a reaction system is given, only files for the given system will be included in the list.
1732 
1733  if (!fRepository || !HasDataType(data_type)) {
1734  Error("GetRunList",
1735  "No data of type %s available. Runlist will be empty.",
1736  data_type);
1737  return {};
1738  }
1739 
1740  return GetAvailableRunsFile(data_type)->GetRunList(system);
1741 }
1742 
1743 
1744 
1745 
1776 
1778 {
1779  //This method returns a pointer to the available analysis task whose description (title) contains
1780  //all of the whitespace-separated keywords (which may be regular expressions)
1781  //given in the string "keywords". The comparison is case-insensitive.
1782  //
1783  //WARNING: this method can only be used to access analysis tasks that are
1784  //available for this dataset, i.e. for which the corresponding prerequisite data type
1785  //is available in the repository.
1786  //For unavailable data/tasks, use GetAnalysisTaskAny(const Char_t*).
1787  //
1788  //EXAMPLES
1789  //Let us suppose that the current dataset has the following list of tasks:
1790  //~~~
1791  // root [2] gDataSet->Print("tasks")
1792  // 1. Event reconstruction from raw data (raw->recon)
1793  // 2. Analysis of raw data
1794  // 3. Identification of reconstructed events (recon->ident)
1795  // 4. Analysis of reconstructed events (recon)
1796  // 5. Analysis of partially identified & calibrated reconstructed events (ident)
1797  // 6. Analysis of fully calibrated physical data (root)
1798  //~~~
1799  //Then the following will occur:
1800  //~~~
1801  // root [14] gDataSet->GetAnalysisTask("raw->recon")->Print()
1802  // KVDataAnalysisTask : Event reconstruction from raw data (raw->recon)
1803  //
1804  // root [10] gDataSet->GetAnalysisTask("analysis root")->Print()
1805  // KVDataAnalysisTask : Analysis of fully calibrated physical data (root)
1806  //~~~
1807 
1808  //case-insensitive search for matches in list based on 'title' attribute
1809  return (KVDataAnalysisTask*)fTasks.FindObjectAny("title", keywords, kTRUE, kFALSE);
1810 }
1811 
1812 
1813 
1814 
1827 
1828 void KVDataSet::MakeAnalysisClass(const Char_t* task, const Char_t* classname)
1829 {
1830  //Create a skeleton analysis class to be used for analysis of the data belonging to this dataset.
1831  //
1832  // task = keywords contained in title of analysis task (see GetAnalysisTask(const Char_t*))
1833  // (you do not need to include 'analysis', it is added automatically)
1834  // classname = name of new analysis class
1835  //
1836  //Example:
1837  // MakeAnalysisClass("raw", "MyRawDataAnalysis")
1838  // --> make skeleton raw data analysis class in files MyRawDataAnalysis.cpp & MyRawDataAnalysis.h
1839  // MakeAnalysisClass("fully calibrated", "MyDataAnalysis")
1840  // --> make skeleton data analysis class in files MyDataAnalysis.cpp & MyDataAnalysis.h
1841 
1842  KVString _task = task;
1843  if (!_task.Contains("nalysis")) _task += " analysis";
1844  //We want to be able to write analysis classes even when we don't have any data
1845  //to analyse. Therefore we use GetAnalysisTaskAny.
1846  auto dat = GetAnalysisTaskAny(_task.Data());
1847  if (!dat) {
1848  Error("MakeAnalysisClass",
1849  "called for unknown or unavailable analysis task : %s", _task.Data());
1850  return;
1851  }
1852  if (!dat->WithUserClass()) {
1853  Error("MakeAnalysisClass",
1854  "no user analysis class for analysis task : %s", dat->GetTitle());
1855  return;
1856  }
1857 
1858  //all analysis base classes must define a static Make(const Char_t * classname)
1859  //which generates the skeleton class files.
1860 
1861  TClass* cl = nullptr;
1862  //has the user base class for the task been compiled and loaded ?
1863  if (dat->CheckUserBaseClassIsLoaded()) cl = TClass::GetClass(dat->GetUserBaseClass());
1864  else
1865  return;
1866 
1867  //set up call to static Make method
1868  unique_ptr<TMethodCall> methcall(new TMethodCall(cl, "Make", Form("\"%s\"", classname)));
1869 
1870  if (!methcall->IsValid()) {
1871  Error("MakeAnalysisClass", "static Make(const Char_t*) method for class %s is not valid",
1872  cl->GetName());
1873  return;
1874  }
1875 
1876  //generate skeleton class
1877  methcall->Execute();
1878 }
1879 
1880 
1881 
1882 
1886 
1887 Bool_t KVDataSet::OpenDataSetFile(const Char_t* filename, ifstream& file)
1888 {
1889  // Look for (and open for reading, if found) the named file in the directory which
1890  // contains the files for this dataset (given by GetDataSetDir())
1891 
1892  return OpenDataSetFile(GetName(), filename, file);
1893 }
1894 
1895 
1896 
1900 
1901 Bool_t KVDataSet::OpenDataSetFile(const TString& dataset, const Char_t* filename, ifstream& file)
1902 {
1903  // Static method to look for (and open for reading, if found) the named file in the directory which
1904  // contains the files for the dataset
1905 
1906  TString datasetdir = KVBase::GetDataSetEnv(dataset, "DataSet.Directory", dataset);
1907  if (gSystem->IsAbsoluteFileName(datasetdir)) {
1908  // dataset directory is outside of standard KV installation directories
1909  // use absolute path to search for file
1910  TString abspath;
1911  abspath.Form("%s/%s", datasetdir.Data(), filename);
1912  return SearchAndOpenKVFile(abspath, file);
1913  }
1914  // dataset directory is a subdirectory of GetDATADIRFilePath()
1915  return SearchAndOpenKVFile(filename, file, datasetdir);
1916 }
1917 
1918 
1919 
1923 
1925 {
1926  // Find a file in the dataset directory (given by GetDataSetDir())
1927  // Returns full path to file if found, empty string if not
1928 
1929  return GetFullPathToDataSetFile(GetName(), filename);
1930 }
1931 
1932 
1933 
1937 
1939 {
1940  // Static method to find a file in the dataset directory (given by GetDataSetDir())
1941  // Returns full path to file if found, empty string if not
1942 
1943  TString fullpath;
1944  TString datasetdir = KVBase::GetDataSetEnv(dataset, "DataSet.Directory", dataset);
1945  if (!SearchKVFile(filename, fullpath, datasetdir)) {
1946  ::Warning("KVDataSet::GetFullPathToDataSetFile", "File %s not found in dataset subdirectory %s", filename, datasetdir.Data());
1947  fullpath = "";
1948  }
1949  return fullpath;
1950 }
1951 
1952 
1953 
1957 
1958 Bool_t KVDataSet::FindDataSetFile(const TString& dataset, const Char_t* filename)
1959 {
1960  // Static method to find a file in the dataset directory (given by GetDataSetDir())
1961  // Returns kTRUE if found, kFALSE if not
1962 
1963  TString fullpath;
1964  TString datasetdir = KVBase::GetDataSetEnv(dataset, "DataSet.Directory", dataset);
1965  return SearchKVFile(filename, fullpath, datasetdir);
1966 }
1967 
1968 
1969 
1973 
1975 {
1976  // Find a file in the dataset directory (given by GetDataSetDir())
1977  // Returns kTRUE if found, kFALSE if not
1978 
1979  return FindDataSetFile(GetName(), filename);
1980 }
1981 
1982 
1983 
1984 
1993 
1995 {
1996  //This method returns the analysis task whose description (title) contains
1997  //all of the whitespace-separated keywords (which may be regular expressions)
1998  //given in the string "keywords". The comparison is case-insensitive.
1999  //The analysis task does not need to be "available", i.e. the associated prerequisite
2000  //data type does not have to be present in the repository (see GetAnalysisTask).
2001  //
2002  // If no task is found, returns nullptr
2003 
2004  KVDataAnalysisTask* tsk = (KVDataAnalysisTask*)fAllTasks.FindObjectAny("title", keywords, kTRUE, kFALSE);
2005  if (!tsk) {
2006  Error("GetAnalysisTaskAny", "No task found with the following keywords in its title : %s", keywords);
2007  }
2008  return tsk;
2009 }
2010 
2011 
2012 
2013 
2019 
2021 {
2022  // Returns kTRUE if database needs to be regenerated from source files,
2023  // i.e. if source files are more recent than DataBase.root
2024  // In case no directory exists for dataset (dataset added 'on the fly')
2025  // we create the directory and fill it with dummy files (Makefile, Runlist.csv, Systems.dat)
2026 
2027  TString pwd = gSystem->pwd();
2028 
2029  TString path = "";
2030  if (!SearchKVFile(GetDataSetDir(), path)) {
2031  // dataset directory doesn't exist - create it
2032  Info("DataBaseNeedsUpdate", "%s: Creating new dataset directory %s",
2033  GetName(), GetDataSetDir());
2034  if (gSystem->mkdir(GetDataSetDir())) {
2035  // problem creating directory
2036  Error("DataBaseNeedsUpdate",
2037  "%s: Dataset directory %s does not exist and cannot be created ?",
2038  GetName(), GetDataSetDir());
2039  return kFALSE;
2040  }
2041  // create dummy files
2042  SearchKVFile(GetDataSetDir(), path); // get full path
2043  path += "/";
2044  TString filename = path + "Makefile";
2045  ofstream of1(filename.Data());
2046  of1 << "$(KV_WORK_DIR)/db/" << GetName() << "/DataBase.root : Runlist.csv Systems.dat" << endl;
2047  of1 << "\t@echo Database needs update" << endl;
2048  of1.close();
2049  filename = path + "Runlist.csv";
2050  ofstream of2(filename.Data());
2051  of2 << "# Automatically generated dummy Runlist.csv file" << endl;
2052  of2.close();
2053  filename = path + "Systems.dat";
2054  ofstream of3(filename.Data());
2055  of3 << "# Automatically generated dummy Systems.dat file" << endl;
2056  of3.close();
2057  }
2058  gSystem->cd(GetDataSetDir());
2059  TString cmd = "make -q";
2060  Int_t ret = gSystem->Exec(cmd.Data());
2061  gSystem->cd(pwd.Data());
2062  return (ret != 0);
2063 }
2064 
2065 
2066 
2083 
2085 {
2086  // Returns name of output repository for given task.
2087  // By default it is the name of the repository associated with this dataset,
2088  // but can be changed by the following environment variables:
2089  //
2090  // [repository].DefaultOutputRepository: [other repository]
2091  // - this means that all tasks carried out on data in [repository]
2092  // will have their output files placed in [other repository]
2093  //
2094  // [taskname].DataAnalysisTask.OutputRepository: [other repository]
2095  // - this means that for [taskname], any output files will
2096  // be placed in [other repository]
2097  //
2098  // [dataset].[taskname].DataAnalysisTask.OutputRepository: [other repository]
2099  // - this means that for given [dataset] & [taskname],
2100  // any output files will be placed in [other repository]
2101 
2102  if (gEnv->Defined(Form("%s.DataRepository.DefaultOutputRepository", GetRepository()->GetName())))
2103  return TString(gEnv->GetValue(Form("%s.DataRepository.DefaultOutputRepository", GetRepository()->GetName()), ""));
2104  TString orep = GetDataSetEnv(Form("%s.DataAnalysisTask.OutputRepository", taskname), GetRepository()->GetName());
2105  return orep;
2106 }
2107 
2108 
2109 
2110 
2113 
2114 void KVDataSet::CopyRunfilesFromRepository(const Char_t* type, const run_index_list& runs, const Char_t* destdir)
2115 {
2116  // Copies the runfiles of given "type" into the local directory "destdir".
2117 
2118  KVDataRepository* repo = GetRepository();
2119  for (auto& run : runs) {
2120  TString filename = GetRunfileName(type, run);
2121  TString destpath;
2122  AssignAndDelete(destpath, gSystem->ConcatFileName(destdir, filename));
2123  repo->CopyFileFromRepository(this, type, filename, destpath);
2124  }
2125 }
2126 
2127 
2128 
2129 
2133 
2134 void KVDataSet::CopyRunfilesToRepository(const Char_t* type, const run_index_list& runs, const Char_t* destrepo)
2135 {
2136  // Copies the runfiles of given "type" from the data repository associated
2137  // with this dataset into the local repository "destrepo".
2138 
2139  KVDataRepository* repo = GetRepository();
2140  KVDataRepository* dest_repo = gDataRepositoryManager->GetRepository(destrepo);
2141 
2142  if (!dest_repo) {
2143  Error("CopyRunfilesToRepository", "Unknown destination repository : %s", destrepo);
2144  gDataRepositoryManager->Print();
2145  return;
2146  }
2147 
2148  KVDataSet* dest_ds = dest_repo->GetDataSetManager()->GetDataSet(GetName());
2149  dest_repo->CreateAllNeededSubdirectories(dest_ds, type);
2150  for (auto& run : runs) {
2151  TString filename = GetRunfileName(type, run);
2152  TString destpath = dest_repo->GetFullPathToTransferFile(dest_ds, type, filename);
2153  repo->CopyFileFromRepository(this, type, filename, destpath);
2154  }
2155 }
2156 
2157 
int Int_t
ROOT::R::TRInterface & r
#define f(i)
bool Bool_t
char Char_t
constexpr Bool_t kFALSE
double Double_t
constexpr Bool_t kTRUE
const char Option_t
#define gDirectory
R__EXTERN TEnv * gEnv
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 filename
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,...)
void AssignAndDelete(TString &target, char *tobedeleted)
R__EXTERN TSystem * gSystem
Handles lists of available runs for different datasets and types of data.
virtual void Remove(const run_index_t &run, const KVString &filename="")
Remove from the db ALL entries corresponding to the given run/index (and filename if given)
std::forward_list< run_index_t > CheckMultiRunfiles()
Returns a list with all run/indexes for which more than one file is in the available runs db.
void GetRunInfos(const run_index_t &run, KVList *dates, KVList *names)
virtual void Add(const run_index_t &run, const KVString &filename)
static ValType GetDataSetEnv(const KVString &dataset, const KVString &type, const ValType &defval)
Definition: KVBase.h:304
Database class used to store information on different colliding systems studied during an experiment....
Definition: KVDBSystem.h:52
Bool_t IsCollision() const
retourne kTRUE, si le systeme est une collision ie projectile+cible
Definition: KVDBSystem.cpp:105
Define and manage data analysis tasks.
virtual void SetDataAnalyser(const Char_t *d)
virtual void SetPrereq(const Char_t *p)
virtual void SetStatusUpdateInterval(Long64_t n)
void SetExtraAClicIncludes(const KVString &list)
virtual const Char_t * GetPrereq() const
virtual void SetUserBaseClass(const Char_t *d)
KVDataRepository * GetRepository(const Char_t *name) const
void Print(Option_t *opt="") const
Base class for managing repositories of experimental data.
virtual KVDataSetManager * GetDataSetManager() const
Return pointer to data set manager for this repository.
virtual void CopyFileFromRepository(const KVDataSet *dataset, const Char_t *datatype, const Char_t *filename, const Char_t *destination)
void CreateAllNeededSubdirectories(const KVDataSet *DataSet, const Char_t *DataType)
virtual const Char_t * GetFullPathToTransferFile(const KVDataSet *dataset, const Char_t *datatype, const Char_t *runfile)
KVDataSet * GetDataSet(Int_t) const
Return pointer to DataSet using index in list of all datasets, index>=0.
Manage an experimental dataset corresponding to a given experiment or campaign.
Definition: KVDataSet.h:36
TString GetFullPathToRunfile(const KVString &type, const run_index_t &run) const
Definition: KVDataSet.cpp:929
TString GetFullPathToDB() const
Returns full path to file where database is written on disk.
Definition: KVDataSet.cpp:150
void ls(Option_t *opt="") const override
Print dataset information.
Definition: KVDataSet.cpp:422
TString GetOutputRepository(const Char_t *taskname) const
Definition: KVDataSet.cpp:2084
virtual void OpenDBFile(const Char_t *full_path_to_dbfile) const
Open the database from a file on disk.
Definition: KVDataSet.cpp:124
run_index_list GetRunList_VersionSelection(const Char_t *type, const Char_t *version, KVDBSystem *sys=0)
Definition: KVDataSet.cpp:1329
TString GetDBName() const
Definition: KVDataSet.cpp:110
void CheckMultiRunfiles(const Char_t *data_type)
Definition: KVDataSet.cpp:1471
Bool_t CheckRunfileAvailable(const KVString &type, const run_index_t &run)
Definition: KVDataSet.cpp:1017
virtual const Char_t * GetBaseFileName(const Char_t *type, const run_index_t &run) const
Definition: KVDataSet.cpp:1050
void CheckUpToDate(const Char_t *data_type, const Char_t *other_repos)
Definition: KVDataSet.cpp:1645
run_index_list GetRunList(const Char_t *data_type, const KVDBSystem *sys=0) const
Definition: KVDataSet.cpp:1726
void CopyRunfilesFromRepository(const Char_t *type, const run_index_list &runs, const Char_t *destdir)
Copies the runfiles of given "type" into the local directory "destdir".
Definition: KVDataSet.cpp:2114
KVDataRepository * GetRepository() const
Get pointer to data repository in which dataset is stored.
Definition: KVDataSet.cpp:1457
const Char_t * GetDataSetDir() const
Definition: KVDataSet.cpp:744
KVAvailableRunsFile * GetAvailableRunsFile(const Char_t *type) const
Definition: KVDataSet.cpp:50
void CommitRunfile(const KVString &type, const run_index_t &run, TFile *file)
Definition: KVDataSet.cpp:1370
TDatime GetRunfileDate(const KVString &type, const run_index_t &run)
Definition: KVDataSet.cpp:983
virtual void AddAvailableDataType(const Char_t *)
Definition: KVDataSet.cpp:551
KVDataAnalysisTask * GetAnalysisTask(Int_t) const
Definition: KVDataSet.cpp:617
virtual void SaveDataBase() const
Definition: KVDataSet.cpp:213
virtual std::unique_ptr< TList > GetListOfAvailableSystems(const Char_t *datatype, KVDBSystem *systol=0)
Definition: KVDataSet.cpp:641
virtual KVDataAnalysisTask * GetAnalysisTaskAny(const Char_t *keywords) const
Definition: KVDataSet.cpp:1994
run_index_list GetRunList_DateSelection(const Char_t *type, TDatime *min=0, TDatime *max=0)
Definition: KVDataSet.cpp:1213
virtual void SetAnalysisTasks(const KVSeqCollection *)
Definition: KVDataSet.cpp:568
TFile * NewRunfile(const KVString &type, const run_index_t &run)
Definition: KVDataSet.cpp:1110
Bool_t CheckRunfileUpToDate(const KVString &data_type, const run_index_t &run, KVDataRepository *other_repos)
Definition: KVDataSet.cpp:1586
virtual void CheckAvailable()
Definition: KVDataSet.cpp:494
void DeleteRunfile(const KVString &type, const run_index_t &run, Bool_t confirm=kTRUE)
Definition: KVDataSet.cpp:1135
virtual Int_t GetNtasks() const
Definition: KVDataSet.cpp:602
KVString GetDataSetEnv(const Char_t *type, const Char_t *defval="") const
Definition: KVDataSet.cpp:782
run_index_list GetRunList_StageSelection(const Char_t *other_type, const Char_t *base_type, KVDBSystem *sys=0, Bool_t OnlyCol=kFALSE)
Definition: KVDataSet.cpp:1275
TString GetFullPathToDataSetFile(const Char_t *filename)
Definition: KVDataSet.cpp:1924
virtual void MakeAnalysisClass(const Char_t *task, const Char_t *classname)
Definition: KVDataSet.cpp:1828
void DeleteRunfiles(const Char_t *type, const run_index_list &lrun={}, Bool_t confirm=kTRUE)
Definition: KVDataSet.cpp:1182
TObject * open_runfile(const KVString &type, const run_index_t &run)
Definition: KVDataSet.cpp:874
void CopyRunfilesToRepository(const Char_t *type, const run_index_list &runs, const Char_t *destrepo)
Definition: KVDataSet.cpp:2134
KVString GetRunfileName(const KVString &type, const run_index_t &run) const
Definition: KVDataSet.cpp:955
KVExpDB * GetDataBase(Option_t *opt="") const
Definition: KVDataSet.cpp:308
virtual Bool_t DataBaseNeedsUpdate() const
Definition: KVDataSet.cpp:2020
Bool_t OpenDataSetFile(const Char_t *filename, std::ifstream &file)
void SetDataSetSpecificTaskParameters(KVDataAnalysisTask *) const
Definition: KVDataSet.cpp:178
void cd() const
Definition: KVDataSet.cpp:760
virtual void WriteDBFile(const Char_t *full_path_to_dbfile) const
Definition: KVDataSet.cpp:274
void Print(Option_t *opt="") const override
Definition: KVDataSet.cpp:443
void SetName(const char *name) override
Definition: KVDataSet.cpp:712
virtual Bool_t CheckUserCanAccess()
Definition: KVDataSet.cpp:1414
void UpdateAvailableRuns(const KVString &type)
Definition: KVDataSet.cpp:1088
run_index_list GetUpdatableRuns(const Char_t *data_type, const Char_t *other_repos)
Definition: KVDataSet.cpp:1691
void SetRepository(KVDataRepository *)
Set pointer to data repository in which dataset is stored.
Definition: KVDataSet.cpp:1445
KVDataSet()
Default constructor.
Definition: KVDataSet.cpp:35
void CleanMultiRunfiles(const Char_t *data_type, Bool_t confirm=kTRUE)
Definition: KVDataSet.cpp:1515
virtual void OpenDataBase(Option_t *opt="") const
Definition: KVDataSet.cpp:354
static Bool_t FindDataSetFile(const TString &dataset, const Char_t *filename)
Definition: KVDataSet.cpp:1958
TString GetDBFileName() const
Definition: KVDataSet.cpp:82
Extension of TDatime to handle various useful date formats.
Definition: KVDatime.h:33
Base class to describe database of an experiment ,,.
Definition: KVExpDB.h:20
virtual void cd()
Definition: KVExpDB.cpp:576
static KVExpDB * MakeDataBase(const Char_t *name, const Char_t *datasetdir)
Definition: KVExpDB.cpp:598
Extended TList class which owns its objects by default.
Definition: KVList.h:28
Description of an individual data file in an experimental dataset.
Definition: KVRunFile.h:19
const Char_t * GetVersion() const
Definition: KVRunFile.h:80
const KVDatime & GetFileWrittenDatime() const
Definition: KVRunFile.h:72
const run_index_t & GetRunIndex() const
Definition: KVRunFile.h:56
KaliVeda extensions to ROOT collection classes.
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
Bool_t End() const
Definition: KVString.cpp:634
KVString Next(Bool_t strip_whitespace=kFALSE) const
Definition: KVString.cpp:695
static TClass * GetClass(Bool_t load=kTRUE, Bool_t silent=kFALSE)
virtual Int_t GetEntries() const
const char * AsSQLString() const
void Set()
virtual Bool_t cd()
virtual const char * GetValue(const char *name, const char *dflt) const
virtual void SetValue(const char *name, const char *value, EEnvLevel level=kEnvChange, const char *type=nullptr)
Bool_t Defined(const char *name) const
TObject * FindObject(const char *name) const override
virtual void SetTitle(const char *title="")
const char * GetName() const override
const char * GetTitle() const override
virtual void SetName(const char *name)
TString & String()
const char * Data() const
void ToUpper()
void Form(const char *fmt,...)
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TString & ReplaceAll(const char *s1, const char *s2)
Bool_t cd(const char *path)
const char * pwd()
virtual int Chmod(const char *file, UInt_t mode)
virtual const char * DirName(const char *pathname)
virtual char * ConcatFileName(const char *dir, const char *name)
virtual int mkdir(const char *name, Bool_t recursive=kFALSE)
virtual Int_t Exec(const char *shellcmd)
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
virtual const char * BaseName(const char *pathname)
virtual Bool_t IsAbsoluteFileName(const char *dir)
Specifies a runfile according to run number and file index ,.
Definition: run_index.h:33
int run() const
Definition: run_index.h:52
TString as_string() const
Definition: run_index.h:94
int index(int no_index=-1) const
Definition: run_index.h:57
bool has_index() const
Definition: run_index.h:61
const Int_t n
void Error(const char *location, const char *fmt,...)
void Info(const char *location, const char *fmt,...)
void Warning(const char *location, const char *fmt,...)
double min(double x, double y)
double max(double x, double y)
const char * String
TArc a
ClassImp(TPyArg)