Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
ParN04.cc File Reference
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "ExN04DetectorConstruction.hh"
#include "QGSP_BERT.hh"
#include "ExN04PrimaryGeneratorAction.hh"
#include "ExN04RunAction.hh"
#include "ExN04EventAction.hh"
#include "ExN04StackingAction.hh"
#include "ExN04TrackingAction.hh"
#include "ExN04SteppingAction.hh"
#include "ExN04SteppingVerbose.hh"
#include "ParTopC.icc"

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 61 of file ParN04.cc.

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

62 {
63  // User Verbose output class
64  //
67 
68  // Run manager
69  //
70  G4RunManager* runManager = new G4RunManager;
71 
72  // User Initialization classes (mandatory)
73  //
75  runManager->SetUserInitialization(detector);
76  //
77  G4VUserPhysicsList* physics = new QGSP_BERT();
78  runManager->SetUserInitialization(physics);
79 
80 #ifdef G4VIS_USE
81  // Visualization, if you choose to have it!
82  //
83  G4VisManager* visManager = new G4VisExecutive;
84  visManager->Initialize();
85 #endif
86 
87  runManager->Initialize();
88 
89  // User Action classes
90  //
92  runManager->SetUserAction(gen_action);
93  //
94  G4UserRunAction* run_action = new ExN04RunAction;
95  runManager->SetUserAction(run_action);
96  //
97  G4UserEventAction* event_action = new ExN04EventAction;
98  runManager->SetUserAction(event_action);
99  //
100  G4UserStackingAction* stacking_action = new ExN04StackingAction;
101  runManager->SetUserAction(stacking_action);
102  //
103  G4UserTrackingAction* tracking_action = new ExN04TrackingAction;
104  runManager->SetUserAction(tracking_action);
105  //
106  G4UserSteppingAction* stepping_action = new ExN04SteppingAction;
107  runManager->SetUserAction(stepping_action);
108 
109  // Get the pointer to the User Interface manager
110  //
111  G4UImanager* UImanager = G4UImanager::GetUIpointer();
112 
113  if(argc==1) // Define (G)UI terminal for interactive mode
114  {
115 #ifdef G4UI_USE
116  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
117  UImanager->ApplyCommand("/control/execute vis.mac");
118  ui->SessionStart();
119  delete ui;
120 #endif
121  }
122  else // Batch mode
123  {
124  G4String command = "/control/execute ";
125  G4String fileName = argv[1];
126  UImanager->ApplyCommand(command+fileName);
127  }
128 
129  // Free the store: user actions, physics_list and detector_description are
130  // owned and deleted by the run manager, so they should not
131  // be deleted in the main() program !
132 
133 #ifdef G4VIS_USE
134  delete visManager;
135 #endif
136  delete runManager;
137  delete verbosity;
138 
139  return 0;
140 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
TQGSP_BERT< G4VModularPhysicsList > QGSP_BERT
Definition: QGSP_BERT.hh:63
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
static void SetInstance(G4VSteppingVerbose *Instance)
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)