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

#include <RE01PrimaryGeneratorAction.hh>

Inheritance diagram for RE01PrimaryGeneratorAction:
Collaboration diagram for RE01PrimaryGeneratorAction:

Public Member Functions

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

Detailed Description

Definition at line 42 of file RE01PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

RE01PrimaryGeneratorAction::RE01PrimaryGeneratorAction ( )

Definition at line 43 of file RE01PrimaryGeneratorAction.cc.

45  fHEPEvt(0), fParticleGun(0), fMessenger(0)
46 {
47  const char* filename = "pythia_event.data";
48  fHEPEvt = new G4HEPEvtInterface(filename);
49 
50  G4int n_particle = 1;
51  G4ParticleGun* particleGun = new G4ParticleGun(n_particle);
53  G4String particleName;
54  G4ParticleDefinition* particle
55  = particleTable->FindParticle(particleName="mu+");
56  particleGun->SetParticleDefinition(particle);
57  particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,1.,0.));
58  particleGun->SetParticleEnergy(100.*GeV);
59  particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,0.*cm));
60  fParticleGun = particleGun;
61 
62  fMessenger = new RE01PrimaryGeneratorMessenger(this);
63  fUseHEPEvt = true;
64 
65 }
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:

RE01PrimaryGeneratorAction::~RE01PrimaryGeneratorAction ( )
virtual

Definition at line 74 of file RE01PrimaryGeneratorAction.cc.

75 {
76  G4AutoLock lock(&RE01PrimGenDestrMutex);
77  if(fHEPEvt) {delete fHEPEvt; fHEPEvt = 0;}
78  delete fParticleGun;
79  delete fMessenger;
80 }

Member Function Documentation

void RE01PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 83 of file RE01PrimaryGeneratorAction.cc.

84 {
85  if(fUseHEPEvt)
86  {
87  G4AutoLock lock(&RE01PrimGenMutex);
88  fHEPEvt->GeneratePrimaryVertex(anEvent);
89  if(anEvent->GetNumberOfPrimaryVertex()==0)
90  { // End-of-file
91  G4Exception("RE01PrimaryGeneratorAction::GeneratePrimaries",
92  "RE01_0001",RunMustBeAborted,"End of file detected.");
93  }
94  }
95  else
96  { fParticleGun->GeneratePrimaryVertex(anEvent); }
97 }
G4int GetNumberOfPrimaryVertex() const
Definition: G4Event.hh:164
virtual void GeneratePrimaryVertex(G4Event *evt)=0
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:

G4bool RE01PrimaryGeneratorAction::GetHEPEvtGenerator ( )
inline

Definition at line 52 of file RE01PrimaryGeneratorAction.hh.

53  { return fUseHEPEvt; }

Here is the caller graph for this function:

void RE01PrimaryGeneratorAction::SetHEPEvtGenerator ( G4bool  f)
inline

Definition at line 50 of file RE01PrimaryGeneratorAction.hh.

51  { fUseHEPEvt = f; }

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