157 |
|
|
158 |
|
|
159 |
|
//________________________________________________________________________________________ |
160 |
+ |
// Master Formula |
161 |
+ |
void master_formula(std::vector<float> eff, float &errHi, float &errLo) { |
162 |
+ |
|
163 |
+ |
float x0 = eff[0]; |
164 |
+ |
float deltaPos = 0, deltaNeg = 0; |
165 |
+ |
for(int k = 0; k < (eff.size()-1)/2; k++) { |
166 |
+ |
float xneg = eff[2*k+2]; |
167 |
+ |
float xpos = eff[2*k+1]; |
168 |
+ |
if(xpos-x0>0 || xneg-x0>0) { |
169 |
+ |
if(xpos-x0 > xneg-x0) { |
170 |
+ |
deltaPos += (xpos-x0)*(xpos-x0); |
171 |
+ |
} else { |
172 |
+ |
deltaPos += (xneg-x0)*(xneg-x0); |
173 |
+ |
} |
174 |
+ |
} |
175 |
+ |
if(x0-xpos>0 || x0-xneg>0) { |
176 |
+ |
if(x0-xpos > x0-xneg) { |
177 |
+ |
deltaNeg += (xpos-x0)*(xpos-x0); |
178 |
+ |
} else { |
179 |
+ |
deltaNeg += (xneg-x0)*(xneg-x0); |
180 |
+ |
} |
181 |
+ |
} |
182 |
+ |
} |
183 |
+ |
errHi = sqrt(deltaPos); |
184 |
+ |
errLo = sqrt(deltaNeg); |
185 |
+ |
|
186 |
+ |
} |
187 |
+ |
|
188 |
+ |
|
189 |
+ |
//________________________________________________________________________________________ |
190 |
+ |
// Get normalization factor for the PDFs |
191 |
+ |
float get_norm_pdf_factor(TTree *events, int k) { |
192 |
+ |
|
193 |
+ |
TH1F *haux = new TH1F("haux", "", 1000, 0, 15); |
194 |
+ |
char nameVar[20]; |
195 |
+ |
sprintf(nameVar, "pdfW[%d]", k); |
196 |
+ |
events->Project("haux", nameVar); |
197 |
+ |
float factor = haux->Integral(); |
198 |
+ |
|
199 |
+ |
delete haux; |
200 |
+ |
|
201 |
+ |
return factor; |
202 |
+ |
|
203 |
+ |
} |
204 |
+ |
|
205 |
+ |
|
206 |
+ |
|
207 |
+ |
//________________________________________________________________________________________ |
208 |
|
// Pile-up efficiency |
209 |
< |
float pileup(TTree *events, bool requireZ, string informalname, Float_t myJzbMax = 140. ) { |
209 |
> |
float pileup(TTree *events, bool requireZ, string informalname, string addcut="",Float_t myJzbMax = 140. ) { |
210 |
|
nBins = 16; |
211 |
|
jzbMax = myJzbMax; |
212 |
|
|
213 |
|
// Acceptance cuts |
214 |
|
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
215 |
+ |
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
216 |
+ |
|
217 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
218 |
|
TH1F* hLM4 = plotEff(events,kbase,informalname); |
219 |
|
hLM4->SetMinimum(0.); |
230 |
|
if(!automatized) dout << " PU: " << funcUp->Eval(jzbSel) << " " << func->Eval(jzbSel) |
231 |
|
<< "(" << (funcUp->Eval(jzbSel)-func->Eval(jzbSel))/func->Eval(jzbSel)*100. << "%)" << std::endl; |
232 |
|
|
233 |
< |
return (funcUp->Eval(jzbSel)-func->Eval(jzbSel))/func->Eval(jzbSel)*100.; |
233 |
> |
return (funcUp->Eval(jzbSel)-func->Eval(jzbSel))/func->Eval(jzbSel); |
234 |
|
|
235 |
|
} |
236 |
|
|
237 |
|
//____________________________________________________________________________________ |
238 |
|
// Effect of peak shifting |
239 |
< |
void PeakError(TTree *events,float &result, string mcjzb, float peakerr) { |
239 |
> |
void PeakError(TTree *events,float &result, string mcjzb, float peakerr,string addcut="") { |
240 |
|
TString peakup("("+TString(mcjzb)+"+"+TString(any2string(TMath::Abs(peakerr)))+")"+geq_or_leq()+TString(any2string(jzbSel))); |
241 |
|
TString peakdown("("+TString(mcjzb)+"-"+TString(any2string(TMath::Abs(peakerr)))+")"+geq_or_leq()+TString(any2string(jzbSel))); |
242 |
|
TString peakcentral("("+TString(mcjzb)+")"+geq_or_leq()+TString(any2string(jzbSel))); |
259 |
|
poscut=peakup; |
260 |
|
negcut=npeakup; |
261 |
|
} |
262 |
< |
float res=allcontributionsplot(events,cutnJets,cutmass,sidebandcut,poscut.c_str(),negcut.c_str()); |
262 |
> |
float res; |
263 |
> |
if(addcut=="") res=allcontributionsplot(events,cutnJets,cutmass,sidebandcut,poscut.c_str(),negcut.c_str()); |
264 |
> |
else res=allcontributionsplot(events,cutnJets&&addcut.c_str(),cutmass,sidebandcut,poscut.c_str(),negcut.c_str()); |
265 |
|
if(i==0) rescent=res; |
266 |
|
else if(i==1) resdown=res; |
267 |
|
else if(i==2) resup=res; |
268 |
|
} |
269 |
< |
if(TMath::Abs(rescent-resup)>TMath::Abs(rescent-resdown)) result=(TMath::Abs(rescent-resup)/rescent)*100; |
270 |
< |
else result=(TMath::Abs(rescent-resdown)/rescent)*100; |
269 |
> |
if(TMath::Abs(rescent-resup)>TMath::Abs(rescent-resdown)) result=(TMath::Abs(rescent-resup)/rescent); |
270 |
> |
else result=(TMath::Abs(rescent-resdown)/rescent); |
271 |
|
} |
272 |
|
|
273 |
|
//____________________________________________________________________________________ |
274 |
|
// Total selection efficiency (MC) |
275 |
< |
void MCefficiency(TTree *events,float &result, float &resulterr,string mcjzb,bool requireZ,string addcut="") { |
275 |
> |
void MCefficiency(TTree *events,float &result, float &resulterr,string mcjzb,bool requireZ,int Neventsinfile, string addcut="", int k = 0) { |
276 |
|
|
277 |
|
char jzbSelStr[256]; sprintf(jzbSelStr,"%f",jzbSel); |
278 |
|
// All acceptance cuts at gen. level |
279 |
< |
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&genJZB"+geq_or_leq()+TString(jzbSelStr)+"&&genId1==-genId2"); |
279 |
> |
//TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&genJZB"+geq_or_leq()+TString(jzbSelStr)+"&&genId1==-genId2"); |
280 |
> |
TCut kbase(""); |
281 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
282 |
|
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
283 |
|
// Corresponding reco. cuts |
284 |
< |
TCut ksel("abs(mll-91.2)<20&&id1==id2&&"+TString(mcjzb)+geq_or_leq()+TString(jzbSelStr)); |
285 |
< |
|
286 |
< |
events->Draw(mcjzbexpression.c_str(),kbase&&ksel,"goff"); |
284 |
> |
TCut ksel("pfJetGoodNum>2&&abs(mll-91.2)<20&&id1==id2&&"+TString(mcjzb)+geq_or_leq()+TString(jzbSelStr)); |
285 |
> |
TCut ksel2("pfJetGoodNum>2&&abs(mll-91.2)<20&&id1==id2&&"+TString(mcjzb)+ngeq_or_leq()+TString("-")+TString(jzbSelStr)); |
286 |
> |
TCut posSide = kbase&&ksel; |
287 |
> |
TCut negSide = kbase&&ksel2; |
288 |
> |
string sposSide(posSide); |
289 |
> |
string snegSide(negSide); |
290 |
> |
char var[20]; |
291 |
> |
sprintf(var, "pdfW[%d]", k); |
292 |
> |
string svar(var); |
293 |
> |
string newPosSide = "(" + sposSide + ")*" + svar; |
294 |
> |
string newNegSide = "(" + snegSide + ")*" + svar; |
295 |
> |
|
296 |
> |
events->Draw(mcjzbexpression.c_str(), newPosSide.c_str(),"goff"); |
297 |
|
Float_t sel = events->GetSelectedRows(); |
298 |
< |
events->Draw(mcjzbexpression.c_str(),kbase,"goff"); |
299 |
< |
Float_t tot = events->GetSelectedRows(); |
300 |
< |
|
301 |
< |
result=sel/tot; |
302 |
< |
resulterr=TMath::Sqrt(sel/tot*(1-sel/tot)/tot); |
303 |
< |
if(!automatized) dout << " MC efficiency: " << result << "+-" << resulterr << std::endl; |
298 |
> |
Float_t nsel=0; |
299 |
> |
if(ConsiderSignalContaminationForLimits) { |
300 |
> |
events->Draw(mcjzbexpression.c_str(), newNegSide.c_str(),"goff"); |
301 |
> |
nsel = events->GetSelectedRows(); |
302 |
> |
} |
303 |
> |
//Corrections due to normalization in the PDF. This has to be applied as well to the number of events in a file if the definition changes at some point. |
304 |
> |
float normFactor = get_norm_pdf_factor(events, k); |
305 |
> |
sel = sel/normFactor; |
306 |
> |
nsel = nsel/normFactor; |
307 |
> |
|
308 |
> |
// events->Draw(mcjzbexpression.c_str(),kbase,"goff"); |
309 |
> |
// Float_t tot = events->GetSelectedRows(); |
310 |
> |
Float_t tot = Neventsinfile; |
311 |
> |
|
312 |
> |
if(ConsiderSignalContaminationForLimits) { |
313 |
> |
result=(sel-nsel)/tot; |
314 |
> |
resulterr=(1.0/tot)*TMath::Sqrt(sel+nsel+(sel-nsel)*(sel-nsel)/tot); |
315 |
> |
} else {//no signal contamination considered: |
316 |
> |
result=(sel)/tot; |
317 |
> |
resulterr=TMath::Sqrt(sel/tot*(1+sel/tot)/tot); |
318 |
> |
} |
319 |
> |
if(!automatized) dout << " MC efficiency: " << result << "+-" << resulterr << " ( JZB>" << jzbSel << " : " << sel << " , JZB<-" << jzbSel << " : " << nsel << " and nevents=" << tot << ")" << std::endl; |
320 |
|
} |
321 |
|
|
322 |
< |
void JZBefficiency(TTree *events, string informalname, float &jzbeff, float &jzbefferr, bool requireZ) { |
322 |
> |
void JZBefficiency(TTree *events, string informalname, float &jzbeff, float &jzbefferr, bool requireZ, string addcut="") { |
323 |
|
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
324 |
+ |
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
325 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
326 |
|
TH1F* hLM4 = plotEff(events,kbase,informalname); |
327 |
|
Int_t bin = hLM4->FindBin(jzbSel); // To get the error |
333 |
|
|
334 |
|
//________________________________________________________________________ |
335 |
|
// Effect of energy scale on efficiency |
336 |
< |
void JZBjetScale(TTree *events, float &jesdown, float &jesup, string informalname,bool requireZ,float syst=0.1, Float_t jzbSelection=-1, TString plotName = "" ) { |
336 |
> |
void JZBjetScale(TTree *events, float &jesdown, float &jesup, string informalname,bool requireZ,string addcut="",float syst=0.1, Float_t jzbSelection=-1, TString plotName = "" ) { |
337 |
|
TCut kbase("abs(genMll-91.2)<20&&genZPt>0"); |
338 |
+ |
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
339 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
340 |
|
|
341 |
|
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
364 |
|
if(!automatized) dout << " JESup: " << effp << " (" << (effp-eff)/eff*100. << "%)" << std::endl; |
365 |
|
if(!automatized) dout << " central: " << eff << std::endl; |
366 |
|
if(!automatized) dout << " JESdown: " << effm << " (" << (effm-eff)/eff*100. << "%)" << std::endl; |
367 |
< |
jesup=(effp-eff)/eff*100.; |
368 |
< |
jesdown=(effm-eff)/eff*100.; |
367 |
> |
jesup=(effp-eff)/eff; |
368 |
> |
jesdown=(effm-eff)/eff; |
369 |
|
} |
370 |
|
|
371 |
|
//________________________________________________________________________ |
372 |
|
// Effect of energy scale on JZB efficiency |
373 |
< |
void doJZBscale(TTree *events, float &down, float &up, float &syst, float systematic, string informalname, bool requireZ) { |
373 |
> |
void doJZBscale(TTree *events, float &down, float &up, float &syst, float systematic, string informalname, bool requireZ, string addcut) { |
374 |
|
|
375 |
|
TCut kbase("abs(genMll-91.2)<20&&genZPt>0&&genNjets>2"); |
376 |
+ |
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
377 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
378 |
|
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
379 |
|
|
390 |
|
if(!automatized) dout << " efficiency at JZB==" << jzbSel*(1.+systematic) << "(-"<<syst*100<<"%) : " << effp << " (" << ((effp-eff)/eff)*100. << "%)" << std::endl; |
391 |
|
if(!automatized) dout << " efficiency at JZB==" << jzbSel << ": " << eff << std::endl; |
392 |
|
if(!automatized) dout << " efficiency at JZB==" << jzbSel*(1.-systematic) << "(-"<<syst*100<<"%) : " << effm << " (" << ((effm-eff)/eff)*100. << "%)" << std::endl; |
393 |
< |
up=((effp-eff)/eff)*100; |
394 |
< |
down=((effm-eff)/eff)*100; |
393 |
> |
up=((effp-eff)/eff); |
394 |
> |
down=((effm-eff)/eff); |
395 |
|
} |
396 |
|
|
397 |
|
//________________________________________________________________________ |
398 |
|
// JZB response (true/reco. vs. true) |
399 |
< |
void JZBresponse(TTree *events, bool requireZ, float &resp, float &resperr, bool isMET = kFALSE, Float_t myJzbMax = 200., Int_t nPeriods = 9 ) { |
399 |
> |
void JZBresponse(TTree *events, bool requireZ, float &resp, float &resperr, string addcut="",bool isMET = kFALSE, Float_t myJzbMax = 200., Int_t nPeriods = 9 ) { |
400 |
|
|
401 |
|
jzbMin = 20; |
402 |
|
TCut kbase("abs(genMll-91.2)<20&&genZPt>0&&genNjets>2"); |
403 |
+ |
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
404 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
405 |
|
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
406 |
|
|
420 |
|
} |
421 |
|
|
422 |
|
|
423 |
< |
void do_systematics_for_one_file(TTree *events,string informalname, vector<vector<float> > &results,string mcjzb,string datajzb,float peakerror,bool requireZ=false) { |
423 |
> |
//________________________________________________________________________________________ |
424 |
> |
// PDF uncertainty |
425 |
> |
float get_pdf_uncertainty(TTree *events, string mcjzb, bool requireZ, int Neventsinfile, string addcut="") { |
426 |
> |
|
427 |
> |
int numberOfPDFs = 44; |
428 |
> |
std::vector<float> efficiency; |
429 |
> |
for(int k = 1; k < numberOfPDFs; k++) { |
430 |
> |
float result, resulterr; |
431 |
> |
MCefficiency(events, result, resulterr, mcjzb, requireZ, Neventsinfile, addcut, k); |
432 |
> |
efficiency.push_back(result); |
433 |
> |
} |
434 |
> |
float errHi, errLow; |
435 |
> |
master_formula(efficiency, errHi, errLow); |
436 |
> |
if(errHi>errLow) return errHi; |
437 |
> |
return errLow; |
438 |
> |
|
439 |
> |
} |
440 |
> |
|
441 |
> |
|
442 |
> |
|
443 |
> |
void do_systematics_for_one_file(TTree *events,int Neventsinfile,string informalname, vector<vector<float> > &results,string mcjzb,string datajzb,float peakerror,bool requireZ=false, string addcut="", bool ismSUGRA=false) { |
444 |
|
|
445 |
|
float JetEnergyScaleUncert=0.1; |
446 |
|
float JZBScaleUncert=0.1; |
447 |
|
mcjzbexpression=mcjzb; |
448 |
< |
|
346 |
< |
float triggereff=4;//percent! |
448 |
> |
float triggereff=4.0/100;// in range [0,1] |
449 |
|
dout << "Trigger efficiency not implemented in this script yet, still using external one" << endl; |
450 |
< |
float leptonseleff=2;//percent! |
450 |
> |
float leptonseleff=2.0/100;// in range [0,1] |
451 |
|
dout << "Lepton selection efficiency not implemented in this script yet, still using external one" << endl; |
452 |
|
|
453 |
|
float mceff,mcefferr,jzbeff,jzbefferr; |
454 |
|
if(!automatized) dout << "MC efficiencies:" << endl; |
455 |
< |
MCefficiency(events,mceff,mcefferr,mcjzb,requireZ); |
456 |
< |
JZBefficiency(events,informalname,jzbeff,jzbefferr,requireZ); |
455 |
> |
MCefficiency(events,mceff,mcefferr,mcjzb,requireZ,Neventsinfile,addcut); |
456 |
> |
JZBefficiency(events,informalname,jzbeff,jzbefferr,requireZ,addcut); |
457 |
|
if(!automatized) dout << "JZB efficiency: " << jzbeff << "+/-" << jzbefferr << endl; |
458 |
|
|
459 |
|
if(!automatized) dout << "Error from Peak position:" << endl; |
460 |
|
float sysfrompeak=0; |
461 |
< |
PeakError(events,sysfrompeak,mcjzb,peakerror); |
461 |
> |
PeakError(events,sysfrompeak,mcjzb,peakerror,addcut); |
462 |
|
|
463 |
|
if(!automatized) dout << "Jet energy scale: " << std::endl; |
464 |
|
float jesup,jesdown; |
465 |
< |
JZBjetScale(events,jesdown,jesup,informalname,JetEnergyScaleUncert,requireZ); |
465 |
> |
JZBjetScale(events,jesdown,jesup,informalname,requireZ,addcut,JetEnergyScaleUncert); |
466 |
|
|
467 |
|
if(!automatized) dout << "JZB scale: " << std::endl; |
468 |
|
float scaleup,scaledown,scalesyst; |
469 |
< |
doJZBscale(events,scaledown,scaleup,scalesyst,JZBScaleUncert,informalname,requireZ); |
469 |
> |
doJZBscale(events,scaledown,scaleup,scalesyst,JZBScaleUncert,informalname,requireZ,addcut); |
470 |
|
|
471 |
|
if(!automatized) dout << "JZB response: " << std::endl; |
472 |
|
float resp,resperr; |
473 |
< |
JZBresponse(events,requireZ,resp,resperr); |
473 |
> |
JZBresponse(events,requireZ,resp,resperr,addcut); |
474 |
|
|
475 |
|
if(!automatized) dout << "Pileup: " << std::endl; |
476 |
< |
float resolution=pileup(events,requireZ,informalname); |
477 |
< |
|
476 |
> |
float resolution=pileup(events,requireZ,informalname,addcut); |
477 |
> |
|
478 |
> |
float PDFuncert=0; |
479 |
> |
if(ismSUGRA) PDFuncert = get_pdf_uncertainty(events, mcjzb, requireZ, Neventsinfile, addcut); |
480 |
> |
|
481 |
|
dout << "_______________________________________________" << endl; |
482 |
< |
dout << " SUMMARY FOR " << informalname << " with JZB>" << jzbSel << " (all in %) " << endl; |
483 |
< |
dout << "MC efficiency: " << 100*mceff << "+/-" << 100*mcefferr << endl; |
484 |
< |
dout << "Trigger efficiency: " << triggereff << endl; |
485 |
< |
dout << "Lepton Sel Eff: " << leptonseleff << endl; |
486 |
< |
dout << "Jet energy scale: " << jesup << " " << jesdown << endl; |
487 |
< |
dout << "JZB Scale Uncert: " << scaledown << " " << scaleup << endl; |
488 |
< |
dout << "Resolution : " << resolution << endl; |
489 |
< |
dout << "From peak : " << sysfrompeak << endl; |
490 |
< |
dout << "JZB efficiency: " << jzbeff << "+/-" << jzbefferr << " (not yet included below) " << endl; |
491 |
< |
dout << "JZB response : " << resp << " +/-" << resperr << " (not yet included below) " << endl; |
482 |
> |
dout << " SUMMARY FOR " << informalname << " with JZB>" << jzbSel << " (all in %) "; |
483 |
> |
if(addcut!="") dout << "With additional cut: " << addcut; |
484 |
> |
dout << endl; |
485 |
> |
dout << "MC efficiency: " << mceff << "+/-" << mcefferr << endl; // in range [0,1] |
486 |
> |
dout << "Trigger efficiency: " << triggereff << endl; // in range [0,1] |
487 |
> |
dout << "Lepton Sel Eff: " << leptonseleff << endl; // in range [0,1] |
488 |
> |
dout << "Jet energy scale: " << jesup << " " << jesdown << endl; // in range [0,1] |
489 |
> |
dout << "JZB Scale Uncert: " << scaledown << " " << scaleup << endl; // in range [0,1] |
490 |
> |
dout << "Resolution : " << resolution << endl; // in range [0,1] |
491 |
> |
dout << "From peak : " << sysfrompeak << endl; // in range [0,1] |
492 |
> |
dout << "PDF uncertainty : " << PDFuncert << " (not yet included below) " << endl; // in range [0,1] |
493 |
> |
dout << "JZB efficiency: " << jzbeff << "+/-" << jzbefferr << " (not yet included below) " << endl; // in range [0,1] |
494 |
> |
dout << "JZB response : " << resp << " +/-" << resperr << " (not yet included below) " << endl; // in range [0,1] |
495 |
|
|
496 |
|
float toterr=0; |
497 |
< |
toterr+=(triggereff/100)*(triggereff/100); |
498 |
< |
toterr+=(leptonseleff/100)*(leptonseleff/100); |
499 |
< |
if(fabs(jesup)>fabs(jesdown)) toterr+=(jesup/100)*(jesup/100); else toterr+=(jesdown/100)*(jesdown/100); |
500 |
< |
if(fabs(scaleup)>fabs(scaledown)) toterr+=(scaleup/100)*(scaleup/100); else toterr+=(scaledown/100)*(scaledown/100); |
501 |
< |
toterr+=(resolution/100)*(resolution/100); |
502 |
< |
toterr+=(sysfrompeak/100)*(sysfrompeak/100); |
503 |
< |
toterr=TMath::Sqrt(toterr); |
504 |
< |
dout << "FINAL RESULT : " << 100*mceff << " +/- "<< 100*mcefferr << " (stat) +/- " << 100*toterr << " (syst) %" << endl; |
505 |
< |
dout << " we thus use the sqrt of the sum of the squares which is : " << 100*TMath::Sqrt(mcefferr*mcefferr+(toterr*toterr)) << endl; |
497 |
> |
toterr+=(triggereff)*(triggereff); |
498 |
> |
toterr+=(leptonseleff)*(leptonseleff); |
499 |
> |
if(fabs(jesup)>fabs(jesdown)) toterr+=(jesup*jesup); else toterr+=(jesdown*jesdown); |
500 |
> |
if(fabs(scaleup)>fabs(scaledown)) toterr+=(scaleup*scaleup); else toterr+=(scaledown*scaledown); |
501 |
> |
toterr+=(resolution*resolution); |
502 |
> |
toterr+=(sysfrompeak*sysfrompeak); |
503 |
> |
if(ismSUGRA) toterr+=(PDFuncert*PDFuncert); |
504 |
> |
dout << "TOTAL SYSTEMATICS: " << TMath::Sqrt(toterr) << " --> " << TMath::Sqrt(toterr)*mceff << endl; |
505 |
> |
float systerr=TMath::Sqrt(toterr)*mceff; |
506 |
> |
toterr=TMath::Sqrt(toterr*mceff*mceff+mcefferr*mcefferr);//also includes stat err! |
507 |
> |
|
508 |
> |
dout << "FINAL RESULT : " << 100*mceff << " +/- "<< 100*mcefferr << " (stat) +/- " << 100*systerr << " (syst) %" << endl; |
509 |
> |
dout << " we thus use the sqrt of the sum of the squares of the stat & syst err, which is : " << 100*toterr << endl; |
510 |
> |
|
511 |
> |
//Do not modify the lines below or mess with the order; this order is expected by all limit calculating functions! |
512 |
|
vector<float> res; |
513 |
|
res.push_back(jzbSel); |
514 |
|
res.push_back(mceff); |
515 |
|
res.push_back(mcefferr); |
516 |
|
res.push_back(toterr); |
517 |
|
res.push_back(TMath::Sqrt((mcefferr)*(mcefferr)+(toterr*toterr))); |
518 |
< |
|
518 |
> |
if(fabs(jesup)>fabs(jesdown)) res.push_back(fabs(jesup)); else res.push_back(fabs(jesdown)); |
519 |
> |
if(fabs(scaleup)>fabs(scaledown)) res.push_back(fabs(scaleup)); else res.push_back(fabs(scaledown)); |
520 |
> |
res.push_back(fabs(resolution)); |
521 |
> |
if(ismSUGRA) res.push_back(PDFuncert); |
522 |
|
results.push_back(res); |
523 |
|
} |
524 |
|
|
530 |
|
for(int ibin=0;ibin<bins.size();ibin++) { |
531 |
|
jzbSel=bins[ibin]; |
532 |
|
geqleq="geq"; |
533 |
< |
do_systematics_for_one_file((signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,systematics,mcjzb,datajzb,mcpeakerror,requireZ); |
533 |
> |
do_systematics_for_one_file((signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].Nentries,(signalsamples.collection)[isignal].samplename,systematics,mcjzb,datajzb,mcpeakerror,requireZ); |
534 |
|
}//end of bin loop |
535 |
|
}//end of signal loop |
536 |
|
return systematics; |