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

#include <FCALPrimaryGeneratorAction.hh>

Inheritance diagram for FCALPrimaryGeneratorAction:
Collaboration diagram for FCALPrimaryGeneratorAction:

Public Member Functions

 FCALPrimaryGeneratorAction ()
 
 ~FCALPrimaryGeneratorAction ()
 
void GeneratePrimaries (G4Event *)
 
void SetVerbosity (G4int ver)
 
- Public Member Functions inherited from G4VUserPrimaryGeneratorAction
 G4VUserPrimaryGeneratorAction ()
 
virtual ~G4VUserPrimaryGeneratorAction ()
 

Detailed Description

Definition at line 45 of file FCALPrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

FCALPrimaryGeneratorAction::FCALPrimaryGeneratorAction ( )

Definition at line 124 of file FCALPrimaryGeneratorAction.cc.

124  :
125  fVerbosity(0)
126 {
127  particleGun = new G4ParticleGun();
128 
129  // default Particle
130  G4String particleName;
132  G4ParticleDefinition* particle = particleTable->FindParticle(particleName="e-");
133  particleGun->SetParticleDefinition(particle);
134 
135  // default Energy
136  particleGun->SetParticleEnergy(20*GeV);
137 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
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:

FCALPrimaryGeneratorAction::~FCALPrimaryGeneratorAction ( )

Definition at line 141 of file FCALPrimaryGeneratorAction.cc.

142 {
143  delete particleGun;
144 }

Member Function Documentation

void FCALPrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 148 of file FCALPrimaryGeneratorAction.cc.

149 {
150  //this function is called at the begining of event
151  ReadKinematicFromFile(particleGun->GetParticleEnergy());
152 
153  //Get next event to be processed
154  size_t nEvent = GetNextId();
155  particleGun->SetParticlePosition(G4ThreeVector(fX[nEvent],fY[nEvent],fZ[nEvent]));
156  particleGun->SetParticleMomentumDirection(G4ThreeVector(-1.0*fCosX[nEvent],
157  fCosY[nEvent],
158  -1.0*fCosZ[nEvent]));
159 
160  particleGun->GeneratePrimaryVertex(anEvent);
161 
162  if (fVerbosity)
163  {
164  G4cout<< " Event "<<anEvent->GetEventID()<< " Generated Vertex : "
165  <<anEvent->GetEventID() <<" (x,y,z)=(" << fX[nEvent] << ","
166  <<fY[nEvent] << "," << fZ[nEvent]<< ") (cosX,cosY,cosZ)=("
167  << -1.*fCosX[nEvent] << "," << fCosY[nEvent]
168  <<"," << -1.*fCosZ[nEvent] << ")"<<G4endl;
169  }
170 
171 }
CLHEP::Hep3Vector G4ThreeVector
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
virtual void GeneratePrimaryVertex(G4Event *evt)
G4int GetEventID() const
Definition: G4Event.hh:151
void SetParticlePosition(G4ThreeVector aPosition)
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4double GetParticleEnergy() const

Here is the call graph for this function:

void FCALPrimaryGeneratorAction::SetVerbosity ( G4int  ver)
inline

Definition at line 53 of file FCALPrimaryGeneratorAction.hh.

53 {fVerbosity = ver;};

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