190 |
|
// Get normalization factor for the PDFs |
191 |
|
float get_norm_pdf_factor(TTree *events, int k) { |
192 |
|
|
193 |
< |
TH1F *haux = new TH1F("haux", "", 1, 0, 20); |
193 |
> |
TH1F *haux = new TH1F("haux", "", 10000, 0, 5); |
194 |
|
char nameVar[20]; |
195 |
|
sprintf(nameVar, "pdfW[%d]", k); |
196 |
|
events->Project("haux", nameVar); |
298 |
|
string newNegSide = "(" + snegSide + ")*" + svar; |
299 |
|
|
300 |
|
TH1F *effh= new TH1F("effh","effh",1,-14000,14000); |
301 |
< |
events->Draw((mcjzbexpression+">>effh").c_str(), newPosSide.c_str(),"goff"); |
301 |
> |
if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newPosSide.c_str(),"goff"); |
302 |
> |
else events->Draw((mcjzbexpression+">>effh").c_str(), sposSide.c_str(),"goff"); |
303 |
|
Float_t sel = effh->Integral(); |
304 |
|
Float_t nsel=0; |
305 |
|
if(ConsiderSignalContaminationForLimits) { |
306 |
< |
events->Draw((mcjzbexpression+">>effh").c_str(), newNegSide.c_str(),"goff"); |
306 |
> |
if(k>=0)events->Draw((mcjzbexpression+">>effh").c_str(), newNegSide.c_str(),"goff"); |
307 |
> |
else events->Draw((mcjzbexpression+">>effh").c_str(), snegSide.c_str(),"goff"); |
308 |
|
nsel = effh->Integral(); |
309 |
|
} |
310 |
|
//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. |
311 |
< |
float normFactor = get_norm_pdf_factor(events, k); |
311 |
> |
float normFactor = 1; |
312 |
> |
if(k>=0) get_norm_pdf_factor(events, k); |
313 |
|
sel = sel/normFactor; |
314 |
|
nsel = nsel/normFactor; |
315 |
|
|
327 |
|
if(!automatized) dout << " MC efficiency: " << result << "+-" << resulterr << " ( JZB>" << jzbSel << " : " << sel << " , JZB<-" << jzbSel << " : " << nsel << " and nevents=" << tot << ") with normFact=" << normFactor << std::endl; |
328 |
|
delete effh; |
329 |
|
} |
327 |
– |
//Pablo: MC efficiency: 6.90539e-08+-6.73798e-06 ( JZB>100 : 0.000105031 , JZB<-100 : 0 and nevents=1521) |
328 |
– |
//corre: MC efficiency: 0.000657462+-0.000657678 ( JZB>100 : 1 , JZB<-100 : 0 and nevents=1521) |
330 |
|
|
331 |
|
|
332 |
+ |
//____________________________________________________________________________________ |
333 |
+ |
// Total selection efficiency (MC) |
334 |
+ |
vector<float> processMCefficiency(TTree *events,string mcjzb,bool requireZ,int Neventsinfile, string addcut) { |
335 |
+ |
vector<float> process_efficiencies; |
336 |
+ |
for(int iprocess=0;iprocess<=10;iprocess++) { |
337 |
+ |
float this_process_efficiency,efferr; |
338 |
+ |
stringstream addcutplus; |
339 |
+ |
addcutplus<<addcut<<"&&(process=="<<iprocess<<")"; |
340 |
+ |
MCefficiency(events,this_process_efficiency, efferr,mcjzb,requireZ,Neventsinfile, addcutplus.str(),-1); |
341 |
+ |
process_efficiencies.push_back(this_process_efficiency); |
342 |
+ |
} |
343 |
+ |
return process_efficiencies; |
344 |
+ |
} |
345 |
+ |
|
346 |
+ |
|
347 |
|
void JZBefficiency(TTree *events, string informalname, float &jzbeff, float &jzbefferr, bool requireZ, string addcut="") { |
348 |
|
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
349 |
|
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
475 |
|
float JetEnergyScaleUncert=0.1; |
476 |
|
float JZBScaleUncert=0.1; |
477 |
|
mcjzbexpression=mcjzb; |
478 |
< |
float triggereff=4.0/100;// in range [0,1] |
478 |
> |
float triggereff=5.0/100;// in range [0,1] |
479 |
|
dout << "Trigger efficiency not implemented in this script yet, still using external one" << endl; |
480 |
|
float leptonseleff=2.0/100;// in range [0,1] |
481 |
|
dout << "Lepton selection efficiency not implemented in this script yet, still using external one" << endl; |
482 |
|
|
483 |
< |
int NPdfs=get_npdfs(events); |
484 |
< |
|
483 |
> |
int NPdfs=0; |
484 |
> |
if(ismSUGRA) NPdfs = get_npdfs(events); |
485 |
> |
|
486 |
|
float mceff,mcefferr,jzbeff,jzbefferr; |
487 |
|
if(!automatized) dout << "MC efficiencies:" << endl; |
488 |
< |
MCefficiency(events,mceff,mcefferr,mcjzb,requireZ,Neventsinfile,addcut); |
488 |
> |
MCefficiency(events,mceff,mcefferr,mcjzb,requireZ,Neventsinfile,addcut,-1); |
489 |
|
JZBefficiency(events,informalname,jzbeff,jzbefferr,requireZ,addcut); |
490 |
|
if(!automatized) dout << "JZB efficiency: " << jzbeff << "+/-" << jzbefferr << endl; |
491 |
|
|