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

Main program of the medical/fanoCavity 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"
#include "StackingAction.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the medical/fanoCavity example.

Definition in file fanoCavity.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 59 of file fanoCavity.cc.

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

59  {
60 
61  //choose the Random engine
63 
64  //my Verbose output class
66 
67  //Construct the default run manager
68  G4RunManager * runManager = new G4RunManager;
69 
70  //set mandatory initialization classes
72  PhysicsList* phys;
74  runManager->SetUserInitialization(det = new DetectorConstruction);
75  runManager->SetUserInitialization(phys = new PhysicsList(det));
76  runManager->SetUserAction(kin = new PrimaryGeneratorAction(det));
77 
78  //set user action classes
79  RunAction* run = new RunAction(det,kin);
80  EventAction* event = new EventAction(run);
81  TrackingAction* track = new TrackingAction(run);
82  SteppingAction* step = new SteppingAction(det,run,track);
83  StackingAction* stack = new StackingAction(det,run);
84 
85  runManager->SetUserAction(run);
86  runManager->SetUserAction(event);
87  runManager->SetUserAction(track);
88  runManager->SetUserAction(step);
89  runManager->SetUserAction(stack);
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 // interactive mode :define visualization and UI terminal
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)