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 "KVUnownedList.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  TTree* tree = nullptr;
57  TFile* file = nullptr;
58  KVSimEvent* evt = nullptr;
59  KVSimNucleus* nuc = nullptr;
60 
61  Int_t nevt;
62  KVString tree_name{"SIMULATION_NAME"}, tree_title{"SIMULATION"},
63  branch_name{"Simulated_evts"}, root_file_name{"Output.root"};
64  Bool_t kmode = true;
65  Bool_t fMultiFiles = false;
66  Int_t fFileIndex = 1;
67  TString fOutputDirectory = "./";
68 
69  KVUnownedList linked_info;
70  KVUnownedList linked_objects;
71  KVNameValueList nv;
72 
73 public:
74  KVSimReader();
76 
77  void CleanAll();
78 
79  void SetMultiFiles(Bool_t on = kTRUE)
80  {
81  fMultiFiles = on;
82  }
84  {
85  fFileIndex = i;
86  }
87  void SetOutputDirectory(const TString& where)
88  {
89  fOutputDirectory = where;
90  }
91 
92  virtual KVString GetDate()
93  {
94  TDatime now;
95  KVString stime;
96  stime.Form("%d_%02d_%02d_%02d:%02d:%02d",
97  now.GetYear(),
98  now.GetMonth(),
99  now.GetDay(),
100  now.GetHour(),
101  now.GetMinute(),
102  now.GetSecond()
103  );
104  return stime;
105 
106  }
107 
108  void SetFillingMode(Bool_t mode = kTRUE)
109  {
110  kmode = mode;
111  }
112  void DeclareTree(Option_t* option);
113 
115  {
116  return tree;
117  }
118  virtual void FillTree()
119  {
120  GetTree()->Fill();
121  }
123  {
124  return kmode;
125  }
126  virtual void SaveTree();
127  void Run(Option_t* option = "recreate");
128 
131  void AddObject(TObject* obj);
132  void WriteObjects();
134 
137 
138  void AddInfo(const KVNamedParameter&);
139 
140  void WriteInfo();
142 
144  virtual void ReadFile();
145  virtual Bool_t ReadHeader();
146  virtual Bool_t ReadEvent();
147  virtual Bool_t ReadNucleus();
148 
150  {
151  return nevt;
152  }
153 
154  void SetTreeName(const Char_t* n)
155  {
156  tree_name = n;
157  }
158  void SetTreeTitle(const Char_t* n)
159  {
160  tree_title = n;
161  }
162  void SetROOTFileName(const Char_t* n)
163  {
164  root_file_name = n;
165  }
166  void SetBranchName(const Char_t* n)
167  {
168  branch_name = n;
169  }
170 
171  const char* GetROOTFileName()
172  {
173  return root_file_name.Data();
174  }
175 
176  virtual void ConvertAndSaveEventsInFile(KVString filename);
177 
178  static KVSimReader* MakeSimReader(const char* model_uri);
179 
180  ClassDef(KVSimReader, 1) //Base class to read output files for simulation and create tree using KVEvent type class
181 };
182 
183 #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 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
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:121
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
A generic named parameter storing values of different types.
KaliVeda extensions to ROOT collection classes.
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
KVSeqCollection * GetSimuInfo()
virtual Bool_t ReadHeader()
Definition: KVSimReader.cpp:94
void SetTreeTitle(const Char_t *n)
Definition: KVSimReader.h:158
void WriteObjects()
void DeclareTree(Option_t *option)
Definition: KVSimReader.cpp:56
virtual Bool_t ReadNucleus()
virtual Bool_t ReadEvent()
void AddInfo(const KVNamedParameter &)
void SetBranchName(const Char_t *n)
Definition: KVSimReader.h:166
void SetOutputDirectory(const TString &where)
Definition: KVSimReader.h:87
void Run(Option_t *option="recreate")
void SetROOTFileName(const Char_t *n)
Definition: KVSimReader.h:162
KVSeqCollection * GetLinkedObjects()
void CleanAll()
Definition: KVSimReader.cpp:35
static KVSimReader * MakeSimReader(const char *model_uri)
Returns an instance of a child class specific to given model.
void SetFillingMode(Bool_t mode=kTRUE)
Definition: KVSimReader.h:108
Bool_t HasToFill()
Definition: KVSimReader.h:122
virtual void FillTree()
Definition: KVSimReader.h:118
void AddObject(TObject *obj)
void CreateObjectList()
void WriteInfo()
virtual void ConvertEventsInFile(KVString filename)
Definition: KVSimReader.cpp:24
void CreateInfoList()
void SetTreeName(const Char_t *n)
Definition: KVSimReader.h:154
Int_t GetNumberOfEvents()
Definition: KVSimReader.h:149
const char * GetROOTFileName()
Definition: KVSimReader.h:171
TTree * GetTree()
Definition: KVSimReader.h:114
virtual KVString GetDate()
Definition: KVSimReader.h:92
void SetFileIndex(Int_t i)
Definition: KVSimReader.h:83
virtual void ReadFile()
Definition: KVSimReader.cpp:85
void SetMultiFiles(Bool_t on=kTRUE)
Definition: KVSimReader.h:79
virtual void ConvertAndSaveEventsInFile(KVString filename)
Read events, convert and save in ROOT file.
virtual void SaveTree()
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
Extended TList class which does not own its objects by default.
Definition: KVUnownedList.h:20
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