1 #ifndef RecoTauTag_RecoTau_TauWPThreshold_h 2 #define RecoTauTag_RecoTau_TauWPThreshold_h 12 bool simple_value =
false;
16 simple_value = (
pos == cut_str.size());
17 }
catch (std::invalid_argument&) {
18 }
catch (std::out_of_range&) {
22 "[&](double *x, double *p) { const int decayMode = p[0];" 23 "const double pt = p[1]; const double eta = p[2];";
24 static const int n_params = 3;
25 static const auto handler = [](
int, Bool_t,
const char*,
const char*) ->
void {};
28 if (cut_str.find(
"return") == std::string::npos)
29 fn_str +=
" return " + cut_str +
";}";
31 fn_str += cut_str +
"}";
32 auto old_handler = SetErrorHandler(handler);
33 fn_ = std::make_unique<TF1>(
"fn_", fn_str.c_str(), 0, 1, n_params);
34 SetErrorHandler(old_handler);
36 throw cms::Exception(
"TauWPThreshold: invalid formula") <<
"Invalid WP cut formula = '" << cut_str <<
"'.";
44 fn_->SetParameter(0,
dm);
45 fn_->SetParameter(1,
pt);
53 return (*
this)(
dm,
tau.pt(),
tau.eta());
59 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