35 const G4Track* track,
const G4ClassificationOfNewTrack& currentTrackClass) {
37 G4int pdgID = track->GetParticleDefinition()->GetPDGEncoding();
40 G4String particleName = track->GetParticleDefinition()->GetParticleName();
44 G4ClassificationOfNewTrack classification = currentTrackClass;
46 if (track->GetTrackID() == 1 && pdgID == 11) {
50 return classification;
55 auto track{step->GetTrack()};
58 if (track->GetParentID() != 0)
return;
62 if (
auto pdgID{track->GetParticleDefinition()->GetPDGEncoding()}; pdgID != 11)
67 static auto target_region =
68 simcore::g4user::ptrretrieval::getRegion(
"target");
70 ldmx_log(warn) <<
"Region 'target' not found in Geant4 region store";
72 auto phy_vol{track->GetVolume()};
73 auto log_vol{phy_vol ? phy_vol->GetLogicalVolume() :
nullptr};
74 auto track_region{log_vol ? log_vol->GetRegion() :
nullptr};
75 if (track_region != target_region)
return;
96 auto recoil_physical_volume =
97 simcore::g4user::ptrretrieval::getPhysicalVolume(
"recoil_PV");
98 auto world_physical_volume =
99 simcore::g4user::ptrretrieval::getPhysicalVolume(
"World_PV");
100 if (!recoil_physical_volume) {
101 ldmx_log(warn) <<
"Volume 'recoil_PV' not found in Geant4 volume store";
103 if (!world_physical_volume) {
104 ldmx_log(warn) <<
"Volume 'World_PV' not found in Geant4 volume store";
106 auto track_volume = track->GetNextVolume();
107 if (track_volume == recoil_physical_volume or
108 track_volume == world_physical_volume) {
111 track->SetTrackStatus(fKillTrackAndSecondaries);
112 G4RunManager::GetRunManager()->AbortEvent();
117 bool hasBremCandidate =
false;
118 if (
auto secondaries = step->GetSecondary(); secondaries->size() == 0) {
119 track->SetTrackStatus(fKillTrackAndSecondaries);
120 G4RunManager::GetRunManager()->AbortEvent();
123 for (
auto& secondary_track : *secondaries) {
124 auto electron = G4Electron::Definition();
126 simcore::g4user::ptrretrieval::getProcess(electron,
"eBrem");
127 if (!ebrem_process) {
128 ldmx_log(warn) <<
"Process 'eBrem' not found in Geant4 process store";
134 trackInfo->tagBremCandidate();
138 hasBremCandidate =
true;
143 if (!hasBremCandidate) {
144 track->SetTrackStatus(fKillTrackAndSecondaries);
145 G4RunManager::GetRunManager()->AbortEvent();
156 track->SetTrackStatus(fStopAndKill);
158 track->SetTrackStatus(fSuspend);
160 }
else if (step->GetPostStepPoint()->GetKineticEnergy() == 0) {
161 track->SetTrackStatus(fKillTrackAndSecondaries);
162 G4RunManager::GetRunManager()->AbortEvent();