From e39ae5befdc679965881c14ecbeacb0805abe25c Mon Sep 17 00:00:00 2001 From: Gitea Date: Mon, 2 Apr 2018 23:14:52 +0200 Subject: [PATCH] Created EventAction class --- include/MedtechEventAction.hh | 32 ++++++++++++++++++++++++++++++++ src/MedtechEventAction.cc | 28 ++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 include/MedtechEventAction.hh create mode 100644 src/MedtechEventAction.cc diff --git a/include/MedtechEventAction.hh b/include/MedtechEventAction.hh new file mode 100644 index 0000000..8e1e609 --- /dev/null +++ b/include/MedtechEventAction.hh @@ -0,0 +1,32 @@ +// +// MedtechEventAction.hh +// medtech +// +// Created by Baranyai David on 2018. 04. 01.. +// + +#ifndef MedtechEventAction_hh +#define MedtechEventAction_hh + +#include +#include "G4UserEventAction.hh" +#include "G4Types.hh" +#include "MedtechRunAction.hh" + +class MedtechEventAction : public G4UserEventAction +{ +public: + MedtechEventAction(MedtechRunAction *runAction); + virtual ~MedtechEventAction(); + + virtual void BeginOfEventAction(const G4Event* event); + virtual void EndOfEventAction(const G4Event* event); + + void AddEdep(G4double edep) { fEdep += edep; } + +private: + MedtechRunAction* fRunAction; + G4double fEdep; +}; + +#endif /* MedtechEventAction_hh */ diff --git a/src/MedtechEventAction.cc b/src/MedtechEventAction.cc new file mode 100644 index 0000000..33262fa --- /dev/null +++ b/src/MedtechEventAction.cc @@ -0,0 +1,28 @@ +// +// MedtechEventAction.cc +// medtech +// +// Created by Baranyai David on 2018. 04. 01.. +// + +#include "MedtechEventAction.hh" + +MedtechEventAction::MedtechEventAction(MedtechRunAction *runAction) : G4UserEventAction(), fRunAction(runAction), fEdep(0.) +{ +} + +MedtechEventAction::~MedtechEventAction() +{ + +} + +void MedtechEventAction::BeginOfEventAction(const G4Event*) +{ + fEdep = 0.; +} + +void MedtechEventAction::EndOfEventAction(const G4Event*) +{ + // accumulate statistics in run action + fRunAction->AddEdep(fEdep); +}