TParticlePDG.cxx

Go to the documentation of this file.
00001 // @(#)root/eg:$Id: TParticlePDG.cxx 31956 2010-01-04 10:13:13Z brun $
00002 // Author: Pasha Murat   12/02/99
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 //______________________________________________________________________________
00013 //
00014 // Description of the static properties of a particle.
00015 // The class is typically generated by the TDatabasePDG class.
00016 // It is referenced by the dynamic particle class TParticle.
00017 //  Int_t            fPdgCode;          // PDG code of the particle
00018 //  Double_t         fMass;             // particle mass in GeV
00019 //  Double_t         fCharge;           // charge in units of |e|/3
00020 //  Double_t         fLifetime;         // proper lifetime in seconds
00021 //  Double_t         fWidth;            // total width in GeV
00022 //  Int_t            fParity;           // parity
00023 //  Double_t         fSpin;             // spin
00024 //  Double_t         fIsospin;          // isospin
00025 //  Double_t         fI3;               // i3
00026 //  Int_t            fStrangeness;      // flavours are defined if i3 != -1
00027 //  Int_t            fCharm;            // 1 or -1 for C-particles,  0 for others
00028 //  Int_t            fBeauty;
00029 //  Int_t            fTop;
00030 //  Int_t            fY;                // X,Y: quantum numbers for the 4-th generation
00031 //  Int_t            fX;
00032 //  Int_t            fStable;           // 1 if stable, 0 otherwise
00033 //                                        
00034 //  TObjArray*       fDecayList;        // array of decay channels
00035 //                                
00036 //  TString          fParticleClass;    // lepton, meson etc
00037 //
00038 //  Int_t            fTrackingCode;     // G3 tracking code of the particle
00039 //  TParticlePDG*    fAntiParticle;     // pointer to antiparticle
00040 
00041 #include "TDecayChannel.h"
00042 #include "TParticlePDG.h"
00043 #include "TDatabasePDG.h"
00044 
00045 ClassImp(TParticlePDG)
00046 
00047 //______________________________________________________________________________
00048 TParticlePDG::TParticlePDG()
00049 {
00050    //default constructor
00051    fPdgCode      = 0;
00052    fMass         = 0;
00053    fCharge       = 0;
00054    fLifetime     = 0;
00055    fWidth        = 0;
00056    fParity       = 0;
00057    fSpin         = 0;
00058    fIsospin      = 0;
00059    fI3           = 0;
00060    fStrangeness  = 0;
00061    fCharm        = 0;
00062    fBeauty       = 0;
00063    fTop          = 0;
00064    fY            = 0;
00065    fX            = 0;
00066    fStable       = 0;
00067    fDecayList    = 0;
00068    fTrackingCode = 0;
00069    fAntiParticle = 0;
00070 }
00071 
00072 //______________________________________________________________________________
00073 TParticlePDG::TParticlePDG(Int_t )
00074 {
00075    // empty for the time  being
00076 
00077    fPdgCode      = 0;
00078    fMass         = 0;
00079    fCharge       = 0;
00080    fLifetime     = 0;
00081    fWidth        = 0;
00082    fParity       = 0;
00083    fSpin         = 0;
00084    fIsospin      = 0;
00085    fI3           = 0;
00086    fStrangeness  = 0;
00087    fCharm        = 0;
00088    fBeauty       = 0;
00089    fTop          = 0;
00090    fY            = 0;
00091    fX            = 0;
00092    fStable       = 0;
00093    fDecayList    = 0;
00094    fTrackingCode = 0;
00095    fAntiParticle = 0;
00096 }
00097 
00098 //______________________________________________________________________________
00099 TParticlePDG::TParticlePDG(const char* Name, const char* Title, Double_t aMass,
00100                            Bool_t aStable, Double_t aWidth, Double_t aCharge,
00101                            const char* aParticleClass, Int_t aPdgCode, Int_t Anti,
00102                            Int_t aTrackingCode)
00103   : TNamed(Name,Title)
00104 {
00105 
00106    // empty for the time  being
00107    fLifetime      = 0;
00108    fParity        = 0;
00109    fSpin          = 0;
00110    fIsospin       = 0;
00111    fI3            = 0;
00112    fStrangeness   = 0;
00113    fCharm         = 0;
00114    fBeauty        = 0;
00115    fTop           = 0;
00116    fY             = 0;
00117    fX             = 0;
00118    fStable        = 0;
00119 
00120    fMass          = aMass;
00121    fStable        = aStable;
00122    fWidth         = aWidth;
00123    fCharge        = aCharge;
00124    fParticleClass = aParticleClass;
00125    fPdgCode       = aPdgCode;
00126    fTrackingCode  = aTrackingCode;
00127    fDecayList     = NULL;
00128    if (Anti) fAntiParticle = this;
00129    else      fAntiParticle = 0;
00130    
00131    const Double_t kHbar = 6.58211889e-25; // GeV s
00132    if (fWidth != 0.) fLifetime = kHbar / fWidth;
00133 }
00134 
00135 //______________________________________________________________________________
00136 TParticlePDG::TParticlePDG(const TParticlePDG& pdg) :
00137   TNamed(pdg),
00138   fPdgCode(pdg.fPdgCode),
00139   fMass(pdg.fMass),
00140   fCharge(pdg.fCharge),
00141   fLifetime(pdg.fLifetime),
00142   fWidth(pdg.fWidth),
00143   fParity(pdg.fParity),
00144   fSpin(pdg.fSpin),
00145   fIsospin(pdg.fIsospin),
00146   fI3(pdg.fI3),
00147   fStrangeness(pdg.fStrangeness),
00148   fCharm(pdg.fCharm),
00149   fBeauty(pdg.fBeauty),
00150   fTop(pdg.fTop),
00151   fY(pdg.fY),
00152   fX(pdg.fX),
00153   fStable(pdg.fStable),
00154   fDecayList(pdg.fDecayList),
00155   fParticleClass(pdg.fParticleClass),
00156   fTrackingCode(pdg.fTrackingCode),
00157   fAntiParticle(pdg.fAntiParticle)
00158 {
00159    //copy constructor
00160 }
00161 
00162 //______________________________________________________________________________
00163 TParticlePDG& TParticlePDG::operator=(const TParticlePDG& pdg)
00164 {
00165    //assignement operator
00166    if(this!=&pdg) {
00167       TNamed::operator=(pdg);
00168       fPdgCode=pdg.fPdgCode;
00169       fMass=pdg.fMass;
00170       fCharge=pdg.fCharge;
00171       fLifetime=pdg.fLifetime;
00172       fWidth=pdg.fWidth;
00173       fParity=pdg.fParity;
00174       fSpin=pdg.fSpin;
00175       fIsospin=pdg.fIsospin;
00176       fI3=pdg.fI3;
00177       fStrangeness=pdg.fStrangeness;
00178       fCharm=pdg.fCharm;
00179       fBeauty=pdg.fBeauty;
00180       fTop=pdg.fTop;
00181       fY=pdg.fY;
00182       fX=pdg.fX;
00183       fStable=pdg.fStable;
00184       fDecayList=pdg.fDecayList;
00185       fParticleClass=pdg.fParticleClass;
00186       fTrackingCode=pdg.fTrackingCode;
00187       fAntiParticle=pdg.fAntiParticle;
00188    }
00189    return *this;
00190 }
00191 
00192 //______________________________________________________________________________
00193 TParticlePDG::~TParticlePDG() {
00194    //destructor
00195    if (fDecayList) {
00196       fDecayList->Delete();
00197       delete fDecayList;
00198    }
00199 }
00200 
00201 
00202 //______________________________________________________________________________
00203 Int_t TParticlePDG::AddDecayChannel(Int_t        Type,
00204                                     Double_t     BranchingRatio,
00205                                     Int_t        NDaughters,
00206                                     Int_t*       DaughterPdgCode)
00207 {
00208    // add new decay channel, Particle owns those...
00209 
00210    Int_t n = NDecayChannels();
00211    if (NDecayChannels() == 0) {
00212       fDecayList = new TObjArray(5);
00213    }
00214    TDecayChannel* dc = new TDecayChannel(n,Type,BranchingRatio,NDaughters,
00215                                         DaughterPdgCode);
00216    fDecayList->Add(dc);
00217    return 0;
00218 }
00219 
00220 //_____________________________________________________________________________
00221 TDecayChannel* TParticlePDG::DecayChannel(Int_t i)
00222 {
00223    //return pointer to decay channel object at index i
00224    return (TDecayChannel*) fDecayList->At(i);
00225 }
00226 
00227 //_____________________________________________________________________________
00228 void TParticlePDG::PrintDecayChannel(TDecayChannel* dc, Option_t* option) const
00229 {
00230    //print the list of decays
00231    if (strstr(option,"banner")) {
00232                                 // print banner
00233 
00234       printf(" Channel Code BranchingRatio Nd  ");
00235       printf(" ...................Daughters.................... \n");
00236    }
00237    if (strstr(option,"data")) {
00238 
00239       TDatabasePDG* db = TDatabasePDG::Instance();
00240 
00241       printf("%7i %5i %12.5e %5i  ",
00242            dc->Number(),
00243            dc->MatrixElementCode(),
00244            dc->BranchingRatio(),
00245            dc->NDaughters());
00246 
00247       for (int i=0; i<dc->NDaughters(); i++) {
00248          int ic = dc->DaughterPdgCode(i);
00249          TParticlePDG* p = db->GetParticle(ic);
00250          printf(" %15s(%8i)",p->GetName(),ic);
00251       }
00252       printf("\n");
00253    }
00254 }
00255 
00256 
00257 //______________________________________________________________________________
00258 void TParticlePDG::Print(Option_t *) const
00259 {
00260 //
00261 //  Print the entire information of this kind of particle
00262 //
00263 
00264    printf("%-20s  %6d\t",GetName(),fPdgCode);
00265    if (!fStable) {
00266       printf("Mass:%9.4f Width (GeV):%11.4e\tCharge: %5.1f\n",
00267               fMass, fWidth, fCharge);
00268    } else {
00269       printf("Mass:%9.4f Width (GeV): Stable\tCharge: %5.1f\n",
00270               fMass, fCharge);
00271    }
00272    if (fDecayList) {
00273       int banner_printed = 0;
00274       TIter next(fDecayList);
00275       TDecayChannel* dc;
00276       while ((dc = (TDecayChannel*)next())) {
00277          if (! banner_printed) {
00278             PrintDecayChannel(dc,"banner");
00279             banner_printed = 1;
00280          }
00281          PrintDecayChannel(dc,"data");
00282       }
00283    }
00284 }
00285 

Generated on Tue Jul 5 14:45:15 2011 for ROOT_528-00b_version by  doxygen 1.5.1