CMS 3D CMS Logo

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

#include <SaveSimTrack.h>

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

Public Member Functions

 SaveSimTrack (edm::ParameterSet const &p)
 
void update (const BeginOfTrack *trk) override
 This routine will be called when the appropriate signal arrives. More...
 
 ~SaveSimTrack () override
 
- Public Member Functions inherited from SimWatcher
const SimWatcheroperator= (const SimWatcher &)=delete
 
 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

std::vector< int > pdgs_
 

Additional Inherited Members

Detailed Description

Definition at line 11 of file SaveSimTrack.h.

Constructor & Destructor Documentation

◆ SaveSimTrack()

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

Definition at line 13 of file SaveSimTrack.cc.

13  {
14  edm::ParameterSet ps = p.getParameter<edm::ParameterSet>("SaveSimTrack");
15  pdgs_ = ps.getUntrackedParameter<std::vector<int>>("PDGCodes");
16 
17  edm::LogInfo("SaveSimTrack") << "SaveSimTrack:: Save Sim Track if PDG code "
18  << "is one from the list of " << pdgs_.size() << " items";
19  for (unsigned int k = 0; k < pdgs_.size(); ++k)
20  edm::LogInfo("SaveSimTrack") << "[" << k << "] " << pdgs_[k];
21 }

References edm::ParameterSet::getUntrackedParameter(), dqmdumpme::k, AlCaHLTBitMon_ParallelJobs::p, and pdgs_.

◆ ~SaveSimTrack()

SaveSimTrack::~SaveSimTrack ( )
override

Definition at line 23 of file SaveSimTrack.cc.

23 {}

Member Function Documentation

◆ update()

void SaveSimTrack::update ( const BeginOfTrack )
overridevirtual

This routine will be called when the appropriate signal arrives.

Implements Observer< const BeginOfTrack * >.

Definition at line 25 of file SaveSimTrack.cc.

25  {
26  G4Track *theTrack = (G4Track *)((*trk)());
27  TrackInformation *trkInfo = (TrackInformation *)(theTrack->GetUserInformation());
28  if (trkInfo) {
29  int pdg = theTrack->GetDefinition()->GetPDGEncoding();
30  if (std::find(pdgs_.begin(), pdgs_.end(), pdg) != pdgs_.end()) {
31  trkInfo->storeTrack(true);
32  LogDebug("SaveSimTrack") << "Save SimTrack the Track " << theTrack->GetTrackID() << " Type "
33  << theTrack->GetDefinition()->GetParticleName() << " Momentum "
34  << theTrack->GetMomentum() / MeV << " MeV/c";
35  }
36  }
37 }

References spr::find(), LogDebug, MeV, dileptonTrigSettings_cff::pdg, pdgs_, and TrackInformation::storeTrack().

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

Member Data Documentation

◆ pdgs_

std::vector<int> SaveSimTrack::pdgs_
private

Definition at line 18 of file SaveSimTrack.h.

Referenced by SaveSimTrack(), and update().

AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
dileptonTrigSettings_cff.pdg
pdg
Definition: dileptonTrigSettings_cff.py:6
MeV
const double MeV
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
SaveSimTrack::pdgs_
std::vector< int > pdgs_
Definition: SaveSimTrack.h:18
dqmdumpme.k
k
Definition: dqmdumpme.py:60
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
edm::ParameterSet
Definition: ParameterSet.h:47
TrackInformation
Definition: TrackInformation.h:12
TrackInformation::storeTrack
bool storeTrack() const
Definition: TrackInformation.h:18
pdg
Definition: pdg_functions.h:28
edm::Log
Definition: MessageLogger.h:70