33 const G4Track* track,
const G4ClassificationOfNewTrack& currentTrackClass) {
35 G4int pdg_id = track->GetParticleDefinition()->GetPDGEncoding();
38 G4String particle_name = track->GetParticleDefinition()->GetParticleName();
42 G4ClassificationOfNewTrack classification = currentTrackClass;
44 if (track->GetTrackID() == 1 && pdg_id == 11) {
48 return classification;
53 auto track{step->GetTrack()};
56 if (track->GetParentID() != 0)
return;
60 if (
auto pdg_id{track->GetParticleDefinition()->GetPDGEncoding()};
66 static auto target_region =
67 simcore::g4user::ptrretrieval::getRegion(
"target");
69 ldmx_log(warn) <<
"Region 'target' not found in Geant4 region store";
71 auto phy_vol{track->GetVolume()};
72 auto log_vol{phy_vol ? phy_vol->GetLogicalVolume() :
nullptr};
73 auto track_region{log_vol ? log_vol->GetRegion() :
nullptr};
74 if (track_region != target_region)
return;
95 auto recoil_physical_volume =
96 simcore::g4user::ptrretrieval::getPhysicalVolume(
"recoil_PV");
97 auto world_physical_volume =
98 simcore::g4user::ptrretrieval::getPhysicalVolume(
"World_PV");
99 if (!recoil_physical_volume) {
100 ldmx_log(warn) <<
"Volume 'recoil_PV' not found in Geant4 volume store";
102 if (!world_physical_volume) {
103 ldmx_log(warn) <<
"Volume 'World_PV' not found in Geant4 volume store";
105 auto track_volume = track->GetNextVolume();
106 if (track_volume == recoil_physical_volume or
107 track_volume == world_physical_volume) {
110 track->SetTrackStatus(fKillTrackAndSecondaries);
111 G4RunManager::GetRunManager()->AbortEvent();
116 bool has_brem_candidate =
false;
117 if (
auto secondaries = step->GetSecondary(); secondaries->size() == 0) {
118 track->SetTrackStatus(fKillTrackAndSecondaries);
119 G4RunManager::GetRunManager()->AbortEvent();
122 for (
auto& secondary_track : *secondaries) {
123 auto electron = G4Electron::Definition();
125 simcore::g4user::ptrretrieval::getProcess(electron,
"eBrem");
126 if (!ebrem_process) {
127 ldmx_log(warn) <<
"Process 'eBrem' not found in Geant4 process store";
133 track_info->tagBremCandidate();
137 has_brem_candidate =
true;
142 if (!has_brem_candidate) {
143 track->SetTrackStatus(fKillTrackAndSecondaries);
144 G4RunManager::GetRunManager()->AbortEvent();
155 track->SetTrackStatus(fStopAndKill);
157 track->SetTrackStatus(fSuspend);
159 }
else if (step->GetPostStepPoint()->GetKineticEnergy() == 0) {
160 track->SetTrackStatus(fKillTrackAndSecondaries);
161 G4RunManager::GetRunManager()->AbortEvent();