65 else {xmin -= 1; xmax += 1;}
84 Int_t newbinsx,newbinsy;
90 else {xmin -= 1; xmax += 1;}
94 else {ymin -= 1; ymax += 1;}
105 h->
SetBins(newbinsx,xmin,xmax,newbinsy,ymin,ymax);
116 Int_t newbinsx,newbinsy,newbinsz;
123 else {xmin -= 1; xmax += 1;}
127 else {ymin -= 1; ymax += 1;}
131 else {zmin -= 1; zmax += 1;}
146 h->
SetBins(newbinsx,xmin,xmax,newbinsy,ymin,ymax,newbinsz,zmin,zmax);
199 if(strchr(option,
't')) optionTime = 1;
else optionTime = 0;
205 if (al == ah) ah = al+1;
207 if (nold == -1 && BinWidth > 0 )
goto L90;
209 if (ntemp < 1) ntemp = 1;
214 if (awidth >= FLT_MAX)
goto LOK;
215 if (awidth <= 0)
goto LOK;
220 if (optionTime && awidth>=60) {
222 awidth /= 60; timemulti *=60;
226 awidth /= 60; timemulti *= 60;
230 awidth /= 24; timemulti *= 24;
233 if (awidth>=30.43685) {
234 awidth /= 30.43685; timemulti *= 30.43685;
238 awidth /= 12; timemulti *= 12;
248 if (jlog <-200 || jlog > 200) {
255 if (awidth <= 1 && (!optionTime || timemulti==1) ) jlog--;
266 if (sigfig <= 1) siground = 1;
267 else if (sigfig <= 1.5 && jlog==1) siground = 1.5;
268 else if (sigfig <= 2) siground = 2;
269 else if (sigfig <= 3 && jlog ==1) siground = 3;
270 else if (sigfig <= 5 && sigfig>3 && jlog ==0) siground = 5;
271 else if (jlog==0) {siground = 1; jlog++;}
277 if (sigfig <= 1 && jlog==0) siground = 1;
278 else if (sigfig <= 1.2 && jlog==1) siground = 1.2;
279 else if (sigfig <= 2 && jlog==0) siground = 2;
280 else if (sigfig <= 2.4 && jlog==1) siground = 2.4;
281 else if (sigfig <= 3) siground = 3;
282 else if (sigfig <= 6) siground = 6;
283 else if (jlog==0) siground = 12;
289 if (sigfig <= 1 && jlog==0) siground = 1;
290 else if (sigfig <= 1.4 && jlog==1) siground = 1.4;
291 else if (sigfig <= 3 && jlog ==1) siground = 3;
297 if (sigfig <= 1) siground = 1;
298 else if (sigfig <= 2) siground = 2;
299 else if (sigfig <= 5 && (!optionTime || jlog<1)) siground = 5;
300 else if (sigfig <= 6 && optionTime && jlog==1) siground = 6;
301 else {siground = 1; jlog++; }
306 if (optionTime) BinWidth *= timemulti;
315 if (nbins > 10*nold && nbins > 10000) nbins = nold;
321 alb = ah/BinWidth + 1.00001;
326 if (nold == -1)
goto LOK;
328 if (nold > 1 || nbins == 1)
goto LOK;
329 BinWidth = BinWidth*2;
333 if (2*nbins == nold && !optionTime) {ntemp++;
goto L20; }
336 Double_t oldBinLow = BinLow;
337 Double_t oldBinHigh = BinHigh;
340 Double_t atest = BinWidth*0.0001;
343 if (al-BinLow >= atest) { BinLow += BinWidth; nbins--; }
344 if (BinHigh-ah >= atest) { BinHigh -= BinWidth; nbins--; }
345 if (!optionTime && BinLow >= BinHigh) {
348 BinHigh = oldBinHigh;
351 else if (optionTime && BinLow>=BinHigh) {
353 BinHigh = oldBinHigh;
355 BinWidth = (oldBinHigh - oldBinLow)/nbins;
356 atest = BinWidth*0.0001;
357 if (al-BinLow >= atest) { BinLow += BinWidth; nbins--; }
358 if (BinHigh-ah >= atest) { BinHigh -= BinWidth; nbins--; }
369 Double_t binlow = 0,binhigh = 0,binwidth=0;
372 if (isInteger) dx = 5*(xmax-
xmin)/nbins;
375 if (umin < 0 && xmin >= 0) umin = 0;
376 if (umax > 0 && xmax <= 0) umax = 0;
380 if (binwidth <= 0 || binwidth > 1.e+39) {
392 if (xmin < 0 && xmin != dxmin) xmin = dxmin - 1;
394 if (xmax > 0 && xmax != dxmax) xmax = dxmax + 1;
395 else if (xmax ==0 && xmax == dxmax) xmax = 1;
397 if (xmin >= xmax) xmax = xmin+1;
400 nbins =
Int_t((xmax-xmin)/bw);
401 if (xmin +nbins*bw < umax) {nbins++; xmax = xmin +nbins*bw;}
402 if (xmin > umin) {nbins++; xmin = xmax -nbins*bw;}
virtual ~THLimitsFinder()
Class to find nice axis limits.
virtual void SetBins(Int_t nx, Double_t xmin, Double_t xmax)
Redefine x axis parameters.
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
static THLimitsFinder * GetLimitsFinder()
Return pointer to the current finder.
Short_t Min(Short_t a, Short_t b)
virtual Int_t FindGoodLimits(TH1 *h, Double_t xmin, Double_t xmax)
compute the best axis limits for the X axis.
static void OptimizeLimits(Int_t nbins, Int_t &newbins, Double_t &xmin, Double_t &xmax, Bool_t isInteger)
Optimize axis limits.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Double_t Log10(Double_t x)
static void SetLimitsFinder(THLimitsFinder *finder)
This static function can be used to specify a finder derived from THLimitsFinder. ...
Class to manage histogram axis.
Bool_t TestBit(UInt_t f) const
THLimitsFinder()
Pointer to hist limits finder.
THashList * GetLabels() const
static THLimitsFinder * fgLimitsFinder
Short_t Max(Short_t a, Short_t b)