/
testIntegration.C
68 lines (39 loc) · 1.03 KB
/
testIntegration.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
* testIntegration.C
* 2012IFF
*
* Created by Keith Landry on 5/28/14.
* UCLA
*
*/
void testIntegration(){
TFile* infile = new TFile("/Users/keithlandry/Desktop/testPtHist.root");
TH1D * h = infile->Get("Pt");
int bmin = 751;
int bmax = bmin+1;
double binval = 0;
int numberOfPairs = 0;
cout << "starting at bmin = " << bmin << " bmax = " << bmax << endl;
cout << (double)h->GetEntries()/9.0 << endl;
for (int i=0; i < h->GetNbinsX()-bmin; i++)
{
bmax++;
cout << " i = " << i << " bmax = " << bmax << endl;
int integ = h->Integral(bmin,bmax);
cout << bmax << " " << integ << endl;
binval += h->GetBinContent(bmax)*h->GetBinCenter(bmax);
numberOfPairs += h->GetBinContent(bmax);
if (integ > (double)h->GetEntries()/9.0)
{
cout << bmax << " " << integ << endl;
lastI = i;
break;
}
if (bmax == 1000)
{
break;
}
}
cout << "avg val of bin " << (double)binval/numberOfPairs << endl;
cout << " Pt = " << h->GetBinCenter(bmax) << endl;
}