2020#include " TParticlePDG.h"
2121#include < string>
2222
23- namespace o2 {
23+ namespace o2
24+ {
2425
2526// An ALICE specific extension of ROOT's TDatabasePDG
2627//
2728// By using O2DatabasePDG::Instance() in our code instead of
2829// TDatabasePDG::Instance(), correct initialization is guaranteed.
2930// Alternatively, a static function is exposed with which particles can be added
3031// to TDatabasePDG objects directly.
31- class O2DatabasePDG {
32+ class O2DatabasePDG
33+ {
3234 //
33- public:
34- static TDatabasePDG *Instance () {
35+ public:
36+ static TDatabasePDG* Instance ()
37+ {
3538 static bool initialized =
36- false ; // initialize this --> adds particles to TDatabasePDG;
39+ false ; // initialize this --> adds particles to TDatabasePDG;
3740 auto db = TDatabasePDG::Instance ();
3841 if (!initialized) {
3942 addALICEParticles (db);
@@ -43,11 +46,12 @@ class O2DatabasePDG {
4346 }
4447
4548 // adds ALICE particles to a given TDatabasePDG instance
46- static void addALICEParticles (TDatabasePDG * db = TDatabasePDG::Instance());
47- static void addParticlesFromExternalFile (TDatabasePDG * db);
49+ static void addALICEParticles (TDatabasePDG* db = TDatabasePDG::Instance());
50+ static void addParticlesFromExternalFile (TDatabasePDG* db);
4851
4952 // get particle's (if any) mass
50- static Double_t MassImpl (TParticlePDG *particle, bool &success) {
53+ static Double_t MassImpl (TParticlePDG* particle, bool & success)
54+ {
5155 success = false ;
5256 if (!particle) {
5357 return -1 .;
@@ -57,8 +61,9 @@ class O2DatabasePDG {
5761 }
5862
5963 // determine particle to get mass for based on PDG
60- static Double_t Mass (int pdg, bool &success,
61- TDatabasePDG *db = O2DatabasePDG::Instance()) {
64+ static Double_t Mass (int pdg, bool & success,
65+ TDatabasePDG* db = O2DatabasePDG::Instance())
66+ {
6267 if (pdg < IONBASELOW || pdg > IONBASEHIGH) {
6368 // not an ion, return immediately
6469 return MassImpl (db->GetParticle (pdg), success);
@@ -76,14 +81,15 @@ class O2DatabasePDG {
7681 // remove default constructor
7782 O2DatabasePDG () = delete ;
7883
79- private:
84+ private:
8085 static constexpr int IONBASELOW{1000000000 };
8186 static constexpr int IONBASEHIGH{1099999999 };
8287};
8388
8489// by keeping this inline, we can use it in other parts of the code, for
8590// instance Framework or Analysis, without needing to link against this library
86- inline void O2DatabasePDG::addALICEParticles (TDatabasePDG *db) {
91+ inline void O2DatabasePDG::addALICEParticles (TDatabasePDG* db)
92+ {
8793 //
8894 // Add ALICE particles to the ROOT PDG data base
8995 // Code has been taken from AliRoot
@@ -685,18 +691,19 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG *db) {
685691 addParticlesFromExternalFile (db);
686692}
687693
688- inline void O2DatabasePDG::addParticlesFromExternalFile (TDatabasePDG *db) {
694+ inline void O2DatabasePDG::addParticlesFromExternalFile (TDatabasePDG* db)
695+ {
689696 static bool initialized = false ;
690697 if (!initialized) {
691698 // allow user to specify custom file
692- if (const char * custom = std::getenv (" O2_SIM_CUSTOM_PDG" )) {
699+ if (const char * custom = std::getenv (" O2_SIM_CUSTOM_PDG" )) {
693700 // TODO: make sure this is a file
694701 db->ReadPDGTable (custom);
695- } else if (const char * o2Root = std::getenv (" O2_ROOT" )) {
702+ } else if (const char * o2Root = std::getenv (" O2_ROOT" )) {
696703 // take the maintained file from O2
697704 auto inputExtraPDGs =
698- std::string (o2Root) +
699- " /share/Detectors/gconfig/data/extra_ions_pdg_table.dat" ;
705+ std::string (o2Root) +
706+ " /share/Detectors/gconfig/data/extra_ions_pdg_table.dat" ;
700707 db->ReadPDGTable (inputExtraPDGs.c_str ());
701708 }
702709 initialized = true ;
0 commit comments