KaliVeda
Toolkit for HIC analysis
KVSimReader_ELIE2023.cpp
1 #include "KVSimReader_ELIE2023.h"
2 
3 
22 
24 {
25  // File header no longer contains all info on simulation, this can be found in accompanying '.input' file
26  //
27  // File header now looks like:
28  //~~~~
29  //zproj aproj zcibl acibl ebeam number_of_events run_number
30  //~~~~
31  //
32  // while '.input' file contains
33  //~~~~
34  //alevel=7.87
35  //entropy_max=1.25
36  //g_al=1.
37  //thermal=1
38  //fermi_gas=1
39  //geometry=1
40  // ...
41  //~~~~
42 
43  auto res = ReadLineAndCheck(7, " ");
44  switch (res) {
46  Info("ReadHeader", "Can't read file header infos");
47  return kFALSE;
49  AddInfo({"Aproj", GetIntReadPar(1)});
50  AddInfo({"Zproj", GetIntReadPar(0)});
51  AddInfo({"Atarg", GetIntReadPar(3)});
52  AddInfo({"Ztarg", GetIntReadPar(2)});
53  AddInfo({"Ebeam", GetDoubleReadPar(4)});
54  AddInfo({"Nevents", GetIntReadPar(5)});
55  AddInfo({"RunNumber", GetIntReadPar(6)});
56  run_number = GetIntReadPar(6);
57  proj.SetZAandE(GetIntReadPar(0), GetIntReadPar(1), GetIntReadPar(1)*GetDoubleReadPar(4));
58  targ.SetZandA(GetIntReadPar(2), GetIntReadPar(3));
59  ebeam = GetDoubleReadPar(4);
60  break;
61  default:
62  Info("ReadHeader", "res=%d", (int)res);
63  return kFALSE;
64  }
65 
66  // derive '.input' file name from name of file being read
67  auto input_file = GetFileName();
68  auto suff_ind = input_file.Index("_primary.output");
69  if (suff_ind < 0) suff_ind = input_file.Index("_secondary.output");
70  if (suff_ind < 0) {
71  KVError::Warning(this, "ReadHeader", "Cannot deduce name of '.input' file from filename:%s", input_file.Data());
72  KVError::Warning(this, "ReadHeader", "Informations on input parameters of calculation will not be read/kept");
73  return kFALSE;
74  }
75  input_file.Remove(suff_ind);
76  input_file.Append(".input");
77 
78  // open '.input' file and read infos
79  KVFileReader input_file_reader("#");// comments start with '#' in file
80  if (!input_file_reader.OpenFileToRead(input_file)) {
81  KVError::Warning(this, "ReadHeader", "Failed to open file %s", input_file.Data());
82  KVError::Warning(this, "ReadHeader", "Informations on input parameters of calculation will not be read/kept");
83  return kFALSE;
84  }
85 
86  read_elie_params(input_file_reader);
87 
88  return kTRUE;
89 }
90 
91 
92 
100 
102 {
103  // New event header structure is:
104  //~~~~
105  //event_number multiplicity b_reduit reduced_density tempe_part tempe_qp tempe_qt sigma* pauli_factor
106  //~~~~
107  //
108  // These are the names used for the event parameters
109 
110  auto res = ReadLineAndCheck(9, " ");
111  mult = 0;
112  switch (res) {
115  return kFALSE;
117  evt->SetNumber(GetIntReadPar(0));
118  mult = GetIntReadPar(1);
119  evt->GetParameters()->SetValue("bred", GetDoubleReadPar(2));
120  evt->GetParameters()->SetValue("mult", mult);
121  evt->GetParameters()->SetValue("reduced_density", GetDoubleReadPar(3));
122  evt->GetParameters()->SetValue("tempe_part", GetDoubleReadPar(4));
123  evt->GetParameters()->SetValue("tempe_qp", GetDoubleReadPar(5));
124  evt->GetParameters()->SetValue("tempe_qt", GetDoubleReadPar(6));
125  evt->GetParameters()->SetValue("sigma*", GetDoubleReadPar(7));
126  evt->GetParameters()->SetValue("pauli_factor", GetDoubleReadPar(8));
127  return kTRUE;
128 
129  default:
130  return kFALSE;
131  }
132  return kFALSE;
133 }
134 
135 
136 
146 
148 {
149  // New particle structure is:
150  //~~~~
151  //particule_number z_part a_part teta_part phi_part e_part exci_part origine_part
152  //~~~~
153  //
154  //
155  // The origin of secondary decay particles is stored in a parameter named "ORIGIN"
156  // As particles in a KVEvent are numbered 1,2,... we add 1 to the value read in
157 
158  auto res = ReadLineAndCheck(8, " ");
159  switch (res) {
161  Info("ReadNucleus", "premature end of file?");
162  return kFALSE;
164  Info("ReadNucleus", "case 0 line est vide");
165  return kFALSE;
166 
168  nuc->SetZ(GetIntReadPar(1));
169  nuc->SetA(GetIntReadPar(2));
171  nuc->SetEnergy(GetDoubleReadPar(5));
172  nuc->SetTheta(GetDoubleReadPar(3));
173  nuc->SetPhi(GetDoubleReadPar(4));
174  nuc->SetParameter("ORIGIN", GetIntReadPar(7) + 1);
175  return kTRUE;
176  break;
177 
178  default:
179  return kFALSE;
180  }
181 
182  return kFALSE;
183 }
184 
185 
187 
188 
189 
bool Bool_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
virtual void SetNumber(UInt_t num)
Definition: KVBase.h:224
KVNameValueList * GetParameters() const
Definition: KVEvent.h:180
Handle reading columns of numeric data in text files.
Definition: KVFileReader.h:121
KVString GetFileName()
Definition: KVFileReader.h:190
@ 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:279
Double_t GetDoubleReadPar(Int_t pos) const
Definition: KVFileReader.h:334
Int_t GetIntReadPar(Int_t pos) const
Definition: KVFileReader.h:338
Bool_t OpenFileToRead(const KVString &filename)
Definition: KVFileReader.h:210
void SetValue(const Char_t *name, value_type value)
void SetExcitEnergy(Double_t e)
Definition: KVNucleus.cpp:867
void SetA(Int_t a)
Definition: KVNucleus.cpp:658
void SetZ(Int_t z, Char_t mt=-1)
Definition: KVNucleus.cpp:709
void SetTheta(Double_t theta)
Definition: KVParticle.h:696
void SetPhi(Double_t phi)
Definition: KVParticle.h:700
void SetParameter(const Char_t *name, ValType value) const
Definition: KVParticle.h:822
void SetEnergy(Double_t e)
Definition: KVParticle.h:602
Container class for simulated nuclei, KVSimNucleus.
Definition: KVSimEvent.h:22
Nucleus in a simulated event.
Definition: KVSimNucleus.h:32
Read ASCII files generated by ELIE (new format 2022)
Bool_t ReadFileHeader() override
Bool_t ReadEventHeader(KVSimEvent *) override
Bool_t ReadNucleus(KVSimNucleus *) override
virtual void Info(const char *method, const char *msgfmt,...) const
void Warning(UserClass p, const char *location, const char *va_(fmt),...)
Definition: KVError.h:125
ClassImp(TPyArg)