19#include "BDSGlobalConstants.hh"
20#include "BDSLinkStackingAction.hh"
21#include "BDSPhysicsUtilities.hh"
22#include "BDSRunManager.hh"
26#include "G4TrackStatus.hh"
28#include "G4ParticleDefinition.hh"
32G4double BDSLinkStackingAction::kineticEnergyKilled = 0;
35 const std::set<G4int>& pdgIDsToAllowIn,
36 G4bool protonsAndIonsOnlyIn,
37 G4double minimumEKIn):
38 pdgIDsToAllow(pdgIDsToAllowIn),
39 emptyPDGIDs(pdgIDsToAllow.empty()),
40 protonsAndIonsOnly(protonsAndIonsOnlyIn),
41 minimumEK(minimumEKIn)
43 killNeutrinos = globals->KillNeutrinos();
44 stopSecondaries = globals->StopSecondaries();
45 maxTracksPerEvent = globals->MaximumTracksPerEvent();
46 if (maxTracksPerEvent == 0)
47 {maxTracksPerEvent = LONG_MAX;}
50BDSLinkStackingAction::~BDSLinkStackingAction()
55 G4ClassificationOfNewTrack result = fUrgent;
59 else if (aTrack->GetKineticEnergy() <=
minimumEK)
65 auto definition = aTrack->GetDefinition();
66 G4int pdgID = definition->GetPDGEncoding();
70 if (pdgID == 12 || pdgID == 14 || pdgID == 16)
74 if (protonsAndIonsOnly)
78 else if (pdgID == 2212)
81 else if (!emptyPDGIDs)
83 if (pdgIDsToAllow.find(pdgID) != pdgIDsToAllow.end())
89 {kineticEnergyKilled += aTrack->GetKineticEnergy() * aTrack->GetWeight();}
A class that holds global options and constants.
G4bool stopSecondaries
Whether particles with parentID > 0 will be killed.
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *aTrack)
G4double minimumEK
Minimum kinetic energy to generate a hit for.
BDSLinkStackingAction()=delete
Force use of supplied constructor.
G4bool killNeutrinos
Local copy of whether to kill neutrinos for tracking efficiency.
G4long maxTracksPerEvent
Maximum number of tracks before start killing.
G4bool IsIon(const G4ParticleDefinition *particle)
Whether a particle is an ion. A proton is counted NOT as an ion.