CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
KillSecondariesTrackAction Class Reference

#include <KillSecondariesTrackAction.h>

Inheritance diagram for KillSecondariesTrackAction:
SimWatcher Observer< const BeginOfTrack *>

Public Member Functions

 KillSecondariesTrackAction (edm::ParameterSet const &p)
 
void update (const BeginOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
 ~KillSecondariesTrackAction () override
 
- Public Member Functions inherited from SimWatcher
virtual void beginRun (edm::EventSetup const &)
 
bool isMT () const
 
const SimWatcheroperator= (const SimWatcher &)=delete
 
virtual void registerConsumes (edm::ConsumesCollector)
 
 SimWatcher ()
 
 SimWatcher (const SimWatcher &)=delete
 
virtual ~SimWatcher ()
 
- Public Member Functions inherited from Observer< const BeginOfTrack *>
 Observer ()
 
void slotForUpdate (const BeginOfTrack * iT)
 
virtual ~Observer ()
 

Private Attributes

bool killHeavy
 
double kmaxIon
 
double kmaxNeutron
 
double kmaxProton
 

Additional Inherited Members

- Protected Member Functions inherited from SimWatcher
void setMT (bool val)
 

Detailed Description

Definition at line 10 of file KillSecondariesTrackAction.h.

Constructor & Destructor Documentation

◆ KillSecondariesTrackAction()

KillSecondariesTrackAction::KillSecondariesTrackAction ( edm::ParameterSet const &  p)

Definition at line 12 of file KillSecondariesTrackAction.cc.

References AlCaHLTBitMon_ParallelJobs::p.

12  {
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 }
Log< level::Info, false > LogInfo

◆ ~KillSecondariesTrackAction()

KillSecondariesTrackAction::~KillSecondariesTrackAction ( )
override

Definition at line 23 of file KillSecondariesTrackAction.cc.

23 {}

Member Function Documentation

◆ update()

void KillSecondariesTrackAction::update ( const BeginOfTrack )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack *>.

Definition at line 25 of file KillSecondariesTrackAction.cc.

References TrackInformation::isPrimary().

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), and MatrixUtil.Steps::overwrite().

25  {
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 }
bool isPrimary() const
Log< level::Info, false > LogInfo

Member Data Documentation

◆ killHeavy

bool KillSecondariesTrackAction::killHeavy
private

Definition at line 17 of file KillSecondariesTrackAction.h.

◆ kmaxIon

double KillSecondariesTrackAction::kmaxIon
private

Definition at line 18 of file KillSecondariesTrackAction.h.

◆ kmaxNeutron

double KillSecondariesTrackAction::kmaxNeutron
private

Definition at line 18 of file KillSecondariesTrackAction.h.

◆ kmaxProton

double KillSecondariesTrackAction::kmaxProton
private

Definition at line 18 of file KillSecondariesTrackAction.h.