CMS 3D CMS Logo

KillSecondariesTrackAction.cc
Go to the documentation of this file.
2 
5 
7 
8 #include "G4Track.hh"
9 
10 using namespace CLHEP;
11 
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;
17 
18  edm::LogInfo("KillSecondaries") << "KillSecondariesTrackAction:: Killing"
19  << " Flag " << killHeavy << " protons below " << kmaxProton << " MeV, neutrons below "
20  << kmaxNeutron << " MeV and ions below " << kmaxIon << " MeV\n";
21 }
22 
24 
26  if (killHeavy) {
27  G4Track *theTrack = (G4Track *)((*trk)());
28  TrackInformation *trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
29  if (trkInfo) {
30  int pdg = theTrack->GetDefinition()->GetPDGEncoding();
31  if (!(trkInfo->isPrimary())) { // Only secondary particles
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);
36  edm::LogInfo("KillSecondaries")
37  << "Kill Track " << theTrack->GetTrackID() << " Type " << theTrack->GetDefinition()->GetParticleName()
38  << " Kinetic Energy " << ke << " MeV";
39  }
40  }
41  }
42  }
43 }
KillSecondariesTrackAction::~KillSecondariesTrackAction
~KillSecondariesTrackAction() override
Definition: KillSecondariesTrackAction.cc:23
MessageLogger.h
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
KillSecondariesTrackAction::KillSecondariesTrackAction
KillSecondariesTrackAction(edm::ParameterSet const &p)
Definition: KillSecondariesTrackAction.cc:12
MeV
const double MeV
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
KillSecondariesTrackAction.h
BeginOfTrack.h
TrackInformation::isPrimary
bool isPrimary() const
Definition: TrackInformation.h:27
BeginOfTrack
Definition: BeginOfTrack.h:6
KillSecondariesTrackAction::update
void update(const BeginOfTrack *trk) override
This routine will be called when the appropriate signal arrives.
Definition: KillSecondariesTrackAction.cc:25
CLHEP
Definition: CocoaGlobals.h:27
edm::ParameterSet
Definition: ParameterSet.h:47
ke
int ke
Definition: CascadeWrapper.h:13
TrackInformation
Definition: TrackInformation.h:12
TrackInformation.h
pdg
Definition: pdg_functions.h:28