CMS 3D CMS Logo

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

Go to the documentation of this file.
00001 /* 
00002  * class PFRecoTauDecayModeIndexProducer
00003  * created : April 16, 2009
00004  * revised : ,
00005  * Authors : Evan K. Friis, (UC Davis), Simone Gennai (SNS)
00006  *
00007  * Associates the decay mode index (see enum in DataFormats/TauReco/interface/PFTauDecayMode.h)
00008  * reconstruced in the PFTauDecayMode production to its underlying PFTau, in PFTau discriminator format
00009  *
00010  */
00011 
00012 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h"
00013 
00014 #include "DataFormats/TauReco/interface/PFTauDecayMode.h"
00015 #include "DataFormats/TauReco/interface/PFTauDecayModeAssociation.h"
00016 
00017 using namespace reco;
00018 
00019 class PFRecoTauDecayModeIndexProducer : public PFTauDiscriminationProducerBase {
00020    public:
00021       explicit PFRecoTauDecayModeIndexProducer(const edm::ParameterSet& iConfig):PFTauDiscriminationProducerBase(iConfig) {   
00022          PFTauDecayModeProducer_     = iConfig.getParameter<edm::InputTag>("PFTauDecayModeProducer");
00023       }
00024       ~PFRecoTauDecayModeIndexProducer(){} 
00025       double discriminate(const PFTauRef& thePFTauRef);
00026       void beginEvent(const edm::Event& evt, const edm::EventSetup& evtSetup);
00027    private:
00028       edm::InputTag PFTauDecayModeProducer_;
00029       edm::Handle<PFTauDecayModeAssociation> decayModes_; // holds the PFTauDecayModes for the current event
00030 };
00031 
00032 
00033 void PFRecoTauDecayModeIndexProducer::beginEvent(const edm::Event& event, const edm::EventSetup& evtSetup)
00034 {
00035    // Get the PFTau Decay Modes
00036    event.getByLabel(PFTauDecayModeProducer_, decayModes_);
00037 }
00038 
00039 double PFRecoTauDecayModeIndexProducer::discriminate(const PFTauRef& thePFTauRef)
00040 {
00041    int theDecayModeIndex = -1;
00042 
00043    const PFTauDecayMode& theDecayMode = (*decayModes_)[thePFTauRef];
00044 
00045    // retrieve decay mode
00046    theDecayModeIndex = static_cast<int>(theDecayMode.getDecayMode()); 
00047 
00048    if (theDecayModeIndex < 0) theDecayModeIndex = -1;
00049 
00050    return theDecayModeIndex;
00051 }
00052   
00053 DEFINE_FWK_MODULE(PFRecoTauDecayModeIndexProducer);