CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual reco::IsoDeposit deposit (const edm::Event &evt, const edm::EventSetup &es, const reco::Track &track) const
 
virtual reco::IsoDeposit deposit (const edm::Event &evt, const edm::EventSetup &es, const reco::Candidate &candidate) const
 
virtual void fillVetos (const edm::Event &, const edm::EventSetup &, const reco::TrackCollection &)
 definition of pure virtual functions inherited from IsoDepositExtractor base-class More...
 
 PFTauExtractor (const edm::ParameterSet &)
 
virtual ~PFTauExtractor ()
 
- 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::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Track &track) const
 
virtual std::vector
< reco::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::TrackBaseRef &track) const
 
virtual std::vector
< reco::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::Candidate &track) const
 
virtual std::vector
< reco::IsoDeposit
deposits (const edm::Event &ev, const edm::EventSetup &evSetup, const reco::CandidateBaseRef &track) const
 
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::InputTag candidateSource_
 
double dRIsoCone_
 
double dRmatchPFTau_
 
double dRVetoCone_
 
double dRvetoPFTauSignalConeConstituents_
 
double maxDxyTrack_
 
double maxDzTrack_
 
edm::InputTag tauSource_
 configuration parameters More...
 

Detailed Description

Definition at line 17 of file PFTauExtractor.h.

Constructor & Destructor Documentation

PFTauExtractor::PFTauExtractor ( const edm::ParameterSet cfg)
explicit

Definition at line 14 of file PFTauExtractor.cc.

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

15 {
16  tauSource_ = cfg.getParameter<edm::InputTag>("tauSource");
17  candidateSource_ = cfg.getParameter<edm::InputTag>("candidateSource");
18  maxDxyTrack_ = cfg.getParameter<double>("Diff_r");
19  maxDzTrack_ = cfg.getParameter<double>("Diff_z");
20  dRmatchPFTau_ = cfg.getParameter<double>("dRmatchPFTau");
21  dRVetoCone_ = cfg.getParameter<double>("DR_Veto");
22  dRIsoCone_ = cfg.getParameter<double>("DR_Max");
23  dRvetoPFTauSignalConeConstituents_ = cfg.getParameter<double>("dRvetoPFTauSignalConeConstituents");
24 }
T getParameter(std::string const &) const
double dRvetoPFTauSignalConeConstituents_
edm::InputTag candidateSource_
double dRmatchPFTau_
edm::InputTag tauSource_
configuration parameters
virtual PFTauExtractor::~PFTauExtractor ( )
inlinevirtual

Definition at line 22 of file PFTauExtractor.h.

22 {}

Member Function Documentation

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

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

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 26 of file PFTauExtractor.h.

References depositFromObject().

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

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 29 of file PFTauExtractor.h.

References depositFromObject().

29  {
30  return depositFromObject(evt, es, candidate);
31  }
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 27 of file PFTauExtractor.cc.

References edm::RefVector< C, T, F >::begin(), candidateSource_, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::IsoDeposit::Veto::dR, dRIsoCone_, dRmatchPFTau_, dRVetoCone_, dRvetoPFTauSignalConeConstituents_, edm::RefVector< C, T, F >::end(), edm::Event::getByLabel(), maxDxyTrack_, maxDzTrack_, reco::LeafCandidate::momentum(), pfTaus_cff::pfTaus, reco::PFTau::signalPFCands(), tauSource_, reco::LeafCandidate::vertex(), and reco::IsoDeposit::Veto::vetoDir.

Referenced by deposit().

28 {
29 //--- create IsoDeposit to be returned;
30 // set "direction" of IsoDeposit cone to jet-axis of tauCandidate
31  reco::isodeposit::Direction tauCandidateDirection(tauCandidate.eta(), tauCandidate.phi());
32  reco::IsoDeposit isoDeposit(tauCandidateDirection);
33  isoDeposit.addCandEnergy(tauCandidate.pt());
34 
35 //--- find PFTau closest to tauDirection
37  evt.getByLabel(tauSource_, pfTaus);
38 
39  double dR_min = -1.;
40  const reco::PFTau* pfTau_matched = 0;
41  for ( reco::PFTauCollection::const_iterator pfTau = pfTaus->begin();
42  pfTau != pfTaus->end(); ++pfTau ) {
43  double dR = deltaR(pfTau->eta(), pfTau->phi(), tauCandidate.eta(), tauCandidate.phi());
44  if ( pfTau_matched == 0 || dR < dR_min ) {
45  dR_min = dR;
46  pfTau_matched = &(*pfTau);
47  }
48  }
49 
50 //--- compute IsoDeposit for matched PFTau
51  if ( pfTau_matched != 0 && dR_min < dRmatchPFTau_ ) {
53  evt.getByLabel(candidateSource_, candidates);
54 
55  const reco::Particle::Point& tauVertex = pfTau_matched->vertex();
56  double dRsignalCone_max = 0.;
57  for ( edm::View<reco::Candidate>::const_iterator candidate = candidates->begin();
58  candidate != candidates->end(); ++candidate ) {
59  double dR = deltaR(candidate->momentum(), pfTau_matched->momentum());
60 
61 //--- check that candidate is inbetween veto and isolation cone,
62 // and is compatible with originating from the same primary event vertex as the PFTau
63  if ( dR > dRVetoCone_ && dR < dRIsoCone_ &&
64  (candidate->vertex() - tauVertex).Rho() < maxDxyTrack_ &&
65  fabs(candidate->vertex().z() - tauVertex.z()) < maxDzTrack_ ) {
66 
67 //--- check that the candidate is not associated to one of the tau decay products
68 // within the signal cone of the PFTau
69  bool isSignalCone = false;
70  for ( reco::PFCandidateRefVector::const_iterator tauSignalConeConstituent = pfTau_matched->signalPFCands().begin();
71  tauSignalConeConstituent != pfTau_matched->signalPFCands().end(); ++tauSignalConeConstituent ) {
72  double dR = deltaR(candidate->momentum(), (*tauSignalConeConstituent)->momentum());
73  if ( dR <= dRvetoPFTauSignalConeConstituents_ ) isSignalCone = true;
74  }
75 
76  if ( !isSignalCone ) {
77  reco::isodeposit::Direction candidateDirection(candidate->eta(), candidate->phi());
78  isoDeposit.addDeposit(candidateDirection, candidate->pt());
79  }
80  }
81  }
82 
83 //--- set size of veto cone of IsoDeposit to largest distance
84 // of any tau decay product within the signal cone of the PFTau
85 // (add a small positive number in order to avoid issues
86 // with rounding errors and "<" versus "<=" comparisson)
87  reco::IsoDeposit::Veto isoDepositVeto;
88  isoDepositVeto.vetoDir = tauCandidateDirection;
89  isoDepositVeto.dR = dRsignalCone_max + 1.e-3;
90  isoDeposit.setVeto(isoDepositVeto);
91  } else {
92  edm::LogWarning ("PFTauExtractor::depositFromObject") << " 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 }
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
double dRvetoPFTauSignalConeConstituents_
tuple pfTaus
Definition: pfTaus_cff.py:130
virtual const Point & vertex() const
vertex position (overwritten by PF...)
edm::InputTag candidateSource_
const_iterator end() const
Termination of iteration.
Definition: RefVector.h:249
const PFCandidateRefVector & signalPFCands() const
PFCandidates in signal region.
Definition: PFTau.cc:73
const_iterator begin() const
Initialize an iterator over the RefVector.
Definition: RefVector.h:244
math::XYZPoint Point
point in the space
Definition: Particle.h:29
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual Vector momentum() const GCC11_FINAL
spatial momentum vector
double dRmatchPFTau_
edm::InputTag tauSource_
configuration parameters
virtual void PFTauExtractor::fillVetos ( const edm::Event ,
const edm::EventSetup ,
const reco::TrackCollection  
)
inlinevirtual

definition of pure virtual functions inherited from IsoDepositExtractor base-class

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 25 of file PFTauExtractor.h.

25 { }

Member Data Documentation

edm::InputTag PFTauExtractor::candidateSource_
private

Definition at line 37 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRIsoCone_
private

Definition at line 42 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRmatchPFTau_
private

Definition at line 40 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRVetoCone_
private

Definition at line 41 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRvetoPFTauSignalConeConstituents_
private

Definition at line 43 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::maxDxyTrack_
private

Definition at line 38 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::maxDzTrack_
private

Definition at line 39 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

edm::InputTag PFTauExtractor::tauSource_
private

configuration parameters

Definition at line 36 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().