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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 ( const edm::ParameterSet iConfig)
explicit

Definition at line 32 of file PFTauMiniAODPrimaryVertexProducer.cc.

32  :
34  packedCandsToken_(consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("packedCandidatesTag"))),
35  lostCandsToken_(consumes<pat::PackedCandidateCollection>(iConfig.getParameter<edm::InputTag>("lostCandidatesTag"))) {}
T getParameter(std::string const &) const
edm::EDGetTokenT< pat::PackedCandidateCollection > lostCandsToken_
edm::EDGetTokenT< pat::PackedCandidateCollection > packedCandsToken_
PFTauPrimaryVertexProducerBase(const edm::ParameterSet &iConfig)
PFTauMiniAODPrimaryVertexProducer::~PFTauMiniAODPrimaryVertexProducer ( )
override

Definition at line 37 of file PFTauMiniAODPrimaryVertexProducer.cc.

37 {}

Member Function Documentation

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

Reimplemented from PFTauPrimaryVertexProducerBase.

Definition at line 39 of file PFTauMiniAODPrimaryVertexProducer.cc.

References edm::Event::getByToken(), lostCands_, lostCandsToken_, packedCands_, and packedCandsToken_.

39  {
40 
41  //Get candidate collections
44 }
edm::EDGetTokenT< pat::PackedCandidateCollection > lostCandsToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< pat::PackedCandidateCollection > packedCandsToken_
edm::Handle< pat::PackedCandidateCollection > packedCands_
edm::Handle< pat::PackedCandidateCollection > lostCands_
void PFTauMiniAODPrimaryVertexProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 93 of file PFTauMiniAODPrimaryVertexProducer.cc.

References edm::ConfigurationDescriptions::add(), DEFINE_FWK_MODULE, and PFTauPrimaryVertexProducerBase::getDescriptionsBase().

93  {
95  desc.add<edm::InputTag>("lostCandidatesTag", edm::InputTag("lostTracks"));
96  desc.add<edm::InputTag>("packedCandidatesTag", edm::InputTag("packedPFCandidates"));
97 
98  descriptions.add("pfTauMiniAODPrimaryVertexProducer", desc);
99 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static edm::ParameterSetDescription getDescriptionsBase()
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 46 of file PFTauMiniAODPrimaryVertexProducer.cc.

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

48  {
49 
50  //Find non-tau tracks associated to thePV
51  //PackedCandidates first...
52  if(packedCands_.isValid()) {
53  nonTauTracksInPVFromPackedCands(thePVRef.key(),*packedCands_,tauTracks,nonTauTracks);
54  }
55  //then lostCandidates
56  if(lostCands_.isValid()) {
57  nonTauTracksInPVFromPackedCands(thePVRef.key(),*lostCands_,tauTracks,nonTauTracks);
58  }
59 }
key_type key() const
Accessor for product key.
Definition: Ref.h:263
void nonTauTracksInPVFromPackedCands(const size_t &, const pat::PackedCandidateCollection &, const std::vector< edm::Ptr< reco::TrackBase > > &, std::vector< const reco::Track * > &)
bool isValid() const
Definition: HandleBase.h:74
edm::Handle< pat::PackedCandidateCollection > packedCands_
edm::Handle< pat::PackedCandidateCollection > lostCands_
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 61 of file PFTauMiniAODPrimaryVertexProducer.cc.

References funct::abs(), hiPixelPairStep_cff::deltaPhi, reco::TrackBase::eta(), electrons_cff::matched, reco::TrackBase::phi(), reco::TrackBase::pt(), jets_cff::quality, HiIsolationCommonParameters_cff::track, pat::PackedCandidate::UsedInFitLoose, and pat::PackedCandidate::UsedInFitTight.

Referenced by nonTauTracksInPV().

64  {
65 
66  //Find candidates/tracks associated to thePV
67  for(const auto& cand: cands){
68  if(cand.vertexRef().isNull()) continue;
69  int quality = cand.pvAssociationQuality();
70  if(cand.vertexRef().key()!=thePVkey ||
72  quality!=pat::PackedCandidate::UsedInFitLoose)) continue;
73  const reco::Track *track = cand.bestTrack();
74  if(track == nullptr) continue;
75  //Remove signal (tau) tracks
76  //MB: Only deltaR deltaPt overlap removal possible (?)
77  //MB: It should be fine as pat objects stores same track info with same presision
78  bool matched = false;
79  for(const auto& tauTrack: tauTracks){
80  if(std::abs(tauTrack->eta()-track->eta())<0.005
81  && std::abs(deltaPhi(tauTrack->phi(),track->phi()))<0.005
82  && std::abs(tauTrack->pt()/track->pt()-1.)<0.005
83  ){
84  matched = true;
85  break;
86  }
87  }
88  if( !matched ) nonTauTracks.push_back(track);
89  }
90 }
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:684
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:690
double pt() const
track transverse momentum
Definition: TrackBase.h:660
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

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

Definition at line 28 of file PFTauMiniAODPrimaryVertexProducer.cc.

Referenced by beginEvent(), and nonTauTracksInPV().

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

Definition at line 27 of file PFTauMiniAODPrimaryVertexProducer.cc.

Referenced by beginEvent().

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

Definition at line 28 of file PFTauMiniAODPrimaryVertexProducer.cc.

Referenced by beginEvent(), and nonTauTracksInPV().

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

Definition at line 27 of file PFTauMiniAODPrimaryVertexProducer.cc.

Referenced by beginEvent().