KaliVeda
Toolkit for HIC analysis
Loading...
Searching...
No Matches
KVTestEvent.cpp
1#include <iostream>
2#include <string>
3#include <TMath.h>
4#include <TRandom3.h>
5#include "KVTestEvent.h"
6#include "KVNucleus.h"
7
8using std::cout;
9using std::cerr;
10using std::endl;
11
13
14
15
18
20{
21 //Default constructor
22
23 init();
24}
25
26
27
30
32{
33 //Default initialisations
34
37 fUpper_Limit_theta = 180.;
38 fUpper_Limit_phi = 360.;
41 fLower_Limit_E = 0.;
42 fUpper_Limit_E = 0.;
43 fGenMult = 0;
44 kAMeV = kFALSE;
45 strcpy(fOption, "");
46}
47
48
49
57
59{
60 //Constructor with arguments
61 //
62 //mult = multiplicity of event
63 //Option string can be
64 // "isotropic": particle directions generated isotropically (1/sin Theta law)
65 // "random": particle directions generated equiprobably
66
67 init();
68 fGenMult = mult;
69 strcpy(fOption, t);
70}
71
72
73
75
79
80
81
86
88{
89//
90//Set range in Z of nuclei
91//
92 fLower_Limit_Z = zlo;
93 fUpper_Limit_Z = zhi;
94}
95
96
97
102
104{
105//
106//Set range in kinetic energy of nuclei (MeV)
107//
108 fLower_Limit_E = elo;
109 fUpper_Limit_E = ehi;
110 kAMeV = kFALSE;
111}
112
113
114
119
121{
122//
123//Set range in kinetic energy of nuclei (MeV/nucleon)
124//
125 fLower_Limit_E = elo;
126 fUpper_Limit_E = ehi;
127 kAMeV = kTRUE;
128}
129
130
131
136
138{
139//
140//Set polar angular range for nuclei
141//
142 fLower_Limit_theta = thmin;
143 fUpper_Limit_theta = thmax;
144}
145
146
147
152
154{
155//
156//Set azimuthal angular range for nuclei
157//
158 fLower_Limit_phi = phmin;
159 fUpper_Limit_phi = phmax;
160}
161
162
163
171
173{
174//
175//Generate an event based on given parameters.
176//Before using, at least set multiplicity (using constructor with arguments or
177//KVTestEvent::SetMult), range in Z (KVTestEvent::SetZRange) and range
178//in energy (KVTestEvent::SetERange or KVTestEvent::SetERangeAMeV).
179//
180
181 for (UInt_t i = 1; i <= fGenMult; i++) {
182 UInt_t z =
185 Float_t ke =
188 KVNucleus* kvn = AddParticle();
189 kvn->SetZ(z);
190 if (kAMeV)
191 ke *= kvn->GetA();
194 }
195}
196
197
198
203
205{
206//
207//Print out list of all particles in event
208//
209 cout << "\nKVTestEvent with " << GetMult() << " nuclei:" << endl;
210 cout << "----------------------------------------" << endl;
211 cout << "Zmin=" << fLower_Limit_Z << " Zmax=" << fUpper_Limit_Z << endl;
212 cout << "Emin=" << fLower_Limit_E << " Emax=" << fUpper_Limit_E;
213 if (kAMeV)
214 cout << " (MeV/nucleon)" << endl;
215 else
216 cout << " (MeV)" << endl;
217 cout << "Thetamin=" << fLower_Limit_theta << " Thetamax=" <<
218 fUpper_Limit_theta << endl;
219 cout << "Phimin=" << fLower_Limit_phi << " Phimax=" << fUpper_Limit_phi
220 << endl;
221 cout << "----------------------------------------" << endl;
222#ifdef WITH_CPP11
223 for (auto& n : *this) n.Print();
224#else
225 for (KVEvent::Iterator it = begin(); it != end(); ++it)(*it).Print();
226#endif
227}
228
229
unsigned int UInt_t
float Float_t
constexpr Bool_t kFALSE
constexpr Bool_t kTRUE
const char Option_t
R__EXTERN TRandom * gRandom
Description of properties and kinematics of atomic nuclei.
Definition KVNucleus.h:126
Int_t GetA() const
void SetZ(Int_t z, Char_t mt=-1)
void SetRandomMomentum(Double_t T, Double_t thmin, Double_t thmax, Double_t phmin, Double_t phmax, Option_t *opt="isotropic")
Container class for simulated nuclei, KVSimNucleus.
Definition KVSimEvent.h:22
virtual Int_t GetMult(Option_t *opt="") const
A simple event generator for testing charged particle array response.
Definition KVTestEvent.h:57
void SetThetaRange(Float_t thmin, Float_t thmax)
UInt_t fGenMult
multiplicity of nuclei to generate
Definition KVTestEvent.h:69
void SetZRange(UInt_t zlo, UInt_t zhi)
Char_t fOption[12]
[12] option string
Definition KVTestEvent.h:68
Float_t fUpper_Limit_E
max E of nuclei
Definition KVTestEvent.h:61
void SetPhiRange(Float_t phmin, Float_t phmax)
void init()
Default initialisations.
Float_t fLower_Limit_phi
min phi of nuclei
Definition KVTestEvent.h:67
virtual ~KVTestEvent()
Float_t fUpper_Limit_phi
max phi of nuclei
Definition KVTestEvent.h:66
Float_t fUpper_Limit_theta
max theta of nuclei
Definition KVTestEvent.h:64
UInt_t fLower_Limit_Z
min Z of nuclei
Definition KVTestEvent.h:60
virtual void Print(Option_t *t="") const
Float_t fLower_Limit_theta
min theta of nuclei
Definition KVTestEvent.h:65
Bool_t kAMeV
true if E limits are in MeV/nucleon
Definition KVTestEvent.h:63
void SetERange(Float_t elo, Float_t ehi)
KVTestEvent()
Default constructor.
UInt_t fUpper_Limit_Z
max Z of nuclei
Definition KVTestEvent.h:59
Float_t fLower_Limit_E
min E of nuclei
Definition KVTestEvent.h:62
void SetERangeAMeV(Float_t elo, Float_t ehi)
virtual Double_t Uniform(Double_t x1, Double_t x2)
virtual UInt_t Integer(UInt_t imax)
const Int_t n
ClassImp(TPyArg)