CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/RecoTauTag/RecoTau/plugins/RecoTauDiscriminantCleanerPlugin.cc

Go to the documentation of this file.
00001 /*
00002  * RecoTauDiscriminantCleanerPlugin
00003  *
00004  * Author: Evan K. Friis, UC Davis
00005  *
00006  * A reco tau cleaner plugin that given a PFTau returns the associated value 
00007  * stored in a PFTauDiscrimiantor.
00008  */
00009 
00010 #include "RecoTauTag/RecoTau/interface/RecoTauBuilderPlugins.h"
00011 #include "DataFormats/TauReco/interface/PFTauDiscriminator.h"
00012 
00013 namespace reco { namespace tau {
00014 
00015 class RecoTauDiscriminantCleanerPlugin : public RecoTauCleanerPlugin {
00016   public:
00017     RecoTauDiscriminantCleanerPlugin(const edm::ParameterSet& pset);
00018     virtual ~RecoTauDiscriminantCleanerPlugin(){}
00019 
00020     // Get discriminant value for a given tau Ref
00021     double operator()(const reco::PFTauRef&) const;
00022     // Hook called from base class at the beginning of each event
00023     void beginEvent();
00024 
00025   private:
00026     edm::InputTag discriminatorSrc_;
00027     edm::Handle<PFTauDiscriminator> discriminator_;
00028 };
00029 
00030 RecoTauDiscriminantCleanerPlugin::RecoTauDiscriminantCleanerPlugin(
00031     const edm::ParameterSet& pset):RecoTauCleanerPlugin(pset) {
00032   discriminatorSrc_ = pset.getParameter<edm::InputTag>("src");
00033 }
00034 
00035 void RecoTauDiscriminantCleanerPlugin::beginEvent() {
00036   // Load our handle to the discriminators from the event
00037   evt()->getByLabel(discriminatorSrc_, discriminator_);
00038 }
00039 
00040 double RecoTauDiscriminantCleanerPlugin::operator()(
00041     const reco::PFTauRef& tau) const {
00042   // Get the discriminator result for this tau. N.B. result is negated!  lower 
00043   // = more "tau like"! This is opposite to the normal case.
00044   double result = -(*discriminator_)[tau];
00045   return result;
00046 }
00047 
00048 }} // end namespace reco::tau
00049 
00050 // Register our plugin
00051 #include "FWCore/Framework/interface/MakerMacros.h"
00052 DEFINE_EDM_PLUGIN(RecoTauCleanerPluginFactory, 
00053     reco::tau::RecoTauDiscriminantCleanerPlugin, 
00054     "RecoTauDiscriminantCleanerPlugin");