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

#include <DicomPrimaryGeneratorAction.hh>

Inheritance diagram for DicomPrimaryGeneratorAction:
Collaboration diagram for DicomPrimaryGeneratorAction:

Public Member Functions

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

Detailed Description

Definition at line 58 of file DicomPrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

DicomPrimaryGeneratorAction::DicomPrimaryGeneratorAction ( )

Definition at line 57 of file DicomPrimaryGeneratorAction.cc.

59  fParticleGun(0)
60 {
61  G4int nParticle = 1;
62  fParticleGun = new G4ParticleGun(nParticle);
63 }
int G4int
Definition: G4Types.hh:78
DicomPrimaryGeneratorAction::~DicomPrimaryGeneratorAction ( )

Definition at line 66 of file DicomPrimaryGeneratorAction.cc.

67 {
68  delete fParticleGun;
69 }

Member Function Documentation

void DicomPrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 72 of file DicomPrimaryGeneratorAction.cc.

73 {
75  G4String particleName;
76  G4ParticleDefinition* particle
77  = particleTable->FindParticle(particleName="e-");
78  fParticleGun->SetParticleDefinition(particle);
79  // put the e- in the x direction of the patient (z in the accelerator axs)
80  // to hit patient in the central slice of the phantom
81  G4ThreeVector dir(0,0,1);
82  //G4ThreeVector dir(2.*CLHEP::RandFlat::shoot()-1.,
83  //2.*CLHEP::RandFlat::shoot()-1.,-CLHEP::RandFlat::shoot());
84  dir /= dir.mag();
85  fParticleGun->SetParticleMomentumDirection(dir);
86  fParticleGun->SetParticleEnergy(100.*MeV);
87  //put it at SAD = 1 m on xy plane of central slice
88  fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,-120.));
89  //fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,-22.));
90  fParticleGun->GeneratePrimaryVertex(anEvent);
91 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
CLHEP::Hep3Vector G4ThreeVector
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
virtual void GeneratePrimaryVertex(G4Event *evt)
void SetParticlePosition(G4ThreeVector aPosition)
void SetParticleEnergy(G4double aKineticEnergy)
static G4ParticleTable * GetParticleTable()
static constexpr double MeV
Definition: G4SIunits.hh:214
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)

Here is the call graph for this function:


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