test
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 &, edm::ConsumesCollector &&iC)
 
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 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::PFTauCollection
tauSourceToken_
 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_.

13 {
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_
virtual PFTauExtractor::~PFTauExtractor ( )
inlinevirtual

Definition at line 25 of file PFTauExtractor.h.

25 {}

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

References depositFromObject().

29  {
30  return depositFromObject(evt, es, track);
31  }
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 32 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 objects.IsoTrackAnalyzer::candidates, candidateSourceToken_, deltaR(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, reco::IsoDeposit::Veto::dR, dRIsoCone_, dRmatchPFTau_, dRVetoCone_, dRvetoPFTauSignalConeConstituents_, edm::Event::getByToken(), maxDxyTrack_, maxDzTrack_, reco::LeafCandidate::momentum(), pfTaus_cff::pfTaus, reco::PFTau::signalPFCands(), tauSourceToken_, reco::LeafCandidate::vertex(), and reco::IsoDeposit::Veto::vetoDir.

Referenced by deposit().

26 {
27 //--- create IsoDeposit to be returned;
28 // set "direction" of IsoDeposit cone to jet-axis of tauCandidate
29  reco::isodeposit::Direction tauCandidateDirection(tauCandidate.eta(), tauCandidate.phi());
30  reco::IsoDeposit isoDeposit(tauCandidateDirection);
31  isoDeposit.addCandEnergy(tauCandidate.pt());
32 
33 //--- find PFTau closest to tauDirection
35  evt.getByToken(tauSourceToken_, pfTaus);
36 
37  double dR_min = -1.;
38  const reco::PFTau* pfTau_matched = 0;
39  for ( reco::PFTauCollection::const_iterator pfTau = pfTaus->begin();
40  pfTau != pfTaus->end(); ++pfTau ) {
41  double dR = deltaR(pfTau->eta(), pfTau->phi(), tauCandidate.eta(), tauCandidate.phi());
42  if ( pfTau_matched == 0 || dR < dR_min ) {
43  dR_min = dR;
44  pfTau_matched = &(*pfTau);
45  }
46  }
47 
48 //--- compute IsoDeposit for matched PFTau
49  if ( pfTau_matched != 0 && 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();
56  candidate != candidates->end(); ++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_ &&
62  (candidate->vertex() - tauVertex).Rho() < maxDxyTrack_ &&
63  fabs(candidate->vertex().z() - tauVertex.z()) < maxDzTrack_ ) {
64 
65 //--- check that the candidate is not associated to one of the tau decay products
66 // within the signal cone of the PFTau
67  bool isSignalCone = false;
68  for ( std::vector<reco::PFCandidatePtr>::const_iterator tauSignalConeConstituent = pfTau_matched->signalPFCands().begin();
69  tauSignalConeConstituent != pfTau_matched->signalPFCands().end(); ++tauSignalConeConstituent ) {
70  double dR = deltaR(candidate->momentum(), (*tauSignalConeConstituent)->momentum());
71  if ( dR <= dRvetoPFTauSignalConeConstituents_ ) isSignalCone = true;
72  }
73 
74  if ( !isSignalCone ) {
75  reco::isodeposit::Direction candidateDirection(candidate->eta(), candidate->phi());
76  isoDeposit.addDeposit(candidateDirection, candidate->pt());
77  }
78  }
79  }
80 
81 //--- set size of veto cone of IsoDeposit to largest distance
82 // of any tau decay product within the signal cone of the PFTau
83 // (add a small positive number in order to avoid issues
84 // with rounding errors and "<" versus "<=" comparisson)
85  reco::IsoDeposit::Veto isoDepositVeto;
86  isoDepositVeto.vetoDir = tauCandidateDirection;
87  isoDepositVeto.dR = dRsignalCone_max + 1.e-3;
88  isoDeposit.setVeto(isoDepositVeto);
89  } else {
90  edm::LogWarning ("PFTauExtractor::depositFromObject") << " Failed to match PFTau to tauCandidate direction given by"
91  << " eta = " << tauCandidate.eta() << ", phi = " << tauCandidate.phi()
92  << " --> skipping computation of IsoDeposit !!";
93  }
94 
95  return isoDeposit;
96 }
double dRvetoPFTauSignalConeConstituents_
tuple pfTaus
Definition: pfTaus_cff.py:136
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
virtual const Point & vertex() const
vertex position (overwritten by PF...)
const std::vector< reco::PFCandidatePtr > & signalPFCands() const
PFCandidates in signal region.
Definition: PFTau.cc:78
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
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
virtual Vector momentum() const final
spatial momentum vector
double dRmatchPFTau_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
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 28 of file PFTauExtractor.h.

28 { }

Member Data Documentation

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

Definition at line 40 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRIsoCone_
private

Definition at line 45 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRmatchPFTau_
private

Definition at line 43 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRVetoCone_
private

Definition at line 44 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::dRvetoPFTauSignalConeConstituents_
private

Definition at line 46 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::maxDxyTrack_
private

Definition at line 41 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

double PFTauExtractor::maxDzTrack_
private

Definition at line 42 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().

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

configuration parameters

Definition at line 39 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().