2#ifndef RIVET_ResolutionFunctions_HH
3#define RIVET_ResolutionFunctions_HH
6#include "Rivet/Particle.hh"
7#include "Rivet/Math/Vector4.hh"
8#include "Rivet/Tools/Logging.hh"
9#include "Rivet/Tools/RivetYODA.hh"
26 virtual double resolution(
const T& input)
const = 0;
33 void _cacheRefData()
const {
35 static std::mutex cache_ref_data_mutex_guard{};
36 std::lock_guard<mutex> lock(cache_ref_data_mutex_guard);
38 if (_refdata.empty()) {
39 MSG_TRACE(
"Getting refdata cache for file " << _refFileName);
49 template <
typename T2 = YODA::Estimate1D>
50 const T2&
refData(
const string& hname)
const {
52 if (!_refdata[hname]) {
53 MSG_ERROR(
"Can't find reference histogram " << hname);
54 throw Exception(
"Reference data " + hname +
" not found.");
57 return dynamic_cast<T2&
>(*_refdata[hname]);
59 catch (std::bad_cast& e) {
60 throw Exception(
"Requested object type "s +
typeid(T2).name() +
", but reference data \""s + hname
61 +
"\" actually has type " + _refdata[hname]->type() +
".\n");
72 mutable std::map<std::string, YODA::AnalysisObjectPtr> _refdata;
77 using ResolutionFunctorPtr = unique_ptr<ResolutionFunctor<T>>;
Logging system for controlled & formatted writing to stdout.
Definition Logging.hh:10
static Log & getLog(const std::string &name)
Definition ResolutionFunctions.hh:20
const T2 & refData(const string &hname) const
Definition ResolutionFunctions.hh:50
map< string, YODA::AnalysisObjectPtr > getRefData(const string &papername)
#define MSG_TRACE(x)
Lowest-level, most verbose messaging, using MSG_LVL.
Definition Logging.hh:193
#define MSG_ERROR(x)
Highest level messaging for serious problems, using MSG_LVL.
Definition Logging.hh:202
Definition LHCbCommon.hh:9
Error Exception
Rivet::Exception is a synonym for Rivet::Error.
Definition Exceptions.hh:19