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

Main program of the electromagnetic/TestEm17 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 "HistoManager.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the electromagnetic/TestEm17 example.

Definition in file TestEm17.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 60 of file TestEm17.cc.

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

60  {
61 
62  //choose the Random engine
64 
65  //my Verbose output class
67 
68  // Construct the default run manager
69  G4RunManager * runManager = new G4RunManager;
70 
71  // set mandatory initialization classes
74  runManager->SetUserInitialization(det = new DetectorConstruction);
75  runManager->SetUserInitialization(new PhysicsList);
76  runManager->SetUserAction(prim = new PrimaryGeneratorAction(det));
77 
78  HistoManager* histo = new HistoManager();
79 
80  // set user action classes
81  RunAction* run;
82  runManager->SetUserAction(run = new RunAction(det,prim,histo));
83  runManager->SetUserAction(new EventAction);
84  runManager->SetUserAction(new SteppingAction(run,histo));
85  runManager->SetUserAction(new StackingAction);
86 
87  // Start execution
88  //
89  if (argc > 1) { // execute an argument macro file if exist
90  G4String command = "/control/execute ";
91  G4String fileName = argv[1];
92  G4UImanager::GetUIpointer()->ApplyCommand(command+fileName);
93 
94  } else { // start interactive session
95 #ifdef G4VIS_USE
96  G4VisManager* visManager = new G4VisExecutive;
97  visManager->Initialize();
98 #endif
99 
100 #ifdef G4UI_USE
101  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
102  ui->SessionStart();
103  delete ui;
104 #endif
105 
106 #ifdef G4VIS_USE
107  delete visManager;
108 #endif
109  }
110 
111  // job termination
112  //
113  delete histo;
114  delete runManager;
115 
116  return 0;
117 }
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)