254 |
|
draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.05",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz__mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
255 |
|
} |
256 |
|
|
257 |
< |
Value get_Zb_data_over_mc(string variable, TCut cut) { |
257 |
> |
/*double GetMedian(TH1F *histo) { |
258 |
> |
int numBins = histo->GetXaxis()->GetNbins(); |
259 |
> |
Double_t x[numBins]; |
260 |
> |
Double_t y[numBins]; |
261 |
> |
for (int i = 1; i <= numBins; i++) { |
262 |
> |
x[i] = histo->GetBinCenter(i); |
263 |
> |
y[i] = histo->GetBinContent(i); |
264 |
> |
} |
265 |
> |
return TMath::Median(numBins, &x, &y); |
266 |
> |
}*/ |
267 |
> |
|
268 |
> |
Value get_Zb_data_over_mc(string variable, string variable2, TCut cut, string saveas) { |
269 |
|
// write_warning(__FUNCTION__,"Debugging this function, therefore always returning 3.1415+/-1.010101"); return Value(3.1415,1.010101); |
270 |
< |
TH1F *hdata = allsamples.Draw("hdata",variable,1000,0,30, "#alpha [GeV]", "events", cut,data,luminosity); |
271 |
< |
TH1F *hmc = allsamples.Draw("hmc" , variable,1000,0,30, "#alpha [GeV]", "events", cut,mc, luminosity); |
270 |
> |
TCanvas *cn = new TCanvas("cn","cn"); |
271 |
> |
string varname="MPF"; |
272 |
> |
if(Contains(variable,"pfJetGood")) varname="R_{abs}"; |
273 |
> |
TH1F *hdata = allsamples.Draw("hdata",variable,1200,0,30, varname, "events", cut,data,luminosity); |
274 |
> |
TH1F *hmc = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc, luminosity); |
275 |
|
|
276 |
|
float a=hdata->GetMean(); |
277 |
|
float b=hmc->GetMean(); |
279 |
|
float db=hmc->GetMeanError(); |
280 |
|
float factor = a / b; |
281 |
|
float error = TMath::Sqrt( (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db); |
282 |
+ |
|
283 |
+ |
cn->cd(); |
284 |
+ |
hdata->GetYaxis()->SetTitle("events / 0.1"); |
285 |
+ |
hdata->Rebin(4); |
286 |
+ |
hmc->Rebin(4); |
287 |
+ |
hdata->GetXaxis()->SetRangeUser(0,2); |
288 |
+ |
hdata->Draw("e1"); |
289 |
+ |
hmc->Draw("histo,same"); |
290 |
+ |
hdata->Draw("e1,same"); |
291 |
+ |
stringstream summary; |
292 |
+ |
summary << "#splitline{" << varname << "}{#splitline{data: " << std::setprecision(4) << a << " #pm " << std::setprecision(4) << da << "}{#splitline{mc: " << std::setprecision(4) << b << " #pm " << std::setprecision(4) << db << "}{ratio: " << factor; |
293 |
+ |
summary << " #pm " << error << "}}}"; |
294 |
+ |
TText *infobox = write_title(summary.str()); |
295 |
+ |
infobox->SetX(0.75); |
296 |
+ |
infobox->SetTextSize(0.03); |
297 |
+ |
infobox->SetY(0.75); |
298 |
+ |
infobox->Draw(); |
299 |
+ |
|
300 |
+ |
|
301 |
+ |
DrawPrelim(); |
302 |
+ |
CompleteSave(cn,"ResponsePlots/"+saveas); |
303 |
+ |
|
304 |
+ |
cout << "Data;" << a << ";"<<da<<";MC"<<b<<";"<<db<<endl; |
305 |
+ |
delete cn; |
306 |
|
delete hdata; |
307 |
|
delete hmc; |
308 |
|
|
341 |
|
stringstream specialcut; |
342 |
|
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (Zb3010_alpha<" << alphacuts[ia] << "))"; |
343 |
|
cout << specialcut.str() << endl; |
344 |
< |
Value MPF_data_over_mc = get_Zb_data_over_mc("mpf",TCut(basecut && specialcut.str().c_str())); |
345 |
< |
Value RABS_data_over_mc = get_Zb_data_over_mc("Zb3010_pfJetGoodPt[0]/pt",TCut(basecut && specialcut.str().c_str())); |
344 |
> |
Value MPF_data_over_mc = get_Zb_data_over_mc("mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia])); |
345 |
> |
Value RABS_data_over_mc = get_Zb_data_over_mc("Zb3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia])); |
346 |
|
|
347 |
|
MPF_Results[ia][ipt]=MPF_data_over_mc.getValue(); |
348 |
|
MPF_Errors[ia][ipt]=MPF_data_over_mc.getError(); |
903 |
|
|
904 |
|
} |
905 |
|
|
906 |
< |
void do_basic_ZB_analysis() { |
906 |
> |
void do_basic_ZB_analysis(int do_inclusive) { |
907 |
|
|
908 |
+ |
//https://twiki.cern.ch/twiki/bin/viewauth/CMS/BtagPOG#2011_Data_and_MC |
909 |
+ |
//https://twiki.cern.ch/twiki/pub/CMS/BtagPOG/SFb-ttbar_payload.txt |
910 |
+ |
|
911 |
+ |
if(do_inclusive) { |
912 |
+ |
LeadingB=TCut("Zb3010_bTagProbCSVBP[0]>=-10000"); |
913 |
+ |
cutWeight=TCut("(weight*(weight<1000)*(is_data+(!is_data)*((id1==id2&&id1==0)*0.95+(id1==id2&&id1==1)*0.88+(id1!=id2)*0.92)))"); |
914 |
+ |
write_info(__FUNCTION__,"Inclusive selection - no btag requirement, no btag efficiency/mistag correction (weight)"); |
915 |
+ |
} else { |
916 |
+ |
LeadingB=TCut("Zb3010_bTagProbCSVBP[0]>0.898"); |
917 |
+ |
cutWeight=TCut("(weight*(weight<1000)*(is_data+(!is_data)*((id1==id2&&id1==0)*0.95+(id1==id2&&id1==1)*0.88+(id1!=id2)*0.92)*Zb3010_BTagWgt))"); |
918 |
+ |
write_info(__FUNCTION__,"Exclusive selection - switched on btag requirement and btag efficiency/mistag correction (weight)"); |
919 |
+ |
} |
920 |
+ |
|
921 |
+ |
bool doquick=true; |
922 |
|
|
923 |
|
TCanvas *zbcanvas = new TCanvas("zbcanvas","zbcanvas"); |
924 |
|
|
936 |
|
// compare_selection("Zb3010"); |
937 |
|
// compare_selection("Zb40"); |
938 |
|
|
939 |
< |
|
940 |
< |
print_all_b_yields(); |
941 |
< |
draw_mpf_vars(); |
942 |
< |
// DrawEvilCutFlow(); |
943 |
< |
|
944 |
< |
draw_Zb_kin_vars(); |
939 |
> |
if(!doquick) { |
940 |
> |
print_all_b_yields(); |
941 |
> |
draw_mpf_vars(); |
942 |
> |
// DrawEvilCutFlow(); |
943 |
> |
|
944 |
> |
draw_Zb_kin_vars(); |
945 |
> |
|
946 |
> |
} |
947 |
|
|
948 |
|
new_data_mc_agreement_2d(); |
949 |
|
|
950 |
< |
|
950 |
> |
write_error(__FUNCTION__,"Need to implement switch for inclusive result; inclusive result needs to have btag efficiency reweighting deactivated!"); |
951 |
|
delete zbcanvas; |
952 |
|
} |
953 |
|
|