1616#include " TParticlePDG.h"
1717#include < string>
1818
19- namespace o2 {
19+ namespace o2
20+ {
2021
2122// An ALICE specific extension of ROOT's TDatabasePDG
2223//
2324// By using O2DatabasePDG::Instance() in our code instead of
2425// TDatabasePDG::Instance(), correct initialization is guaranteed.
2526// Alternatively, a static function is exposed with which particles can be added
2627// to TDatabasePDG objects directly.
27- class O2DatabasePDG {
28+ class O2DatabasePDG
29+ {
2830 //
29- public:
30- static TDatabasePDG *Instance () {
31+ public:
32+ static TDatabasePDG* Instance ()
33+ {
3134 static bool initialized =
32- false ; // initialize this --> adds particles to TDatabasePDG;
35+ false ; // initialize this --> adds particles to TDatabasePDG;
3336 auto db = TDatabasePDG::Instance ();
3437 if (!initialized) {
3538 addALICEParticles (db);
@@ -39,11 +42,12 @@ class O2DatabasePDG {
3942 }
4043
4144 // adds ALICE particles to a given TDatabasePDG instance
42- static void addALICEParticles (TDatabasePDG * db = TDatabasePDG::Instance());
43- static void addParticlesFromExternalFile (TDatabasePDG * db);
45+ static void addALICEParticles (TDatabasePDG* db = TDatabasePDG::Instance());
46+ static void addParticlesFromExternalFile (TDatabasePDG* db);
4447
4548 // get particle's (if any) mass
46- static Double_t MassImpl (TParticlePDG *particle, bool &success) {
49+ static Double_t MassImpl (TParticlePDG* particle, bool & success)
50+ {
4751 success = false ;
4852 if (!particle) {
4953 return -1 .;
@@ -53,8 +57,9 @@ class O2DatabasePDG {
5357 }
5458
5559 // determine particle to get mass for based on PDG
56- static Double_t Mass (int pdg, bool &success,
57- TDatabasePDG *db = O2DatabasePDG::Instance()) {
60+ static Double_t Mass (int pdg, bool & success,
61+ TDatabasePDG* db = O2DatabasePDG::Instance())
62+ {
5863 if (pdg < IONBASELOW || pdg > IONBASEHIGH) {
5964 // not an ion, return immediately
6065 return MassImpl (db->GetParticle (pdg), success);
@@ -72,14 +77,15 @@ class O2DatabasePDG {
7277 // remove default constructor
7378 O2DatabasePDG () = delete ;
7479
75- private:
80+ private:
7681 static constexpr int IONBASELOW{1000000000 };
7782 static constexpr int IONBASEHIGH{1099999999 };
7883};
7984
8085// by keeping this inline, we can use it in other parts of the code, for
8186// instance Framework or Analysis, without needing to link against this library
82- inline void O2DatabasePDG::addALICEParticles (TDatabasePDG *db) {
87+ inline void O2DatabasePDG::addALICEParticles (TDatabasePDG* db)
88+ {
8389 //
8490 // Add ALICE particles to the ROOT PDG data base
8591 // Code has been taken from AliRoot
@@ -657,18 +663,19 @@ inline void O2DatabasePDG::addALICEParticles(TDatabasePDG *db) {
657663 addParticlesFromExternalFile (db);
658664}
659665
660- inline void O2DatabasePDG::addParticlesFromExternalFile (TDatabasePDG *db) {
666+ inline void O2DatabasePDG::addParticlesFromExternalFile (TDatabasePDG* db)
667+ {
661668 static bool initialized = false ;
662669 if (!initialized) {
663670 // allow user to specify custom file
664- if (const char * custom = std::getenv (" O2_SIM_CUSTOM_PDG" )) {
671+ if (const char * custom = std::getenv (" O2_SIM_CUSTOM_PDG" )) {
665672 // TODO: make sure this is a file
666673 db->ReadPDGTable (custom);
667- } else if (const char * o2Root = std::getenv (" O2_ROOT" )) {
674+ } else if (const char * o2Root = std::getenv (" O2_ROOT" )) {
668675 // take the maintained file from O2
669676 auto inputExtraPDGs =
670- std::string (o2Root) +
671- " /share/Detectors/gconfig/data/extra_ions_pdg_table.dat" ;
677+ std::string (o2Root) +
678+ " /share/Detectors/gconfig/data/extra_ions_pdg_table.dat" ;
672679 db->ReadPDGTable (inputExtraPDGs.c_str ());
673680 }
674681 initialized = true ;
0 commit comments