Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
HepMCEx01.cc File Reference

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

#include "FTFP_BERT.hh"
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "ExN04DetectorConstruction.hh"
#include "ExN04EventAction.hh"
#include "ExN04PrimaryGeneratorAction.hh"
#include "ExN04RunAction.hh"
#include "ExN04StackingAction.hh"
#include "ExN04SteppingAction.hh"
#include "ExN04SteppingVerbose.hh"
#include "ExN04TrackingAction.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Main program of the eventgenerator/HepMC/HepMCEx01 example.

Definition in file HepMCEx01.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 56 of file HepMCEx01.cc.

References G4UImanager::ApplyCommand(), G4UImanager::GetUIpointer(), G4RunManager::Initialize(), G4VisManager::Initialize(), G4UIExecutive::SessionStart(), G4VSteppingVerbose::SetInstance(), G4RunManager::SetUserAction(), G4RunManager::SetUserInitialization(), and G4VisManager::SetVerboseLevel().

57 {
58  // User Verbose output class
59  //
62 
63  // Run manager
64  //
65  G4RunManager* runManager = new G4RunManager;
66 
67  // User Initialization classes (mandatory)
68  //
70  runManager->SetUserInitialization(detector);
71  //
72  G4VUserPhysicsList* physics = new FTFP_BERT;
73  runManager->SetUserInitialization(physics);
74 
75  runManager->Initialize();
76 
77  // User Action classes
78  //
80  runManager->SetUserAction(gen_action);
81  //
82  G4UserRunAction* run_action = new ExN04RunAction;
83  runManager->SetUserAction(run_action);
84  //
85  G4UserEventAction* event_action = new ExN04EventAction;
86  runManager->SetUserAction(event_action);
87  //
88  G4UserStackingAction* stacking_action = new ExN04StackingAction;
89  runManager->SetUserAction(stacking_action);
90  //
91  G4UserTrackingAction* tracking_action = new ExN04TrackingAction;
92  runManager->SetUserAction(tracking_action);
93  //
94  G4UserSteppingAction* stepping_action = new ExN04SteppingAction;
95  runManager->SetUserAction(stepping_action);
96 
97 #ifdef G4VIS_USE
98  // Visualization, if you choose to have it!
99  G4VisManager* visManager = new G4VisExecutive;
100  visManager->Initialize();
101 #endif
102 
103  //get the pointer to the User Interface manager
104  G4UImanager* UImanager = G4UImanager::GetUIpointer();
105 
106  if (argc!=1) // batch mode
107  {
108 #ifdef G4VIS_USE
109  visManager->SetVerboseLevel("quiet");
110 #endif
111  G4String command = "/control/execute ";
112  G4String fileName = argv[1];
113  UImanager->ApplyCommand(command+fileName);
114  }
115  else
116  { // interactive mode : define UI session
117 #ifdef G4UI_USE
118  G4UIExecutive* ui = new G4UIExecutive(argc, argv);
119  ui->SessionStart();
120  delete ui;
121 #endif
122  }
123 
124  // Free the store: user actions, physics_list and detector_description are
125  // owned and deleted by the run manager, so they should not
126  // be deleted in the main() program !
127 
128 #ifdef G4VIS_USE
129  delete visManager;
130 #endif
131  delete runManager;
132  delete verbosity;
133 
134  return 0;
135 }
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
void SetVerboseLevel(G4int)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:58
void Initialize()
TFTFP_BERT< G4VModularPhysicsList > FTFP_BERT
Definition: FTFP_BERT.hh:63
static void SetInstance(G4VSteppingVerbose *Instance)
virtual void Initialize()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:419
virtual void SetUserAction(G4UserRunAction *userAction)