LArSoft  v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
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"

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
49  runManager->SetUserInitialization(new DetectorConstruction);
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
63  G4UImanager* UI = G4UImanager::GetUIpointer();
64  UI->ApplyCommand("/run/verbose 1");
65  UI->ApplyCommand("/event/verbose 1");
66  UI->ApplyCommand("/tracking/verbose 1");
67 
68  // configure MCTruth handling
69  MCTruthConfig* config = new MCTruthConfig;
70  config->SetMinE(1000.0);
71  config->AddParticleType(11);
72  MCTruthManager::GetInstance()->SetConfig(config);
73 
74  // start a run
75  int numberOfEvent = 1;
76  runManager->BeamOn(numberOfEvent);
77 
78  // job termination
79  delete runManager;
80  return 0;
81 }