Geant4  10.03.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mctruthex.cc File Reference

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

#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "FTFP_BERT.hh"
#include "PrimaryGeneratorAction.hh"
#include "DetectorConstruction.hh"
#include "MCTruthTrackingAction.hh"
#include "MCTruthEventAction.hh"
#include "MCTruthManager.hh"
Include dependency graph for mctruthex.cc:

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

Main program of the eventgenerator/HepMC/MCTruth example.

Definition in file mctruthex.cc.

Function Documentation

int main ( )

Definition at line 43 of file mctruthex.cc.

44 {
45  // Construct the default run manager
46  G4RunManager* runManager = new G4RunManager;
47 
48  // set mandatory initialization classes
50  runManager->SetUserInitialization(new FTFP_BERT);
51 
52  // set mandatory user action class
53  runManager->SetUserAction(new PrimaryGeneratorAction);
54 
55  // set MCTruth user action classes
56  runManager->SetUserAction(new MCTruthTrackingAction);
57  runManager->SetUserAction(new MCTruthEventAction);
58 
59  // Initialize G4 kernel
60  runManager->Initialize();
61 
62  // get the pointer to the UI manager and set verbosities
64  UI->ApplyCommand("/run/verbose 1");
65  UI->ApplyCommand("/event/verbose 1");
66  UI->ApplyCommand("/tracking/verbose 1");
67 
68  // configure MCTruth handling
70  config->SetMinE(1000.0);
71  config->AddParticleType(11);
73 
74  // start a run
75  int numberOfEvent = 1;
76  runManager->BeamOn(numberOfEvent);
77 
78  // job termination
79  delete runManager;
80  return 0;
81 }
The primary generator action class with particle gun.
virtual void SetUserInitialization(G4VUserDetectorConstruction *userInit)
static MCTruthManager * GetInstance()
void SetMinE(double e)
void SetConfig(MCTruthConfig *c)
virtual void BeamOn(G4int n_event, const char *macroFile=0, G4int n_select=-1)
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:59
void AddParticleType(G4int type)
virtual void Initialize()
Detector construction class to define materials and geometry.
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:447
virtual void SetUserAction(G4UserRunAction *userAction)

Here is the call graph for this function: