CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_7/src/RecoTauTag/RecoTau/plugins/RecoTauStringCleanerPlugin.cc

Go to the documentation of this file.
00001 /*
00002  * =====================================================================================
00003  *       Filename:  RecoTauStringCleanerPlugin.cc
00004  *
00005  *    Description:  Rank taus by a string function.  There are three arguments,
00006  *                  a binary [selection] string, an expression to return if that
00007  *                  selection passes, and value to return if the selection
00008  *                  fails.
00009  *        Created:  11/11/2010 11:09:52
00010  *
00011  *         Author:  Evan K. Friis (UC Davis), evan.klose.friis@cern.ch
00012  * =====================================================================================
00013  */
00014 
00015 #include "RecoTauTag/RecoTau/interface/RecoTauBuilderPlugins.h"
00016 #include "DataFormats/TauReco/interface/PFTau.h"
00017 #include "DataFormats/TauReco/interface/PFTauFwd.h"
00018 
00019 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
00020 #include "CommonTools/Utils/interface/StringObjectFunction.h"
00021 
00022 namespace reco { namespace tau {
00023 
00024 class RecoTauStringCleanerPlugin : public RecoTauCleanerPlugin {
00025   public:
00026     explicit RecoTauStringCleanerPlugin(const edm::ParameterSet&);
00027     ~RecoTauStringCleanerPlugin() {}
00028     double operator()(const PFTauRef& tau) const;
00029   private:
00030     const StringCutObjectSelector<PFTau> selector_;
00031     const StringObjectFunction<PFTau> function_;
00032     double failResult_;
00033 };
00034 
00035 RecoTauStringCleanerPlugin::RecoTauStringCleanerPlugin(
00036     const edm::ParameterSet& pset): RecoTauCleanerPlugin(pset),
00037     selector_(pset.getParameter<std::string>("selection")),
00038     function_(pset.getParameter<std::string>("selectionPassFunction")),
00039     failResult_(pset.getParameter<double>("selectionFailValue")) {}
00040 
00041 double RecoTauStringCleanerPlugin::operator()(const PFTauRef& cand) const {
00042   if(selector_(*cand))
00043     return function_(*cand);
00044   else
00045     return failResult_;
00046 }
00047 
00048 }} // end namespace reco::tau
00049 
00050 #include "FWCore/Framework/interface/MakerMacros.h"
00051 DEFINE_EDM_PLUGIN(RecoTauCleanerPluginFactory,
00052                   reco::tau::RecoTauStringCleanerPlugin,
00053                   "RecoTauStringCleanerPlugin");