CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_4/src/RecoTauTag/RecoTau/plugins/PFRecoTauDiscriminationByLeadingObjectPtCut.cc

Go to the documentation of this file.
00001 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
00002 
00003 /* 
00004  * class PFRecoTauDiscriminationByLeadingObjectPtCut
00005  * created : October 08 2008,
00006  * revised : Wed Aug 19 17:13:04 PDT 2009
00007  * Authors : Simone Gennai (SNS), Evan Friis (UC Davis)
00008  */
00009 
00010 using namespace reco;
00011 
00012 class PFRecoTauDiscriminationByLeadingObjectPtCut : public PFTauDiscriminationProducerBase  {
00013    public:
00014       explicit PFRecoTauDiscriminationByLeadingObjectPtCut(const edm::ParameterSet& iConfig):PFTauDiscriminationProducerBase(iConfig){   
00015          chargedOnly_     = iConfig.getParameter<bool>("UseOnlyChargedHadrons");
00016          minPtLeadObject_ = iConfig.getParameter<double>("MinPtLeadingObject");
00017       }
00018       ~PFRecoTauDiscriminationByLeadingObjectPtCut(){} 
00019       double discriminate(const PFTauRef& pfTau);
00020    private:
00021       bool chargedOnly_;
00022       double minPtLeadObject_;
00023 };
00024 
00025 double PFRecoTauDiscriminationByLeadingObjectPtCut::discriminate(const PFTauRef& thePFTauRef)
00026 {
00027    double leadObjectPt = -1.;
00028    if( chargedOnly_ )
00029    {
00030       // consider only charged hadrons.  note that the leadPFChargedHadrCand is the highest pt
00031       // charged signal cone object above the quality cut level (typically 0.5 GeV).  
00032       if( thePFTauRef->leadPFChargedHadrCand().isNonnull() )
00033       {
00034          leadObjectPt = thePFTauRef->leadPFChargedHadrCand()->pt();
00035       }
00036    } 
00037    else
00038    {
00039       // If using the 'leading pion' option, require that:
00040       //   1) at least one charged hadron exists above threshold (thePFTauRef->leadPFChargedHadrCand().isNonnull())
00041       //   2) the lead PFCand exists.  In the case that the highest pt charged hadron is above the PFRecoTauProducer threshold 
00042       //      (typically 5 GeV), the leadPFCand and the leadPFChargedHadrCand are the same object.  If the leadPFChargedHadrCand
00043       //      is below 5GeV, but there exists a neutral PF particle > 5 GeV, it is set to be the leadPFCand
00044       if( thePFTauRef->leadPFCand().isNonnull() && thePFTauRef->leadPFChargedHadrCand().isNonnull() )
00045       {
00046          leadObjectPt = thePFTauRef->leadPFCand()->pt();
00047       }
00048    }
00049 
00050    return ( leadObjectPt > minPtLeadObject_ ? 1. : 0. );
00051 }
00052 
00053 DEFINE_FWK_MODULE(PFRecoTauDiscriminationByLeadingObjectPtCut);
00054 
00055 /*
00056 void PFRecoTauDiscriminationByLeadingPionPtCut::produce(edm::Event& iEvent,const edm::EventSetup& iEventSetup){
00057    edm::Handle<PFTauCollection> thePFTauCollection;
00058    iEvent.getByLabel(PFTauProducer_,thePFTauCollection);
00059 
00060 
00061    auto_ptr<PFTauDiscriminator> thePFTauDiscriminatorByLeadingPionPtCut(new PFTauDiscriminator(PFTauRefProd(thePFTauCollection)));
00062 
00063    //loop over the PFTau candidates
00064    for(size_t iPFTau=0;iPFTau<thePFTauCollection->size();++iPFTau) {
00065       PFTauRef thePFTauRef(thePFTauCollection,iPFTau);
00066       PFTau thePFTau=*thePFTauRef;
00067       double theleadTrackPtCutDiscriminator = 0.;   
00068       // fill the AssociationVector object
00069       if (!thePFTau.leadPFCand() || !thePFTau.leadPFChargedHadrCand()) 
00070       {
00071          theleadTrackPtCutDiscriminator=0.;
00072       }
00073       else if(thePFTau.leadPFCand()->pt() > minPtLeadTrack_) theleadTrackPtCutDiscriminator=1.;
00074 
00075       thePFTauDiscriminatorByLeadingPionPtCut->setValue(iPFTau,theleadTrackPtCutDiscriminator);
00076    }
00077 
00078    iEvent.put(thePFTauDiscriminatorByLeadingPionPtCut);
00079 
00080 }
00081    
00082 */