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
51
52////////////////////////////////////////////////////////////////////////////////
53///default constructor
54
56{
57 fPdgCode = 0;
58 fMass = 0;
59 fCharge = 0;
60 fLifetime = 0;
61 fWidth = 0;
62 fParity = 0;
63 fSpin = 0;
64 fIsospin = 0;
65 fI3 = 0;
66 fStrangeness = 0;
67 fCharm = 0;
68 fBeauty = 0;
69 fTop = 0;
70 fY = 0;
71 fX = 0;
72 fStable = 0;
73 fDecayList = 0;
74 fTrackingCode = 0;
75 fAntiParticle = 0;
76}
77
78////////////////////////////////////////////////////////////////////////////////
79///constructor
80
81TParticlePDG::TParticlePDG(const char* Name, const char* Title, Double_t aMass,
82 Bool_t aStable, Double_t aWidth, Double_t aCharge,
83 const char* aParticleClass, Int_t aPdgCode, Int_t Anti,
84 Int_t aTrackingCode)
85 : TNamed(Name,Title)
86{
87 // empty for the time being
88 fLifetime = 0;
89 fParity = 0;
90 fSpin = 0;
91 fIsospin = 0;
92 fI3 = 0;
93 fStrangeness = 0;
94 fCharm = 0;
95 fBeauty = 0;
96 fTop = 0;
97 fY = 0;
98 fX = 0;
99 fStable = 0;
100
101 fMass = aMass;
102 fStable = aStable;
103 fWidth = aWidth;
104 fCharge = aCharge;
105 fParticleClass = aParticleClass;
106 fPdgCode = aPdgCode;
107 fTrackingCode = aTrackingCode;
108 fDecayList = NULL;
109 if (Anti) fAntiParticle = this;
110 else fAntiParticle = 0;
111
112 const Double_t kHbar = 6.58211889e-25; // GeV s
113 if (fWidth != 0.) fLifetime = kHbar / fWidth;
114}
115
116////////////////////////////////////////////////////////////////////////////////
117///copy constructor
118
120 TNamed(pdg),
121 fPdgCode(pdg.fPdgCode),
122 fMass(pdg.fMass),
123 fCharge(pdg.fCharge),
124 fLifetime(pdg.fLifetime),
125 fWidth(pdg.fWidth),
126 fParity(pdg.fParity),
127 fSpin(pdg.fSpin),
128 fIsospin(pdg.fIsospin),
129 fI3(pdg.fI3),
130 fStrangeness(pdg.fStrangeness),
131 fCharm(pdg.fCharm),
132 fBeauty(pdg.fBeauty),
133 fTop(pdg.fTop),
134 fY(pdg.fY),
135 fX(pdg.fX),
136 fStable(pdg.fStable),
137 fDecayList(pdg.fDecayList),
138 fParticleClass(pdg.fParticleClass),
139 fTrackingCode(pdg.fTrackingCode),
140 fAntiParticle(pdg.fAntiParticle)
141{
142}
143
144////////////////////////////////////////////////////////////////////////////////
145///assignement operator
146
148{
149 if(this!=&pdg) {
151 fPdgCode=pdg.fPdgCode;
152 fMass=pdg.fMass;
153 fCharge=pdg.fCharge;
155 fWidth=pdg.fWidth;
156 fParity=pdg.fParity;
157 fSpin=pdg.fSpin;
158 fIsospin=pdg.fIsospin;
159 fI3=pdg.fI3;
161 fCharm=pdg.fCharm;
162 fBeauty=pdg.fBeauty;
163 fTop=pdg.fTop;
164 fY=pdg.fY;
165 fX=pdg.fX;
166 fStable=pdg.fStable;
171 }
172 return *this;
173}
174
175////////////////////////////////////////////////////////////////////////////////
176///destructor
177
179 if (fDecayList) {
181 delete fDecayList;
182 }
183}
184
185
186////////////////////////////////////////////////////////////////////////////////
187/// add new decay channel, Particle owns those...
188
190 Double_t BranchingRatio,
191 Int_t NDaughters,
192 Int_t* DaughterPdgCode)
193{
195 if (NDecayChannels() == 0) {
196 fDecayList = new TObjArray(5);
197 }
198 TDecayChannel* dc = new TDecayChannel(n,Type,BranchingRatio,NDaughters,
199 DaughterPdgCode);
200 fDecayList->Add(dc);
201 return 0;
202}
203
204////////////////////////////////////////////////////////////////////////////////
205/// return pointer to decay channel object at index i
206
208{
209 return (TDecayChannel*) fDecayList->At(i);
210}
211
212////////////////////////////////////////////////////////////////////////////////
213/// print the list of decays
214
216{
217 if (strstr(option,"banner")) {
218 // print banner
219
220 printf(" Channel Code BranchingRatio Nd ");
221 printf(" ...................Daughters.................... \n");
222 }
223 if (strstr(option,"data")) {
224
226
227 printf("%7i %5i %12.5e %5i ",
228 dc->Number(),
229 dc->MatrixElementCode(),
230 dc->BranchingRatio(),
231 dc->NDaughters());
232
233 for (int i=0; i<dc->NDaughters(); i++) {
234 int ic = dc->DaughterPdgCode(i);
235 TParticlePDG* p = db->GetParticle(ic);
236 printf(" %15s(%8i)",p->GetName(),ic);
237 }
238 printf("\n");
239 }
240}
241
242
243////////////////////////////////////////////////////////////////////////////////
244///
245/// Print the entire information of this kind of particle
246///
247
249{
250 printf("%-20s %6d\t",GetName(),fPdgCode);
251 if (!fStable) {
252 printf("Mass:%9.4f Width (GeV):%11.4e\tCharge: %5.1f\n",
254 } else {
255 printf("Mass:%9.4f Width (GeV): Stable\tCharge: %5.1f\n",
256 fMass, fCharge);
257 }
258 if (fDecayList) {
259 int banner_printed = 0;
260 TIter next(fDecayList);
261 TDecayChannel* dc;
262 while ((dc = (TDecayChannel*)next())) {
263 if (! banner_printed) {
264 PrintDecayChannel(dc,"banner");
265 banner_printed = 1;
266 }
267 PrintDecayChannel(dc,"data");
268 }
269 }
270}
271
double Double_t
Definition RtypesCore.h:59
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
Particle database manager class.
static TDatabasePDG * Instance()
static function
TParticlePDG * GetParticle(Int_t pdgCode) const
Get a pointer to the particle object according to the MC code number.
Description of the decay channel.
Int_t MatrixElementCode()
Int_t DaughterPdgCode(Int_t i)
Double_t BranchingRatio()
Int_t NDaughters()
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition TNamed.cxx:51
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
An array of TObjects.
Definition TObjArray.h:31
void Add(TObject *obj)
Definition TObjArray.h:68
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
TObject * At(Int_t idx) const
Definition TObjArray.h:164
Description of the static properties of a particle.
Double_t fIsospin
virtual void Print(Option_t *opt="") const
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
virtual ~TParticlePDG()
destructor
Double_t fSpin
Double_t fLifetime
TParticlePDG * fAntiParticle
Double_t fCharge
const Int_t n
Definition legend1.C:16