237 |
|
TCut ksel2("pfJetGoodNum>2&&abs(mll-91.2)<20&&id1==id2&&"+TString(mcjzb)+ngeq_or_leq()+TString("-")+TString(jzbSelStr)); |
238 |
|
events->Draw(mcjzbexpression.c_str(),kbase&&ksel,"goff"); |
239 |
|
Float_t sel = events->GetSelectedRows(); |
240 |
< |
events->Draw(mcjzbexpression.c_str(),kbase&&ksel2,"goff"); |
241 |
< |
Float_t nsel = events->GetSelectedRows(); |
240 |
> |
Float_t nsel=0; |
241 |
> |
if(ConsiderSignalContaminationForLimits) { |
242 |
> |
events->Draw(mcjzbexpression.c_str(),kbase&&ksel2,"goff"); |
243 |
> |
nsel = events->GetSelectedRows(); |
244 |
> |
} |
245 |
|
// events->Draw(mcjzbexpression.c_str(),kbase,"goff"); |
246 |
|
// Float_t tot = events->GetSelectedRows(); |
247 |
|
Float_t tot = Neventsinfile; |
248 |
|
|
249 |
< |
result=(sel-nsel)/tot; |
250 |
< |
resulterr=TMath::Sqrt(sel/tot*(1-sel/tot)/tot); |
251 |
< |
dout << " MC efficiency: " << result << "+-" << resulterr << " ( JZB>" << jzbSel << " : " << sel << " , JZB<-" << jzbSel << " : " << nsel << " and nevents=" << tot << ")" << std::endl; |
249 |
> |
if(ConsiderSignalContaminationForLimits) { |
250 |
> |
result=(sel-nsel)/tot; |
251 |
> |
resulterr=(1.0/tot)*TMath::Sqrt(sel+nsel+(sel-nsel)*(sel-nsel)/tot); |
252 |
> |
} else {//no signal contamination considered: |
253 |
> |
result=(sel)/tot; |
254 |
> |
resulterr=TMath::Sqrt(sel/tot*(1+sel/tot)/tot); |
255 |
> |
} |
256 |
> |
if(!automatized) dout << " MC efficiency: " << result << "+-" << resulterr << " ( JZB>" << jzbSel << " : " << sel << " , JZB<-" << jzbSel << " : " << nsel << " and nevents=" << tot << ")" << std::endl; |
257 |
|
} |
258 |
|
|
259 |
|
void JZBefficiency(TTree *events, string informalname, float &jzbeff, float &jzbefferr, bool requireZ, string addcut="") { |
260 |
|
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
253 |
– |
cout << "Getting started with JZB efficiency" << endl; |
261 |
|
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
262 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
263 |
|
TH1F* hLM4 = plotEff(events,kbase,informalname); |
414 |
|
toterr+=(resolution*resolution); |
415 |
|
toterr+=(sysfrompeak*sysfrompeak); |
416 |
|
dout << "TOTAL SYSTEMATICS: " << TMath::Sqrt(toterr) << " --> " << TMath::Sqrt(toterr)*mceff << endl; |
417 |
< |
toterr=TMath::Sqrt(toterr)*mceff; |
418 |
< |
dout << "FINAL RESULT : " << 100*mceff << " +/- "<< 100*mcefferr << " (stat) +/- " << 100*toterr << " (syst) %" << endl; |
419 |
< |
dout << " we thus use the sqrt of the sum of the squares which is : " << 100*toterr << endl; |
417 |
> |
float systerr=TMath::Sqrt(toterr)*mceff; |
418 |
> |
toterr=TMath::Sqrt(toterr*mceff*mceff+mcefferr*mcefferr);//also includes stat err! |
419 |
> |
|
420 |
> |
dout << "FINAL RESULT : " << 100*mceff << " +/- "<< 100*mcefferr << " (stat) +/- " << 100*systerr << " (syst) %" << endl; |
421 |
> |
dout << " we thus use the sqrt of the sum of the squares of the stat & syst err, which is : " << 100*toterr << endl; |
422 |
> |
|
423 |
> |
//Do not modify the lines below or mess with the order; this order is expected by all limit calculating functions! |
424 |
|
vector<float> res; |
425 |
|
res.push_back(jzbSel); |
426 |
|
res.push_back(mceff); |