4 #include "KVSimReader.h"
16 linked_info.
SetName(
"Simulation info");
17 linked_objects.SetName(
"List of objects");
29 KVError::Error(
this,
"ReadFileHeader",
"Error reading the file header");
97 void KVSimReader::InitializeOutputFileAndTree()
111 auto filename = GetCurrentRootFileName();
112 if (!fOutputDirectory.
EndsWith(
"/")) fOutputDirectory +=
"/";
126 void KVSimReader::ReadEventsInFile()
130 total_nevents=total_nevents_current_output_file=0;
139 if(NeedNewOutputFile())
142 InitializeOutputFileAndTree();
143 total_nevents_current_output_file=0;
145 ++total_nevents_current_output_file;
147 if(OutputFileIsFull())
249 TString KVSimReader::GetCurrentRootFileName()
254 if(max_number_events_per_output_file)
269 if(!NeedNewOutputFile())
284 ::Error(
"KVSimReader::MakeSimReader",
"No plugin defined with name %s", model_uri);
294 void KVSimReader::Run()
302 InitializeOutputFileAndTree();
308 AddInfo({
"date", GetDate()});
317 void KVSimReader::SaveTree()
322 KVError::Info(
this,
"SaveTree",
"Writing %d events in file : %s", total_nevents_current_output_file,
file->GetName());
365 void KVSimReader::WriteInfo()
381 return &linked_objects;
391 void KVSimReader::AddObject(
TObject* obj)
396 GetLinkedObjects()->
Add(obj);
403 void KVSimReader::WriteObjects()
410 list->
Add(linked_objects.
At(ii));
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,...)
R__EXTERN TSystem * gSystem
static TPluginHandler * LoadPlugin(const Char_t *base, const Char_t *uri="0")
static void MakeEventBranch(TTree *tree, const TString &branchname, T &event, Int_t bufsize=10000000)
void Clear(Option_t *opt="") override
Bool_t OpenFileToRead(const KVString &filename)
A generic named parameter storing values of different types.
KaliVeda extensions to ROOT collection classes.
void Add(TObject *obj) override
TObject * At(Int_t idx) const override
Container class for simulated nuclei, KVSimNucleus.
Nucleus in a simulated event.
Base class to convert output from different simulation codes into TTrees containing KVSimEvent event ...
virtual Bool_t ReadEventHeader(KVSimEvent *)
virtual Bool_t ReadNucleus(KVSimNucleus *)
virtual Bool_t ReadFileHeader()
static KVSimReader * MakeSimReader(const char *model_uri)
Returns an instance of a child class specific to given model.
virtual void NotifyChangeOfOutputFile()
void ConvertEventsInFile(KVString filename)
virtual Bool_t ReadEvent(KVSimEvent *evt)=0
void ConvertAndSaveEventsInFile(KVString filename)
Read events, convert and save in ROOT file(s)
virtual bool NeedToIterateReadEvent()
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
virtual Int_t GetEntries() const
void Add(TObject *obj) override
virtual void SetName(const char *name)
virtual void Error(const char *method, const char *msgfmt,...) const
Longptr_t ExecPlugin(int nargs)
void Start(Bool_t reset=kTRUE)
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
virtual UserGroup_t * GetUserInfo(const char *user=nullptr)
Int_t Write(const char *name=nullptr, Int_t option=0, Int_t bufsize=0) const override
virtual TList * GetUserInfo()
void Error(UserClass p, const char *location, const char *va_(fmt),...)
void Info(UserClass p, const char *location, const char *va_(fmt),...)