Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
18class THashList;
19class TExMap;
20
21class TDatabasePDG: public TNamed {
22
23protected:
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 virtual void ReadPDGTableImpl(const char *filename, bool isParticleListInitializedWhenInvoking);
40
41public:
42
44 ~TDatabasePDG() override;
45
46 static TDatabasePDG* Instance();
47
48 virtual TParticlePDG* AddParticle(const char* Name,
49 const char* Title,
50 Double_t Mass,
51 Bool_t Stable,
52 Double_t DecayWidth,
53 Double_t Charge,
54 const char* ParticleClass,
55 Int_t PdgCode,
56 Int_t Anti=-1,
57 Int_t TrackingCode=0);
58
59 virtual Int_t ConvertGeant3ToPdg(Int_t Geant3Number) const;
60 virtual Int_t ConvertPdgToGeant3(Int_t pdgNumber) const;
61 virtual Int_t ConvertIsajetToPdg(Int_t isaNumber) const;
62
63 virtual TParticlePDG* AddAntiParticle(const char* Name, Int_t PdgCode);
64
65 TParticlePDG *GetParticle(Int_t pdgCode) const;
66 TParticlePDG *GetParticle(const char *name) const;
67
69 if (fParticleList == 0) ((TDatabasePDG*)this)->ReadPDGTable();
71 }
72
73 const THashList *ParticleList() const { return fParticleList; }
74
75 void Print(Option_t *opt = "") const override;
76
77 Bool_t IsFolder() const override { return kTRUE; }
78 void Browse(TBrowser* b) override;
79
80 virtual void ReadPDGTable (const char *filename = "");
81 virtual Int_t WritePDGTable(const char *filename);
82
83 ClassDefOverride(TDatabasePDG, 3); // PDG particle database
84};
85
86#endif
#define b(i)
Definition RSha256.hxx:100
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
char name[80]
Definition TGX11.cxx:110
Using a TBrowser one can browse all ROOT objects.
Definition TBrowser.h:37
Particle database manager class.
virtual Int_t WritePDGTable(const char *filename)
write contents of the particle DB into a file
static TDatabasePDG * Instance()
static function
virtual Int_t ConvertGeant3ToPdg(Int_t Geant3Number) const
Converts Geant3 particle codes to PDG convention.
virtual Int_t ConvertPdgToGeant3(Int_t pdgNumber) const
Converts pdg code to geant3 id.
void BuildPdgMap() const
Build fPdgMap mapping pdg-code to particle.
const THashList * ParticleList() const
virtual Int_t ConvertIsajetToPdg(Int_t isaNumber) const
Converts the ISAJET Particle number into the PDG MC number.
TParticleClassPDG * GetParticleClass(const char *name)
TParticlePDG * GetParticle(Int_t pdgCode) const
Get a pointer to the particle object according to the MC code number.
TDatabasePDG(const TDatabasePDG &db)
hash-map from pdg-code to particle
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.
Bool_t IsFolder() const override
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
TDatabasePDG()
Create PDG database.
~TDatabasePDG() override
Cleanup the PDG database.
TExMap * fPdgMap
void Print(Option_t *opt="") const override
Print contents of PDG database.
virtual TParticlePDG * AddAntiParticle(const char *Name, Int_t PdgCode)
assuming particle has already been defined
THashList * fParticleList
TObjArray * fListOfClasses
virtual void ReadPDGTableImpl(const char *filename, bool isParticleListInitializedWhenInvoking)
void Browse(TBrowser *b) override
browse data base
virtual void ReadPDGTable(const char *filename="")
read list of particles from a file if the particle list does not exist, it is created,...
TDatabasePDG & operator=(const TDatabasePDG &db)
This class stores a (key,value) pair using an external hash.
Definition TExMap.h:33
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
Definition THashList.h:34
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
TNamed & operator=(const TNamed &rhs)
TNamed assignment operator.
Definition TNamed.cxx:51
An array of TObjects.
Definition TObjArray.h:31
TObject * FindObject(const char *name) const override
Find an object in this collection using its name.
Utility class used internally by TDatabasePDG.
Description of the static properties of a particle.