VMC Examples
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
examples
E03
E03d
include
Ex03dParticle.h
Go to the documentation of this file.
1
#ifndef EX03_PARTICLE_H
2
#define EX03_PARTICLE_H
3
4
//------------------------------------------------
5
// The Virtual Monte Carlo examples
6
// Copyright (C) 2014 - 2018 Ivana Hrivnacova
7
// All rights reserved.
8
//
9
// For the licensing terms see geant4_vmc/LICENSE.
10
// Contact: root-vmc@cern.ch
11
//-------------------------------------------------
12
13
/// \file Ex03dParticle.h
14
/// \brief Definition of the Ex03dParticle class
15
///
16
/// Simplified version of ROOT's TParticle to store in RNTuple
17
///
18
/// \author Radoslaw Karabowicz; GSI
19
20
#include "TLorentzVector.h"
21
22
/// \ingroup E03
23
/// \brief Replacement of the TParticle
24
///
25
/// A variant of the TParticle class
26
/// that can be stored in the RNTuple.
27
///
28
29
/// \date 07/07/2026
30
/// \author Radoslaw Karabowicz, GSI
31
32
class
Ex03dParticle
33
{
34
public
:
35
// ****** constructors and destructor
36
Ex03dParticle
();
37
38
Ex03dParticle
(Int_t pdg, Int_t status, Int_t mother1, Int_t mother2,
39
Int_t daughter1, Int_t daughter2, Double_t px, Double_t py, Double_t pz,
40
Double_t etot, Double_t vx, Double_t vy, Double_t vz, Double_t time);
41
42
Ex03dParticle
(Int_t pdg, Int_t status, Int_t mother1, Int_t mother2,
43
Int_t daughter1, Int_t daughter2,
const
TLorentzVector& p,
44
const
TLorentzVector& v);
45
46
Ex03dParticle
(
const
Ex03dParticle
& part);
47
48
~Ex03dParticle
();
49
50
// methods
51
Ex03dParticle
&
operator=
(
const
Ex03dParticle
&);
52
53
Double_t
Ek
()
const
{
return
fE
-
fCalcMass
; }
54
Int_t
GetStatusCode
()
const
{
return
fStatusCode
; }
55
Int_t
GetPdgCode
()
const
{
return
fPdgCode
; }
56
Int_t
GetFirstMother
()
const
{
return
fMother
[0]; }
57
Int_t
GetMother
(Int_t i)
const
{
return
fMother
[i]; }
58
Int_t
GetSecondMother
()
const
{
return
fMother
[1]; }
59
Bool_t
IsPrimary
()
const
60
{
61
return
fMother
[0] > -1 ? kFALSE : kTRUE;
62
}
// Is this particle primary one?
63
Int_t
GetFirstDaughter
()
const
{
return
fDaughter
[0]; }
64
Int_t
GetDaughter
(Int_t i)
const
{
return
fDaughter
[i]; }
65
Int_t
GetLastDaughter
()
const
{
return
fDaughter
[1]; }
66
Double_t
GetCalcMass
()
const
{
return
fCalcMass
; }
67
Double_t
GetMass
()
const
;
68
Int_t
GetNDaughters
()
const
69
{
70
return
fDaughter
[1] > 0 ?
fDaughter
[1] -
fDaughter
[0] + 1 : 0;
71
}
72
Float_t
GetWeight
()
const
{
return
fWeight
; }
73
void
GetPolarisation
(TVector3& v)
const
;
74
// TParticlePDG* GetPDG (Int_t mode = 0) const;
75
Int_t
Beauty
()
const
;
76
Int_t
Charm
()
const
;
77
Int_t
Strangeness
()
const
;
78
Double_t
PhiX
()
const
79
{
80
return
TMath::Pi() + TMath::ATan2(-
fPz
, -
fPy
);
81
}
// note that PhiX() returns an angle between 0 and 2pi
82
Double_t
PhiY
()
const
83
{
84
return
TMath::Pi() + TMath::ATan2(-
fPx
, -
fPz
);
85
}
// note that PhiY() returns an angle between 0 and 2pi
86
Double_t
PhiZ
()
const
87
{
88
return
TMath::Pi() + TMath::ATan2(-
fPy
, -
fPx
);
89
}
// note that PhiZ() returns an angle between 0 and 2pi
90
Double_t
ThetaX
()
const
91
{
92
return
(
fPx
== 0) ? TMath::PiOver2() : TMath::ACos(
fPx
/
P
());
93
}
94
Double_t
ThetaY
()
const
95
{
96
return
(
fPy
== 0) ? TMath::PiOver2() : TMath::ACos(
fPy
/
P
());
97
}
98
Double_t
ThetaZ
()
const
99
{
100
return
(
fPz
== 0) ? TMath::PiOver2() : TMath::ACos(
fPz
/
P
());
101
}
102
Double_t
GetPolarTheta
()
const
{
return
fPolarTheta
; }
103
Double_t
GetPolarPhi
()
const
{
return
fPolarPhi
; }
104
void
GetPolarisation
(Double_t& theta, Double_t& phi)
const
105
{
106
theta =
fPolarTheta
;
107
phi =
fPolarPhi
;
108
}
109
void
SetPolarTheta
(Double_t theta) {
fPolarTheta
= theta; }
110
void
SetPolarPhi
(Double_t phi) {
fPolarPhi
= phi; }
111
void
SetPolarisation
(Double_t theta, Double_t phi)
112
{
113
fPolarTheta
= theta;
114
fPolarPhi
= phi;
115
}
116
void
Momentum
(TLorentzVector& v)
const
{ v.SetPxPyPzE(
fPx
,
fPy
,
fPz
,
fE
); }
117
void
ProductionVertex
(TLorentzVector& v)
const
118
{
119
v.SetXYZT(
fVx
,
fVy
,
fVz
,
fVt
);
120
}
121
122
Double_t
Theta
(
123
const
Ex03dParticle
& p)
// Returns the angle between momenta of particles
124
{
125
Double_t v =
P
() * p.
P
();
126
if
(v == 0)
127
v = 1;
128
else
129
v = (
fPx
* p.
Px
() +
fPy
* p.
Py
() +
fPz
* p.
Pz
()) / v;
130
if
(v > 1)
131
v = 1;
132
else
if
(v < -1)
133
v = -1;
// just a precaution
134
return
TMath::ACos(v);
135
}
136
137
// ****** redefine several most oftenly used methods of LORENTZ_VECTOR
138
139
Double_t
Vx
()
const
{
return
fVx
; }
140
Double_t
Vy
()
const
{
return
fVy
; }
141
Double_t
Vz
()
const
{
return
fVz
; }
142
Double_t
T
()
const
{
return
fVt
; }
143
Double_t
R
()
const
144
{
145
return
TMath::Sqrt(
fVx
*
fVx
+
fVy
*
fVy
);
146
}
// Radius of production vertex in cylindrical system
147
Double_t
Rho
()
const
148
{
149
return
TMath::Sqrt(
fVx
*
fVx
+
fVy
*
fVy
+
fVz
*
fVz
);
150
}
// Radius of production vertex in spherical system
151
Double_t
Px
()
const
{
return
fPx
; }
152
Double_t
Py
()
const
{
return
fPy
; }
153
Double_t
Pz
()
const
{
return
fPz
; }
154
Double_t
P
()
const
{
return
TMath::Sqrt(
fPx
*
fPx
+
fPy
*
fPy
+
fPz
*
fPz
); }
155
Double_t
Pt
()
const
{
return
TMath::Sqrt(
fPx
*
fPx
+
fPy
*
fPy
); }
156
Double_t
Energy
()
const
{
return
fE
; }
157
Double_t
Eta
()
const
158
{
159
Double_t pmom =
P
();
160
if
(pmom != TMath::Abs(
fPz
))
161
return
0.5 * TMath::Log((pmom +
fPz
) / (pmom -
fPz
));
162
else
163
return
1.e30;
164
}
165
Double_t
Y
()
const
166
{
167
if
(
fE
!= TMath::Abs(
fPz
))
168
return
0.5 * TMath::Log((
fE
+
fPz
) / (
fE
-
fPz
));
169
else
170
return
1.e30;
171
}
172
173
Double_t
Phi
()
const
174
{
175
return
TMath::Pi() + TMath::ATan2(-
fPy
, -
fPx
);
176
}
// note that Phi() returns an angle between 0 and 2pi
177
Double_t
Theta
()
const
178
{
179
return
(
fPz
== 0) ? TMath::PiOver2() : TMath::ACos(
fPz
/
P
());
180
}
181
182
// setters
183
184
void
SetFirstMother
(
int
code) {
fMother
[0] = code; }
185
void
SetMother
(
int
i,
int
code) {
fMother
[i] = code; }
186
void
SetLastMother
(
int
code) {
fMother
[1] = code; }
187
void
SetFirstDaughter
(
int
code) {
fDaughter
[0] = code; }
188
void
SetDaughter
(
int
i,
int
code) {
fDaughter
[i] = code; }
189
void
SetLastDaughter
(
int
code) {
fDaughter
[1] = code; }
190
void
SetCalcMass
(Double_t mass) {
fCalcMass
= mass; }
191
void
SetPdgCode
(Int_t pdg);
192
void
SetPolarisation
(Double_t polx, Double_t poly, Double_t polz);
193
void
SetPolarisation
(
const
TVector3& v)
194
{
195
SetPolarisation
(v.X(), v.Y(), v.Z());
196
}
197
void
SetStatusCode
(
int
status) {
fStatusCode
= status; }
198
void
SetWeight
(Float_t weight = 1) {
fWeight
= weight; }
199
void
SetMomentum
(Double_t px, Double_t py, Double_t pz, Double_t e)
200
{
201
fPx
= px;
202
fPy
= py;
203
fPz
= pz;
204
fE
= e;
205
}
206
void
SetMomentum
(
const
TLorentzVector& p)
207
{
208
SetMomentum
(p.Px(), p.Py(), p.Pz(), p.Energy());
209
}
210
void
SetProductionVertex
(Double_t vx, Double_t vy, Double_t vz, Double_t t)
211
{
212
fVx
= vx;
213
fVy
= vy;
214
fVz
= vz;
215
fVt
= t;
216
}
217
void
SetProductionVertex
(
const
TLorentzVector& v)
218
{
219
SetProductionVertex
(v.X(), v.Y(), v.Z(), v.T());
220
}
221
222
protected
:
223
// data members
224
225
Int_t
fPdgCode
;
// PDG code of the particle
226
Int_t
fStatusCode
;
// generation status code
227
Int_t
fMother
[2];
// Indices of the mother particles
228
Int_t
fDaughter
[2];
// Indices of the daughter particles
229
Float_t
fWeight
;
// particle weight
230
231
Double_t
fCalcMass
;
// Calculated mass
232
233
Double_t
fPx
;
// x component of momentum
234
Double_t
fPy
;
// y component of momentum
235
Double_t
fPz
;
// z component of momentum
236
Double_t
fE
;
// Energy
237
238
Double_t
fVx
;
// x of production vertex
239
Double_t
fVy
;
// y of production vertex
240
Double_t
fVz
;
// z of production vertex
241
Double_t
fVt
;
// t of production vertex
242
243
Double_t
fPolarTheta
;
// Polar angle of polarisation
244
Double_t
fPolarPhi
;
// azymutal angle of polarisation
245
246
Int_t
fParticlePDG
;
// PDG number
247
//----------------------------------------------------------------------------
248
// functions
249
//----------------------------------------------------------------------------
250
251
// ClassDef(Ex03dParticle,1) // Ex03dParticle vertex particle information
252
};
253
254
#endif
Ex03dParticle::Py
Double_t Py() const
Definition
Ex03dParticle.h:152
Ex03dParticle::SetPolarisation
void SetPolarisation(const TVector3 &v)
Definition
Ex03dParticle.h:193
Ex03dParticle::Px
Double_t Px() const
Definition
Ex03dParticle.h:151
Ex03dParticle::fVz
Double_t fVz
Definition
Ex03dParticle.h:240
Ex03dParticle::Momentum
void Momentum(TLorentzVector &v) const
Definition
Ex03dParticle.h:116
Ex03dParticle::fPy
Double_t fPy
Definition
Ex03dParticle.h:234
Ex03dParticle::GetMass
Double_t GetMass() const
Definition
Ex03dParticle.cxx:157
Ex03dParticle::Y
Double_t Y() const
Definition
Ex03dParticle.h:165
Ex03dParticle::SetPolarPhi
void SetPolarPhi(Double_t phi)
Definition
Ex03dParticle.h:110
Ex03dParticle::Theta
Double_t Theta(const Ex03dParticle &p)
Definition
Ex03dParticle.h:122
Ex03dParticle::SetProductionVertex
void SetProductionVertex(Double_t vx, Double_t vy, Double_t vz, Double_t t)
Definition
Ex03dParticle.h:210
Ex03dParticle::Phi
Double_t Phi() const
Definition
Ex03dParticle.h:173
Ex03dParticle::GetPolarTheta
Double_t GetPolarTheta() const
Definition
Ex03dParticle.h:102
Ex03dParticle::T
Double_t T() const
Definition
Ex03dParticle.h:142
Ex03dParticle::SetMomentum
void SetMomentum(Double_t px, Double_t py, Double_t pz, Double_t e)
Definition
Ex03dParticle.h:199
Ex03dParticle::PhiY
Double_t PhiY() const
Definition
Ex03dParticle.h:82
Ex03dParticle::operator=
Ex03dParticle & operator=(const Ex03dParticle &)
Definition
Ex03dParticle.cxx:122
Ex03dParticle::Theta
Double_t Theta() const
Definition
Ex03dParticle.h:177
Ex03dParticle::Beauty
Int_t Beauty() const
Definition
Ex03dParticle.cxx:163
Ex03dParticle::GetMother
Int_t GetMother(Int_t i) const
Definition
Ex03dParticle.h:57
Ex03dParticle::fPz
Double_t fPz
Definition
Ex03dParticle.h:235
Ex03dParticle::GetFirstMother
Int_t GetFirstMother() const
Definition
Ex03dParticle.h:56
Ex03dParticle::SetLastMother
void SetLastMother(int code)
Definition
Ex03dParticle.h:186
Ex03dParticle::~Ex03dParticle
~Ex03dParticle()
Definition
Ex03dParticle.cxx:154
Ex03dParticle::SetPdgCode
void SetPdgCode(Int_t pdg)
Definition
Ex03dParticle.cxx:192
Ex03dParticle::Vz
Double_t Vz() const
Definition
Ex03dParticle.h:141
Ex03dParticle::fVy
Double_t fVy
Definition
Ex03dParticle.h:239
Ex03dParticle::fMother
Int_t fMother[2]
Definition
Ex03dParticle.h:227
Ex03dParticle::SetDaughter
void SetDaughter(int i, int code)
Definition
Ex03dParticle.h:188
Ex03dParticle::GetWeight
Float_t GetWeight() const
Definition
Ex03dParticle.h:72
Ex03dParticle::Energy
Double_t Energy() const
Definition
Ex03dParticle.h:156
Ex03dParticle::fParticlePDG
Int_t fParticlePDG
Definition
Ex03dParticle.h:246
Ex03dParticle::GetPolarisation
void GetPolarisation(Double_t &theta, Double_t &phi) const
Definition
Ex03dParticle.h:104
Ex03dParticle::Strangeness
Int_t Strangeness() const
Definition
Ex03dParticle.cxx:175
Ex03dParticle::SetMother
void SetMother(int i, int code)
Definition
Ex03dParticle.h:185
Ex03dParticle::SetFirstMother
void SetFirstMother(int code)
Definition
Ex03dParticle.h:184
Ex03dParticle::fPolarPhi
Double_t fPolarPhi
Definition
Ex03dParticle.h:244
Ex03dParticle::GetStatusCode
Int_t GetStatusCode() const
Definition
Ex03dParticle.h:54
Ex03dParticle::SetPolarTheta
void SetPolarTheta(Double_t theta)
Definition
Ex03dParticle.h:109
Ex03dParticle::GetPdgCode
Int_t GetPdgCode() const
Definition
Ex03dParticle.h:55
Ex03dParticle::ThetaY
Double_t ThetaY() const
Definition
Ex03dParticle.h:94
Ex03dParticle::PhiX
Double_t PhiX() const
Definition
Ex03dParticle.h:78
Ex03dParticle::SetWeight
void SetWeight(Float_t weight=1)
Definition
Ex03dParticle.h:198
Ex03dParticle::SetCalcMass
void SetCalcMass(Double_t mass)
Definition
Ex03dParticle.h:190
Ex03dParticle::ThetaZ
Double_t ThetaZ() const
Definition
Ex03dParticle.h:98
Ex03dParticle::GetPolarPhi
Double_t GetPolarPhi() const
Definition
Ex03dParticle.h:103
Ex03dParticle::fDaughter
Int_t fDaughter[2]
Definition
Ex03dParticle.h:228
Ex03dParticle::Eta
Double_t Eta() const
Definition
Ex03dParticle.h:157
Ex03dParticle::Rho
Double_t Rho() const
Definition
Ex03dParticle.h:147
Ex03dParticle::GetNDaughters
Int_t GetNDaughters() const
Definition
Ex03dParticle.h:68
Ex03dParticle::fWeight
Float_t fWeight
Definition
Ex03dParticle.h:229
Ex03dParticle::SetFirstDaughter
void SetFirstDaughter(int code)
Definition
Ex03dParticle.h:187
Ex03dParticle::GetLastDaughter
Int_t GetLastDaughter() const
Definition
Ex03dParticle.h:65
Ex03dParticle::Charm
Int_t Charm() const
Definition
Ex03dParticle.cxx:169
Ex03dParticle::GetFirstDaughter
Int_t GetFirstDaughter() const
Definition
Ex03dParticle.h:63
Ex03dParticle::GetCalcMass
Double_t GetCalcMass() const
Definition
Ex03dParticle.h:66
Ex03dParticle::Ek
Double_t Ek() const
Definition
Ex03dParticle.h:53
Ex03dParticle::fCalcMass
Double_t fCalcMass
Definition
Ex03dParticle.h:231
Ex03dParticle::Vy
Double_t Vy() const
Definition
Ex03dParticle.h:140
Ex03dParticle::SetLastDaughter
void SetLastDaughter(int code)
Definition
Ex03dParticle.h:189
Ex03dParticle::ThetaX
Double_t ThetaX() const
Definition
Ex03dParticle.h:90
Ex03dParticle::Vx
Double_t Vx() const
Definition
Ex03dParticle.h:139
Ex03dParticle::SetMomentum
void SetMomentum(const TLorentzVector &p)
Definition
Ex03dParticle.h:206
Ex03dParticle::fPx
Double_t fPx
Definition
Ex03dParticle.h:233
Ex03dParticle::fE
Double_t fE
Definition
Ex03dParticle.h:236
Ex03dParticle::ProductionVertex
void ProductionVertex(TLorentzVector &v) const
Definition
Ex03dParticle.h:117
Ex03dParticle::Pz
Double_t Pz() const
Definition
Ex03dParticle.h:153
Ex03dParticle::SetStatusCode
void SetStatusCode(int status)
Definition
Ex03dParticle.h:197
Ex03dParticle::fStatusCode
Int_t fStatusCode
Definition
Ex03dParticle.h:226
Ex03dParticle::fVx
Double_t fVx
Definition
Ex03dParticle.h:238
Ex03dParticle::SetPolarisation
void SetPolarisation(Double_t theta, Double_t phi)
Definition
Ex03dParticle.h:111
Ex03dParticle::fPdgCode
Int_t fPdgCode
Definition
Ex03dParticle.h:225
Ex03dParticle::Pt
Double_t Pt() const
Definition
Ex03dParticle.h:155
Ex03dParticle::fVt
Double_t fVt
Definition
Ex03dParticle.h:241
Ex03dParticle::GetPolarisation
void GetPolarisation(TVector3 &v) const
Definition
Ex03dParticle.cxx:181
Ex03dParticle::GetSecondMother
Int_t GetSecondMother() const
Definition
Ex03dParticle.h:58
Ex03dParticle::P
Double_t P() const
Definition
Ex03dParticle.h:154
Ex03dParticle::IsPrimary
Bool_t IsPrimary() const
Definition
Ex03dParticle.h:59
Ex03dParticle::PhiZ
Double_t PhiZ() const
Definition
Ex03dParticle.h:86
Ex03dParticle::fPolarTheta
Double_t fPolarTheta
Definition
Ex03dParticle.h:243
Ex03dParticle::SetProductionVertex
void SetProductionVertex(const TLorentzVector &v)
Definition
Ex03dParticle.h:217
Ex03dParticle::Ex03dParticle
Ex03dParticle()
Definition
Ex03dParticle.cxx:21
Ex03dParticle::R
Double_t R() const
Definition
Ex03dParticle.h:143
Ex03dParticle::GetDaughter
Int_t GetDaughter(Int_t i) const
Definition
Ex03dParticle.h:64
Generated on
for VMC Examples by
1.17.0