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