2#ifndef RIVET_ResolutionFunctions_HH
3#define RIVET_ResolutionFunctions_HH
5#include "Rivet/Tools/Logging.hh"
6#include "Rivet/Particle.hh"
8#include "Rivet/Math/Vector4.hh"
9#include "Rivet/Tools/RivetYODA.hh"
25 virtual double resolution(
const T& input)
const = 0;
32 void _cacheRefData()
const {
34 static std::mutex cache_ref_data_mutex_guard {};
35 std::lock_guard<mutex> lock(cache_ref_data_mutex_guard);
37 if (_refdata.empty()) {
38 MSG_TRACE(
"Getting refdata cache for file " <<_refFileName);
48 template <
typename T2=YODA::Estimate1D>
49 const T2&
refData(
const string& hname)
const {
51 if (!_refdata[hname]) {
52 MSG_ERROR(
"Can't find reference histogram " << hname);
53 throw Exception(
"Reference data " + hname +
" not found.");
56 return dynamic_cast<T2&
>(*_refdata[hname]);
57 }
catch (std::bad_cast &e) {
58 throw Exception(
"Requested object type "s +
typeid(T2).name() +
", but reference data \""s + hname
59 +
"\" actually has type " + _refdata[hname]->type() +
".\n");
69 mutable std::map<std::string, YODA::AnalysisObjectPtr> _refdata;
74 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:49
map< string, YODA::AnalysisObjectPtr > getRefData(const string &papername)
#define MSG_TRACE(x)
Lowest-level, most verbose messaging, using MSG_LVL.
Definition Logging.hh:180
#define MSG_ERROR(x)
Highest level messaging for serious problems, using MSG_LVL.
Definition Logging.hh:189
Definition MC_CENT_PPB_Projections.hh:10
Error Exception
Rivet::Exception is a synonym for Rivet::Error.
Definition Exceptions.hh:18