BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
UEvent.cxx
Go to the documentation of this file.
1
#include <iostream>
2
using namespace
std
;
3
4
#include "
TClonesArray.h
"
5
#include "
TObject.h
"
6
#include "
TString.h
"
7
#include "
UEvent.h
"
8
#include "
UParticle.h
"
9
10
//____________________________________________________________________
11
//
12
// UEvent
13
//
14
// Class for event description. Contains the particle array
15
//
16
17
//--------------------------------------------------------------------
18
UEvent::UEvent
()
19
{
20
// Default constructor
21
fEventNr
= 0;
22
fB
=
fPhi
= 0.;
23
fNes
= 1;
24
fStepNr
= 0;
25
fStepT
= 0.;
26
fNpa
= 0;
27
fComment
=
""
;
28
fName
=
"Unigen"
;
29
fParticles
=
new
TClonesArray
(
"UParticle"
, 100);
30
}
31
//--------------------------------------------------------------------
32
33
//--------------------------------------------------------------------
34
UEvent::UEvent
(
const
UEvent
& right)
35
{
36
// Copy constructor
37
fEventNr
= right.
fEventNr
;
38
fB
= right.
fB
;
39
fPhi
= right.
fPhi
;
40
fNes
= right.
fNes
;
41
fStepNr
= right.
fStepNr
;
42
fStepT
= right.
fStepT
;
43
fComment
= right.
fComment
;
44
fNpa
= right.
fNpa
;
45
fName
= right.
fName
;
46
fParticles
=
new
TClonesArray
(
"UParticle"
, 100);
47
UParticle
* p;
48
for
(
Int_t
i
= 0;
i
<
fNpa
;
i
++) {
49
p = (
UParticle
*)right.
fParticles
->
At
(
i
);
50
new
((*fParticles)[
i
])
UParticle
(*p);
51
}
52
}
53
//--------------------------------------------------------------------
54
55
//--------------------------------------------------------------------
56
UEvent::~UEvent
()
57
{
58
// Destructor
59
Clear
();
60
delete
fParticles
;
61
}
62
//--------------------------------------------------------------------
63
64
//--------------------------------------------------------------------
65
void
UEvent::Print
(
Option_t
* option)
66
{
67
// Print data members to the standard output
68
cout <<
"---------------------------------------------"
<< endl
69
<<
"-I- Event -I-"
<< endl
70
<<
"Event number : "
<<
fEventNr
<< endl
71
<<
"Impact parameter (fm) : "
<<
fB
<< endl
72
<<
"Reaction plane angle (rad) : "
<<
fPhi
<< endl
73
<<
"Number of time steps : "
<<
fNes
<< endl
74
<<
"Time step number : "
<<
fStepNr
<< endl
75
<<
"Time of the time step (fm) : "
<<
fStepT
<< endl
76
<<
"Number of particles : "
<<
fNpa
<< endl
77
<<
"Comment :\n"
78
<<
fComment
<< endl;
79
TString
opt = option;
80
if
(opt.
Contains
(
"all"
)) {
81
UParticle
* particle;
82
for
(
Int_t
iPa = 0; iPa <
fNpa
; iPa++) {
83
particle = (
UParticle
*)
fParticles
->At(iPa);
84
particle->
Print
(option);
85
}
86
}
87
cout <<
"---------------------------------------------"
<< endl;
88
}
89
//--------------------------------------------------------------------
90
91
//--------------------------------------------------------------------
92
UParticle
*
UEvent::GetParticle
(
Int_t
index)
const
93
{
94
// Get pointer to the particle.
95
// index - index of the particle
96
if
(index < 0) {
97
return
NULL;
98
}
99
if
(index >=
fNpa
) {
100
return
NULL;
101
}
102
return
((
UParticle
*)
fParticles
->At(index));
103
}
104
//--------------------------------------------------------------------
105
106
//--------------------------------------------------------------------
107
void
UEvent::AddParticle
(
Int_t
index,
108
Int_t
pdg,
109
Int_t
status,
110
Int_t
parent,
111
Int_t
parentDecay,
112
Int_t
mate,
113
Int_t
decay,
114
Int_t
child[2],
115
Double_t
px,
116
Double_t
py,
117
Double_t
pz,
118
Double_t
e,
119
Double_t
x,
120
Double_t
y,
121
Double_t
z,
122
Double_t
t,
123
Double_t
weight)
124
{
125
// Add particle to the array
126
new
((*fParticles)[
fNpa
])
127
UParticle
(index, pdg, status, parent, parentDecay, mate, decay, child, px, py, pz, e, x, y, z, t, weight);
128
fNpa
+= 1;
129
}
130
//--------------------------------------------------------------------
131
132
//--------------------------------------------------------------------
133
void
UEvent::AddParticle
(
Int_t
index,
134
Int_t
pdg,
135
Int_t
status,
136
Int_t
parent,
137
Int_t
parentDecay,
138
Int_t
mate,
139
Int_t
decay,
140
Int_t
child[2],
141
TLorentzVector
mom,
142
TLorentzVector
pos,
143
Double_t
weight)
144
{
145
// Add particle to the array
146
new
((*fParticles)[
fNpa
])
UParticle
(index, pdg, status, parent, parentDecay, mate, decay, child, mom, pos, weight);
147
fNpa
+= 1;
148
}
149
//--------------------------------------------------------------------
150
151
//--------------------------------------------------------------------
152
void
UEvent::AddParticle
(
const
UParticle
& particle)
153
{
154
// Add particle to the array
155
new
((*fParticles)[
fNpa
])
UParticle
(particle);
156
fNpa
+= 1;
157
}
158
//--------------------------------------------------------------------
159
UEvent
UEvent::operator=
(
const
UEvent
& right)
160
{
161
if
(
this
!= &right) {
162
fEventNr
= right.
fEventNr
;
163
fB
= right.
fB
;
164
fPhi
= right.
fPhi
;
165
fNes
= right.
fNes
;
166
fStepNr
= right.
fStepNr
;
167
fStepT
= right.
fStepT
;
168
fComment
= right.
fComment
;
169
fNpa
= right.
fNpa
;
170
fName
= right.
fName
;
171
fParticles
->Clear();
172
UParticle
* p;
173
for
(
Int_t
i
= 0;
i
<
fNpa
;
i
++) {
174
p = (
UParticle
*)right.
fParticles
->
At
(
i
);
175
new
((*fParticles)[
i
])
UParticle
(*p);
176
}
177
}
178
return
*
this
;
179
}
180
//--------------------------------------------------------------------
181
182
//--------------------------------------------------------------------
183
void
UEvent::SetParameters
(
Int_t
eventNr,
184
Double_t
b,
185
Double_t
phi,
186
Int_t
nes,
187
Int_t
stepNr,
188
Double_t
stepT,
189
const
char
* comment)
190
{
191
// Set the event parameters
192
fEventNr
= eventNr;
193
fB
= b;
194
fPhi
= phi;
195
fNes
= nes;
196
fStepNr
= stepNr;
197
fStepT
= stepT;
198
fComment
= comment;
199
}
200
//--------------------------------------------------------------------
201
202
//--------------------------------------------------------------------
203
void
UEvent::Clear
()
204
{
205
// Remove the particles from the array and reset counter
206
fParticles
->Clear();
207
fNpa
= 0;
208
}
209
210
//--------------------------------------------------------------------
211
212
//--------------------------------------------------------------------
213
void
UEvent::RemoveAt
(
Int_t
i
)
214
{
215
// Remove one particle from the array.
216
// i - index of the particle.
217
// Array is automaticaly compressed afterwards, mind the indexing
218
fParticles
->RemoveAt(
i
);
219
fParticles
->Compress();
220
}
221
//--------------------------------------------------------------------
i
int i
Definition
P4_F32vec4.h:22
Int_t
int Int_t
Double_t
double Double_t
Option_t
const char Option_t
TClonesArray.h
TObject.h
TString.h
TLorentzVector
TNamed::fName
TString fName
TObjArray::At
TObject * At(Int_t idx) const override
TObject::TClonesArray
friend friend class TClonesArray
TString
TString::Contains
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
UEvent::fB
Double_t fB
Impact parameter (fm).
Definition
UEvent.h:30
UEvent::fParticles
TClonesArray * fParticles
Array of particles.
Definition
UEvent.h:58
UEvent::fStepNr
Int_t fStepNr
Event step number.
Definition
UEvent.h:42
UEvent::fStepT
Double_t fStepT
Event step time.
Definition
UEvent.h:46
UEvent::Clear
void Clear()
clear this
Definition
UEvent.cxx:203
UEvent::AddParticle
void AddParticle(Int_t index, Int_t pdg, Int_t status, Int_t parent, Int_t parentDecay, Int_t mate, Int_t decay, Int_t child[2], Double_t px, Double_t py, Double_t pz, Double_t e, Double_t x, Double_t y, Double_t z, Double_t t, Double_t weight)
add particle
Definition
UEvent.cxx:107
UEvent::RemoveAt
void RemoveAt(Int_t i)
remove particle
Definition
UEvent.cxx:213
UEvent::~UEvent
virtual ~UEvent()
Definition
UEvent.cxx:56
UEvent::UEvent
UEvent()
default constructor
Definition
UEvent.cxx:18
UEvent::fComment
TString fComment
Generator-specific information.
Definition
UEvent.h:54
UEvent::fEventNr
Int_t fEventNr
Event number.
Definition
UEvent.h:26
UEvent::Print
void Print(Option_t *option="")
print info about event
Definition
UEvent.cxx:65
UEvent::operator=
UEvent operator=(const UEvent &right)
assignement operator
Definition
UEvent.cxx:159
UEvent::fNpa
Int_t fNpa
Number of particles.
Definition
UEvent.h:50
UEvent::fPhi
Double_t fPhi
Reaction plane angle.
Definition
UEvent.h:34
UEvent::GetParticle
UParticle * GetParticle(Int_t index) const
Definition
UEvent.cxx:92
UEvent::fNes
Int_t fNes
Number of event steps.
Definition
UEvent.h:38
UEvent::SetParameters
void SetParameters(Int_t eventNr, Double_t b, Double_t phi, Int_t nes, Int_t stepNr, Double_t stepT, const char *comment="")
set event parameters
Definition
UEvent.cxx:183
UParticle
unigen particle
Definition
UParticle.h:14
UParticle::Print
void Print(Option_t *option="")
print info about this particle
Definition
UParticle.cxx:202
UEvent.h
UParticle.h
std
Definition
json.hpp:4446
generators
unigen_format
UEvent.cxx
Generated on
for BmnRoot by
1.17.0