Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
amsEcal.cc File Reference
#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 "HistoManager.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 55 of file amsEcal.cc.

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

55  {
56 
57  //choose the Random engine
59 
60  //my Verbose output class
62 
63  // Construct the default run manager
64  G4RunManager * runManager = new G4RunManager;
65 
66  // set mandatory initialization classes
68  runManager->SetUserInitialization(detector);
69  runManager->SetUserInitialization(new PhysicsList);
70 
71  // histograms for this example
72  HistoManager* histo = new HistoManager();
73 
74  // primary generator
75  PrimaryGeneratorAction* primary = new PrimaryGeneratorAction(detector);
76  runManager->SetUserAction(primary);
77 
78  // set user action classes
79  //
80  RunAction* runAct = new RunAction(detector,primary,histo);
81  EventAction* evtAct = new EventAction(detector,runAct,primary,histo);
82  TrackingAction* trkAct = new TrackingAction(detector,runAct);
83  SteppingAction* stpAct = new SteppingAction(detector,evtAct);
84 
85  runManager->SetUserAction(runAct);
86  runManager->SetUserAction(evtAct);
87  runManager->SetUserAction(trkAct);
88  runManager->SetUserAction(stpAct);
89 
90  // get the pointer to the User Interface manager
92 
93  if (argc!=1) // batch mode
94  {
95  G4String command = "/control/execute ";
96  G4String fileName = argv[1];
97  UI->ApplyCommand(command+fileName);
98  }
99 
100  else //define visualization and UI terminal for interactive mode
101  {
102 #ifdef G4VIS_USE
103  G4VisManager* visManager = new G4VisExecutive;
104  visManager->Initialize();
105 #endif
106 
107 #ifdef G4UI_USE
108  G4UIExecutive * ui = new G4UIExecutive(argc,argv);
109  ui->SessionStart();
110  delete ui;
111 #endif
112 
113 #ifdef G4VIS_USE
114  delete visManager;
115 #endif
116  }
117 
118  // job termination
119  //
120  delete histo;
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)