102 |
|
hname=GetNumericHistoName(); |
103 |
|
TH1F* hosofn = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
104 |
|
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kMassCut&&JZBNegCut&&cutOSOF,"goff"); |
105 |
– |
|
106 |
– |
hname=GetNumericHistoName(); |
107 |
– |
TH1F* sbhossfp = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
108 |
– |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBPosCut&&cutOSSF,"goff"); |
109 |
– |
hname=GetNumericHistoName(); |
110 |
– |
TH1F* sbhossfn = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
111 |
– |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBNegCut&&cutOSSF,"goff"); |
112 |
– |
|
113 |
– |
hname=GetNumericHistoName(); |
114 |
– |
TH1F* sbhosofp = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
115 |
– |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBPosCut&&cutOSOF,"goff"); |
116 |
– |
hname=GetNumericHistoName(); |
117 |
– |
TH1F* sbhosofn = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
118 |
– |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBNegCut&&cutOSOF,"goff"); |
105 |
|
|
106 |
< |
float obs = hossfp->Integral(); |
107 |
< |
float pred= hossfn->Integral() + (1.0/3)*( hosofp->Integral() - hosofn->Integral() + sbhossfp->Integral() - sbhossfn->Integral() + sbhosofp->Integral() - sbhosofn->Integral()); |
106 |
> |
float obs=0; |
107 |
> |
float pred=0; |
108 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
109 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
110 |
> |
hname=GetNumericHistoName(); |
111 |
> |
TH1F* sbhossfp = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
112 |
> |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBPosCut&&cutOSSF,"goff"); |
113 |
> |
hname=GetNumericHistoName(); |
114 |
> |
TH1F* sbhossfn = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
115 |
> |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBNegCut&&cutOSSF,"goff"); |
116 |
> |
|
117 |
> |
hname=GetNumericHistoName(); |
118 |
> |
TH1F* sbhosofp = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
119 |
> |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBPosCut&&cutOSOF,"goff"); |
120 |
> |
hname=GetNumericHistoName(); |
121 |
> |
TH1F* sbhosofn = new TH1F(hname.c_str(),hname.c_str(),1,-14000,14000); |
122 |
> |
events->Draw(TString(mcjzbexpression)+">>"+TString(hname),kBaseCut&&kSidebandCut&&JZBNegCut&&cutOSOF,"goff"); |
123 |
> |
|
124 |
> |
obs = hossfp->Integral(); |
125 |
> |
pred= hossfn->Integral() + (1.0/3)*( hosofp->Integral() - hosofn->Integral() + sbhossfp->Integral() - sbhossfn->Integral() + sbhosofp->Integral() - sbhosofn->Integral()); |
126 |
> |
delete sbhossfp,sbhossfn,sbhosofp,sbhosofn; |
127 |
> |
} else { |
128 |
> |
obs = hossfp->Integral(); |
129 |
> |
pred= hossfn->Integral() + (hosofp->Integral() - hosofn->Integral()); |
130 |
> |
} |
131 |
|
|
132 |
|
delete hossfp,hossfn,hosofp,hosofn; |
124 |
– |
delete sbhossfp,sbhossfn,sbhosofp,sbhosofn; |
133 |
|
return obs-pred; |
134 |
|
} |
135 |
|
|
198 |
|
|
199 |
|
//________________________________________________________________________________________ |
200 |
|
// Get normalization factor for the PDFs |
201 |
< |
float get_norm_pdf_factor(TTree *events, int k) { |
201 |
> |
float get_norm_pdf_factor(TTree *events, int k, string addcut) { |
202 |
|
|
203 |
|
TH1F *haux = new TH1F("haux", "", 10000, 0, 5); |
204 |
|
char nameVar[20]; |
205 |
|
sprintf(nameVar, "pdfW[%d]", k); |
206 |
< |
events->Project("haux", nameVar); |
206 |
> |
events->Project("haux", nameVar, addcut.c_str()); |
207 |
|
float thisW = haux->Integral(); |
208 |
|
events->Project("haux", "pdfW[0]"); |
209 |
|
float normW = haux->Integral(); |
225 |
|
jzbMax = myJzbMax; |
226 |
|
|
227 |
|
// Acceptance cuts |
228 |
< |
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
228 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
229 |
> |
TCut kbase(PlottingSetup::genMassCut&&"genNjets>2&&genZPt>0"&&cutmass&&cutOSSF); |
230 |
|
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
231 |
|
|
232 |
< |
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
232 |
> |
if(requireZ&&PlottingSetup::RestrictToMassPeak) kbase=kbase&&"TMath::Abs(genMID)==23"; |
233 |
|
TH1F* hLM4 = plotEff(events,kbase,informalname); |
234 |
|
hLM4->SetMinimum(0.); |
235 |
|
|
252 |
|
//____________________________________________________________________________________ |
253 |
|
// Effect of peak shifting |
254 |
|
void PeakError(TTree *events,float &result, string mcjzb, float peakerr,string addcut="") { |
255 |
+ |
//Note: the cut used here is something like (JZBEXPRESSION+(peakerr)>50) without all the other cuts, to increase statistics (particularly for scans) |
256 |
|
TString peakup("("+TString(mcjzb)+"+"+TString(any2string(TMath::Abs(peakerr)))+")"+geq_or_leq()+TString(any2string(jzbSel))); |
257 |
|
TString peakdown("("+TString(mcjzb)+"-"+TString(any2string(TMath::Abs(peakerr)))+")"+geq_or_leq()+TString(any2string(jzbSel))); |
258 |
|
TString peakcentral("("+TString(mcjzb)+")"+geq_or_leq()+TString(any2string(jzbSel))); |
259 |
|
TString npeakup("("+TString(mcjzb)+"+"+TString(any2string(TMath::Abs(peakerr)))+")"+ngeq_or_leq()+"-"+TString(any2string(jzbSel))); |
260 |
|
TString npeakdown("("+TString(mcjzb)+"-"+TString(any2string(TMath::Abs(peakerr)))+")"+ngeq_or_leq()+"-"+TString(any2string(jzbSel))); |
261 |
|
TString npeakcentral("("+TString(mcjzb)+")"+ngeq_or_leq()+"-"+TString(any2string(jzbSel))); |
252 |
– |
|
262 |
|
nBins = 1; |
263 |
|
string informalname="PeakErrorCalculation"; |
264 |
|
float resup,resdown,rescent; |
281 |
|
else if(i==1) resdown=res; |
282 |
|
else if(i==2) resup=res; |
283 |
|
} |
284 |
< |
if(TMath::Abs(rescent-resup)>TMath::Abs(rescent-resdown)) result=(TMath::Abs(rescent-resup)/rescent); |
285 |
< |
else result=(TMath::Abs(rescent-resdown)/rescent); |
284 |
> |
if(TMath::Abs(rescent-resup)>TMath::Abs(rescent-resdown)) result=(TMath::Abs(rescent-resup)/(float)rescent); |
285 |
> |
else result=(TMath::Abs(rescent-resdown)/(float)rescent); |
286 |
> |
} |
287 |
> |
|
288 |
> |
|
289 |
> |
void MCPartialefficiency(TTree *events,float &result, float &resulterr,string mcjzb,bool requireZ,int Neventsinfile, string addcut="", int k = 0, int type = 0) { |
290 |
> |
if(!events) { |
291 |
> |
write_error(__FUNCTION__,"Tree passed for efficiency calculation is invalid!"); |
292 |
> |
result=0;resulterr=0; |
293 |
> |
return; |
294 |
> |
} |
295 |
> |
|
296 |
> |
char jzbSelStr[256]; sprintf(jzbSelStr,"%f",jzbSel); |
297 |
> |
// All acceptance cuts at gen. level |
298 |
> |
//TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&genJZB"+geq_or_leq()+TString(jzbSelStr)+"&&genId1==-genId2"); |
299 |
> |
TCut kbase(""); |
300 |
> |
if(requireZ&&PlottingSetup::RestrictToMassPeak) kbase=kbase&&"TMath::Abs(genMID)==23"; |
301 |
> |
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
302 |
> |
// Corresponding reco. cuts |
303 |
> |
|
304 |
> |
TCut acceptance("genPt2 != 0"); |
305 |
> |
TCut massId(cutmass&&cutOSSF); |
306 |
> |
TCut njets(cutnJets); |
307 |
> |
TCut jzbp(TString(mcjzb)+geq_or_leq()+TString(jzbSelStr)); |
308 |
> |
TCut jzbn(TString(mcjzb)+ngeq_or_leq()+TString("-")+TString(jzbSelStr)); |
309 |
> |
dout << jzbp << endl; |
310 |
> |
dout << jzbn << endl; |
311 |
> |
|
312 |
> |
float ntotal = events->Draw("pt1", kbase, "goff"); |
313 |
> |
TCut theCut; |
314 |
> |
switch(type) { |
315 |
> |
case 1: |
316 |
> |
theCut = kbase+acceptance; |
317 |
> |
break; |
318 |
> |
case 2: |
319 |
> |
theCut = kbase+massId; |
320 |
> |
break; |
321 |
> |
case 3: |
322 |
> |
theCut = kbase+massId+njets; |
323 |
> |
break; |
324 |
> |
case 4: |
325 |
> |
theCut = kbase+massId+njets+jzbn; |
326 |
> |
break; |
327 |
> |
default: |
328 |
> |
theCut = kbase+massId+njets+jzbn; |
329 |
> |
break; |
330 |
> |
} |
331 |
> |
|
332 |
> |
string stheCut(theCut); |
333 |
> |
char var[20]; |
334 |
> |
sprintf(var, "pdfW[%d]", k); |
335 |
> |
|
336 |
> |
string svar(var); |
337 |
> |
string newtheCut; |
338 |
> |
if(k>0) newtheCut = "(" + stheCut + ")*" + svar; |
339 |
> |
else newtheCut = "(" + stheCut + ")"; // for k==0 or even k==-1 we don't need to evaluate PDFs |
340 |
> |
|
341 |
> |
TH1F *effh= new TH1F("effh","effh",1,-14000,14000); |
342 |
> |
if(k>=0) events->Draw((mcjzbexpression+">>effh").c_str(), newtheCut.c_str(),"goff"); |
343 |
> |
else events->Draw((mcjzbexpression+">>effh").c_str(), theCut,"goff"); |
344 |
> |
Float_t sel = effh->Integral(); |
345 |
> |
Float_t nsel=0; |
346 |
> |
//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. |
347 |
> |
float normFactor = 1; |
348 |
> |
if(k>=0) get_norm_pdf_factor(events, k, addcut); |
349 |
> |
sel = sel/normFactor; |
350 |
> |
|
351 |
> |
result=(sel)/ntotal; |
352 |
> |
resulterr=TMath::Sqrt(sel/ntotal*(1+sel/ntotal)/ntotal); |
353 |
> |
|
354 |
|
} |
355 |
|
|
356 |
|
//____________________________________________________________________________________ |
357 |
|
// Total selection efficiency (MC) |
358 |
|
//returns the efficiency WITHOUT signal contamination, and the result and resulterr contain the result and the corresponding error |
359 |
|
Value MCefficiency(TTree *events,float &result, float &resulterr,string mcjzb,bool requireZ,int Neventsinfile, string addcut="", int k = 0) { |
360 |
+ |
if(k<1) write_warning(__FUNCTION__,"Setting automatized to off!"); automatized=false; // only do this once when computing pdf uncertainties |
361 |
+ |
if(!events) { |
362 |
+ |
write_error(__FUNCTION__,"Tree passed for efficiency calculation is invalid!"); |
363 |
+ |
result=0; |
364 |
+ |
resulterr=0; |
365 |
+ |
return Value(0,0); |
366 |
+ |
} |
367 |
|
|
368 |
|
char jzbSelStr[256]; sprintf(jzbSelStr,"%f",jzbSel); |
369 |
|
// All acceptance cuts at gen. level |
370 |
|
//TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&genJZB"+geq_or_leq()+TString(jzbSelStr)+"&&genId1==-genId2"); |
371 |
|
TCut kbase(""); |
372 |
< |
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
372 |
> |
|
373 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
374 |
> |
if(requireZ&&PlottingSetup::RestrictToMassPeak) kbase=kbase&&"TMath::Abs(genMID)==23"; |
375 |
|
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
376 |
|
// Corresponding reco. cuts |
377 |
< |
TCut ksel("pfJetGoodNum>2&&abs(mll-91.2)<20&&id1==id2&&"+TString(mcjzb)+geq_or_leq()+TString(jzbSelStr)); |
378 |
< |
TCut ksel2("pfJetGoodNum>2&&abs(mll-91.2)<20&&id1==id2&&"+TString(mcjzb)+ngeq_or_leq()+TString("-")+TString(jzbSelStr)); |
377 |
> |
|
378 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
379 |
> |
TCut ksel;//("pfJetGoodNum>2"&&cutmass&&"id1==id2&&"+TString(mcjzb)+geq_or_leq()+TString(jzbSelStr)); |
380 |
> |
TCut ksel2;//("pfJetGoodNum>2"&&cutmass&&"id1==id2&&"+TString(mcjzb)+ngeq_or_leq()+TString("-")+TString(jzbSelStr)); |
381 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
382 |
> |
if(PlottingSetup::RestrictToMassPeak||!ConsiderSignalContaminationForLimits) { |
383 |
> |
ksel=TCut("pfJetGoodNum>2"&&cutmass&&"id1==id2&&"+TString(mcjzb)+geq_or_leq()+TString(jzbSelStr)); |
384 |
> |
ksel2=TCut("pfJetGoodNum>2"&&cutmass&&"id1==id2&&"+TString(mcjzb)+ngeq_or_leq()+TString("-")+TString(jzbSelStr)); |
385 |
> |
} else { |
386 |
> |
//for off peak analysis we don't use the OSSF condition here yet so we can recycle these two cuts for the em condition! |
387 |
> |
ksel=TCut("pfJetGoodNum>2"&&cutmass&&(TString(mcjzb)+geq_or_leq()+TString(jzbSelStr))); |
388 |
> |
ksel2=TCut("pfJetGoodNum>2"&&cutmass&&(TString(mcjzb)+ngeq_or_leq()+TString("-")+TString(jzbSelStr))); |
389 |
> |
} |
390 |
> |
|
391 |
|
TCut posSide = kbase&&ksel; |
392 |
|
TCut negSide = kbase&&ksel2; |
393 |
|
string sposSide(posSide); |
394 |
|
string snegSide(negSide); |
395 |
|
char var[20]; |
396 |
|
sprintf(var, "pdfW[%d]", k); |
397 |
+ |
if(k==-1) sprintf(var,"1.0");//case in which we don't want to evaluate PDFs |
398 |
|
string svar(var); |
399 |
< |
string newPosSide = "(" + sposSide + ")*" + svar; |
400 |
< |
string newNegSide = "(" + snegSide + ")*" + svar; |
399 |
> |
string newPosSide = "((id1==id2)&&(" + sposSide + "))*" + svar; |
400 |
> |
string newNegSide = "((id1==id2)&&(" + snegSide + "))*" + svar; |
401 |
> |
string emnewPosSide = "((id1!=id2)&&(" + sposSide + "))*" + svar; // only used for off peak analysis |
402 |
> |
string emnewNegSide = "((id1!=id2)&&(" + snegSide + "))*" + svar; // only used for off peak analysis |
403 |
|
|
404 |
|
TH1F *effh= new TH1F("effh","effh",1,-14000,14000); |
405 |
|
if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newPosSide.c_str(),"goff"); |
406 |
< |
else events->Draw((mcjzbexpression+">>effh").c_str(), sposSide.c_str(),"goff"); |
406 |
> |
else events->Draw((mcjzbexpression+">>effh").c_str(), (sposSide+"&&(id1==id2)").c_str(),"goff");//the OSSF condition is added for the offpeak analysis, in onpeak case it's there already but doesn't change anything. |
407 |
|
Float_t sel = effh->Integral(); |
408 |
|
Float_t nsel=0; |
409 |
+ |
|
410 |
+ |
///----------------------------------------------- THIS PART REQUIRES STUDYING! ------------------------- |
411 |
+ |
|
412 |
|
if(ConsiderSignalContaminationForLimits) { |
413 |
< |
if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newNegSide.c_str(),"goff"); |
414 |
< |
else events->Draw((mcjzbexpression+">>effh").c_str(), snegSide.c_str(),"goff"); |
415 |
< |
nsel = effh->Integral(); |
413 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
414 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
415 |
> |
events->Draw((mcjzbexpression+">>effh").c_str(), newNegSide.c_str(),"goff"); |
416 |
> |
nsel += effh->Integral(); |
417 |
> |
} else { |
418 |
> |
events->Draw((mcjzbexpression+">>effh").c_str(), newNegSide.c_str(),"goff"); |
419 |
> |
nsel += effh->Integral(); |
420 |
> |
events->Draw((mcjzbexpression+">>effh").c_str(), emnewPosSide.c_str(),"goff"); |
421 |
> |
nsel += effh->Integral(); |
422 |
> |
events->Draw((mcjzbexpression+">>effh").c_str(), emnewNegSide.c_str(),"goff"); |
423 |
> |
nsel -= effh->Integral(); |
424 |
> |
} |
425 |
|
} |
426 |
+ |
|
427 |
|
//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. |
428 |
|
float normFactor = 1; |
429 |
< |
if(k>=0) get_norm_pdf_factor(events, k); |
429 |
> |
if(k>=0) get_norm_pdf_factor(events, k, addcut); |
430 |
|
sel = sel/normFactor; |
431 |
|
nsel = nsel/normFactor; |
432 |
|
|
445 |
|
resulterr=TMath::Sqrt(sel/tot*(1+sel/tot)/tot); |
446 |
|
result_wo_signalcont=Value(result,resulterr); |
447 |
|
} |
448 |
< |
if(!automatized && k>0 ) dout << "PDF assessment: "; |
449 |
< |
if(!automatized) dout << " MC efficiency: " << result << "+-" << resulterr << " ( JZB>" << jzbSel << " : " << sel << " , JZB<-" << jzbSel << " : " << nsel << " and nevents=" << tot << ") with normFact=" << normFactor << std::endl; |
448 |
> |
if(!automatized && k>0 ) dout << "PDF assessment [" << k << "] : "; |
449 |
> |
if(!automatized) dout << " MC efficiency: " << result << "+-" << resulterr << " ( JZB>" << jzbSel << " : " << sel << " , signal contamination : " << nsel << " and nevents=" << tot << ") with normFact=" << normFactor << std::endl; |
450 |
|
delete effh; |
451 |
+ |
return result_wo_signalcont; |
452 |
|
} |
453 |
|
|
454 |
|
|
455 |
+ |
|
456 |
|
//____________________________________________________________________________________ |
457 |
|
// Selection efficiency for one process (MC) |
458 |
|
vector<float> processMCefficiency(TTree *events,string mcjzb,bool requireZ,int Neventsinfile, string addcut) { |
469 |
|
|
470 |
|
|
471 |
|
void JZBefficiency(TTree *events, string informalname, float &jzbeff, float &jzbefferr, bool requireZ, string addcut="") { |
472 |
< |
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
472 |
> |
TCut kbase(genMassCut&&"genNjets>2&&genZPt>0"&&cutmass&&cutOSSF); |
473 |
|
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
474 |
< |
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
474 |
> |
if(requireZ&&PlottingSetup::RestrictToMassPeak) kbase=kbase&&"TMath::Abs(genMID)==23"; |
475 |
|
TH1F* hLM4 = plotEff(events,kbase,informalname); |
476 |
|
Int_t bin = hLM4->FindBin(jzbSel); // To get the error |
477 |
|
jzbeff=Interpolate(jzbSel,hLM4); |
483 |
|
//________________________________________________________________________ |
484 |
|
// Effect of energy scale on efficiency |
485 |
|
void JZBjetScale(TTree *events, float &jesdown, float &jesup, string informalname,bool requireZ,string addcut="",float syst=0.1, Float_t jzbSelection=-1, TString plotName = "" ) { |
486 |
< |
TCut kbase("abs(genMll-91.2)<20&&genZPt>0"); |
486 |
> |
TCut kbase(genMassCut&&"genZPt>0"); |
487 |
|
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
488 |
< |
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
488 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
489 |
> |
if(requireZ&&PlottingSetup::RestrictToMassPeak) kbase=kbase&&"TMath::Abs(genMID)==23"; |
490 |
|
|
491 |
< |
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
491 |
> |
TCut ksel(cutmass&&cutOSSF); |
492 |
|
TCut nJets("pfJetGoodNum>2"); |
493 |
|
stringstream down,up; |
494 |
|
down << "pfJetGoodNum"<<30*(1-syst)<<">=3"; |
522 |
|
// Effect of energy scale on JZB efficiency |
523 |
|
void doJZBscale(TTree *events, float &down, float &up, float &syst, float systematic, string informalname, bool requireZ, string addcut) { |
524 |
|
|
525 |
< |
TCut kbase("abs(genMll-91.2)<20&&genZPt>0&&genNjets>2"); |
525 |
> |
TCut kbase(genMassCut&&"genZPt>0&&genNjets>2"); |
526 |
|
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
527 |
< |
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
528 |
< |
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
527 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
528 |
> |
if(requireZ&&PlottingSetup::RestrictToMassPeak) kbase=kbase&&"TMath::Abs(genMID)==23"; |
529 |
> |
TCut ksel(cutmass&&cutOSSF); |
530 |
|
|
531 |
|
nBins = 50; |
532 |
|
jzbMin = 0.5*jzbSel; |
550 |
|
void JZBresponse(TTree *events, bool requireZ, float &resp, float &resperr, string addcut="",bool isMET = kFALSE, Float_t myJzbMax = 200., Int_t nPeriods = 9 ) { |
551 |
|
|
552 |
|
jzbMin = 20; |
553 |
< |
TCut kbase("abs(genMll-91.2)<20&&genZPt>0&&genNjets>2"); |
553 |
> |
flag_this_change(__FUNCTION__,__LINE__,false);//PlottingSetup::RestrictToMassPeak |
554 |
> |
TCut kbase(genMassCut&&"genZPt>0&&genNjets>2"); |
555 |
|
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
556 |
< |
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
557 |
< |
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
556 |
> |
flag_this_change(__FUNCTION__,__LINE__,false);//PlottingSetup::RestrictToMassPeak |
557 |
> |
if(requireZ&&PlottingSetup::RestrictToMassPeak) kbase=kbase&&"TMath::Abs(genMID)==23"; |
558 |
> |
flag_this_change(__FUNCTION__,__LINE__,false);//PlottingSetup::RestrictToMassPeak |
559 |
> |
TCut ksel(cutmass&&cutOSSF); |
560 |
|
|
561 |
|
TProfile* hJzbResp = new TProfile("hJzbResp","JZB response ; JZB true (GeV/c); JZB reco. / JZB true", nPeriods, jzbMin, myJzbMax, "" ); |
562 |
|
|
622 |
|
|
623 |
|
float mceff,mcefferr,jzbeff,jzbefferr; |
624 |
|
if(!automatized) dout << "MC efficiencies:" << endl; |
625 |
< |
MCefficiency(events,mceff,mcefferr,mcjzb,requireZ,Neventsinfile,addcut,-1); |
625 |
> |
Value mceff_nosigcont = MCefficiency(events,mceff,mcefferr,mcjzb,requireZ,Neventsinfile,addcut,-1); |
626 |
> |
if(!automatized) cout << " Without signal contamination, we find an efficiency of " << mceff_nosigcont << endl; |
627 |
> |
|
628 |
|
if(PlottingSetup::computeJZBefficiency) JZBefficiency(events,informalname,jzbeff,jzbefferr,requireZ,addcut); |
629 |
|
if(!automatized) dout << "JZB efficiency: " << jzbeff << "+/-" << jzbefferr << endl; |
630 |
|
|
684 |
|
|
685 |
|
dout << "FINAL RESULT : " << 100*mceff << " +/- "<< 100*mcefferr << " (stat) +/- " << 100*systerr << " (syst) %" << endl; |
686 |
|
dout << " we thus use the sqrt of the sum of the squares of the stat & syst err, which is : " << 100*toterr << endl; |
687 |
+ |
dout << "_______________________________________________" << endl; |
688 |
|
|
689 |
|
//Do not modify the lines below or mess with the order; this order is expected by all limit calculating functions! |
690 |
|
vector<float> res; |
696 |
|
if(fabs(jesup)>fabs(jesdown)) res.push_back(fabs(jesup)); else res.push_back(fabs(jesdown)); |
697 |
|
if(fabs(scaleup)>fabs(scaledown)) res.push_back(fabs(scaleup)); else res.push_back(fabs(scaledown)); |
698 |
|
res.push_back(fabs(resolution)); |
699 |
+ |
res.push_back(mceff_nosigcont.getValue()); |
700 |
+ |
res.push_back(mceff_nosigcont.getError()); |
701 |
|
if(ismSUGRA) res.push_back(PDFuncert); |
702 |
|
results.push_back(res); |
703 |
|
} |