00001 #include "RecoTauTag/RecoTau/interface/TauDiscriminationProducerBase.h" 00002 #include "CommonTools/Utils/interface/StringCutObjectSelector.h" 00003 00004 /* class TauDiscriminationByStringCut 00005 * created : Nov 9 2009 00006 * revised : Tue Nov 10 14:44:40 PDT 2009 00007 * author : Christian Veelken (veelken@fnal.gov ; UC Davis) 00008 */ 00009 00010 template<class TauType, class TauDiscriminator> 00011 class TauDiscriminationByStringCut : 00012 public TauDiscriminationProducerBase<TauType, TauDiscriminator> { 00013 public: 00014 explicit TauDiscriminationByStringCut(const edm::ParameterSet& iConfig) 00015 : TauDiscriminationProducerBase<TauType, TauDiscriminator>(iConfig), 00016 cut_(new StringCutObjectSelector<TauType>( 00017 iConfig.getParameter<std::string>("cut"))) { 00018 cutFailValue_ = ( iConfig.exists("cutFailValue") ) ? 00019 iConfig.getParameter<double>("cutFailValue") : 0.; 00020 cutPassValue_ = ( iConfig.exists("cutPassValue") ) ? 00021 iConfig.getParameter<double>("cutPassValue") : 1.; 00022 this->prediscriminantFailValue_ = cutFailValue_; 00023 } 00024 00025 typedef std::vector<TauType> TauCollection; 00026 typedef edm::Ref<TauCollection> TauRef; 00027 00028 double discriminate(const TauRef& tau) { 00029 // StringCutObjectSelector::operator() returns true if tau passes cut 00030 return ( (*cut_)(*tau) ) ? cutPassValue_ : cutFailValue_; 00031 } 00032 00033 private: 00034 std::auto_ptr<StringCutObjectSelector<TauType> > cut_; 00035 double cutFailValue_; 00036 double cutPassValue_; 00037 }; 00038 00039 typedef TauDiscriminationByStringCut<reco::PFTau, reco::PFTauDiscriminator> 00040 PFRecoTauDiscriminationByStringCut; 00041 typedef TauDiscriminationByStringCut<reco::CaloTau, reco::CaloTauDiscriminator> 00042 CaloRecoTauDiscriminationByStringCut; 00043 00044 DEFINE_FWK_MODULE(PFRecoTauDiscriminationByStringCut); 00045 DEFINE_FWK_MODULE(CaloRecoTauDiscriminationByStringCut);