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