Compare commits
1 Commits
master
...
Correct_Ru
Author | SHA1 | Date | |
---|---|---|---|
9075f52eca |
@ -1,3 +1,4 @@
|
||||
#include <regex>
|
||||
#include "musrDetectorConstruction.hh"
|
||||
#include "musrPhysicsList.hh"
|
||||
#include "musrPrimaryGeneratorAction.hh"
|
||||
@ -76,9 +77,13 @@ int main(int argc,char** argv) {
|
||||
|
||||
// UserInitialization classes (mandatory)
|
||||
// musrDetectorConstruction* musrdetector = new musrDetectorConstruction;
|
||||
//Allow for argv[1] generic paths and only extract the runnumber before .mac
|
||||
if (argc>1) {
|
||||
G4int myRunNr=atoi(argv[1]); // Get the run number from the name of the
|
||||
// parameter file, if it starts with a number.
|
||||
std::regex pattern(R"((\d+)(?=(?=[^/]*\.mac$)))"); // for an input like /some/path987/1234.mac for argv[1]. Matches last number (1234) before ".mac"
|
||||
std::smatch match;
|
||||
G4int myRunNr = 0;
|
||||
std::string argv1str(argv[1]);
|
||||
if (std::regex_search(argv1str, match, pattern)) myRunNr = G4int(std::stoi(match.str(1)));
|
||||
if (myRunNr>0) {runManager->SetRunIDCounter(myRunNr);}
|
||||
// musrdetector->SetInputParameterFileName(argv[1]);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user