6 #include "KVSystemDirectory.h"
13 #include <KVSystemFile.h>
46 throw std::runtime_error(
Form(
"<KVSimDir::KVSimDir> : invalid path %s given to constructor", path));
121 fAuxDir = std::make_unique<KVSimDir>(
"aux", fullpath);
131 return fAuxDir->GetDirectory();
155 Error(
"IsFromAuxDirectory",
"The file %s is neither associated to the main nor the auxiliary directory of dataset %s",
178 TIter nextFile(fileList);
195 fAuxDir->fSimData.Clear(
"nodelete");
196 fAuxDir->fFiltData.Clear(
"nodelete");
247 if (!
file.get() ||
file->IsZombie())
return;
251 while ((key = (
TKey*)next())) {
257 TIter nextB(branches);
262 if (branch_class && branch_class->
InheritsFrom(
"KVEvent")) {
263 if (branch_class->
InheritsFrom(
"KVReconstructedEvent")) {
265 unique_ptr<TNamed> ds((
TNamed*)
file->Get(
"Dataset"));
266 unique_ptr<TNamed> orig((
TNamed*)
file->Get(
"Origin"));
267 unique_ptr<TNamed> sys((
TNamed*)
file->Get(
"System"));
269 unique_ptr<TNamed>
f((
TNamed*)
file->Get(
"Filter"));
270 unique_ptr<TNamed> phi((
TNamed*)
file->Get(
"RandomPhi"));
271 unique_ptr<TNamed> dqa((
TNamed*)
file->Get(
"DataQualityAudit"));
273 if (ds) dataset = ds->GetTitle();
275 if (sys) system = sys->GetTitle();
279 if (phi) random_phi = (
TString(phi->GetTitle()) ==
"yes");
282 origin = orig->GetTitle();
291 std::vector<KVString> bits;
293 bits.push_back(o.
Next());
295 if (bits.size() > 2) {
297 auto last_bit = bits.size() - 1;
298 auto last_but_one_bit = last_bit - 1;
299 if (bits[last_bit] ==
"root" && bits[last_but_one_bit].IsDec()) {
300 origin.
Remove(origin.
Index(
Form(
".%d.root", bits[last_but_one_bit].Atoi())),
301 origin.
Length() - origin.
Index(
Form(
".%d.root", bits[last_but_one_bit].Atoi())));
302 origin +=
Form(
".root.%d", bits[last_but_one_bit].Atoi());
307 if (
f) filter =
f->GetTitle();
308 Int_t run_number = -1;
309 if (run.
IsDec()) run_number = run.
Atoi();
311 if (dqa) _dqa = dqa->GetTitle();
313 dataset, system, run_number, origin, filter, _dqa);
316 unique_ptr<TNamed> gem((
TNamed*)
file->Get(
"Gemini++"));
318 if (!strcmp(gem->GetTitle(),
"yes")) fff->
SetGemini();
319 unique_ptr<TNamed> gemdec((
TNamed*)
file->Get(
"GemDecayPerEvent"));
321 TString gemdecperev = gemdec->GetTitle();
324 unique_ptr<TNamed> gemrot((
TNamed*)
file->Get(
"GemAddRotEner"));
354 if (set_parent_aux_dir)
f->SetSimDir(
fAuxDir.get());
355 else f->SetSimDir(
this);
371 if (set_parent_aux_dir)
f->SetSimDir(
fAuxDir.get());
372 else f->SetSimDir(
this);
383 cout <<
"SIMULATION SET: " <<
GetName() << endl;
385 cout <<
"CONTENTS:" << endl;
386 cout <<
"--simulated data:" << endl;
388 cout <<
"--filtered data:" << endl;
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
char * Form(const char *fmt,...)
void AssignAndDelete(TString &target, char *tobedeleted)
R__EXTERN TSystem * gSystem
Base class for KaliVeda framework.
void Error(const char *method, const char *msgfmt,...) const override
colourised errors (red) !
void Copy(TObject &) const override
Make a copy of this object.
static std::optional< TString > AbsoluteUnixPath(const TString &)
void Add(TObject *obj) override
void Clear(Option_t *option="") override
Handle directory containing simulated and/or filtered simulated data ,.
void ls(Option_t *opt="") const override
void Copy(TObject &) const override
void SetAuxDirectory(const TString &)
void AddFiltData(KVSimFile *, bool=false)
void init()
Default initialisations.
Bool_t HasAuxDirectory() const
KVSimDir()
Default constructor.
const Char_t * GetDirectory() const
Bool_t IsFromAuxDirectory(KVSimFile *) const
returns true if given file is in the auxiliary directory
std::unique_ptr< KVSimDir > fAuxDir
potential auxiliary directory associated with this one
void AnalyseFile(const Char_t *)
KVList fSimData
list of simulated data files
KVList fFiltData
list of filtered simulated data files
TString GetAuxDirectory() const
void AddSimData(KVSimFile *, bool=false)
Handle file containing simulated and/or filtered simulated data ,.
void SetRandomPhi(bool yes=true)
void SetGemini(Bool_t yes=kTRUE)
KVSimDir * GetSimDir() const
void SetGemAddRotEner(bool yes=true)
void SetGemDecayPerEvent(Int_t n)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
Extension of ROOT TSystemDirectory class, handling browsing directories on disk.
TList * GetListOfFiles() const override
Extended ROOT TSystemFile with added info on file size etc.
const char * GetClassName() const override
static TClass * GetClass(Bool_t load=kTRUE, Bool_t silent=kFALSE)
Bool_t InheritsFrom(const char *cl) const override
void ls(Option_t *option="") const override
void SetName(const char *name)
virtual void AddAll(const TCollection *col)
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
virtual const char * GetClassName() const
virtual void SetTitle(const char *title="")
const char * GetName() const override
virtual const char * GetTitle() const
virtual void Info(const char *method, const char *msgfmt,...) const
static void IndentLevel()
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
virtual char * ConcatFileName(const char *dir, const char *name)