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

Main program of the electromagnetic/TestEm7 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 "TrackingAction.hh"
#include "SteppingAction.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/TestEm7 example.

Definition in file TestEm7.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file TestEm7.cc.

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

58  {
59 
60  //choose the Random engine
62 
63  //my Verbose output class
65 
66  //Construct the default run manager
67  G4RunManager * runManager = new G4RunManager;
68 
69  //set mandatory initialization classes
70  //
72  PhysicsList* phys = new PhysicsList();
73 
74  runManager->SetUserInitialization(det);
75  runManager->SetUserInitialization(phys);
76 
77  //set user action classes
78  //
80  RunAction* run = new RunAction(det,phys,kin);
81  EventAction* event = new EventAction();
82  TrackingAction* track = new TrackingAction(det,run);
83  SteppingAction* step = new SteppingAction(det,run);
84 
85  runManager->SetUserAction(kin);
86  runManager->SetUserAction(run);
87  runManager->SetUserAction(event);
88  runManager->SetUserAction(track);
89  runManager->SetUserAction(step);
90 
91  //get the pointer to the User Interface manager
93 
94  if (argc!=1) // batch mode
95  {
96  G4String command = "/control/execute ";
97  G4String fileName = argv[1];
98  UI->ApplyCommand(command+fileName);
99  }
100 
101  else //define visualization and UI terminal for interactive mode
102  {
103 #ifdef G4VIS_USE
104  G4VisManager* visManager = new G4VisExecutive;
105  visManager->Initialize();
106 #endif
107 
108 #ifdef G4UI_USE
109  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
110  ui->SessionStart();
111  delete ui;
112 #endif
113 
114 #ifdef G4VIS_USE
115  delete visManager;
116 #endif
117  }
118 
119  //job termination
120  //
121  delete runManager;
122 
123  return 0;
124 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:170
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)