LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
ParN04.cc File Reference

Main program of the parallel/TopC/ParN04 example. More...

#include "ExN04DetectorConstruction.hh"
#include "ExN04PrimaryGeneratorAction.hh"
#include "ExN04RunAction.hh"
#include "ExN04EventAction.hh"
#include "ExN04StackingAction.hh"
#include "ExN04TrackingAction.hh"
#include "ExN04SteppingAction.hh"
#include "ExN04SteppingVerbose.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "QGSP_BERT.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"
#include "ParTopC.icc"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the parallel/TopC/ParN04 example.

Definition in file ParN04.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 54 of file ParN04.cc.

55 {
56  // Detect interactive mode (if no arguments) and define UI session
57  //
58  G4UIExecutive* ui = 0;
59  if ( argc == 1 ) {
60  ui = new G4UIExecutive(argc, argv);
61  }
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  // Visualization, if you choose to have it!
81  //
82  G4VisManager* visManager = new G4VisExecutive;
83  visManager->Initialize();
84 
85  // Initialize G4 kernel
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  // Process macro or start UI session
114  //
115  if ( ! ui ) {
116  // batch mode
117  G4String command = "/control/execute ";
118  G4String fileName = argv[1];
119  UImanager->ApplyCommand(command+fileName);
120  }
121  else {
122  // interactive mode
123  UImanager->ApplyCommand("/control/execute vis.mac");
124  ui->SessionStart();
125  delete ui;
126  }
127 
128  // Free the store: user actions, physics_list and detector_description are
129  // owned and deleted by the run manager, so they should not
130  // be deleted in the main() program !
131 
132  delete visManager;
133  delete runManager;
134  delete verbosity;
135 
136  return 0;
137 }