forked from root-project/root
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TParticlePDG.cxx
259 lines (234 loc) · 7.89 KB
/
TParticlePDG.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
// @(#)root/eg:$Id$
// Author: Pasha Murat 12/02/99
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
//______________________________________________________________________________
//
// Description of the static properties of a particle.
// The class is typically generated by the TDatabasePDG class.
// It is referenced by the dynamic particle class TParticle.
// Int_t fPdgCode; // PDG code of the particle
// Double_t fMass; // particle mass in GeV
// Double_t fCharge; // charge in units of |e|/3
// Double_t fLifetime; // proper lifetime in seconds
// Double_t fWidth; // total width in GeV
// Int_t fParity; // parity
// Double_t fSpin; // spin
// Double_t fIsospin; // isospin
// Double_t fI3; // i3
// Int_t fStrangeness; // flavours are defined if i3 != -1
// Int_t fCharm; // 1 or -1 for C-particles, 0 for others
// Int_t fBeauty;
// Int_t fTop;
// Int_t fY; // X,Y: quantum numbers for the 4-th generation
// Int_t fX;
// Int_t fStable; // 1 if stable, 0 otherwise
//
// TObjArray* fDecayList; // array of decay channels
//
// TString fParticleClass; // lepton, meson etc
//
// Int_t fTrackingCode; // G3 tracking code of the particle
// TParticlePDG* fAntiParticle; // pointer to antiparticle
#include "TDecayChannel.h"
#include "TParticlePDG.h"
#include "TDatabasePDG.h"
ClassImp(TParticlePDG)
//______________________________________________________________________________
TParticlePDG::TParticlePDG()
{
//default constructor
fPdgCode = 0;
fMass = 0;
fCharge = 0;
fLifetime = 0;
fWidth = 0;
fParity = 0;
fSpin = 0;
fIsospin = 0;
fI3 = 0;
fStrangeness = 0;
fCharm = 0;
fBeauty = 0;
fTop = 0;
fY = 0;
fX = 0;
fStable = 0;
fDecayList = 0;
fTrackingCode = 0;
fAntiParticle = 0;
}
//______________________________________________________________________________
TParticlePDG::TParticlePDG(const char* Name, const char* Title, Double_t aMass,
Bool_t aStable, Double_t aWidth, Double_t aCharge,
const char* aParticleClass, Int_t aPdgCode, Int_t Anti,
Int_t aTrackingCode)
: TNamed(Name,Title)
{
// empty for the time being
fLifetime = 0;
fParity = 0;
fSpin = 0;
fIsospin = 0;
fI3 = 0;
fStrangeness = 0;
fCharm = 0;
fBeauty = 0;
fTop = 0;
fY = 0;
fX = 0;
fStable = 0;
fMass = aMass;
fStable = aStable;
fWidth = aWidth;
fCharge = aCharge;
fParticleClass = aParticleClass;
fPdgCode = aPdgCode;
fTrackingCode = aTrackingCode;
fDecayList = NULL;
if (Anti) fAntiParticle = this;
else fAntiParticle = 0;
const Double_t kHbar = 6.58211889e-25; // GeV s
if (fWidth != 0.) fLifetime = kHbar / fWidth;
}
//______________________________________________________________________________
TParticlePDG::TParticlePDG(const TParticlePDG& pdg) :
TNamed(pdg),
fPdgCode(pdg.fPdgCode),
fMass(pdg.fMass),
fCharge(pdg.fCharge),
fLifetime(pdg.fLifetime),
fWidth(pdg.fWidth),
fParity(pdg.fParity),
fSpin(pdg.fSpin),
fIsospin(pdg.fIsospin),
fI3(pdg.fI3),
fStrangeness(pdg.fStrangeness),
fCharm(pdg.fCharm),
fBeauty(pdg.fBeauty),
fTop(pdg.fTop),
fY(pdg.fY),
fX(pdg.fX),
fStable(pdg.fStable),
fDecayList(pdg.fDecayList),
fParticleClass(pdg.fParticleClass),
fTrackingCode(pdg.fTrackingCode),
fAntiParticle(pdg.fAntiParticle)
{
//copy constructor
}
//______________________________________________________________________________
TParticlePDG& TParticlePDG::operator=(const TParticlePDG& pdg)
{
//assignement operator
if(this!=&pdg) {
TNamed::operator=(pdg);
fPdgCode=pdg.fPdgCode;
fMass=pdg.fMass;
fCharge=pdg.fCharge;
fLifetime=pdg.fLifetime;
fWidth=pdg.fWidth;
fParity=pdg.fParity;
fSpin=pdg.fSpin;
fIsospin=pdg.fIsospin;
fI3=pdg.fI3;
fStrangeness=pdg.fStrangeness;
fCharm=pdg.fCharm;
fBeauty=pdg.fBeauty;
fTop=pdg.fTop;
fY=pdg.fY;
fX=pdg.fX;
fStable=pdg.fStable;
fDecayList=pdg.fDecayList;
fParticleClass=pdg.fParticleClass;
fTrackingCode=pdg.fTrackingCode;
fAntiParticle=pdg.fAntiParticle;
}
return *this;
}
//______________________________________________________________________________
TParticlePDG::~TParticlePDG() {
//destructor
if (fDecayList) {
fDecayList->Delete();
delete fDecayList;
}
}
//______________________________________________________________________________
Int_t TParticlePDG::AddDecayChannel(Int_t Type,
Double_t BranchingRatio,
Int_t NDaughters,
Int_t* DaughterPdgCode)
{
// add new decay channel, Particle owns those...
Int_t n = NDecayChannels();
if (NDecayChannels() == 0) {
fDecayList = new TObjArray(5);
}
TDecayChannel* dc = new TDecayChannel(n,Type,BranchingRatio,NDaughters,
DaughterPdgCode);
fDecayList->Add(dc);
return 0;
}
//_____________________________________________________________________________
TDecayChannel* TParticlePDG::DecayChannel(Int_t i)
{
//return pointer to decay channel object at index i
return (TDecayChannel*) fDecayList->At(i);
}
//_____________________________________________________________________________
void TParticlePDG::PrintDecayChannel(TDecayChannel* dc, Option_t* option) const
{
//print the list of decays
if (strstr(option,"banner")) {
// print banner
printf(" Channel Code BranchingRatio Nd ");
printf(" ...................Daughters.................... \n");
}
if (strstr(option,"data")) {
TDatabasePDG* db = TDatabasePDG::Instance();
printf("%7i %5i %12.5e %5i ",
dc->Number(),
dc->MatrixElementCode(),
dc->BranchingRatio(),
dc->NDaughters());
for (int i=0; i<dc->NDaughters(); i++) {
int ic = dc->DaughterPdgCode(i);
TParticlePDG* p = db->GetParticle(ic);
printf(" %15s(%8i)",p->GetName(),ic);
}
printf("\n");
}
}
//______________________________________________________________________________
void TParticlePDG::Print(Option_t *) const
{
//
// Print the entire information of this kind of particle
//
printf("%-20s %6d\t",GetName(),fPdgCode);
if (!fStable) {
printf("Mass:%9.4f Width (GeV):%11.4e\tCharge: %5.1f\n",
fMass, fWidth, fCharge);
} else {
printf("Mass:%9.4f Width (GeV): Stable\tCharge: %5.1f\n",
fMass, fCharge);
}
if (fDecayList) {
int banner_printed = 0;
TIter next(fDecayList);
TDecayChannel* dc;
while ((dc = (TDecayChannel*)next())) {
if (! banner_printed) {
PrintDecayChannel(dc,"banner");
banner_printed = 1;
}
PrintDecayChannel(dc,"data");
}
}
}