G4-ExampleB1/src/EventAction.cc

22 lines
520 B
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "EventAction.hh"
#include "G4Event.hh"
#include "G4RunManager.hh"
#include "RunAction.hh"
namespace B1 {
// 初始化 fEventAction即获取到当前 Event 所在的 Run
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