KaliVeda  1.12/06
Heavy-Ion Analysis Toolkit
KVSimReader_DIT.cpp
Go to the documentation of this file.
1 //Created by KVClassFactory on Fri Sep 11 23:31:56 2020
2 //Author: henri
3 
4 #include "KVSimReader_DIT.h"
5 
7 
8 // BEGIN_HTML <!--
10 /* -->
11 <h2>KVSimReader_DIT</h2>
12 <h4></h4>
13 <!-- */
14 // --> END_HTML
16 
17 
18 
21 {
22  projectile = proj;
23  target = targ;
24  energy = ener;
25  //
26  InitReader();
27  ConvertEventsInFile(filename);
28  SaveTree();
29 }
30 
31 
32 
33 
36 
38 {
39  // Destructor
40 }
41 
42 
43 
44 
46 
48 {
49  if (!OpenFileToRead(filename)) return;
50 
51  SkipFirstLine();
52  Run();
53  CloseFile();
54 }
55 
56 
57 
58 
60 
62 {
63  while (IsOK()) {
64  while (ReadEvent()) {
65  if ((nevt % 10000) == 0) Info("ReadFile", "%d events read", nevt);
66  if (HasToFill()) FillTree();
67  }
68  }
69 }
70 
71 
72 
73 
75 
77 {
78  evt->Clear();
79  //
80  Int_t res = ReadLineAndCheck(21, " ");
81 
82  switch (res) {
83  case 0 :
84  Info("ReadEvent", "Line is empty");
85  return kFALSE;
86 
87  case 1 :
88  evt->SetNumber(nevt);
90  FillEvent();
91  break;
92 
93  default :
94  return kFALSE;
95  }
96 
97  nevt++;
98 
99  return kTRUE;
100 }
101 
102 
103 
104 
106 
108 {
112  itype = GetIntReadPar(3);
127  k_n = GetIntReadPar(18);
128  k_p = GetIntReadPar(19);
129  min_dist = GetIntReadPar(20);
130 }
131 
132 
133 
134 
137 
139 {
140  // Fill projectile-like nucleus
141  nuc = static_cast<KVSimNucleus*>(evt->AddParticle());
142 
146 
147  if (itype == DITCollOk) {
148  if (theta_proj_like < 0.) {
149  nuc->SetPhi(270.);
150  }
151  else {
152  nuc->SetPhi(90.);
153  }
154  }
155  else {
156  nuc->SetPhi(0.);
157  }
158 
160  nuc->SetSpin(spin_proj_like, 0., 0.); // Spin component given by the model is normal to the reaction plane, this last being (YZ), thus the spin is on the X-axis
161  //
162  // Fill target-like nucleus if it exists (meaning he itype code is 0, a DIC event and not a fusion
163  if (itype == DITCollOk) {
164  nuc = static_cast<KVSimNucleus*>(evt->AddParticle());
165 
169 
170  if (theta_targ_like < 0.) {
171  nuc->SetPhi(270.);
172  }
173  else {
174  nuc->SetPhi(90.);
175  }
176 
178  nuc->SetSpin(spin_targ_like, 0., 0.); // Spin component given by the model is normal to the reaction plane, this last being (YZ), thus the spin is on the X-axis
179  }
180  //
181  // Add parameters to event
182  evt->SetParameter("weight", weight);
183  evt->SetParameter("inicident_partial_wave", inicident_partial_wave);
184  evt->SetParameter("impact_parameter", impact_parameter);
185  evt->SetParameter("itype", itype);
186  evt->SetParameter("theta_cm", theta_cm);
187  evt->SetParameter("q_reaction", q_reaction);
188  evt->SetParameter("k_n", k_n);
189  evt->SetParameter("k_p", k_p);
190  evt->SetParameter("min_dist", min_dist);
191 }
192 
193 
194 
195 
197 
199 {
200  tree_name = "DIT";
201  tree_title = "dit_events";
202  branch_name = "DITKVSimEvents";
203  root_file_name = Form("DIT_%s+%s@%.1fMeV.root", projectile.Data(), target.Data(), energy);
204 }
205 
206 
207 
208 
214 
216 {
217  //
218  // Skip first line of the file events.dat, which should be :
219  // WEIGHT/F:ANGM0:IMPAR:ITYPE/I:A[2]:Z[2]:EX[2]/F:SPIN[2]:ELAB[2]:THETA[2]:THCM:Q:KN/I:KP:SMIN/F
220  //
221  ReadLine(0);
222  Info("SkipFirstLine", "Skipping firt line of simulated data file!");
223 }
224 
225 
226 //____________________________________________________________________________//
227 
int Int_t
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
static Double_t energy[]
const Bool_t kFALSE
bool Bool_t
double Double_t
const Bool_t kTRUE
char * Form(const char *fmt,...)
virtual void SetNumber(UInt_t num)
Definition: KVBase.h:209
virtual void Clear(Option_t *opt="")
Definition: KVEvent.cpp:200
KVNucleus * AddParticle()
Definition: KVEvent.cpp:166
void SetParameter(const Char_t *name, ValType value) const
Definition: KVEvent.h:484
Int_t ReadLineAndCheck(Int_t nexpect, const Char_t *pattern)
Definition: KVFileReader.h:100
void CloseFile()
Definition: KVFileReader.h:79
Bool_t OpenFileToRead(KVString filename)
Definition: KVFileReader.h:59
void ReadLine(const Char_t *pattern)
Definition: KVFileReader.h:84
Double_t GetDoubleReadPar(Int_t pos)
Definition: KVFileReader.h:159
Bool_t IsOK()
Definition: KVFileReader.h:74
Int_t GetIntReadPar(Int_t pos)
Definition: KVFileReader.h:163
void SetExcitEnergy(Double_t e)
Definition: KVNucleus.cpp:865
void SetZandA(Int_t z, Int_t a)
Set atomic number and mass number.
Definition: KVNucleus.cpp:721
void SetTheta(Double_t theta)
Definition: KVParticle.h:654
void SetPhi(Double_t phi)
Definition: KVParticle.h:658
void SetE(Double_t a)
Definition: KVParticle.h:555
Nucleus in a simulated event.
Definition: KVSimNucleus.h:20
void SetSpin(Double_t x, Double_t y, Double_t z)
Definition: KVSimNucleus.h:88
Double_t impact_parameter
Impact parameter of the collision.
void FillEvent()
Fill projectile-like nucleus.
Double_t energy
Projectile energy in MeV/A.
Int_t itype
Collision type.
Double_t theta_targ_like
Target like theta scattering angle in the laboratory frame in degrees.
Double_t energy_targ_like
Target like energy in the laboratory frame in MeV.
Int_t z_proj_like
Projectile like charge number.
Double_t spin_targ_like
Target like spin in hbar (only components normal to the reaction plane)
Int_t k_p
Number of protons exchanged.
Double_t excitation_energy_proj_like
Projectile like excitation energy (thermal + rotational) in MeV.
virtual ~KVSimReader_DIT()
Destructor.
Int_t z_targ_like
Target like charge number.
KVString projectile
Projectile of the collision in the format '58Ni'.
void ConvertEventsInFile(KVString)
Method called by constructors with KVString filename argument.
Double_t min_dist
Minimal distance of approach(fm) between nuclear surfaces.
Int_t k_n
Number of neutrons exchanged.
Double_t theta_proj_like
Projectile like theta scattering angle in the laboratory frame in degrees.
Double_t spin_proj_like
Projectile like spin in hbar (only components normal to the reaction plane)
Double_t weight
Weight (?) of the collision.
Double_t theta_cm
Center of mass theta scattering angle in degrees.
Int_t a_targ_like
Target like mass number.
KVString target
Projectile of the collision in the format '64Ni'.
Int_t a_proj_like
Projectile like mass number.
Double_t excitation_energy_targ_like
Target like excitation energy (thermal + rotational) in MeV.
Double_t inicident_partial_wave
Incident partial wave in hbar (to determine the impact parameter) in the center of mass.
Double_t energy_proj_like
Projectile like energy in the laboratory frame in MeV.
Double_t q_reaction
Reaction Q value in MeV.
Base class to read output files for simulation and create tree using KVSimEvent class.
Definition: KVSimReader.h:57
KVString root_file_name
Definition: KVSimReader.h:69
Int_t nevt
Definition: KVSimReader.h:68
KVString tree_name
Definition: KVSimReader.h:69
KVString tree_title
Definition: KVSimReader.h:69
void Run(Option_t *option="recreate")
KVString branch_name
Definition: KVSimReader.h:69
KVSimNucleus * nuc
Definition: KVSimReader.h:66
virtual Bool_t HasToFill()
Definition: KVSimReader.h:133
virtual void FillTree()
Definition: KVSimReader.h:129
KVSimEvent * evt
Definition: KVSimReader.h:65
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
Definition: KVString.h:72
virtual void Info(const char *method, const char *msgfmt,...) const
const char * Data() const
Double_t Abs(Double_t d)