CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/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 : public PFTauDiscriminationProducerBase  {
00014     public:
00015         explicit PFRecoTauDiscriminationByTauPolarization(const ParameterSet& iConfig):PFTauDiscriminationProducerBase(iConfig),
00016                                                                                qualityCuts_(iConfig.getParameter<ParameterSet>("qualityCuts")){  // retrieve quality cuts
00017                 rTauMin = iConfig.getParameter<double>("rtau");
00018                 booleanOutput = iConfig.getParameter<bool>("BooleanOutput");
00019         }
00020 
00021         ~PFRecoTauDiscriminationByTauPolarization(){}
00022 
00023         void beginEvent(const Event&, const EventSetup&);
00024         double discriminate(const PFTauRef&);
00025 
00026     private:
00027         PFTauQualityCutWrapper qualityCuts_;
00028 
00029         bool booleanOutput;
00030         double rTauMin;
00031 };
00032 
00033 void PFRecoTauDiscriminationByTauPolarization::beginEvent(const Event& event, const EventSetup& eventSetup){}
00034 
00035 double PFRecoTauDiscriminationByTauPolarization::discriminate(const PFTauRef& tau){
00036 
00037         double rTau = 0;
00038         // rtau for PFTau has to be calculated for leading PF charged hadronic candidate
00039         // calculating it from leadingTrack can (and will) give rtau > 1!
00040         if(tau.isNonnull() && tau->p() > 0 && tau->leadPFChargedHadrCand().isNonnull()) rTau = tau->leadPFChargedHadrCand()->p()/tau->p();
00041 
00042         if(booleanOutput) return ( rTau > rTauMin ? 1. : 0. );
00043         return rTau;
00044 }
00045 
00046 DEFINE_FWK_MODULE(PFRecoTauDiscriminationByTauPolarization);
00047