Skip to content
Snippets Groups Projects
Commit 210dc290 authored by matta adrien's avatar matta adrien
Browse files

* npsimulation now exit with error if the provided macro does not work:

        - However does not check that the provided file make sense for
          G4.
parent 5c85834f
No related branches found
No related tags found
No related merge requests found
...@@ -200,6 +200,7 @@ NPOptionManager::NPOptionManager(string arg){ ...@@ -200,6 +200,7 @@ NPOptionManager::NPOptionManager(string arg){
void NPOptionManager::CheckArguments(){ void NPOptionManager::CheckArguments(){
CheckEventGenerator(); CheckEventGenerator();
CheckDetectorConfiguration(); CheckDetectorConfiguration();
CheckG4Macro();
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
...@@ -263,6 +264,21 @@ void NPOptionManager::CheckDetectorConfiguration(){ ...@@ -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 // This method tests if the input files are the default ones
...@@ -324,6 +340,15 @@ void NPOptionManager::SendErrorAndExit(const char* type) const{ ...@@ -324,6 +340,15 @@ void NPOptionManager::SendErrorAndExit(const char* type) const{
} }
else if (stype == "RunToTreat") { 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 { else {
cout << "NPOptionManager::SendErrorAndExit() unkwown keyword" << endl; cout << "NPOptionManager::SendErrorAndExit() unkwown keyword" << endl;
} }
......
...@@ -71,6 +71,7 @@ class NPOptionManager{ ...@@ -71,6 +71,7 @@ class NPOptionManager{
void CheckArguments(); void CheckArguments();
void CheckEventGenerator(); void CheckEventGenerator();
void CheckDetectorConfiguration(); void CheckDetectorConfiguration();
void CheckG4Macro();
public: public:
bool IsDefault(const char* type) const; bool IsDefault(const char* type) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment