Dear experts,
I’m writing a code that shall count the number of electrons and positrons hitting a CCD volume inside a geometry. The count shall NOT consider any secondaries that might be produced in the volume, but only the ones that reach it. For that I’m using G4SteppingManager, and I’d appreciate any feedbacks on my approach if possible.
So, for G4SteppingManager I take the volumes at the PreStepPoint and PostStepPoint and check if the step “enters” the volume. There, I retrieve the kinetic energy of the particle and store it in a ROOT ntuple, so later I can apply any energy filters that I like.
What I’m not entirely sure is if my conditionals are correct:
auto volPreStep = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
auto volPostStep = step->GetPostStepPoint()->GetTouchableHandle()->GetVolume();
G4double electronEkinetic = 0;
G4double positronEkinetic = 0;
if(step->GetTrack()->GetDefinition()->GetParticleName() == "e-"){
electronEkinetic = step->GetTrack()->GetKineticEnergy();
}
else if(step->GetTrack()->GetDefinition()->GetParticleName() == "e+"){
positronEkinetic = step->GetTrack()->GetKineticEnergy();
}
if(volPreStep != fGeometry->GetCCD() && volPostStep == fGeometry->GetCCD()){
fEventAction->AddCCD(electronEkinetic, positronEkinetic);
The methods GetCCD() and AddCCD() are similar to the ones from example B4a.
I could’ve used the multifunctional detector with primitive scorers, but my fear is that those might count the secondaries as well.
Any feedback on my conditionals to get only the incident electrons and positrons would be much appreciated And thanks in advance.
_Geant4 Version:_10.7.3
_Operating System:_GNU_Linux Debian 12
_Compiler/Version:_GCC 10.4
_CMake Version:_3.25.1