Created EventAction class

This commit is contained in:
Gitea 2018-04-02 23:14:52 +02:00
parent 92aa2e0199
commit e39ae5befd
2 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,32 @@
//
// MedtechEventAction.hh
// medtech
//
// Created by Baranyai David on 2018. 04. 01..
//
#ifndef MedtechEventAction_hh
#define MedtechEventAction_hh
#include <stdio.h>
#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 */

28
src/MedtechEventAction.cc Normal file
View File

@ -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);
}