Integrating: TH2D

From: Anil Singh <anil79_at_fnal.gov>
Date: Sun, 24 May 2009 01:55:53 -0500


Dear Rooters,

I am creating a TH2D histogram and filling it using random numbers, uniformly distributed in range 0, 1
(100-bins).



for(int i=0; i!=100000; i++){
float x = rand()/(float)RAND_MAX;
float y = rand()/(float)RAND_MAX;
 h2->Fill(x,y);
  }

Well, now I expect that, number of entries enclosed in any "box" created on X-Y plane of this histogram should be proportional to the area of the box
(Please correct me if I am wrong). So in that spirit,
I did following:



float num1 = h2->Integral(10,20,10,20);
float num2 = h2->Integral(20,30,20,30);
cout<<"num1: "<<num1<<endl;
cout<<"num2: "<<num2<<endl;

I expected the numbers to be very similar if not exactly same. Here's what I get:

num1: 1152
num2: 1258

We see there is a discrepency of almost 100 counts.... Can this be explained out ? Or am I messing up somewhere ?

Anil Received on Sun May 24 2009 - 08:55:58 CEST

This archive was generated by hypermail 2.2.0 : Sun May 24 2009 - 23:50:01 CEST