LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
HepMCEx02.cc File Reference

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

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "H02DetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "H02PrimaryGeneratorAction.hh"
#include "H02EventAction.hh"
#include "H02SteppingAction.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 54 of file HepMCEx02.cc.

References Initialize().

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