Logo ROOT   6.08/07
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 /** \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 
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 
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 
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),
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),
141 {
142 }
143 
144 ////////////////////////////////////////////////////////////////////////////////
145 ///assignement operator
146 
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;
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) {
180  fDecayList->Delete();
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 {
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 
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",
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 
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
An array of TObjects.
Definition: TObjArray.h:39
Int_t NDaughters()
Definition: TDecayChannel.h:48
Description of the decay channel.
Definition: TDecayChannel.h:28
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:329
Int_t fTrackingCode
Definition: TParticlePDG.h:51
Int_t NDecayChannels() const
Definition: TParticlePDG.h:90
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
TObject * At(Int_t idx) const
Definition: TObjArray.h:167
Double_t fLifetime
Definition: TParticlePDG.h:32
TString fParticleClass
Definition: TParticlePDG.h:49
TDecayChannel * DecayChannel(Int_t i)
return pointer to decay channel object at index i
const char * Name
Definition: TXMLSetup.cxx:67
Particle database manager class.
Definition: TDatabasePDG.h:25
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
virtual void Print(Option_t *opt="") const
Print the entire information of this kind of particle.
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:42
Double_t fIsospin
Definition: TParticlePDG.h:36
virtual void PrintDecayChannel(TDecayChannel *dc, Option_t *opt="") const
print the list of decays
TParticlePDG * fAntiParticle
Definition: TParticlePDG.h:52
Double_t fI3
Definition: TParticlePDG.h:37
Description of the static properties of a particle.
Definition: TParticlePDG.h:23
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
#define ClassImp(name)
Definition: Rtypes.h:279
double Double_t
Definition: RtypesCore.h:55
TParticlePDG * GetParticle(Int_t pdgCode) const
Get a pointer to the particle object according to the MC code number.
Double_t fSpin
Definition: TParticlePDG.h:35
#define NULL
Definition: Rtypes.h:82
TParticlePDG()
default constructor
Double_t BranchingRatio()
Definition: TDecayChannel.h:49
void Add(TObject *obj)
Definition: TObjArray.h:75
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...