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
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

std::vector< int > pdgs_
 

Additional Inherited Members

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

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.

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

13  {
14  edm::ParameterSet ps = p.getParameter<edm::ParameterSet>("SaveSimTrack");
15  pdgs_ = ps.getUntrackedParameter<std::vector<int>>("PDGCodes");
16 
17  edm::LogVerbatim("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::LogVerbatim("SaveSimTrack") << "[" << k << "] " << pdgs_[k];
21 }
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
std::vector< int > pdgs_
Definition: SaveSimTrack.h:18

◆ ~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.

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

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

25  {
26  const G4Track *theTrack = (*trk)();
27  TrackInformation *trkInfo = reinterpret_cast<TrackInformation *>(theTrack->GetUserInformation());
28  if (nullptr != trkInfo) {
29  int pdg = theTrack->GetDefinition()->GetPDGEncoding();
30  if (std::find(pdgs_.begin(), pdgs_.end(), pdg) != pdgs_.end()) {
31  trkInfo->setStoreTrack();
32  LogDebug("SaveSimTrack") << "Save SimTrack the Track " << theTrack->GetTrackID() << " Type "
33  << theTrack->GetDefinition()->GetParticleName() << " Momentum "
34  << theTrack->GetMomentum() / CLHEP::MeV << " MeV/c";
35  }
36  }
37 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< int > pdgs_
Definition: SaveSimTrack.h:18
#define LogDebug(id)

Member Data Documentation

◆ pdgs_

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

Definition at line 18 of file SaveSimTrack.h.

Referenced by SaveSimTrack(), and update().