LArSoft  v06_85_00
Liquid Argon Software toolkit - http://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 43 of file PrimaryGeneratorAction.hh.

Constructor & Destructor Documentation

PrimaryGeneratorAction::PrimaryGeneratorAction ( DetectorConstruction DC)

Definition at line 45 of file PrimaryGeneratorAction.cc.

References particleGun, and SetDefaultKinematic().

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

Definition at line 54 of file PrimaryGeneratorAction.cc.

References particleGun.

55 {
56  delete particleGun;
57 }

Member Function Documentation

void PrimaryGeneratorAction::GeneratePrimaries ( G4Event *  anEvent)

Definition at line 74 of file PrimaryGeneratorAction.cc.

References particleGun.

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

Definition at line 53 of file PrimaryGeneratorAction.hh.

References particleGun.

Referenced by RunAction::BeginOfRunAction().

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

Definition at line 61 of file PrimaryGeneratorAction.cc.

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

Referenced by PrimaryGeneratorAction().

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

Member Data Documentation

DetectorConstruction* PrimaryGeneratorAction::Detector
private

Definition at line 57 of file PrimaryGeneratorAction.hh.

Referenced by SetDefaultKinematic().

G4ParticleGun* PrimaryGeneratorAction::particleGun
private

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