CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
PFTauExtractor Class Reference
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 16 of file PFTauExtractor.cc.

Constructor & Destructor Documentation

◆ PFTauExtractor()

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

Definition at line 49 of file PFTauExtractor.cc.

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

49  {
50  tauSourceToken_ = iC.consumes<reco::PFTauCollection>(cfg.getParameter<edm::InputTag>("tauSource"));
52  iC.mayConsume<edm::View<reco::Candidate> >(cfg.getParameter<edm::InputTag>("candidateSource"));
53  maxDxyTrack_ = cfg.getParameter<double>("Diff_r");
54  maxDzTrack_ = cfg.getParameter<double>("Diff_z");
55  dRmatchPFTau_ = cfg.getParameter<double>("dRmatchPFTau");
56  dRVetoCone_ = cfg.getParameter<double>("DR_Veto");
57  dRIsoCone_ = cfg.getParameter<double>("DR_Max");
58  dRvetoPFTauSignalConeConstituents_ = cfg.getParameter<double>("dRvetoPFTauSignalConeConstituents");
59 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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_

◆ ~PFTauExtractor()

PFTauExtractor::~PFTauExtractor ( )
inlineoverride

Definition at line 19 of file PFTauExtractor.cc.

19 {}

Member Function Documentation

◆ deposit() [1/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 23 of file PFTauExtractor.cc.

References depositFromObject(), and HLT_2022v12_cff::track.

23  {
24  return depositFromObject(evt, es, track);
25  }
reco::IsoDeposit depositFromObject(const edm::Event &, const edm::EventSetup &, const T &) const

◆ deposit() [2/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 26 of file PFTauExtractor.cc.

References depositFromObject().

28  {
29  return depositFromObject(evt, es, candidate);
30  }
reco::IsoDeposit depositFromObject(const edm::Event &, const edm::EventSetup &, const T &) const

◆ 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 62 of file PFTauExtractor.cc.

References HLT_2022v12_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(), nanoDQM_cfi::Rho, reco::PFTau::signalCands(), tauSourceToken_, reco::LeafCandidate::vertex(), and reco::IsoDeposit::Veto::vetoDir.

Referenced by deposit().

64  {
65  //--- create IsoDeposit to be returned;
66  // set "direction" of IsoDeposit cone to jet-axis of tauCandidate
67  reco::isodeposit::Direction tauCandidateDirection(tauCandidate.eta(), tauCandidate.phi());
68  reco::IsoDeposit isoDeposit(tauCandidateDirection);
69  isoDeposit.addCandEnergy(tauCandidate.pt());
70 
71  //--- find PFTau closest to tauDirection
73  evt.getByToken(tauSourceToken_, pfTaus);
74 
75  double dR_min = -1.;
76  const reco::PFTau* pfTau_matched = nullptr;
77  for (reco::PFTauCollection::const_iterator pfTau = pfTaus->begin(); pfTau != pfTaus->end(); ++pfTau) {
78  double dR = deltaR(pfTau->eta(), pfTau->phi(), tauCandidate.eta(), tauCandidate.phi());
79  if (pfTau_matched == nullptr || dR < dR_min) {
80  dR_min = dR;
81  pfTau_matched = &(*pfTau);
82  }
83  }
84 
85  //--- compute IsoDeposit for matched PFTau
86  if (pfTau_matched != nullptr && dR_min < dRmatchPFTau_) {
89 
90  const reco::Particle::Point& tauVertex = pfTau_matched->vertex();
91  double dRsignalCone_max = 0.;
92  for (edm::View<reco::Candidate>::const_iterator candidate = candidates->begin(); candidate != candidates->end();
93  ++candidate) {
94  double dR = deltaR(candidate->momentum(), pfTau_matched->momentum());
95 
96  //--- check that candidate is inbetween veto and isolation cone,
97  // and is compatible with originating from the same primary event vertex as the PFTau
98  if (dR > dRVetoCone_ && dR < dRIsoCone_ && (candidate->vertex() - tauVertex).Rho() < maxDxyTrack_ &&
99  fabs(candidate->vertex().z() - tauVertex.z()) < maxDzTrack_) {
100  //--- check that the candidate is not associated to one of the tau decay products
101  // within the signal cone of the PFTau
102  bool isSignalCone = false;
103  for (std::vector<reco::CandidatePtr>::const_iterator tauSignalConeConstituent =
104  pfTau_matched->signalCands().begin();
105  tauSignalConeConstituent != pfTau_matched->signalCands().end();
106  ++tauSignalConeConstituent) {
107  double dR = deltaR(candidate->momentum(), (*tauSignalConeConstituent)->momentum());
109  isSignalCone = true;
110  }
111 
112  if (!isSignalCone) {
113  reco::isodeposit::Direction candidateDirection(candidate->eta(), candidate->phi());
114  isoDeposit.addDeposit(candidateDirection, candidate->pt());
115  }
116  }
117  }
118 
119  //--- set size of veto cone of IsoDeposit to largest distance
120  // of any tau decay product within the signal cone of the PFTau
121  // (add a small positive number in order to avoid issues
122  // with rounding errors and "<" versus "<=" comparisson)
123  reco::IsoDeposit::Veto isoDepositVeto;
124  isoDepositVeto.vetoDir = tauCandidateDirection;
125  isoDepositVeto.dR = dRsignalCone_max + 1.e-3;
126  isoDeposit.setVeto(isoDepositVeto);
127  } else {
128  edm::LogWarning("PFTauExtractor::depositFromObject")
129  << " Failed to match PFTau to tauCandidate direction given by"
130  << " eta = " << tauCandidate.eta() << ", phi = " << tauCandidate.phi()
131  << " --> skipping computation of IsoDeposit !!";
132  }
133 
134  return isoDeposit;
135 }
Vector momentum() const final
spatial momentum vector
double dRvetoPFTauSignalConeConstituents_
const std::vector< reco::CandidatePtr > & signalCands() const
Candidates in signal region.
Definition: PFTau.cc:74
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const Point & vertex() const override
vertex position (overwritten by PF...)
edm::EDGetTokenT< reco::PFTauCollection > tauSourceToken_
configuration parameters
edm::EDGetTokenT< edm::View< reco::Candidate > > candidateSourceToken_
math::XYZPoint Point
point in the space
Definition: Particle.h:25
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
Log< level::Warning, false > LogWarning

◆ 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 22 of file PFTauExtractor.cc.

22 {}

Member Data Documentation

◆ candidateSourceToken_

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

Definition at line 35 of file PFTauExtractor.cc.

Referenced by depositFromObject(), and PFTauExtractor().

◆ dRIsoCone_

double PFTauExtractor::dRIsoCone_
private

Definition at line 40 of file PFTauExtractor.cc.

Referenced by depositFromObject(), and PFTauExtractor().

◆ dRmatchPFTau_

double PFTauExtractor::dRmatchPFTau_
private

Definition at line 38 of file PFTauExtractor.cc.

Referenced by depositFromObject(), and PFTauExtractor().

◆ dRVetoCone_

double PFTauExtractor::dRVetoCone_
private

Definition at line 39 of file PFTauExtractor.cc.

Referenced by depositFromObject(), and PFTauExtractor().

◆ dRvetoPFTauSignalConeConstituents_

double PFTauExtractor::dRvetoPFTauSignalConeConstituents_
private

Definition at line 41 of file PFTauExtractor.cc.

Referenced by depositFromObject(), and PFTauExtractor().

◆ maxDxyTrack_

double PFTauExtractor::maxDxyTrack_
private

Definition at line 36 of file PFTauExtractor.cc.

Referenced by depositFromObject(), and PFTauExtractor().

◆ maxDzTrack_

double PFTauExtractor::maxDzTrack_
private

Definition at line 37 of file PFTauExtractor.cc.

Referenced by depositFromObject(), and PFTauExtractor().

◆ tauSourceToken_

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

configuration parameters

Definition at line 34 of file PFTauExtractor.cc.

Referenced by depositFromObject(), and PFTauExtractor().