Logo ROOT  
Reference Guide
TDatabasePDG.h
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 #ifndef ROOT_TDatabasePDG
13 #define ROOT_TDatabasePDG
14 
15 #include "TParticlePDG.h"
16 #include "TParticleClassPDG.h"
17 
18 class THashList;
19 class TExMap;
20 
21 class TDatabasePDG: public TNamed {
22 
23 protected:
24  THashList *fParticleList; // list of PDG particles
25  TObjArray *fListOfClasses; // list of classes (leptons etc.)
26  mutable TExMap *fPdgMap; //!hash-map from pdg-code to particle
27 
28  // make copy-constructor and assigment protected since class cannot be copied
32 
34  {if(this!=&db) {TNamed::operator=(db); fParticleList=db.fParticleList;
36  return *this;}
37 
38  void BuildPdgMap() const;
39 
40 public:
41 
42  TDatabasePDG();
43  virtual ~TDatabasePDG();
44 
45  static TDatabasePDG* Instance();
46 
47  virtual TParticlePDG* AddParticle(const char* Name,
48  const char* Title,
49  Double_t Mass,
50  Bool_t Stable,
51  Double_t DecayWidth,
52  Double_t Charge,
53  const char* ParticleClass,
54  Int_t PdgCode,
55  Int_t Anti=-1,
56  Int_t TrackingCode=0);
57 
58  virtual Int_t ConvertGeant3ToPdg(Int_t Geant3Number) const;
59  virtual Int_t ConvertPdgToGeant3(Int_t pdgNumber) const;
60  virtual Int_t ConvertIsajetToPdg(Int_t isaNumber) const;
61 
62  virtual TParticlePDG* AddAntiParticle(const char* Name, Int_t PdgCode);
63 
64  TParticlePDG *GetParticle(Int_t pdgCode) const;
65  TParticlePDG *GetParticle(const char *name) const;
66 
68  if (fParticleList == 0) ((TDatabasePDG*)this)->ReadPDGTable();
70  }
71 
72  const THashList *ParticleList() const { return fParticleList; }
73 
74  virtual void Print(Option_t *opt = "") const;
75 
76  Bool_t IsFolder() const { return kTRUE; }
77  virtual void Browse(TBrowser* b);
78 
79  virtual void ReadPDGTable (const char *filename = "");
80  virtual Int_t WritePDGTable(const char *filename);
81 
82  ClassDef(TDatabasePDG, 3); // PDG particle database
83 };
84 
85 #endif
TDatabasePDG::IsFolder
Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition: TDatabasePDG.h:76
TDatabasePDG::fListOfClasses
TObjArray * fListOfClasses
Definition: TDatabasePDG.h:25
TParticleClassPDG.h
TBrowser
Using a TBrowser one can browse all ROOT objects.
Definition: TBrowser.h:37
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TObjArray
An array of TObjects.
Definition: TObjArray.h:37
Option_t
const char Option_t
Definition: RtypesCore.h:66
TDatabasePDG::ConvertPdgToGeant3
virtual Int_t ConvertPdgToGeant3(Int_t pdgNumber) const
Converts pdg code to geant3 id.
Definition: TDatabasePDG.cxx:329
TDatabasePDG::fParticleList
THashList * fParticleList
Definition: TDatabasePDG.h:24
TDatabasePDG::TDatabasePDG
TDatabasePDG(const TDatabasePDG &db)
hash-map from pdg-code to particle
Definition: TDatabasePDG.h:29
TNamed::operator=
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition: TNamed.cxx:51
TDatabasePDG::Instance
static TDatabasePDG * Instance()
static function
Definition: TDatabasePDG.cxx:106
TParticlePDG
Description of the static properties of a particle.
Definition: TParticlePDG.h:19
TDatabasePDG
Particle database manager class.
Definition: TDatabasePDG.h:21
Int_t
int Int_t
Definition: RtypesCore.h:45
xmlio::Title
const char * Title
Definition: TXMLSetup.cxx:68
TParticlePDG.h
TDatabasePDG::GetParticle
TParticlePDG * GetParticle(Int_t pdgCode) const
Get a pointer to the particle object according to the MC code number.
Definition: TDatabasePDG.cxx:232
TDatabasePDG::Print
virtual void Print(Option_t *opt="") const
Print contents of PDG database.
Definition: TDatabasePDG.cxx:243
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
b
#define b(i)
Definition: RSha256.hxx:100
bool
THashList
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition: THashList.h:34
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
TDatabasePDG::TDatabasePDG
TDatabasePDG()
Create PDG database.
Definition: TDatabasePDG.cxx:68
TParticleClassPDG
Utility class used internally by TDatabasePDG.
Definition: TParticleClassPDG.h:19
TDatabasePDG::ParticleList
const THashList * ParticleList() const
Definition: TDatabasePDG.h:72
TDatabasePDG::WritePDGTable
virtual Int_t WritePDGTable(const char *filename)
write contents of the particle DB into a file
Definition: TDatabasePDG.cxx:745
TDatabasePDG::~TDatabasePDG
virtual ~TDatabasePDG()
Cleanup the PDG database.
Definition: TDatabasePDG.cxx:85
TDatabasePDG::ConvertGeant3ToPdg
virtual Int_t ConvertGeant3ToPdg(Int_t Geant3Number) const
Converts Geant3 particle codes to PDG convention.
Definition: TDatabasePDG.cxx:266
TDatabasePDG::BuildPdgMap
void BuildPdgMap() const
Build fPdgMap mapping pdg-code to particle.
Definition: TDatabasePDG.cxx:123
xmlio::Name
const char * Name
Definition: TXMLSetup.cxx:67
Double_t
double Double_t
Definition: RtypesCore.h:59
TDatabasePDG::GetParticleClass
TParticleClassPDG * GetParticleClass(const char *name)
Definition: TDatabasePDG.h:67
TObjArray::FindObject
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:415
TDatabasePDG::fPdgMap
TExMap * fPdgMap
Definition: TDatabasePDG.h:26
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TDatabasePDG::operator=
TDatabasePDG & operator=(const TDatabasePDG &db)
Definition: TDatabasePDG.h:33
name
char name[80]
Definition: TGX11.cxx:110
TDatabasePDG::AddAntiParticle
virtual TParticlePDG * AddAntiParticle(const char *Name, Int_t PdgCode)
assuming particle has already been defined
Definition: TDatabasePDG.cxx:180
TExMap
This class stores a (key,value) pair using an external hash.
Definition: TExMap.h:33
TDatabasePDG::AddParticle
virtual TParticlePDG * AddParticle(const char *Name, const char *Title, Double_t Mass, Bool_t Stable, Double_t DecayWidth, Double_t Charge, const char *ParticleClass, Int_t PdgCode, Int_t Anti=-1, Int_t TrackingCode=0)
Particle definition normal constructor.
Definition: TDatabasePDG.cxx:143
TDatabasePDG::ReadPDGTable
virtual void ReadPDGTable(const char *filename="")
read list of particles from a file if the particle list does not exist, it is created,...
Definition: TDatabasePDG.cxx:559
TDatabasePDG::Browse
virtual void Browse(TBrowser *b)
browse data base
Definition: TDatabasePDG.cxx:736
TDatabasePDG::ConvertIsajetToPdg
virtual Int_t ConvertIsajetToPdg(Int_t isaNumber) const
Converts the ISAJET Particle number into the PDG MC number.
Definition: TDatabasePDG.cxx:388