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

The user main program of the parallel/TopC/ParN02 example. More...

#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 "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

The user main program of the parallel/TopC/ParN02 example.

Definition in file ParN02.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 52 of file ParN02.cc.

53 {
54  // Detect interactive mode (if no arguments) and define UI session
55  //
56  G4UIExecutive* ui = 0;
57  if ( argc == 1 ) {
58  ui = new G4UIExecutive(argc, argv);
59  }
60 
61  // User Verbose output class
62  //
63  G4VSteppingVerbose* verbosity = new ExN02SteppingVerbose;
64  G4VSteppingVerbose::SetInstance(verbosity);
65 
66  // Run manager
67  //
68  G4RunManager * runManager = new G4RunManager;
69 
70  // User Initialization classes (mandatory)
71  //
72  ExN02DetectorConstruction* detector = new ExN02DetectorConstruction;
73  runManager->SetUserInitialization(detector);
74  //
75  G4VUserPhysicsList* physics = new ExN02PhysicsList;
76  runManager->SetUserInitialization(physics);
77 
78  // User Action classes
79  //
80  G4VUserPrimaryGeneratorAction* gen_action = new ExN02PrimaryGeneratorAction(detector);
81  runManager->SetUserAction(gen_action);
82  //
83  G4UserRunAction* run_action = new ExN02RunAction;
84  runManager->SetUserAction(run_action);
85  //
86  G4UserEventAction* event_action = new ExN02EventAction;
87  runManager->SetUserAction(event_action);
88  //
89  G4UserSteppingAction* stepping_action = new ExN02SteppingAction;
90  runManager->SetUserAction(stepping_action);
91 
92  // Visualization, if you choose to have it!
93  //
94  G4VisManager* visManager = new G4VisExecutive;
95  visManager->Initialize();
96 
97  // Initialize G4 kernel
98  //
99  runManager->Initialize();
100 
101  // Get the pointer to the User Interface manager
102  //
103  G4UImanager * UImanager = G4UImanager::GetUIpointer();
104 
105  // Process macro or start UI session
106  //
107  if ( ! ui ) {
108  // batch mode
109  G4String command = "/control/execute ";
110  G4String fileName = argv[1];
111  UImanager->ApplyCommand(command+fileName);
112  }
113  else {
114  // interactive mode
115  UImanager->ApplyCommand("/run/beamOn 10");
116  ui->SessionStart();
117  delete ui;
118  }
119 
120  // Free the store: user actions, physics_list and detector_description are
121  // owned and deleted by the run manager, so they should not
122  // be deleted in the main() program !
123 
124  delete visManager;
125  delete runManager;
126  delete verbosity;
127 }