Hi Folks,
I am seeing some very odd behaviour when I try to re-bin a histogram with variable bin widths.
When I do the following (see code below) I get the attached output.
I would have expected the second bin in the re-binned histogram to have 5 entries instead of 2. Am I doing something wrong?
Cheers
Andrew
TCanvas *c1 = new TCanvas("c1","c1",600,400);
c1->cd();
TH1F *h1 = new TH1F("h1","Orig",6,0,3);
h1->SetLineWidth(4);
h1->Fill(0.25);
h1->Fill(0.75);
h1->Fill(0.75);
h1->Fill(1.75);
h1->Fill(1.75);
h1->Fill(1.75);
h1->Draw();
c1->Update();
Double_t xbins[3] = {0.0,0.5,3.0};
TH1F *h2 = h1->Rebin(2,"h2",xbins);
h2->SetTitle("Rebin");
h2->SetLineWidth(1);
h2->SetLineColor(kBlue);
h2->Draw("same");
c1->Update();