Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TParticlePDG.cxx
Go to the documentation of this file.
1// @(#)root/eg:$Id$
2// Author: Pasha Murat 12/02/99
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12/** \class TParticlePDG
13 \ingroup eg
14
15Description of the static properties of a particle.
16
17The class is typically generated by the TDatabasePDG class.
18It is referenced by the dynamic particle class TParticle.
19\verbatim
20 Int_t fPdgCode; // PDG code of the particle
21 Double_t fMass; // particle mass in GeV
22 Double_t fCharge; // charge in units of |e|/3
23 Double_t fLifetime; // proper lifetime in seconds
24 Double_t fWidth; // total width in GeV
25 Int_t fParity; // parity
26 Double_t fSpin; // spin
27 Double_t fIsospin; // isospin
28 Double_t fI3; // i3
29 Int_t fStrangeness; // flavours are defined if i3 != -1
30 Int_t fCharm; // 1 or -1 for C-particles, 0 for others
31 Int_t fBeauty;
32 Int_t fTop;
33 Int_t fY; // X,Y: quantum numbers for the 4-th generation
34 Int_t fX;
35 Int_t fStable; // 1 if stable, 0 otherwise
36
37 TObjArray* fDecayList; // array of decay channels
38
39 TString fParticleClass; // lepton, meson etc
40
41 Int_t fTrackingCode; // G3 tracking code of the particle
42 TParticlePDG* fAntiParticle; // pointer to antiparticle
43\endverbatim
44*/
45
46#include "TDecayChannel.h"
47#include "TParticlePDG.h"
48#include "TDatabasePDG.h"
49
50
51////////////////////////////////////////////////////////////////////////////////
52///default constructor
53
55{
56 fPdgCode = 0;
57 fMass = 0;
58 fCharge = 0;
59 fLifetime = 0;
60 fWidth = 0;
61 fParity = 0;
62 fSpin = 0;
63 fIsospin = 0;
64 fI3 = 0;
65 fStrangeness = 0;
66 fCharm = 0;
67 fBeauty = 0;
68 fTop = 0;
69 fY = 0;
70 fX = 0;
71 fStable = 0;
72 fDecayList = 0;
73 fTrackingCode = 0;
74 fAntiParticle = 0;
75}
76
77////////////////////////////////////////////////////////////////////////////////
78///constructor
79
80TParticlePDG::TParticlePDG(const char* Name, const char* Title, Double_t aMass,
84 : TNamed(Name,Title)
85{
86 // empty for the time being
87 fLifetime = 0;
88 fParity = 0;
89 fSpin = 0;
90 fIsospin = 0;
91 fI3 = 0;
92 fStrangeness = 0;
93 fCharm = 0;
94 fBeauty = 0;
95 fTop = 0;
96 fY = 0;
97 fX = 0;
98 fStable = 0;
99
100 fMass = aMass;
102 fWidth = aWidth;
108 if (Anti) fAntiParticle = this;
109 else fAntiParticle = 0;
110
111 const Double_t kHbar = 6.58211889e-25; // GeV s
112 if (fWidth != 0.) fLifetime = kHbar / fWidth;
113}
114
115////////////////////////////////////////////////////////////////////////////////
116///copy constructor
117
119 TNamed(pdg),
120 fPdgCode(pdg.fPdgCode),
121 fMass(pdg.fMass),
122 fCharge(pdg.fCharge),
123 fLifetime(pdg.fLifetime),
124 fWidth(pdg.fWidth),
125 fParity(pdg.fParity),
126 fSpin(pdg.fSpin),
127 fIsospin(pdg.fIsospin),
128 fI3(pdg.fI3),
129 fStrangeness(pdg.fStrangeness),
130 fCharm(pdg.fCharm),
131 fBeauty(pdg.fBeauty),
132 fTop(pdg.fTop),
133 fY(pdg.fY),
134 fX(pdg.fX),
135 fStable(pdg.fStable),
136 fDecayList(pdg.fDecayList),
137 fParticleClass(pdg.fParticleClass),
138 fTrackingCode(pdg.fTrackingCode),
139 fAntiParticle(pdg.fAntiParticle)
140{
141}
142
143////////////////////////////////////////////////////////////////////////////////
144///assignement operator
145
147{
148 if(this!=&pdg) {
150 fPdgCode=pdg.fPdgCode;
151 fMass=pdg.fMass;
152 fCharge=pdg.fCharge;
153 fLifetime=pdg.fLifetime;
154 fWidth=pdg.fWidth;
155 fParity=pdg.fParity;
156 fSpin=pdg.fSpin;
157 fIsospin=pdg.fIsospin;
158 fI3=pdg.fI3;
159 fStrangeness=pdg.fStrangeness;
160 fCharm=pdg.fCharm;
161 fBeauty=pdg.fBeauty;
162 fTop=pdg.fTop;
163 fY=pdg.fY;
164 fX=pdg.fX;
165 fStable=pdg.fStable;
166 fDecayList=pdg.fDecayList;
167 fParticleClass=pdg.fParticleClass;
168 fTrackingCode=pdg.fTrackingCode;
169 fAntiParticle=pdg.fAntiParticle;
170 }
171 return *this;
172}
173
174////////////////////////////////////////////////////////////////////////////////
175///destructor
176
178 if (fDecayList) {
180 delete fDecayList;
181 }
182}
183
184
185////////////////////////////////////////////////////////////////////////////////
186/// add new decay channel, Particle owns those...
187
189 Double_t BranchingRatio,
190 Int_t NDaughters,
191 Int_t* DaughterPdgCode)
192{
194 if (NDecayChannels() == 0) {
195 fDecayList = new TObjArray(5);
196 }
197 TDecayChannel* dc = new TDecayChannel(n,Type,BranchingRatio,NDaughters,
198 DaughterPdgCode);
199 fDecayList->Add(dc);
200 return 0;
201}
202
203////////////////////////////////////////////////////////////////////////////////
204/// return pointer to decay channel object at index i
205
210
211////////////////////////////////////////////////////////////////////////////////
212/// print the list of decays
213
215{
216 if (strstr(option,"banner")) {
217 // print banner
218
219 printf(" Channel Code BranchingRatio Nd ");
220 printf(" ...................Daughters.................... \n");
221 }
222 if (strstr(option,"data")) {
223
225
226 printf("%7i %5i %12.5e %5i ",
227 dc->Number(),
228 dc->MatrixElementCode(),
229 dc->BranchingRatio(),
230 dc->NDaughters());
231
232 for (int i=0; i<dc->NDaughters(); i++) {
233 int ic = dc->DaughterPdgCode(i);
234 TParticlePDG* p = db->GetParticle(ic);
235 printf(" %15s(%8i)",p->GetName(),ic);
236 }
237 printf("\n");
238 }
239}
240
241
242////////////////////////////////////////////////////////////////////////////////
243///
244/// Print the entire information of this kind of particle
245///
246
248{
249 printf("%-20s %6d\t",GetName(),fPdgCode);
250 if (!fStable) {
251 printf("Mass:%9.4f Width (GeV):%11.4e\tCharge: %5.1f\n",
253 } else {
254 printf("Mass:%9.4f Width (GeV): Stable\tCharge: %5.1f\n",
255 fMass, fCharge);
256 }
257 if (fDecayList) {
258 int banner_printed = 0;
259 TIter next(fDecayList);
261 while ((dc = (TDecayChannel*)next())) {
262 if (! banner_printed) {
263 PrintDecayChannel(dc,"banner");
264 banner_printed = 1;
265 }
266 PrintDecayChannel(dc,"data");
267 }
268 }
269}
270
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t option
Particle database manager class.
static TDatabasePDG * Instance()
static function
Description of the decay channel.
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition TNamed.cxx:50
An array of TObjects.
Definition TObjArray.h:31
void Delete(Option_t *option="") override
Remove all objects from the array AND delete all heap based objects.
TObject * At(Int_t idx) const override
Definition TObjArray.h:164
void Add(TObject *obj) override
Definition TObjArray.h:68
Description of the static properties of a particle.
~TParticlePDG() override
destructor
Double_t fIsospin
void Print(Option_t *opt="") const override
Print the entire information of this kind of particle.
virtual void PrintDecayChannel(TDecayChannel *dc, Option_t *opt="") const
print the list of decays
Int_t fTrackingCode
Double_t fWidth
Int_t fStrangeness
TDecayChannel * DecayChannel(Int_t i)
return pointer to decay channel object at index i
TParticlePDG & operator=(const TParticlePDG &)
assignement operator
Int_t AddDecayChannel(Int_t Type, Double_t BranchingRatio, Int_t NDaughters, Int_t *DaughterPdgCode)
add new decay channel, Particle owns those...
TString fParticleClass
Double_t fI3
Double_t fMass
TParticlePDG()
default constructor
TObjArray * fDecayList
Int_t NDecayChannels() const
Double_t fSpin
Double_t fLifetime
TParticlePDG * fAntiParticle
Double_t fCharge
const Int_t n
Definition legend1.C:16