CMS 3D CMS Logo

PFTauExtractor Class Reference

#include <PhysicsTools/IsolationAlgos/plugins/PFTauExtractor.h>

Inheritance diagram for PFTauExtractor:

reco::isodeposit::IsoDepositExtractor

List of all members.

Public Member Functions

virtual reco::IsoDeposit deposit (const edm::Event &evt, const edm::EventSetup &es, const reco::Candidate &candidate) const
 make single IsoDeposit based on a candidate as input purely virtual: have to implement in concrete implementations
virtual reco::IsoDeposit deposit (const edm::Event &evt, const edm::EventSetup &es, const reco::Track &track) const
 make single IsoDeposit based on track as input purely virtual: have to implement in concrete implementations
virtual void fillVetos (const edm::Event &, const edm::EventSetup &, const reco::TrackCollection &)
 definition of pure virtual functions inherited from IsoDepositExtractor base-class
 PFTauExtractor (const edm::ParameterSet &)
virtual ~PFTauExtractor ()

Private Member Functions

template<typename T>
reco::IsoDeposit depositFromObject (const edm::Event &, const edm::EventSetup &, const T &) const
 private member function for computing the IsoDeposits in case of reco::Track as well as in case of reco::Canididate input

Private Attributes

edm::InputTag candidateSource_
double dRIsoCone_
double dRmatchPFTau_
double dRVetoCone_
double dRvetoPFTauSignalConeConstituents_
double maxDxyTrack_
double maxDzTrack_
edm::InputTag tauSource_
 configuration parameters


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_.

00015 {
00016   tauSource_ = cfg.getParameter<edm::InputTag>("tauSource");
00017   candidateSource_ = cfg.getParameter<edm::InputTag>("candidateSource");
00018   maxDxyTrack_ = cfg.getParameter<double>("Diff_r");
00019   maxDzTrack_ = cfg.getParameter<double>("Diff_z");
00020   dRmatchPFTau_ = cfg.getParameter<double>("dRmatchPFTau");
00021   dRVetoCone_ = cfg.getParameter<double>("DR_Veto");
00022   dRIsoCone_ = cfg.getParameter<double>("DR_Max");
00023   dRvetoPFTauSignalConeConstituents_ = cfg.getParameter<double>("dRvetoPFTauSignalConeConstituents");
00024 }

virtual PFTauExtractor::~PFTauExtractor (  )  [inline, virtual]

Definition at line 22 of file PFTauExtractor.h.

00022 {}


Member Function Documentation

virtual reco::IsoDeposit PFTauExtractor::deposit ( const edm::Event ev,
const edm::EventSetup evSetup,
const reco::Candidate track 
) const [inline, virtual]

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().

00029                                                                                                                      { 
00030     return depositFromObject(evt, es, candidate);
00031   }

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

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().

00026                                                                                                              { 
00027     return depositFromObject(evt, es, track);
00028   }

template<typename T>
reco::IsoDeposit PFTauExtractor::depositFromObject ( const edm::Event evt,
const edm::EventSetup es,
const T &  tauCandidate 
) const [inline, 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 candidateSource_, deltaR(), reco::IsoDeposit::Veto::dR, dRIsoCone_, dRmatchPFTau_, dRVetoCone_, dRvetoPFTauSignalConeConstituents_, edm::Event::getByLabel(), maxDxyTrack_, maxDzTrack_, reco::Particle::momentum(), reco::PFTau::signalPFCands(), tauSource_, reco::Particle::vertex(), and reco::IsoDeposit::Veto::vetoDir.

Referenced by deposit().

00028 {
00029 //--- create IsoDeposit to be returned;
00030 //    set "direction" of IsoDeposit cone to jet-axis of tauCandidate
00031   reco::isodeposit::Direction tauCandidateDirection(tauCandidate.eta(), tauCandidate.phi());
00032   reco::IsoDeposit isoDeposit(tauCandidateDirection);
00033   isoDeposit.addCandEnergy(tauCandidate.pt());
00034 
00035 //--- find PFTau closest to tauDirection
00036   edm::Handle<reco::PFTauCollection> pfTaus;
00037   evt.getByLabel(tauSource_, pfTaus);
00038 
00039   double dR_min = -1.;
00040   const reco::PFTau* pfTau_matched = 0;
00041   for ( reco::PFTauCollection::const_iterator pfTau = pfTaus->begin();
00042         pfTau != pfTaus->end(); ++pfTau ) {
00043     double dR = deltaR(pfTau->eta(), pfTau->phi(), tauCandidate.eta(), tauCandidate.phi());
00044     if ( pfTau_matched == 0 || dR < dR_min ) {
00045       dR_min = dR;
00046       pfTau_matched = &(*pfTau);
00047     }
00048   }
00049 
00050 //--- compute IsoDeposit for matched PFTau
00051   if ( pfTau_matched != 0 && dR_min < dRmatchPFTau_ ) {
00052     edm::Handle<edm::View<reco::Candidate> > candidates;
00053     evt.getByLabel(candidateSource_, candidates);
00054 
00055     const reco::Particle::Point& tauVertex = pfTau_matched->vertex();
00056     double dRsignalCone_max = 0.;
00057     for ( edm::View<reco::Candidate>::const_iterator candidate = candidates->begin();
00058           candidate != candidates->end(); ++candidate ) {
00059       double dR = deltaR(candidate->momentum(), pfTau_matched->momentum());
00060 
00061 //--- check that candidate is inbetween veto and isolation cone,
00062 //    and is compatible with originating from the same primary event vertex as the PFTau
00063       if ( dR > dRVetoCone_ && dR < dRIsoCone_ &&
00064            (candidate->vertex() - tauVertex).Rho() < maxDxyTrack_ &&
00065            fabs(candidate->vertex().z() - tauVertex.z()) < maxDzTrack_ ) {
00066 
00067 //--- check that the candidate is not associated to one of the tau decay products
00068 //    within the signal cone of the PFTau
00069         bool isSignalCone = false;
00070         for ( reco::PFCandidateRefVector::const_iterator tauSignalConeConstituent = pfTau_matched->signalPFCands().begin();
00071               tauSignalConeConstituent != pfTau_matched->signalPFCands().end(); ++tauSignalConeConstituent ) {
00072           double dR = deltaR(candidate->momentum(), (*tauSignalConeConstituent)->momentum());
00073           if ( dR <= dRvetoPFTauSignalConeConstituents_ ) isSignalCone = true;
00074         }
00075         
00076         if ( !isSignalCone ) {
00077           reco::isodeposit::Direction candidateDirection(candidate->eta(), candidate->phi());
00078           isoDeposit.addDeposit(candidateDirection, candidate->pt());
00079         }
00080       }
00081     }
00082 
00083 //--- set size of veto cone of IsoDeposit to largest distance 
00084 //    of any tau decay product within the signal cone of the PFTau
00085 //    (add a small positive number in order to avoid issues 
00086 //     with rounding errors and "<" versus "<=" comparisson)
00087     reco::IsoDeposit::Veto isoDepositVeto;
00088     isoDepositVeto.vetoDir = tauCandidateDirection;
00089     isoDepositVeto.dR = dRsignalCone_max + 1.e-3;
00090     isoDeposit.setVeto(isoDepositVeto);
00091   } else {
00092     edm::LogWarning ("PFTauExtractor::depositFromObject") << " Failed to match PFTau to tauCandidate direction given by" 
00093                                                           << " eta = " << tauCandidate.eta() << ", phi = " << tauCandidate.phi()
00094                                                           << " --> skipping computation of IsoDeposit !!";
00095   }
00096 
00097   return isoDeposit;
00098 }

virtual void PFTauExtractor::fillVetos ( const edm::Event ,
const edm::EventSetup ,
const reco::TrackCollection  
) [inline, virtual]

definition of pure virtual functions inherited from IsoDepositExtractor base-class

Implements reco::isodeposit::IsoDepositExtractor.

Definition at line 25 of file PFTauExtractor.h.

00025 { }


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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:29:49 2009 for CMSSW by  doxygen 1.5.4