#include <SimG4Core/SaveSimTrackAction/interface/SaveSimTrack.h>
Public Member Functions | |
SaveSimTrack (edm::ParameterSet const &p) | |
void | update (const BeginOfTrack *trk) |
This routine will be called when the appropriate signal arrives. | |
~SaveSimTrack () | |
Private Attributes | |
int | pdgMax |
int | pdgMin |
Definition at line 9 of file SaveSimTrack.h.
SaveSimTrack::SaveSimTrack | ( | edm::ParameterSet const & | p | ) |
Definition at line 10 of file SaveSimTrack.cc.
References edm::ParameterSet::getUntrackedParameter(), pdgMax, and pdgMin.
00010 { 00011 00012 pdgMin = p.getUntrackedParameter<int>("MinimumPDGCode", 1000000); 00013 pdgMax = p.getUntrackedParameter<int>("MaximumPDGCode", 2000000); 00014 00015 edm::LogInfo("SaveSimTrack") << "SaveSimTrack:: Save Sim Track if PDG code " 00016 << "lies between " << pdgMin << " and " 00017 << pdgMax; 00018 }
SaveSimTrack::~SaveSimTrack | ( | ) |
void SaveSimTrack::update | ( | const BeginOfTrack * | ) | [virtual] |
This routine will be called when the appropriate signal arrives.
Implements Observer< const BeginOfTrack * >.
Definition at line 22 of file SaveSimTrack.cc.
References funct::abs(), LogDebug, pdgMax, pdgMin, and TrackInformation::storeTrack().
00022 { 00023 00024 G4Track* theTrack = (G4Track*)((*trk)()); 00025 TrackInformation * trkInfo = (TrackInformation *)(theTrack->GetUserInformation()); 00026 if (trkInfo) { 00027 int pdg = std::abs(theTrack->GetDefinition()->GetPDGEncoding()); 00028 if (pdg >= pdgMin && pdg <= pdgMax) { 00029 trkInfo->storeTrack(true); 00030 LogDebug("SaveSimTrack") << "Save SimTrack the Track " 00031 << theTrack->GetTrackID() << " Type " 00032 << theTrack->GetDefinition()->GetParticleName() 00033 << " Momentum " << theTrack->GetMomentum()/MeV 00034 << " MeV/c"; 00035 } 00036 } 00037 }
int SaveSimTrack::pdgMax [private] |
int SaveSimTrack::pdgMin [private] |