KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVDataSet.h
1/*
2$Id: KVDataSet.h,v 1.26 2009/01/27 08:06:56 franklan Exp $
3$Revision: 1.26 $
4$Date: 2009/01/27 08:06:56 $
5$Author: franklan $
6*/
7
8#ifndef __KVDATASET_H
9#define __KVDATASET_H
10
11#include "KVString.h"
12#include "KVBase.h"
13#include "KVUniqueNameList.h"
14#include "KVNumberList.h"
15#include "TDatime.h"
16#include "TFile.h"
17#include "KVDataAnalysisTask.h"
18#include "KVExpDB.h"
19
22class KVDBSystem;
23class TObjArray;
24class KVDBRun;
26
35class KVDataSet: public KVBase {
36
37 friend class KVAvailableRunsFile;
38 friend class KVDataSetManager;
39
40protected:
47 mutable std::unique_ptr<TFile> fDBase;
52 enum {
53 kAvailable = BIT(14) //flag set if this dataset is physically present on local machine
54 };
56
57 virtual const Char_t* GetBaseFileName(const Char_t* type, Int_t run) const;
58
59 virtual void OpenDataBase(Option_t* opt = "") const;
60 virtual void OpenDBFile(const Char_t* full_path_to_dbfile) const;
61 virtual void WriteDBFile(const Char_t* full_path_to_dbfile) const;
62 void SetDBFileName(const Char_t* name)
63 {
65 }
66 const Char_t* GetDBFileName() const;
67 void SetDBName(const Char_t* name)
68 {
69 fDBName = name;
70 }
71 const Char_t* GetDBName() const;
72 const Char_t* GetFullPathToDB() const;
74 TObject* open_runfile(const Char_t* type, Int_t run);
75
77public:
82
84
85 KVDataSet();
86 virtual ~ KVDataSet() {}
87
88 virtual Bool_t CheckUserCanAccess();
89
90 virtual void SetDataPathSubdir(const Char_t* s)
91 {
92 SetLabel(s);
93 }
95 virtual const Char_t* GetDataPathSubdir() const
96 {
97 return GetLabel();
98 }
99 const Char_t* GetDataTypeSubdir(const Char_t* type) const
100 {
102 KVString snom;
103 snom.Form("KVDataSet.DataType.Subdir.%s", type);
104 return GetDataSetEnv(snom.Data(), type);
105 }
106 virtual const Char_t* GetAvailableDataTypes() const
107 {
108 return fDatatypes.Data();
109 }
110 virtual void AddAvailableDataType(const Char_t*);
111 virtual void SetUserGroups(const Char_t* groups)
112 {
113 fUserGroups = groups;
114 }
116 virtual Bool_t IsAvailable() const
117 {
118 return TestBit(kAvailable);
119 }
120 virtual void SetAvailable(Bool_t yes = kTRUE)
121 {
122 SetBit(kAvailable, yes);
123 }
124 virtual void CheckAvailable();
125
126 virtual Bool_t HasDataType(const Char_t* data_type) const
127 {
130
131 KVString _dt = data_type;
132 _dt.Remove(TString::kBoth, ' ');
133 return (_dt == "*" || fDatatypes.Contains(_dt));
134 }
135
136 virtual void ls(Option_t* opt = "") const;
137 virtual void Print(Option_t* opt = "") const;
138
139 virtual void SetAnalysisTasks(const KVSeqCollection*);
141 KVDataAnalysisTask* GetAnalysisTask(const Char_t* keywords) const;
142 virtual KVDataAnalysisTask* GetAnalysisTaskAny(const Char_t* keywords) const;
143 virtual Int_t GetNtasks() const;
144
145 virtual TList* GetListOfAvailableSystems(const Char_t* datatype,
146 KVDBSystem* systol = 0);
148 KVDBSystem* systol = 0);
149
150 void cd() const;
151
152 const Char_t* GetDataSetDir() const;
153 void SetName(const char* name);
154
155
156 KVExpDB* GetDataBase(Option_t* opt = "") const;
157 virtual void SaveDataBase() const;
158
159 const Char_t* GetDataSetEnv(const Char_t* type, const Char_t* defval = "") const;
160 Double_t GetDataSetEnv(const Char_t* type, Double_t defval) const;
161 Bool_t GetDataSetEnv(const Char_t* type, Bool_t defval) const;
162
163 TString GetFullPathToRunfile(const Char_t* type, Int_t run) const;
164 const Char_t* GetRunfileName(const Char_t* type, Int_t run) const;
165 TDatime GetRunfileDate(const Char_t* type, Int_t run);
166 template <typename FileType>
167 FileType* OpenRunfile(const Char_t* type, Int_t run)
168 {
169 return dynamic_cast<FileType*>(open_runfile(type, run));
170 }
171 TObject* OpenRunfile(const Char_t* type, Int_t run)
172 {
173 return open_runfile(type, run);
174 }
175
176 Bool_t CheckRunfileAvailable(const Char_t* type, Int_t run);
177 void UpdateAvailableRuns(const Char_t* type);
178 TFile* NewRunfile(const Char_t* type, Int_t run);
179 void CommitRunfile(const Char_t* type, Int_t run, TFile* file);
180
181 void CopyRunfilesFromRepository(const Char_t* type, KVNumberList runs, const Char_t* destdir);
182
183 void DeleteRunfile(const Char_t* type, Int_t run, Bool_t confirm = kTRUE);
184 void DeleteRunfiles(const Char_t* type, KVNumberList lrun = "", Bool_t confirm = kTRUE);
185 KVNumberList GetRunList_DateSelection(const Char_t* type, TDatime* min = 0, TDatime* max = 0);
186 KVNumberList GetRunList_StageSelection(const Char_t* other_type, const Char_t* base_type, KVDBSystem* sys = 0, Bool_t OnlyCol = kFALSE);
187 KVNumberList GetRunList_VersionSelection(const Char_t* type, const Char_t* version, KVDBSystem* sys = 0);
190
191 void CheckMultiRunfiles(const Char_t* data_type);
192 void CleanMultiRunfiles(const Char_t* data_type, Bool_t confirm = kTRUE);
193
194 Bool_t CheckRunfileUpToDate(const Char_t* data_type, Int_t run,
195 KVDataRepository* other_repos);
196 Bool_t CheckRunfileUpToDate(const Char_t* data_type, Int_t run,
197 const Char_t* other_repos);
198 void CheckUpToDate(const Char_t* data_type,
199 const Char_t* other_repos);
200 KVNumberList GetUpdatableRuns(const Char_t* data_type,
201 const Char_t* other_repos);
202
203 KVNumberList GetRunList(const Char_t* data_type,
204 const KVDBSystem* sys = 0) const;
205
206 virtual void MakeAnalysisClass(const Char_t* task, const Char_t* classname);
207
208 Bool_t OpenDataSetFile(const Char_t* filename, std::ifstream& file);
209 static Bool_t OpenDataSetFile(const TString& dataset, const Char_t* filename, std::ifstream& file);
210 TString GetFullPathToDataSetFile(const Char_t* filename);
211 static TString GetFullPathToDataSetFile(const TString& dataset, const Char_t* filename);
212 static Bool_t FindDataSetFile(const TString& dataset, const Char_t* filename);
213 Bool_t FindDataSetFile(const Char_t* filename);
214
215 virtual Bool_t DataBaseNeedsUpdate() const;
216
218 {
225
226 return GetDataSetEnv("ReconstructedEventClassName", "KVReconstructedEvent");
227 }
228
229 TString GetOutputRepository(const Char_t* taskname) const;
230 void CopyRunfilesToRepository(const Char_t* type, KVNumberList runs, const Char_t* destrepo);
231
233 {
238 return GetDataSetEnv("HasCalibIdentInfos", kTRUE);
239 }
240
241 ClassDef(KVDataSet, 3) //Describes a set of experimental data which may be analysed with KaliVeda
242};
243
245R__EXTERN KVDataSet* gDataSet;
246
247#endif
int Int_t
#define R__EXTERN
bool Bool_t
char Char_t
double Double_t
constexpr Bool_t kTRUE
const char Option_t
#define ClassDef(name, id)
#define BIT(n)
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]
Handles lists of available runs for different datasets and types of data.
Base class for KaliVeda framework.
Definition KVBase.h:142
void SetLabel(const Char_t *lab)
Definition KVBase.h:195
const Char_t * GetLabel() const
Definition KVBase.h:199
Description of an experimental run in database ,,.
Definition KVDBRun.h:36
Database class used to store information on different colliding systems studied during an experiment....
Definition KVDBSystem.h:52
Define and manage data analysis tasks.
Base class for managing repositories of experimental data.
Manage all datasets contained in a given data repository.
Manage an experimental dataset corresponding to a given experiment or campaign.
Definition KVDataSet.h:35
FileType * OpenRunfile(const Char_t *type, Int_t run)
Definition KVDataSet.h:167
virtual void SetUserGroups(const Char_t *groups)
Definition KVDataSet.h:111
TString fUserGroups
list of user groups allowed to read data
Definition KVDataSet.h:55
TString GetOutputRepository(const Char_t *taskname) const
virtual void OpenDBFile(const Char_t *full_path_to_dbfile) const
Open the database from a file on disk.
KVExpDB * fDataBase
pointer to dataset's database
Definition KVDataSet.h:50
virtual const Char_t * GetReconstructedEventClassName() const
Definition KVDataSet.h:217
KVNumberList GetRunList_VersionSelection(const Char_t *type, const Char_t *version, KVDBSystem *sys=0)
void CheckMultiRunfiles(const Char_t *data_type)
KVNumberList GetRunList_StageSelection(const Char_t *other_type, const Char_t *base_type, KVDBSystem *sys=0, Bool_t OnlyCol=kFALSE)
void CheckUpToDate(const Char_t *data_type, const Char_t *other_repos)
TString fDBName
name of database
Definition KVDataSet.h:48
virtual void SetDataPathSubdir(const Char_t *s)
Definition KVDataSet.h:90
void SetDBFileName(const Char_t *name)
Definition KVDataSet.h:62
const Char_t * GetDBName() const
Definition KVDataSet.cpp:89
KVDataRepository * GetRepository() const
Get pointer to data repository in which dataset is stored.
void CopyRunfilesToRepository(const Char_t *type, KVNumberList runs, const Char_t *destrepo)
const Char_t * GetDBFileName() const
Definition KVDataSet.cpp:72
const Char_t * GetDataSetDir() const
void DeleteRunfiles(const Char_t *type, KVNumberList lrun="", Bool_t confirm=kTRUE)
KVNumberList GetUpdatableRuns(const Char_t *data_type, const Char_t *other_repos)
Bool_t fDataBaseUpdateInProgress
Definition KVDataSet.h:76
virtual void ls(Option_t *opt="") const
Print dataset information.
void DeleteRunfile(const Char_t *type, Int_t run, Bool_t confirm=kTRUE)
KVAvailableRunsFile * GetAvailableRunsFile(const Char_t *type) const
Definition KVDataSet.cpp:50
virtual void AddAvailableDataType(const Char_t *)
virtual TList * GetListOfAvailableSystems(const Char_t *datatype, KVDBSystem *systol=0)
Bool_t CheckRunfileUpToDate(const Char_t *data_type, Int_t run, KVDataRepository *other_repos)
void SetName(const char *name)
KVDataAnalysisTask * GetAnalysisTask(Int_t) const
virtual const Char_t * GetBaseFileName(const Char_t *type, Int_t run) const
virtual const Char_t * GetDataPathSubdir() const
Returns name of top-level directory in data repository used to store data files for this dataset.
Definition KVDataSet.h:95
virtual void SaveDataBase() const
virtual KVDataAnalysisTask * GetAnalysisTaskAny(const Char_t *keywords) const
KVList fAvailableRuns
list of KVAvailableRunsFile objects used to read infos on available runs
Definition KVDataSet.h:51
virtual void SetAnalysisTasks(const KVSeqCollection *)
KVNumberList GetRunList_DateSelection(const Char_t *type, TDatime *min=0, TDatime *max=0)
Bool_t HasCalibIdentInfos() const
Definition KVDataSet.h:232
virtual void CheckAvailable()
const Char_t * GetRunfileName(const Char_t *type, Int_t run) const
TDatime GetRunfileDate(const Char_t *type, Int_t run)
const Char_t * GetDataSetEnv(const Char_t *type, const Char_t *defval="") const
virtual Bool_t HasDataType(const Char_t *data_type) const
Definition KVDataSet.h:126
virtual Int_t GetNtasks() const
std::unique_ptr< TFile > fDBase
file containing database
Definition KVDataSet.h:47
virtual const Char_t * GetAvailableDataTypes() const
Definition KVDataSet.h:106
KVNumberList GetRunList(const Char_t *data_type, const KVDBSystem *sys=0) const
TString GetFullPathToDataSetFile(const Char_t *filename)
TString GetFullPathToRunfile(const Char_t *type, Int_t run) const
TString fDBFileName
name of file in which database is stored on disk
Definition KVDataSet.h:49
void CopyRunfilesFromRepository(const Char_t *type, KVNumberList runs, const Char_t *destdir)
void UpdateAvailableRuns(const Char_t *type)
virtual Bool_t IsAvailable() const
Returns kTRUE if this dataset is available for analysis, i.e. if any associated data files are stored...
Definition KVDataSet.h:116
virtual void MakeAnalysisClass(const Char_t *task, const Char_t *classname)
TObject * OpenRunfile(const Char_t *type, Int_t run)
Definition KVDataSet.h:171
TObject * open_runfile(const Char_t *type, Int_t run)
void CommitRunfile(const Char_t *type, Int_t run, TFile *file)
KVExpDB * GetDataBase(Option_t *opt="") const
virtual Bool_t DataBaseNeedsUpdate() const
Bool_t OpenDataSetFile(const Char_t *filename, std::ifstream &file)
void SetDataSetSpecificTaskParameters(KVDataAnalysisTask *) const
TString fDatatypes
list of types of data which are available for this dataset
Definition KVDataSet.h:42
virtual void SetAvailable(Bool_t yes=kTRUE)
Definition KVDataSet.h:120
void cd() const
virtual void WriteDBFile(const Char_t *full_path_to_dbfile) const
const Char_t * GetDataTypeSubdir(const Char_t *type) const
Definition KVDataSet.h:99
const Char_t * GetFullPathToDB() const
Returns full path to file where database is written on disk.
TFile * NewRunfile(const Char_t *type, Int_t run)
virtual Bool_t CheckUserCanAccess()
Bool_t fDBBuild
has the database been built by us ?
Definition KVDataSet.h:46
KVDataRepository * fRepository
repository in which dataset is stored
Definition KVDataSet.h:41
void SetRepository(KVDataRepository *)
Set pointer to data repository in which dataset is stored.
Bool_t DataBaseUpdateInProgress() const
Definition KVDataSet.h:78
KVUniqueNameList fAllTasks
all data analysis tasks for this dataset
Definition KVDataSet.h:43
KVDataSet()
Default constructor.
Definition KVDataSet.cpp:35
void SetDBName(const Char_t *name)
Definition KVDataSet.h:67
void CleanMultiRunfiles(const Char_t *data_type, Bool_t confirm=kTRUE)
virtual void OpenDataBase(Option_t *opt="") const
static Bool_t OpenDataSetFile(const TString &dataset, const Char_t *filename, std::ifstream &file)
TString fCalibDir
directory containing database, calibration, identification parameters etc. for dataset
Definition KVDataSet.h:45
virtual void Print(Option_t *opt="") const
static Bool_t FindDataSetFile(const TString &dataset, const Char_t *filename)
Bool_t CheckRunfileAvailable(const Char_t *type, Int_t run)
KVUniqueNameList fTasks
possible data analysis tasks for this dataset (available data only)
Definition KVDataSet.h:44
Base class to describe database of an experiment ,,.
Definition KVExpDB.h:20
Extended TList class which owns its objects by default.
Definition KVList.h:28
Strings used to represent a set of ranges of values.
KaliVeda extensions to ROOT collection classes.
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition KVString.h:73
Optimised list in which named objects can only be placed once.
void SetBit(UInt_t f)
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
const char * Data() const
void Form(const char *fmt,...)
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const