2222#include " Framework/SerializationMethods.h"
2323#include " Framework/TableBuilder.h"
2424#include " Framework/RuntimeError.h"
25+ #include " StepTHn.h"
2526
2627#include < TDataMember.h>
2728#include < TDataType.h>
2829#include < TArrayL.h>
30+ #include < THnSparse.h>
2931#include < TProfile2D.h>
3032#include < fmt/core.h>
3133
@@ -403,28 +405,6 @@ constexpr HistogramRegistry::HistName::HistName(const ConstStr<chars...>& hashed
403405{
404406}
405407
406- template <typename T>
407- std::shared_ptr<T> HistogramRegistry::add (char const * const name, char const * const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2)
408- {
409- auto histVariant = add (name, title, histConfigSpec, callSumw2);
410- if (auto histPtr = std::get_if<std::shared_ptr<T>>(&histVariant)) {
411- return *histPtr;
412- } else {
413- throw runtime_error_f (R"( Histogram type specified in add<>("%s") does not match the actual type of the histogram!)" , name);
414- }
415- }
416-
417- template <typename T>
418- std::shared_ptr<T> HistogramRegistry::add (char const * const name, char const * const title, HistType histType, const std::vector<AxisSpec>& axes, bool callSumw2)
419- {
420- auto histVariant = add (name, title, histType, axes, callSumw2);
421- if (auto histPtr = std::get_if<std::shared_ptr<T>>(&histVariant)) {
422- return *histPtr;
423- } else {
424- throw runtime_error_f (R"( Histogram type specified in add<>("%s") does not match the actual type of the histogram!)" , name);
425- }
426- }
427-
428408template <typename T>
429409std::shared_ptr<T> HistogramRegistry::add (const std::string& name, char const * const title, HistType histType, const std::vector<AxisSpec>& axes, bool callSumw2)
430410{
@@ -447,25 +427,6 @@ std::shared_ptr<T> HistogramRegistry::operator()(const HistName& histName)
447427 return get<T>(histName);
448428}
449429
450- template <typename T>
451- HistPtr HistogramRegistry::insertClone (const HistName& histName, const std::shared_ptr<T> originalHist)
452- {
453- validateHistName (histName.str , histName.hash );
454- for (auto i = 0u ; i < MAX_REGISTRY_SIZE; ++i) {
455- TObject* rawPtr = nullptr ;
456- std::visit ([&](const auto & sharedPtr) { rawPtr = sharedPtr.get (); }, mRegistryValue [imask (histName.idx + i)]);
457- if (!rawPtr) {
458- registerName (histName.str );
459- mRegistryKey [imask (histName.idx + i)] = histName.hash ;
460- mRegistryValue [imask (histName.idx + i)] = std::shared_ptr<T>(static_cast <T*>(originalHist->Clone (histName.str )));
461- lookup += i;
462- return mRegistryValue [imask (histName.idx + i)];
463- }
464- }
465- LOGF (fatal, R"( Internal array of HistogramRegistry "%s" is full.)" , mName );
466- return HistPtr ();
467- }
468-
469430template <typename T>
470431uint32_t HistogramRegistry::getHistIndex (const T& histName)
471432{
@@ -491,6 +452,35 @@ extern template void HistogramRegistry::fill(const HistName& histName, double);
491452extern template void HistogramRegistry::fill (const HistName& histName, float );
492453extern template void HistogramRegistry::fill (const HistName& histName, int );
493454
455+ extern template HistPtr HistogramRegistry::insertClone (const HistName&, const std::shared_ptr<TH1>);
456+ extern template HistPtr HistogramRegistry::insertClone (const HistName&, const std::shared_ptr<TH2>);
457+ extern template HistPtr HistogramRegistry::insertClone (const HistName&, const std::shared_ptr<TH3>);
458+ extern template HistPtr HistogramRegistry::insertClone (const HistName&, const std::shared_ptr<TProfile>);
459+ extern template HistPtr HistogramRegistry::insertClone (const HistName&, const std::shared_ptr<TProfile2D>);
460+ extern template HistPtr HistogramRegistry::insertClone (const HistName&, const std::shared_ptr<TProfile3D>);
461+ extern template HistPtr HistogramRegistry::insertClone (const HistName&, const std::shared_ptr<THnSparse>);
462+ extern template HistPtr HistogramRegistry::insertClone (const HistName&, const std::shared_ptr<THn>);
463+ extern template HistPtr HistogramRegistry::insertClone (const HistName&, const std::shared_ptr<StepTHn>);
464+
465+ extern template std::shared_ptr<TH1> HistogramRegistry::add<TH1>(char const * const name, char const * const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2);
466+ extern template std::shared_ptr<TH1> HistogramRegistry::add<TH1>(char const * const name, char const * const title, HistType histType, const std::vector<AxisSpec>& axes, bool callSumw2);
467+ extern template std::shared_ptr<TH2> HistogramRegistry::add<TH2>(char const * const name, char const * const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2);
468+ extern template std::shared_ptr<TH2> HistogramRegistry::add<TH2>(char const * const name, char const * const title, HistType histType, const std::vector<AxisSpec>& axes, bool callSumw2);
469+ extern template std::shared_ptr<TH3> HistogramRegistry::add<TH3>(char const * const name, char const * const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2);
470+ extern template std::shared_ptr<TH3> HistogramRegistry::add<TH3>(char const * const name, char const * const title, HistType histType, const std::vector<AxisSpec>& axes, bool callSumw2);
471+ extern template std::shared_ptr<TProfile> HistogramRegistry::add<TProfile>(char const * const name, char const * const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2);
472+ extern template std::shared_ptr<TProfile> HistogramRegistry::add<TProfile>(char const * const name, char const * const title, HistType histType, const std::vector<AxisSpec>& axes, bool callSumw2);
473+ extern template std::shared_ptr<TProfile2D> HistogramRegistry::add<TProfile2D>(char const * const name, char const * const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2);
474+ extern template std::shared_ptr<TProfile2D> HistogramRegistry::add<TProfile2D>(char const * const name, char const * const title, HistType histType, const std::vector<AxisSpec>& axes, bool callSumw2);
475+ extern template std::shared_ptr<TProfile3D> HistogramRegistry::add<TProfile3D>(char const * const name, char const * const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2);
476+ extern template std::shared_ptr<TProfile3D> HistogramRegistry::add<TProfile3D>(char const * const name, char const * const title, HistType histType, const std::vector<AxisSpec>& axes, bool callSumw2);
477+ extern template std::shared_ptr<THn> HistogramRegistry::add<THn>(char const * const name, char const * const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2);
478+ extern template std::shared_ptr<THn> HistogramRegistry::add<THn>(char const * const name, char const * const title, HistType histType, const std::vector<AxisSpec>& axes, bool callSumw2);
479+ extern template std::shared_ptr<THnSparse> HistogramRegistry::add<THnSparse>(char const * const name, char const * const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2);
480+ extern template std::shared_ptr<THnSparse> HistogramRegistry::add<THnSparse>(char const * const name, char const * const title, HistType histType, const std::vector<AxisSpec>& axes, bool callSumw2);
481+ extern template std::shared_ptr<StepTHn> HistogramRegistry::add<StepTHn>(char const * const name, char const * const title, const HistogramConfigSpec& histConfigSpec, bool callSumw2);
482+ extern template std::shared_ptr<StepTHn> HistogramRegistry::add<StepTHn>(char const * const name, char const * const title, HistType histType, const std::vector<AxisSpec>& axes, bool callSumw2);
483+
494484template <typename ... Cs, typename T>
495485void HistogramRegistry::fill (const HistName& histName, const T& table, const o2::framework::expressions::Filter& filter)
496486{
0 commit comments