158 |
|
|
159 |
|
//________________________________________________________________________________________ |
160 |
|
// Pile-up efficiency |
161 |
< |
float pileup(TTree *events, bool requireZ, string informalname, Float_t myJzbMax = 140. ) { |
161 |
> |
float pileup(TTree *events, bool requireZ, string informalname, string addcut="",Float_t myJzbMax = 140. ) { |
162 |
|
nBins = 16; |
163 |
|
jzbMax = myJzbMax; |
164 |
|
|
165 |
|
// Acceptance cuts |
166 |
|
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
167 |
+ |
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
168 |
+ |
|
169 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
170 |
|
TH1F* hLM4 = plotEff(events,kbase,informalname); |
171 |
|
hLM4->SetMinimum(0.); |
188 |
|
|
189 |
|
//____________________________________________________________________________________ |
190 |
|
// Effect of peak shifting |
191 |
< |
void PeakError(TTree *events,float &result, string mcjzb, float peakerr) { |
191 |
> |
void PeakError(TTree *events,float &result, string mcjzb, float peakerr,string addcut="") { |
192 |
|
TString peakup("("+TString(mcjzb)+"+"+TString(any2string(TMath::Abs(peakerr)))+")"+geq_or_leq()+TString(any2string(jzbSel))); |
193 |
|
TString peakdown("("+TString(mcjzb)+"-"+TString(any2string(TMath::Abs(peakerr)))+")"+geq_or_leq()+TString(any2string(jzbSel))); |
194 |
|
TString peakcentral("("+TString(mcjzb)+")"+geq_or_leq()+TString(any2string(jzbSel))); |
211 |
|
poscut=peakup; |
212 |
|
negcut=npeakup; |
213 |
|
} |
214 |
< |
float res=allcontributionsplot(events,cutnJets,cutmass,sidebandcut,poscut.c_str(),negcut.c_str()); |
214 |
> |
float res; |
215 |
> |
if(addcut=="") res=allcontributionsplot(events,cutnJets,cutmass,sidebandcut,poscut.c_str(),negcut.c_str()); |
216 |
> |
else res=allcontributionsplot(events,cutnJets&&addcut.c_str(),cutmass,sidebandcut,poscut.c_str(),negcut.c_str()); |
217 |
|
if(i==0) rescent=res; |
218 |
|
else if(i==1) resdown=res; |
219 |
|
else if(i==2) resup=res; |
244 |
|
if(!automatized) dout << " MC efficiency: " << result << "+-" << resulterr << std::endl; |
245 |
|
} |
246 |
|
|
247 |
< |
void JZBefficiency(TTree *events, string informalname, float &jzbeff, float &jzbefferr, bool requireZ) { |
247 |
> |
void JZBefficiency(TTree *events, string informalname, float &jzbeff, float &jzbefferr, bool requireZ, string addcut="") { |
248 |
|
TCut kbase("abs(genMll-91.2)<20&&genNjets>2&&genZPt>0&&abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
249 |
+ |
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
250 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
251 |
|
TH1F* hLM4 = plotEff(events,kbase,informalname); |
252 |
|
Int_t bin = hLM4->FindBin(jzbSel); // To get the error |
258 |
|
|
259 |
|
//________________________________________________________________________ |
260 |
|
// Effect of energy scale on efficiency |
261 |
< |
void JZBjetScale(TTree *events, float &jesdown, float &jesup, string informalname,bool requireZ,float syst=0.1, Float_t jzbSelection=-1, TString plotName = "" ) { |
261 |
> |
void JZBjetScale(TTree *events, float &jesdown, float &jesup, string informalname,bool requireZ,string addcut="",float syst=0.1, Float_t jzbSelection=-1, TString plotName = "" ) { |
262 |
|
TCut kbase("abs(genMll-91.2)<20&&genZPt>0"); |
263 |
+ |
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
264 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
265 |
|
|
266 |
|
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
295 |
|
|
296 |
|
//________________________________________________________________________ |
297 |
|
// Effect of energy scale on JZB efficiency |
298 |
< |
void doJZBscale(TTree *events, float &down, float &up, float &syst, float systematic, string informalname, bool requireZ) { |
298 |
> |
void doJZBscale(TTree *events, float &down, float &up, float &syst, float systematic, string informalname, bool requireZ, string addcut) { |
299 |
|
|
300 |
|
TCut kbase("abs(genMll-91.2)<20&&genZPt>0&&genNjets>2"); |
301 |
+ |
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
302 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
303 |
|
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
304 |
|
|
321 |
|
|
322 |
|
//________________________________________________________________________ |
323 |
|
// JZB response (true/reco. vs. true) |
324 |
< |
void JZBresponse(TTree *events, bool requireZ, float &resp, float &resperr, bool isMET = kFALSE, Float_t myJzbMax = 200., Int_t nPeriods = 9 ) { |
324 |
> |
void JZBresponse(TTree *events, bool requireZ, float &resp, float &resperr, string addcut="",bool isMET = kFALSE, Float_t myJzbMax = 200., Int_t nPeriods = 9 ) { |
325 |
|
|
326 |
|
jzbMin = 20; |
327 |
|
TCut kbase("abs(genMll-91.2)<20&&genZPt>0&&genNjets>2"); |
328 |
+ |
if(addcut!="") kbase=kbase&&addcut.c_str();//this is mostly for SUSY scans (adding requirements on masses) |
329 |
|
if(requireZ) kbase=kbase&&"TMath::Abs(genMID)==23"; |
330 |
|
TCut ksel("abs(mll-91.2)<20&&((id1+1)*(id2+1)*ch1*ch2)!=-2"); |
331 |
|
|
345 |
|
} |
346 |
|
|
347 |
|
|
348 |
< |
void do_systematics_for_one_file(TTree *events,string informalname, vector<vector<float> > &results,string mcjzb,string datajzb,float peakerror,bool requireZ=false) { |
348 |
> |
void do_systematics_for_one_file(TTree *events,string informalname, vector<vector<float> > &results,string mcjzb,string datajzb,float peakerror,bool requireZ=false, string addcut="") { |
349 |
|
|
350 |
|
float JetEnergyScaleUncert=0.1; |
351 |
|
float JZBScaleUncert=0.1; |
358 |
|
|
359 |
|
float mceff,mcefferr,jzbeff,jzbefferr; |
360 |
|
if(!automatized) dout << "MC efficiencies:" << endl; |
361 |
< |
MCefficiency(events,mceff,mcefferr,mcjzb,requireZ); |
362 |
< |
JZBefficiency(events,informalname,jzbeff,jzbefferr,requireZ); |
361 |
> |
MCefficiency(events,mceff,mcefferr,mcjzb,requireZ,addcut); |
362 |
> |
JZBefficiency(events,informalname,jzbeff,jzbefferr,requireZ,addcut); |
363 |
|
if(!automatized) dout << "JZB efficiency: " << jzbeff << "+/-" << jzbefferr << endl; |
364 |
|
|
365 |
|
if(!automatized) dout << "Error from Peak position:" << endl; |
366 |
|
float sysfrompeak=0; |
367 |
< |
PeakError(events,sysfrompeak,mcjzb,peakerror); |
367 |
> |
PeakError(events,sysfrompeak,mcjzb,peakerror,addcut); |
368 |
|
|
369 |
|
if(!automatized) dout << "Jet energy scale: " << std::endl; |
370 |
|
float jesup,jesdown; |
371 |
< |
JZBjetScale(events,jesdown,jesup,informalname,JetEnergyScaleUncert,requireZ); |
371 |
> |
JZBjetScale(events,jesdown,jesup,informalname,requireZ,addcut,JetEnergyScaleUncert); |
372 |
|
|
373 |
|
if(!automatized) dout << "JZB scale: " << std::endl; |
374 |
|
float scaleup,scaledown,scalesyst; |
375 |
< |
doJZBscale(events,scaledown,scaleup,scalesyst,JZBScaleUncert,informalname,requireZ); |
375 |
> |
doJZBscale(events,scaledown,scaleup,scalesyst,JZBScaleUncert,informalname,requireZ,addcut); |
376 |
|
|
377 |
|
if(!automatized) dout << "JZB response: " << std::endl; |
378 |
|
float resp,resperr; |
379 |
< |
JZBresponse(events,requireZ,resp,resperr); |
379 |
> |
JZBresponse(events,requireZ,resp,resperr,addcut); |
380 |
|
|
381 |
|
if(!automatized) dout << "Pileup: " << std::endl; |
382 |
< |
float resolution=pileup(events,requireZ,informalname); |
382 |
> |
float resolution=pileup(events,requireZ,informalname,addcut); |
383 |
|
|
384 |
|
dout << "_______________________________________________" << endl; |
385 |
< |
dout << " SUMMARY FOR " << informalname << " with JZB>" << jzbSel << " (all in %) " << endl; |
385 |
> |
dout << " SUMMARY FOR " << informalname << " with JZB>" << jzbSel << " (all in %) "; |
386 |
> |
if(addcut!="") dout << "With additional cut: " << addcut; |
387 |
> |
dout << endl; |
388 |
|
dout << "MC efficiency: " << 100*mceff << "+/-" << 100*mcefferr << endl; |
389 |
|
dout << "Trigger efficiency: " << triggereff << endl; |
390 |
|
dout << "Lepton Sel Eff: " << leptonseleff << endl; |