CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/RecoTauTag/TauTagTools/plugins/RecoTauDiscriminationByGenMatch.cc

Go to the documentation of this file.
00001 /*
00002  * Build a PFTauDiscriminator that returns 1.0 if the a given tau has a matching
00003  * in the input matching collection.
00004  *
00005  * Author: Evan K. Friis (UC Davis)
00006  *
00007  */
00008 
00009 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
00010 #include "DataFormats/Common/interface/Association.h"
00011 #include "DataFormats/JetReco/interface/GenJetCollection.h"
00012 
00013 class RecoTauDiscriminationByGenMatch : public PFTauDiscriminationProducerBase  {
00014    public:
00015       explicit RecoTauDiscriminationByGenMatch(const edm::ParameterSet& pset)
00016         :PFTauDiscriminationProducerBase(pset){
00017          matchingSrc_        = pset.getParameter<edm::InputTag>("match");
00018       }
00019       ~RecoTauDiscriminationByGenMatch(){}
00020       double discriminate(const reco::PFTauRef& pfTau);
00021       virtual void beginEvent(
00022           const edm::Event& evt, const edm::EventSetup& es);
00023    private:
00024       edm::InputTag matchingSrc_;
00025       edm::Handle<edm::Association<reco::GenJetCollection> > matching_;
00026 };
00027 
00028 void RecoTauDiscriminationByGenMatch::beginEvent(
00029     const edm::Event& evt, const edm::EventSetup& es) {
00030   evt.getByLabel(matchingSrc_, matching_);
00031 }
00032 
00033 double
00034 RecoTauDiscriminationByGenMatch::discriminate(const reco::PFTauRef& tau) {
00035   reco::GenJetRef genJet = (*matching_)[tau];
00036   return genJet.isNonnull() ? 1.0 : 0;
00037 }
00038 
00039 #include "FWCore/Framework/interface/MakerMacros.h"
00040 DEFINE_FWK_MODULE(RecoTauDiscriminationByGenMatch);