#include "YourSteppingAction.hh" #include "YourDetectorConstruction.hh" #include "YourEventAction.hh" #include "G4Step.hh" YourSteppingAction::YourSteppingAction(YourDetectorConstruction* det, YourEventAction* evtAct) : G4UserSteppingAction(), fDetector(det), fEvtAct(evtAct) {} YourSteppingAction::~YourSteppingAction() {} void YourSteppingAction::UserSteppingAction(const G4Step* stp) { // check if thi step was done inside the target if (stp->GetPreStepPoint()->GetPhysicalVolume() != fDetector->GetTargetPhysicalVolume()) { return; } G4double edep = stp->GetTotalEnergyDeposit(); G4double slen = stp->GetStepLength(); if ( stp->GetTrack()->GetParticleDefinition()->GetPDGCharge() != 0.0) { fEvtAct->AddCHL(slen); } fEvtAct->AddEdep(edep); }