18#include "BDSGlobalConstants.hh"
19#include "BDSLinkStackingAction.hh"
20#include "BDSPhysicsUtilities.hh"
21#include "BDSRunManager.hh"
25#include "G4TrackStatus.hh"
27#include "G4ParticleDefinition.hh"
31G4double BDSLinkStackingAction::kineticEnergyKilled = 0;
34 const std::set<G4int>& pdgIDsToAllowIn,
35 G4bool protonsAndIonsOnlyIn,
36 G4double minimumEKIn):
37 pdgIDsToAllow(pdgIDsToAllowIn),
38 emptyPDGIDs(pdgIDsToAllow.empty()),
39 protonsAndIonsOnly(protonsAndIonsOnlyIn),
40 minimumEK(minimumEKIn)
42 killNeutrinos = globals->KillNeutrinos();
43 stopSecondaries = globals->StopSecondaries();
44 maxTracksPerEvent = globals->MaximumTracksPerEvent();
45 if (maxTracksPerEvent == 0)
46 {maxTracksPerEvent = LONG_MAX;}
49BDSLinkStackingAction::~BDSLinkStackingAction()
54 G4ClassificationOfNewTrack result = fUrgent;
58 else if (aTrack->GetKineticEnergy() <=
minimumEK)
64 auto definition = aTrack->GetDefinition();
65 G4int pdgID = definition->GetPDGEncoding();
69 if (pdgID == 12 || pdgID == 14 || pdgID == 16)
73 if (protonsAndIonsOnly)
77 else if (pdgID == 2212)
80 else if (!emptyPDGIDs)
82 if (pdgIDsToAllow.find(pdgID) != pdgIDsToAllow.end())
88 {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.