Import Geant4 9.6.0 source tree
This commit is contained in:
@@ -49,8 +49,35 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
namespace {
|
||||
void PrintUsage() {
|
||||
G4cerr << " Usage: " << G4endl;
|
||||
G4cerr << " exampleB4d [-m macro ] [-u UIsession]" << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
int main(int argc,char** argv)
|
||||
{
|
||||
// Evaluate arguments
|
||||
//
|
||||
if ( argc > 5 ) {
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
G4String macro;
|
||||
G4String session;
|
||||
for ( G4int i=1; i<argc; i=i+2 ) {
|
||||
if ( G4String(argv[i]) == "-m" ) macro = argv[i+1];
|
||||
else if ( G4String(argv[i]) == "-u" ) session = argv[i+1];
|
||||
else {
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Choose the Random engine
|
||||
//
|
||||
CLHEP::HepRandom::setTheEngine(new CLHEP::RanecuEngine);
|
||||
@@ -91,27 +118,26 @@ int main(int argc,char** argv)
|
||||
// Get the pointer to the User Interface manager
|
||||
G4UImanager* UImanager = G4UImanager::GetUIpointer();
|
||||
|
||||
if (argc!=1) // batch mode
|
||||
{
|
||||
G4String command = "/control/execute ";
|
||||
G4String fileName = argv[1];
|
||||
UImanager->ApplyCommand(command+fileName);
|
||||
}
|
||||
else
|
||||
{ // interactive mode : define UI session
|
||||
if ( macro.size() ) {
|
||||
// batch mode
|
||||
G4String command = "/control/execute ";
|
||||
UImanager->ApplyCommand(command+macro);
|
||||
}
|
||||
else {
|
||||
// interactive mode : define UI session
|
||||
#ifdef G4UI_USE
|
||||
G4UIExecutive* ui = new G4UIExecutive(argc, argv);
|
||||
G4UIExecutive* ui = new G4UIExecutive(argc, argv, session);
|
||||
#ifdef G4VIS_USE
|
||||
UImanager->ApplyCommand("/control/execute init_vis.mac");
|
||||
UImanager->ApplyCommand("/control/execute init_vis.mac");
|
||||
#else
|
||||
UImanager->ApplyCommand("/control/execute init.mac");
|
||||
UImanager->ApplyCommand("/control/execute init.mac");
|
||||
#endif
|
||||
if (ui->IsGUI())
|
||||
UImanager->ApplyCommand("/control/execute gui.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
if (ui->IsGUI())
|
||||
UImanager->ApplyCommand("/control/execute gui.mac");
|
||||
ui->SessionStart();
|
||||
delete ui;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// Job termination
|
||||
// Free the store: user actions, physics_list and detector_description are
|
||||
|
||||
Reference in New Issue
Block a user