Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
H02PrimaryGeneratorAction Class Reference

#include <H02PrimaryGeneratorAction.hh>

Inheritance diagram for H02PrimaryGeneratorAction:
Collaboration diagram for H02PrimaryGeneratorAction:

Public Member Functions

 H02PrimaryGeneratorAction ()
 
 ~H02PrimaryGeneratorAction ()
 
virtual void GeneratePrimaries (G4Event *anEvent)
 
void SetGenerator (G4VPrimaryGenerator *gen)
 
void SetGenerator (G4String genname)
 
G4VPrimaryGeneratorGetGenerator () const
 
G4String GetGeneratorName () const
 
- Public Member Functions inherited from G4VUserPrimaryGeneratorAction
 G4VUserPrimaryGeneratorAction ()
 
virtual ~G4VUserPrimaryGeneratorAction ()
 

Detailed Description

Definition at line 46 of file H02PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

H02PrimaryGeneratorAction::H02PrimaryGeneratorAction ( )

Definition at line 38 of file H02PrimaryGeneratorAction.cc.

39 {
40  // default generator is particle gun.
41  currentGenerator= particleGun= new G4ParticleGun();
42  currentGeneratorName= "particleGun";
43  hepmcAscii= new HepMCG4AsciiReader();
44 #ifdef G4LIB_USE_PYTHIA
45  pythiaGen= new HepMCG4PythiaInterface();
46 #else
47  pythiaGen= 0;
48 #endif
49 
50  gentypeMap["particleGun"]= particleGun;
51  gentypeMap["hepmcAscii"]= hepmcAscii;
52  gentypeMap["pythia"]= pythiaGen;
53 
54  messenger= new H02PrimaryGeneratorMessenger(this);
55 }
A generic interface class with Pythia event generator via HepMC.
H02PrimaryGeneratorAction::~H02PrimaryGeneratorAction ( )

Definition at line 58 of file H02PrimaryGeneratorAction.cc.

59 {
60  delete messenger;
61 }

Member Function Documentation

void H02PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 64 of file H02PrimaryGeneratorAction.cc.

65 {
66  if(currentGenerator)
67  currentGenerator-> GeneratePrimaryVertex(anEvent);
68  else
69  G4Exception("H02PrimaryGeneratorAction::GeneratePrimaries",
70  "InvalidSetup", FatalException,
71  "Generator is not instanciated.");
72 }
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41

Here is the call graph for this function:

G4VPrimaryGenerator * H02PrimaryGeneratorAction::GetGenerator ( ) const
inline

Definition at line 88 of file H02PrimaryGeneratorAction.hh.

89 {
90  return currentGenerator;
91 }
G4String H02PrimaryGeneratorAction::GetGeneratorName ( ) const
inline

Definition at line 93 of file H02PrimaryGeneratorAction.hh.

94 {
95  return currentGeneratorName;
96 }
void H02PrimaryGeneratorAction::SetGenerator ( G4VPrimaryGenerator gen)
inline

Definition at line 73 of file H02PrimaryGeneratorAction.hh.

74 {
75  currentGenerator= gen;
76 }
void H02PrimaryGeneratorAction::SetGenerator ( G4String  genname)
inline

Definition at line 78 of file H02PrimaryGeneratorAction.hh.

79 {
80  std::map<G4String, G4VPrimaryGenerator*>::iterator
81  pos = gentypeMap.find(genname);
82  if(pos != gentypeMap.end()) {
83  currentGenerator= pos->second;
84  currentGeneratorName= genname;
85  }
86 }
static const G4double pos

The documentation for this class was generated from the following files: