ROOT  6.06/09
Reference Guide
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 //______________________________________________________________________________
13 //
14 // Description of the static properties of a particle.
15 // The class is typically generated by the TDatabasePDG class.
16 // It is referenced by the dynamic particle class TParticle.
17 // Int_t fPdgCode; // PDG code of the particle
18 // Double_t fMass; // particle mass in GeV
19 // Double_t fCharge; // charge in units of |e|/3
20 // Double_t fLifetime; // proper lifetime in seconds
21 // Double_t fWidth; // total width in GeV
22 // Int_t fParity; // parity
23 // Double_t fSpin; // spin
24 // Double_t fIsospin; // isospin
25 // Double_t fI3; // i3
26 // Int_t fStrangeness; // flavours are defined if i3 != -1
27 // Int_t fCharm; // 1 or -1 for C-particles, 0 for others
28 // Int_t fBeauty;
29 // Int_t fTop;
30 // Int_t fY; // X,Y: quantum numbers for the 4-th generation
31 // Int_t fX;
32 // Int_t fStable; // 1 if stable, 0 otherwise
33 //
34 // TObjArray* fDecayList; // array of decay channels
35 //
36 // TString fParticleClass; // lepton, meson etc
37 //
38 // Int_t fTrackingCode; // G3 tracking code of the particle
39 // TParticlePDG* fAntiParticle; // pointer to antiparticle
40 
41 #include "TDecayChannel.h"
42 #include "TParticlePDG.h"
43 #include "TDatabasePDG.h"
44 
46 
47 ////////////////////////////////////////////////////////////////////////////////
48 ///default constructor
49 
51 {
52  fPdgCode = 0;
53  fMass = 0;
54  fCharge = 0;
55  fLifetime = 0;
56  fWidth = 0;
57  fParity = 0;
58  fSpin = 0;
59  fIsospin = 0;
60  fI3 = 0;
61  fStrangeness = 0;
62  fCharm = 0;
63  fBeauty = 0;
64  fTop = 0;
65  fY = 0;
66  fX = 0;
67  fStable = 0;
68  fDecayList = 0;
69  fTrackingCode = 0;
70  fAntiParticle = 0;
71 }
72 
73 ////////////////////////////////////////////////////////////////////////////////
74 
75 TParticlePDG::TParticlePDG(const char* Name, const char* Title, Double_t aMass,
76  Bool_t aStable, Double_t aWidth, Double_t aCharge,
77  const char* aParticleClass, Int_t aPdgCode, Int_t Anti,
78  Int_t aTrackingCode)
79  : TNamed(Name,Title)
80 {
81  // empty for the time being
82  fLifetime = 0;
83  fParity = 0;
84  fSpin = 0;
85  fIsospin = 0;
86  fI3 = 0;
87  fStrangeness = 0;
88  fCharm = 0;
89  fBeauty = 0;
90  fTop = 0;
91  fY = 0;
92  fX = 0;
93  fStable = 0;
94 
95  fMass = aMass;
96  fStable = aStable;
97  fWidth = aWidth;
98  fCharge = aCharge;
99  fParticleClass = aParticleClass;
100  fPdgCode = aPdgCode;
101  fTrackingCode = aTrackingCode;
102  fDecayList = NULL;
103  if (Anti) fAntiParticle = this;
104  else fAntiParticle = 0;
105 
106  const Double_t kHbar = 6.58211889e-25; // GeV s
107  if (fWidth != 0.) fLifetime = kHbar / fWidth;
108 }
109 
110 ////////////////////////////////////////////////////////////////////////////////
111 ///copy constructor
112 
114  TNamed(pdg),
115  fPdgCode(pdg.fPdgCode),
116  fMass(pdg.fMass),
117  fCharge(pdg.fCharge),
118  fLifetime(pdg.fLifetime),
119  fWidth(pdg.fWidth),
120  fParity(pdg.fParity),
121  fSpin(pdg.fSpin),
122  fIsospin(pdg.fIsospin),
123  fI3(pdg.fI3),
124  fStrangeness(pdg.fStrangeness),
125  fCharm(pdg.fCharm),
126  fBeauty(pdg.fBeauty),
127  fTop(pdg.fTop),
128  fY(pdg.fY),
129  fX(pdg.fX),
130  fStable(pdg.fStable),
131  fDecayList(pdg.fDecayList),
132  fParticleClass(pdg.fParticleClass),
133  fTrackingCode(pdg.fTrackingCode),
134  fAntiParticle(pdg.fAntiParticle)
135 {
136 }
137 
138 ////////////////////////////////////////////////////////////////////////////////
139 ///assignement operator
140 
142 {
143  if(this!=&pdg) {
144  TNamed::operator=(pdg);
145  fPdgCode=pdg.fPdgCode;
146  fMass=pdg.fMass;
147  fCharge=pdg.fCharge;
148  fLifetime=pdg.fLifetime;
149  fWidth=pdg.fWidth;
150  fParity=pdg.fParity;
151  fSpin=pdg.fSpin;
152  fIsospin=pdg.fIsospin;
153  fI3=pdg.fI3;
155  fCharm=pdg.fCharm;
156  fBeauty=pdg.fBeauty;
157  fTop=pdg.fTop;
158  fY=pdg.fY;
159  fX=pdg.fX;
160  fStable=pdg.fStable;
165  }
166  return *this;
167 }
168 
169 ////////////////////////////////////////////////////////////////////////////////
170 ///destructor
171 
173  if (fDecayList) {
174  fDecayList->Delete();
175  delete fDecayList;
176  }
177 }
178 
179 
180 ////////////////////////////////////////////////////////////////////////////////
181 /// add new decay channel, Particle owns those...
182 
184  Double_t BranchingRatio,
185  Int_t NDaughters,
186  Int_t* DaughterPdgCode)
187 {
188  Int_t n = NDecayChannels();
189  if (NDecayChannels() == 0) {
190  fDecayList = new TObjArray(5);
191  }
192  TDecayChannel* dc = new TDecayChannel(n,Type,BranchingRatio,NDaughters,
193  DaughterPdgCode);
194  fDecayList->Add(dc);
195  return 0;
196 }
197 
198 ////////////////////////////////////////////////////////////////////////////////
199 ///return pointer to decay channel object at index i
200 
202 {
203  return (TDecayChannel*) fDecayList->At(i);
204 }
205 
206 ////////////////////////////////////////////////////////////////////////////////
207 ///print the list of decays
208 
210 {
211  if (strstr(option,"banner")) {
212  // print banner
213 
214  printf(" Channel Code BranchingRatio Nd ");
215  printf(" ...................Daughters.................... \n");
216  }
217  if (strstr(option,"data")) {
218 
220 
221  printf("%7i %5i %12.5e %5i ",
222  dc->Number(),
223  dc->MatrixElementCode(),
224  dc->BranchingRatio(),
225  dc->NDaughters());
226 
227  for (int i=0; i<dc->NDaughters(); i++) {
228  int ic = dc->DaughterPdgCode(i);
229  TParticlePDG* p = db->GetParticle(ic);
230  printf(" %15s(%8i)",p->GetName(),ic);
231  }
232  printf("\n");
233  }
234 }
235 
236 
237 ////////////////////////////////////////////////////////////////////////////////
238 ///
239 /// Print the entire information of this kind of particle
240 ///
241 
243 {
244  printf("%-20s %6d\t",GetName(),fPdgCode);
245  if (!fStable) {
246  printf("Mass:%9.4f Width (GeV):%11.4e\tCharge: %5.1f\n",
247  fMass, fWidth, fCharge);
248  } else {
249  printf("Mass:%9.4f Width (GeV): Stable\tCharge: %5.1f\n",
250  fMass, fCharge);
251  }
252  if (fDecayList) {
253  int banner_printed = 0;
255  TDecayChannel* dc;
256  while ((dc = (TDecayChannel*)next())) {
257  if (! banner_printed) {
258  PrintDecayChannel(dc,"banner");
259  banner_printed = 1;
260  }
261  PrintDecayChannel(dc,"data");
262  }
263  }
264 }
265 
An array of TObjects.
Definition: TObjArray.h:39
Int_t NDaughters()
Definition: TDecayChannel.h:48
ClassImp(TSeqCollection) Int_t TSeqCollection TIter next(this)
Return index of object in collection.
const char * Title
Definition: TXMLSetup.cxx:68
const char Option_t
Definition: RtypesCore.h:62
virtual void Delete(Option_t *option="")
Remove all objects from the array AND delete all heap based objects.
Definition: TObjArray.cxx:328
virtual void Print(Option_t *opt="") const
Print the entire information of this kind of particle.
Int_t fTrackingCode
Definition: TParticlePDG.h:51
TParticlePDG * GetParticle(Int_t pdgCode) const
Get a pointer to the particle object according to the MC code number.
virtual ~TParticlePDG()
destructor
Int_t fStrangeness
Definition: TParticlePDG.h:38
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
TParticlePDG & operator=(const TParticlePDG &)
assignement operator
Double_t fLifetime
Definition: TParticlePDG.h:32
TString fParticleClass
Definition: TParticlePDG.h:49
virtual void PrintDecayChannel(TDecayChannel *dc, Option_t *opt="") const
print the list of decays
TDecayChannel * DecayChannel(Int_t i)
return pointer to decay channel object at index i
const char * Name
Definition: TXMLSetup.cxx:67
static TDatabasePDG * Instance()
static function
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
Double_t fMass
Definition: TParticlePDG.h:30
Int_t DaughterPdgCode(Int_t i)
Definition: TDecayChannel.h:50
Int_t MatrixElementCode()
Definition: TDecayChannel.h:47
Double_t fCharge
Definition: TParticlePDG.h:31
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition: TNamed.cxx:40
Double_t fIsospin
Definition: TParticlePDG.h:36
TParticlePDG * fAntiParticle
Definition: TParticlePDG.h:52
Double_t fI3
Definition: TParticlePDG.h:37
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
Double_t fWidth
Definition: TParticlePDG.h:33
TObjArray * fDecayList
Definition: TParticlePDG.h:47
Int_t Number()
Definition: TDecayChannel.h:46
Type
enumeration specifying the integration types.
Int_t fPdgCode
Definition: TParticlePDG.h:29
Int_t NDecayChannels() const
Definition: TParticlePDG.h:90
ClassImp(TParticlePDG) TParticlePDG
default constructor
double Double_t
Definition: RtypesCore.h:55
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
Double_t fSpin
Definition: TParticlePDG.h:35
#define NULL
Definition: Rtypes.h:82
Double_t BranchingRatio()
Definition: TDecayChannel.h:49
void Add(TObject *obj)
Definition: TObjArray.h:75
TObject * At(Int_t idx) const
Definition: TObjArray.h:167
const Int_t n
Definition: legend1.C:16
Int_t AddDecayChannel(Int_t Type, Double_t BranchingRatio, Int_t NDaughters, Int_t *DaughterPdgCode)
add new decay channel, Particle owns those...