CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
reco::tau::PFRecoTauLostTrackPlugin Class Reference
Inheritance diagram for reco::tau::PFRecoTauLostTrackPlugin:
reco::tau::RecoTauModifierPlugin reco::tau::RecoTauEventHolderPlugin reco::tau::RecoTauNamedPlugin

Public Member Functions

void beginEvent () override
 
void endEvent () override
 
void operator() (PFTau &) const override
 
 PFRecoTauLostTrackPlugin (const edm::ParameterSet &, edm::ConsumesCollector &&iC)
 
 ~PFRecoTauLostTrackPlugin () override=default
 
- Public Member Functions inherited from reco::tau::RecoTauModifierPlugin
 RecoTauModifierPlugin (const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
 
 ~RecoTauModifierPlugin () override
 
- Public Member Functions inherited from reco::tau::RecoTauEventHolderPlugin
const edm::Eventevt () const
 
edm::Eventevt ()
 
const edm::EventSetupevtSetup () const
 
 RecoTauEventHolderPlugin (const edm::ParameterSet &pset)
 
void setup (edm::Event &, const edm::EventSetup &)
 
 ~RecoTauEventHolderPlugin () override
 
- Public Member Functions inherited from reco::tau::RecoTauNamedPlugin
const std::string & name () const
 
 RecoTauNamedPlugin (const edm::ParameterSet &pset)
 
virtual ~RecoTauNamedPlugin ()
 

Private Attributes

const edm::EDGetTokenT< reco::TrackCollectiontrack_token_
 
edm::Handle< reco::TrackCollectiontracks_
 
const int verbosity_
 

Detailed Description

Definition at line 25 of file PFRecoTauLostTrackPlugin.cc.

Constructor & Destructor Documentation

◆ PFRecoTauLostTrackPlugin()

reco::tau::PFRecoTauLostTrackPlugin::PFRecoTauLostTrackPlugin ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
explicit

Definition at line 39 of file PFRecoTauLostTrackPlugin.cc.

41  track_token_(iC.consumes(cfg.getParameter<edm::InputTag>("trackSrc"))),
42  verbosity_(cfg.getParameter<int>("verbosity")) {}
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
const edm::EDGetTokenT< reco::TrackCollection > track_token_
RecoTauModifierPlugin(const edm::ParameterSet &pset, edm::ConsumesCollector &&iC)
def move(src, dest)
Definition: eostools.py:511

◆ ~PFRecoTauLostTrackPlugin()

reco::tau::PFRecoTauLostTrackPlugin::~PFRecoTauLostTrackPlugin ( )
overridedefault

Member Function Documentation

◆ beginEvent()

void reco::tau::PFRecoTauLostTrackPlugin::beginEvent ( )
overridevirtual

Reimplemented from reco::tau::RecoTauModifierPlugin.

Definition at line 44 of file PFRecoTauLostTrackPlugin.cc.

References reco::tau::RecoTauEventHolderPlugin::evt(), edm::Event::getByToken(), track_token_, and tracks_.

edm::Handle< reco::TrackCollection > tracks_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:540
const edm::EDGetTokenT< reco::TrackCollection > track_token_

◆ endEvent()

void reco::tau::PFRecoTauLostTrackPlugin::endEvent ( )
overridevirtual

Reimplemented from reco::tau::RecoTauModifierPlugin.

Definition at line 73 of file PFRecoTauLostTrackPlugin.cc.

73 {}

◆ operator()()

void reco::tau::PFRecoTauLostTrackPlugin::operator() ( PFTau tau) const
overridevirtual

Implements reco::tau::RecoTauModifierPlugin.

Definition at line 46 of file PFRecoTauLostTrackPlugin.cc.

References HPSPFTauProducerPuppi_cfi::chargedHadron, edm::HandleBase::isValid(), reco::PFRecoTauChargedHadron::kTrack, isotracks_cff::lostTracks, edm::HandleBase::provenance(), metsig::tau, tracks_, and verbosity_.

46  {
47  if (!tracks_.isValid()) { //track collection not available in the event
48  if (verbosity_) {
49  edm::LogPrint("<PFRecoTauLostTrackPlugin::operator()>:")
50  << " Track collection " << tracks_.provenance() << " is not valid."
51  << " No tracks will be added to tau.";
52  }
53  return;
54  }
56  const PFRecoTauChargedHadronCollection& chargedHadrons = tau.signalTauChargedHadronCandidates();
57  for (const auto& chargedHadron : chargedHadrons) {
58  if (chargedHadron.algoIs(PFRecoTauChargedHadron::kTrack) && chargedHadron.getTrack().isNonnull()) {
59  reco::TrackRef trackRef(tracks_, chargedHadron.getTrack().key());
60  lostTracks.push_back(trackRef);
61  }
62  }
63  if (verbosity_) {
64  edm::LogPrint("<PFRecoTauLostTrackPlugin::operator()>:")
65  << " tau: Pt = " << tau.pt() << ", eta = " << tau.eta() << ", phi = " << tau.phi()
66  << ", mass = " << tau.mass() << " (decayMode = " << tau.decayMode() << ")"
67  << ", nChHadrs = " << chargedHadrons.size() << ", nLostTracks = " << lostTracks.size();
68  }
69  if (!lostTracks.empty())
70  tau.setsignalTracks(lostTracks);
71  }
edm::Handle< reco::TrackCollection > tracks_
Provenance const * provenance() const
Definition: HandleBase.h:74
std::vector< PFRecoTauChargedHadron > PFRecoTauChargedHadronCollection
collection of PFRecoTauChargedHadron objects
Log< level::Warning, true > LogPrint
bool isValid() const
Definition: HandleBase.h:70

Member Data Documentation

◆ track_token_

const edm::EDGetTokenT<reco::TrackCollection> reco::tau::PFRecoTauLostTrackPlugin::track_token_
private

Definition at line 35 of file PFRecoTauLostTrackPlugin.cc.

Referenced by beginEvent().

◆ tracks_

edm::Handle<reco::TrackCollection> reco::tau::PFRecoTauLostTrackPlugin::tracks_
private

Definition at line 34 of file PFRecoTauLostTrackPlugin.cc.

Referenced by beginEvent(), and operator()().

◆ verbosity_

const int reco::tau::PFRecoTauLostTrackPlugin::verbosity_
private

Definition at line 36 of file PFRecoTauLostTrackPlugin.cc.

Referenced by operator()().