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){
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;
}
......
......@@ -71,6 +71,7 @@ class NPOptionManager{
void CheckArguments();
void CheckEventGenerator();
void CheckDetectorConfiguration();
void CheckG4Macro();
public:
bool IsDefault(const char* type) const;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment