Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G03PrimaryGeneratorAction Class Reference

Primary generator action for the GDML extension example. More...

#include <G03PrimaryGeneratorAction.hh>

Inheritance diagram for G03PrimaryGeneratorAction:
G4VUserPrimaryGeneratorAction

Public Member Functions

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

Detailed Description

Primary generator action for the GDML extension example.

Definition at line 49 of file G03PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

G03PrimaryGeneratorAction::G03PrimaryGeneratorAction ( )

Definition at line 44 of file G03PrimaryGeneratorAction.cc.

References G4ParticleTable::FindParticle(), G4ParticleTable::GetParticleTable(), python.hepunit::MeV, G4ParticleGun::SetParticleDefinition(), G4ParticleGun::SetParticleEnergy(), G4ParticleGun::SetParticleMomentumDirection(), and G4VPrimaryGenerator::SetParticlePosition().

46  fParticleGun(0),
47  fParticleTable(0)
48 {
49  // Particle gun and particle table
50  //
51  fParticleGun = new G4ParticleGun();
52  fParticleTable = G4ParticleTable::GetParticleTable();
53 
54  // Default particle
55  //
56  fParticleGun->SetParticleDefinition(fParticleTable->FindParticle("geantino"));
57  fParticleGun->SetParticleEnergy( 1.0*MeV );
58 
59  G4ThreeVector err1=G4ThreeVector(-1260,-560,40); // outside
60  G4ThreeVector err2=G4ThreeVector(100,-240,120); // inside
61  G4ThreeVector err2v=(err2-err1).unit();
62 
63  fParticleGun->SetParticleMomentumDirection(err2v);
64  fParticleGun->SetParticlePosition(err1);
65 
66 }
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
CLHEP::Hep3Vector G4ThreeVector
void SetParticleMomentumDirection(G4ParticleMomentum aMomentumDirection)
void SetParticlePosition(G4ThreeVector aPosition)
void SetParticleEnergy(G4double aKineticEnergy)
static G4ParticleTable * GetParticleTable()
void SetParticleDefinition(G4ParticleDefinition *aParticleDefinition)
G03PrimaryGeneratorAction::~G03PrimaryGeneratorAction ( )

Definition at line 70 of file G03PrimaryGeneratorAction.cc.

71 {
72  delete fParticleGun;
73 }

Member Function Documentation

void G03PrimaryGeneratorAction::GeneratePrimaries ( G4Event anEvent)
virtual

Implements G4VUserPrimaryGeneratorAction.

Definition at line 77 of file G03PrimaryGeneratorAction.cc.

References G4ParticleGun::GeneratePrimaryVertex().

78 {
79  fParticleGun->GeneratePrimaryVertex(anEvent);
80 }
virtual void GeneratePrimaryVertex(G4Event *evt)

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