// // ******************************************************************** // * DISCLAIMER * // * * // * The following disclaimer summarizes all the specific disclaimers * // * of contributors to this software. The specific disclaimers,which * // * govern, are listed with their locations in: * // * http://cern.ch/geant4/license * // * * // * Neither the authors of this software system, nor their employing * // * institutes,nor the agencies providing financial support for this * // * work make any representation or warranty, express or implied, * // * regarding this software system or assume any liability for its * // * use. * // * * // * This code implementation is the intellectual property of the * // * GEANT4 collaboration. * // * By copying, distributing or modifying the Program (or any work * // * based on the Program) you indicate your acceptance of this * // * statement, and all its terms. * // ******************************************************************** // // // $Id: Em2PrimaryGeneratorAction.cc,v 1.5 2002/10/31 13:58:32 maire Exp $ // GEANT4 tag $Name: geant4-05-00 $ // // //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... #include "Em2PrimaryGeneratorAction.hh" #include "Em2DetectorConstruction.hh" #include "G4Event.hh" #include "G4ParticleTable.hh" #include "G4ParticleDefinition.hh" //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... Em2PrimaryGeneratorAction::Em2PrimaryGeneratorAction( Em2DetectorConstruction* det) :Em2Detector(det) { G4int n_particle = 1; particleGun = new G4ParticleGun(n_particle); G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()->FindParticle("e-"); particleGun->SetParticleDefinition(particle); particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.)); particleGun->SetParticleEnergy(5.*GeV); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... Em2PrimaryGeneratorAction::~Em2PrimaryGeneratorAction() { delete particleGun; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... void Em2PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent) { //this function is called at the begin of event // G4double position = -0.5*(Em2Detector->GetfullLength()); particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position)); particleGun->GeneratePrimaryVertex(anEvent); } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......