LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
PrimaryGeneratorAction Class Reference

#include "PrimaryGeneratorAction.hh"

Inheritance diagram for PrimaryGeneratorAction:

Public Member Functions

 PrimaryGeneratorAction (DetectorConstruction *)
 
 ~PrimaryGeneratorAction ()
 
void SetDefaultKinematic ()
 
void GeneratePrimaries (G4Event *)
 
G4ParticleGun * GetParticleGun ()
 

Private Attributes

G4ParticleGun * particleGun
 
DetectorConstructionDetector
 

Detailed Description

Definition at line 42 of file PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

PrimaryGeneratorAction::PrimaryGeneratorAction ( DetectorConstruction DC)

Definition at line 44 of file PrimaryGeneratorAction.cc.

References particleGun, and SetDefaultKinematic().

45 :Detector(DC)
46 {
47  particleGun = new G4ParticleGun(1);
49 }
DetectorConstruction * Detector
PrimaryGeneratorAction::~PrimaryGeneratorAction ( )

Definition at line 53 of file PrimaryGeneratorAction.cc.

References particleGun.

54 {
55  delete particleGun;
56 }

Member Function Documentation

void PrimaryGeneratorAction::GeneratePrimaries ( G4Event *  anEvent)

Definition at line 73 of file PrimaryGeneratorAction.cc.

References particleGun.

74 {
75  //this function is called at the begining of event
76  //
77  particleGun->GeneratePrimaryVertex(anEvent);
78 }
G4ParticleGun* PrimaryGeneratorAction::GetParticleGun ( )
inline

Definition at line 52 of file PrimaryGeneratorAction.hh.

References particleGun.

Referenced by RunAction::BeginOfRunAction().

52 {return particleGun;}
void PrimaryGeneratorAction::SetDefaultKinematic ( )

Definition at line 60 of file PrimaryGeneratorAction.cc.

References Detector, DetectorConstruction::GetSize(), and particleGun.

Referenced by PrimaryGeneratorAction().

61 {
62  G4ParticleDefinition* particle
63  = G4ParticleTable::GetParticleTable()->FindParticle("e-");
64  particleGun->SetParticleDefinition(particle);
65  particleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));
66  particleGun->SetParticleEnergy(100*MeV);
67  G4double position = -0.5*(Detector->GetSize());
68  particleGun->SetParticlePosition(G4ThreeVector(position,0.*cm,0.*cm));
69 }
DetectorConstruction * Detector

Member Data Documentation

DetectorConstruction* PrimaryGeneratorAction::Detector
private

Definition at line 56 of file PrimaryGeneratorAction.hh.

Referenced by SetDefaultKinematic().

G4ParticleGun* PrimaryGeneratorAction::particleGun
private

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