CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/RecoTauTag/RecoTau/plugins/PFRecoTauDiscriminationByNProngs.cc

Go to the documentation of this file.
00001 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
00002 #include "FWCore/Utilities/interface/InputTag.h"
00003 
00004 /* class PFRecoTauDiscriminationByNProngs
00005  * created : August 30 2010,
00006  * contributors : Sami Lehti (sami.lehti@cern.ch ; HIP, Helsinki)
00007  * based on H+ tau ID by Lauri Wendland
00008  */
00009 
00010 using namespace reco;
00011 using namespace std;
00012 using namespace edm;
00013 
00014 class PFRecoTauDiscriminationByNProngs : public PFTauDiscriminationProducerBase  {
00015     public:
00016         explicit PFRecoTauDiscriminationByNProngs(const ParameterSet& iConfig):PFTauDiscriminationProducerBase(iConfig){
00017                 nprongs                 = iConfig.getParameter<uint32_t>("nProngs");
00018                 booleanOutput = iConfig.getParameter<bool>("BooleanOutput");
00019         }
00020 
00021         ~PFRecoTauDiscriminationByNProngs(){}
00022 
00023         void beginEvent(const edm::Event&, const edm::EventSetup&);
00024         double discriminate(const reco::PFTauRef&);
00025 
00026     private:
00027 
00028         uint32_t nprongs;
00029         bool booleanOutput;
00030 };
00031 
00032 void PFRecoTauDiscriminationByNProngs::beginEvent(const Event& iEvent, const EventSetup& iSetup){}
00033 
00034 double PFRecoTauDiscriminationByNProngs::discriminate(const PFTauRef& tau){
00035 
00036         bool accepted = false;
00037         int np = tau->signalTracks().size();
00038 
00039         if((np == 1 && (nprongs == 1 || nprongs == 0)) ||
00040            (np == 3 && (nprongs == 3 || nprongs == 0)) ) accepted = true;
00041 
00042         if(!accepted) np = 0;
00043         if(booleanOutput) return accepted;
00044         return np;
00045 }
00046 
00047 DEFINE_FWK_MODULE(PFRecoTauDiscriminationByNProngs);
00048