Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
PurgMag.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "PurgMagDetectorConstruction.hh"
#include "PurgMagPhysicsList.hh"
#include "PurgMagPrimaryGeneratorAction.hh"
#include "PurgMagRunAction.hh"
#include "PurgMagEventAction.hh"
#include "PurgMagTrackingAction.hh"
#include "PurgMagSteppingAction.hh"
#include "PurgMagSteppingVerbose.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 61 of file PurgMag.cc.

References G4UImanager::ApplyCommand(), G4cout, G4endl, G4UImanager::GetUIpointer(), G4RunManager::Initialize(), G4VisManager::Initialize(), G4UIExecutive::SessionStart(), G4VSteppingVerbose::SetInstance(), CLHEP::HepRandom::setTheEngine(), G4RunManager::SetUserAction(), and G4RunManager::SetUserInitialization().

61  {
62 
63  //choose the Random engine
65 
66  //PurgMag Verbose output class
68 
69  // Construct the default run manager
70  G4RunManager * runManager = new G4RunManager;
71 
72  // set mandatory initialization classes
74  runManager->SetUserInitialization(detector);
76 
78 
79 #ifdef G4VIS_USE
80  // visualization manager
81  G4VisManager* visManager = new G4VisExecutive;
82  visManager->Initialize();
83 #endif
84 
85 // output environment variables:
86 #ifdef G4ANALYSIS_USE
87  G4cout << G4endl << G4endl << G4endl
88  << " User Environment " << G4endl
89  << " Using AIDA 3.0 analysis " << G4endl;
90 # else
91  G4cout << G4endl << G4endl << G4endl
92  << " User Environment " << G4endl
93  << " G4ANALYSIS_USE environment variable not set, NO ANALYSIS "
94  << G4endl;
95 #endif
96 
97  // set user action classes
98  PurgMagRunAction* RunAct = new PurgMagRunAction();
99  runManager->SetUserAction(RunAct);
100  runManager->SetUserAction(new PurgMagEventAction());
101  runManager->SetUserAction(new PurgMagTrackingAction());
102  runManager->SetUserAction(new PurgMagSteppingAction(detector));
103 
104  //Initialize G4 kernel
105  runManager->Initialize();
106 
107  // get the pointer to the User Interface manager
108  G4UImanager* UImanager = G4UImanager::GetUIpointer();
109 
110 
111  if (argc==1) // Define UI session for interactive mode.
112  {
113 #ifdef G4UI_USE
114  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
115 #ifdef G4VIS_USE
116  UImanager->ApplyCommand("/control/execute vis.mac");
117 #endif
118  ui->SessionStart();
119  delete ui;
120 #endif
121  }
122  else // Batch mode
123  {
124  G4String command = "/control/execute ";
125  G4String fileName = argv[1];
126  UImanager->ApplyCommand(command+fileName);
127  }
128 
129 
130  // For bg jobs with 100000 events.
131  /*
132  int numberOfEvent = 100000;
133  runManager->BeamOn(numberOfEvent);
134  */
135 
136 
137  // job termination
138 #ifdef G4VIS_USE
139  delete visManager;
140 #endif
141  delete runManager;
142 
143  return 0;
144 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
G4GLOB_DLL std::ostream G4cout
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
virtual void Initialize()
#define G4endl
Definition: G4ios.hh:61
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:170
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)