Skip to content

Commit

Permalink
Improve error messages by adding the name of the failing histograms w…
Browse files Browse the repository at this point in the history
…hen merging
  • Loading branch information
lmoneta committed Nov 4, 2016
1 parent 295f8b4 commit b097aab
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
22 changes: 11 additions & 11 deletions hist/hist/src/TH1Merger.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ Bool_t TH1Merger::operator() () {
Bool_t ret = BufferMerge();
// if ret is true the merge is completed and we can exit
if (ret) return kTRUE;
// in the otehr case then we merge using FindBin
// in the other cases then we merge using FindBin
return DifferentAxesMerge();
}
Error("TH1Merger","Unknown type");
Error("TH1Merger","Unknown type of Merge for histogram %s",fH0->GetName());
return kFALSE;
}

Expand Down Expand Up @@ -156,9 +156,9 @@ TH1Merger::EMergerType TH1Merger::ExamineHistograms() {
// and one common bin edge
if (!TH1::RecomputeAxisLimits(fNewXAxis, *(h->GetXaxis()))) {
Error("Merge", "Cannot merge histograms - limits are inconsistent:\n "
"first: (%d, %f, %f), second: (%d, %f, %f)",
fNewXAxis.GetNbins(), fNewXAxis.GetXmin(), fNewXAxis.GetXmax(),
h->GetXaxis()->GetNbins(), h->GetXaxis()->GetXmin(),
"first: %s (%d, %f, %f), second: %s (%d, %f, %f)", fH0->GetName(),
fNewXAxis.GetNbins(), fNewXAxis.GetXmin(), fNewXAxis.GetXmax(),
h->GetName(),h->GetXaxis()->GetNbins(), h->GetXaxis()->GetXmin(),
h->GetXaxis()->GetXmax());
return kNotCompatible;
}
Expand All @@ -171,9 +171,9 @@ TH1Merger::EMergerType TH1Merger::ExamineHistograms() {
// and one common bin edge
if (!TH1::RecomputeAxisLimits(fNewYAxis, *(h->GetYaxis()))) {
Error("Merge", "Cannot merge histograms - limits are inconsistent:\n "
"first: (%d, %f, %f), second: (%d, %f, %f)",
"first: %s (%d, %f, %f), second: %s (%d, %f, %f)", fH0->GetName(),
fNewYAxis.GetNbins(), fNewYAxis.GetXmin(), fNewYAxis.GetXmax(),
h->GetYaxis()->GetNbins(), h->GetYaxis()->GetXmin(),
h->GetName(), h->GetYaxis()->GetNbins(), h->GetYaxis()->GetXmin(),
h->GetYaxis()->GetXmax());
return kNotCompatible;
}
Expand All @@ -182,9 +182,9 @@ TH1Merger::EMergerType TH1Merger::ExamineHistograms() {
sameLimitsZ = kFALSE;
if (!TH1::RecomputeAxisLimits(fNewZAxis, *(h->GetZaxis()))) {
Error("Merge", "Cannot merge histograms - limits are inconsistent:\n "
"first: (%d, %f, %f), second: (%d, %f, %f)",
"first: %s (%d, %f, %f), second: %s (%d, %f, %f)", fH0->GetName(),
fNewZAxis.GetNbins(), fNewZAxis.GetXmin(), fNewZAxis.GetXmax(),
h->GetZaxis()->GetNbins(), h->GetZaxis()->GetXmin(),
h->GetName(),h->GetZaxis()->GetNbins(), h->GetZaxis()->GetXmin(),
h->GetZaxis()->GetXmax());
return kNotCompatible;
}
Expand Down Expand Up @@ -497,8 +497,8 @@ Bool_t TH1Merger::DifferentAxesMerge() {

if (hist->IsBinUnderflow(ibin) || hist->IsBinOverflow(ibin) ) {
Error("TH1Merger::DifferentAxesMerge", "Cannot merge histograms - the histograms have"
" different limits and underflows/overflows are present."
" The initial histogram is now broken!");
" different limits and underflows/overflows are present in the histogram %s."
" The initial histogram is now broken!",hist->GetName());
return kFALSE;
}

Expand Down
2 changes: 1 addition & 1 deletion hist/hist/src/TH1Merger.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class TH1Merger{


TH1 * fH0; //! histogram on which the list is merged
TH1 * fHClone; //! copy of fH0 - managed bby this class
TH1 * fHClone; //! copy of fH0 - managed by this class
TList fInputList; // input histogram List
TAxis fNewXAxis;
TAxis fNewYAxis;
Expand Down

0 comments on commit b097aab

Please sign in to comment.