CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
00002 #include "RecoTauTag/TauTagTools/interface/PFTauQualityCutWrapper.h"
00003 
00004 /* class PFRecoTauDiscriminationByTauPolarization
00005  * created : May 26 2010,
00006  * contributors : Sami Lehti (sami.lehti@cern.ch ; HIP, Helsinki)
00007  */
00008 
00009 using namespace reco;
00010 using namespace std;
00011 using namespace edm;
00012 
00013 class PFRecoTauDiscriminationByTauPolarization :
00014   public PFTauDiscriminationProducerBase  {
00015   public:
00016     explicit PFRecoTauDiscriminationByTauPolarization(
00017         const ParameterSet& iConfig)
00018       :PFTauDiscriminationProducerBase(iConfig) {  // retrieve quality cuts
00019         rTauMin = iConfig.getParameter<double>("rtau");
00020         booleanOutput = iConfig.getParameter<bool>("BooleanOutput");
00021       }
00022 
00023     ~PFRecoTauDiscriminationByTauPolarization(){}
00024 
00025     void beginEvent(const Event&, const EventSetup&);
00026     double discriminate(const PFTauRef&);
00027 
00028   private:
00029     bool booleanOutput;
00030     double rTauMin;
00031 };
00032 
00033 void PFRecoTauDiscriminationByTauPolarization::beginEvent(
00034     const Event& event, const EventSetup& eventSetup){}
00035 
00036 double
00037 PFRecoTauDiscriminationByTauPolarization::discriminate(const PFTauRef& tau){
00038 
00039   double rTau = 0;
00040   // rtau for PFTau has to be calculated for leading PF charged hadronic candidate
00041   // calculating it from leadingTrack can (and will) give rtau > 1!
00042   if(tau.isNonnull() && tau->p() > 0
00043       && tau->leadPFChargedHadrCand().isNonnull()) {
00044     rTau = tau->leadPFChargedHadrCand()->p()/tau->p();
00045   }
00046 
00047   if(booleanOutput) return ( rTau > rTauMin ? 1. : 0. );
00048   return rTau;
00049 }
00050 
00051 DEFINE_FWK_MODULE(PFRecoTauDiscriminationByTauPolarization);