LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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.

62 {
63  // User Verbose output class
64  //
65  G4VSteppingVerbose* verbosity = new ExN04SteppingVerbose;
66  G4VSteppingVerbose::SetInstance(verbosity);
67 
68  // Run manager
69  //
70  G4RunManager* runManager = new G4RunManager;
71 
72  // User Initialization classes (mandatory)
73  //
74  G4VUserDetectorConstruction* detector = new ExN04DetectorConstruction;
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  //
91  G4VUserPrimaryGeneratorAction* gen_action = new ExN04PrimaryGeneratorAction;
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 }