TChain Project wrong info in statbox

Hi all, I am using the following code to project a tree branch into a 1D histogram, the range of histogram declared is different than the one in the tree branch (actually a subset of that). but the no. of entries shown in statistics box of the histogram is still the same as that of full range. Does anybody know the possible problem here.

TChain *h10 = new TChain("h1");
TCanvas *c1 = new TCanvas("c1","",550,400);  
 TH1F *h1000 = new TH1F("h1000","",100,0.144,0.147); 


What about the underflows and overflows ? they should be different …

yes, they are different. Also, if I print double s = h1000->Integral(); then it prints the correct No. of events(into the small range specified while declaring the histogram)

The number of entries count the also the underflow and overflow that why they are the same even if you change the histogram range. This can be easily verified with the following commands:

root [0] auto h = new TH1F("h","h",10,0.,1.)
root [1] h->GetEntries()
(double) 0.0000000
root [2] h->Fill(0.5);
root [3] h->GetEntries()
(double) 1.0000000
root [4] h->Fill(-1.); // underflow
root [5] h->GetEntries()
(double) 2.0000000
root [6] h->Fill(2.); // overflow
root [7] h->GetEntries()
(double) 3.0000000

Thanks couet, now I understand. Is there a way to make the statistics box display correct no. of entries(no underflows and overflows) like what h->Integral() returns?



Thanks! It Works fine

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