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

Main program of the hadronic/Hadr03 example. More...

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

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the hadronic/Hadr03 example.

Definition in file Hadr03.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file Hadr03.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
72  runManager->SetUserInitialization(det = new DetectorConstruction);
73  runManager->SetUserInitialization(new PhysicsList);
74  runManager->SetUserAction(prim = new PrimaryGeneratorAction(det));
75 
76  // set user action classes
77  RunAction* run;
78 
79  runManager->SetUserAction(run = new RunAction(det,prim));
80  runManager->SetUserAction(new EventAction());
81  runManager->SetUserAction(new SteppingAction(run));
82 
83  // get the pointer to the User Interface manager
85 
86  if (argc!=1) // batch mode
87  {
88  G4String command = "/control/execute ";
89  G4String fileName = argv[1];
90  UI->ApplyCommand(command+fileName);
91  }
92 
93  else //define visualization and UI terminal for interactive mode
94  {
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 runManager;
114 
115  return 0;
116 }
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)