#include "steppingAction.hh" #include "G4VProcess.hh" #include "G4SystemOfUnits.hh" #include "G4Gamma.hh" #include "G4Alpha.hh" #include "G4Triton.hh" #include "G4Proton.hh" #include "G4Electron.hh" #include "G4Neutron.hh" #include "G4AnalysisManager.hh" MySteppingAction::MySteppingAction() : fEdepCryst1(0.) {} void MySteppingAction::BeginOfEventAction() { fEdepCryst1 = 0.; } void MySteppingAction::EndOfEventAction() { G4AnalysisManager* mgr = G4AnalysisManager::Instance(); if ((fEdepCryst1) > 0.) { mgr->FillNtupleDColumn(1, fEdepCryst1); mgr->AddNtupleRow(); } } void MySteppingAction::UserSteppingAction(const G4Step* step) { G4StepPoint* postStepPoint = step->GetPostStepPoint(); //G4StepPoint* preStepPoint = step->GetPreStepPoint(); G4Track* track = step->GetTrack(); // To avoid recording interaction from the Co-60 beta- emission if (track->GetDefinition() == G4Electron::Electron()) { track->SetTrackStatus(fStopAndKill); return; } //preVolumeName = postStepPoint->GetPhysicalVolume()->GetName(); // To only record the interactions in the B if (postStepPoint->GetPhysicalVolume() == nullptr) return; if (postStepPoint->GetPhysicalVolume()->GetName() != "Cryst1" ) return; const G4VProcess* postProcessDefinedStep = postStepPoint->GetProcessDefinedStep(); if (postProcessDefinedStep == nullptr) return; // To store the energy deposits in the crystals during the event if (postStepPoint->GetPhysicalVolume()->GetName() == "Cryst1") { if(track->GetDefinition()->GetParticleName() == "proton" || "triton") { G4double Edep1 = step->GetTotalEnergyDeposit() / keV; if(Edep1 > 0.) fEdepCryst1 += Edep1; return; } } }