ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/claudioc/OSNote2010/plotTrgEff/triggerSuperModel.cc
Revision: 1.2
Committed: Tue Nov 9 13:31:13 2010 UTC (14 years, 5 months ago) by claudioc
Content type: text/plain
Branch: MAIN
Changes since 1.1: +31 -5 lines
Log Message:
trg eff for eta(mu)>2.1

File Contents

# User Rev Content
1 claudioc 1.1 #include "Math/LorentzVector.h"
2     #include "Math/VectorUtil.h"
3     #include "TMath.h"
4    
5    
6     //----------------------------------------
7     // To be used on Monte Carlo events.
8     // Input is hypothesis index.
9     // Output is the 2010 trigger efficiency for the
10     // given hypothesis.
11     //
12     // Claudio, Jae, Avi 3 Nov 2010
13     //----------------------------------------
14     // float triggerSuperModelEffic(int hyp) {
15     float triggerSuperModelEffic(int hyp, float pt1, float eta1,
16     int id1, float pt2, float eta2, int id2) {
17    
18     //----------------------------------------------
19     // Some important inputs
20     //-----------------------------------------------
21     // Plateau efficiency of muon trigger
22     // (For now we ignore the fact that in the mu9 period
23     // it was not quite as good)
24 claudioc 1.2 float effmu = 0.93; // eta<2.1
25     float effmu24 = 0.50; // 2.4<eta<2.4
26 claudioc 1.1
27     // Fraction of luminosity where mu9 was not prescaled
28     // run <= 147116
29     float f9=0.215;
30    
31     // Fraction of luminosity where mu9 was prescaled and mu11
32     // was unprescaled
33     // 147196 <= run <= 148058
34 claudioc 1.2 float f11=0.273;
35 claudioc 1.1
36     // Fraction of luminosity where mu9 and mu11 were prescaled
37     // and mu15 was not
38     //float f15 = 1.0 - f9 - f11;
39    
40     // Fraction of luminosity with 100% efficient ele10 trigger
41     // run <= 139980
42     float e10=0.002;
43    
44     //Fraction of luminosity with 100% efficienct ele15 GeV trigger
45     // 139980<run<=144114
46     float e15=0.086;
47    
48     //Fraction of luminosity with 100% efficient ele17 trigger
49     // 14114<run<=147116
50     float e17=0.127;
51    
52     //Fraction of luminosity with somewhat inefficient (~93%) ele17 trigger
53     // 147116<run<=148058
54     float e17b=0.273;
55    
56     //Efficiency of 17 GeV trigger in 147116<run<=148058
57     float eff17b=0.93;
58    
59     //Fraction of luminosity with messy electron trigger
60     // run>148058
61     float emess=0.512;
62    
63     //Efficiency in pt bins for messy electron trigger period
64     // run>148058 (rounded to the nearest 1%)
65     float eff17to22 =0.99;
66     float eff22to27 =0.97;
67     float eff27to32 =0.98;
68     float eff32andUp=1.00;
69    
70     //-------------------------------------------------
71     // Algorithm applies only to events with one
72     // lepton above 20 and one letpon above 10.
73     // If this is not the case, return zero and complain.
74     //-------------------------------------------------
75     //bool badHyp = false;
76     //if( TMath::Max(cms2.hyp_ll_p4()[hyp].pt(),cms2.hyp_lt_p4()[hyp].pt()) < 20.)
77     //badHyp=true;
78     //if( TMath::Min(cms2.hyp_ll_p4()[hyp].pt(),cms2.hyp_lt_p4()[hyp].pt()) < 10.)
79     //badHyp=true;
80     //if (badHyp) {
81     //std::cout << "Bad inputs to trigger SuperModelEffic" << std::endl;
82     // return 0.0;
83     //}
84    
85     //-------------------------------------------------
86     // If it is a dielectron event, we return 100%
87     //-------------------------------------------------
88     //if (cms2.hyp_type()[hyp] == 3) return 1.0;
89     if (hyp == 3) return 1.0;
90    
91     //-------------------------------------------------
92     // Dimuon events.
93     //-------------------------------------------------
94     if (hyp == 0) {
95    
96     if (pt2>pt1) {
97     float pttemp = pt2;
98     float etatemp = eta2;
99     pt2 = pt1;
100     eta2 = eta1;
101     pt1 = pttemp;
102     eta1 = etatemp;
103     }
104    
105     // both above 15 and both in eta<2.1
106     if (pt2>=15 && eta1<=2.1 && eta2<=2.1) {
107     float eff = 1 - (1-effmu)*(1-effmu);
108     return eff;
109     }
110    
111     // the 2nd one between 11 and 15, both in eta<2.1
112     if (pt2>11 && pt2<15 && eta1<=2.1 && eta2<=2.1) {
113     float eff = effmu + (f9+f11)*effmu*(1-effmu);
114     return eff;
115     }
116    
117     // the 2nd one between 10 and 11, both in eta<2.1
118     if (pt2<11 && eta1<=2.1 && eta2<=2.1) {
119     float eff = effmu + f9*effmu*(1-effmu);
120     return eff;
121     }
122    
123     // both at high eta
124     if (eta1>2.1 && eta2>2.1) {
125 claudioc 1.2
126     float eff = effmu*effmu; // this neglects the trigger at high eta
127     if (pt2>=15) {
128     eff = eff + 2*(1.-effmu)*effmu24;
129     } else if (pt2>=11) {
130     eff = eff + (1.+f9+f11)*(1-effmu)*effmu24;
131     } else {
132     eff = eff + (1.+f9)*(1-effmu)*effmu24;
133     }
134 claudioc 1.1 return eff;
135     }
136    
137     // One with pt>15 eta<2.1. The other with eta>2.1
138     if ( (pt1>=15 && eta1<=2.1 && eta2>2.1) ||
139     (pt2>=15 && eta2<=2.1 && eta1>2.1) ) {
140 claudioc 1.2 float eff = effmu; // this neglects the trigger at high eta
141     if ( (pt1>=15 && eta1>2.1) || (pt2>=15 && eta2>2.1) ) {
142     eff = eff + (1-effmu)*effmu24;
143     } else if ( (pt1>=11 && eta1>2.1) || (pt2>=11 && eta2>2.1) ) {
144     eff = eff + (f9+f11)*(1-effmu)*effmu24;
145     } else {
146     eff = eff + f9*(1-effmu)*effmu24;
147     }
148 claudioc 1.1 return eff;
149     }
150    
151    
152     // First with 11<pt<15 eta<2.1. Second one with eta>2.1
153     if ( (pt1>=11 && pt1<15 && eta1<=2.1 && eta2>2.1) ||
154     (pt2>=11 && pt2<15 && eta2<=2.1 && eta1>2.1) ) {
155 claudioc 1.2 float eff = (f9+f11)*effmu + (1-f9-f11)*effmu*effmu;
156     eff = eff + (1-effmu)*effmu24; // allow trigger at high eta
157 claudioc 1.1 return eff;
158     }
159    
160     // First with 10<pt<11 eta<2.1. Second one with eta>2.1
161     if ( (pt1<11 && eta1<=2.1 && eta2>2.1) ||
162     (pt2<11 && eta2<=2.1 && eta1>2.1) ) {
163     float eff = f9*effmu + (1-f9)*effmu*effmu;
164 claudioc 1.2 eff = eff + (1-effmu)*effmu24; // allow trigger at high eta
165 claudioc 1.1 return eff;
166     }
167    
168     // We should never get here!
169     std::cout << "----------" <<std::endl;
170     std::cout << "Logic failure for mu-mu events in triggerSuperModel" << std::endl;
171     std::cout << "This should never happen -- do not ignore" << std::endl;
172     std::cout << "----------" << std::endl;
173     return 0.0;
174    
175     } // close mumu code block
176    
177     //-------------------------------------------------
178     // emu events
179     //-------------------------------------------------
180     if (hyp == 1 || hyp == 2) {
181    
182     float ptmu;
183     float ptele;
184     float etamu;
185    
186     if (id1 == 13) {
187     ptmu = pt1;
188     ptele = pt2;
189     etamu= eta1;
190     } else {
191     ptmu = pt2;
192     ptele = pt1;
193     etamu= eta2;
194     }
195    
196    
197     // muon in eta<2.1 and pt>15;
198     if (ptmu>= 15 && etamu<= 2.1) {
199     float delta;
200     if (ptele<=15.) {
201     delta=e10;
202     } else if (ptele<17) {
203     delta=e10+e15;
204     } else if (ptele>=17) {
205     delta = e10+e15+e17+e17b*eff17b;
206     } if (ptele<=22) {
207     delta = e10+e15+e17+e17b*eff17b+emess*eff17to22;
208     } else if (ptele<=27) {
209     delta = e10+e15+e17+e17b*eff17b+emess*eff22to27;
210     } else if (ptele<=32) {
211     delta = e10+e15+e17+e17b*eff17b+emess*eff27to32;
212     } else {
213     delta = e10+e15+e17+e17b*eff17b+emess*eff32andUp;
214     }
215     float eff = effmu + (1-effmu)*delta;
216     return eff;
217     }
218    
219     // muon in eta<2.1 and pt beween 11 and 15 or 10 and 11
220     // (note: here the electron has pt>20 for sure)
221     if (ptmu< 15 && etamu<= 2.1) {
222     float eleff;
223     float f=f9;
224     if (ptmu>=11) f=f11+f9;
225     if (ptele <= 22) eleff=eff17to22;
226     if (ptele <= 27) eleff=eff22to27;
227     if (ptele <= 32) eleff=eff27to32;
228     if (ptele > 32) eleff=eff32andUp;
229     float delta2 = (1-f)*(effmu + (1-effmu)*eleff);
230     float delta3 = f*(1-effmu)*( (e10+e15+e17)/f + eff17b*(f-e10-e15-e17)/f);
231     float eff = f*effmu + delta2 +delta3;
232     return eff;
233     }
234    
235     // muon in eta>2.1
236     if (etamu>2.1) {
237     float eff;
238     if (ptele<=15) {
239     eff = e10;
240     } else if (ptele<=17) {
241     eff = e10 + e15;
242     } else if (ptele <= 22) {
243     eff = e10 + e15 + e17 + e17b*eff17b + emess*eff17to22;
244     } else if (ptele <= 27) {
245     eff = e10 + e15 + e17 + e17b*eff17b + emess*eff22to27;
246     } else if (ptele <= 32) {
247     eff = e10 + e15 + e17 + e17b*eff17b + emess*eff27to32;
248     } else {
249     eff = e10 + e15 + e17 + e17b*eff17b + emess*eff32andUp;
250     }
251 claudioc 1.2 // now allow for the possibility of a muon trigger
252     if (ptmu>=15) {
253     eff = eff + (1-eff)*effmu24;
254     } else if (ptmu>=11) {
255     eff = eff + (f9+f11)*(1-eff)*effmu24;
256     } else {
257     eff = eff + f9*(1-eff)*effmu24;
258     }
259 claudioc 1.1 return eff;
260     }
261    
262     // We should never get here!
263     std::cout << "----------" <<std::endl;
264     std::cout << "Logic failure for e-mu events in triggerSuperModel" << std::endl;
265     std::cout << "This should never happen -- do not ignore" << std::endl;
266     std::cout << "----------" << std::endl;
267     return 0.0;
268    
269     } // Close emu code block
270    
271     // We should never get here!
272     std::cout << "----------" <<std::endl;
273     std::cout << "Logic failure in triggerSuperModel" << std::endl;
274     std::cout << "This should never happen -- do not ignore" << std::endl;
275     std::cout << "----------" << std::endl;
276     return 0.0;
277    
278     }