35 template <
int DIMENSION>
38 GetPainterPtr() =
this;
41 template <
int DIMENSION>
44 GetPainterPtr() =
nullptr;
47 template <
int DIMENSION>
55 template <
int DIMENSION>
63 return GetPainterPtr();
81 template <
int DIMENSIONS>
84 template <
int DIMENSIONS>
87 auto implBase = fHistImpl.Get();
93 std::array<TAxisView, DIMENSIONS> axes;
94 for (
int i = 0; i < DIMENSIONS; ++i)
95 axes[i] = implBase->GetAxis(i);
100 std::string histName;
102 std::stringstream strm;
103 strm <<
"drawAdaptor" <<
this;
107 switch (DIMENSIONS) {
108 case 1: old =
new TH1D(histName.c_str(), implBase->GetTitle().c_str(), axes[0].GetNBins() - 2, 0., 1.);
break;
110 old =
new TH2D(histName.c_str(), implBase->GetTitle().c_str(), axes[0].GetNBins() - 2, 0., 1.,
111 axes[1].GetNBins() - 2, 0., 1.);
114 old =
new TH3D(histName.c_str(), implBase->GetTitle().c_str(), axes[0].GetNBins() - 2, 0., 1.,
115 axes[1].GetNBins() - 2, 0., 1., axes[2].GetNBins() - 2, 0., 1.);
120 R__ERROR_HERE(
"Hist") <<
"Drawing of " << DIMENSIONS <<
" dimensional histograms not supported.";
128 for (
int i = 0; i < DIMENSIONS; ++i) {
130 oldAxes[i]->SetTitle(axes[i].GetTitle().c_str());
131 if (axes[i].GetAsEquidistant()) {
132 oldAxes[i]->Set(axes[i].GetNBins() - 2, axes[i].GetFrom(), axes[i].GetTo());
133 }
else if (
const TAxisIrregular *irr = axes[i].GetAsIrregular()) {
134 oldAxes[i]->Set(axes[i].GetNBins() - 2, &irr->GetBinBorders()[0]);
136 assert(0 &&
"Logic error; the axis is neither equidistant nor irregular.");
140 int nBins = implBase->GetNBins();
142 if (implBase->HasBinUncertainty())
146 for (
int binidx = 0; binidx < nBins; ++binidx) {
147 old->
SetBinContent(binidx, implBase->GetBinContentAsDouble(binidx));
148 old->
SetBinError(binidx, implBase->GetBinUncertainty(binidx));
155 template <
int DIMENSIONS>
162 namespace Experimental {
Namespace for new ROOT classes and functions.
void Paint(Internal::TVirtualCanvasPainter &canv) final
Paint the histogram.
virtual void SetDirectory(TDirectory *dir)
By default when an histogram is created, it is added to the list of histogram objects in the current ...
virtual int Load(const char *module, const char *entry="", Bool_t system=kFALSE)
Load a shared library.
void LoadHistPainterLibrary()
static THistPainterBase< DIMENSION > * GetPainter()
virtual void SetBinError(Int_t bin, Double_t error)
Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empt...
THist< 3, double, THistStatContent, THistStatUncertainty > TH3D
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis from bin first to last.
R__EXTERN TSystem * gSystem
void PopulateMenu(TMenuItems &) final
Method can be used to provide menu items for the drawn object.
virtual ~THistDrawableBase()
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
THistDrawableBase & operator=(THistDrawableBase &&)
Abstract interface for painting a canvas.
An axis with non-equidistant bins (also known as "variable binning").
THist< 2, double, THistStatContent, THistStatUncertainty > TH2D
typedef void((*Func_t)())
virtual void SetBinsLength(Int_t=-1)
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
THist< 1, double, THistStatContent, THistStatUncertainty > TH1D
static THistPainterBase< DIMENSION > *& GetPainterPtr()
virtual ~THistPainterBase()
#define R__ERROR_HERE(GROUP)
TAxis * GetXaxis()
Get the behaviour adopted by the object about the statoverflows. See EStatOverflows for more informat...