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 
12 void KVSimReader_HIPSE::define_output_filename()
13 {
14  SetROOTFileName(Form("HIPSE_%s_%s_%.1fAMeV",
15  proj.GetSymbol(), targ.GetSymbol(), ebeam));
16  SetTreeTitle(Form("HIPSE primary events %s + %s %.1f MeV/nuc.",
17  proj.GetSymbol(), targ.GetSymbol(), ebeam));
18 }
19 
20 
21 
24 
26 {
27  // Default constructor
28  init();
29 }
30 
31 
32 
34 
36 {
37  init();
39 }
40 
41 
42 
45 
47 {
48 
49  // create histogram for impact parameter distribution
50  h1 = new TH1F("impact_parameter", "distri", 200, 0, 20);
51  AddObject(h1);
52  h1->SetDirectory(nullptr);//avoid double deletion on ROOT file close
53 
54  auto res = ReadLineAndCheck(2, " ");
55  switch (res) {
57  return kFALSE;
59  AddInfo({"Aproj", GetIntReadPar(0)});
60  AddInfo({"Zproj", GetIntReadPar(1)});
61  proj.SetZandA(GetReadPar(1).Atoi(), GetReadPar(0).Atoi());
62  break;
63  default:
64  return kFALSE;
65  }
66 
67  res = ReadLineAndCheck(2, " ");
68  switch (res) {
70  return kFALSE;
72  AddInfo({"Atarg", GetIntReadPar(0)});
73  AddInfo({"Ztarg", GetIntReadPar(1)});
74  targ.SetZandA(GetReadPar(1).Atoi(), GetReadPar(0).Atoi());
75  break;
76  default:
77  return kFALSE;
78  }
79 
80  res = ReadLineAndCheck(1, " ");
81  switch (res) {
83  return kFALSE;
85  AddInfo({"Ebeam", GetDoubleReadPar(0)});
86  ebeam = GetDoubleReadPar(0);
87  break;
88  default:
89  return kFALSE;
90  }
91 
92  define_output_filename();
93 
94  KVError::Info(this, "ReadFileHeader", "Reading %s", GetTreeTitle().Data());
95 
96  return kTRUE;
97 }
98 
99 
100 
102 
104 {
105 
106  mult = 0, mtotal = 0;
107 
108  /*---------------------------------------------
109  mul_vrai = multiplicity of charged particles
110  mult = total multiplicity (i.e. including neutrons)
111  //---------------------------------------------
112  */
113  auto res = ReadLineAndCheck(2, " ");
114  switch (res) {
116  Info("ReadEvent", "case 0 line est vide");
117  return kFALSE;
119  mult = GetIntReadPar(0); //mul_vrai
120  mtotal = GetIntReadPar(1);
121  evt->GetParameters()->SetValue("mult", mtotal);
122  break;
123  default:
124  return kFALSE;
125  }
126 
127  /*---------------------------------------------
128  Esa = excitation per nucleon
129  vcm = center of mass energy
130  Bparstore = impact parameter
131  //---------------------------------------------
132  */
133  res = ReadLineAndCheck(3, " ");
134  switch (res) {
136  return kFALSE;
138  evt->GetParameters()->SetValue("Esa", GetDoubleReadPar(0));
139  evt->GetParameters()->SetValue("vcm", GetDoubleReadPar(1));
140  evt->GetParameters()->SetValue("Bparstore", GetDoubleReadPar(2));
141  h1->Fill(evt->GetParameters()->GetDoubleValue("Bparstore"));
142  break;
143  default:
144  return kFALSE;
145  }
146 
147  /*---------------------------------------------
148  energetic information
149  excitat : total excitation energy
150  xmassav : Q-value
151  ekinav : total kinetic energy at freeze-out
152  epotav : total potential energy at freeze-out
153  erotav : total rotational energy at freeze-out
154  //---------------------------------------------
155  */
156  res = ReadLineAndCheck(2, " ");
157  switch (res) {
159  return kFALSE;
161  evt->GetParameters()->SetValue("excitat", GetDoubleReadPar(0));
162  evt->GetParameters()->SetValue("xmassav", GetDoubleReadPar(1));
163  break;
164  default:
165  return kFALSE;
166  }
167 
168  res = ReadLineAndCheck(3, " ");
169  switch (res) {
171  return kFALSE;
173  evt->GetParameters()->SetValue("ekinav", GetDoubleReadPar(0));
174  evt->GetParameters()->SetValue("epotav", GetDoubleReadPar(1));
175  evt->GetParameters()->SetValue("erotav", GetDoubleReadPar(2));
176  break;
177 
178  default:
179  return kFALSE;
180  }
181  return kTRUE;
182 }
183 
184 
185 
187 
189 {
190  evt->SetNumber(GetEventNumber());
191  for (Int_t mm = 0; mm < mult; mm += 1) {
192  auto nuc = evt->AddParticle();
193  if (!ReadNucleus(nuc)) return kFALSE;
194  }
195 
196  return kTRUE;
197 }
198 
199 
200 
202 
204 {
205 
206  auto res = ReadLineAndCheck(3, " ");
207  switch (res) {
209  Info("ReadNucleus", "case 0 line est vide");
210  return kFALSE;
211 
213  /*
214  proven = 0 -> fusion of the QP and QT
215  proven = 1 -> QP
216  proven = 2 -> QT
217  proven > 2 -> other
218  */
219  nuc->SetZ(GetIntReadPar(1));
220  nuc->SetA(GetIntReadPar(0));
221  nuc->GetParameters()->SetValue("proven", GetDoubleReadPar(2));
222  break;
223 
224  default:
225  return kFALSE;
226  }
227 
228  res = ReadLineAndCheck(3, " ");
229  switch (res) {
231  Info("ReadNucleus", "case 0 line est vide");
232  return kFALSE;
233 
235  //Axe "faisceau dans HIPSE x -> on effectue une rotation X,Y,Z -> Y,Z,X"
237  break;
238 
239  default:
240  return kFALSE;
241  }
242 
243  int AA = nuc->GetA();
244 
245  /*---------------------------------------------------------
246  exci(I) : excitation energy
247  ether(I) : not used
248  spinx(i),spiny(i),spinz(i) : angular momentum (hbar units)
249  //---------------------------------------------
250  */
251  res = ReadLineAndCheck(2, " ");
252  switch (res) {
254  Info("ReadNucleus", "case 0 line est vide");
255  return kFALSE;
256 
258  nuc->SetExcitEnergy(GetDoubleReadPar(0)*AA);
259  nuc->GetParameters()->SetValue("exci", GetDoubleReadPar(0));
260  nuc->GetParameters()->SetValue("ether", GetDoubleReadPar(1));
261  break;
262 
263  default:
264  return kFALSE;
265  }
266 
267  res = ReadLineAndCheck(3, " ");
268  switch (res) {
270  Info("ReadNucleus", "case 0 line est vide");
271  return kFALSE;
272 
274  //On effectue la meme rotation que les impulsions ... à vérifier
276  break;
277 
278  default:
279  return kFALSE;
280  }
281 
282  return kTRUE;
283 }
284 
285 
286 
291 
293 {
294  // Clear the impact parameter histogram when starting a new output file.
295  //
296  // This way the distribution in the histogram only concerns the events in the current file.
297 
298  h1->Reset();
299 }
300 
301 
302 
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:224
KVNameValueList * GetParameters() const
Definition: KVEvent.h:180
@ 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
Double_t GetDoubleReadPar(Int_t pos) const
Definition: KVFileReader.h:334
Int_t GetIntReadPar(Int_t pos) const
Definition: KVFileReader.h:338
KVString GetReadPar(Int_t pos) const
Definition: KVFileReader.h:342
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:43
void SetExcitEnergy(Double_t e)
Definition: KVNucleus.cpp:867
Int_t GetA() const
Definition: KVNucleus.cpp:805
void SetA(Int_t a)
Definition: KVNucleus.cpp:658
void SetZ(Int_t z, Char_t mt=-1)
Definition: KVNucleus.cpp:709
void SetZandA(Int_t z, Int_t a)
Set atomic number and mass number.
Definition: KVNucleus.cpp:726
KVNameValueList * GetParameters() const
Definition: KVParticle.h:818
void SetMomentum(const TVector3 &v)
Definition: KVParticle.h:581
Container class for simulated nuclei, KVSimNucleus.
Definition: KVSimEvent.h:22
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
Converts primary HiPSE events, after clusterization but before secondary decay.
Bool_t ReadEventHeader(KVSimEvent *) override
Bool_t ReadEvent(KVSimEvent *) override
Bool_t ReadFileHeader() override
create histogram for impact parameter distribution
Bool_t ReadNucleus(KVSimNucleus *) override
void NotifyChangeOfOutputFile() override
KVSimReader_HIPSE()
Default constructor.
void SetROOTFileName(KVString name)
Definition: KVSimReader.h:247
KVString GetTreeTitle() const
Definition: KVSimReader.h:242
void SetTreeTitle(KVString n)
Definition: KVSimReader.h:237
void ConvertEventsInFile(KVString filename)
Definition: KVSimReader.cpp:24
int GetEventNumber() const
Definition: KVSimReader.h:190
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:73
Particle * AddParticle()
void Reset(Option_t *option="") override
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 Info(UserClass p, const char *location, const char *va_(fmt),...)
Definition: KVError.h:134
ClassImp(TPyArg)