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

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

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "Randomize.hh"
#include "DetectorConstruction.hh"
#include "PhysicsList.hh"
#include "ActionInitialization.hh"
#include "SteppingVerbose.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the electromagnetic/TestEm5 example.

Definition in file TestEm5.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file TestEm5.cc.

References G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4VisManager::Initialize(), G4UIExecutive::SessionStart(), G4VSteppingVerbose::SetInstance(), and G4RunManager::SetUserInitialization().

59  {
60 
61  //choose the Random engine
62  G4Random::setTheEngine(new CLHEP::RanecuEngine);
63 
64  // Construct the default run manager
65 #ifdef G4MULTITHREADED
66  G4MTRunManager* runManager = new G4MTRunManager;
67 #else
69  G4RunManager* runManager = new G4RunManager;
70 #endif
71 
72  // set mandatory initialization classes
74  runManager->SetUserInitialization(detector);
75  runManager->SetUserInitialization(new PhysicsList());
76 
77  // set user action classes
78  //
79  runManager->SetUserInitialization(new ActionInitialization(detector));
80 
81  // get the pointer to the User Interface manager
83 
84  if (argc!=1) // batch mode
85  {
86  G4String command = "/control/execute ";
87  G4String fileName = argv[1];
88  UI->ApplyCommand(command+fileName);
89  }
90 
91  else //define visualization and UI terminal for interactive mode
92  {
93 #ifdef G4VIS_USE
94  G4VisManager* visManager = new G4VisExecutive;
95  visManager->Initialize();
96 #endif
97 
98 #ifdef G4UI_USE
99  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
100  ui->SessionStart();
101  delete ui;
102 #endif
103 
104 #ifdef G4VIS_USE
105  delete visManager;
106 #endif
107  }
108 
109  // job termination
110  //
111  delete runManager;
112 
113  return 0;
114 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419