Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
TestEm8.cc File Reference

Main program of the electromagnetic/TestEm8 example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "StackingAction.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the electromagnetic/TestEm8 example.

Definition in file TestEm8.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 55 of file TestEm8.cc.

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

56 {
57  //choose the Random engine
59 
60  // Construct the default run manager
61  G4RunManager * runManager = new G4RunManager;
62 
63  // set mandatory initialization classes
64  runManager->SetUserInitialization(new PhysicsList);
66  runManager->SetUserInitialization(new DetectorConstruction(gun));
67 
68  // set user action classes
69  runManager->SetUserAction(gun);
70  runManager->SetUserAction(new RunAction());
71  runManager->SetUserAction(new EventAction());
72  runManager->SetUserAction(new StackingAction());
73 
75 
76  if (argc!=1) // batch mode
77  {
78  G4String command = "/control/execute ";
79  G4String fileName = argv[1];
80  UI->ApplyCommand(command+fileName);
81  }
82 
83  else //define visualization and UI terminal for interactive mode
84  {
85 #ifdef G4VIS_USE
86  G4VisManager* visManager = new G4VisExecutive;
87  visManager->Initialize();
88 #endif
89 
90 #ifdef G4UI_USE
91  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
92  ui->SessionStart();
93  delete ui;
94 #endif
95 
96 #ifdef G4VIS_USE
97  delete visManager;
98 #endif
99  }
100 
101  // job termination
102  //
103  delete runManager;
104 
105  return 0;
106 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:170
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)