CMS 3D CMS Logo

TauDiscriminationByStringCut.cc
Go to the documentation of this file.
3 
4 /* class TauDiscriminationByStringCut
5  * created : Nov 9 2009
6  * revised : Tue Nov 10 14:44:40 PDT 2009
7  * author : Christian Veelken (veelken@fnal.gov ; UC Davis)
8  */
9 
10 namespace {
11 template<class TauType, class TauDiscriminator>
12 class TauDiscriminationByStringCut :
13  public TauDiscriminationProducerBase<TauType, TauDiscriminator> {
14  public:
15  explicit TauDiscriminationByStringCut(const edm::ParameterSet& iConfig)
16  : TauDiscriminationProducerBase<TauType, TauDiscriminator>(iConfig),
17  cut_(new StringCutObjectSelector<TauType>(
18  iConfig.getParameter<std::string>("cut"))) {
19  cutFailValue_ = ( iConfig.exists("cutFailValue") ) ?
20  iConfig.getParameter<double>("cutFailValue") : 0.;
21  cutPassValue_ = ( iConfig.exists("cutPassValue") ) ?
22  iConfig.getParameter<double>("cutPassValue") : 1.;
23  this->prediscriminantFailValue_ = cutFailValue_;
24  }
25 
26  typedef std::vector<TauType> TauCollection;
28 
29  double discriminate(const TauRef& tau) const {
30  // StringCutObjectSelector::operator() returns true if tau passes cut
31  return ( (*cut_)(*tau) ) ? cutPassValue_ : cutFailValue_;
32  }
33 
34  private:
35  std::unique_ptr<StringCutObjectSelector<TauType> > cut_;
36  double cutFailValue_;
37  double cutPassValue_;
38 };
39 }
40 
41 typedef TauDiscriminationByStringCut<reco::PFTau, reco::PFTauDiscriminator>
43 typedef TauDiscriminationByStringCut<reco::CaloTau, reco::CaloTauDiscriminator>
45 
T getParameter(std::string const &) const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
bool exists(std::string const &parameterName) const
checks if a parameter exists
TauDiscriminationByStringCut< reco::CaloTau, reco::CaloTauDiscriminator > CaloRecoTauDiscriminationByStringCut
virtual double discriminate(const TauRef &tau) const =0
TauDiscriminationByStringCut< reco::PFTau, reco::PFTauDiscriminator > PFRecoTauDiscriminationByStringCut