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

#include <B3PrimaryGeneratorAction.hh>

Inheritance diagram for B3PrimaryGeneratorAction:
Collaboration diagram for B3PrimaryGeneratorAction:

Public Member Functions

 B3PrimaryGeneratorAction ()
 
virtual ~B3PrimaryGeneratorAction ()
 
virtual void GeneratePrimaries (G4Event *)
 
const G4ParticleGunGetParticleGun () const
 
 B3PrimaryGeneratorAction ()
 
virtual ~B3PrimaryGeneratorAction ()
 
virtual void GeneratePrimaries (G4Event *)
 
const G4ParticleGunGetParticleGun () const
 
- Public Member Functions inherited from G4VUserPrimaryGeneratorAction
 G4VUserPrimaryGeneratorAction ()
 
virtual ~G4VUserPrimaryGeneratorAction ()
 

Detailed Description

The primary generator action class with particle gum.

It defines an ion (F18), at rest, randomly distribued within a zone in a patient defined in GeneratePrimaries(). Ion F18 can be changed with the G4ParticleGun commands (see run2.mac).

Definition at line 47 of file B3PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

B3PrimaryGeneratorAction::B3PrimaryGeneratorAction ( )

Definition at line 45 of file B3PrimaryGeneratorAction.cc.

47  fParticleGun(0)
48 {
49  G4int n_particle = 1;
50  fParticleGun = new G4ParticleGun(n_particle);
51 
52  // default particle kinematic
53 
55  G4ParticleDefinition* particle
56  = particleTable->FindParticle("chargedgeantino");
57  fParticleGun->SetParticleDefinition(particle);
58  fParticleGun->SetParticlePosition(G4ThreeVector(0.,0.,0.));
59  fParticleGun->SetParticleEnergy(1*eV);
60  fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
61 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
CLHEP::Hep3Vector G4ThreeVector
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
int G4int
Definition: G4Types.hh:78
void SetParticlePosition(G4ThreeVector aPosition)
static constexpr double eV
Definition: G4SIunits.hh:215
void SetParticleEnergy(G4double aKineticEnergy)
static G4ParticleTable * GetParticleTable()
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)

Here is the call graph for this function:

B3PrimaryGeneratorAction::~B3PrimaryGeneratorAction ( )
virtual

Definition at line 65 of file B3PrimaryGeneratorAction.cc.

66 {
67  delete fParticleGun;
68 }
B3PrimaryGeneratorAction::B3PrimaryGeneratorAction ( )
virtual B3PrimaryGeneratorAction::~B3PrimaryGeneratorAction ( )
virtual

Member Function Documentation

void B3PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

G4double x0 = 0*cm, y0 = 0*cm, z0 = 0*cm; G4double dx0 = 0*cm, dy0 = 0*cm, dz0 = 0*cm;

Implements G4VUserPrimaryGeneratorAction.

Definition at line 72 of file B3PrimaryGeneratorAction.cc.

73 {
74  G4ParticleDefinition* particle = fParticleGun->GetParticleDefinition();
75  if (particle == G4ChargedGeantino::ChargedGeantino()) {
76  //fluorine
77  G4int Z = 9, A = 18;
78  G4double ionCharge = 0.*eplus;
79  G4double excitEnergy = 0.*keV;
80 
82  = G4IonTable::GetIonTable()->GetIon(Z,A,excitEnergy);
83  fParticleGun->SetParticleDefinition(ion);
84  fParticleGun->SetParticleCharge(ionCharge);
85  }
86 
87  // randomized position
88  //
91  G4double x0 = 4*cm, y0 = 4*cm, z0 = 4*cm;
92  G4double dx0 = 1*cm, dy0 = 1*cm, dz0 = 1*cm;
93  x0 += dx0*(G4UniformRand()-0.5);
94  y0 += dy0*(G4UniformRand()-0.5);
95  z0 += dz0*(G4UniformRand()-0.5);
96  fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));
97 
98  //create vertex
99  //
100  fParticleGun->GeneratePrimaryVertex(anEvent);
101 }
CLHEP::Hep3Vector G4ThreeVector
G4ParticleDefinition * GetIon(G4int Z, G4int A, G4int lvl=0)
Definition: G4IonTable.cc:503
static G4ChargedGeantino * ChargedGeantino()
int G4int
Definition: G4Types.hh:78
virtual void GeneratePrimaryVertex(G4Event *evt)
void SetParticlePosition(G4ThreeVector aPosition)
#define G4UniformRand()
Definition: Randomize.hh:97
double A(double temperature)
void SetParticleCharge(G4double aCharge)
static constexpr double cm
Definition: G4SIunits.hh:119
static constexpr double eplus
Definition: G4SIunits.hh:199
static G4IonTable * GetIonTable()
Definition: G4IonTable.hh:78
G4ParticleDefinition * GetParticleDefinition() const
double G4double
Definition: G4Types.hh:76
static constexpr double keV
Definition: G4SIunits.hh:216
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)

Here is the call graph for this function:

virtual void B3PrimaryGeneratorAction::GeneratePrimaries ( G4Event )
virtual
const G4ParticleGun* B3PrimaryGeneratorAction::GetParticleGun ( void  ) const
inline

Definition at line 55 of file B3PrimaryGeneratorAction.hh.

55 { return fParticleGun; }
const G4ParticleGun* B3PrimaryGeneratorAction::GetParticleGun ( void  ) const
inline

Definition at line 55 of file B3PrimaryGeneratorAction.hh.

55 { return fParticleGun; }

Here is the caller graph for this function:


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