CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

PFTauExtractor Class Reference

#include <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::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
 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 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_.

{
  tauSource_ = cfg.getParameter<edm::InputTag>("tauSource");
  candidateSource_ = cfg.getParameter<edm::InputTag>("candidateSource");
  maxDxyTrack_ = cfg.getParameter<double>("Diff_r");
  maxDzTrack_ = cfg.getParameter<double>("Diff_z");
  dRmatchPFTau_ = cfg.getParameter<double>("dRmatchPFTau");
  dRVetoCone_ = cfg.getParameter<double>("DR_Veto");
  dRIsoCone_ = cfg.getParameter<double>("DR_Max");
  dRvetoPFTauSignalConeConstituents_ = cfg.getParameter<double>("dRvetoPFTauSignalConeConstituents");
}
virtual PFTauExtractor::~PFTauExtractor ( ) [inline, virtual]

Definition at line 22 of file PFTauExtractor.h.

{}

Member Function Documentation

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

                                                                                                             { 
    return depositFromObject(evt, es, track);
  }
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().

                                                                                                                     { 
    return depositFromObject(evt, es, candidate);
  }
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 candidateSource_, deltaR(), reco::IsoDeposit::Veto::dR, dRIsoCone_, dRmatchPFTau_, dRVetoCone_, dRvetoPFTauSignalConeConstituents_, edm::Event::getByLabel(), maxDxyTrack_, maxDzTrack_, reco::LeafCandidate::momentum(), python::pfTaus_cff::pfTaus, reco::PFTau::signalPFCands(), tauSource_, reco::LeafCandidate::vertex(), and reco::IsoDeposit::Veto::vetoDir.

Referenced by deposit().

{
//--- create IsoDeposit to be returned;
//    set "direction" of IsoDeposit cone to jet-axis of tauCandidate
  reco::isodeposit::Direction tauCandidateDirection(tauCandidate.eta(), tauCandidate.phi());
  reco::IsoDeposit isoDeposit(tauCandidateDirection);
  isoDeposit.addCandEnergy(tauCandidate.pt());

//--- find PFTau closest to tauDirection
  edm::Handle<reco::PFTauCollection> pfTaus;
  evt.getByLabel(tauSource_, pfTaus);

  double dR_min = -1.;
  const reco::PFTau* pfTau_matched = 0;
  for ( reco::PFTauCollection::const_iterator pfTau = pfTaus->begin();
        pfTau != pfTaus->end(); ++pfTau ) {
    double dR = deltaR(pfTau->eta(), pfTau->phi(), tauCandidate.eta(), tauCandidate.phi());
    if ( pfTau_matched == 0 || dR < dR_min ) {
      dR_min = dR;
      pfTau_matched = &(*pfTau);
    }
  }

//--- compute IsoDeposit for matched PFTau
  if ( pfTau_matched != 0 && dR_min < dRmatchPFTau_ ) {
    edm::Handle<edm::View<reco::Candidate> > candidates;
    evt.getByLabel(candidateSource_, candidates);

    const reco::Particle::Point& tauVertex = pfTau_matched->vertex();
    double dRsignalCone_max = 0.;
    for ( edm::View<reco::Candidate>::const_iterator candidate = candidates->begin();
          candidate != candidates->end(); ++candidate ) {
      double dR = deltaR(candidate->momentum(), pfTau_matched->momentum());

//--- check that candidate is inbetween veto and isolation cone,
//    and is compatible with originating from the same primary event vertex as the PFTau
      if ( dR > dRVetoCone_ && dR < dRIsoCone_ &&
           (candidate->vertex() - tauVertex).Rho() < maxDxyTrack_ &&
           fabs(candidate->vertex().z() - tauVertex.z()) < maxDzTrack_ ) {

//--- check that the candidate is not associated to one of the tau decay products
//    within the signal cone of the PFTau
        bool isSignalCone = false;
        for ( reco::PFCandidateRefVector::const_iterator tauSignalConeConstituent = pfTau_matched->signalPFCands().begin();
              tauSignalConeConstituent != pfTau_matched->signalPFCands().end(); ++tauSignalConeConstituent ) {
          double dR = deltaR(candidate->momentum(), (*tauSignalConeConstituent)->momentum());
          if ( dR <= dRvetoPFTauSignalConeConstituents_ ) isSignalCone = true;
        }
        
        if ( !isSignalCone ) {
          reco::isodeposit::Direction candidateDirection(candidate->eta(), candidate->phi());
          isoDeposit.addDeposit(candidateDirection, candidate->pt());
        }
      }
    }

//--- set size of veto cone of IsoDeposit to largest distance 
//    of any tau decay product within the signal cone of the PFTau
//    (add a small positive number in order to avoid issues 
//     with rounding errors and "<" versus "<=" comparisson)
    reco::IsoDeposit::Veto isoDepositVeto;
    isoDepositVeto.vetoDir = tauCandidateDirection;
    isoDepositVeto.dR = dRsignalCone_max + 1.e-3;
    isoDeposit.setVeto(isoDepositVeto);
  } else {
    edm::LogWarning ("PFTauExtractor::depositFromObject") << " Failed to match PFTau to tauCandidate direction given by" 
                                                          << " eta = " << tauCandidate.eta() << ", phi = " << tauCandidate.phi()
                                                          << " --> skipping computation of IsoDeposit !!";
  }

  return isoDeposit;
}
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.

{ }

Member Data Documentation

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

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

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

configuration parameters

Definition at line 36 of file PFTauExtractor.h.

Referenced by depositFromObject(), and PFTauExtractor().