#include <SimG4Core/KillSecondaries/interface/KillSecondariesTrackAction.h>
Public Member Functions | |
KillSecondariesTrackAction (edm::ParameterSet const &p) | |
void | update (const BeginOfTrack *trk) |
This routine will be called when the appropriate signal arrives. | |
~KillSecondariesTrackAction () | |
Private Attributes | |
bool | killHeavy |
double | kmaxIon |
double | kmaxNeutron |
double | kmaxProton |
Definition at line 10 of file KillSecondariesTrackAction.h.
KillSecondariesTrackAction::KillSecondariesTrackAction | ( | edm::ParameterSet const & | p | ) |
Definition at line 10 of file KillSecondariesTrackAction.cc.
References edm::ParameterSet::getParameter(), killHeavy, kmaxIon, kmaxNeutron, and kmaxProton.
00010 { 00011 00012 killHeavy = p.getParameter<bool>("KillHeavy"); 00013 kmaxIon = p.getParameter<double>("IonThreshold")*MeV; 00014 kmaxProton = p.getParameter<double>("ProtonThreshold")*MeV; 00015 kmaxNeutron = p.getParameter<double>("NeutronThreshold")*MeV; 00016 00017 edm::LogInfo("KillSecondaries") << "KillSecondariesTrackAction:: Killing" 00018 << " Flag " << killHeavy << " protons below " 00019 << kmaxProton << " MeV, neutrons below " 00020 << kmaxNeutron << " MeV and ions below " 00021 << kmaxIon << " MeV\n"; 00022 }
KillSecondariesTrackAction::~KillSecondariesTrackAction | ( | ) |
void KillSecondariesTrackAction::update | ( | const BeginOfTrack * | ) | [virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfTrack * >.
Definition at line 26 of file KillSecondariesTrackAction.cc.
References TrackInformation::isPrimary(), killHeavy, kmaxIon, kmaxNeutron, and kmaxProton.
00026 { 00027 00028 if (killHeavy) { 00029 G4Track* theTrack = (G4Track*)((*trk)()); 00030 TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation()); 00031 if (trkInfo) { 00032 int pdg = theTrack->GetDefinition()->GetPDGEncoding(); 00033 if (!(trkInfo->isPrimary())) { // Only secondary particles 00034 double ke = theTrack->GetKineticEnergy()/MeV; 00035 if ((((pdg/1000000000 == 1 && ((pdg/10000)%100) > 0 && 00036 ((pdg/10)%100) > 0)) && (ke<kmaxIon)) || 00037 ((pdg == 2212) && (ke < kmaxProton)) || 00038 ((pdg == 2112) && (ke < kmaxNeutron))) { 00039 theTrack->SetTrackStatus(fStopAndKill); 00040 edm::LogInfo("KillSecondaries") << "Kill Track " << theTrack->GetTrackID() 00041 << " Type " << theTrack->GetDefinition()->GetParticleName() 00042 << " Kinetic Energy " << ke <<" MeV"; 00043 } 00044 } 00045 } 00046 } 00047 }
bool KillSecondariesTrackAction::killHeavy [private] |
Definition at line 19 of file KillSecondariesTrackAction.h.
Referenced by KillSecondariesTrackAction(), and update().
double KillSecondariesTrackAction::kmaxIon [private] |
Definition at line 20 of file KillSecondariesTrackAction.h.
Referenced by KillSecondariesTrackAction(), and update().
double KillSecondariesTrackAction::kmaxNeutron [private] |
Definition at line 20 of file KillSecondariesTrackAction.h.
Referenced by KillSecondariesTrackAction(), and update().
double KillSecondariesTrackAction::kmaxProton [private] |
Definition at line 20 of file KillSecondariesTrackAction.h.
Referenced by KillSecondariesTrackAction(), and update().