diff --git a/NPLib/Core/NPOptionManager.cxx b/NPLib/Core/NPOptionManager.cxx index 55f18653826b6a2da65c5f29ef3433c2d55533e7..8ec2720fc387a08a3c3141755a62cc1bceb2f59f 100644 --- a/NPLib/Core/NPOptionManager.cxx +++ b/NPLib/Core/NPOptionManager.cxx @@ -200,6 +200,7 @@ NPOptionManager::NPOptionManager(string arg){ void NPOptionManager::CheckArguments(){ CheckEventGenerator(); CheckDetectorConfiguration(); + CheckG4Macro(); } //////////////////////////////////////////////////////////////////////////////// @@ -263,6 +264,21 @@ void NPOptionManager::CheckDetectorConfiguration(){ } +//////////////////////////////////////////////////////////////////////////////// +void NPOptionManager::CheckG4Macro(){ + if(IsDefault("G4MacroPath")) + return ; + + // ifstream to configfile + ifstream MacroFile( fG4MacroPath ); + + if (!MacroFile.is_open()) { + SendErrorAndExit("G4MacroPath"); + } + +} + + //////////////////////////////////////////////////////////////////////////////// // This method tests if the input files are the default ones @@ -324,6 +340,15 @@ void NPOptionManager::SendErrorAndExit(const char* type) const{ } else if (stype == "RunToTreat") { } + else if (stype == "G4MacroPath") { + cout << endl; + cout << "*********************************** Error ***********************************" << endl; + cout << "* No Geant4 macro file found in the provided path *" << endl; + cout << "*****************************************************************************************" << endl; + cout << endl; + exit(1); + } + else { cout << "NPOptionManager::SendErrorAndExit() unkwown keyword" << endl; } diff --git a/NPLib/Core/NPOptionManager.h b/NPLib/Core/NPOptionManager.h index b6b6308ddd4aef4c1b07ef590a4c780a18f7b2e5..dc9941ceb5713793ee615f1a02f4ef7179de8e82 100644 --- a/NPLib/Core/NPOptionManager.h +++ b/NPLib/Core/NPOptionManager.h @@ -71,6 +71,7 @@ class NPOptionManager{ void CheckArguments(); void CheckEventGenerator(); void CheckDetectorConfiguration(); + void CheckG4Macro(); public: bool IsDefault(const char* type) const;