57 TAxis *xaxis =
h->GetXaxis();
83 TAxis *xaxis =
h->GetXaxis();
84 TAxis *yaxis =
h->GetYaxis();
86 const Bool_t xbinAuto = newbinsx == 0;
87 const Bool_t ybinAuto = newbinsy == 0;
121 TAxis *xaxis =
h->GetXaxis();
122 TAxis *yaxis =
h->GetYaxis();
123 TAxis *zaxis =
h->GetZaxis();
125 const Bool_t xbinAuto = newbinsx == 0;
126 const Bool_t ybinAuto = newbinsy == 0;
127 const Bool_t zbinAuto = newbinsz == 0;
137 if (zbinAuto && zmin >= zmax) {
139 else {zmin -= 1; zmax += 1;}
210 if(strchr(option,
't')) optionTime = 1;
else optionTime = 0;
216 if (al == ah) ah = al+1;
218 if (nold == -1 && BinWidth > 0 )
goto L90;
220 if (ntemp < 1) ntemp = 1;
225 if (awidth >= FLT_MAX)
goto LOK;
226 if (awidth <= 0)
goto LOK;
231 if (optionTime && awidth>=60) {
233 awidth /= 60; timemulti *=60;
237 awidth /= 60; timemulti *= 60;
241 awidth /= 24; timemulti *= 24;
244 if (awidth>=30.43685) {
245 awidth /= 30.43685; timemulti *= 30.43685;
249 awidth /= 12; timemulti *= 12;
259 if (jlog <-200 || jlog > 200) {
266 if (awidth <= 1 && (!optionTime || timemulti==1) ) jlog--;
277 if (sigfig <= 1) siground = 1;
278 else if (sigfig <= 1.5 && jlog==1) siground = 1.5;
279 else if (sigfig <= 2) siground = 2;
280 else if (sigfig <= 3 && jlog ==1) siground = 3;
281 else if (sigfig <= 5 && sigfig>3 && jlog ==0) siground = 5;
282 else if (jlog==0) {siground = 1; jlog++;}
288 if (sigfig <= 1 && jlog==0) siground = 1;
289 else if (sigfig <= 1.2 && jlog==1) siground = 1.2;
290 else if (sigfig <= 2 && jlog==0) siground = 2;
291 else if (sigfig <= 2.4 && jlog==1) siground = 2.4;
292 else if (sigfig <= 3) siground = 3;
293 else if (sigfig <= 6) siground = 6;
294 else if (jlog==0) siground = 12;
300 if (sigfig <= 1 && jlog==0) siground = 1;
301 else if (sigfig <= 1.4 && jlog==1) siground = 1.4;
302 else if (sigfig <= 3 && jlog ==1) siground = 3;
308 if (sigfig <= 1) siground = 1;
309 else if (sigfig <= 2) siground = 2;
310 else if (sigfig <= 5 && (!optionTime || jlog<1)) siground = 5;
311 else if (sigfig <= 6 && optionTime && jlog==1) siground = 6;
312 else {siground = 1; jlog++; }
317 if (optionTime) BinWidth *= timemulti;
326 if (nbins > 10*nold && nbins > 10000) nbins = nold;
332 alb = ah/BinWidth + 1.00001;
337 if (nold == -1)
goto LOK;
339 if (nold > 1 || nbins == 1)
goto LOK;
340 BinWidth = BinWidth*2;
344 if (2*nbins == nold && !optionTime) {ntemp++;
goto L20; }
349 Int_t oldnbins = nbins;
354 if (al-BinLow >= atest) { BinLow += BinWidth; nbins--; }
355 if (BinHigh-ah >= atest) { BinHigh -= BinWidth; nbins--; }
356 if (!optionTime && BinLow >= BinHigh) {
359 BinHigh = oldBinHigh;
362 else if (optionTime && BinLow>=BinHigh) {
364 BinHigh = oldBinHigh;
366 BinWidth = (oldBinHigh - oldBinLow)/nbins;
367 atest = BinWidth*0.0001;
368 if (al-BinLow >= atest) { BinLow += BinWidth; nbins--; }
369 if (BinHigh-ah >= atest) { BinHigh -= BinWidth; nbins--; }
381 Double_t binlow = 0,binhigh = 0,binwidth=0;
384 if (isInteger) dx = 5*(
xmax-
xmin)/nbins;
387 if (umin < 0 && xmin >= 0) umin = 0;
388 if (umax > 0 &&
xmax <= 0) umax = 0;
392 if (binwidth <= 0 || binwidth > 1.e+39) {
396 const auto delta = 0.01 * (
xmax -
xmin);
397 xmin = std::min(binlow,
xmin - delta);
398 xmax = std::max(binhigh,
xmax + delta);
414 if (
xmin +nbins*bw < umax) {nbins++;
xmax =
xmin +nbins*bw;}
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
long long Long64_t
Portable signed long integer 8 bytes.
const char Option_t
Option string (const char).
Class to manage histogram axis.
THashList * GetLabels() const
TH1 is the base class of all histogram classes in ROOT.
Class to compute nice axis limits.
static void SetLimitsFinder(THLimitsFinder *finder)
This static function can be used to specify a finder derived from THLimitsFinder.
~THLimitsFinder() override
static THLimitsFinder * GetLimitsFinder()
Return pointer to the current finder.
static void OptimizeLimits(Int_t nbins, Int_t &newbins, Double_t &xmin, Double_t &xmax, Bool_t isInteger)
Optimize axis limits.
virtual Int_t FindGoodLimitsXY(TH1 *h, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Int_t newbinsx=0, Int_t newbinsy=0)
Compute the best axis limits for the X and Y axis if the corresponding newbins variable is set to 0,...
static THLimitsFinder * fgLimitsFinder
! Pointer to hist limits finder
virtual Int_t FindGoodLimits(TH1 *h, Double_t xmin, Double_t xmax)
Compute the best axis limits for the X axis.
virtual Int_t FindGoodLimitsXYZ(TH1 *h, Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax, Int_t newbinsx=0, Int_t newbinsy=0, Int_t newbinsz=0)
Compute the best axis limits and bins for the X, Y and Z axis if the corresponding newbins variable i...
static void Optimize(Double_t A1, Double_t A2, Int_t nold, Double_t &BinLow, Double_t &BinHigh, Int_t &nbins, Double_t &BWID, Option_t *option="")
Static function to compute reasonable axis limits.
Bool_t TestBit(UInt_t f) const
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
Short_t Min(Short_t a, Short_t b)
Returns the smallest of a and b.
Double_t Log10(Double_t x)
Returns the common (base-10) logarithm of x.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.