Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
genie::PDGLibrary Class Reference

Singleton class to load & serve a TDatabasePDG. More...

#include <PDGLibrary.h>

Classes

struct  Cleaner
 

Public Member Functions

TDatabasePDG * DBase (void)
 
TParticlePDG * Find (int pdgc, bool must_exist=true)
 
void ReloadDBase (void)
 
void AddDarkMatter (double mass, double med_ratio)
 
void AddNHL (double mass)
 

Static Public Member Functions

static PDGLibraryInstance (void)
 

Private Member Functions

 PDGLibrary ()
 
 PDGLibrary (const PDGLibrary &config_pool)
 
virtual ~PDGLibrary ()
 
bool LoadDBase (void)
 
bool AddDarkSector ()
 

Private Attributes

TDatabasePDG * fDatabasePDG
 

Static Private Attributes

static PDGLibraryfInstance = 0
 

Friends

struct Cleaner
 

Detailed Description

Singleton class to load & serve a TDatabasePDG.

Author
Costas Andreopoulos <constantinos.andreopoulos cern.ch> University of Liverpool & STFC Rutherford Appleton Laboratory

Changes required to implement the GENIE Boosted Dark Matter module were installed by Josh Berger (Univ. of Wisconsin)

Changes required to implement the GENIE Dark Neutrino module were installed by Iker de Icaza (Univ. of Sussex)

May 06, 2004

Copyright (c) 2003-2020, The GENIE Collaboration For the full text of the license visit http://copyright.genie-mc.org

Definition at line 32 of file PDGLibrary.h.

Constructor & Destructor Documentation

PDGLibrary::PDGLibrary ( )
private

Definition at line 37 of file PDGLibrary.cxx.

38 {
39  if( ! LoadDBase() ) LOG("PDG", pERROR) << "Could not load PDG data";
40 
41 #ifdef __GENIE_DARK_NEUTRINO_ENABLED__
42  LOG("PDG", pINFO) << "Loading Dark sector Info";
43  if ( ! AddDarkSector() ) {
44  LOG("PDG", pFATAL) << "Could not load Dark Neutrino data";
45  exit(78);
46  }
47 #endif // __GENIE_DARK_NEUTRINO_ENABLED__
48 
49  fInstance = 0;
50 }
#define pERROR
Definition: Messenger.h:59
#define pFATAL
Definition: Messenger.h:56
static PDGLibrary * fInstance
Definition: PDGLibrary.h:58
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool LoadDBase(void)
Definition: PDGLibrary.cxx:89
#define pINFO
Definition: Messenger.h:62
genie::PDGLibrary::PDGLibrary ( const PDGLibrary config_pool)
private
PDGLibrary::~PDGLibrary ( )
privatevirtual

Definition at line 52 of file PDGLibrary.cxx.

53 {
54  fInstance = 0;
55 }
static PDGLibrary * fInstance
Definition: PDGLibrary.h:58

Member Function Documentation

void PDGLibrary::AddDarkMatter ( double  mass,
double  med_ratio 
)

Definition at line 142 of file PDGLibrary.cxx.

143 {
144 // Add dark matter particle to PDG database
145 
146  double med_mass = mass*med_ratio;
147  TParticlePDG * dm_particle = fDatabasePDG->GetParticle(kPdgDarkMatter);
148  TParticlePDG * med_particle = fDatabasePDG->GetParticle(kPdgMediator);
149  if (!dm_particle) {
150  // Name Title Mass Stable Width Charge Class PDG
151  fDatabasePDG->AddParticle("chi_dm","chi_dm",mass,true,0.,0,"DarkMatter",kPdgDarkMatter);
152  }
153  else {
154  assert(dm_particle->Mass() == mass);
155  }
156  if (!med_particle) {
157  // Name Title Mass Stable Width Charge Class PDG
158  fDatabasePDG->AddParticle("Z_prime","Z_prime",med_mass,true,0.,0,"DarkMatter",kPdgMediator);
159  }
160  else {
161  assert(med_particle->Mass() == med_mass);
162  }
163 }
const int kPdgMediator
Definition: PDGCodes.h:220
const int kPdgDarkMatter
Definition: PDGCodes.h:218
TDatabasePDG * fDatabasePDG
Definition: PDGLibrary.h:59
bool PDGLibrary::AddDarkSector ( )
private

Definition at line 179 of file PDGLibrary.cxx.

180 {
181  // Add dark neutrino particles to PDG database
182 
183  const Registry * reg = AlgConfigPool::Instance()->CommonList("Dark", "Masses");
184  if(!reg) {
185  LOG("PDG", pERROR) << "The Dark Sector masses not available.";
186  return false;
187  }
188  TParticlePDG * dnu_particle = fDatabasePDG->GetParticle(kPdgDarkNeutrino);
189  TParticlePDG * anti_dnu_particle = fDatabasePDG->GetParticle(kPdgAntiDarkNeutrino);
190  TParticlePDG * med_particle = fDatabasePDG->GetParticle(kPdgDNuMediator);
191  if (!dnu_particle) {
192  // Name Title Mass Stable Width Charge Class PDG
193  fDatabasePDG->AddParticle("nu_D","#nu_{D}",reg->GetDouble("Dark-NeutrinoMass"),
194  true,0.,0,"DarkNeutrino",kPdgDarkNeutrino);
195  }
196  if (!anti_dnu_particle) {
197  // Name Title Mass Stable Width Charge Class PDG
198  fDatabasePDG->AddParticle("nu_D_bar","#bar{#nu}_{D}",reg->GetDouble("Dark-NeutrinoMass"),
199  true,0.,0,"DarkNeutrino",kPdgAntiDarkNeutrino);
200  }
201  if (!med_particle) {
202  // Name Title Mass Stable Width Charge Class PDG
203  fDatabasePDG->AddParticle("Z_D","Z_{D}",reg->GetDouble("Dark-MediatorMass"),
204  true,0.,0,"DarkNeutrino",kPdgDNuMediator);
205  }
206  return true;
207 }
#define pERROR
Definition: Messenger.h:59
RgDbl GetDouble(RgKey key) const
Definition: Registry.cxx:474
TDatabasePDG * fDatabasePDG
Definition: PDGLibrary.h:59
const int kPdgAntiDarkNeutrino
Definition: PDGCodes.h:223
Registry * CommonList(const string &file_id, const string &set_name) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
const int kPdgDNuMediator
Definition: PDGCodes.h:224
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
const int kPdgDarkNeutrino
Definition: PDGCodes.h:222
static AlgConfigPool * Instance()
void PDGLibrary::AddNHL ( double  mass)

Definition at line 165 of file PDGLibrary.cxx.

166 {
167 // Add NHL to PDG database
168 
169  TParticlePDG * nhl = fDatabasePDG->GetParticle(kPdgNHL);
170  if (!nhl) {
171  // Name Title Mass Stable Width Charge Class PDG
172  fDatabasePDG->AddParticle("NHL","NHL",mass,true,0.,0,"NHL",kPdgNHL);
173  }
174  else {
175  assert(nhl->Mass() == mass);
176  }
177 }
TDatabasePDG * fDatabasePDG
Definition: PDGLibrary.h:59
const int kPdgNHL
Definition: PDGCodes.h:221
TDatabasePDG * PDGLibrary::DBase ( void  )

Definition at line 70 of file PDGLibrary.cxx.

71 {
72  return fDatabasePDG;
73 }
TDatabasePDG * fDatabasePDG
Definition: PDGLibrary.h:59
TParticlePDG * PDGLibrary::Find ( int  pdgc,
bool  must_exist = true 
)

Definition at line 75 of file PDGLibrary.cxx.

76 {
77 
78  TParticlePDG * ret = fDatabasePDG->GetParticle(pdgc);
79  if(ret) return ret;
80 
81  if ( must_exist ) {
82  LOG("PDG", pERROR) << "Requested missing particle with PDG: " << pdgc ;
83  }
84 
85  return ret ;
86 }
#define pERROR
Definition: Messenger.h:59
TDatabasePDG * fDatabasePDG
Definition: PDGLibrary.h:59
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
PDGLibrary * PDGLibrary::Instance ( void  )
static

Definition at line 57 of file PDGLibrary.cxx.

58 {
59  if(fInstance == 0) {
60  LOG("PDG", pINFO) << "PDGLibrary late initialization";
61 
62  static PDGLibrary::Cleaner cleaner;
64 
65  fInstance = new PDGLibrary;
66  }
67  return fInstance;
68 }
static PDGLibrary * fInstance
Definition: PDGLibrary.h:58
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
bool PDGLibrary::LoadDBase ( void  )
private

Definition at line 89 of file PDGLibrary.cxx.

90 {
91  fDatabasePDG = TDatabasePDG::Instance();
92 
93  // loading PDG data from $GENIE/config/
94  const char* altpdgtable = gSystem->Getenv("GENIE_PDG_TABLE");
95  if ( altpdgtable ) {
96  if ( ! (gSystem->AccessPathName(altpdgtable) ) ) {
97  LOG("PDG", pINFO) << "Load PDG data from $GENIE_PDG_TABLE: "
98  << altpdgtable;
99  fDatabasePDG->ReadPDGTable( altpdgtable );
100  return true;
101  }
102  }
103 
104  if ( gSystem->Getenv("GENIE") ) {
105  string base_dir = string( gSystem->Getenv("GENIE") );
106  base_dir += string("/data/evgen/catalogues/pdg/") ;
107 
108  string file_name = "genie_pdg_table.txt" ;
109  const Registry * reg = AlgConfigPool::Instance()->CommonList("Param", "PDG");
110  if( reg ) {
111  file_name = reg -> GetString("PDG-TableName") ;
112  LOG("PDG", pINFO) << "Found file name specification: " << file_name ;
113 
114  }
115 
116  string path = base_dir + file_name ;
117 
118  if ( ! (gSystem->AccessPathName(path.c_str()) ) ) {
119  LOG("PDG", pINFO) << "Load PDG data from: " << path;
120  fDatabasePDG->ReadPDGTable( path.c_str() );
121  return true;
122  }
123  }
124 
125  // no PDG data in $GENIE/config/ - Try $ROOTSYS/etc/
126 
127  if(gSystem->Getenv("ROOTSYS")) {
128  string base_dir = string( gSystem->Getenv("ROOTSYS") );
129  string path = base_dir + string("/etc/pdg_table.txt");
130 
131  if ( !(gSystem->AccessPathName(path.c_str())) ) {
132  LOG("PDG", pINFO) << "Load PDG data from: " << path;
133  fDatabasePDG->ReadPDGTable( path.c_str() );
134  return true;
135  }
136  }
137 
138  LOG("PDG", pERROR) << " *** The PDG extensions will not be loaded!! ***";
139  return false;
140 };
#define pERROR
Definition: Messenger.h:59
#define GetString
Definition: config.cpp:1232
std::string string
Definition: nybbler.cc:12
TDatabasePDG * fDatabasePDG
Definition: PDGLibrary.h:59
QCString file_name
Registry * CommonList(const string &file_id, const string &set_name) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
A registry. Provides the container for algorithm configuration parameters.
Definition: Registry.h:65
static AlgConfigPool * Instance()
void PDGLibrary::ReloadDBase ( void  )

Definition at line 210 of file PDGLibrary.cxx.

211 {
212  if(fDatabasePDG) {
213  delete fDatabasePDG;
214  }
215 
216  if( ! LoadDBase() ) LOG("PDG", pERROR) << "Could not load PDG data";
217 }
#define pERROR
Definition: Messenger.h:59
TDatabasePDG * fDatabasePDG
Definition: PDGLibrary.h:59
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
bool LoadDBase(void)
Definition: PDGLibrary.cxx:89

Friends And Related Function Documentation

friend struct Cleaner
friend

Definition at line 70 of file PDGLibrary.h.

Member Data Documentation

TDatabasePDG* genie::PDGLibrary::fDatabasePDG
private

Definition at line 59 of file PDGLibrary.h.

PDGLibrary * PDGLibrary::fInstance = 0
staticprivate

Definition at line 58 of file PDGLibrary.h.


The documentation for this class was generated from the following files: