12#ifndef FRAMEWORK_HISTOGRAMSPEC_H_
13#define FRAMEWORK_HISTOGRAMSPEC_H_
30#include <TProfile2D.h>
31#include <TProfile3D.h>
76using HistPtr = std::variant<std::shared_ptr<THn>, std::shared_ptr<THnSparse>, std::shared_ptr<TH3>, std::shared_ptr<TH2>, std::shared_ptr<TH1>, std::shared_ptr<TProfile3D>, std::shared_ptr<TProfile2D>, std::shared_ptr<TProfile>, std::shared_ptr<StepTHn>>;
95 AxisSpec(std::vector<double> binEdges_, std::optional<std::string> title_ = std::nullopt, std::optional<std::string> name_ = std::nullopt);
97 AxisSpec(
int nBins_,
double binMin_,
double binMax_, std::optional<std::string> title_ = std::nullopt, std::optional<std::string> name_ = std::nullopt);
100 AxisSpec(
ConfigurableAxis binEdges_, std::optional<std::string> title_ = std::nullopt, std::optional<std::string> name_ = std::nullopt);
119 [[nodiscard]]
long getNbins() const;
128 std::optional<std::string>
name{};
149 axes.push_back(axis);
152 void addAxis(
int nBins_,
double binMin_,
double binMax_, std::optional<std::string> title_ = std::nullopt, std::optional<std::string> name_ = std::nullopt)
154 axes.emplace_back(nBins_, binMin_, binMax_, title_, name_);
157 void addAxis(std::vector<double> binEdges_, std::optional<std::string> title_ = std::nullopt, std::optional<std::string> name_ = std::nullopt)
159 axes.emplace_back(binEdges_, title_, name_);
164 axes.insert(
axes.end(), axes_.begin(), axes_.end());
213 template <
typename T>
220 template <
typename T>
221 static TAxis*
getAxis(
const int i, T* hist);
224#define DECLAREEXT(HType) \
225 extern template std::unique_ptr<HType> HistFactory::createHist<HType>(const HistogramSpec& histSpec);
#define DECLAREEXT(HType)
constexpr uint32_t runtime_hash(char const *str)
GLuint const GLchar * name
GLint GLint GLsizei GLint GLenum GLenum type
Defining ITS Vertex explicitly as messageable.
std::variant< std::shared_ptr< THn >, std::shared_ptr< THnSparse >, std::shared_ptr< TH3 >, std::shared_ptr< TH2 >, std::shared_ptr< TH1 >, std::shared_ptr< TProfile3D >, std::shared_ptr< TProfile2D >, std::shared_ptr< TProfile >, std::shared_ptr< StepTHn > > HistPtr
constexpr double VARIABLE_WIDTH
void makeLogarithmic()
Function to make the axis logarithmic.
std::optional< int > nBins
Data members.
std::optional< std::string > title
Edges of the bin. For fixed bin width these are the limits of the binning.
std::vector< double > binEdges
Number of bins (only used for fixed bin width axis)
AxisSpec(AxisSpec const &)
AxisSpec(AxisSpec &&) noexcept
static HistPtr createHistVariant(const HistogramSpec &histSpec)
static TAxis * getAxis(const int i, T *hist)
static std::unique_ptr< T > createHist(const HistogramSpec &histSpec)
void addAxes(const HistogramConfigSpec &other)
HistogramConfigSpec(HistogramConfigSpec const &other)=default
void addAxis(int nBins_, double binMin_, double binMax_, std::optional< std::string > title_=std::nullopt, std::optional< std::string > name_=std::nullopt)
HistogramConfigSpec(HistogramConfigSpec &&other)=default
HistogramConfigSpec()=default
void addAxis(const AxisSpec &axis)
void addAxes(std::vector< AxisSpec > axes_)
void addAxis(std::vector< double > binEdges_, std::optional< std::string > title_=std::nullopt, std::optional< std::string > name_=std::nullopt)
std::vector< AxisSpec > axes
HistogramSpec(HistogramSpec const &other)=default
HistogramSpec(HistogramSpec &&other)=default
HistogramSpec(char const *name_, char const *const title_, HistogramConfigSpec config_, bool callSumw2_=false)
HistogramConfigSpec config
VectorOfTObjectPtrs other