22#include " gphysics.h"
33#include " gphysicsConventions.h"
44
5- // glibrary
5+ // gemc
66#include " gutilities.h"
77
88// geant4 version
99#include " G4Version.hh"
1010
11- // c++
12- using namespace std ;
1311
1412// geant4
1513
@@ -29,8 +27,8 @@ using namespace std;
2927#include " G4PhysicsConstructorFactory.hh"
3028
3129
32- GPhysics::GPhysics (GOptions *gopts) : physList(nullptr ) {
33-
30+ GPhysics::GPhysics (GOptions *gopts, std::shared_ptr<GLogger> logger ) : physList(nullptr ), log(logger ) {
31+ log-> debug ( CONSTRUCTOR , " GPhysics " );
3432
3533 bool showPhys = gopts->getSwitch (" showAvailablePhysics" );
3634 bool showPhysX = gopts->getSwitch (" showAvailablePhysicsX" );
@@ -50,31 +48,35 @@ GPhysics::GPhysics(GOptions *gopts) : physList(nullptr) {
5048 // would make this a drop-in replacement, but we'll list the explicit
5149 // namespace here just for clarity
5250 g4alt::G4PhysListFactory factory;
53- string g4physList = removeAllSpacesFromString (gphysList);
51+ string g4physList = gutilities:: removeAllSpacesFromString (gphysList);
5452
5553 physList = factory.GetReferencePhysList (g4physList);
5654
5755 if (!physList) {
58- cerr << FATALERRORL << " physics list <" << gphysList << " > could not be loaded." << endl;
59- gexit (EC__PHYSLISTERROR );
56+ log->error (ERR_PHYSLISTERROR , " physics list <" + gphysList + " > could not be loaded." );
6057 }
6158
62- cout << GPHYSLOGHEADER << " Geant4 physics list : <" << g4physList << " >" << endl ;
59+ log-> info ( 0 , " G4PhysListFactory : <" + g4physList + " > loaded. " ) ;
6360}
6461
65- GPhysics::~GPhysics () {}
62+ GPhysics::~GPhysics () {
63+ log->debug (DESTRUCTOR , " GPhysics" );
64+ }
6665
6766
6867// calls PrintAvailablePhysLists
6968// if verbosity is > 0 calls PrintAvailablePhysicsConstructors
7069void GPhysics::printAvailable () {
7170
72- cout << endl << " Geant4 Version " << replaceCharInStringWithChars (G4Version, " $" , " " ) << " " << G4Date << endl << endl;
71+ string g4ver = gutilities::replaceCharInStringWithChars (G4Version, " $" , " " );
72+
73+ log->info (0 , " Geant4 Version " , g4ver, " " , G4Date);;
7374
7475 g4alt::G4PhysListFactory factory;
7576 factory.PrintAvailablePhysLists ();
7677
77- G4cout << GPHYSLOGHEADER << " Geant4 available physics constructor that can be added to physicsList:" << G4endl;
78+ log->info (0 , " Available Geant4 Physics Lists:" );
79+
7880 G4PhysicsConstructorRegistry *g4pctorFactory = G4PhysicsConstructorRegistry::Instance ();
7981 g4pctorFactory->PrintAvailablePhysicsConstructors ();
8082
0 commit comments