/////////////////////////////////////////////////////////////////// // // MiniSims are ad-hoc RAT simulations. This class can be extended to // simulate an ad-hoc version of RAT. For example, a fitter might throw // a photon bomb to derive optical response parameters, then use these // parameters later in a fit. // // Author: A Mastbaum // // REVISION HISTORY: // 2014-05-30 : P G Jones - no longer derives from stepping and // tracking actions, instead uses RAT classes. Also // added doxygen comments // /////////////////////////////////////////////////////////////////// #ifndef __RAT__MiniSim__ #define __RAT__MiniSim__ #include #include #include #include class G4UserTrackingAction; class G4UserSteppingAction; namespace RAT { class TrackingAction; class SteppingAction; class MiniSim : public G4UserEventAction, G4VUserPrimaryGeneratorAction { public: // Construct MiniSim, news the stepping and tracking actions MiniSim(); // Destruct MiniSim, releases control and deletes the stepping and tracking actions virtual ~MiniSim(); // Start simulating nevents with MiniSim // // nevents: number of events to simulate virtual void BeamOn(const int nevents); // This method is called by geant4 to generate primary particles // // This must be overridden // // argEvent: the G4Event with primaries to simulate virtual void GeneratePrimaries(G4Event* argEvent) = 0; // This method is called by geant4 before it starts simulating an event // // This can be overridden virtual void BeginOfEventAction(const G4Event* /*anEvent*/) {}; // This method is called by geant4 after is has simulated an event // // This can be overridden virtual void EndOfEventAction(const G4Event* /*anEvent*/) {}; protected: // Called internally by MiniSim to redirect Geant4 control to itself virtual void TakeSimControl(); // Called internally by MiniSim to redirect Geant4 control back to the original objects virtual void ReleaseSimControl(); bool fHaveControl; // This is true if MiniSim is in control of Geant4 TrackingAction* fTrackingAction; // The tracking action MiniSim uses SteppingAction* fSteppingAction; // The stepping action MiniSim uses const G4UserRunAction* fOrigRunAction; // The original run action const G4UserEventAction* fOrigEventAction; // The original event action const G4UserStackingAction* fOrigStackingAction; // The original stacking action const G4UserTrackingAction* fOrigTrackingAction; // The original tracking action const G4UserSteppingAction* fOrigSteppingAction; // The original stepping action const G4VUserPrimaryGeneratorAction* fOrigPrimaryGeneratorAction; // The original primary generator action }; } // namespace RAT #endif