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

Primary generator action for GDML sensitive detector example. More...

#include <G04PrimaryGeneratorAction.hh>

Inheritance diagram for G04PrimaryGeneratorAction:
Collaboration diagram for G04PrimaryGeneratorAction:

Public Member Functions

 G04PrimaryGeneratorAction ()
 
 ~G04PrimaryGeneratorAction ()
 
virtual void GeneratePrimaries (G4Event *anEvent)
 
- Public Member Functions inherited from G4VUserPrimaryGeneratorAction
 G4VUserPrimaryGeneratorAction ()
 
virtual ~G4VUserPrimaryGeneratorAction ()
 

Detailed Description

Primary generator action for GDML sensitive detector example.

Definition at line 46 of file G04PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

G04PrimaryGeneratorAction::G04PrimaryGeneratorAction ( )

Definition at line 43 of file G04PrimaryGeneratorAction.cc.

45  fParticleGun(0)
46 {
47  G4int n_particle = 1;
48  fParticleGun = new G4ParticleGun(n_particle);
49 
51  G4String particleName;
52  fParticleGun->SetParticleDefinition(
53  particleTable->FindParticle(particleName="geantino"));
54  fParticleGun->SetParticleEnergy(1.0*GeV);
55  fParticleGun->SetParticlePosition(G4ThreeVector(-2.0*m, 0.1, 0.1));
56 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
CLHEP::Hep3Vector G4ThreeVector
int G4int
Definition: G4Types.hh:78
void SetParticlePosition(G4ThreeVector aPosition)
static constexpr double m
Definition: G4SIunits.hh:129
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:

G04PrimaryGeneratorAction::~G04PrimaryGeneratorAction ( )

Definition at line 60 of file G04PrimaryGeneratorAction.cc.

61 {
62  delete fParticleGun;
63 }

Member Function Documentation

void G04PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 67 of file G04PrimaryGeneratorAction.cc.

68 {
69  G4int i = anEvent->GetEventID() % 3;
70  G4ThreeVector v(1.0,0.0,0.0);
71  switch(i)
72  {
73  case 0:
74  break;
75  case 1:
76  v.setY(0.1);
77  break;
78  case 2:
79  v.setZ(0.1);
80  break;
81  }
82  fParticleGun->SetParticleMomentumDirection(v);
83  fParticleGun->GeneratePrimaryVertex(anEvent);
84 }
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
int G4int
Definition: G4Types.hh:78
virtual void GeneratePrimaryVertex(G4Event *evt)
G4int GetEventID() const
Definition: G4Event.hh:151
tuple v
Definition: test.py:18

Here is the call graph for this function:


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