CMS 3D CMS Logo

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

#include <PFTauExtractor.h>

Inheritance diagram for PFTauExtractor:
reco::isodeposit::IsoDepositExtractor

Public Member Functions

reco::IsoDeposit deposit (const edm::Event &evt, const edm::EventSetup &es, const reco::Track &track) const override
 
reco::IsoDeposit deposit (const edm::Event &evt, const edm::EventSetup &es, const reco::Candidate &candidate) const override
 
void fillVetos (const edm::Event &, const edm::EventSetup &, const reco::TrackCollection &) override
 definition of pure virtual functions inherited from IsoDepositExtractor base-class More...
 
 PFTauExtractor (const edm::ParameterSet &, edm::ConsumesCollector &&iC)
 
 ~PFTauExtractor () override
 
- Public Member Functions inherited from reco::isodeposit::IsoDepositExtractor
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 make single IsoDeposit based on trackRef as input More...
 
virtual reco::IsoDeposit deposit (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 make single IsoDeposit based on a CandidateBaseRef as input More...
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &track) const
 
virtual std::vector< reco::IsoDepositdeposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 
virtual void initEvent (const edm::Event &, const edm::EventSetup &)
 perform some constly initialization More...
 
virtual ~IsoDepositExtractor ()
 Destructor. More...
 

Private Member Functions

template<typename T >
reco::IsoDeposit depositFromObject (const edm::Event &, const edm::EventSetup &, const T &) const
 

Private Attributes

edm::EDGetTokenT< edm::View< reco::Candidate > > candidateSourceToken_
 
double dRIsoCone_
 
double dRmatchPFTau_
 
double dRVetoCone_
 
double dRvetoPFTauSignalConeConstituents_
 
double maxDxyTrack_
 
double maxDzTrack_
 
edm::EDGetTokenT< reco::PFTauCollectiontauSourceToken_
 configuration parameters More...
 

Detailed Description

Definition at line 20 of file PFTauExtractor.h.

Constructor & Destructor Documentation

PFTauExtractor::PFTauExtractor ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
explicit

Definition at line 12 of file PFTauExtractor.cc.

References candidateSourceToken_, dRIsoCone_, dRmatchPFTau_, dRVetoCone_, dRvetoPFTauSignalConeConstituents_, edm::ParameterSet::getParameter(), maxDxyTrack_, maxDzTrack_, and tauSourceToken_.

12  {
16  maxDxyTrack_ = cfg.getParameter<double>("Diff_r");
17  maxDzTrack_ = cfg.getParameter<double>("Diff_z");
18  dRmatchPFTau_ = cfg.getParameter<double>("dRmatchPFTau");
19  dRVetoCone_ = cfg.getParameter<double>("DR_Veto");
20  dRIsoCone_ = cfg.getParameter<double>("DR_Max");
21  dRvetoPFTauSignalConeConstituents_ = cfg.getParameter<double>("dRvetoPFTauSignalConeConstituents");
22 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
double dRvetoPFTauSignalConeConstituents_
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
edm::EDGetTokenT< reco::PFTauCollection > tauSourceToken_
configuration parameters
edm::EDGetTokenT< edm::View< reco::Candidate > > candidateSourceToken_
double dRmatchPFTau_
PFTauExtractor::~PFTauExtractor ( )
inlineoverride

Definition at line 23 of file PFTauExtractor.h.

23 {}

Member Function Documentation

reco::IsoDeposit PFTauExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Track track 
) const
inlineoverridevirtual

make single IsoDeposit based on track as input purely virtual: have to implement in concrete implementations

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 27 of file PFTauExtractor.h.

References depositFromObject().

27  {
28  return depositFromObject(evt, es, track);
29  }
reco::IsoDeposit depositFromObject(const edm::Event &, const edm::EventSetup &, const T &) const
reco::IsoDeposit PFTauExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Candidate track 
) const
inlineoverridevirtual

make single IsoDeposit based on a candidate as input purely virtual: have to implement in concrete implementations

Reimplemented from reco::isodeposit::IsoDepositExtractor.

Definition at line 30 of file PFTauExtractor.h.

References depositFromObject().

32  {
33  return depositFromObject(evt, es, candidate);
34  }
reco::IsoDeposit depositFromObject(const edm::Event &, const edm::EventSetup &, const T &) const
template<typename T >
reco::IsoDeposit PFTauExtractor::depositFromObject ( const edm::Event evt,
const edm::EventSetup es,
const T tauCandidate 
) const
private

private member function for computing the IsoDeposits in case of reco::Track as well as in case of reco::Canididate input

Definition at line 25 of file PFTauExtractor.cc.

References HLT_2018_cff::candidates, candidateSourceToken_, DEFINE_EDM_PLUGIN, PbPb_ZMuSkimMuonDPG_cff::deltaR, HGC3DClusterGenMatchSelector_cfi::dR, reco::IsoDeposit::Veto::dR, dRIsoCone_, dRmatchPFTau_, dRVetoCone_, dRvetoPFTauSignalConeConstituents_, edm::Event::getByToken(), maxDxyTrack_, maxDzTrack_, reco::LeafCandidate::momentum(), reco::PFTau::signalCands(), tauSourceToken_, reco::LeafCandidate::vertex(), and reco::IsoDeposit::Veto::vetoDir.

Referenced by deposit().

27  {
28  //--- create IsoDeposit to be returned;
29  // set "direction" of IsoDeposit cone to jet-axis of tauCandidate
30  reco::isodeposit::Direction tauCandidateDirection(tauCandidate.eta(), tauCandidate.phi());
31  reco::IsoDeposit isoDeposit(tauCandidateDirection);
32  isoDeposit.addCandEnergy(tauCandidate.pt());
33 
34  //--- find PFTau closest to tauDirection
36  evt.getByToken(tauSourceToken_, pfTaus);
37 
38  double dR_min = -1.;
39  const reco::PFTau* pfTau_matched = nullptr;
40  for (reco::PFTauCollection::const_iterator pfTau = pfTaus->begin(); pfTau != pfTaus->end(); ++pfTau) {
41  double dR = deltaR(pfTau->eta(), pfTau->phi(), tauCandidate.eta(), tauCandidate.phi());
42  if (pfTau_matched == nullptr || dR < dR_min) {
43  dR_min = dR;
44  pfTau_matched = &(*pfTau);
45  }
46  }
47 
48  //--- compute IsoDeposit for matched PFTau
49  if (pfTau_matched != nullptr && dR_min < dRmatchPFTau_) {
51  evt.getByToken(candidateSourceToken_, candidates);
52 
53  const reco::Particle::Point& tauVertex = pfTau_matched->vertex();
54  double dRsignalCone_max = 0.;
55  for (edm::View<reco::Candidate>::const_iterator candidate = candidates->begin(); candidate != candidates->end();
56  ++candidate) {
57  double dR = deltaR(candidate->momentum(), pfTau_matched->momentum());
58 
59  //--- check that candidate is inbetween veto and isolation cone,
60  // and is compatible with originating from the same primary event vertex as the PFTau
61  if (dR > dRVetoCone_ && dR < dRIsoCone_ && (candidate->vertex() - tauVertex).Rho() < maxDxyTrack_ &&
62  fabs(candidate->vertex().z() - tauVertex.z()) < maxDzTrack_) {
63  //--- check that the candidate is not associated to one of the tau decay products
64  // within the signal cone of the PFTau
65  bool isSignalCone = false;
66  for (std::vector<reco::CandidatePtr>::const_iterator tauSignalConeConstituent =
67  pfTau_matched->signalCands().begin();
68  tauSignalConeConstituent != pfTau_matched->signalCands().end();
69  ++tauSignalConeConstituent) {
70  double dR = deltaR(candidate->momentum(), (*tauSignalConeConstituent)->momentum());
72  isSignalCone = true;
73  }
74 
75  if (!isSignalCone) {
76  reco::isodeposit::Direction candidateDirection(candidate->eta(), candidate->phi());
77  isoDeposit.addDeposit(candidateDirection, candidate->pt());
78  }
79  }
80  }
81 
82  //--- set size of veto cone of IsoDeposit to largest distance
83  // of any tau decay product within the signal cone of the PFTau
84  // (add a small positive number in order to avoid issues
85  // with rounding errors and "<" versus "<=" comparisson)
86  reco::IsoDeposit::Veto isoDepositVeto;
87  isoDepositVeto.vetoDir = tauCandidateDirection;
88  isoDepositVeto.dR = dRsignalCone_max + 1.e-3;
89  isoDeposit.setVeto(isoDepositVeto);
90  } else {
91  edm::LogWarning("PFTauExtractor::depositFromObject")
92  << " Failed to match PFTau to tauCandidate direction given by"
93  << " eta = " << tauCandidate.eta() << ", phi = " << tauCandidate.phi()
94  << " --> skipping computation of IsoDeposit !!";
95  }
96 
97  return isoDeposit;
98 }
double dRvetoPFTauSignalConeConstituents_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< reco::PFTauCollection > tauSourceToken_
configuration parameters
Vector momentum() const final
spatial momentum vector
edm::EDGetTokenT< edm::View< reco::Candidate > > candidateSourceToken_
const Point & vertex() const override
vertex position (overwritten by PF...)
math::XYZPoint Point
point in the space
Definition: Particle.h:25
double dRmatchPFTau_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
const std::vector< reco::CandidatePtr > & signalCands() const
Candidates in signal region.
Definition: PFTau.cc:73
void PFTauExtractor::fillVetos ( const edm::Event ,
const edm::EventSetup ,
const reco::TrackCollection  
)
inlineoverridevirtual

definition of pure virtual functions inherited from IsoDepositExtractor base-class

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 26 of file PFTauExtractor.h.

26 {}

Member Data Documentation

edm::EDGetTokenT<edm::View<reco::Candidate> > PFTauExtractor::candidateSourceToken_
private

Definition at line 39 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRIsoCone_
private

Definition at line 44 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRmatchPFTau_
private

Definition at line 42 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRVetoCone_
private

Definition at line 43 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRvetoPFTauSignalConeConstituents_
private

Definition at line 45 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::maxDxyTrack_
private

Definition at line 40 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::maxDzTrack_
private

Definition at line 41 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

edm::EDGetTokenT<reco::PFTauCollection> PFTauExtractor::tauSourceToken_
private

configuration parameters

Definition at line 38 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().