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

Main program of the eventgenerator/HepMC/HepMCEx02 example. More...

#include "G4Types.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "H02DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "H02PrimaryGeneratorAction.hh"
#include "H02EventAction.hh"
#include "H02SteppingAction.hh"
#include "G4VisExecutive.hh"
#include "G4UIExecutive.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the eventgenerator/HepMC/HepMCEx02 example.

Definition in file HepMCEx02.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 50 of file HepMCEx02.cc.

References Initialize().

51 {
52  // Instantiate G4UIExecutive if there are no arguments (interactive mode)
53  G4UIExecutive* ui = nullptr;
54  if ( argc == 1 ) {
55  ui = new G4UIExecutive(argc, argv);
56  }
57 
58  G4RunManager* runManager= new G4RunManager;
59 
60  // User Initialization classes (mandatory)
61  //
62  G4VUserDetectorConstruction* detector = new H02DetectorConstruction;
63  runManager-> SetUserInitialization(detector);
64  //
65  G4VUserPhysicsList* physics = new FTFP_BERT;
66  runManager-> SetUserInitialization(physics);
67 
68  runManager-> Initialize();
69 
70  // User Action classes
71  //
72  G4VUserPrimaryGeneratorAction* gen_action = new H02PrimaryGeneratorAction;
73  runManager-> SetUserAction(gen_action);
74  //
75  G4UserEventAction* event_action = new H02EventAction;
76  runManager-> SetUserAction(event_action);
77  //
78  G4UserSteppingAction* stepping_action = new H02SteppingAction;
79  runManager-> SetUserAction(stepping_action);
80 
81  G4VisManager* visManager= new G4VisExecutive;
82  visManager-> Initialize();
83  G4cout << G4endl;
84 
85  //get the pointer to the User Interface manager
86  G4UImanager* UImanager = G4UImanager::GetUIpointer();
87 
88  if (!ui) { // batch mode
89  visManager-> SetVerboseLevel("quiet");
90  G4String command = "/control/execute ";
91  G4String fileName = argv[1];
92  UImanager-> ApplyCommand(command+fileName);
93  } else { // interactive mode : define UI session
94  ui-> SessionStart();
95  delete ui;
96  }
97 
98  // Free the store: user actions, physics_list and detector_description are
99  // owned and deleted by the run manager, so they should not
100  // be deleted in the main() program !
101 
102  delete visManager;
103  delete runManager;
104 }
void Initialize()
Definition: errprop.cc:100