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