#ifndef B1PrimaryGeneratorAction_h #define B1PrimaryGeneratorAction_h 1 #include "G4ParticleGun.hh" #include "G4VUserPrimaryGeneratorAction.hh" #include "globals.hh" class G4ParticleGun; class G4Event; class G4Box; /// The primary generator action class with particle gun. /// /// The default kinematic is a 6 MeV gamma, randomly distribued /// in front of the phantom across 80% of the (X,Y) phantom size. namespace B1 { // G4ParticleGun 粒子枪,即辐射源 class PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction { public: PrimaryGeneratorAction(); ~PrimaryGeneratorAction() override; // method from the base class void GeneratePrimaries(G4Event*) override; // method to access particle gun const G4ParticleGun* GetParticleGun() const { return fParticleGun; } private: G4ParticleGun* fParticleGun = nullptr; // pointer a to G4 gun class G4Box* fEnvelopeBox = nullptr; }; } // namespace B1 #endif