@@ -2061,17 +2061,14 @@ TH1D *TH3::DoProject1D(const char* name, const char * title, const TAxis* projX,
20612061 Int_t ix = h1->FindBin (projX->GetBinCenter (ixbin));
20622062 auto eps = 1e-12 ;
20632063 if (ix == h1->GetNbinsX () + 1 ) {
2064- // if upper edge is infinite, the bin center is infinite no matter what low edge is,
2064+ // if upper edge is infinite, the bin center is + infinite no matter what low edge is,
20652065 // so FindBin is in overflow since bin goes from [lower edge, infinite)
2066- // Check the low edge instead of the bin center in that case
2066+ // if lower edge is -infinite, the bin center is -nan no matter what upper edge is,
2067+ // so FindBin is also in overflow (not underflow)
2068+ // Check close to the lower or upper edges instead of the bin center in these cases
20672069 if (std::isinf (projX->GetBinUpEdge (ixbin))) {
20682070 ix = h1->FindBin (projX->GetBinLowEdge (ixbin) + eps);
2069- }
2070- } else if (ix == 0 ) {
2071- // if lower edge is -infinite, the bin center is -infinite no matter what upper edge is,
2072- // so FindBin is in underflow bin which goes from [-inf, -inf)
2073- // Check the upper edge instead of the bin center in that case
2074- if (std::isinf (projX->GetBinLowEdge (ixbin))) {
2071+ } else if (std::isinf (projX->GetBinLowEdge (ixbin))) {
20752072 ix = h1->FindBin (projX->GetBinUpEdge (ixbin) - eps);
20762073 }
20772074 }
@@ -2286,17 +2283,14 @@ TH2D *TH3::DoProject2D(const char* name, const char * title, const TAxis* projX,
22862283 Int_t ix = h2->GetYaxis ()->FindBin (projX->GetBinCenter (ixbin));
22872284 auto eps = 1e-12 ;
22882285 if (ix == h2->GetYaxis ()->GetNbins () + 1 ) {
2289- // if upper edge is infinite, the bin center is infinite no matter what low edge is,
2286+ // if upper edge is infinite, the bin center is + infinite no matter what low edge is,
22902287 // so FindBin is in overflow since bin goes from [lower edge, infinite)
2291- // Check the low edge instead of the bin center in that case
2288+ // if lower edge is -infinite, the bin center is -nan no matter what upper edge is,
2289+ // so FindBin is also in overflow (not underflow)
2290+ // Check close to the lower or upper edges instead of the bin center in these cases
22922291 if (std::isinf (projX->GetBinUpEdge (ixbin))) {
22932292 ix = h2->GetYaxis ()->FindBin (projX->GetBinLowEdge (ixbin) + eps);
2294- }
2295- } else if (ix == 0 ) {
2296- // if lower edge is -infinite, the bin center is -infinite no matter what upper edge is,
2297- // so FindBin is in underflow bin which goes from [-inf, -inf)
2298- // Check the upper edge instead of the bin center in that case
2299- if (std::isinf (projX->GetBinLowEdge (ixbin))) {
2293+ } else if (std::isinf (projX->GetBinLowEdge (ixbin))) {
23002294 ix = h2->GetYaxis ()->FindBin (projX->GetBinUpEdge (ixbin) - eps);
23012295 }
23022296 }
@@ -2305,17 +2299,14 @@ TH2D *TH3::DoProject2D(const char* name, const char * title, const TAxis* projX,
23052299 if ( projY->TestBit (TAxis::kAxisRange ) && ( iybin < iymin || iybin > iymax )) continue ;
23062300 Int_t iy = h2->GetXaxis ()->FindBin ( projY->GetBinCenter (iybin) );
23072301 if (iy == h2->GetXaxis ()->GetNbins () + 1 ) {
2308- // if upper edge is infinite, the bin center is infinite no matter what low edge is,
2309- // so FindBin is in overflow since bin goes from [lower edge, infinite)
2310- // Check the low edge instead of the bin center in that case
2302+ // if upper edge is infinite, the bin center is +infinite no matter what low edge is,
2303+ // so FindBin is in overflow since bin goes from [lower edge, infinite)
2304+ // if lower edge is -infinite, the bin center is -nan no matter what upper edge is,
2305+ // so FindBin is also in overflow (not underflow)
2306+ // Check close to the lower or upper edges instead of the bin center in these cases
23112307 if (std::isinf (projY->GetBinUpEdge (iybin))) {
23122308 iy = h2->GetXaxis ()->FindBin (projY->GetBinLowEdge (iybin) + eps);
2313- }
2314- } else if (iy == 0 ) {
2315- // if lower edge is -infinite, the bin center is -infinite no matter what upper edge is,
2316- // so FindBin is in underflow bin which goes from [-inf, -inf)
2317- // Check the upper edge instead of the bin center in that case
2318- if (std::isinf (projY->GetBinLowEdge (iybin))) {
2309+ } else if (std::isinf (projY->GetBinLowEdge (iybin))) {
23192310 iy = h2->GetXaxis ()->FindBin (projY->GetBinUpEdge (iybin) - eps);
23202311 }
23212312 }
0 commit comments