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

Main program of the medical/fanoCavity2 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 medical/fanoCavity2 example.

Definition in file fanoCavity2.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 58 of file fanoCavity2.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
71  PhysicsList* phys;
73 
74  runManager->SetUserInitialization(det = new DetectorConstruction);
75  runManager->SetUserInitialization(phys = new PhysicsList());
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 
84  runManager->SetUserAction(run);
85  runManager->SetUserAction(event);
86  runManager->SetUserAction(track);
87  runManager->SetUserAction(step);
88 
89  //get the pointer to the User Interface manager
91 
92 #ifdef G4VIS_USE
93  G4VisManager* visManager = new G4VisExecutive;
94  visManager->Initialize();
95 #endif
96 
97  if (argc!=1) // batch mode
98  {
99  G4String command = "/control/execute ";
100  G4String fileName = argv[1];
101  UImanager->ApplyCommand(command+fileName);
102  }
103 
104  else // interactive mode :define visualization and UI terminal
105  {
106 #ifdef G4UI_USE
107  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
108 #ifdef G4VIS_USE
109  UImanager->ApplyCommand("/control/execute vis.mac");
110 #endif
111  ui->SessionStart();
112  delete ui;
113 #endif
114 
115 #ifdef G4VIS_USE
116  delete visManager;
117 #endif
118  }
119 
120  //job termination
121  //
122  delete runManager;
123 
124  return 0;
125 }
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)