G4-ExampleB1/src/EventAction.cc

22 lines
520 B
C++
Raw Normal View History

2022-04-29 13:24:29 +08:00
#include "EventAction.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "RunAction.hh"
namespace B1 {
2022-04-30 21:39:54 +08:00
// 初始化 fEventAction即获取到当前 Event 所在的 Run
2022-04-29 13:24:29 +08:00
EventAction::EventAction(RunAction* runAction) : fRunAction(runAction) {}
EventAction::~EventAction() {}
void EventAction::BeginOfEventAction(const G4Event*) { fEdep = 0.; }
void EventAction::EndOfEventAction(const G4Event*) {
// 将 event 中的沉积能量返回给 run
fRunAction->AddEdep(fEdep);
}
} // namespace B1