Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
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 
15 Description of the static properties of a particle.
16 
17 The class is typically generated by the TDatabasePDG class.
18 It 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 ClassImp(TParticlePDG);
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 ///default constructor
54 
55 TParticlePDG::TParticlePDG()
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 
81 TParticlePDG::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 
119 TParticlePDG::TParticlePDG(const TParticlePDG& pdg) :
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 
147 TParticlePDG& TParticlePDG::operator=(const TParticlePDG& pdg)
148 {
149  if(this!=&pdg) {
150  TNamed::operator=(pdg);
151  fPdgCode=pdg.fPdgCode;
152  fMass=pdg.fMass;
153  fCharge=pdg.fCharge;
154  fLifetime=pdg.fLifetime;
155  fWidth=pdg.fWidth;
156  fParity=pdg.fParity;
157  fSpin=pdg.fSpin;
158  fIsospin=pdg.fIsospin;
159  fI3=pdg.fI3;
160  fStrangeness=pdg.fStrangeness;
161  fCharm=pdg.fCharm;
162  fBeauty=pdg.fBeauty;
163  fTop=pdg.fTop;
164  fY=pdg.fY;
165  fX=pdg.fX;
166  fStable=pdg.fStable;
167  fDecayList=pdg.fDecayList;
168  fParticleClass=pdg.fParticleClass;
169  fTrackingCode=pdg.fTrackingCode;
170  fAntiParticle=pdg.fAntiParticle;
171  }
172  return *this;
173 }
174 
175 ////////////////////////////////////////////////////////////////////////////////
176 ///destructor
177 
178 TParticlePDG::~TParticlePDG() {
179  if (fDecayList) {
180  fDecayList->Delete();
181  delete fDecayList;
182  }
183 }
184 
185 
186 ////////////////////////////////////////////////////////////////////////////////
187 /// add new decay channel, Particle owns those...
188 
189 Int_t TParticlePDG::AddDecayChannel(Int_t Type,
190  Double_t BranchingRatio,
191  Int_t NDaughters,
192  Int_t* DaughterPdgCode)
193 {
194  Int_t n = NDecayChannels();
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 
207 TDecayChannel* TParticlePDG::DecayChannel(Int_t i)
208 {
209  return (TDecayChannel*) fDecayList->At(i);
210 }
211 
212 ////////////////////////////////////////////////////////////////////////////////
213 /// print the list of decays
214 
215 void TParticlePDG::PrintDecayChannel(TDecayChannel* dc, Option_t* option) const
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 
225  TDatabasePDG* db = TDatabasePDG::Instance();
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 
248 void TParticlePDG::Print(Option_t *) const
249 {
250  printf("%-20s %6d\t",GetName(),fPdgCode);
251  if (!fStable) {
252  printf("Mass:%9.4f Width (GeV):%11.4e\tCharge: %5.1f\n",
253  fMass, fWidth, fCharge);
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