1 #ifndef RDFAnalysis_SysResultPtr_H 2 #define RDFAnalysis_SysResultPtr_H 31 m_nominal(nominalName) {}
40 typename = std::enable_if_t<std::is_base_of<T, U>{} || std::is_same<T, U>{},
void>>
42 const std::string& nominalName,
43 const std::map<std::string, ROOT::RDF::RResultPtr<U>>& resultMap) :
44 m_nominal(nominalName)
46 for (
const auto& p : resultMap)
51 auto begin() {
return m_wrappers.begin(); }
54 auto begin()
const {
return m_wrappers.begin(); }
57 auto end() {
return m_wrappers.end(); }
60 auto end()
const {
return m_wrappers.end(); }
64 std::size_t
size()
const {
return m_wrappers.size(); }
70 void reset() { m_wrappers.clear(); }
77 T*
get(
const std::string& syst)
79 auto itr = m_wrappers.find(syst);
80 return itr == m_wrappers.end()
81 ? m_wrappers.at(m_nominal).get()
94 const std::string& systematic,
97 return m_wrappers.insert(std::make_pair(systematic, result) ).second;
105 template <
typename U,
106 typename = std::enable_if_t<std::is_base_of<T, U>{},
void>
109 m_nominal(other.m_nominal)
111 for (
const auto& p : other)
112 m_wrappers.insert(std::make_pair(
117 operator bool()
const {
return m_wrappers.size() != 0; }
120 template <
typename U>
122 std::string m_nominal;
123 std::map<std::string, ResultWrapper<T>> m_wrappers;
126 #endif //> !RDFAnalysis_SysResultPtr_H SysResultPtr(const std::string &nominalName)
Create the result.
Definition: SysResultPtr.h:30
std::size_t size() const
Size of the map (i.e. the number of systematics affecting this result)
Definition: SysResultPtr.h:64
bool addResult(const std::string &systematic, const ResultWrapper< T > &result)
Add the result wrapper for a given systematic.
Definition: SysResultPtr.h:93
auto end()
Iterator to the end of the underlying map.
Definition: SysResultPtr.h:57
SysResultPtr(const SysResultPtr< U > &other)
Allow type conversions in copy construction.
Definition: SysResultPtr.h:108
Class for wrapping RResultPtrs.
Definition: CutflowDetail.h:11
auto begin()
Iterator to the start of the underlying map.
Definition: SysResultPtr.h:51
void setMap(const std::map< std::string, ResultWrapper< T >> &newMap)
Set from a map.
Definition: SysResultPtr.h:67
Class to wrap together RResultPtrs for different systematic variations.
Definition: SysResultPtr.h:24
void reset()
Reset all results.
Definition: SysResultPtr.h:70
auto end() const
Const iterator to the end of the underlying map.
Definition: SysResultPtr.h:60
Wrapper class for RResultPtrs.
Definition: ResultWrapper.h:25
auto begin() const
Const iterator to the start of the underlying map.
Definition: SysResultPtr.h:54
SysResultPtr(const std::string &nominalName, const std::map< std::string, ROOT::RDF::RResultPtr< U >> &resultMap)
Create the result from an existing map.
Definition: SysResultPtr.h:41