VMC Examples
Version 6.8
Toggle main menu visibility
Loading...
Searching...
No Matches
examples
E03
E03d
src
Ex03dParticle.cxx
Go to the documentation of this file.
1
//------------------------------------------------
2
// The Virtual Monte Carlo examples
3
// Copyright (C) 2014 - 2018 Ivana Hrivnacova
4
// All rights reserved.
5
//
6
// For the licensing terms see geant4_vmc/LICENSE.
7
// Contact: root-vmc@cern.ch
8
//-------------------------------------------------
9
10
/// \file Ex03dParticle.cxx
11
/// \brief Implementation of the Ex03dParticle class
12
///
13
/// Simplified version of ROOT's TParticle to store in RNTuple
14
///
15
/// \date 07/07/2026
16
/// \author Radoslaw Karabowicz; GSI
17
18
#include "
Ex03dParticle.h
"
19
20
//_____________________________________________________________________________
21
Ex03dParticle::Ex03dParticle
()
22
:
fPdgCode
(0),
23
fStatusCode
(0),
24
fWeight
(0),
25
fCalcMass
(0),
26
fPx
(0),
27
fPy
(0),
28
fPz
(0),
29
fE
(0),
30
fVx
(0),
31
fVy
(0),
32
fVz
(0),
33
fVt
(0),
34
fPolarTheta
(0),
35
fPolarPhi
(0)
36
{
37
fMother
[0] = 0;
38
fMother
[1] = 0;
39
fDaughter
[0] = 0;
40
fDaughter
[1] = 0;
41
fParticlePDG
= 0;
42
}
43
44
//_____________________________________________________________________________
45
Ex03dParticle::Ex03dParticle
(Int_t pdg, Int_t status, Int_t mother1,
46
Int_t mother2, Int_t daughter1, Int_t daughter2, Double_t px, Double_t py,
47
Double_t pz, Double_t etot, Double_t vx, Double_t vy, Double_t vz,
48
Double_t time)
49
:
fPdgCode
(pdg),
50
fStatusCode
(status),
51
fWeight
(1.),
52
fPx
(px),
53
fPy
(py),
54
fPz
(pz),
55
fE
(etot),
56
fVx
(vx),
57
fVy
(vy),
58
fVz
(vz),
59
fVt
(time)
60
{
61
fMother
[0] = mother1;
62
fMother
[1] = mother2;
63
fDaughter
[0] = daughter1;
64
fDaughter
[1] = daughter2;
65
66
SetPolarisation
(0, 0, 0);
67
68
SetPdgCode
(pdg);
69
}
70
71
//_____________________________________________________________________________
72
Ex03dParticle::Ex03dParticle
(Int_t pdg, Int_t status, Int_t mother1,
73
Int_t mother2, Int_t daughter1, Int_t daughter2,
const
TLorentzVector& p,
74
const
TLorentzVector& v)
75
:
fPdgCode
(pdg),
76
fStatusCode
(status),
77
fWeight
(1.),
78
fPx
(p.
Px
()),
79
fPy
(p.
Py
()),
80
fPz
(p.
Pz
()),
81
fE
(p.E()),
82
fVx
(v.X()),
83
fVy
(v.
Y
()),
84
fVz
(v.Z()),
85
fVt
(v.
T
())
86
{
87
fMother
[0] = mother1;
88
fMother
[1] = mother2;
89
fDaughter
[0] = daughter1;
90
fDaughter
[1] = daughter2;
91
92
SetPolarisation
(0, 0, 0);
93
94
SetPdgCode
(pdg);
95
}
96
97
//_____________________________________________________________________________
98
Ex03dParticle::Ex03dParticle
(
const
Ex03dParticle
& p)
99
:
fPdgCode
(p.
fPdgCode
),
100
fStatusCode
(p.
fStatusCode
),
101
fWeight
(p.
fWeight
),
102
fCalcMass
(p.
fCalcMass
),
103
fPx
(p.
fPx
),
104
fPy
(p.
fPy
),
105
fPz
(p.
fPz
),
106
fE
(p.
fE
),
107
fVx
(p.
fVx
),
108
fVy
(p.
fVy
),
109
fVz
(p.
fVz
),
110
fVt
(p.
fVt
),
111
fPolarTheta
(p.
fPolarTheta
),
112
fPolarPhi
(p.
fPolarPhi
),
113
fParticlePDG
(p.
fParticlePDG
)
114
{
115
fMother
[0] = p.
fMother
[0];
116
fMother
[1] = p.
fMother
[1];
117
fDaughter
[0] = p.
fDaughter
[0];
118
fDaughter
[1] = p.
fDaughter
[1];
119
}
120
121
//_____________________________________________________________________________
122
Ex03dParticle
&
Ex03dParticle::operator=
(
const
Ex03dParticle
& p)
123
{
124
if
(
this
!= &p) {
125
fPdgCode
= p.
fPdgCode
;
126
fStatusCode
= p.
fStatusCode
;
127
fMother
[0] = p.
fMother
[0];
128
fMother
[1] = p.
fMother
[1];
129
fDaughter
[0] = p.
fDaughter
[0];
130
fDaughter
[1] = p.
fDaughter
[1];
131
fWeight
= p.
fWeight
;
132
133
fCalcMass
= p.
fCalcMass
;
134
135
fPx
= p.
fPx
;
136
fPy
= p.
fPy
;
137
fPz
= p.
fPz
;
138
fE
= p.
fE
;
139
140
fVx
= p.
fVx
;
141
fVy
= p.
fVy
;
142
fVz
= p.
fVz
;
143
fVt
= p.
fVt
;
144
145
fPolarTheta
= p.
fPolarTheta
;
146
fPolarPhi
= p.
fPolarPhi
;
147
148
fParticlePDG
= p.
fParticlePDG
;
149
}
150
return
*
this
;
151
}
152
153
//_____________________________________________________________________________
154
Ex03dParticle::~Ex03dParticle
() {}
155
156
//_____________________________________________________________________________
157
Double_t
Ex03dParticle::GetMass
()
const
158
{
159
return
0.;
// GetPDG()->Mass();
160
}
161
162
//_____________________________________________________________________________
163
Int_t
Ex03dParticle::Beauty
()
const
164
{
165
return
0;
// GetPDG()->Beauty();
166
}
167
168
//_____________________________________________________________________________
169
Int_t
Ex03dParticle::Charm
()
const
170
{
171
return
0;
// GetPDG()->Charm();
172
}
173
174
//_____________________________________________________________________________
175
Int_t
Ex03dParticle::Strangeness
()
const
176
{
177
return
0;
// GetPDG()->Strangeness();
178
}
179
180
//_____________________________________________________________________________
181
void
Ex03dParticle::GetPolarisation
(TVector3& v)
const
182
{
183
if
(
fPolarTheta
== -99 &&
fPolarPhi
== -99)
184
// No polarisation to return
185
v.SetXYZ(0., 0., 0.);
186
else
187
v.SetXYZ(TMath::Cos(
fPolarPhi
) * TMath::Sin(
fPolarTheta
),
188
TMath::Sin(
fPolarPhi
) * TMath::Sin(
fPolarTheta
), TMath::Cos(
fPolarTheta
));
189
}
190
191
//_____________________________________________________________________________
192
void
Ex03dParticle::SetPdgCode
(Int_t pdg)
193
{
194
// fParticlePDG = pdg;
195
/* fParticlePDG = TDatabasePDG::Instance()->GetParticle(pdg);
196
if (fParticlePDG) {
197
fCalcMass = fParticlePDG->Mass();
198
} else {
199
if (nWarnings < 10) {
200
Warning("SetPdgCode","PDG code %d unknown from TDatabasePDG",pdg);
201
nWarnings++;
202
}
203
Double_t a2 = fE*fE -fPx*fPx -fPy*fPy -fPz*fPz;
204
if (a2 >= 0) fCalcMass = TMath::Sqrt(a2);
205
else fCalcMass = -TMath::Sqrt(-a2);
206
}*/
207
}
208
209
//_____________________________________________________________________________
210
void
Ex03dParticle::SetPolarisation
(Double_t polx, Double_t poly, Double_t polz)
211
{
212
if
(polx || poly || polz) {
213
fPolarTheta
=
214
TMath::ACos(polz / TMath::Sqrt(polx * polx + poly * poly + polz * polz));
215
fPolarPhi
= TMath::Pi() + TMath::ATan2(-poly, -polx);
216
}
217
else
{
218
fPolarTheta
= -99;
219
fPolarPhi
= -99;
220
}
221
}
Ex03dParticle.h
Definition of the Ex03dParticle class.
Ex03dParticle::Py
Double_t Py() const
Definition
Ex03dParticle.h:152
Ex03dParticle::Px
Double_t Px() const
Definition
Ex03dParticle.h:151
Ex03dParticle::fVz
Double_t fVz
Definition
Ex03dParticle.h:240
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::T
Double_t T() const
Definition
Ex03dParticle.h:142
Ex03dParticle::operator=
Ex03dParticle & operator=(const Ex03dParticle &)
Definition
Ex03dParticle.cxx:122
Ex03dParticle::Beauty
Int_t Beauty() const
Definition
Ex03dParticle.cxx:163
Ex03dParticle::fPz
Double_t fPz
Definition
Ex03dParticle.h:235
Ex03dParticle::~Ex03dParticle
~Ex03dParticle()
Definition
Ex03dParticle.cxx:154
Ex03dParticle::SetPdgCode
void SetPdgCode(Int_t pdg)
Definition
Ex03dParticle.cxx:192
Ex03dParticle::fVy
Double_t fVy
Definition
Ex03dParticle.h:239
Ex03dParticle::fMother
Int_t fMother[2]
Definition
Ex03dParticle.h:227
Ex03dParticle::fParticlePDG
Int_t fParticlePDG
Definition
Ex03dParticle.h:246
Ex03dParticle::Strangeness
Int_t Strangeness() const
Definition
Ex03dParticle.cxx:175
Ex03dParticle::fPolarPhi
Double_t fPolarPhi
Definition
Ex03dParticle.h:244
Ex03dParticle::fDaughter
Int_t fDaughter[2]
Definition
Ex03dParticle.h:228
Ex03dParticle::fWeight
Float_t fWeight
Definition
Ex03dParticle.h:229
Ex03dParticle::Charm
Int_t Charm() const
Definition
Ex03dParticle.cxx:169
Ex03dParticle::fCalcMass
Double_t fCalcMass
Definition
Ex03dParticle.h:231
Ex03dParticle::fPx
Double_t fPx
Definition
Ex03dParticle.h:233
Ex03dParticle::fE
Double_t fE
Definition
Ex03dParticle.h:236
Ex03dParticle::Pz
Double_t Pz() const
Definition
Ex03dParticle.h:153
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::fVt
Double_t fVt
Definition
Ex03dParticle.h:241
Ex03dParticle::GetPolarisation
void GetPolarisation(TVector3 &v) const
Definition
Ex03dParticle.cxx:181
Ex03dParticle::fPolarTheta
Double_t fPolarTheta
Definition
Ex03dParticle.h:243
Ex03dParticle::Ex03dParticle
Ex03dParticle()
Definition
Ex03dParticle.cxx:21
Generated on
for VMC Examples by
1.17.0