CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/RecoTauTag/RecoTau/plugins/RecoTauPiZeroQualityPlugins.cc

Go to the documentation of this file.
00001 /*
00002  * RecoTauPiZeroStringQuality
00003  *
00004  * Author: Evan K. Friis, UC Davis
00005  *
00006  * RecoTau quality plugin that returns the value given by the supplied string
00007  * expression.  A string cut can additionally be applied.  The PiZeros
00008  * that fail the cut will be associated with a default value.
00009  *
00010  * $Id $
00011  *
00012  */
00013 
00014 #include "RecoTauTag/RecoTau/interface/RecoTauPiZeroPlugins.h"
00015 #include "DataFormats/TauReco/interface/RecoTauPiZero.h"
00016 
00017 #include "CommonTools/Utils/interface/StringCutObjectSelector.h" 
00018 #include "CommonTools/Utils/interface/StringObjectFunction.h" 
00019 
00020 namespace reco { namespace tau {
00021 
00022 class RecoTauPiZeroStringQuality : public RecoTauPiZeroQualityPlugin {
00023   public:
00024     explicit RecoTauPiZeroStringQuality(const edm::ParameterSet&);
00025     ~RecoTauPiZeroStringQuality() {}
00026     double operator()(const RecoTauPiZero&) const;
00027   private:
00028     const StringCutObjectSelector<RecoTauPiZero> selector_;
00029     const StringObjectFunction<RecoTauPiZero> function_;
00030     double failResult_;
00031 };
00032 
00033 RecoTauPiZeroStringQuality::RecoTauPiZeroStringQuality(
00034     const edm::ParameterSet& pset): RecoTauPiZeroQualityPlugin(pset),
00035   selector_(pset.getParameter<std::string>("selection")),
00036   function_(pset.getParameter<std::string>("selectionPassFunction")),
00037   failResult_(pset.getParameter<double>("selectionFailValue")) {}
00038 
00039 double RecoTauPiZeroStringQuality::operator()(const RecoTauPiZero& cand) const{
00040   if(selector_(cand)) {
00041     return function_(cand);
00042   } 
00043   else {
00044     return failResult_;
00045   }
00046 }
00047 }} // end namespace reco::tau
00048 
00049 #include "FWCore/Framework/interface/MakerMacros.h"
00050 DEFINE_EDM_PLUGIN(RecoTauPiZeroQualityPluginFactory, 
00051     reco::tau::RecoTauPiZeroStringQuality, 
00052     "RecoTauPiZeroStringQuality");