35 |
|
// Temporarily switch off PU reweighting, if asked |
36 |
|
TCut weightbackup=cutWeight; |
37 |
|
if ( !doPUreweighting ) cutWeight="1.0"; |
38 |
< |
|
38 |
> |
|
39 |
|
TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations"); |
40 |
|
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc, luminosity); |
41 |
|
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity); |
102 |
|
TH1F *RcorrJZBSBeemm; |
103 |
|
TH1F *LcorrJZBSBeemm; |
104 |
|
|
105 |
< |
TH1F *RcorrJZBeemmNoS; |
105 |
> |
// TH1F *RcorrJZBeemmNoS; |
106 |
|
|
107 |
|
if(PlottingSetup::RestrictToMassPeak) { |
108 |
|
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,data, luminosity); |
189 |
|
TIter next(bgleg->GetListOfPrimitives()); |
190 |
|
TObject* obj; |
191 |
|
// Copy the nice bkgd legend skipping the "data" |
192 |
< |
while ( obj = next() ) |
192 |
> |
while ( (obj = next()) ) |
193 |
|
if ( strcmp(((TLegendEntry*)obj)->GetObject()->GetName(),"datahistoOSSF") ) |
194 |
|
kinleg->GetListOfPrimitives()->Add(obj); |
195 |
|
|
208 |
|
TIter next(hmc.GetHists()); |
209 |
|
TObject* obj; |
210 |
|
TH1* hratio = NULL; |
211 |
< |
while ( obj = next() ) { |
211 |
> |
while ( (obj = next()) ) { |
212 |
|
if ( !hratio ) { |
213 |
|
hratio = (TH1*)obj->Clone(); |
214 |
|
hratio->SetName("hratio"); |
269 |
|
TCut cut; |
270 |
|
cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut; |
271 |
|
if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut; |
272 |
+ |
if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut; |
273 |
|
if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF; |
274 |
|
if(filename=="mll") { |
275 |
|
cut=cutOSSF&&cutnJets&&ibasiccut; |
297 |
|
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
298 |
|
if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
299 |
|
if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
300 |
< |
if(filename=="mll_inclusive") datahisto->SetMinimum(1); |
300 |
> |
if(filename=="mll_inclusive"||filename=="mll_inclusive_mm"||filename=="mll_inclusive_ee") datahisto->SetMinimum(1); |
301 |
|
if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
302 |
|
if(filename=="mll_osof") datahisto->SetMinimum(9); |
302 |
– |
|
303 |
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
304 |
|
datahisto->Draw("e1"); |
305 |
|
ckin->Update(); |
430 |
|
bool dolog=true; |
431 |
|
bool nolog=false; |
432 |
|
if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!"); |
433 |
< |
float mll_low=40; |
433 |
> |
float mll_low=50; |
434 |
|
float mll_hi=160; |
435 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
436 |
< |
mll_low=10; |
436 |
> |
mll_low=20; |
437 |
|
mll_hi=210; |
438 |
|
} |
439 |
< |
/* |
439 |
> |
|
440 |
> |
make_kin_plot("met[4]","",40,0,200,dolog,"MET [GeV]","met",doPF,true); |
441 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
442 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
443 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
445 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
446 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
447 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
448 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
449 |
< |
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF);/* |
448 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/2,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
449 |
> |
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
450 |
|
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
451 |
< |
make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
452 |
< |
make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
451 |
> |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
452 |
> |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
453 |
|
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
454 |
|
make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF); |
455 |
|
make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF); |
456 |
|
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF); |
457 |
|
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF); |
458 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF); |
459 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF);*//* |
458 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
459 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
460 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
461 |
|
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
462 |
|
stringstream jzbcut; |
463 |
|
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
472 |
|
stringstream jzbcut3; |
473 |
|
jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
474 |
|
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true); |
475 |
< |
*/ |
475 |
> |
|
476 |
> |
make_special_obs_pred_mll_plot(mcjzb,0); |
477 |
|
make_special_obs_pred_mll_plot(mcjzb,50); |
478 |
|
make_special_obs_pred_mll_plot(mcjzb,100); |
479 |
|
make_special_obs_pred_mll_plot(mcjzb,150); |
550 |
|
|
551 |
|
|
552 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
553 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
553 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
554 |
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut |
555 |
|
float mll_low=50;float mll_high=170; |
556 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
934 |
|
|
935 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
936 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
937 |
+ |
|
938 |
+ |
TH1F *BpredSys = (TH1F*)LcorrJZBeemm->Clone("Bpredsys"); |
939 |
+ |
ClearHisto(BpredSys); |
940 |
+ |
write_error(__FUNCTION__,"Implemented systematic error but NOT drawing it yet. Need to still implement drawing, particularly in ratio."); |
941 |
+ |
|
942 |
|
if(PlottingSetup::RestrictToMassPeak) { |
943 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
944 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
961 |
|
JBpred->Add(JLcorrJZBSBem,-1.0/3.); |
962 |
|
JBpred->Add(JRcorrJZBSBeemm,1.0/3.); |
963 |
|
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.); |
964 |
+ |
|
965 |
+ |
//Systematics: |
966 |
+ |
AddSquared(BpredSys,LcorrJZBeemm,zjetsestimateuncertONPEAK*zjetsestimateuncertONPEAK); |
967 |
+ |
AddSquared(BpredSys,RcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
968 |
+ |
AddSquared(BpredSys,LcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
969 |
+ |
AddSquared(BpredSys,RcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
970 |
+ |
AddSquared(BpredSys,LcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
971 |
+ |
AddSquared(BpredSys,RcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
972 |
+ |
AddSquared(BpredSys,LcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
973 |
|
} else { |
974 |
|
Bpred->Add(RcorrJZBem,1.0); |
975 |
|
Bpred->Add(LcorrJZBem,-1.0); |
979 |
|
//these are for the ratio |
980 |
|
JBpred->Add(JRcorrJZBem,1.0); |
981 |
|
JBpred->Add(JLcorrJZBem,-1.0); |
982 |
+ |
|
983 |
+ |
//Systematics |
984 |
+ |
AddSquared(BpredSys,LcorrJZBeemm,zjetsestimateuncertOFFPEAK*zjetsestimateuncertOFFPEAK); |
985 |
+ |
AddSquared(BpredSys,RcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
986 |
+ |
AddSquared(BpredSys,LcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
987 |
+ |
|
988 |
|
} |
989 |
|
|
990 |
< |
|
990 |
> |
SQRT(BpredSys); |
991 |
> |
|
992 |
|
|
993 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
994 |
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred"); |
1116 |
|
Bpred->Draw("hist,same"); |
1117 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1118 |
|
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1119 |
< |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1119 |
> |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1120 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
1121 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
1122 |
|
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1269 |
|
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal); |
1270 |
|
} else { |
1271 |
|
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
1272 |
+ |
} |
1273 |
|
} |
1274 |
|
|
1275 |
|
void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) { |
1689 |
|
|
1690 |
|
|
1691 |
|
dout << "Going to increase the cross section for diboson samples ... " << endl; |
1692 |
< |
for(int i=0;i<SamplesToBeModified.size();i++) { |
1692 |
> |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
1693 |
|
float origxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1694 |
|
(allsamples.collection)[SamplesToBeModified[i]].xs=origxs*stretchfactor; |
1695 |
|
dout << " Increased xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].filename << " from " << origxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ")" << endl; |
1709 |
|
delete gloca; |
1710 |
|
|
1711 |
|
dout << "Going to reset the cross section for diboson samples ... " << endl; |
1712 |
< |
for(int i=0;i<SamplesToBeModified.size();i++) { |
1712 |
> |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
1713 |
|
float Upxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1714 |
|
(allsamples.collection)[SamplesToBeModified[i]].xs=(allsamples.collection)[SamplesToBeModified[i]].xs*(1.0/stretchfactor); |
1715 |
|
string Upname=(allsamples.collection)[SamplesToBeModified[i]].samplename; |
1806 |
|
string posneg[] = {"pos","neg"}; |
1807 |
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut}; |
1808 |
|
|
1809 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
1809 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
1810 |
|
TCut jzbMC[] = { give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"), give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg") }; |
1811 |
|
dout << "_________________________________________________________" << endl; |
1812 |
|
dout << "Table for JZB> " << jzb_cuts[ijzb] << endl; |
1813 |
< |
for(int isample=0;isample<(allsamples.collection).size();isample++) { |
1813 |
> |
for(int isample=0;isample<(int)(allsamples.collection).size();isample++) { |
1814 |
|
if(!(allsamples.collection)[isample].is_data) dout << (allsamples.collection)[isample].samplename << " & "; |
1815 |
|
else dout << "Sample & "; |
1816 |
|
for(int iregion=0;iregion<nRegions;iregion++) { |
2069 |
|
|
2070 |
|
void draw_ttbar_and_zjets_shape(string mcjzb, string datajzb) { |
2071 |
|
int all_leptons=-1; |
2047 |
– |
int electrons_only=0; |
2048 |
– |
int mu_only=1; |
2049 |
– |
int twojetswith50gev=1; |
2072 |
|
int threejetswith30gev=0; |
2073 |
|
/* |
2074 |
+ |
int twojetswith50gev=1; |
2075 |
+ |
int electrons_only=0; |
2076 |
+ |
int mu_only=1; |
2077 |
+ |
|
2078 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,twojetswith50gev); |
2079 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev); |
2080 |
|
|
2095 |
|
cancorr->SetRightMargin(0.13); |
2096 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2097 |
|
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"); |
2098 |
+ |
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
2099 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
2100 |
|
(allsamples.collection)[allsamples.FindSample("Data")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotd",zptforresponsepresentation); |
2101 |
|
niceresponseplotd->SetStats(0); |
2106 |
|
niceresponseplotd->Draw("COLZ"); |
2107 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
2108 |
|
profd->SetMarkerSize(DataMarkerSize); |
2109 |
< |
profd->Fit("pol0","","same,e1",30,400); |
2109 |
> |
profd->Fit("pol0","","same,e1",100,400); |
2110 |
|
DrawPrelim(); |
2111 |
|
TText* title = write_text(0.5,0.7,"Data"); |
2112 |
|
title->SetTextAlign(12); |
2122 |
|
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_Data"); |
2123 |
|
|
2124 |
|
TH2F *niceresponseplotm = new TH2F("niceresponseplotm","",100,0,600,100,0,5); |
2125 |
< |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation); |
2125 |
> |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation*cutWeight); |
2126 |
|
niceresponseplotm->SetStats(0); |
2127 |
|
niceresponseplotm->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2128 |
|
niceresponseplotm->GetYaxis()->SetTitle("Response"); |
2132 |
|
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt",zptforresponsepresentation,"PROF,same"); |
2133 |
|
TProfile * profm = (TProfile*)niceresponseplotm->ProfileX(); |
2134 |
|
profm->SetMarkerSize(DataMarkerSize); |
2135 |
< |
profm->Fit("pol0","","same,e1",30,400); |
2135 |
> |
profm->Fit("pol0","","same,e1",100,400); |
2136 |
|
DrawMCPrelim(); |
2137 |
|
title = write_text(0.5,0.7,"MC simulation"); |
2138 |
|
title->SetTextAlign(12); |
2168 |
|
allsamples.PickUpEvents(cut); |
2169 |
|
} |
2170 |
|
|
2171 |
< |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError) { |
2171 |
> |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) { |
2172 |
|
dout << "Saving configuration template!" << endl; |
2173 |
|
ofstream configfile; |
2174 |
|
configfile.open("../DistributedModelCalculations/last_configuration.C"); |
2188 |
|
configfile<<"string datajzb=\"datajzb_ERROR\";\n"; |
2189 |
|
configfile<<"string mcjzb=\"mcjzb_ERROR\";\n"; |
2190 |
|
configfile<<"vector<float>jzb_cuts;\n"; |
2191 |
+ |
configfile<<"vector<float>jzb_shape_limit_bins;\n"; |
2192 |
|
configfile<<"float MCPeakError=-999;\n"; |
2193 |
|
configfile<<"float DataPeakError=-999;\n"; |
2194 |
|
configfile<<"}\n\n"; |
2198 |
|
configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n"; |
2199 |
|
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n"; |
2200 |
|
configfile<<"DataPeakError="<<DataPeakError<<";\n\n"; |
2201 |
< |
for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2201 |
> |
for(int i=0;i<(int)jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2202 |
> |
configfile<<"\n\n"; |
2203 |
> |
for(int i=0;i<(int)Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2204 |
> |
for(int i=0;i<(int)Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2205 |
> |
for(int i=0;i<(int)Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2206 |
|
configfile<<"\n\n"; |
2207 |
< |
for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2208 |
< |
for(int i=0;i<Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2209 |
< |
for(int i=0;i<Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2207 |
> |
for(int i=0;i<(int)flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2208 |
> |
for(int i=0;i<(int)flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2209 |
> |
for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2210 |
> |
for(int i=0;i<(int)jzb_shape_limit_bins.size();i++) configfile<<"jzb_shape_limit_bins.push_back("<<jzb_shape_limit_bins[i]<<"); // JZB shape bin boundary at " << jzb_shape_limit_bins[i] << "\n"; |
2211 |
|
configfile<<"\n\n"; |
2179 |
– |
for(int i=0;i<flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2180 |
– |
for(int i=0;i<flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2181 |
– |
for(int i=0;i<flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2212 |
|
configfile<<"\n\n"; |
2213 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
2214 |
|
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
2234 |
|
float max=histos[0]->GetMaximum(); |
2235 |
|
if(manualmin>=0) min=manualmin; |
2236 |
|
else { |
2237 |
< |
for(int i=1;i<histos.size();i++) { |
2237 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2238 |
|
float curmin=get_nonzero_minimum(histos[i]); |
2239 |
|
float curmax=histos[i]->GetMaximum(); |
2240 |
|
if(curmin<min) min=curmin; |
2245 |
|
histos[0]->Draw(drawoption.c_str()); |
2246 |
|
stringstream drawopt; |
2247 |
|
drawopt << drawoption << ",same"; |
2248 |
< |
for(int i=1;i<histos.size();i++) { |
2248 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2249 |
|
histos[i]->Draw(drawopt.str().c_str()); |
2250 |
|
} |
2251 |
|
} |
2254 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
2255 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
2256 |
|
TCut weightbackup=cutWeight; |
2257 |
< |
cutWeight="1.0"; |
2257 |
> |
// cutWeight="1.0"; |
2258 |
|
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2259 |
|
|
2260 |
|
|
2312 |
|
leg->Draw("same"); |
2313 |
|
DrawMCPrelim(simulatedlumi); |
2314 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison"); |
2285 |
– |
cout << __LINE__ << endl; |
2315 |
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
2287 |
– |
cout << __LINE__ << endl; |
2316 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
2289 |
– |
cout << __LINE__ << endl; |
2317 |
|
TH1F *TSeemmcopy; |
2318 |
|
TH1F *TSemcopy; |
2319 |
|
if(PlottingSetup::RestrictToMassPeak) { |
2504 |
|
} |
2505 |
|
|
2506 |
|
|
2507 |
< |
void zjets_prediction_comparison() { |
2507 |
> |
void zjets_prediction_comparison(string mcjzbWithPU) { |
2508 |
> |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2509 |
> |
zcan->SetLogy(1); |
2510 |
> |
TCut weightbackup=cutWeight; |
2511 |
> |
|
2512 |
> |
/* |
2513 |
|
// Do it without PU re-weighting |
2514 |
|
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2515 |
|
stringstream resultsNoPU; |
2516 |
|
|
2517 |
|
stringstream mcjzbnoPU; |
2518 |
< |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,false); |
2518 |
> |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,true); |
2519 |
|
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2520 |
|
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2521 |
|
|
2522 |
|
string mcjzb = mcjzbnoPU.str(); |
2523 |
|
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl; |
2524 |
|
|
2493 |
– |
TCut weightbackup=cutWeight; |
2525 |
|
cutWeight="1.0"; |
2526 |
+ |
*/ |
2527 |
+ |
string mcjzb = mcjzbWithPU; // this is with PURW, if you want without it you have to uncomment the part above (and comment out this line) |
2528 |
|
float sbg_min=0.; |
2529 |
|
float sbg_max=100.; |
2530 |
|
int sbg_nbins=5; |
2534 |
|
TCut kNeg((mcjzb+"<0").c_str()); |
2535 |
|
string var( "abs("+mcjzb+")" ); |
2536 |
|
|
2537 |
< |
TCut kcut(cutmass&&cutOSSF&&"pfJetGoodNum>2"); |
2538 |
< |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2539 |
< |
kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2507 |
< |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2508 |
< |
kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2537 |
> |
TCut kcut(cutmass&&cutOSSF&&cutnJets); |
2538 |
> |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2539 |
> |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2540 |
|
hJZBpos->SetLineColor(kBlack); |
2541 |
|
hJZBneg->SetLineColor(kRed); |
2542 |
|
|
2512 |
– |
Int_t nbins = 5; |
2513 |
– |
Float_t xmax = 100.; |
2514 |
– |
|
2515 |
– |
|
2516 |
– |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2517 |
– |
zcan->SetLogy(1); |
2543 |
|
|
2544 |
|
hJZBpos->Draw("e1"); |
2545 |
|
hJZBneg->Draw("same,hist"); |
2622 |
|
|
2623 |
|
TCanvas *cannie = new TCanvas("cannie","cannie"); |
2624 |
|
|
2625 |
< |
for(int icut=0;icut<jzb_cuts.size();icut++) { |
2625 |
> |
for(int icut=0;icut<(int)jzb_cuts.size();icut++) { |
2626 |
|
float currcut=jzb_cuts[icut]; |
2627 |
|
int nbins=1;float low=currcut; |
2628 |
|
vector<int> mysample; |
2681 |
|
//prediction part |
2682 |
|
if(is_data) cout << "Data prediction & "; |
2683 |
|
if(subselection!="none") cout << subselection << " prediction &"; |
2684 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
2684 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
2685 |
|
|
2686 |
|
cout << endl; |
2687 |
|
//observation part |
2688 |
|
if(is_data) cout << "Data observation & "; |
2689 |
|
if(subselection!="none") cout << subselection << " observation &"; |
2690 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
2690 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
2691 |
|
cout << endl; |
2692 |
|
cout << "_________________________________________________________________" << endl; |
2693 |
|
delete cannie; |
2748 |
|
leg->SetLineColor(kBlack); |
2749 |
|
leg->SetTextFont(62); |
2750 |
|
|
2751 |
< |
for ( int icut=0; icut<jzb_bins.size(); ++icut ) { |
2751 |
> |
for ( int icut=0; icut<(int)jzb_bins.size(); ++icut ) { |
2752 |
|
|
2753 |
|
ostringstream selection; |
2754 |
|
selection << mcjzb << ">" << jzb_bins[icut]; |
2800 |
|
// Calls the above function for each signal sample |
2801 |
|
void plot_jzb_sel_eff(string mcjzb, samplecollection &signalsamples, vector<float> bins ) |
2802 |
|
{ |
2803 |
< |
for (int isignal=0; isignal<signalsamples.collection.size();isignal++) { |
2803 |
> |
for (int isignal=0; isignal<(int)signalsamples.collection.size();isignal++) { |
2804 |
|
dout << "JZB selection efficiency curve: " << std::endl; |
2805 |
|
JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples |
2806 |
|
} |
2843 |
|
TH1F *RcorrJZBSBeemm; |
2844 |
|
TH1F *LcorrJZBSBeemm; |
2845 |
|
|
2846 |
< |
TH1F *RcorrJZBeemmNoS; |
2846 |
> |
// TH1F *RcorrJZBeemmNoS; |
2847 |
|
|
2848 |
|
//these are for the ratio |
2849 |
|
TH1F *JRcorrJZBeemm = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2974 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral() << endl; |
2975 |
|
|
2976 |
|
dout << endl; |
2977 |
< |
for(int i=0;i<bins.size();i++) { |
2977 |
> |
for(int i=0;i<(int)bins.size();i++) { |
2978 |
|
dout << " JZB > " << bins[i] << " : " << endl; |
2979 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
2980 |
|
if(PlottingSetup::RestrictToMassPeak) { |
3022 |
|
leg->SetY2(1.0); |
3023 |
|
|
3024 |
|
|
3025 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
3025 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3026 |
|
string nowname=(allsamples.collection)[isample].filename; |
3027 |
|
cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl; |
3028 |
|
individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
3046 |
|
ptsancan->cd(2); |
3047 |
|
fpt2->Draw(); |
3048 |
|
|
3049 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
3049 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3050 |
|
ptsancan->cd(1); |
3051 |
|
individualpt1histos[isample]->DrawNormalized("same,histo"); |
3052 |
|
ptsancan->cd(2); |
3062 |
|
void do_mlls_plot(string mcjzb) { |
3063 |
|
cout << "At this point we'd plot the mll distribution" << endl; |
3064 |
|
TCanvas *sigcan = new TCanvas("sigcan","sigcan"); |
3065 |
< |
for(int isig=0;isig<(signalsamples.collection).size();isig++) { |
3065 |
> |
for(int isig=0;isig<(int)(signalsamples.collection).size();isig++) { |
3066 |
|
if(!(signalsamples.collection)[isig].events) continue; |
3067 |
|
string nowname=(signalsamples.collection)[isig].filename; |
3068 |
|
TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname)); |
3101 |
|
findme.push_back("TTJets"); |
3102 |
|
findme.push_back("LM"); |
3103 |
|
|
3104 |
< |
for(int ifind=0;ifind<findme.size();ifind++) { |
3104 |
> |
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
3105 |
|
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
3106 |
|
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
3107 |
< |
for(int isel=0;isel<selsamples.size();isel++) { |
3107 |
> |
for(int isel=0;isel<(int)selsamples.size();isel++) { |
3108 |
|
cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
3109 |
|
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF); |
3110 |
|
} |