Geant4  10.02.p03
AnaEx03.cc File Reference

Main program of the analysis/AnaEx03 example. More...

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "DetectorConstruction.hh"
#include "PrimaryGeneratorAction.hh"
#include "RunAction.hh"
#include "EventAction.hh"
#include "SteppingAction.hh"
#include "HistoManager.hh"
Include dependency graph for AnaEx03.cc:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the analysis/AnaEx03 example.

Definition in file AnaEx03.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 57 of file AnaEx03.cc.

58 {
59  // Construct the default run manager
60  //
61  G4RunManager * runManager = new G4RunManager;
62 
63  // Set mandatory initialization classes
64  //
66  runManager->SetUserInitialization(detector);
67  //
68  runManager->SetUserInitialization(new FTFP_BERT);
69 
70  // set an HistoManager
71  //
72  HistoManager* histo = new HistoManager();
73 
74  // Set user action classes
75  //
76  PrimaryGeneratorAction* gen_action =
77  new PrimaryGeneratorAction(detector);
78  runManager->SetUserAction(gen_action);
79  //
80  RunAction* run_action = new RunAction(histo);
81  runManager->SetUserAction(run_action);
82  //
83  EventAction* event_action = new EventAction(run_action,histo);
84  runManager->SetUserAction(event_action);
85  //
86  SteppingAction* stepping_action =
87  new SteppingAction(detector, event_action);
88  runManager->SetUserAction(stepping_action);
89 
90  // Initialize G4 kernel
91  //
92  runManager->Initialize();
93 
94  // Get the pointer to the User Interface manager
95  //
97 
98  if (argc!=1) // batch mode
99  {
100  G4String command = "/control/execute ";
101  G4String fileName = argv[1];
102  UImanager->ApplyCommand(command+fileName);
103  }
104  else
105  { // interactive mode : define visualization and UI terminal
106 #ifdef G4VIS_USE
107  G4VisManager* visManager = new G4VisExecutive;
108  visManager->Initialize();
109 #ifdef G4UI_USE
110  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
111 #endif
112  UImanager->ApplyCommand("/control/execute vis.mac");
113 #endif
114 
115 #ifdef G4UI_USE
116  ui->SessionStart();
117  delete ui;
118 #endif
119 
120 #ifdef G4VIS_USE
121  delete visManager;
122 #endif
123  }
124 
125  // Job termination
126  delete histo;
127  delete runManager;
128 
129  return 0;
130 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
virtual void Initialize()
Detector construction class to define materials and geometry.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:446
virtual void SetUserAction(G4UserRunAction *userAction)
Here is the call graph for this function: