10 using namespace CLHEP;
13 killHeavy =
p.getParameter<
bool>(
"KillHeavy");
14 kmaxIon =
p.getParameter<
double>(
"IonThreshold") * MeV;
15 kmaxProton =
p.getParameter<
double>(
"ProtonThreshold") * MeV;
16 kmaxNeutron =
p.getParameter<
double>(
"NeutronThreshold") * MeV;
18 edm::LogInfo(
"KillSecondaries") <<
"KillSecondariesTrackAction:: Killing" 19 <<
" Flag " << killHeavy <<
" protons below " << kmaxProton <<
" MeV, neutrons below " 20 << kmaxNeutron <<
" MeV and ions below " << kmaxIon <<
" MeV\n";
27 G4Track *theTrack = (G4Track *)((*
trk)());
30 int pdg = theTrack->GetDefinition()->GetPDGEncoding();
32 double ke = theTrack->GetKineticEnergy() / MeV;
33 if ((((
pdg / 1000000000 == 1 && ((
pdg / 10000) % 100) > 0 && ((
pdg / 10) % 100) > 0)) && (ke < kmaxIon)) ||
34 ((
pdg == 2212) && (ke < kmaxProton)) || ((
pdg == 2112) && (ke < kmaxNeutron))) {
35 theTrack->SetTrackStatus(fStopAndKill);
37 <<
"Kill Track " << theTrack->GetTrackID() <<
" Type " << theTrack->GetDefinition()->GetParticleName()
38 <<
" Kinetic Energy " << ke <<
" MeV";
KillSecondariesTrackAction(edm::ParameterSet const &p)
void update(const BeginOfTrack *trk) override
This routine will be called when the appropriate signal arrives.
Log< level::Info, false > LogInfo
~KillSecondariesTrackAction() override