Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TestEm18.cc File Reference

Main program of the electromagnetic/TestEm18 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 "SteppingAction.hh"
#include "SteppingVerbose.hh"
#include "StackingAction.hh"
Include dependency graph for TestEm18.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the electromagnetic/TestEm18 example.

Definition in file TestEm18.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file TestEm18.cc.

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  DetectorConstruction* detector;
71  detector = new DetectorConstruction;
72  runManager->SetUserInitialization(detector);
73  runManager->SetUserInitialization(new PhysicsList());
74 
75  // set user action classes
76  //
77  //primaryGenerator
78  PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(detector);
79  runManager->SetUserAction(primary);
80 
81  //runAction
82  RunAction* runaction = new RunAction(detector,primary);
83  runManager->SetUserAction(runaction);
84 
85  //eventAction
86  EventAction* eventaction = new EventAction(runaction);
87  runManager->SetUserAction(eventaction);
88 
89  //stepAction
90  SteppingAction* steppingaction = new SteppingAction(runaction, eventaction);
91  runManager->SetUserAction(steppingaction);
92 
93  //stackAction
94  StackingAction* stackingaction = new StackingAction(runaction, eventaction);
95  runManager->SetUserAction(stackingaction);
96 
97  // get the pointer to the User Interface manager
99 
100  if (argc!=1) // batch mode
101  {
102  G4String command = "/control/execute ";
103  G4String fileName = argv[1];
104  UI->ApplyCommand(command+fileName);
105  }
106 
107  else //define visualization and UI terminal for interactive mode
108  {
109 #ifdef G4VIS_USE
110  G4VisManager* visManager = new G4VisExecutive;
111  visManager->Initialize();
112 #endif
113 
114 #ifdef G4UI_USE
115  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
116  ui->SessionStart();
117  delete ui;
118 #endif
119 
120 #ifdef G4VIS_USE
121  delete visManager;
122 #endif
123  }
124 
125  // job termination
126  //
127  delete runManager;
128 
129  return 0;
130 }
The primary generator action class with particle gun.
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
Event action class.
Definition: EventAction.hh:45
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
Detector construction class to define materials and geometry.
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:270
Run action class.
Definition: RunAction.hh:45
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
virtual void SetUserAction(G4UserRunAction *userAction)
Physics list class.
Definition: PhysicsList.hh:47

Here is the call graph for this function: