G4-ExampleB1/include/RunAction.hh

36 lines
815 B
C++
Raw Normal View History

2022-04-29 13:24:29 +08:00
#ifndef B1RunAction_h
#define B1RunAction_h 1
#include "G4Accumulable.hh"
#include "G4UserRunAction.hh"
#include "globals.hh"
class G4Run;
/// Run action class
///
/// In EndOfRunAction(), it calculates the dose in the selected volume
/// from the energy deposit accumulated via stepping and event actions.
/// The computed dose is then printed on the screen.
namespace B1 {
class RunAction : public G4UserRunAction {
public:
RunAction();
~RunAction() override;
void BeginOfRunAction(const G4Run*) override; // Run 开始时执行
void EndOfRunAction(const G4Run*) override; // Run 结束时执行
void AddEdep(G4double edep); // 计算累计沉积的能量
private:
G4Accumulable<G4double> fEdep = 0.;
G4Accumulable<G4double> fEdep2 = 0.;
};
} // namespace B1
#endif