Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ParN02.cc File Reference
#include "ExN02DetectorConstruction.hh"
#include "ExN02PhysicsList.hh"
#include "ExN02PrimaryGeneratorAction.hh"
#include "ExN02RunAction.hh"
#include "ExN02EventAction.hh"
#include "ExN02SteppingAction.hh"
#include "ExN02SteppingVerbose.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "ParTopC.icc"
Include dependency graph for ParN02.cc:

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 59 of file ParN02.cc.

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

Here is the call graph for this function: