LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
exgps.cc File Reference

Main program of the eventgenerator/exgps example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "GeometryConstruction.hh"
#include "PhysicsList.hh"
#include "ActionInitialization.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the eventgenerator/exgps example.

Definition in file exgps.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 56 of file exgps.cc.

56  {
57 
58  // Construct the default run manager
59 #ifdef G4MULTITHREADED
60  G4MTRunManager * runManager = new G4MTRunManager;
61  G4int nThreads = G4Threading::G4GetNumberOfCores();
62  if (argc==3) nThreads = G4UIcommand::ConvertToInt(argv[2]);
63  runManager->SetNumberOfThreads(nThreads);
64 #else
65  G4RunManager * runManager = new G4RunManager;
66 #endif
67 
68  // set mandatory initialization classes
69  GeometryConstruction* detector = new GeometryConstruction;
70  runManager->SetUserInitialization(detector);
71  runManager->SetUserInitialization(new PhysicsList);
72 
73  runManager->SetUserInitialization(new ActionInitialization);
74 
75 #ifdef G4VIS_USE
76  // visualization manager
77  G4VisManager* visManager = new G4VisExecutive;
78  visManager->Initialize();
79 #endif
80 
81  // get the pointer to the User Interface manager
82  G4UImanager* UImanager = G4UImanager::GetUIpointer();
83 
84  if (argc!=1) // batch mode
85  {
86  G4String command = "/control/execute ";
87  G4String fileName = argv[1];
88  UImanager->ApplyCommand(command+fileName);
89  }
90  else // interactive mode : define UI session
91  {
92 #ifdef G4UI_USE
93  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
94 #ifdef G4VIS_USE
95  UImanager->ApplyCommand("/control/execute vis.mac");
96 #endif
97  ui->SessionStart();
98  delete ui;
99 #endif
100 
101 #ifdef G4VIS_USE
102  delete visManager;
103 #endif
104  }
105 
106  // job termination
107  //
108  delete runManager;
109 
110  return 0;
111 }