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::Candidate &candidate) const override
 
reco::IsoDeposit deposit (const edm::Event &evt, const edm::EventSetup &es, const reco::Track &track) 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::CandidateBaseRef &track) const
 make single IsoDeposit based on a CandidateBaseRef as input More...
 
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 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 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 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::PFTauExtractor ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
explicit

Definition at line 12 of file PFTauExtractor.cc.

12  {
13  tauSourceToken_ = iC.consumes<reco::PFTauCollection>(cfg.getParameter<edm::InputTag>("tauSource"));
15  iC.mayConsume<edm::View<reco::Candidate> >(cfg.getParameter<edm::InputTag>("candidateSource"));
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 }

References candidateSourceToken_, looper::cfg, dRIsoCone_, dRmatchPFTau_, dRVetoCone_, dRvetoPFTauSignalConeConstituents_, maxDxyTrack_, maxDzTrack_, and tauSourceToken_.

◆ ~PFTauExtractor()

PFTauExtractor::~PFTauExtractor ( )
inlineoverride

Definition at line 23 of file PFTauExtractor.h.

23 {}

Member Function Documentation

◆ deposit() [1/2]

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.

32  {
33  return depositFromObject(evt, es, candidate);
34  }

References depositFromObject().

◆ deposit() [2/2]

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.

27  {
28  return depositFromObject(evt, es, track);
29  }

References depositFromObject(), and HLT_FULL_cff::track.

◆ depositFromObject()

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.

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_) {
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 }

References HLT_FULL_cff::candidates, candidateSourceToken_, 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().

◆ fillVetos()

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

◆ candidateSourceToken_

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

Definition at line 39 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

◆ dRIsoCone_

double PFTauExtractor::dRIsoCone_
private

Definition at line 44 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

◆ dRmatchPFTau_

double PFTauExtractor::dRmatchPFTau_
private

Definition at line 42 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

◆ dRVetoCone_

double PFTauExtractor::dRVetoCone_
private

Definition at line 43 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

◆ dRvetoPFTauSignalConeConstituents_

double PFTauExtractor::dRvetoPFTauSignalConeConstituents_
private

Definition at line 45 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

◆ maxDxyTrack_

double PFTauExtractor::maxDxyTrack_
private

Definition at line 40 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

◆ maxDzTrack_

double PFTauExtractor::maxDzTrack_
private

Definition at line 41 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

◆ tauSourceToken_

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

configuration parameters

Definition at line 38 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

reco::IsoDeposit::Veto::dR
float dR
Definition: IsoDeposit.h:61
PFTauExtractor::maxDxyTrack_
double maxDxyTrack_
Definition: PFTauExtractor.h:40
reco::LeafCandidate::momentum
Vector momentum() const final
spatial momentum vector
Definition: LeafCandidate.h:118
reco::PFTau::signalCands
const std::vector< reco::CandidatePtr > & signalCands() const
Candidates in signal region.
Definition: PFTau.cc:74
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11713
PFTauExtractor::dRIsoCone_
double dRIsoCone_
Definition: PFTauExtractor.h:44
PFTauExtractor::depositFromObject
reco::IsoDeposit depositFromObject(const edm::Event &, const edm::EventSetup &, const T &) const
Definition: PFTauExtractor.cc:25
reco::PFTau
Definition: PFTau.h:36
PFTauExtractor::dRVetoCone_
double dRVetoCone_
Definition: PFTauExtractor.h:43
reco::IsoDeposit::Veto
Definition: IsoDeposit.h:59
edm::Handle
Definition: AssociativeIterator.h:50
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
PFTauExtractor::dRvetoPFTauSignalConeConstituents_
double dRvetoPFTauSignalConeConstituents_
Definition: PFTauExtractor.h:45
reco::IsoDeposit::Veto::vetoDir
Direction vetoDir
Definition: IsoDeposit.h:60
reco::PFTauCollection
std::vector< PFTau > PFTauCollection
collection of PFTau objects
Definition: PFTauFwd.h:9
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
edm::Event::getByToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:535
PbPb_ZMuSkimMuonDPG_cff.deltaR
deltaR
Definition: PbPb_ZMuSkimMuonDPG_cff.py:63
PFTauExtractor::tauSourceToken_
edm::EDGetTokenT< reco::PFTauCollection > tauSourceToken_
configuration parameters
Definition: PFTauExtractor.h:38
PFTauExtractor::maxDzTrack_
double maxDzTrack_
Definition: PFTauExtractor.h:41
edm::View
Definition: CaloClusterFwd.h:14
PFTauExtractor::dRmatchPFTau_
double dRmatchPFTau_
Definition: PFTauExtractor.h:42
edm::ConsumesCollector::mayConsume
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
Definition: ConsumesCollector.h:72
reco::LeafCandidate::vertex
const Point & vertex() const override
vertex position (overwritten by PF...)
Definition: LeafCandidate.h:165
looper.cfg
cfg
Definition: looper.py:297
JME::Binning::Rho
PFTauExtractor::candidateSourceToken_
edm::EDGetTokenT< edm::View< reco::Candidate > > candidateSourceToken_
Definition: PFTauExtractor.h:39
HLT_FULL_cff.candidates
candidates
Definition: HLT_FULL_cff.py:54996
reco::isodeposit::Direction
Definition: IsoDepositDirection.h:19
reco::IsoDeposit
Definition: IsoDeposit.h:49
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition: Particle.h:25
HGC3DClusterGenMatchSelector_cfi.dR
dR
Definition: HGC3DClusterGenMatchSelector_cfi.py:7
edm::InputTag
Definition: InputTag.h:15