diff --git a/Framework/Core/include/Framework/HistogramRegistry.h b/Framework/Core/include/Framework/HistogramRegistry.h index 0801064b6f4cc..9f272be38da0c 100644 --- a/Framework/Core/include/Framework/HistogramRegistry.h +++ b/Framework/Core/include/Framework/HistogramRegistry.h @@ -22,10 +22,12 @@ #include "Framework/SerializationMethods.h" #include "Framework/TableBuilder.h" #include "Framework/RuntimeError.h" +#include "StepTHn.h" #include #include #include +#include #include #include @@ -403,28 +405,6 @@ constexpr HistogramRegistry::HistName::HistName(const ConstStr& hashed { } -template -std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2) -{ - auto histVariant = add(name, title, histConfigSpec, callSumw2); - if (auto histPtr = std::get_if>(&histVariant)) { - return *histPtr; - } else { - throw runtime_error_f(R"(Histogram type specified in add<>("%s") does not match the actual type of the histogram!)", name); - } -} - -template -std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2) -{ - auto histVariant = add(name, title, histType, axes, callSumw2); - if (auto histPtr = std::get_if>(&histVariant)) { - return *histPtr; - } else { - throw runtime_error_f(R"(Histogram type specified in add<>("%s") does not match the actual type of the histogram!)", name); - } -} - template std::shared_ptr HistogramRegistry::add(const std::string& name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2) { @@ -447,25 +427,6 @@ std::shared_ptr HistogramRegistry::operator()(const HistName& histName) return get(histName); } -template -HistPtr HistogramRegistry::insertClone(const HistName& histName, const std::shared_ptr originalHist) -{ - validateHistName(histName.str, histName.hash); - for (auto i = 0u; i < MAX_REGISTRY_SIZE; ++i) { - TObject* rawPtr = nullptr; - std::visit([&](const auto& sharedPtr) { rawPtr = sharedPtr.get(); }, mRegistryValue[imask(histName.idx + i)]); - if (!rawPtr) { - registerName(histName.str); - mRegistryKey[imask(histName.idx + i)] = histName.hash; - mRegistryValue[imask(histName.idx + i)] = std::shared_ptr(static_cast(originalHist->Clone(histName.str))); - lookup += i; - return mRegistryValue[imask(histName.idx + i)]; - } - } - LOGF(fatal, R"(Internal array of HistogramRegistry "%s" is full.)", mName); - return HistPtr(); -} - template uint32_t HistogramRegistry::getHistIndex(const T& histName) { @@ -491,6 +452,35 @@ extern template void HistogramRegistry::fill(const HistName& histName, double); extern template void HistogramRegistry::fill(const HistName& histName, float); extern template void HistogramRegistry::fill(const HistName& histName, int); +extern template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +extern template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +extern template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +extern template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +extern template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +extern template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +extern template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +extern template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +extern template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); + +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +extern template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); + template void HistogramRegistry::fill(const HistName& histName, const T& table, const o2::framework::expressions::Filter& filter) { diff --git a/Framework/Core/src/HistogramRegistry.cxx b/Framework/Core/src/HistogramRegistry.cxx index 0836e72ffa935..0a0cc1fc3a690 100644 --- a/Framework/Core/src/HistogramRegistry.cxx +++ b/Framework/Core/src/HistogramRegistry.cxx @@ -414,4 +414,74 @@ void HistFiller::badHistogramFill(char const* name) LOGF(fatal, "The number of arguments in fill function called for histogram %s is incompatible with histogram dimensions.", name); } +template +HistPtr HistogramRegistry::insertClone(const HistName& histName, const std::shared_ptr originalHist) +{ + validateHistName(histName.str, histName.hash); + for (auto i = 0u; i < MAX_REGISTRY_SIZE; ++i) { + TObject* rawPtr = nullptr; + std::visit([&](const auto& sharedPtr) { rawPtr = sharedPtr.get(); }, mRegistryValue[imask(histName.idx + i)]); + if (!rawPtr) { + registerName(histName.str); + mRegistryKey[imask(histName.idx + i)] = histName.hash; + mRegistryValue[imask(histName.idx + i)] = std::shared_ptr(static_cast(originalHist->Clone(histName.str))); + lookup += i; + return mRegistryValue[imask(histName.idx + i)]; + } + } + LOGF(fatal, R"(Internal array of HistogramRegistry "%s" is full.)", mName); + return HistPtr(); +} + +template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); +template HistPtr HistogramRegistry::insertClone(const HistName&, const std::shared_ptr); + +template +std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2) +{ + auto histVariant = add(name, title, histConfigSpec, callSumw2); + if (auto histPtr = std::get_if>(&histVariant)) { + return *histPtr; + } else { + throw runtime_error_f(R"(Histogram type specified in add<>("%s") does not match the actual type of the histogram!)", name); + } +} + +template +std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2) +{ + auto histVariant = add(name, title, histType, axes, callSumw2); + if (auto histPtr = std::get_if>(&histVariant)) { + return *histPtr; + } else { + throw runtime_error_f(R"(Histogram type specified in add<>("%s") does not match the actual type of the histogram!)", name); + } +} + +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2); +template std::shared_ptr HistogramRegistry::add(char const* const name, char const* const title, HistType histType, const std::vector& axes, bool callSumw2); + } // namespace o2::framework