12#ifndef FRAMEWORK_HISTOGRAMSPEC_H_
13#define FRAMEWORK_HISTOGRAMSPEC_H_
30#include <TProfile2D.h>
31#include <TProfile3D.h>
73using 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>>;
84 AxisSpec(std::vector<double> binEdges_, std::optional<std::string> title_ = std::nullopt, std::optional<std::string> name_ = std::nullopt)
92 AxisSpec(
int nBins_,
double binMin_,
double binMax_, std::optional<std::string> title_ = std::nullopt, std::optional<std::string> name_ = std::nullopt)
95 title(std::move(title_)),
96 name(std::move(name_))
98 if (binMin_ > binMax_) {
99 LOG(fatal) <<
"Defined ill-defined axis";
104 AxisSpec(
ConfigurableAxis binEdges_, std::optional<std::string> title_ = std::nullopt, std::optional<std::string> name_ = std::nullopt)
120 [[nodiscard]]
long getNbins()
const;
129 std::optional<std::string>
name{};
150 axes.push_back(axis);
153 void addAxis(
int nBins_,
double binMin_,
double binMax_, std::optional<std::string> title_ = std::nullopt, std::optional<std::string> name_ = std::nullopt)
155 axes.emplace_back(nBins_, binMin_, binMax_, title_, name_);
158 void addAxis(std::vector<double> binEdges_, std::optional<std::string> title_ = std::nullopt, std::optional<std::string> name_ = std::nullopt)
160 axes.emplace_back(binEdges_, title_, name_);
165 axes.insert(
axes.end(), axes_.begin(), axes_.end());
214 template <
typename T>
221 template <
typename T>
222 static TAxis*
getAxis(
const int i, T* hist);
225#define DECLAREEXT(HType) \
226 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 PrimaryVertex 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
Defining DataPointCompositeObject explicitly as copiable.
void makeLogarithmic()
Function to make the axis logarithmic.
std::optional< int > nBins
Data members.
AxisSpec(std::vector< double > binEdges_, std::optional< std::string > title_=std::nullopt, std::optional< std::string > name_=std::nullopt)
std::optional< std::string > title
Edges of the bin. For fixed bin width these are the limits of the binning.
AxisSpec(int nBins_, double binMin_, double binMax_, std::optional< std::string > title_=std::nullopt, std::optional< std::string > name_=std::nullopt)
std::optional< std::string > name
Optional title of the axis.
std::vector< double > binEdges
Number of bins (only used for fixed bin width axis)
AxisSpec(ConfigurableAxis binEdges_, std::optional< std::string > title_=std::nullopt, std::optional< std::string > name_=std::nullopt)
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_)
HistogramConfigSpec(HistType type_, std::vector< AxisSpec > axes_, uint8_t nSteps_=1)
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
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"