Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:48

0001 /*
0002  * PFRecoTauChargedHadronStringQuality
0003  *
0004  * Author: Christian Veelken, LLR
0005  *
0006  * RecoTau quality plugin that returns the value given by the supplied string
0007  * expression.  A string cut can additionally be applied.  ChargedHadrons
0008  * that fail the cut will be associated with a default value.
0009  *
0010  */
0011 
0012 #include "RecoTauTag/RecoTau/interface/PFRecoTauChargedHadronPlugins.h"
0013 #include "DataFormats/TauReco/interface/PFRecoTauChargedHadron.h"
0014 
0015 #include "CommonTools/Utils/interface/StringCutObjectSelector.h"
0016 #include "CommonTools/Utils/interface/StringObjectFunction.h"
0017 
0018 namespace reco {
0019   namespace tau {
0020 
0021     class PFRecoTauChargedHadronStringQuality : public PFRecoTauChargedHadronQualityPlugin {
0022     public:
0023       explicit PFRecoTauChargedHadronStringQuality(const edm::ParameterSet&);
0024       ~PFRecoTauChargedHadronStringQuality() override {}
0025       double operator()(const PFRecoTauChargedHadron&) const override;
0026 
0027     private:
0028       const StringCutObjectSelector<PFRecoTauChargedHadron> selector_;
0029       const StringObjectFunction<PFRecoTauChargedHadron> function_;
0030       double failResult_;
0031     };
0032 
0033     PFRecoTauChargedHadronStringQuality::PFRecoTauChargedHadronStringQuality(const edm::ParameterSet& pset)
0034         : PFRecoTauChargedHadronQualityPlugin(pset),
0035           selector_(pset.getParameter<std::string>("selection")),
0036           function_(pset.getParameter<std::string>("selectionPassFunction")),
0037           failResult_(pset.getParameter<double>("selectionFailValue")) {}
0038 
0039     double PFRecoTauChargedHadronStringQuality::operator()(const PFRecoTauChargedHadron& cand) const {
0040       if (selector_(cand))
0041         return function_(cand);
0042       else
0043         return failResult_;
0044     }
0045 
0046   }  // namespace tau
0047 }  // namespace reco
0048 
0049 #include "FWCore/Framework/interface/MakerMacros.h"
0050 
0051 DEFINE_EDM_PLUGIN(PFRecoTauChargedHadronQualityPluginFactory,
0052                   reco::tau::PFRecoTauChargedHadronStringQuality,
0053                   "PFRecoTauChargedHadronStringQuality");