6 #include "TSystemDirectory.h"
12 #include "TBranchElement.h"
42 gSystem->ExpandPathName(_path);
43 if (!gSystem->IsAbsoluteFileName(_path)) {
44 if (_path.CountChar(
'.') == 1) {
45 _path.ReplaceAll(
".",
"$(PWD)");
46 gSystem->ExpandPathName(_path);
61 fFiltData.SetName(
"Filtered Simulated Data");
131 Info(
"AnalyseDirectory",
"Analysing %s...",
GetDirectory());
136 unique_ptr<TList> fileList(thisDir.GetListOfFiles());
137 TIter nextFile(fileList.get());
138 TSystemFile* aFile = 0;
139 while ((aFile = (TSystemFile*)nextFile())) {
141 if (aFile->IsDirectory())
continue;
143 KVString fileName = aFile->GetName();
144 if (!fileName.EndsWith(
".root") && !fileName.Contains(
".root."))
continue;
196 AssignAndDelete(fullpath, gSystem->ConcatFileName(
GetDirectory(), filename));
197 unique_ptr<TFile> file(TFile::Open(fullpath));
198 if (!file.get() || file->IsZombie())
return;
200 TIter next(file->GetListOfKeys());
202 while ((key = (TKey*)next())) {
203 TString cn = key->GetClassName();
206 TTree* tree = (TTree*)file->Get(key->GetName());
207 TSeqCollection* branches = tree->GetListOfBranches();
208 TIter nextB(branches);
209 TBranchElement* branch;
210 while ((branch = (TBranchElement*)nextB())) {
211 TString branch_classname = branch->GetClassName();
212 TClass* branch_class = TClass::GetClass(branch_classname, kFALSE, kTRUE);
213 if (branch_class && branch_class->InheritsFrom(
"KVEvent")) {
214 if (branch_class->InheritsFrom(
"KVReconstructedEvent")) {
216 unique_ptr<TNamed> ds((TNamed*)file->Get(
"Dataset"));
217 unique_ptr<TNamed> orig((TNamed*)file->Get(
"Origin"));
218 unique_ptr<TNamed> sys((TNamed*)file->Get(
"System"));
219 unique_ptr<TNamed> r((TNamed*)file->Get(
"Run"));
220 unique_ptr<TNamed> g((TNamed*)file->Get(
"Geometry"));
221 unique_ptr<TNamed> f((TNamed*)file->Get(
"Filter"));
223 if (ds.get()) dataset = ds->GetTitle();
225 if (sys.get()) system = sys->GetTitle();
227 if (r.get()) run = r->GetTitle();
229 if (orig.get()) origin = orig->GetTitle();
231 if (g.get()) geometry = g->GetTitle();
233 if (f.get()) filter = f->GetTitle();
234 Int_t run_number = -1;
235 if (run.IsDec()) run_number = run.Atoi();
236 KVSimFile* fff =
new KVSimFile(
this, filename, tree->GetTitle(), tree->GetEntries(), tree->GetName(), branch->GetName(),
237 dataset, system, run_number, geometry, origin, filter);
239 unique_ptr<TNamed> gem((TNamed*)file->Get(
"Gemini++"));
241 if (!strcmp(gem->GetTitle(),
"yes")) fff->
SetGemini();
242 unique_ptr<TNamed> gemdec((TNamed*)file->Get(
"GemDecayPerEvent"));
244 TString gemdecperev = gemdec->GetTitle();
251 fSimData.
Add(
new KVSimFile(
this, filename, tree->GetTitle(), tree->GetEntries(), tree->GetName(), branch->GetName()));
285 TROOT::IndentLevel();
286 cout <<
"SIMULATION SET: " << GetName() << endl;
288 cout <<
"CONTENTS:" << endl;
289 cout <<
"--simulated data:" << endl;
291 cout <<
"--filtered data:" << endl;
Base class for KaliVeda framework.
virtual void Copy(TObject &) const
Make a copy of this object.
virtual void Clear(Option_t *option="")
virtual void Add(TObject *obj)
Handle directory containing simulated and/or filtered simulated data ,.
void init()
Default initialisations.
KVSimDir()
Default constructor.
void ls(Option_t *opt="") const
virtual void AnalyseFile(const Char_t *)
virtual ~KVSimDir()
Destructor.
KVList fSimData
list of simulated data files
KVList fFiltData
list of filtered simulated data files
void AddSimData(KVSimFile *)
virtual void AnalyseDirectory()
void AddFiltData(KVSimFile *)
virtual const Char_t * GetDirectory() const
void Copy(TObject &) const
Handle file containing simulated and/or filtered simulated data ,.
void SetGemini(Bool_t yes=kTRUE)
void SetGemDecayPerEvent(Int_t n)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....