CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
PFTauMiniAODPrimaryVertexProducer Class Referencefinal

MiniAOD implementation of the PFTauPrimaryVertexProducer plugin. More...

Inheritance diagram for PFTauMiniAODPrimaryVertexProducer:
PFTauPrimaryVertexProducerBase edm::stream::EDProducer<>

Public Member Functions

void beginEvent (const edm::Event &, const edm::EventSetup &) override
 
 PFTauMiniAODPrimaryVertexProducer (const edm::ParameterSet &iConfig)
 
 ~PFTauMiniAODPrimaryVertexProducer () override
 
- Public Member Functions inherited from PFTauPrimaryVertexProducerBase
 PFTauPrimaryVertexProducerBase (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~PFTauPrimaryVertexProducerBase () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from PFTauPrimaryVertexProducerBase
static edm::ParameterSetDescription getDescriptionsBase ()
 

Protected Member Functions

void nonTauTracksInPV (const reco::VertexRef &, const std::vector< edm::Ptr< reco::TrackBase > > &, std::vector< const reco::Track * > &) override
 

Private Member Functions

void nonTauTracksInPVFromPackedCands (const size_t &, const pat::PackedCandidateCollection &, const std::vector< edm::Ptr< reco::TrackBase > > &, std::vector< const reco::Track * > &)
 

Private Attributes

edm::Handle< pat::PackedCandidateCollectionlostCands_
 
edm::EDGetTokenT< pat::PackedCandidateCollectionlostCandsToken_
 
edm::Handle< pat::PackedCandidateCollectionpackedCands_
 
edm::EDGetTokenT< pat::PackedCandidateCollectionpackedCandsToken_
 

Additional Inherited Members

- Public Types inherited from PFTauPrimaryVertexProducerBase
enum  Alg { useInputPV = 0, useFrontPV }
 
typedef std::vector< DiscCutPair * > DiscCutPairVec
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

MiniAOD implementation of the PFTauPrimaryVertexProducer plugin.

Definition at line 7 of file PFTauMiniAODPrimaryVertexProducer.cc.

Constructor & Destructor Documentation

◆ PFTauMiniAODPrimaryVertexProducer()

PFTauMiniAODPrimaryVertexProducer::PFTauMiniAODPrimaryVertexProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 30 of file PFTauMiniAODPrimaryVertexProducer.cc.

33  consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("packedCandidatesTag"))),
35  consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("lostCandidatesTag"))) {}

◆ ~PFTauMiniAODPrimaryVertexProducer()

PFTauMiniAODPrimaryVertexProducer::~PFTauMiniAODPrimaryVertexProducer ( )
override

Definition at line 37 of file PFTauMiniAODPrimaryVertexProducer.cc.

37 {}

Member Function Documentation

◆ beginEvent()

void PFTauMiniAODPrimaryVertexProducer::beginEvent ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from PFTauPrimaryVertexProducerBase.

Definition at line 39 of file PFTauMiniAODPrimaryVertexProducer.cc.

39  {
40  //Get candidate collections
42  iEvent.getByToken(lostCandsToken_, lostCands_);
43 }

References iEvent, lostCands_, lostCandsToken_, packedCands_, and packedCandsToken_.

◆ fillDescriptions()

void PFTauMiniAODPrimaryVertexProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 95 of file PFTauMiniAODPrimaryVertexProducer.cc.

95  {
97  desc.add<edm::InputTag>("lostCandidatesTag", edm::InputTag("lostTracks"));
98  desc.add<edm::InputTag>("packedCandidatesTag", edm::InputTag("packedPFCandidates"));
99 
100  descriptions.add("pfTauMiniAODPrimaryVertexProducer", desc);
101 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, PFTauPrimaryVertexProducerBase::getDescriptionsBase(), and HLT_FULL_cff::InputTag.

◆ nonTauTracksInPV()

void PFTauMiniAODPrimaryVertexProducer::nonTauTracksInPV ( const reco::VertexRef thePVRef,
const std::vector< edm::Ptr< reco::TrackBase > > &  tauTracks,
std::vector< const reco::Track * > &  nonTauTracks 
)
overrideprotectedvirtual

Implements PFTauPrimaryVertexProducerBase.

Definition at line 45 of file PFTauMiniAODPrimaryVertexProducer.cc.

47  {
48  //Find non-tau tracks associated to thePV
49  //PackedCandidates first...
50  if (packedCands_.isValid()) {
51  nonTauTracksInPVFromPackedCands(thePVRef.key(), *packedCands_, tauTracks, nonTauTracks);
52  }
53  //then lostCandidates
54  if (lostCands_.isValid()) {
55  nonTauTracksInPVFromPackedCands(thePVRef.key(), *lostCands_, tauTracks, nonTauTracks);
56  }
57 }

References edm::HandleBase::isValid(), edm::Ref< C, T, F >::key(), lostCands_, nonTauTracksInPVFromPackedCands(), and packedCands_.

◆ nonTauTracksInPVFromPackedCands()

void PFTauMiniAODPrimaryVertexProducer::nonTauTracksInPVFromPackedCands ( const size_t &  thePVkey,
const pat::PackedCandidateCollection cands,
const std::vector< edm::Ptr< reco::TrackBase > > &  tauTracks,
std::vector< const reco::Track * > &  nonTauTracks 
)
private

Definition at line 59 of file PFTauMiniAODPrimaryVertexProducer.cc.

63  {
64  //Find candidates/tracks associated to thePV
65  for (const auto &cand : cands) {
66  //MB: Skip candidates with ill-defined momentum as they return ill-defined tracks (why it happens?)
67  if (!std::isfinite(cand.pt())) //MB: it is enough to check just pt (?)
68  continue;
69  if (cand.vertexRef().isNull())
70  continue;
71  int quality = cand.pvAssociationQuality();
72  if (cand.vertexRef().key() != thePVkey ||
74  continue;
75  const reco::Track *track = cand.bestTrack();
76  if (track == nullptr)
77  continue;
78  //Remove signal (tau) tracks
79  //MB: Only deltaR deltaPt overlap removal possible (?)
80  //MB: It should be fine as pat objects stores same track info with same presision
81  bool matched = false;
82  for (const auto &tauTrack : tauTracks) {
83  if (std::abs(tauTrack->eta() - track->eta()) < 0.005 &&
84  std::abs(deltaPhi(tauTrack->phi(), track->phi())) < 0.005 &&
85  std::abs(tauTrack->pt() / track->pt() - 1.) < 0.005) {
86  matched = true;
87  break;
88  }
89  }
90  if (!matched)
91  nonTauTracks.push_back(track);
92  }
93 }

References funct::abs(), HLT_FULL_cff::cands, SiPixelRawToDigiRegional_cfi::deltaPhi, muonTagProbeFilters_cff::matched, quality, HLT_FULL_cff::track, pat::PackedCandidate::UsedInFitLoose, and pat::PackedCandidate::UsedInFitTight.

Referenced by nonTauTracksInPV().

Member Data Documentation

◆ lostCands_

edm::Handle<pat::PackedCandidateCollection> PFTauMiniAODPrimaryVertexProducer::lostCands_
private

Definition at line 27 of file PFTauMiniAODPrimaryVertexProducer.cc.

Referenced by beginEvent(), and nonTauTracksInPV().

◆ lostCandsToken_

edm::EDGetTokenT<pat::PackedCandidateCollection> PFTauMiniAODPrimaryVertexProducer::lostCandsToken_
private

Definition at line 26 of file PFTauMiniAODPrimaryVertexProducer.cc.

Referenced by beginEvent().

◆ packedCands_

edm::Handle<pat::PackedCandidateCollection> PFTauMiniAODPrimaryVertexProducer::packedCands_
private

Definition at line 27 of file PFTauMiniAODPrimaryVertexProducer.cc.

Referenced by beginEvent(), and nonTauTracksInPV().

◆ packedCandsToken_

edm::EDGetTokenT<pat::PackedCandidateCollection> PFTauMiniAODPrimaryVertexProducer::packedCandsToken_
private

Definition at line 26 of file PFTauMiniAODPrimaryVertexProducer.cc.

Referenced by beginEvent().

muonTagProbeFilters_cff.matched
matched
Definition: muonTagProbeFilters_cff.py:62
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89281
pat::PackedCandidate::UsedInFitLoose
Definition: PackedCandidate.h:727
quality
const uint32_t *__restrict__ Quality * quality
Definition: CAHitNtupletGeneratorKernelsImpl.h:109
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
PFTauPrimaryVertexProducerBase::PFTauPrimaryVertexProducerBase
PFTauPrimaryVertexProducerBase(const edm::ParameterSet &iConfig)
Definition: PFTauPrimaryVertexProducerBase.cc:20
reco::Track
Definition: Track.h:27
PFTauMiniAODPrimaryVertexProducer::packedCands_
edm::Handle< pat::PackedCandidateCollection > packedCands_
Definition: PFTauMiniAODPrimaryVertexProducer.cc:27
HLT_FULL_cff.cands
cands
Definition: HLT_FULL_cff.py:15144
cand
Definition: decayParser.h:32
iEvent
int iEvent
Definition: GenABIO.cc:224
PFTauMiniAODPrimaryVertexProducer::nonTauTracksInPVFromPackedCands
void nonTauTracksInPVFromPackedCands(const size_t &, const pat::PackedCandidateCollection &, const std::vector< edm::Ptr< reco::TrackBase > > &, std::vector< const reco::Track * > &)
Definition: PFTauMiniAODPrimaryVertexProducer.cc:59
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
PFTauPrimaryVertexProducerBase::getDescriptionsBase
static edm::ParameterSetDescription getDescriptionsBase()
Definition: PFTauPrimaryVertexProducerBase.cc:228
PFTauMiniAODPrimaryVertexProducer::packedCandsToken_
edm::EDGetTokenT< pat::PackedCandidateCollection > packedCandsToken_
Definition: PFTauMiniAODPrimaryVertexProducer.cc:26
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::Ref::key
key_type key() const
Accessor for product key.
Definition: Ref.h:250
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PFTauMiniAODPrimaryVertexProducer::lostCands_
edm::Handle< pat::PackedCandidateCollection > lostCands_
Definition: PFTauMiniAODPrimaryVertexProducer.cc:27
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
pat::PackedCandidate::UsedInFitTight
Definition: PackedCandidate.h:728
PFTauMiniAODPrimaryVertexProducer::lostCandsToken_
edm::EDGetTokenT< pat::PackedCandidateCollection > lostCandsToken_
Definition: PFTauMiniAODPrimaryVertexProducer.cc:26
edm::InputTag
Definition: InputTag.h:15