CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/RecoTauTag/TauTagTools/plugins/RecoTauRandomCleanerPlugin.cc

Go to the documentation of this file.
00001 /*
00002  * RecoTauRandomCleanerPlugin
00003  *
00004  * Author: Evan K. Friis, UC Davis
00005  *
00006  * A reco tau cleaner plugin that selects a *random* PFTau.
00007  *
00008  */
00009 
00010 #include <boost/functional/hash.hpp>
00011 #include "RecoTauTag/RecoTau/interface/RecoTauBuilderPlugins.h"
00012 
00013 
00014 namespace reco { namespace tau {
00015 
00016 class RecoTauRandomCleanerPlugin : public RecoTauCleanerPlugin {
00017   public:
00018     RecoTauRandomCleanerPlugin(const edm::ParameterSet& pset);
00019     virtual ~RecoTauRandomCleanerPlugin(){}
00020     // Get discriminant value for a given tau Ref
00021     double operator()(const reco::PFTauRef&) const;
00022   private:
00023     unsigned int seed_;
00024 };
00025 
00026 RecoTauRandomCleanerPlugin::RecoTauRandomCleanerPlugin(
00027     const edm::ParameterSet& pset):RecoTauCleanerPlugin(pset) {
00028   seed_ = pset.exists("seed") ? pset.getParameter<unsigned int>("seed") : 1234;
00029 }
00030 
00031 double RecoTauRandomCleanerPlugin::operator()(const reco::PFTauRef& tau) const {
00032   size_t output = seed_;
00033   boost::hash_combine(output, tau->pt());
00034   boost::hash_combine(output, tau->eta());
00035   return output;
00036 }
00037 
00038 }} // end namespace reco::tautools
00039 
00040 // Register our plugin
00041 #include "FWCore/Framework/interface/MakerMacros.h"
00042 DEFINE_EDM_PLUGIN(RecoTauCleanerPluginFactory,
00043     reco::tau::RecoTauRandomCleanerPlugin,
00044     "RecoTauRandomCleanerPlugin");