diff --git a/Modules/Common/include/Common/TH1Ratio.inl b/Modules/Common/include/Common/TH1Ratio.inl index 1ce1605aab..2ccf515c8a 100644 --- a/Modules/Common/include/Common/TH1Ratio.inl +++ b/Modules/Common/include/Common/TH1Ratio.inl @@ -218,7 +218,11 @@ void TH1Ratio::update() } T::Reset(); - mHistoNum->GetXaxis()->Copy(*T::GetXaxis()); + if (mHistoNum->GetXaxis()->IsVariableBinSize()) { + T::GetXaxis()->Set(mHistoNum->GetXaxis()->GetNbins(), mHistoNum->GetXaxis()->GetXbins()->GetArray()); + } else { + T::GetXaxis()->Set(mHistoNum->GetXaxis()->GetNbins(), mHistoNum->GetXaxis()->GetXmin(), mHistoNum->GetXaxis()->GetXmax()); + } T::SetBinsLength(); // Copy bin labels between histograms. diff --git a/Modules/Common/include/Common/TH2Ratio.inl b/Modules/Common/include/Common/TH2Ratio.inl index a27e34b2c7..2d5226cde7 100644 --- a/Modules/Common/include/Common/TH2Ratio.inl +++ b/Modules/Common/include/Common/TH2Ratio.inl @@ -277,8 +277,16 @@ void TH2Ratio::update() } T::Reset(); - mHistoNum->GetXaxis()->Copy(*T::GetXaxis()); - mHistoNum->GetYaxis()->Copy(*T::GetYaxis()); + if (mHistoNum->GetXaxis()->IsVariableBinSize()) { + T::GetXaxis()->Set(mHistoNum->GetXaxis()->GetNbins(), mHistoNum->GetXaxis()->GetXbins()->GetArray()); + } else { + T::GetXaxis()->Set(mHistoNum->GetXaxis()->GetNbins(), mHistoNum->GetXaxis()->GetXmin(), mHistoNum->GetXaxis()->GetXmax()); + } + if (mHistoNum->GetYaxis()->IsVariableBinSize()) { + T::GetYaxis()->Set(mHistoNum->GetYaxis()->GetNbins(), mHistoNum->GetYaxis()->GetXbins()->GetArray()); + } else { + T::GetYaxis()->Set(mHistoNum->GetYaxis()->GetNbins(), mHistoNum->GetYaxis()->GetXmin(), mHistoNum->GetYaxis()->GetXmax()); + } T::SetBinsLength(); // Copy bin labels between histograms.