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

#include <ExN04PrimaryGeneratorAction.hh>

Inheritance diagram for ExN04PrimaryGeneratorAction:
Collaboration diagram for ExN04PrimaryGeneratorAction:

Public Member Functions

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

Detailed Description

Definition at line 43 of file ExN04PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

ExN04PrimaryGeneratorAction::ExN04PrimaryGeneratorAction ( )

Definition at line 41 of file ExN04PrimaryGeneratorAction.cc.

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

Definition at line 60 of file ExN04PrimaryGeneratorAction.cc.

61 {
62  delete messenger;
63 }
ExN04PrimaryGeneratorAction::ExN04PrimaryGeneratorAction ( )
ExN04PrimaryGeneratorAction::~ExN04PrimaryGeneratorAction ( )

Member Function Documentation

void ExN04PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 66 of file ExN04PrimaryGeneratorAction.cc.

67 {
68  if(currentGenerator)
69  currentGenerator-> GeneratePrimaryVertex(anEvent);
70  else
71  G4Exception("ExN04PrimaryGeneratorAction::GeneratePrimaries",
72  "PrimaryGeneratorAction001", FatalException,
73  "generator is not instanciated." );
74 }
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:

void ExN04PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual
G4VPrimaryGenerator * ExN04PrimaryGeneratorAction::GetGenerator ( ) const
inline

Definition at line 85 of file ExN04PrimaryGeneratorAction.hh.

86 {
87  return currentGenerator;
88 }
G4String ExN04PrimaryGeneratorAction::GetGeneratorName ( ) const
inline

Definition at line 90 of file ExN04PrimaryGeneratorAction.hh.

91 {
92  return currentGeneratorName;
93 }
G4bool ExN04PrimaryGeneratorAction::GetHEPEvtGenerator ( )
inline

Definition at line 60 of file ExN04PrimaryGeneratorAction.hh.

61  { return useHEPEvt; }
void ExN04PrimaryGeneratorAction::SetGenerator ( G4VPrimaryGenerator gen)
inline

Definition at line 70 of file ExN04PrimaryGeneratorAction.hh.

71 {
72  currentGenerator = gen;
73 }
void ExN04PrimaryGeneratorAction::SetGenerator ( G4String  genname)
inline

Definition at line 75 of file ExN04PrimaryGeneratorAction.hh.

76 {
77  std::map<G4String, G4VPrimaryGenerator*>::iterator pos =
78  gentypeMap.find(genname);
79  if ( pos != gentypeMap.end() ) {
80  currentGenerator = pos->second;
81  currentGeneratorName = genname;
82  }
83 }
static const G4double pos
void ExN04PrimaryGeneratorAction::SetHEPEvtGenerator ( G4bool  f)
inline

Definition at line 58 of file ExN04PrimaryGeneratorAction.hh.

59  { useHEPEvt = f; }

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