KaliVeda
Toolkit for HIC analysis
KVSimReader_HIPSE.cpp
1 //Created by KVClassFactory on Wed Jul 7 12:15:56 2010
2 //Author: bonnet
3 
4 #include "KVSimReader_HIPSE.h"
5 
7 
8 
9 
10 
14 {
15  // Default constructor
16  init();
17 }
18 
19 
20 
22 
24 {
25  init();
27 }
28 
29 
30 
32 
34 {
35 }
36 
37 
38 
39 
41 
43 {
44  h1 = new TH1F("impact_parameter", "distri", 200, 0, 20);
45  AddObject(h1);
46  h1->SetDirectory(nullptr);//avoid double deletion on ROOT file close
47 
48  while (IsOK()) {
49  while (ReadEvent()) {
50  if (nevt % 1000 == 0) Info("ReadFile", "%d evts lus", nevt);
51  h1->Fill(evt->GetParameters()->GetDoubleValue("Bparstore"));
52  if (HasToFill()) FillTree();
53  }
54  }
55 
56 }
57 
58 
59 
61 
63 {
64 
65  auto res = ReadLineAndCheck(2, " ");
66  switch (res) {
68  return kFALSE;
70  AddInfo({"Aproj", GetIntReadPar(0)});
71  AddInfo({"Zproj", GetIntReadPar(1)});
73  break;
74  default:
75  return kFALSE;
76  }
77 
78  res = ReadLineAndCheck(2, " ");
79  switch (res) {
81  return kFALSE;
83  AddInfo({"Atarg", GetIntReadPar(0)});
84  AddInfo({"Ztarg", GetIntReadPar(1)});
86 
87  break;
88  default:
89 
90  return kFALSE;
91  }
92 
93  res = ReadLineAndCheck(1, " ");
94  switch (res) {
96  return kFALSE;
98  AddInfo({"Ebeam", GetDoubleReadPar(0)});
100  return kTRUE;
101 
102  default:
103 
104  return kFALSE;
105  }
106 
107 }
108 
109 
110 
112 
114 {
115 
116  evt->Clear();
117  Int_t mult = 0, mtotal = 0;
118 
119  /*---------------------------------------------
120  mul_vrai = multiplicity of charged particles
121  mult = total multiplicity (i.e. including neutrons)
122  //---------------------------------------------
123  */
124  auto res = ReadLineAndCheck(2, " ");
125  switch (res) {
127  Info("ReadEvent", "case 0 line est vide");
128  return kFALSE;
130  evt->SetNumber(nevt);
131  mult = GetIntReadPar(0); //mul_vrai
132  mtotal = GetIntReadPar(1);
133  evt->GetParameters()->SetValue("mult", mtotal);
134 
135  break;
136  default:
137 
138  return kFALSE;
139  }
140 
141  /*---------------------------------------------
142  Esa = excitation per nucleon
143  vcm = center of mass energy
144  Bparstore = impact parameter
145  //---------------------------------------------
146  */
147  res = ReadLineAndCheck(3, " ");
148  switch (res) {
150  return kFALSE;
154  evt->GetParameters()->SetValue("Bparstore", GetDoubleReadPar(2));
155 
156  break;
157  default:
158 
159  return kFALSE;
160  }
161 
162  /*---------------------------------------------
163  energetic information
164  excitat : total excitation energy
165  xmassav : Q-value
166  ekinav : total kinetic energy at freeze-out
167  epotav : total potential energy at freeze-out
168  erotav : total rotational energy at freeze-out
169  //---------------------------------------------
170  */
171  res = ReadLineAndCheck(2, " ");
172  switch (res) {
174  return kFALSE;
176  evt->GetParameters()->SetValue("excitat", GetDoubleReadPar(0));
177  evt->GetParameters()->SetValue("xmassav", GetDoubleReadPar(1));
178 
179  break;
180  default:
181 
182  return kFALSE;
183  }
184 
185  res = ReadLineAndCheck(3, " ");
186  switch (res) {
188  return kFALSE;
190 
191  evt->GetParameters()->SetValue("ekinav", GetDoubleReadPar(0));
192  evt->GetParameters()->SetValue("epotav", GetDoubleReadPar(1));
193  evt->GetParameters()->SetValue("erotav", GetDoubleReadPar(2));
194  break;
195 
196  default:
197  return kFALSE;
198  }
199 
200  evt->SetNumber(nevt);
201  for (Int_t mm = 0; mm < mult; mm += 1) {
203  if (!ReadNucleus()) return kFALSE;
204  }
205 
206  nevt += 1;
207  return kTRUE;
208 
209 }
210 
211 
212 
214 
216 {
217 
218  auto res = ReadLineAndCheck(3, " ");
219  switch (res) {
221  Info("ReadNucleus", "case 0 line est vide");
222  return kFALSE;
223 
225  /*
226  proven = 0 -> fusion of the QP and QT
227  proven = 1 -> QP
228  proven = 2 -> QT
229  proven > 2 -> other
230  */
231  nuc->SetZ(GetIntReadPar(1));
232  nuc->SetA(GetIntReadPar(0));
233  nuc->GetParameters()->SetValue("proven", GetDoubleReadPar(2));
234  break;
235 
236  default:
237  return kFALSE;
238  }
239 
240  res = ReadLineAndCheck(3, " ");
241  switch (res) {
243  Info("ReadNucleus", "case 0 line est vide");
244  return kFALSE;
245 
247  //Axe "faisceau dans HIPSE x -> on effectue une rotation X,Y,Z -> Y,Z,X"
249  break;
250 
251  default:
252  return kFALSE;
253  }
254 
255  int AA = nuc->GetA();
256 
257  /*---------------------------------------------------------
258  exci(I) : excitation energy
259  ether(I) : not used
260  spinx(i),spiny(i),spinz(i) : angular momentum (hbar units)
261  //---------------------------------------------
262  */
263  res = ReadLineAndCheck(2, " ");
264  switch (res) {
266  Info("ReadNucleus", "case 0 line est vide");
267  return kFALSE;
268 
271  nuc->GetParameters()->SetValue("exci", GetDoubleReadPar(0));
272  nuc->GetParameters()->SetValue("ether", GetDoubleReadPar(1));
273  break;
274 
275  default:
276  return kFALSE;
277  }
278 
279  res = ReadLineAndCheck(3, " ");
280  switch (res) {
282  Info("ReadNucleus", "case 0 line est vide");
283  return kFALSE;
284 
286  //On effectue la meme rotation que les impulsions ... à vérifier
288  return kTRUE;
289 
290  default:
291  return kFALSE;
292  }
293 
294 
295 
296 }
297 
298 
302 
304 {
305  // ROOT file called: HIPSE_[PROJ]_[TARG]_[EBEAM]AMeV.root
306  // Call after reading file header
307 
308  SetROOTFileName(Form("HIPSE_%s_%s_%.1fAMeV.root",
310 }
311 
312 
313 
314 
316 
318 {
319  if (!OpenFileToRead(filename)) return;
320  if (!ReadHeader()) return;
322  tree_title.Form("HIPSE primary events %s + %s %.1f MeV/nuc.",
324  Run();
325  CloseFile();
326 }
327 
328 
int Int_t
bool Bool_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
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,...)
virtual void SetNumber(UInt_t num)
Definition: KVBase.h:215
KVNameValueList * GetParameters() const
Definition: KVEvent.h:180
void Clear(Option_t *opt="") override
Definition: KVEvent.h:239
@ EmptyLine
last line read was empty (only whitespace)
@ OK
successful read and import of parameters from line
ReadStatus ReadLineAndCheck(Int_t nexpect, const KVString &pattern)
Definition: KVFileReader.h:279
void CloseFile()
Definition: KVFileReader.h:237
Double_t GetDoubleReadPar(Int_t pos) const
Definition: KVFileReader.h:334
Int_t GetIntReadPar(Int_t pos) const
Definition: KVFileReader.h:338
Bool_t IsOK()
Definition: KVFileReader.h:231
KVString GetReadPar(Int_t pos) const
Definition: KVFileReader.h:342
Bool_t OpenFileToRead(const KVString &filename)
Definition: KVFileReader.h:210
Double_t GetDoubleValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
const Char_t * GetSymbol(Option_t *opt="") const
Definition: KVNucleus.cpp:71
void SetExcitEnergy(Double_t e)
Definition: KVNucleus.cpp:862
Int_t GetA() const
Definition: KVNucleus.cpp:796
void SetA(Int_t a)
Definition: KVNucleus.cpp:651
void SetZ(Int_t z, Char_t mt=-1)
Definition: KVNucleus.cpp:700
void SetZandA(Int_t z, Int_t a)
Set atomic number and mass number.
Definition: KVNucleus.cpp:717
KVNameValueList * GetParameters() const
Definition: KVParticle.h:818
void SetMomentum(const TVector3 *v)
Definition: KVParticle.h:545
Nucleus in a simulated event.
Definition: KVSimNucleus.h:32
void SetAngMom(Double_t lx, Double_t ly, Double_t lz)
set the angular momentum of the nucleus
Read ascii file for events of the HIPSE code after clusterization.
void ReadFile() override
void ConvertEventsInFile(KVString filename) override
Bool_t ReadNucleus() override
virtual void define_output_filename()
Bool_t ReadEvent() override
Bool_t ReadHeader() override
KVSimReader_HIPSE()
Default constructor.
Int_t nevt
Definition: KVSimReader.h:62
KVString tree_title
Definition: KVSimReader.h:63
void AddInfo(const KVNamedParameter &)
void Run(Option_t *option="recreate")
void SetROOTFileName(const Char_t *n)
Definition: KVSimReader.h:167
KVSimNucleus * nuc
Definition: KVSimReader.h:60
virtual Bool_t HasToFill()
Definition: KVSimReader.h:127
virtual void FillTree()
Definition: KVSimReader.h:123
void AddObject(TObject *obj)
KVSimEvent * evt
Definition: KVSimReader.h:59
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
Particle * AddParticle()
virtual void SetDirectory(TDirectory *dir)
virtual Int_t Fill(const char *name, Double_t w)
virtual void Info(const char *method, const char *msgfmt,...) const
Int_t Atoi() const
void Form(const char *fmt,...)
void init()
ClassImp(TPyArg)