#ifndef B1EventAction_h #define B1EventAction_h 1 #include "G4UserEventAction.hh" #include "globals.hh" /// Event action class namespace B1 { class RunAction; class EventAction : public G4UserEventAction { public: EventAction(RunAction* runAction); ~EventAction() override; void BeginOfEventAction(const G4Event* event) override; void EndOfEventAction(const G4Event* event) override; // 对每个 step 累加,最后一个 step 输出一个 event 的能量沉积 void AddEdep(G4double edep) { fEdep += edep; } private: RunAction* fRunAction = nullptr; G4double fEdep = 0.; }; } // namespace B1 #endif