4 #include "KVDataSetAnalyser.h"
5 #include "KVDataRepositoryManager.h"
6 #include "KVDataRepository.h"
7 #include "KVDataSetManager.h"
9 #include "KVDBSystem.h"
28 fChoozDataSet =
kTRUE;
56 fChoozDataSet =
kTRUE;
85 fChoozDataSet =
kTRUE;
113 else if (IsChooseTask())
114 ChooseAnalysisTask();
131 Error(
"CheckTaskVariables",
"By the pricking of my thumb, something wicked this way comes...");
132 Error(
"CheckTaskVariables",
" *** ABORTING THE ANALYSIS ***");
137 if (!GetAnalysisTask()) {
138 ChooseAnalysisTask();
141 if (fRunList.IsEmpty()) {
166 _set_dataset_pointer(
nullptr);
167 if (GetAnalysisTask()) SetAnalysisTask(
nullptr);
169 cout <<
"Available datasets :" << endl << endl;
170 gDataSetManager->
Print(
"available");
171 Int_t n_dataset = -1;
185 while (!IsQuit() && (n_dataset < 1 || n_dataset > n_avail)) {
186 cout << endl <<
"Your choice (1-" << gDataSetManager->
187 GetNavailable() <<
")";
188 if (IsMenus()) cout <<
" [q - quit]";
195 n_dataset = tmp.
Atoi();
224 SetAnalysisTask(
nullptr);
226 fDataSet->Print(
"data");
227 cout << endl <<
"Choose data type [d - change dataset | q - quit] : ";
229 while (!IsQuit() && !IsChooseDataSet() && !IsChooseSystem()) {
232 if (tmp ==
"raw" || tmp ==
"recon" || tmp ==
"ident" || tmp ==
"root") {
233 fChoozSystem =
kTRUE;
263 SetAnalysisTask(
nullptr);
268 cout << endl <<
"Available data analysis tasks :" << endl << endl;
269 fDataSet->Print(
"tasks");
270 Int_t n_tasks = fDataSet->GetNtasks();
272 SetAnalysisTask(fDataSet->GetAnalysisTask(1));
273 fChoozSystem =
kTRUE;
280 while (!IsQuit() && (n_task < 1 || n_task > n_tasks)) {
281 cout << endl <<
"Your choice (1-" << n_tasks <<
283 if (IsMenus()) cout <<
" [d - change dataset | q - quit]";
290 fChoozDataSet =
kTRUE;
296 SetAnalysisTask(fDataSet->GetAnalysisTask(n_task));
298 fChoozSystem =
kTRUE;
332 if (!fDataSet->GetDataBase()->GetSystems()->GetSize()) {
343 unique_ptr<TList> sys_list(fDataSet->GetListOfAvailableSystems(d_t.
Data()));
344 if (!sys_list.get() || sys_list->GetSize() < 1) {
345 cout <<
"No systems found for dataset: " << fDataSet->
346 GetName() <<
", datatype: " << d_t.
Data() << endl;
351 TIter next_sys(sys_list.get());
354 cout << endl <<
"Available systems : " << endl << endl;
357 cout <<
" " <<
Form(
"%3d.", nsys);
359 cout <<
" (" <<
Form(
"%-3d",
363 if (sys_list->GetSize() == 1) {
376 while (!IsQuit() && !IsChooseTask() && !fChoozRuns && !fChoozDataSet) {
377 cout << endl <<
"Your choice (1-" << nsys <<
")";
379 cout <<
" [r - choose runs | ";
380 if (GetAnalysisTask())
381 cout <<
"t - change task";
383 cout <<
"t - change type";
384 cout <<
" | d - change dataset | q - quit]";
393 fChoozDataSet =
kTRUE;
398 nsys_pick = tmp.
Atoi();
399 if (nsys_pick >= 1 && nsys_pick <= nsys)
404 fSystem = (
KVDBSystem*) sys_list->At(nsys_pick - 1);
446 cout << endl <<
" Chosen system : " << endl;
449 cout << endl << endl <<
" Available runs: " << endl << endl;
455 fChoozSystem =
kTRUE;
459 cout << endl <<
"Enter list of runs [a - all";
462 if (fSystem) cout <<
"s - change system | ";
463 if (GetAnalysisTask())
464 cout <<
"t - change task";
466 cout <<
"t - change type";
467 cout <<
" | d - change dataset | q - quit";
475 fChoozSystem =
kTRUE;
479 fChoozDataSet =
kTRUE;
490 while (!user_list.
End()) {
492 if (all_runs.
Contains(user_run)) fRunList.Add(user_run);
495 if (fRunList.IsEmpty()) {
497 "None of the runs you chose appear in the list");
504 cout << endl <<
"Chosen runs : " << fRunList.GetList() << endl;
534 "Dataset %s is not available for analysis", ds->
GetName());
540 "%ld is address of dataset in repository \"%s\", not of the dataset in the current repository, \"%s\"",
566 Error(
"SetDataSet",
"Unknown dataset %s",
name);
568 set_dataset_pointer(ds);
584 fDataSet->GetRunList(datatype.
Data(), fSystem);
587 while (!all_runs.
End()) {
588 dbrun = fDataSet->GetDataBase()->GetDBRun(all_runs.
Next());
629 Warning(
"SetRuns",
"Data Set not defined... Nothing done");
635 KVDBRun* run = fDataSet->GetDataBase()->GetDBRun(nl.
First());
642 Info(
"SetRuns",
"Checking runs %s for Data type %s",
649 if (!(fDataSet->CheckRunfileAvailable(
GetDataType(), run_no))) {
651 "The run %d is not present for the data type \"%s\" of data set \"%s\".",
652 run_no,
GetDataType().Data(), fDataSet->GetName());
654 fRunList.Add(run_no);
656 KVDBRun* run = fDataSet->GetDataBase()->GetDBRun(run_no);
664 "The system \"%s\" of run %d differs from the system \"%s\" of the previous runs.",
669 Info(
"SetRuns",
"Accepted runs : %s", fRunList.AsString());
690 GetBatchInfoFile()->SetValue(
"DataRepository", gDataRepository->
GetName());
691 GetBatchInfoFile()->SetValue(
"DataSet", fDataSet->GetName());
692 GetBatchInfoFile()->SetValue(
"Runs", fRunList.GetList());
693 GetBatchInfoFile()->SetValue(
"FullRunList", fFullRunList.GetList());
694 if (save) GetBatchInfoFile()->SaveLevel(
kEnvUser);
715 TString val = GetBatchInfoFile()->GetValue(
"DataRepository",
"");
719 Error(
"ReadBatchEnvFile",
"Name of data repository not given");
722 val = GetBatchInfoFile()->GetValue(
"DataSet",
"");
725 SetDataSet(gDataSet);
727 Error(
"ReadBatchEnvFile",
"Name of dataset not given");
730 val = GetBatchInfoFile()->GetValue(
"AnalysisTask",
"");
731 SetAnalysisTask(
nullptr);
735 Error(
"ReadBatchEnvFile",
"Name of analysis task not given");
738 if (!GetAnalysisTask()) {
739 Error(
"ReadBatchEnvFile",
"Analysis task \"%s\"not found for dataset %s",
748 val = GetBatchInfoFile()->GetValue(
"Runs",
"");
752 Error(
"ReadBatchEnvFile",
"List of runs not given");
755 val = GetBatchInfoFile()->GetValue(
"FullRunList",
"");
757 SetFullRunList(val.
Data());
793 if (!fSystem)
return tmp;
794 return fSystem->GetBatchName();
834 if (fSystem)
return fSystem->GetKinematics();
835 Error(
"GetKinematics",
"No system defined for kinematic calculations");
849 arf = GetDataSet()->GetAvailableRunsFile(
GetDataType().Data());
874 jdl->
SetValue(
"DataSet", fDataSet->GetName());
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 format
char * Form(const char *fmt,...)
Relativistic binary kinematics calculator.
Handles lists of available runs for different datasets and types of data.
Int_t IsRunFileName(const Char_t *filename)
virtual Int_t GetNumber() const
Description of an experimental run in database ,,.
ULong64_t GetEvents() const
KVDBSystem * GetSystem() const
const TDatime & GetDatime() const
const Char_t * GetComments() const
Database class used to store information on different colliding systems studied during an experiment....
Manager class which sets up and runs data analysis tasks.
virtual TString ExpandAutoBatchName(const Char_t *format) const
virtual void PostRunReset()
virtual void AddJobDescriptionList(TList *)
virtual void WriteBatchEnvFile(const TString &, Bool_t sav=kTRUE)
virtual const Char_t * GetRecognisedAutoBatchNameKeywords() const
virtual void set_up_analyser_for_task(KVDataAnalyser *the_analyser)
virtual Bool_t ReadBatchEnvFile(const TString &)
KVDataRepository * GetRepository(const Char_t *name) const
virtual Bool_t IsRemote() const
Returns kTRUE for remote repositories, kFALSE for local repositories.
virtual Bool_t IsConnected()
Always returns kTRUE for local repositories.
virtual const Char_t * GetRootDirectory() const
returns root directory of data repository (fLocalrootdir)
Pilots user analysis of experimental data.
virtual Bool_t PreSubmitCheck()
void SetDataSet(KVDataSet *ds)
virtual void ChooseAnalysisTask()
virtual KVNumberList PrintAvailableRuns(KVString &datatype)
virtual void set_up_analyser_for_task(KVDataAnalyser *the_analyser)
void ChooseRuns(KVDBSystem *system=nullptr, const Char_t *data_type="")
Bool_t ReadBatchEnvFile(const TString &filename)
void SetRuns(const KVNumberList &nl, Bool_t check=kTRUE)
void WriteBatchEnvFile(const TString &jobname, Bool_t save=kTRUE)
void ChooseSystem(const Char_t *data_type="")
KVString GetRootDirectoryOfDataToAnalyse() const
Returns path to data to be analysed.
virtual ~KVDataSetAnalyser()
Destructor.
const KV2Body * GetKinematics() const
Int_t GetRunNumberFromFileName(const Char_t *)
Get the run number from the filename.
void SetSystem(KVDBSystem *syst)
Set the System used in the analysis.
const Char_t * GetRecognisedAutoBatchNameKeywords() const
virtual void AddJobDescriptionList(TList *)
virtual void set_dataset_name(const Char_t *name)
virtual void set_dataset_pointer(KVDataSet *ds)
virtual void PostRunReset()
Called at end of Run() after execution of analysis task.
void ChooseWhatToAnalyse()
Bool_t CheckWhatToAnalyseAndHow()
TString ExpandAutoBatchName(const Char_t *format) const
TString SystemBatchName() const
virtual void Print(Option_t *opt="") const
virtual Int_t GetNavailable() const
KVDataSet * GetDataSet(Int_t) const
Return pointer to DataSet using index in list of all datasets, index>=0.
virtual KVDataSet * GetAvailableDataSet(Int_t) const
Manage an experimental dataset corresponding to a given experiment or campaign.
KVDataRepository * GetRepository() const
Get pointer to data repository in which dataset is stored.
KVDataAnalysisTask * GetAnalysisTask(Int_t) const
virtual Bool_t IsAvailable() const
Returns kTRUE if this dataset is available for analysis, i.e. if any associated data files are stored...
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
void SetValue(const Char_t *name, value_type value)
Strings used to represent a set of ranges of values.
Bool_t Contains(Int_t val) const
returns kTRUE if the value 'val' is contained in the ranges defined by the number list
Int_t First() const
Returns smallest number included in list.
const Char_t * AsString(Int_t maxchars=0) const
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
const char * AsString() const
const char * GetName() const override
virtual TObject * FindObject(const char *name) const
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
TString & ReplaceAll(const char *s1, const char *s2)
std::istream & ReadLine(std::istream &str, Bool_t skipWhite=kTRUE)
BinData::ErrorType GetDataType(const TGraph *gr, DataOptions &fitOpt)
RooCmdArg BatchMode(std::string const &batchMode)