1 |
fgolf |
1.1 |
//-------------------------------------------------------------------
|
2 |
|
|
// Returns the sign flip rate from the electron gun
|
3 |
|
|
// Note that the electron gun only goes up to 100 GeV
|
4 |
|
|
// For electron pt>100 returns the flip rate in the 90-100 Gev bin
|
5 |
|
|
// For electron pt<10 returns zero
|
6 |
|
|
// For electron abs(eta)>2.4 returns zero & prints out an error
|
7 |
|
|
//
|
8 |
|
|
// Usage:
|
9 |
|
|
// double flipRate = getSingleEleFlipRate(el_pt, el_eta)
|
10 |
|
|
// double fliRateErr = getSingleEleFlipRateError(el_pt, el_eta)
|
11 |
|
|
//
|
12 |
|
|
// Claudio & Derek 23 July 2009
|
13 |
|
|
//-------------------------------------------------------------
|
14 |
|
|
#include "fliprate_egun.h"
|
15 |
|
|
#include <iostream>
|
16 |
|
|
#include <stdio.h>
|
17 |
|
|
#include <math.h>
|
18 |
|
|
|
19 |
|
|
using namespace std;
|
20 |
|
|
|
21 |
|
|
double getSingleEleNum(double el_pt, double el_eta) {
|
22 |
|
|
|
23 |
|
|
el_eta = fabs(el_eta);
|
24 |
|
|
|
25 |
|
|
if( el_eta < 1.28 ){
|
26 |
|
|
if( el_pt > 70 ) return 31;
|
27 |
|
|
if( el_pt > 50 ) return 20;
|
28 |
|
|
if( el_pt > 40 ) return 5;
|
29 |
|
|
if( el_pt > 30 ) return 9;
|
30 |
|
|
if( el_pt > 10 ) return 4;
|
31 |
|
|
return 0.0;
|
32 |
|
|
}
|
33 |
|
|
if( el_eta < 1.56 ){
|
34 |
|
|
if( el_pt > 70 ) return 48;
|
35 |
|
|
if( el_pt > 50 ) return 30;
|
36 |
|
|
if( el_pt > 40 ) return 12;
|
37 |
|
|
if( el_pt > 30 ) return 8;
|
38 |
|
|
if( el_pt > 10 ) return 5;
|
39 |
|
|
return 0.0;
|
40 |
|
|
}
|
41 |
|
|
if( el_eta < 1.84 ){
|
42 |
|
|
if( el_pt > 70 ) return 92;
|
43 |
|
|
if( el_pt > 50 ) return 67;
|
44 |
|
|
if( el_pt > 40 ) return 35;
|
45 |
|
|
if( el_pt > 30 ) return 20;
|
46 |
|
|
if( el_pt > 10 ) return 13;
|
47 |
|
|
return 0.0;
|
48 |
|
|
}
|
49 |
|
|
if( el_eta < 2.12 ){
|
50 |
|
|
if( el_pt > 70 ) return 72;
|
51 |
|
|
if( el_pt > 50 ) return 29;
|
52 |
|
|
if( el_pt > 40 ) return 16;
|
53 |
|
|
if( el_pt > 30 ) return 13;
|
54 |
|
|
if( el_pt > 10 ) return 6;
|
55 |
|
|
return 0.0;
|
56 |
|
|
}
|
57 |
|
|
if( el_eta < = 2.5 ){
|
58 |
|
|
if( el_pt > 70 ) return 93;
|
59 |
|
|
if( el_pt > 50 ) return 42;
|
60 |
|
|
if( el_pt > 40 ) return 17;
|
61 |
|
|
if( el_pt > 30 ) return 9;
|
62 |
|
|
if( el_pt > 10 ) return 20;
|
63 |
|
|
return 0.0;
|
64 |
|
|
}
|
65 |
|
|
std::cout << "Error: eta > 2.5 value found" << endl;
|
66 |
|
|
return 0.0;
|
67 |
|
|
}
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
double getSingleEleDenom(double el_pt, double el_eta) {
|
71 |
|
|
|
72 |
|
|
el_eta = fabs(el_eta);
|
73 |
|
|
|
74 |
|
|
if( el_eta < 1.28 ){
|
75 |
|
|
if( el_pt > 70 ) return 117286;
|
76 |
|
|
if( el_pt > 50 ) return 78397;
|
77 |
|
|
if( el_pt > 40 ) return 39090;
|
78 |
|
|
if( el_pt > 30 ) return 38858;
|
79 |
|
|
if( el_pt > 10 ) return 69323;
|
80 |
|
|
return 0.0;
|
81 |
|
|
}
|
82 |
|
|
if( el_eta < 1.56 ){
|
83 |
|
|
if( el_pt > 70 ) return 18452;
|
84 |
|
|
if( el_pt > 50 ) return 12276;
|
85 |
|
|
if( el_pt > 40 ) return 6087;
|
86 |
|
|
if( el_pt > 30 ) return 5793;
|
87 |
|
|
if( el_pt > 10 ) return 9374;
|
88 |
|
|
return 0.0;
|
89 |
|
|
}
|
90 |
|
|
if( el_eta < 1.84 ){
|
91 |
|
|
if( el_pt > 70 ) return 20720;
|
92 |
|
|
if( el_pt > 50 ) return 14174;
|
93 |
|
|
if( el_pt > 40 ) return 7021;
|
94 |
|
|
if( el_pt > 30 ) return 6852;
|
95 |
|
|
if( el_pt > 10 ) return 10145;
|
96 |
|
|
return 0.0;
|
97 |
|
|
}
|
98 |
|
|
if( el_eta < 2.12 ){
|
99 |
|
|
if( el_pt > 70 ) return 21436;
|
100 |
|
|
if( el_pt > 50 ) return 14537;
|
101 |
|
|
if( el_pt > 40 ) return 7401;
|
102 |
|
|
if( el_pt > 30 ) return 7241;
|
103 |
|
|
if( el_pt > 10 ) return 12178;
|
104 |
|
|
return 0.0;
|
105 |
|
|
}
|
106 |
|
|
if( el_eta < = 2.5 ){
|
107 |
|
|
if( el_pt > 70 ) return 25029;
|
108 |
|
|
if( el_pt > 50 ) return 16802;
|
109 |
|
|
if( el_pt > 40 ) return 8462;
|
110 |
|
|
if( el_pt > 30 ) return 8277;
|
111 |
|
|
if( el_pt > 10 ) return 15646;
|
112 |
|
|
return 0.0;
|
113 |
|
|
}
|
114 |
|
|
std::cout << "Error: eta > 2.5 value found" << endl;
|
115 |
|
|
return 0.0;
|
116 |
|
|
}
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
double getSingleEleFlipRate(double el_pt, double el_eta) {
|
120 |
|
|
if( el_pt < 10.0 || fabs(el_eta) > 2.5 ){
|
121 |
|
|
std::cout << "Error in 'getSingleEleFlipRate': pt or eta value found out of range" << endl;
|
122 |
|
|
return 0.0;
|
123 |
|
|
}
|
124 |
|
|
return getSingleEleNum(el_pt, fabs(el_eta))/getSingleEleDenom(el_pt, fabs(el_eta));
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
double getSingleEleFlipRateError(double el_pt, double el_eta) {
|
128 |
|
|
//the binomial error
|
129 |
|
|
if( el_pt < 10.0 || fabs(el_eta) > 2.5 ){
|
130 |
|
|
std::cout << "Error in 'getSingleEleFlipRate': pt or eta value found out of range" << endl;
|
131 |
|
|
return 0.0;
|
132 |
|
|
}
|
133 |
|
|
double num = getSingleEleNum(el_pt, fabs(el_eta));
|
134 |
|
|
double denom = getSingleEleDenom(el_pt, fabs(el_eta));
|
135 |
|
|
double p = num/denom;
|
136 |
|
|
return sqrt(p*(1-p)/denom);
|
137 |
|
|
}
|