1 #ifndef RecoTauTag_RecoTau_TauWPThreshold_h 2 #define RecoTauTag_RecoTau_TauWPThreshold_h 16 bool simple_value =
false;
17 const char* cut_cstr = cut_str.c_str();
19 value_ = std::strtod(cut_cstr, &end_cstr);
21 simple_value = !*end_cstr && cut_cstr != end_cstr && std::isfinite(
value_);
24 "[&](double *x, double *p) { const int decayMode = p[0];" 25 "const double pt = p[1]; const double eta = p[2];";
26 static const int n_params = 3;
27 static const auto handler = [](
int, Bool_t,
const char*,
const char*) ->
void {};
30 if (cut_str.find(
"return") == std::string::npos)
31 fn_str +=
" return " + cut_str +
";}";
33 fn_str += cut_str +
"}";
34 auto old_handler = SetErrorHandler(handler);
35 fn_ = std::make_unique<TF1>(
"fn_", fn_str.c_str(), 0, 1, n_params);
36 SetErrorHandler(old_handler);
38 throw cms::Exception(
"TauWPThreshold: invalid formula") <<
"Invalid WP cut formula = '" << cut_str <<
"'.";
46 fn_->SetParameter(0,
dm);
47 fn_->SetParameter(1,
pt);
55 return (*
this)(
dm,
tau.pt(),
tau.eta());
61 std::unique_ptr<TF1>
fn_;
double operator()(const reco::Candidate &tau) const
TauWPThreshold(const std::string &cut_str)
Analysis-level tau class.
std::unique_ptr< TF1 > fn_
double operator()(int dm, double pt, double eta) const
double operator()(const reco::BaseTau &tau, bool isPFTau) const