CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/RecoTauTag/RecoTau/plugins/CaloRecoTauDiscriminationByLeadingTrackPtCut.cc

Go to the documentation of this file.
00001 /* 
00002  * class CaloRecoTauDiscriminationByLeadingTrackPtCut
00003  * created : October 08 2008,
00004  * revised : ,
00005  * Authors : Simone Gennai (SNS), Evan Friis (UC Davis)
00006  */
00007 
00008 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
00009 
00010 #include "DataFormats/TrackReco/interface/Track.h"
00011 
00012 using namespace reco;
00013 
00014 class CaloRecoTauDiscriminationByLeadingTrackPtCut : public CaloTauDiscriminationProducerBase {
00015    public:
00016       explicit CaloRecoTauDiscriminationByLeadingTrackPtCut(const edm::ParameterSet& iConfig):CaloTauDiscriminationProducerBase(iConfig){   
00017          minPtLeadTrack_ = iConfig.getParameter<double>("MinPtLeadingTrack");
00018       }
00019       ~CaloRecoTauDiscriminationByLeadingTrackPtCut(){} 
00020       double discriminate(const CaloTauRef& theCaloTauRef);
00021 
00022    private:
00023       double minPtLeadTrack_;
00024 };
00025 
00026 double CaloRecoTauDiscriminationByLeadingTrackPtCut::discriminate(const CaloTauRef& theCaloTauRef)
00027 {
00028    double leadTrackPt_ = -1;
00029 
00030    if( theCaloTauRef->leadTrack().isNonnull() )
00031    {
00032       leadTrackPt_ = theCaloTauRef->leadTrack()->pt();
00033    } 
00034 
00035    return ( (leadTrackPt_ > minPtLeadTrack_) ? 1. : 0. );
00036 }
00037 
00038 DEFINE_FWK_MODULE(CaloRecoTauDiscriminationByLeadingTrackPtCut);
00039    
00040 /*
00041    edm::Handle<CaloTauCollection> theCaloTauCollection;
00042    iEvent.getByLabel(CaloTauProducer_,theCaloTauCollection);
00043 
00044    double theleadTrackPtCutDiscriminator = 0.;
00045    auto_ptr<CaloTauDiscriminator> theCaloTauDiscriminatorByLeadingTrackPtCut(new CaloTauDiscriminator(CaloTauRefProd(theCaloTauCollection)));
00046 
00047    //loop over the CaloTau candidates
00048    for(size_t iCaloTau=0;iCaloTau<theCaloTauCollection->size();++iCaloTau) {
00049       CaloTauRef theCaloTauRef(theCaloTauCollection,iCaloTau);
00050       CaloTau theCaloTau=*theCaloTauRef;
00051 
00052       // fill the AssociationVector object
00053       if (!theCaloTau.leadTrack()) 
00054          theleadTrackPtCutDiscriminator=0.;
00055       else if(theCaloTau.leadTrack()->pt() > minPtLeadTrack_) theleadTrackPtCutDiscriminator=1.;
00056 
00057       theCaloTauDiscriminatorByLeadingTrackPtCut->setValue(iCaloTau,theleadTrackPtCutDiscriminator);
00058    }
00059 
00060    iEvent.put(theCaloTauDiscriminatorByLeadingTrackPtCut);
00061 
00062 }
00063    
00064 */