diff --git a/hist/hist/src/TH1.cxx b/hist/hist/src/TH1.cxx index 9a6893e71cef754010bb01cd809d63f18bd59e5d..17a965e36727ccf8536d45f1235fda93886134a5 100644 --- a/hist/hist/src/TH1.cxx +++ b/hist/hist/src/TH1.cxx @@ -1031,9 +1031,17 @@ void TH1::Add(const TH1 *h1, const TH1 *h2, Double_t c1, Double_t c2) SetMinimum(); SetMaximum(); -// Reset the kCanRebin option. Otherwise SetBinContent on the overflow bin +// Reset the kCanRebin and time display option. Otherwise SetBinContent on the overflow bin // would resize the axis limits! - ResetBit(kCanRebin); +// we need to do for only X axis since only TH1x::SetBinContent resize the axis + Bool_t canRebin = TestBit(kCanRebin); + if (canRebin) ResetBit(kCanRebin); + + Bool_t timeDisplayX = fXaxis.GetTimeDisplay(); + if (timeDisplayX) fXaxis.SetTimeDisplay(0); + + + // - Loop on bins (including underflows/overflows) @@ -1088,6 +1096,9 @@ void TH1::Add(const TH1 *h1, const TH1 *h2, Double_t c1, Double_t c2) PutStats(s3); SetEntries(nEntries); } + + if (canRebin) SetBit(kCanRebin); + if (timeDisplayX) fXaxis.SetTimeDisplay(1); }