Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Common: correctly handle integer histograms in reference comparator #2444

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions Modules/Common/src/ReferenceComparatorPlot.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -497,19 +497,23 @@ class ReferenceComparatorPlotImpl2D : public ReferenceComparatorPlotImpl

ReferenceComparatorPlot::ReferenceComparatorPlot(TH1* referenceHistogram, const std::string& outputPath, bool scaleReference, bool drawRatioOnly, const std::string& drawOption1D, const std::string& drawOption2D)
{
if (referenceHistogram->IsA() == TClass::GetClass<TH1F>() || referenceHistogram->InheritsFrom("TH1F")) {
// histograms with integer values are promoted to floating point or double to allow correctly scaling the reference and computing the ratios

// 1-D histograms
if (referenceHistogram->InheritsFrom("TH1C") || referenceHistogram->InheritsFrom("TH1S") || referenceHistogram->InheritsFrom("TH1F")) {
mImplementation = std::make_shared<ReferenceComparatorPlotImpl1D<TH1F>>(referenceHistogram, outputPath, scaleReference, drawRatioOnly, drawOption1D);
}

if (referenceHistogram->IsA() == TClass::GetClass<TH1D>() || referenceHistogram->InheritsFrom("TH1D")) {
if (referenceHistogram->InheritsFrom("TH1I") || referenceHistogram->InheritsFrom("TH1D")) {
mImplementation = std::make_shared<ReferenceComparatorPlotImpl1D<TH1D>>(referenceHistogram, outputPath, scaleReference, drawRatioOnly, drawOption1D);
}

if (referenceHistogram->IsA() == TClass::GetClass<TH2F>() || referenceHistogram->InheritsFrom("TH2F")) {
// 2-D histograms
if (referenceHistogram->InheritsFrom("TH2C") || referenceHistogram->InheritsFrom("TH2S") || referenceHistogram->InheritsFrom("TH2F")) {
mImplementation = std::make_shared<ReferenceComparatorPlotImpl2D<TH2F>>(referenceHistogram, outputPath, scaleReference, drawRatioOnly, drawOption2D);
}

if (referenceHistogram->IsA() == TClass::GetClass<TH2D>() || referenceHistogram->InheritsFrom("TH2D")) {
if (referenceHistogram->InheritsFrom("TH2I") || referenceHistogram->InheritsFrom("TH2D")) {
mImplementation = std::make_shared<ReferenceComparatorPlotImpl2D<TH2D>>(referenceHistogram, outputPath, scaleReference, drawRatioOnly, drawOption2D);
}
}
Expand Down
Loading