10#ifndef CbmQaCmpDrawer_h
11#define CbmQaCmpDrawer_h 1
60 void Draw(Option_t* opt)
const;
84 double fMinimum = std::numeric_limits<double>::signaling_NaN();
85 double fMaximum = std::numeric_limits<double>::signaling_NaN();
110 fMinimum = std::numeric_limits<double>::signaling_NaN();
111 fMaximum = std::numeric_limits<double>::signaling_NaN();
120 LOG(info) <<
"CbmQaCmpDrawer: attempt to register a nullptr (" << title <<
"), ignored";
125 auto* pObjClone =
static_cast<Obj*
>(pObj->Clone());
129 TString legEntryName = title ? title : pObj->GetTitle();
139 if constexpr (std::is_base_of_v<TH1, Obj> && !std::is_base_of_v<TH2, Obj> && !std::is_base_of_v<TH3, Obj>) {
142 if (std::isnan(maxY)) {
143 auto HistMax = [](
const Obj* lhs,
const Obj* rhs) {
return lhs->GetMaximum() < rhs->GetMaximum(); };
148 if (std::isnan(minY)) {
149 auto HistMin = [](
const Obj* lhs,
const Obj* rhs) {
return lhs->GetMinimum() < rhs->GetMinimum(); };
151 minY = (minY < 0.) ? minY : 0.;
156 (*it)->SetStats(
false);
157 (*it)->SetMinimum(minY);
158 (*it)->SetMaximum(maxY);
159 (*it)->Draw(it ==
fvpObjects.begin() ?
"" :
"same");
162 else if constexpr (std::is_base_of_v<TH2, Obj> || std::is_base_of_v<TH3, Obj>) {
164 int nRows =
static_cast<int>(std::sqrt(nObjects));
165 int nCols = nObjects / nRows;
166 if (nCols * nRows < nObjects) {
169 gPad->Divide(nCols, nRows);
172 if constexpr (std::is_base_of_v<TH2, Obj>) {
188 auto* pLeg =
new TLegend(legX0, legY0, legX1, legY1);
190 for (
int iObj = 0; iObj < (int)
fvpObjects.size(); ++iObj) {
friend fscal max(fscal x, fscal y)
friend fscal min(fscal x, fscal y)
std::vector< Obj * > fvpObjects
Set of objects to be drawn.
static constexpr double kLegEntryHight
Hight of one legend entry in Y axis.
std::vector< TString > fvsLegEntries
Entries to legend.
CbmQaCmpDrawer()
Default constructor.
~CbmQaCmpDrawer()=default
Destructor.
void SetMaximum(double max)
Sets maximum of the histogram/graph.
void Clear()
Clears the set of objects.
static constexpr double kLegTopBound
Top bound of the legend.
CbmQaCmpDrawer & operator=(const CbmQaCmpDrawer &)=delete
Copy assignment operator.
static constexpr double kIndentFromMax
Indent from the maximum (percentage from (max - min))
void Draw(Option_t *opt) const
Draw objects.
void SetMinimum(double min)
Sets minimum of the histogram/graph.
static constexpr double kLegRightBound
Right bound of the legend.
CbmQaCmpDrawer & operator=(CbmQaCmpDrawer &&)=delete
Move assignment operator.
CbmQaCmpDrawer(const CbmQaCmpDrawer &)=delete
Copy constructor.
void RegisterObject(const Obj *pObj, const char *title=nullptr)
Registers an object to draw.
static constexpr double kLegEntryWidth
Width of the legend.
static constexpr double kLegTextSize
Text size of the legend entries.
CbmQaCmpDrawer(CbmQaCmpDrawer &&)=delete
Move constructor.