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

#include <RE05PrimaryGeneratorAction.hh>

Inheritance diagram for RE05PrimaryGeneratorAction:
Collaboration diagram for RE05PrimaryGeneratorAction:

Public Member Functions

 RE05PrimaryGeneratorAction ()
 
virtual ~RE05PrimaryGeneratorAction ()
 
virtual void GeneratePrimaries (G4Event *anEvent)
 
void SetHEPEvtGenerator (G4bool option)
 
G4bool GetHEPEvtGenerator ()
 
- Public Member Functions inherited from G4VUserPrimaryGeneratorAction
 G4VUserPrimaryGeneratorAction ()
 
virtual ~G4VUserPrimaryGeneratorAction ()
 

Detailed Description

Definition at line 42 of file RE05PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

RE05PrimaryGeneratorAction::RE05PrimaryGeneratorAction ( )

Definition at line 52 of file RE05PrimaryGeneratorAction.cc.

54  fParticleGun(0),
55  fMessenger(0),
56  fUseHEPEvt(false)
57 {
58  G4AutoLock lock(&RE05PrimGenDestrMutex);
59  if(!fHEPEvt)
60  {
61  const char* filename = "pythia_event.data";
62  fHEPEvt = new G4HEPEvtInterface(filename,1);
63  }
64  lock.unlock();
65 
66  G4int n_particle = 1;
67  G4ParticleGun* particleGun = new G4ParticleGun(n_particle);
69  G4String particleName;
70  G4ParticleDefinition* particle
71  = particleTable->FindParticle(particleName="mu+");
72  particleGun->SetParticleDefinition(particle);
73  particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,1.,0.));
74  particleGun->SetParticleEnergy(100.*GeV);
75  particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
76  fParticleGun = particleGun;
77 
78  fMessenger = new RE05PrimaryGeneratorMessenger(this);
79  fUseHEPEvt = true;
80 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
CLHEP::Hep3Vector G4ThreeVector
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
int G4int
Definition: G4Types.hh:78
void SetParticlePosition(G4ThreeVector aPosition)
static constexpr double cm
Definition: G4SIunits.hh:119
void SetParticleEnergy(G4double aKineticEnergy)
static G4ParticleTable * GetParticleTable()
static constexpr double GeV
Definition: G4SIunits.hh:217
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)

Here is the call graph for this function:

RE05PrimaryGeneratorAction::~RE05PrimaryGeneratorAction ( )
virtual

Definition at line 84 of file RE05PrimaryGeneratorAction.cc.

85 {
86  G4AutoLock lock(&RE05PrimGenDestrMutex);
87  if(fHEPEvt) { delete fHEPEvt; fHEPEvt=0; }
88  delete fParticleGun;
89  delete fMessenger;
90 }

Member Function Documentation

void RE05PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 94 of file RE05PrimaryGeneratorAction.cc.

95 {
96  if(fUseHEPEvt)
97  {
98  G4AutoLock lock(&RE05PrimGenMutex);
99  fHEPEvt->GeneratePrimaryVertex(anEvent);
100  }
101  else
102  { fParticleGun->GeneratePrimaryVertex(anEvent); }
103 }
virtual void GeneratePrimaryVertex(G4Event *evt)=0

Here is the call graph for this function:

G4bool RE05PrimaryGeneratorAction::GetHEPEvtGenerator ( )
inline

Definition at line 60 of file RE05PrimaryGeneratorAction.hh.

61  { return fUseHEPEvt; }

Here is the caller graph for this function:

void RE05PrimaryGeneratorAction::SetHEPEvtGenerator ( G4bool  option)
inline

Definition at line 58 of file RE05PrimaryGeneratorAction.hh.

59  { fUseHEPEvt = option; }

Here is the caller graph for this function:


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