// // ******************************************************************** // * 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: EXPO_Primary.icc,v 1.3.4.1 2001/06/28 19:06:31 gunter Exp $ // GEANT4 tag $Name: $ // // See also G4/run/example/EXPO_PrimaryGeneratorAction.cc. #include #include #include #include #include #include class EXPO_PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction { private: G4ParticleGun* particleGun; public: EXPO_PrimaryGeneratorAction() { G4int n_particle = 1; G4String particleName; particleGun = new G4ParticleGun(n_particle); G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable(); G4ParticleDefinition* particle = particleTable->FindParticle(particleName="e-"); particleGun->SetParticleDefinition (particle); particleGun->SetParticleEnergy (1.*GeV); particleGun->SetParticleMomentumDirection (G4ThreeVector(1.,0.,0.)); particleGun->SetParticlePosition (G4ThreeVector(0.*cm,0.*cm,0.*cm)); } ~EXPO_PrimaryGeneratorAction() { delete particleGun; } void GeneratePrimaries(G4Event* anEvent) { particleGun->GeneratePrimaryVertex(anEvent); } };