Problem with TChain and rebinning

I hoped that somebody had come across the following problem when rebinning a 1D histogram.

I have a scenario where I am chaining say 5 files together and then I draw the resultant output. I do this in the following way.

TChain chain(“Analysed_Data”);

The problem arises when I rebin the histogram which is redrawn. I initially have something of the order of 70,000,000 events, but when I rebin this changes to 750,000 events.

This also occurs when I specify a cut such as :-

chain.Draw(“NaI25”,“NaI25 > 0”);

You would expect the drawn histogram to look the same as the chain.Draw(“NaI25”) command except counts at zero would be neglected. However root draws a histogram with hugely reduced number of entries at values > 0 and the histograms look entirely different even when binned the same.

Does anyone know what is going on here?
Thanks, Nick.

Root version 5.12

This sounds odd. Could you send a short example reproducing your problem?


I have attached a simple example of the script, but I cannot attach files as they are roughly a hundred megs each. However perhaps you can tell me what I could be doing wrong just by looking through the code.

Just to remind you of the problem.

the Histogram “h” is drawn and contains 14million entries. However when I rebin from the editor toolbar, the number of entries immediately changes to 600,000 nentries.

Thanks, Nick
test.cpp (934 Bytes)


In order for the rebinning to work properly it needs to cache all the data in memory (instead of the a small fraction as the default). To enable it just do:chain->SetEstimate(chain->GetEntries()+2);
before calling Draw.