CMS 3D CMS Logo

Public Member Functions | Private Attributes

PFRecoTauDiscriminationByIsolation Class Reference

Inheritance diagram for PFRecoTauDiscriminationByIsolation:
TauDiscriminationProducerBase< TauType, TauDiscriminator > edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

void beginEvent (const edm::Event &evt, const edm::EventSetup &evtSetup)
double discriminate (const PFTauRef &pfTau)
 PFRecoTauDiscriminationByIsolation (const edm::ParameterSet &pset)
 ~PFRecoTauDiscriminationByIsolation ()

Private Attributes

bool applyOccupancyCut_
bool applyRelativeSumPtCut_
bool applySumPtCut_
Vertex currentPV_
double customIsoCone_
bool includeGammas_
bool includeTracks_
uint32_t maximumOccupancy_
double maximumRelativeSumPt_
double maximumSumPt_
edm::InputTag pvProducer_
PFTauQualityCutWrapper qualityCuts_

Detailed Description

Definition at line 19 of file PFRecoTauDiscriminationByIsolation.cc.


Constructor & Destructor Documentation

PFRecoTauDiscriminationByIsolation::PFRecoTauDiscriminationByIsolation ( const edm::ParameterSet pset) [inline, explicit]

Definition at line 22 of file PFRecoTauDiscriminationByIsolation.cc.

References edm::ParameterSet::exists(), and edm::ParameterSet::getParameter().

                                    :
      PFTauDiscriminationProducerBase(pset),
      qualityCuts_(pset.getParameter<edm::ParameterSet>("qualityCuts"))  {
        includeTracks_ = pset.getParameter<bool>(
            "ApplyDiscriminationByTrackerIsolation");
        includeGammas_ = pset.getParameter<bool>(
            "ApplyDiscriminationByECALIsolation");

        applyOccupancyCut_ = pset.getParameter<bool>("applyOccupancyCut");
        maximumOccupancy_ = pset.getParameter<uint32_t>("maximumOccupancy");

        applySumPtCut_ = pset.getParameter<bool>("applySumPtCut");
        maximumSumPt_ = pset.getParameter<double>("maximumSumPtCut");

        applyRelativeSumPtCut_ = pset.getParameter<bool>(
            "applyRelativeSumPtCut");
        maximumRelativeSumPt_ = pset.getParameter<double>(
            "relativeSumPtCut");

        pvProducer_ = pset.getParameter<edm::InputTag>("PVProducer");

        if (pset.exists("customOuterCone")) {
          customIsoCone_ = pset.getParameter<double>("customOuterCone");
        } else {
          customIsoCone_ = -1;
        }
      }
PFRecoTauDiscriminationByIsolation::~PFRecoTauDiscriminationByIsolation ( ) [inline]

Definition at line 51 of file PFRecoTauDiscriminationByIsolation.cc.

{}

Member Function Documentation

void PFRecoTauDiscriminationByIsolation::beginEvent ( const edm::Event evt,
const edm::EventSetup evtSetup 
) [virtual]

Reimplemented from TauDiscriminationProducerBase< TauType, TauDiscriminator >.

Definition at line 78 of file PFRecoTauDiscriminationByIsolation.cc.

                                     {

  // NB: The use of the PV in this context is necessitated by its use in
  // applying quality cuts to the different objects in the isolation cone

  // get the PV for this event
  edm::Handle<VertexCollection> primaryVertices;
  event.getByLabel(pvProducer_, primaryVertices);

  // take the highest pt primary vertex in the event
  if( primaryVertices->size() ) {
    currentPV_ = *(primaryVertices->begin());
  } else {
    const double smearedPVsigmaY = 0.0015;
    const double smearedPVsigmaX = 0.0015;
    const double smearedPVsigmaZ = 0.005;
    Vertex::Error SimPVError;
    SimPVError(0,0) = smearedPVsigmaX*smearedPVsigmaX;
    SimPVError(1,1) = smearedPVsigmaY*smearedPVsigmaY;
    SimPVError(2,2) = smearedPVsigmaZ*smearedPVsigmaZ;
    Vertex::Point blankVertex(0, 0, 0);

    // note that the PFTau has its vertex set as the associated PV.  So if it
    // doesn't exist, a fake vertex has already been created (about 0, 0, 0) w/
    // the above width (gaussian)
    currentPV_ = Vertex(blankVertex, SimPVError,1,1,1);
  }
}
double PFRecoTauDiscriminationByIsolation::discriminate ( const PFTauRef pfTau)

Definition at line 108 of file PFRecoTauDiscriminationByIsolation.cc.

References align_tpl::filter, and reco::LeafCandidate::p4().

                                                                             {
  // collect the objects we are working with (ie tracks, tracks+gammas, etc)
  std::vector<LeafCandidate> isoObjects;

  if (includeTracks_) {
    qualityCuts_.isolationChargedObjects(*pfTau, currentPV_, isoObjects);
  }

  if (includeGammas_) {
    qualityCuts_.isolationGammaObjects(*pfTau, isoObjects);
  }

  typedef reco::tau::cone::DeltaRFilter<LeafCandidate> DRFilter;

  // Check if we want a custom iso cone
  if (customIsoCone_ >= 0.) {
    DRFilter filter(pfTau->p4(), 0, customIsoCone_);
    // Remove all the objects not in our iso cone
    std::remove_if(isoObjects.begin(), isoObjects.end(), std::not1(filter));
  }

  bool failsOccupancyCut     = false;
  bool failsSumPtCut         = false;
  bool failsRelativeSumPtCut = false;

  //--- nObjects requirement
  failsOccupancyCut = ( isoObjects.size() > maximumOccupancy_ );

  //--- Sum PT requirement
  if( applySumPtCut_ || applyRelativeSumPtCut_ ) {
    reco::Particle::LorentzVector totalP4;
    BOOST_FOREACH(const LeafCandidate& isoObject, isoObjects) {
      totalP4 += isoObject.p4();
    }

    failsSumPtCut = (totalP4.pt() > maximumSumPt_);

    //--- Relative Sum PT requirement
    failsRelativeSumPtCut = (
        (pfTau->pt() > 0 ? totalP4.pt()/pfTau->pt() : 0 )
        > maximumRelativeSumPt_ );
  }

  bool fails = (applyOccupancyCut_ && failsOccupancyCut) ||
    (applySumPtCut_ && failsSumPtCut) ||
    (applyRelativeSumPtCut_ && failsRelativeSumPtCut) ;

  return (fails ? 0. : 1.);
}

Member Data Documentation

Definition at line 62 of file PFRecoTauDiscriminationByIsolation.cc.

Definition at line 68 of file PFRecoTauDiscriminationByIsolation.cc.

Definition at line 65 of file PFRecoTauDiscriminationByIsolation.cc.

Definition at line 75 of file PFRecoTauDiscriminationByIsolation.cc.

Definition at line 71 of file PFRecoTauDiscriminationByIsolation.cc.

Definition at line 60 of file PFRecoTauDiscriminationByIsolation.cc.

Definition at line 59 of file PFRecoTauDiscriminationByIsolation.cc.

Definition at line 63 of file PFRecoTauDiscriminationByIsolation.cc.

Definition at line 69 of file PFRecoTauDiscriminationByIsolation.cc.

Definition at line 66 of file PFRecoTauDiscriminationByIsolation.cc.

Definition at line 73 of file PFRecoTauDiscriminationByIsolation.cc.

Definition at line 57 of file PFRecoTauDiscriminationByIsolation.cc.