Created SteppingAction class
This commit is contained in:
parent
124bd583e7
commit
2cf2d6c10a
|
@ -0,0 +1,28 @@
|
||||||
|
//
|
||||||
|
// MedtechSteppingAction.hh
|
||||||
|
// medtech
|
||||||
|
//
|
||||||
|
// Created by Baranyai David on 2018. 04. 01..
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef MedtechSteppingAction_hh
|
||||||
|
#define MedtechSteppingAction_hh
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "G4UserSteppingAction.hh"
|
||||||
|
#include "MedtechEventAction.hh"
|
||||||
|
|
||||||
|
class MedtechSteppingAction : public G4UserSteppingAction
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MedtechSteppingAction(MedtechEventAction *eventAction);
|
||||||
|
virtual ~MedtechSteppingAction();
|
||||||
|
|
||||||
|
virtual void UserSteppingAction(const G4Step*);
|
||||||
|
|
||||||
|
private:
|
||||||
|
MedtechEventAction* fEventAction;
|
||||||
|
G4LogicalVolume* fScoringVolume;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* MedtechSteppingAction_hh */
|
|
@ -0,0 +1,40 @@
|
||||||
|
//
|
||||||
|
// MedtechSteppingAction.cc
|
||||||
|
// medtech
|
||||||
|
//
|
||||||
|
// Created by Baranyai David on 2018. 04. 01..
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "MedtechSteppingAction.hh"
|
||||||
|
|
||||||
|
MedtechSteppingAction::MedtechSteppingAction(MedtechEventAction* eventAction) : G4UserSteppingAction(), fEventAction(eventAction), fScoringVolume(0)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
MedtechSteppingAction::~MedtechSteppingAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void MedtechSteppingAction::UserSteppingAction(const G4Step* step)
|
||||||
|
{
|
||||||
|
if (!fScoringVolume) {
|
||||||
|
const MedtechDetectorConstruction* detectorConstruction
|
||||||
|
= static_cast<const MedtechDetectorConstruction*>
|
||||||
|
(G4RunManager::GetRunManager()->GetUserDetectorConstruction());
|
||||||
|
fScoringVolume = detectorConstruction->GetScoringVolume();
|
||||||
|
}
|
||||||
|
|
||||||
|
// get volume of the current step
|
||||||
|
G4LogicalVolume* volume
|
||||||
|
= step->GetPreStepPoint()->GetTouchableHandle()
|
||||||
|
->GetVolume()->GetLogicalVolume();
|
||||||
|
|
||||||
|
// check if we are in scoring volume
|
||||||
|
if (volume != fScoringVolume) return;
|
||||||
|
|
||||||
|
// collect energy deposited in this step
|
||||||
|
G4double edepStep = step->GetTotalEnergyDeposit();
|
||||||
|
fEventAction->AddEdep(edepStep);
|
||||||
|
}
|
Loading…
Reference in New Issue