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

Main program of the radioactivedecay/rdecay01 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 "SteppingVerbose.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the radioactivedecay/rdecay01 example.

Definition in file rdecay01.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 57 of file rdecay01.cc.

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

57  {
58 
59  //choose the Random engine
61 
62  //my Verbose output class
64 
65  // Construct the default run manager
66  G4RunManager * runManager = new G4RunManager;
67 
68  // set mandatory initialization classes
69  //
71  runManager->SetUserInitialization(new PhysicsList);
72 
73  // set user action classes
74  //
76  RunAction* run = new RunAction(prim);
77  EventAction* event = new EventAction();
78  TrackingAction* track = new TrackingAction(run,event);
79 
80  runManager->SetUserAction(run);
81  runManager->SetUserAction(prim);
82  runManager->SetUserAction(event);
83  runManager->SetUserAction(track);
84 
85  //Initialize G4 kernel
86  runManager->Initialize();
87 
88  // get the pointer to the User Interface manager
90 
91 #ifdef G4VIS_USE
92  G4VisManager* visManager = new G4VisExecutive;
93  visManager->Initialize();
94 #endif
95 
96  if (argc!=1) // batch mode
97  {
98  G4String command = "/control/execute ";
99  G4String fileName = argv[1];
100  UI->ApplyCommand(command+fileName);
101  }
102 
103  else // define visualization and UI terminal for interactive mode
104  {
105 #ifdef G4UI_USE
106  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
107 #ifdef G4VIS_USE
108  UI->ApplyCommand("/control/execute vis.mac");
109 #endif
110  ui->SessionStart();
111  delete ui;
112 #endif
113  }
114 
115 #ifdef G4VIS_USE
116  delete visManager;
117 #endif
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)
virtual void Initialize()
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:170
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)