KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVSimReader.h
Go to the documentation of this file.
1 
4 #ifndef __KVSIMREADER_H
5 #define __KVSIMREADER_H
6 
7 #include "KVBase.h"
8 #include "Riostream.h"
9 #include "KVSimEvent.h"
10 #include "KVSimNucleus.h"
11 #include "KVString.h"
12 #include "TTree.h"
13 #include "TFile.h"
14 #include "TMath.h"
15 #include "KVList.h"
16 #include "TObject.h"
17 #include "TDatime.h"
18 #include "TStopwatch.h"
19 #include "KVFileReader.h"
20 #include "TSystem.h"
21 #include "TROOT.h"
22 #include "TDirectory.h"
23 
57 class KVSimReader : public KVFileReader {
58 
59  void init();
60 
61 protected:
62 
67 
74 
79 
81 
82 public:
83 
84  KVSimReader();
85  virtual void ConvertEventsInFile(KVString filename);
86  virtual ~KVSimReader();
87 
88  void CleanAll();
89 
90  void SetMultiFiles(Bool_t on = kTRUE)
91  {
92  fMultiFiles = on;
93  }
95  {
96  fFileIndex = i;
97  }
98  void SetOutputDirectory(const TString& where)
99  {
100  fOutputDirectory = where;
101  }
102 
103  virtual KVString GetDate()
104  {
105  TDatime now;
106  KVString stime;
107  stime.Form("%d_%02d_%02d_%02d:%02d:%02d",
108  now.GetYear(),
109  now.GetMonth(),
110  now.GetDay(),
111  now.GetHour(),
112  now.GetMinute(),
113  now.GetSecond()
114  );
115  return stime;
116 
117  }
118 
119  void SetFillingMode(Bool_t mode = kTRUE)
120  {
121  kmode = mode;
122  }
123  void DeclareTree(Option_t* option);
124 
126  {
127  return tree;
128  }
129  virtual void FillTree()
130  {
131  GetTree()->Fill();
132  }
133  virtual Bool_t HasToFill()
134  {
135  return kmode;
136  }
137  virtual void SaveTree();
138  void Run(Option_t* option = "recreate");
139 
142  void AddObject(TObject* obj);
143  void WriteObjects();
144  void CreateObjectList();
145 
147  KVList* GetSimuInfo();
148  void AddInfo(const Char_t* name, const Char_t* val);
149  void AddInfo(TNamed* named);
150  void WriteInfo();
151  void CreateInfoList();
152 
154  virtual void ReadFile();
155  virtual Bool_t ReadHeader();
156  virtual Bool_t ReadEvent();
157  virtual Bool_t ReadNucleus();
158 
160  {
161  return nevt;
162  }
163 
164  void SetTreeName(const Char_t* n)
165  {
166  tree_name = n;
167  }
168  void SetTreeTitle(const Char_t* n)
169  {
170  tree_title = n;
171  }
172  void SetROOTFileName(const Char_t* n)
173  {
174  root_file_name = n;
175  }
176  void SetBranchName(const Char_t* n)
177  {
178  branch_name = n;
179  }
180 
181  const char* GetROOTFileName()
182  {
183  return root_file_name.Data();
184  }
185 
186  virtual void ConvertAndSaveEventsInFile(KVString filename);
187 
188  static KVSimReader* MakeSimReader(const char* model_uri);
189 
190  ClassDef(KVSimReader, 1) //Base class to read output files for simulation and create tree using KVEvent type class
191 };
192 
193 #endif
int Int_t
char Char_t
bool Bool_t
const char Option_t
#define ClassDef(name, id)
Handle reading columns of numeric data in text files.
Definition: KVFileReader.h:119
Extended TList class which owns its objects by default.
Definition: KVList.h:27
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
Container class for simulated nuclei, KVSimNucleus.
Definition: KVSimEvent.h:21
Nucleus in a simulated event.
Definition: KVSimNucleus.h:31
Base class to read output files for simulation and create tree using KVSimEvent class.
Definition: KVSimReader.h:57
virtual Bool_t ReadHeader()
KVString root_file_name
Definition: KVSimReader.h:69
void SetTreeTitle(const Char_t *n)
Definition: KVSimReader.h:168
Int_t nevt
Definition: KVSimReader.h:68
void WriteObjects()
void DeclareTree(Option_t *option)
KVString tree_name
Definition: KVSimReader.h:69
KVList * linked_info
Liste d'info (TNamed) enregistree dans l arbre.
Definition: KVSimReader.h:77
KVString tree_title
Definition: KVSimReader.h:69
virtual Bool_t ReadNucleus()
virtual Bool_t ReadEvent()
TString fOutputDirectory
where to save converted events
Definition: KVSimReader.h:73
void SetBranchName(const Char_t *n)
Definition: KVSimReader.h:176
void SetOutputDirectory(const TString &where)
Definition: KVSimReader.h:98
void Run(Option_t *option="recreate")
void SetROOTFileName(const Char_t *n)
Definition: KVSimReader.h:172
KVList * linked_objects
liste d'objets a enregistree avec l'arbre
Definition: KVSimReader.h:78
KVList * GetLinkedObjects()
void CleanAll()
Definition: KVSimReader.cpp:86
KVString branch_name
Definition: KVSimReader.h:69
KVSimNucleus * nuc
Definition: KVSimReader.h:66
static KVSimReader * MakeSimReader(const char *model_uri)
void SetFillingMode(Bool_t mode=kTRUE)
Definition: KVSimReader.h:119
Bool_t fMultiFiles
Definition: KVSimReader.h:71
virtual Bool_t HasToFill()
Definition: KVSimReader.h:133
Int_t fFileIndex
Definition: KVSimReader.h:72
virtual void FillTree()
Definition: KVSimReader.h:129
void AddObject(TObject *obj)
void CreateObjectList()
void WriteInfo()
virtual void ConvertEventsInFile(KVString filename)
Method called by constructors with KVString filename argument.
Definition: KVSimReader.cpp:56
void CreateInfoList()
KVList * GetSimuInfo()
KVSimReader()
Default constructor.
Definition: KVSimReader.cpp:45
void SetTreeName(const Char_t *n)
Definition: KVSimReader.h:164
Int_t GetNumberOfEvents()
Definition: KVSimReader.h:159
KVSimEvent * evt
Definition: KVSimReader.h:65
virtual ~KVSimReader()
Destructor.
Definition: KVSimReader.cpp:71
const char * GetROOTFileName()
Definition: KVSimReader.h:181
TTree * GetTree()
Definition: KVSimReader.h:125
virtual KVString GetDate()
Definition: KVSimReader.h:103
Bool_t kmode
Definition: KVSimReader.h:70
void SetFileIndex(Int_t i)
Definition: KVSimReader.h:94
TTree * tree
Definition: KVSimReader.h:63
KVNameValueList * nv
Definition: KVSimReader.h:80
void AddInfo(const Char_t *name, const Char_t *val)
virtual void ReadFile()
void SetMultiFiles(Bool_t on=kTRUE)
Definition: KVSimReader.h:90
virtual void ConvertAndSaveEventsInFile(KVString filename)
Read events, convert and save in ROOT file.
virtual void SaveTree()
TFile * file
Definition: KVSimReader.h:64
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
Int_t GetMonth() const
Int_t GetDay() const
Int_t GetHour() const
Int_t GetSecond() const
Int_t GetYear() const
Int_t GetMinute() const
const char * Data() const
void Form(const char *fmt,...)
virtual Int_t Fill()
const Int_t n