KaliVeda  1.13/01
Heavy-Ion Analysis Toolkit
KVSimReader_ELIE2023.cpp
Go to the documentation of this file.
1 #include "KVSimReader_ELIE2023.h"
2 
3 
4 
5 
24 
26 {
27  // File header no longer contains all info on simulation, this can be found in accompanying '.input' file
28  //
29  // File header now looks like:
30  //~~~~
31  //zproj aproj zcibl acibl ebeam number_of_events run_number
32  //~~~~
33  //
34  // while '.input' file contains
35  //~~~~
36  //alevel=7.87
37  //entropy_max=1.25
38  //g_al=1.
39  //thermal=1
40  //fermi_gas=1
41  //geometry=1
42  // ...
43  //~~~~
44 
45  auto res = ReadLineAndCheck(7, " ");
46  switch (res) {
48  Info("ReadHeader", "Can't read file header infos");
49  return kFALSE;
51  AddInfo("Aproj", GetReadPar(1));
52  AddInfo("Zproj", GetReadPar(0));
53  AddInfo("Atarg", GetReadPar(3));
54  AddInfo("Ztarg", GetReadPar(2));
55  AddInfo("Ebeam", GetReadPar(4));
56  AddInfo("Nevents", GetReadPar(5));
57  AddInfo("RunNumber", GetReadPar(6));
61  break;
62  default:
63  Info("ReadHeader", "res=%d", (int)res);
64  return kFALSE;
65  }
66 
67  // derive '.input' file name from name of file being read
68  auto input_file = GetFileName();
69  auto suff_ind = input_file.Index("_primary.output");
70  if (suff_ind < 0) suff_ind = input_file.Index("_secondary.output");
71  if (suff_ind < 0) {
72  Warning("ReadHeader", "Cannot deduce name of '.input' file from filename:%s", input_file.Data());
73  Warning("ReadHeader", "Informations on input parameters of calculation will not be read/kept");
74  return kFALSE;
75  }
76  input_file.Remove(suff_ind);
77  input_file.Append(".input");
78 
79  // open '.input' file and read infos
80  KVFileReader input_file_reader("#");// comments start with '#' in file
81  if (!input_file_reader.OpenFileToRead(input_file)) {
82  Warning("ReadHeader", "Failed to open file %s", input_file.Data());
83  Warning("ReadHeader", "Informations on input parameters of calculation will not be read/kept");
84  return kFALSE;
85  }
86 
87  read_elie_params(input_file_reader);
88 
89  return kTRUE;
90 }
91 
92 
93 
101 
103 {
104  // New event header structure is:
105  //~~~~
106  //event_number multiplicity b_reduit reduced_density tempe_part tempe_qp tempe_qt sigma* pauli_factor
107  //~~~~
108  //
109  // These are the names used for the event parameters
110 
111  evt->Clear();
112 
113  auto res = ReadLineAndCheck(9, " ");
114  Int_t mult = 0;
115  switch (res) {
118  return kFALSE;
121  mult = GetIntReadPar(1);
122  evt->GetParameters()->SetValue("bred", GetDoubleReadPar(2));
123  evt->GetParameters()->SetValue("mult", mult);
124  evt->GetParameters()->SetValue("reduced_density", GetDoubleReadPar(3));
125  evt->GetParameters()->SetValue("tempe_part", GetDoubleReadPar(4));
126  evt->GetParameters()->SetValue("tempe_qp", GetDoubleReadPar(5));
127  evt->GetParameters()->SetValue("tempe_qt", GetDoubleReadPar(6));
128  evt->GetParameters()->SetValue("sigma*", GetDoubleReadPar(7));
129  evt->GetParameters()->SetValue("pauli_factor", GetDoubleReadPar(8));
130  break;
131 
132  default:
133  return kFALSE;
134  }
135  for (Int_t mm = 0; mm < mult; mm++) {
137  if (!ReadNucleus()) return kFALSE;
138  }
139  nevt++;
140 
141  // if in lab, transform to CM frame
142  if (elie_params->GetIntValue("lab_frame") > 0) transform_to_cm();
143  else evt->SetFrameName("CM");
144 
145  return kTRUE;
146 }
147 
148 
149 
159 
161 {
162  // New particle structure is:
163  //~~~~
164  //particule_number z_part a_part teta_part phi_part e_part exci_part origine_part
165  //~~~~
166  //
167  //
168  // The origin of secondary decay particles is stored in a parameter named "ORIGIN"
169  // As particles in a KVEvent are numbered 1,2,... we add 1 to the value read in
170 
171  auto res = ReadLineAndCheck(8, " ");
172  switch (res) {
174  Info("ReadNucleus", "premature end of file?");
175  return kFALSE;
177  Info("ReadNucleus", "case 0 line est vide");
178  return kFALSE;
179 
181  nuc->SetZ(GetIntReadPar(1));
182  nuc->SetA(GetIntReadPar(2));
187  nuc->SetParameter("ORIGIN", GetIntReadPar(7) + 1);
188  return kTRUE;
189  break;
190 
191  default:
192  return kFALSE;
193  }
194 
195  return kFALSE;
196 }
197 
198 
200 
201 
202 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
const Bool_t kFALSE
bool Bool_t
const Bool_t kTRUE
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
Handle reading columns of numeric data in text files.
Definition: KVFileReader.h:119
KVString GetFileName()
Definition: KVFileReader.h:189
@ EndOfFile
end of file reached
@ 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
Double_t GetDoubleReadPar(Int_t pos) const
Definition: KVFileReader.h:333
Int_t GetIntReadPar(Int_t pos) const
Definition: KVFileReader.h:337
KVString GetReadPar(Int_t pos) const
Definition: KVFileReader.h:341
Bool_t OpenFileToRead(const KVString &filename)
Definition: KVFileReader.h:209
Int_t GetIntValue(const Char_t *name) const
void SetValue(const Char_t *name, value_type value)
void SetExcitEnergy(Double_t e)
Definition: KVNucleus.cpp:865
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
void SetZAandE(Int_t z, Int_t a, Double_t ekin)
Set atomic number, mass number, and kinetic energy in MeV.
Definition: KVNucleus.cpp:733
void SetTheta(Double_t theta)
Definition: KVParticle.h:695
void SetPhi(Double_t phi)
Definition: KVParticle.h:699
void SetParameter(const Char_t *name, ValType value) const
Definition: KVParticle.h:820
void SetEnergy(Double_t e)
Definition: KVParticle.h:601
Nucleus in a simulated event.
Definition: KVSimNucleus.h:31
Read ASCII files generated by ELIE (new format 2022)
void read_elie_params(KVFileReader &input_file_reader)
KVNameValueList * elie_params
void transform_to_cm()
transform all particle kinematics to CM frame from lab
Int_t nevt
Definition: KVSimReader.h:68
KVSimNucleus * nuc
Definition: KVSimReader.h:66
KVSimEvent * evt
Definition: KVSimReader.h:65
void AddInfo(const Char_t *name, const Char_t *val)
void SetFrameName(const KVString &name)
Particle * AddParticle()
virtual void Warning(const char *method, const char *msgfmt,...) const
virtual void Info(const char *method, const char *msgfmt,...) const
const long double mm
Definition: KVUnits.h:69