KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVSimReader_HIPSE.cpp
Go to the documentation of this file.
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();
26  ConvertEventsInFile(filename);
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", GetReadPar(0).Data());
71  AddInfo("Zproj", GetReadPar(1).Data());
72  proj.SetZandA(GetReadPar(1).Atoi(), GetReadPar(0).Atoi());
73  break;
74  default:
75  return kFALSE;
76  }
77 
78  res = ReadLineAndCheck(2, " ");
79  switch (res) {
81  return kFALSE;
83  AddInfo("Atarg", GetReadPar(0).Data());
84  AddInfo("Ztarg", GetReadPar(1).Data());
85  targ.SetZandA(GetReadPar(1).Atoi(), GetReadPar(0).Atoi());
86 
87  break;
88  default:
89 
90  return kFALSE;
91  }
92 
93  res = ReadLineAndCheck(1, " ");
94  switch (res) {
96  return kFALSE;
98  AddInfo("Ebeam", GetReadPar(0).Data());
99  ebeam = GetReadPar(0).Atof();
100  return kTRUE;
101 
102 
103  default:
104 
105  return kFALSE;
106  }
107 
108 }
109 
110 
111 
113 
115 {
116 
117  evt->Clear();
118  Int_t mult = 0, mtotal = 0;
119 
120  /*---------------------------------------------
121  mul_vrai = multiplicity of charged particles
122  mult = total multiplicity (i.e. including neutrons)
123  //---------------------------------------------
124  */
125  auto res = ReadLineAndCheck(2, " ");
126  switch (res) {
128  Info("ReadEvent", "case 0 line est vide");
129  return kFALSE;
131  evt->SetNumber(nevt);
132  mult = GetIntReadPar(0); //mul_vrai
133  mtotal = GetIntReadPar(1);
134  evt->GetParameters()->SetValue("mult", mtotal);
135 
136  break;
137  default:
138 
139  return kFALSE;
140  }
141 
142  /*---------------------------------------------
143  Esa = excitation per nucleon
144  vcm = center of mass energy
145  Bparstore = impact parameter
146  //---------------------------------------------
147  */
148  res = ReadLineAndCheck(3, " ");
149  switch (res) {
151  return kFALSE;
155  evt->GetParameters()->SetValue("Bparstore", GetDoubleReadPar(2));
156 
157  break;
158  default:
159 
160  return kFALSE;
161  }
162 
163  /*---------------------------------------------
164  energetic information
165  excitat : total excitation energy
166  xmassav : Q-value
167  ekinav : total kinetic energy at freeze-out
168  epotav : total potential energy at freeze-out
169  erotav : total rotational energy at freeze-out
170  //---------------------------------------------
171  */
172  res = ReadLineAndCheck(2, " ");
173  switch (res) {
175  return kFALSE;
177  evt->GetParameters()->SetValue("excitat", GetDoubleReadPar(0));
178  evt->GetParameters()->SetValue("xmassav", GetDoubleReadPar(1));
179 
180  break;
181  default:
182 
183  return kFALSE;
184  }
185 
186  res = ReadLineAndCheck(3, " ");
187  switch (res) {
189  return kFALSE;
191 
192  evt->GetParameters()->SetValue("ekinav", GetDoubleReadPar(0));
193  evt->GetParameters()->SetValue("epotav", GetDoubleReadPar(1));
194  evt->GetParameters()->SetValue("erotav", GetDoubleReadPar(2));
195  break;
196 
197  default:
198  return kFALSE;
199  }
200 
201  evt->SetNumber(nevt);
202  for (Int_t mm = 0; mm < mult; mm += 1) {
204  if (!ReadNucleus()) return kFALSE;
205  }
206 
207  nevt += 1;
208  return kTRUE;
209 
210 }
211 
212 
213 
215 
217 {
218 
219  auto res = ReadLineAndCheck(3, " ");
220  switch (res) {
222  Info("ReadNucleus", "case 0 line est vide");
223  return kFALSE;
224 
226  /*
227  proven = 0 -> fusion of the QP and QT
228  proven = 1 -> QP
229  proven = 2 -> QT
230  proven > 2 -> other
231  */
232  nuc->SetZ(GetIntReadPar(1));
233  nuc->SetA(GetIntReadPar(0));
234  nuc->GetParameters()->SetValue("proven", GetDoubleReadPar(2));
235  break;
236 
237  default:
238  return kFALSE;
239  }
240 
241  res = ReadLineAndCheck(3, " ");
242  switch (res) {
244  Info("ReadNucleus", "case 0 line est vide");
245  return kFALSE;
246 
248  //Axe "faisceau dans HIPSE x -> on effectue une rotation X,Y,Z -> Y,Z,X"
250  break;
251 
252  default:
253  return kFALSE;
254  }
255 
256  int AA = nuc->GetA();
257 
258  /*---------------------------------------------------------
259  exci(I) : excitation energy
260  ether(I) : not used
261  spinx(i),spiny(i),spinz(i) : angular momentum (hbar units)
262  //---------------------------------------------
263  */
264  res = ReadLineAndCheck(2, " ");
265  switch (res) {
267  Info("ReadNucleus", "case 0 line est vide");
268  return kFALSE;
269 
272  nuc->GetParameters()->SetValue("exci", GetDoubleReadPar(0));
273  nuc->GetParameters()->SetValue("ether", GetDoubleReadPar(1));
274  break;
275 
276  default:
277  return kFALSE;
278  }
279 
280  res = ReadLineAndCheck(3, " ");
281  switch (res) {
283  Info("ReadNucleus", "case 0 line est vide");
284  return kFALSE;
285 
287  //On effectue la meme rotation que les impulsions ... à vérifier
289  return kTRUE;
290 
291  default:
292  return kFALSE;
293  }
294 
295 
296 
297 }
298 
299 
303 
305 {
306  // ROOT file called: HIPSE_[PROJ]_[TARG]_[EBEAM]AMeV.root
307  // Call after reading file header
308 
309  SetROOTFileName(Form("HIPSE_%s_%s_%.1fAMeV.root",
311 }
312 
313 
314 
315 
317 
319 {
320  if (!OpenFileToRead(filename)) return;
321  if (!ReadHeader()) return;
323  tree_title.Form("HIPSE primary events %s + %s %.1f MeV/nuc.",
325  Run();
326  CloseFile();
327 }
328 
329 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
const Bool_t kFALSE
bool Bool_t
const Bool_t kTRUE
char * Form(const char *fmt,...)
virtual void SetNumber(UInt_t num)
Definition: KVBase.h:215
KVNameValueList * GetParameters() const
Definition: KVEvent.h:203
void Clear(Option_t *opt="")
Clear object properties : name, type/title, number, label.
Definition: KVEvent.h:262
@ 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:278
void CloseFile()
Definition: KVFileReader.h:236
Double_t GetDoubleReadPar(Int_t pos) const
Definition: KVFileReader.h:333
Int_t GetIntReadPar(Int_t pos) const
Definition: KVFileReader.h:337
Bool_t IsOK()
Definition: KVFileReader.h:230
KVString GetReadPar(Int_t pos) const
Definition: KVFileReader.h:341
Bool_t OpenFileToRead(const KVString &filename)
Definition: KVFileReader.h:209
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:81
void SetExcitEnergy(Double_t e)
Definition: KVNucleus.cpp:865
Int_t GetA() const
Definition: KVNucleus.cpp:799
void SetA(Int_t a)
Definition: KVNucleus.cpp:655
void SetZ(Int_t z, Char_t mt=-1)
Definition: KVNucleus.cpp:704
void SetZandA(Int_t z, Int_t a)
Set atomic number and mass number.
Definition: KVNucleus.cpp:721
KVNameValueList * GetParameters() const
Definition: KVParticle.h:816
void SetMomentum(const TVector3 &v)
Definition: KVParticle.h:576
Nucleus in a simulated event.
Definition: KVSimNucleus.h:31
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.
virtual void define_output_filename()
KVSimReader_HIPSE()
Default constructor.
void ConvertEventsInFile(KVString filename)
Method called by constructors with KVString filename argument.
Int_t nevt
Definition: KVSimReader.h:68
KVString tree_title
Definition: KVSimReader.h:69
void Run(Option_t *option="recreate")
void SetROOTFileName(const Char_t *n)
Definition: KVSimReader.h:172
KVSimNucleus * nuc
Definition: KVSimReader.h:66
virtual Bool_t HasToFill()
Definition: KVSimReader.h:133
virtual void FillTree()
Definition: KVSimReader.h:129
void AddObject(TObject *obj)
KVSimEvent * evt
Definition: KVSimReader.h:65
void AddInfo(const Char_t *name, const Char_t *val)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
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
Double_t Atof() const
void Form(const char *fmt,...)
const long double mm
Definition: KVUnits.h:69