Addition of two diffrent histograms for two different limits

_ROOT Version:(I am using ROOT5.)
Platform: Not Provided
Compiler: Not Provided

Hi !!
I have one root file and from there I am plotting variables from two different trees. While I am drawing individual variables (hist1 and hist2), it is showing me individual plots. But while I am trying to add two histograms by the following commands then it is showing me error. The plot for the “hist6”, I am getting the plot for the “hist1” I am attaching the error also. Can you please tell me how to get rid of this ?

TH1F *hist6 = new TH1F("", " ", 50, 0.450, 0.750);
TCanvas * c3 = new TCanvas();
hist6 = (TH1F*) hist1->Clone(“hist6”);

Info in TH1F::Add: Attempt to add histograms with different axis limits - trying to use TH1::Merge
Error in : Cannot merge histograms - limits are inconsistent:
first: hist6 (50, 0.139560, 0.139646), second: (50, 0.450000, 0.550000)

As the message says Add() requires histograms having the same limits. Make sure your histograms have the same limits or try to use Merge as suggested by the error message.

BTW it looks like you are posting several times the same question… try to avoid that …

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.