281 |
|
//returns the efficiency WITHOUT signal contamination, and the result and resulterr contain the result and the corresponding error |
282 |
|
Value MCefficiency(TTree *events,float &result, float &resulterr,string mcjzb,bool requireZ,int Neventsinfile, string addcut="", int k = 0) { |
283 |
|
|
284 |
+ |
if(!events) { |
285 |
+ |
write_error(__FUNCTION__,"Tree passed for efficiency calculation is invalid!"); |
286 |
+ |
return Value(0,0); |
287 |
+ |
} |
288 |
+ |
|
289 |
|
char jzbSelStr[256]; sprintf(jzbSelStr,"%f",jzbSel); |
290 |
|
// All acceptance cuts at gen. level |
291 |
|
//TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&genJZB"+geq_or_leq()+TString(jzbSelStr)+"&&genId1==-genId2"); |
306 |
|
string newNegSide = "(" + snegSide + ")*" + svar; |
307 |
|
|
308 |
|
TH1F *effh= new TH1F("effh","effh",1,-14000,14000); |
309 |
< |
if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newPosSide.c_str(),"goff"); |
310 |
< |
else events->Draw((mcjzbexpression+">>effh").c_str(), sposSide.c_str(),"goff"); |
309 |
> |
cout << "right before drawing" << endl; |
310 |
> |
if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newPosSide.c_str(),""); |
311 |
> |
else events->Draw((mcjzbexpression+">>effh").c_str(), sposSide.c_str(),""); |
312 |
> |
cout << "right after drawing" << endl; |
313 |
> |
cout << "consider sigcont?" << ConsiderSignalContaminationForLimits << endl; |
314 |
|
Float_t sel = effh->Integral(); |
315 |
|
Float_t nsel=0; |
316 |
|
if(ConsiderSignalContaminationForLimits) { |
317 |
< |
if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newNegSide.c_str(),"goff"); |
318 |
< |
else events->Draw((mcjzbexpression+">>effh").c_str(), snegSide.c_str(),"goff"); |
317 |
> |
if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newNegSide.c_str(),""); |
318 |
> |
else events->Draw((mcjzbexpression+">>effh").c_str(), snegSide.c_str(),""); |
319 |
|
nsel = effh->Integral(); |
320 |
|
} |
321 |
|
//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. |
342 |
|
if(!automatized && k>0 ) dout << "PDF assessment: "; |
343 |
|
if(!automatized) dout << " MC efficiency: " << result << "+-" << resulterr << " ( JZB>" << jzbSel << " : " << sel << " , JZB<-" << jzbSel << " : " << nsel << " and nevents=" << tot << ") with normFact=" << normFactor << std::endl; |
344 |
|
delete effh; |
345 |
+ |
return result_wo_signalcont; |
346 |
|
} |
347 |
|
|
348 |
|
|
510 |
|
|
511 |
|
float mceff,mcefferr,jzbeff,jzbefferr; |
512 |
|
if(!automatized) dout << "MC efficiencies:" << endl; |
513 |
< |
MCefficiency(events,mceff,mcefferr,mcjzb,requireZ,Neventsinfile,addcut,-1); |
513 |
> |
Value mceff_nosigcont = MCefficiency(events,mceff,mcefferr,mcjzb,requireZ,Neventsinfile,addcut,-1); |
514 |
> |
if(!automatized) cout << " Without signal contamination, we find an efficiency of " << mceff_nosigcont << endl; |
515 |
> |
|
516 |
|
if(PlottingSetup::computeJZBefficiency) JZBefficiency(events,informalname,jzbeff,jzbefferr,requireZ,addcut); |
517 |
|
if(!automatized) dout << "JZB efficiency: " << jzbeff << "+/-" << jzbefferr << endl; |
518 |
|
|
572 |
|
|
573 |
|
dout << "FINAL RESULT : " << 100*mceff << " +/- "<< 100*mcefferr << " (stat) +/- " << 100*systerr << " (syst) %" << endl; |
574 |
|
dout << " we thus use the sqrt of the sum of the squares of the stat & syst err, which is : " << 100*toterr << endl; |
575 |
+ |
dout << "_______________________________________________" << endl; |
576 |
|
|
577 |
|
//Do not modify the lines below or mess with the order; this order is expected by all limit calculating functions! |
578 |
|
vector<float> res; |
584 |
|
if(fabs(jesup)>fabs(jesdown)) res.push_back(fabs(jesup)); else res.push_back(fabs(jesdown)); |
585 |
|
if(fabs(scaleup)>fabs(scaledown)) res.push_back(fabs(scaleup)); else res.push_back(fabs(scaledown)); |
586 |
|
res.push_back(fabs(resolution)); |
587 |
+ |
res.push_back(mceff_nosigcont.getValue()); |
588 |
+ |
res.push_back(mceff_nosigcont.getError()); |
589 |
|
if(ismSUGRA) res.push_back(PDFuncert); |
590 |
|
results.push_back(res); |
591 |
|
} |