35 |
|
// Temporarily switch off PU reweighting, if asked |
36 |
|
TCut weightbackup=cutWeight; |
37 |
|
if ( !doPUreweighting ) cutWeight="1.0"; |
38 |
< |
|
38 |
> |
|
39 |
> |
int nbins=100; |
40 |
> |
if(PlottingSetup::DoBTag) nbins=25; |
41 |
> |
|
42 |
|
TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations"); |
43 |
< |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc, luminosity); |
44 |
< |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity); |
45 |
< |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc, luminosity); |
46 |
< |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity); |
43 |
> |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc, luminosity); |
44 |
> |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity); |
45 |
> |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc, luminosity); |
46 |
> |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity); |
47 |
|
TH1F *rawttbarjzbeemmMC; |
48 |
|
|
49 |
|
if(method==doKM) { |
50 |
|
//we only need this histo for the KM fitting... |
51 |
< |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,100, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample("TTJet")); |
51 |
> |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,nbins, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample("TTJet")); |
52 |
|
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
53 |
|
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
54 |
|
} |
75 |
|
delete tempcan; |
76 |
|
} |
77 |
|
|
78 |
+ |
void make_special_obs_pred_mll_plot(string mcjzb, float jzbthreshold) { |
79 |
+ |
float min=70.0; |
80 |
+ |
float max=115.0; |
81 |
+ |
if(!PlottingSetup::RestrictToMassPeak) { |
82 |
+ |
min=10; |
83 |
+ |
max=150; |
84 |
+ |
} |
85 |
+ |
int nbins=int((max-min)/5); |
86 |
+ |
|
87 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
88 |
+ |
|
89 |
+ |
stringstream largerzeroS; |
90 |
+ |
largerzeroS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
91 |
+ |
TCut largerzero(largerzeroS.str().c_str()); |
92 |
+ |
|
93 |
+ |
stringstream smallerzeroS; |
94 |
+ |
smallerzeroS << "(" << mcjzb << "<-" << jzbthreshold << ")"; |
95 |
+ |
TCut smallerzero(smallerzeroS.str().c_str()); |
96 |
+ |
|
97 |
+ |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,data,luminosity); |
98 |
+ |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,mc,luminosity); |
99 |
+ |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,data,luminosity); |
100 |
+ |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,data,luminosity); |
101 |
+ |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,data,luminosity); |
102 |
+ |
|
103 |
+ |
TH1F *RcorrJZBSBem; |
104 |
+ |
TH1F *LcorrJZBSBem; |
105 |
+ |
TH1F *RcorrJZBSBeemm; |
106 |
+ |
TH1F *LcorrJZBSBeemm; |
107 |
+ |
|
108 |
+ |
// TH1F *RcorrJZBeemmNoS; |
109 |
+ |
|
110 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
111 |
+ |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,data, luminosity); |
112 |
+ |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,data, luminosity); |
113 |
+ |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,data, luminosity); |
114 |
+ |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,data, luminosity); |
115 |
+ |
} |
116 |
+ |
|
117 |
+ |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
118 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
119 |
+ |
Bpred->Add(RcorrJZBem,1.0/3.); |
120 |
+ |
Bpred->Add(LcorrJZBem,-1.0/3.); |
121 |
+ |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
122 |
+ |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
123 |
+ |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
124 |
+ |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
125 |
+ |
} else { |
126 |
+ |
Bpred->Add(RcorrJZBem,1.0); |
127 |
+ |
Bpred->Add(LcorrJZBem,-1.0); |
128 |
+ |
} |
129 |
+ |
|
130 |
+ |
Bpred->SetLineColor(kRed); |
131 |
+ |
|
132 |
+ |
RcorrJZBeemm->Draw(); |
133 |
+ |
mcRcorrJZBeemm.Draw("same"); |
134 |
+ |
Bpred->Draw("histo,same"); |
135 |
+ |
RcorrJZBeemm->Draw("same"); |
136 |
+ |
|
137 |
+ |
TLegend *leg = allsamples.allbglegend(); |
138 |
+ |
leg->SetX1(0.58); |
139 |
+ |
leg->AddEntry(RcorrJZBeemm,"observed (data)","l"); |
140 |
+ |
leg->AddEntry(Bpred,"predicted (data)","l"); |
141 |
+ |
leg->Draw("same"); |
142 |
+ |
|
143 |
+ |
stringstream saveas; |
144 |
+ |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold; |
145 |
+ |
CompleteSave(ckin,saveas.str()); |
146 |
+ |
|
147 |
+ |
delete RcorrJZBeemm; |
148 |
+ |
delete LcorrJZBeemm; |
149 |
+ |
delete RcorrJZBem; |
150 |
+ |
delete LcorrJZBem; |
151 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
152 |
+ |
delete RcorrJZBSBeemm; |
153 |
+ |
delete LcorrJZBSBeemm; |
154 |
+ |
delete RcorrJZBSBem; |
155 |
+ |
delete LcorrJZBSBem; |
156 |
+ |
} |
157 |
+ |
delete Bpred; |
158 |
+ |
delete ckin; |
159 |
+ |
} |
160 |
+ |
|
161 |
|
void make_special_mll_plot(int nbins, float min, float max, bool logscale,string xlabel) { |
162 |
|
|
163 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
192 |
|
TIter next(bgleg->GetListOfPrimitives()); |
193 |
|
TObject* obj; |
194 |
|
// Copy the nice bkgd legend skipping the "data" |
195 |
< |
while ( obj = next() ) |
195 |
> |
while ( (obj = next()) ) |
196 |
|
if ( strcmp(((TLegendEntry*)obj)->GetObject()->GetName(),"datahistoOSSF") ) |
197 |
|
kinleg->GetListOfPrimitives()->Add(obj); |
198 |
|
|
211 |
|
TIter next(hmc.GetHists()); |
212 |
|
TObject* obj; |
213 |
|
TH1* hratio = NULL; |
214 |
< |
while ( obj = next() ) { |
214 |
> |
while ( (obj = next()) ) { |
215 |
|
if ( !hratio ) { |
216 |
|
hratio = (TH1*)obj->Clone(); |
217 |
|
hratio->SetName("hratio"); |
272 |
|
TCut cut; |
273 |
|
cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut; |
274 |
|
if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut; |
275 |
+ |
if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut; |
276 |
|
if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF; |
277 |
|
if(filename=="mll") { |
278 |
|
cut=cutOSSF&&cutnJets&&ibasiccut; |
284 |
|
draw_separation_lines=true; |
285 |
|
} |
286 |
|
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
287 |
< |
if(filename=="mll_aboveJZB100") cut=cutOSSF&&cutnJets&&ibasiccut; |
287 |
> |
if(Contains(filename,"mll_aboveJZB100")) cut=cutOSSF&&cutnJets&&ibasiccut; |
288 |
> |
if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut; |
289 |
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF; |
290 |
|
if(filename=="mll_inclusive_osof") cut=cutOSOF; |
291 |
|
if(filename=="mll_inclusive_ee") cut=cutOSSF&&"id1==0"; |
300 |
|
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
301 |
|
if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
302 |
|
if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
303 |
< |
if(filename=="mll_inclusive") datahisto->SetMinimum(1); |
303 |
> |
if(filename=="mll_inclusive"||filename=="mll_inclusive_mm"||filename=="mll_inclusive_ee") datahisto->SetMinimum(1); |
304 |
|
if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
305 |
|
if(filename=="mll_osof") datahisto->SetMinimum(9); |
218 |
– |
|
306 |
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
307 |
|
datahisto->Draw("e1"); |
308 |
|
ckin->Update(); |
382 |
|
delete ckin; |
383 |
|
} |
384 |
|
|
298 |
– |
|
385 |
|
void make_JES_plot() { |
386 |
|
|
387 |
|
int nbins=10; |
433 |
|
bool dolog=true; |
434 |
|
bool nolog=false; |
435 |
|
if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!"); |
436 |
< |
float mll_low=40; |
436 |
> |
float mll_low=50; |
437 |
|
float mll_hi=160; |
438 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
439 |
< |
mll_low=30; |
440 |
< |
mll_hi=180; |
439 |
> |
mll_low=20; |
440 |
> |
mll_hi=210; |
441 |
|
} |
442 |
+ |
|
443 |
+ |
make_kin_plot("met[4]","",40,0,200,dolog,"MET [GeV]","met",doPF,true); |
444 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
445 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
446 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
448 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
449 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
450 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
451 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
451 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/2,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
452 |
|
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
453 |
< |
make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
454 |
< |
make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
453 |
> |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
454 |
> |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
455 |
> |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
456 |
|
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
457 |
|
make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF); |
458 |
|
make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF); |
459 |
|
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF); |
460 |
|
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF); |
461 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF); |
462 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
461 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
462 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
463 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
464 |
|
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
465 |
|
stringstream jzbcut; |
466 |
|
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
467 |
|
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
468 |
+ |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
469 |
+ |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
470 |
+ |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
471 |
+ |
stringstream jzbcut2; |
472 |
+ |
jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
473 |
+ |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
474 |
+ |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB150",doPF,true); |
475 |
+ |
stringstream jzbcut3; |
476 |
+ |
jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
477 |
+ |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); |
478 |
+ |
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); |
479 |
+ |
|
480 |
+ |
make_special_obs_pred_mll_plot(mcjzb,0); |
481 |
+ |
make_special_obs_pred_mll_plot(mcjzb,50); |
482 |
+ |
make_special_obs_pred_mll_plot(mcjzb,100); |
483 |
+ |
make_special_obs_pred_mll_plot(mcjzb,150); |
484 |
+ |
make_special_obs_pred_mll_plot(mcjzb,200); |
485 |
+ |
make_special_obs_pred_mll_plot(mcjzb,250); |
486 |
|
} |
487 |
|
|
488 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
554 |
|
|
555 |
|
|
556 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
557 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
557 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
558 |
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut |
559 |
|
float mll_low=50;float mll_high=170; |
560 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
861 |
|
return return_functions; |
862 |
|
} |
863 |
|
|
864 |
< |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false ) |
864 |
> |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
865 |
|
{ |
866 |
+ |
// note: sigma is not used ATM |
867 |
|
switch_overunderflow(true); |
868 |
|
bool is_data=false; |
869 |
|
bool use_signal=false; |
938 |
|
|
939 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
940 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
941 |
+ |
|
942 |
+ |
TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]); |
943 |
+ |
ClearHisto(BpredSys); |
944 |
+ |
|
945 |
|
if(PlottingSetup::RestrictToMassPeak) { |
946 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
947 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
964 |
|
JBpred->Add(JLcorrJZBSBem,-1.0/3.); |
965 |
|
JBpred->Add(JRcorrJZBSBeemm,1.0/3.); |
966 |
|
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.); |
967 |
+ |
|
968 |
+ |
//Systematics: |
969 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertONPEAK*zjetsestimateuncertONPEAK); |
970 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
971 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
972 |
+ |
AddSquared(BpredSys,JRcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
973 |
+ |
AddSquared(BpredSys,JLcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
974 |
+ |
AddSquared(BpredSys,JRcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
975 |
+ |
AddSquared(BpredSys,JLcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
976 |
|
} else { |
977 |
|
Bpred->Add(RcorrJZBem,1.0); |
978 |
|
Bpred->Add(LcorrJZBem,-1.0); |
982 |
|
//these are for the ratio |
983 |
|
JBpred->Add(JRcorrJZBem,1.0); |
984 |
|
JBpred->Add(JLcorrJZBem,-1.0); |
985 |
+ |
|
986 |
+ |
//Systematics |
987 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertOFFPEAK*zjetsestimateuncertOFFPEAK); |
988 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
989 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
990 |
+ |
|
991 |
|
} |
992 |
|
|
993 |
< |
|
993 |
> |
SQRT(BpredSys); |
994 |
> |
BpredSys->Divide(JBpred); |
995 |
> |
|
996 |
|
|
997 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
998 |
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred"); |
1037 |
|
blankback->Draw(); |
1038 |
|
if(use_data==1) |
1039 |
|
{ |
1040 |
+ |
//Bpred->SetLineWidth(3); //paper style.overruled. |
1041 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style.overruled. |
1042 |
|
analytical_function = do_extended_fit_to_plot(Bpred,Tpred,LcorrJZBeemm,LcorrJZBem,is_data); |
1043 |
|
kinpad->cd();//necessary because the extended fit function creates its own canvas |
1044 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1045 |
|
|
1046 |
|
Bpred->Draw("hist,same"); |
1047 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1047 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1048 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1049 |
|
lm4RcorrJZBeemm->Draw("hist,same"); |
1050 |
|
legBpred->AddEntry(RcorrJZBeemm,"observed","p"); |
1051 |
|
legBpred->AddEntry(Bpred,"predicted","l"); |
1052 |
< |
legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1053 |
< |
legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
1054 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1052 |
> |
// legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1053 |
> |
// legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
1054 |
> |
legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1055 |
|
legBpred->Draw(); |
1056 |
|
DrawPrelim(); |
1057 |
|
|
1080 |
|
Bpred->Draw("hist,same"); |
1081 |
|
// analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1082 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1083 |
< |
// TH1F *lm4RcorrJZBeemmC = (TH1F*)lm4RcorrJZBeemm->Clone("lm4RcorrJZBeemmC"); |
952 |
< |
// lm4RcorrJZBeemmC->SetLineColor(kOrange+1); |
953 |
< |
lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
954 |
< |
// lm4RcorrJZBeemmC->Draw("histo,same"); |
1083 |
> |
// lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
1084 |
|
lm4RcorrJZBeemm->SetLineWidth(2); |
1085 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled. |
1086 |
|
lm4RcorrJZBeemm->Draw("histo,same"); |
1087 |
|
DrawPrelim(); |
1088 |
|
TLegend *speciallegBpred = make_legend("",0.45,0.55); |
1089 |
+ |
//TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled. |
1090 |
|
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
1091 |
|
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
1092 |
|
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
1094 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
1095 |
|
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1096 |
|
speciallegBpred->Draw(); |
1097 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,"Bpred_Data_____PredictionComposition",true,use_data!=1,"data/pred"); |
1097 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys); |
1098 |
|
|
1099 |
|
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1100 |
|
THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1105 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1106 |
|
legBpred->Draw(); |
1107 |
|
DrawPrelim(); |
1108 |
< |
CompleteSave(specialcanv,"Bpred_Data_____PredictionCompositioninMC"); |
1108 |
> |
CompleteSave(specialcanv,subdir+"Bpred_Data_____PredictionCompositioninMC"); |
1109 |
|
Bpred->SetLineWidth((int)CurrentBpredLineWidth); |
1110 |
|
|
1111 |
|
delete speciallegBpred; |
1116 |
|
} |
1117 |
|
if(use_data==0) { |
1118 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1119 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1120 |
|
Bpred->Draw("hist,same"); |
1121 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1122 |
|
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1123 |
< |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1123 |
> |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1124 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
1125 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
1126 |
|
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1131 |
|
} |
1132 |
|
if(use_data==2) { |
1133 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1134 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1135 |
|
Bpred->Draw("hist,same"); |
1136 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1137 |
|
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1147 |
|
// CompleteSave(globalcanvas,"Bpred_MCwithS"); // done below in save_with_ratio |
1148 |
|
} |
1149 |
|
{ |
1150 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style. overruled. |
1151 |
+ |
//RcorrJZBeemmNoS->SetLineWidth(3); //paper style. overruled. |
1152 |
+ |
//lm4RcorrJZBeemm->SetLineStyle(2); //paper style. overruled. |
1153 |
+ |
//RcorrJZBeemmNoS->SetLineStyle(3); //paper style. overruled. |
1154 |
+ |
//lm4RcorrJZBeemm->SetLineColor(kOrange+1); //paper style. overruled. |
1155 |
+ |
|
1156 |
|
RcorrJZBeemmNoS->SetLineStyle(2); |
1157 |
|
legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l"); |
1158 |
|
legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
1172 |
|
string ytitle("ratio"); |
1173 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
1174 |
|
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1175 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,false,ytitle);//not extending the y range anymore up to 4 |
1175 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,true,ytitle,BpredSys);//not extending the y range anymore up to 4 |
1176 |
|
|
1177 |
|
|
1178 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1179 |
< |
/// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1180 |
< |
if(!PlottingSetup::RestrictToMassPeak) return; |
1181 |
< |
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1182 |
< |
Bpredem->Add(RcorrJZBem); |
1183 |
< |
Bpredem->Add(LcorrJZBem,-1); |
1184 |
< |
TH1F *BpredSBem = (TH1F*)LcorrJZBeemm->Clone("BpredSBem"); |
1185 |
< |
BpredSBem->Add(RcorrJZBSBem); |
1186 |
< |
Bpred->Add(LcorrJZBSBem,-1); |
1187 |
< |
TH1F *BpredSBeemm = (TH1F*)LcorrJZBeemm->Clone("BpredSBeemm"); |
1188 |
< |
BpredSBeemm->Add(RcorrJZBSBeemm); |
1189 |
< |
BpredSBeemm->Add(LcorrJZBSBeemm,-1.0); |
1190 |
< |
globalcanvas->cd(); |
1191 |
< |
globalcanvas->SetLogy(1); |
1192 |
< |
|
1193 |
< |
RcorrJZBeemm->SetMarkerStyle(20); |
1194 |
< |
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high); |
1195 |
< |
blankback->Draw(); |
1196 |
< |
RcorrJZBeemm->Draw("e1x0,same"); |
1197 |
< |
RcorrJZBeemm->SetMarkerSize(DataMarkerSize); |
1198 |
< |
|
1199 |
< |
Bpredem->SetLineColor(kRed+1); |
1200 |
< |
Bpredem->SetStats(0); |
1201 |
< |
Bpredem->Draw("hist,same"); |
1202 |
< |
|
1203 |
< |
BpredSBem->SetLineColor(kGreen+2);//TColor::GetColor("#0B6138")); |
1204 |
< |
BpredSBem->SetLineStyle(2); |
1205 |
< |
BpredSBem->Draw("hist,same"); |
1206 |
< |
|
1207 |
< |
BpredSBeemm->SetLineColor(kBlue+1); |
1208 |
< |
BpredSBeemm->SetLineStyle(3); |
1209 |
< |
BpredSBeemm->Draw("hist,same"); |
1210 |
< |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1211 |
< |
|
1212 |
< |
TLegend *legBpredc = make_legend("",0.6,0.55); |
1213 |
< |
if(use_data==1) |
1214 |
< |
{ |
1215 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
1216 |
< |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
1217 |
< |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
1218 |
< |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
1219 |
< |
legBpredc->Draw(); |
1220 |
< |
CompleteSave(globalcanvas,"Bpred_Data_comparison"); |
1221 |
< |
} |
1222 |
< |
if(use_data==0) { |
1223 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1224 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1225 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1226 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1227 |
< |
legBpredc->Draw(); |
1228 |
< |
CompleteSave(globalcanvas,"Bpred_MC_comparison"); |
1229 |
< |
} |
1230 |
< |
if(use_data==2) { |
1231 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1232 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1233 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1234 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1235 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1236 |
< |
legBpredc->Draw(); |
1237 |
< |
CompleteSave(globalcanvas,"Bpred_MCwithS_comparison"); |
1179 |
> |
// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1180 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
1181 |
> |
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1182 |
> |
Bpredem->Add(RcorrJZBem); |
1183 |
> |
Bpredem->Add(LcorrJZBem,-1); |
1184 |
> |
TH1F *BpredSBem = (TH1F*)LcorrJZBeemm->Clone("BpredSBem"); |
1185 |
> |
BpredSBem->Add(RcorrJZBSBem); |
1186 |
> |
Bpred->Add(LcorrJZBSBem,-1); |
1187 |
> |
TH1F *BpredSBeemm = (TH1F*)LcorrJZBeemm->Clone("BpredSBeemm"); |
1188 |
> |
BpredSBeemm->Add(RcorrJZBSBeemm); |
1189 |
> |
BpredSBeemm->Add(LcorrJZBSBeemm,-1.0); |
1190 |
> |
globalcanvas->cd(); |
1191 |
> |
globalcanvas->SetLogy(1); |
1192 |
> |
|
1193 |
> |
RcorrJZBeemm->SetMarkerStyle(20); |
1194 |
> |
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high); |
1195 |
> |
blankback->Draw(); |
1196 |
> |
RcorrJZBeemm->Draw("e1x0,same"); |
1197 |
> |
RcorrJZBeemm->SetMarkerSize(DataMarkerSize); |
1198 |
> |
|
1199 |
> |
Bpredem->SetLineColor(kRed+1); |
1200 |
> |
Bpredem->SetStats(0); |
1201 |
> |
Bpredem->Draw("hist,same"); |
1202 |
> |
|
1203 |
> |
BpredSBem->SetLineColor(kGreen+2);//TColor::GetColor("#0B6138")); |
1204 |
> |
BpredSBem->SetLineStyle(2); |
1205 |
> |
BpredSBem->Draw("hist,same"); |
1206 |
> |
|
1207 |
> |
BpredSBeemm->SetLineColor(kBlue+1); |
1208 |
> |
BpredSBeemm->SetLineStyle(3); |
1209 |
> |
BpredSBeemm->Draw("hist,same"); |
1210 |
> |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1211 |
> |
|
1212 |
> |
TLegend *legBpredc = make_legend("",0.6,0.55); |
1213 |
> |
if(use_data==1) |
1214 |
> |
{ |
1215 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
1216 |
> |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
1217 |
> |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
1218 |
> |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
1219 |
> |
legBpredc->Draw(); |
1220 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_Data_comparison"); |
1221 |
> |
} |
1222 |
> |
if(use_data==0) { |
1223 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1224 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1225 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1226 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1227 |
> |
legBpredc->Draw(); |
1228 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_MC_comparison"); |
1229 |
> |
} |
1230 |
> |
if(use_data==2) { |
1231 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1232 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1233 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1234 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1235 |
> |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1236 |
> |
legBpredc->Draw(); |
1237 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison"); |
1238 |
> |
} |
1239 |
|
} |
1240 |
+ |
|
1241 |
|
delete RcorrJZBeemm; |
1242 |
|
delete LcorrJZBeemm; |
1243 |
|
delete RcorrJZBem; |
1268 |
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) { |
1269 |
|
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
1270 |
|
do_prediction_plot(datajzb,globalcanvas,DataSigma,jzbHigh ,data,overlay_signal); |
1271 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal); |
1272 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal); |
1271 |
> |
if ( !PlottingSetup::Approved ) { |
1272 |
> |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal); |
1273 |
> |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal); |
1274 |
> |
} else { |
1275 |
> |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
1276 |
> |
} |
1277 |
|
} |
1278 |
|
|
1279 |
|
void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) { |
1623 |
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str()); |
1624 |
|
writeline1->SetTextSize(0.035); |
1625 |
|
writeline1->Draw(); |
1626 |
< |
save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
1626 |
> |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
1627 |
> |
else save_with_ratio(datahisto,mcstack,jzbpad->cd(),savename); |
1628 |
|
TPad *jzbpad2 = new TPad("jzbpad2","jzbpad2",0,0,1,1); |
1629 |
|
jzbpad2->cd(); |
1630 |
|
jzbpad2->SetLogy(1); |
1639 |
|
writeline1->SetTextSize(0.035); |
1640 |
|
writeline1->Draw(); |
1641 |
|
DrawPrelim(); |
1642 |
< |
save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
1642 |
> |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
1643 |
> |
else save_with_ratio(datahisto,mcstack,jzbpad2->cd(),(savename+"__PosOnly")); |
1644 |
|
datahisto->Delete(); |
1645 |
|
mcstack.Delete(); |
1646 |
|
} |
1648 |
|
Double_t GausR(Double_t *x, Double_t *par) { |
1649 |
|
return gRandom->Gaus(x[0],par[0]); |
1650 |
|
} |
1651 |
+ |
|
1652 |
+ |
void produce_stretched_jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1653 |
+ |
TCanvas *dican = new TCanvas("dican","JZB Plots Canvas"); |
1654 |
+ |
float max=jzbHigh ; |
1655 |
+ |
float min=-120; |
1656 |
+ |
int nbins=(int)((max-min)/5.0); // we want 5 GeV/bin |
1657 |
+ |
int coarserbins=int(nbins/2.0); |
1658 |
+ |
int rebinnedbins=int(nbins/4.0); |
1659 |
+ |
|
1660 |
+ |
vector<float>binning;vector<float>coarse_binning;vector<float>coarsest_binning; |
1661 |
+ |
for(int i=0;i<=nbins;i++)binning.push_back(min+i*(max-min)/((float)nbins)); |
1662 |
+ |
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
1663 |
+ |
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
1664 |
+ |
|
1665 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP",dican,binning); |
1666 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP",dican,binning); |
1667 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_SFZP",dican,binning); |
1668 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning); |
1669 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning); |
1670 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning); |
1671 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
1672 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
1673 |
+ |
|
1674 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning); |
1675 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning); |
1676 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
1677 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
1678 |
+ |
|
1679 |
+ |
delete dican; |
1680 |
+ |
} |
1681 |
|
|
1682 |
+ |
|
1683 |
+ |
void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1684 |
+ |
vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ"); |
1685 |
+ |
|
1686 |
+ |
if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) { |
1687 |
+ |
write_error(__FUNCTION__,"Could not find any diboson samples - aborting diboson plots"); |
1688 |
+ |
return; |
1689 |
+ |
} |
1690 |
+ |
|
1691 |
+ |
float stretchfactor = 100.0; |
1692 |
+ |
vector<string> labels; |
1693 |
+ |
|
1694 |
+ |
|
1695 |
+ |
dout << "Going to increase the cross section for diboson samples ... " << endl; |
1696 |
+ |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
1697 |
+ |
float origxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1698 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].xs=origxs*stretchfactor; |
1699 |
+ |
dout << " Increased xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].filename << " from " << origxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ")" << endl; |
1700 |
+ |
labels.push_back((allsamples.collection)[SamplesToBeModified[i]].samplename); |
1701 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].samplename=any2string(int(stretchfactor))+" x "+(allsamples.collection)[SamplesToBeModified[i]].samplename; |
1702 |
+ |
dout << " (also renamed it to " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " )" << endl; |
1703 |
+ |
} |
1704 |
+ |
|
1705 |
+ |
dout << "Going to produce JZB plots" << endl; |
1706 |
+ |
produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning); |
1707 |
+ |
TCanvas *gloca = new TCanvas("gloca","gloca"); |
1708 |
+ |
float sigma=123456; |
1709 |
+ |
|
1710 |
+ |
dout << "Going to produce prediction plots" << endl; |
1711 |
+ |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
1712 |
+ |
do_prediction_plot(mcjzb, gloca, sigma, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
1713 |
+ |
delete gloca; |
1714 |
+ |
|
1715 |
+ |
dout << "Going to reset the cross section for diboson samples ... " << endl; |
1716 |
+ |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
1717 |
+ |
float Upxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1718 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].xs=(allsamples.collection)[SamplesToBeModified[i]].xs*(1.0/stretchfactor); |
1719 |
+ |
string Upname=(allsamples.collection)[SamplesToBeModified[i]].samplename; |
1720 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].samplename=labels[i]; |
1721 |
+ |
dout << " Reset xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " from " << Upxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ") and reset the correct name (from " << Upname << ")" << endl; |
1722 |
+ |
|
1723 |
+ |
} |
1724 |
+ |
|
1725 |
+ |
} |
1726 |
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1727 |
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas"); |
1728 |
|
float max=jzbHigh ; |
1736 |
|
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
1737 |
|
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
1738 |
|
|
1739 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
1740 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
1741 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
1742 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
1743 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
1744 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
1745 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1746 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
1747 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
1739 |
> |
if ( !PlottingSetup::Approved ) { |
1740 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
1741 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
1742 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
1743 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
1744 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
1745 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
1746 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1747 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
1748 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
1749 |
> |
} |
1750 |
|
|
1751 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarse",can,coarse_binning); |
1752 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
1753 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1754 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
1755 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
1756 |
< |
|
1757 |
< |
// draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarsest",can,coarsest_binning); |
1758 |
< |
// draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarsest",can,coarsest_binning); |
1536 |
< |
// flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1537 |
< |
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarsest",can,coarsest_binning); |
1538 |
< |
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarsest",can,coarsest_binning); |
1752 |
> |
if ( !PlottingSetup::Approved ) { |
1753 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
1754 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1755 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
1756 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
1757 |
> |
} |
1758 |
> |
delete can; |
1759 |
|
} |
1760 |
|
|
1761 |
|
|
1810 |
|
string posneg[] = {"pos","neg"}; |
1811 |
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut}; |
1812 |
|
|
1813 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
1813 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
1814 |
|
TCut jzbMC[] = { give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"), give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg") }; |
1815 |
|
dout << "_________________________________________________________" << endl; |
1816 |
|
dout << "Table for JZB> " << jzb_cuts[ijzb] << endl; |
1817 |
< |
for(int isample=0;isample<(allsamples.collection).size();isample++) { |
1817 |
> |
for(int isample=0;isample<(int)(allsamples.collection).size();isample++) { |
1818 |
|
if(!(allsamples.collection)[isample].is_data) dout << (allsamples.collection)[isample].samplename << " & "; |
1819 |
|
else dout << "Sample & "; |
1820 |
|
for(int iregion=0;iregion<nRegions;iregion++) { |
2073 |
|
|
2074 |
|
void draw_ttbar_and_zjets_shape(string mcjzb, string datajzb) { |
2075 |
|
int all_leptons=-1; |
1856 |
– |
int electrons_only=0; |
1857 |
– |
int mu_only=1; |
1858 |
– |
int twojetswith50gev=1; |
2076 |
|
int threejetswith30gev=0; |
2077 |
|
/* |
2078 |
+ |
int twojetswith50gev=1; |
2079 |
+ |
int electrons_only=0; |
2080 |
+ |
int mu_only=1; |
2081 |
+ |
|
2082 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,twojetswith50gev); |
2083 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev); |
2084 |
|
|
2092 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev,true); |
2093 |
|
} |
2094 |
|
|
2095 |
< |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
1875 |
< |
//first: colorful plots |
2095 |
> |
float find_one_correction_factor(string FindKeyword, TCut SpecialCut, string SaveAs) { |
2096 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
2097 |
|
cancorr->SetLogz(); |
2098 |
|
cancorr->SetRightMargin(0.13); |
2099 |
< |
flag_this_change(__FUNCTION__,__LINE__,false);//PlottingSetup::RestrictToMassPeak |
2100 |
< |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"); |
2099 |
> |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"&&SpecialCut); |
2100 |
> |
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
2101 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
2102 |
< |
(allsamples.collection)[allsamples.FindSample("Data")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotd",zptforresponsepresentation); |
2102 |
> |
vector<int> SampleIndices=allsamples.FindSample(FindKeyword); |
2103 |
> |
for(int iSample=0;iSample<SampleIndices.size();iSample++) { |
2104 |
> |
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << endl; |
2105 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",zptforresponsepresentation*cutWeight); |
2106 |
> |
} |
2107 |
> |
|
2108 |
|
niceresponseplotd->SetStats(0); |
2109 |
|
niceresponseplotd->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2110 |
|
niceresponseplotd->GetYaxis()->SetTitle("Response"); |
2113 |
|
niceresponseplotd->Draw("COLZ"); |
2114 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
2115 |
|
profd->SetMarkerSize(DataMarkerSize); |
2116 |
< |
profd->Fit("pol0","","same,e1",30,400); |
2116 |
> |
profd->Fit("pol0","","same,e1",100,400); |
2117 |
|
DrawPrelim(); |
2118 |
< |
TText* title = write_text(0.5,0.7,"Data"); |
2118 |
> |
string stitle="Data"; |
2119 |
> |
if(!Contains(FindKeyword,"Data")) stitle="MC"; |
2120 |
> |
TText* title = write_text(0.5,0.7,stitle.c_str()); |
2121 |
|
title->SetTextAlign(12); |
2122 |
|
title->Draw(); |
2123 |
|
TF1 *datapol=(TF1*)profd->GetFunction("pol0"); |
2124 |
< |
float datacorrection=datapol->GetParameter(0); |
2125 |
< |
stringstream dataresstring; |
2126 |
< |
dataresstring<<"Response: "<<std::setprecision(2)<<100*datacorrection<<" %"; |
2127 |
< |
TText* restitle = write_text(0.5,0.65,dataresstring.str()); |
2124 |
> |
float correction=datapol->GetParameter(0); |
2125 |
> |
stringstream resstring; |
2126 |
> |
resstring<<"Response: "<<std::setprecision(2)<<100*correction<<" %"; |
2127 |
> |
TText* restitle = write_text(0.5,0.65,resstring.str()); |
2128 |
|
restitle->SetTextAlign(12); |
2129 |
|
restitle->SetTextSize(0.03); |
2130 |
|
restitle->Draw(); |
2131 |
< |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_Data"); |
2131 |
> |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_New_"+SaveAs); |
2132 |
> |
delete cancorr; |
2133 |
> |
delete niceresponseplotd; |
2134 |
> |
return correction; |
2135 |
> |
} |
2136 |
> |
|
2137 |
> |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
2138 |
|
|
2139 |
< |
TH2F *niceresponseplotm = new TH2F("niceresponseplotm","",100,0,600,100,0,5); |
2140 |
< |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation); |
2141 |
< |
niceresponseplotm->SetStats(0); |
2142 |
< |
niceresponseplotm->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2143 |
< |
niceresponseplotm->GetYaxis()->SetTitle("Response"); |
2144 |
< |
niceresponseplotm->GetXaxis()->CenterTitle(); |
2145 |
< |
niceresponseplotm->GetYaxis()->CenterTitle(); |
2146 |
< |
niceresponseplotm->Draw("COLZ"); |
2147 |
< |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt",zptforresponsepresentation,"PROF,same"); |
2148 |
< |
TProfile * profm = (TProfile*)niceresponseplotm->ProfileX(); |
2149 |
< |
profm->SetMarkerSize(DataMarkerSize); |
2150 |
< |
profm->Fit("pol0","","same,e1",30,400); |
2151 |
< |
DrawMCPrelim(); |
2152 |
< |
title = write_text(0.5,0.7,"MC simulation"); |
2153 |
< |
title->SetTextAlign(12); |
1921 |
< |
title->Draw(); |
1922 |
< |
TF1 *mcpol=(TF1*)profm->GetFunction("pol0"); |
1923 |
< |
float mccorrection=mcpol->GetParameter(0); |
1924 |
< |
stringstream mcresstring; |
1925 |
< |
mcresstring<<"Response: "<<std::setprecision(2)<<100*mccorrection<<" %"; |
1926 |
< |
TText* mcrestitle = write_text(0.5,0.65,mcresstring.str()); |
1927 |
< |
mcrestitle->SetTextAlign(12); |
1928 |
< |
mcrestitle->SetTextSize(0.03); |
1929 |
< |
mcrestitle->Draw(); |
1930 |
< |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_MC"); |
2139 |
> |
//Step 1 : Get results |
2140 |
> |
float datacorrection=find_one_correction_factor("Data","","Data"); |
2141 |
> |
float mccorrection=find_one_correction_factor("DY","","MC"); |
2142 |
> |
|
2143 |
> |
float dataEEcorrection=find_one_correction_factor("Data","id1==0","Data_ee"); |
2144 |
> |
float mcEEcorrection=find_one_correction_factor("DY","id1==0","MC_ee"); |
2145 |
> |
|
2146 |
> |
float dataMMcorrection=find_one_correction_factor("Data","id1==1","Data_mm"); |
2147 |
> |
float mcMMcorrection=find_one_correction_factor("DY","id1==1","MC_mm"); |
2148 |
> |
|
2149 |
> |
cout << "Corrections : " << endl; |
2150 |
> |
cout << " Data : " << datacorrection << endl; |
2151 |
> |
cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
2152 |
> |
cout << " MC : " << mccorrection << endl; |
2153 |
> |
cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
2154 |
|
|
2155 |
+ |
cout << " result from new one for data: " << 0.937097 << endl; |
2156 |
+ |
cout << " result from old one for data: " << 0.937097 << endl; |
2157 |
+ |
cout << " result from new one for MC: " << 0.96848 << endl; |
2158 |
+ |
cout << " result from old one for MC: " << 0.963502 << endl; |
2159 |
|
|
2160 |
< |
//Step 2: Getting the result |
2161 |
< |
// TCut zptcutforresponse("pt>30&&pt<300&&TMath::Abs(91.2-mll)<20&&id1==id2&&(ch1*ch2<0)"); |
2160 |
> |
|
2161 |
> |
//Step 2: Processing the result and making it into something useful :-) |
2162 |
|
stringstream jzbvardatas; |
2163 |
< |
if(datacorrection>1) jzbvardatas<<"(jzb[1]-"<<datacorrection-1<<"*pt)"; |
2164 |
< |
if(datacorrection<1) jzbvardatas<<"(jzb[1]+"<<1-datacorrection<<"*pt)"; |
2163 |
> |
jzbvardatas << "("; |
2164 |
> |
|
2165 |
> |
if(dataEEcorrection>=1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]-" << dataEEcorrection-1 << "*pt))"; |
2166 |
> |
if(dataEEcorrection<1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-dataEEcorrection << "*pt))"; |
2167 |
> |
|
2168 |
> |
if(dataMMcorrection>=1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]-" << dataMMcorrection-1 << "*pt))"; |
2169 |
> |
if(dataMMcorrection<1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-dataMMcorrection << "*pt))"; |
2170 |
> |
|
2171 |
> |
float averagecorrection=(dataMMcorrection+dataEEcorrection)/2.0; |
2172 |
> |
|
2173 |
> |
if(averagecorrection>1) jzbvardatas<<"+((id1!=id2)*(jzb[1]-" << averagecorrection-1 << "*pt))"; |
2174 |
> |
if(averagecorrection<1) jzbvardatas<<"+((id1!=id2)*(jzb[1]-" << 1-averagecorrection << "*pt))"; |
2175 |
> |
|
2176 |
> |
jzbvardatas << ")"; |
2177 |
|
jzbvardata=jzbvardatas.str(); |
2178 |
+ |
|
2179 |
|
stringstream jzbvarmcs; |
2180 |
< |
if(mccorrection>1) jzbvarmcs<<"(jzb[1]-"<<mccorrection-1<<"*pt)"; |
2181 |
< |
if(mccorrection<1) jzbvarmcs<<"(jzb[1]+"<<1-mccorrection<<"*pt)"; |
2180 |
> |
jzbvarmcs << "("; |
2181 |
> |
|
2182 |
> |
if(mcEEcorrection>=1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]-" << mcEEcorrection-1 << "*pt))"; |
2183 |
> |
if(mcEEcorrection<1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-mcEEcorrection << "*pt))"; |
2184 |
> |
|
2185 |
> |
if(mcMMcorrection>=1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]-" << mcMMcorrection-1 << "*pt))"; |
2186 |
> |
if(mcMMcorrection<1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-mcMMcorrection << "*pt))"; |
2187 |
> |
|
2188 |
> |
float averagemccorrection=(mcMMcorrection+mcEEcorrection)/2.0; |
2189 |
> |
|
2190 |
> |
if(averagemccorrection>1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]-" << averagemccorrection-1 << "*pt))"; |
2191 |
> |
if(averagemccorrection<1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]-" << 1-averagemccorrection << "*pt))"; |
2192 |
> |
|
2193 |
> |
jzbvarmcs << ")"; |
2194 |
|
jzbvarmc=jzbvarmcs.str(); |
2195 |
+ |
|
2196 |
|
dout << "JZB Z pt correction summary : " << endl; |
2197 |
|
dout << " Data: The response is " << datacorrection << " --> jzb variable is now : " << jzbvardata << endl; |
2198 |
|
dout << " MC : The response is " << mccorrection << " --> jzb variable is now : " << jzbvarmc << endl; |
2199 |
+ |
|
2200 |
|
} |
2201 |
|
|
2202 |
|
void pick_up_events(string cut) { |
2204 |
|
allsamples.PickUpEvents(cut); |
2205 |
|
} |
2206 |
|
|
2207 |
< |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError) { |
2207 |
> |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) { |
2208 |
|
dout << "Saving configuration template!" << endl; |
2209 |
|
ofstream configfile; |
2210 |
|
configfile.open("../DistributedModelCalculations/last_configuration.C"); |
2224 |
|
configfile<<"string datajzb=\"datajzb_ERROR\";\n"; |
2225 |
|
configfile<<"string mcjzb=\"mcjzb_ERROR\";\n"; |
2226 |
|
configfile<<"vector<float>jzb_cuts;\n"; |
2227 |
+ |
configfile<<"vector<float>jzb_shape_limit_bins;\n"; |
2228 |
|
configfile<<"float MCPeakError=-999;\n"; |
2229 |
+ |
configfile<<"float DataPeakError=-999;\n"; |
2230 |
|
configfile<<"}\n\n"; |
2231 |
|
|
2232 |
|
configfile<<"void read_config() {\n"; |
2233 |
|
configfile<<"datajzb=\""<<datajzb<<"\";\n"; |
2234 |
|
configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n"; |
2235 |
< |
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n\n"; |
2236 |
< |
for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2235 |
> |
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n"; |
2236 |
> |
configfile<<"DataPeakError="<<DataPeakError<<";\n\n"; |
2237 |
> |
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"; |
2238 |
> |
configfile<<"\n\n"; |
2239 |
> |
for(int i=0;i<(int)Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2240 |
> |
for(int i=0;i<(int)Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2241 |
> |
for(int i=0;i<(int)Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2242 |
|
configfile<<"\n\n"; |
2243 |
< |
for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2244 |
< |
for(int i=0;i<Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2245 |
< |
for(int i=0;i<Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2243 |
> |
for(int i=0;i<(int)flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2244 |
> |
for(int i=0;i<(int)flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2245 |
> |
for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2246 |
> |
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"; |
2247 |
|
configfile<<"\n\n"; |
1986 |
– |
for(int i=0;i<flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
1987 |
– |
for(int i=0;i<flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
1988 |
– |
for(int i=0;i<flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2248 |
|
configfile<<"\n\n"; |
2249 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
2250 |
|
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
2270 |
|
float max=histos[0]->GetMaximum(); |
2271 |
|
if(manualmin>=0) min=manualmin; |
2272 |
|
else { |
2273 |
< |
for(int i=1;i<histos.size();i++) { |
2273 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2274 |
|
float curmin=get_nonzero_minimum(histos[i]); |
2275 |
|
float curmax=histos[i]->GetMaximum(); |
2276 |
|
if(curmin<min) min=curmin; |
2281 |
|
histos[0]->Draw(drawoption.c_str()); |
2282 |
|
stringstream drawopt; |
2283 |
|
drawopt << drawoption << ",same"; |
2284 |
< |
for(int i=1;i<histos.size();i++) { |
2284 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2285 |
|
histos[i]->Draw(drawopt.str().c_str()); |
2286 |
|
} |
2287 |
|
} |
2290 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
2291 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
2292 |
|
TCut weightbackup=cutWeight; |
2293 |
< |
cutWeight="1.0"; |
2293 |
> |
// cutWeight="1.0"; |
2294 |
|
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2295 |
|
|
2296 |
|
|
2348 |
|
leg->Draw("same"); |
2349 |
|
DrawMCPrelim(simulatedlumi); |
2350 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison"); |
2092 |
– |
|
2351 |
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
2352 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
2353 |
< |
TH1F *TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2354 |
< |
TH1F *TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2353 |
> |
TH1F *TSeemmcopy; |
2354 |
> |
TH1F *TSemcopy; |
2355 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2356 |
> |
TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2357 |
> |
TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2358 |
> |
} |
2359 |
|
|
2360 |
|
TZem->Divide(TZeemm); |
2361 |
|
TZem->SetMarkerStyle(21); |
2377 |
|
|
2378 |
|
float linepos=0.25; |
2379 |
|
if(PlottingSetup::RestrictToMassPeak) linepos=0.25; |
2380 |
+ |
if(!PlottingSetup::RestrictToMassPeak) linepos=0.1; //sys uncertainty for iJZB |
2381 |
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2382 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2383 |
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2384 |
|
|
2385 |
+ |
/*write_warning(__FUNCTION__,"These two lines are to be removed!"); |
2386 |
+ |
TLine *topalt = new TLine(binning[0],1.0+0.1,binning[binning.size()-1],1.0+0.1); |
2387 |
+ |
TLine *bottomalt = new TLine(binning[0],1.0-0.1,binning[binning.size()-1],1.0-0.1); |
2388 |
+ |
topalt->SetLineColor(kRed);topalt->SetLineStyle(3); |
2389 |
+ |
bottomalt->SetLineColor(kRed);bottomalt->SetLineStyle(3); |
2390 |
+ |
topalt->Draw("same");bottomalt->Draw("same");*/ |
2391 |
+ |
|
2392 |
+ |
|
2393 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
2394 |
|
bottom->SetLineColor(kBlue);bottom->SetLineStyle(2); |
2395 |
|
center->SetLineColor(kBlue); |
2414 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio"); |
2415 |
|
|
2416 |
|
|
2146 |
– |
|
2417 |
|
///-------------- second part: only look at the quantity we actually care about! |
2418 |
|
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
2419 |
|
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
2540 |
|
} |
2541 |
|
|
2542 |
|
|
2543 |
< |
void zjets_prediction_comparison() { |
2543 |
> |
void zjets_prediction_comparison(string mcjzbWithPU) { |
2544 |
> |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2545 |
> |
zcan->SetLogy(1); |
2546 |
> |
TCut weightbackup=cutWeight; |
2547 |
> |
|
2548 |
> |
/* |
2549 |
|
// Do it without PU re-weighting |
2550 |
|
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2551 |
|
stringstream resultsNoPU; |
2552 |
|
|
2553 |
|
stringstream mcjzbnoPU; |
2554 |
< |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,false); |
2554 |
> |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,true); |
2555 |
|
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2556 |
|
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2557 |
|
|
2558 |
|
string mcjzb = mcjzbnoPU.str(); |
2559 |
|
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl; |
2560 |
|
|
2286 |
– |
TCut weightbackup=cutWeight; |
2561 |
|
cutWeight="1.0"; |
2562 |
< |
float sbg_min=0.; |
2563 |
< |
float sbg_max=100.; |
2564 |
< |
int sbg_nbins=5; |
2562 |
> |
*/ |
2563 |
> |
string mcjzb = mcjzbWithPU; // this is with PURW, if you want without it you have to uncomment the part above (and comment out this line) |
2564 |
> |
|
2565 |
> |
vector<float> binning; |
2566 |
> |
binning.push_back(0); |
2567 |
> |
binning.push_back(20); |
2568 |
> |
binning.push_back(40); |
2569 |
> |
binning.push_back(60); |
2570 |
> |
binning.push_back(80); |
2571 |
> |
binning.push_back(100); |
2572 |
> |
// float sbg_min=0.; |
2573 |
> |
// float sbg_max=100.; |
2574 |
> |
// int sbg_nbins=5; |
2575 |
|
float simulatedlumi = luminosity;//in pb please - adjust to your likings |
2576 |
|
|
2577 |
|
TCut kPos((mcjzb+">0").c_str()); |
2578 |
|
TCut kNeg((mcjzb+"<0").c_str()); |
2579 |
|
string var( "abs("+mcjzb+")" ); |
2580 |
|
|
2581 |
< |
TCut kcut(cutmass&&cutOSSF&&"pfJetGoodNum>2"); |
2582 |
< |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2583 |
< |
kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2300 |
< |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2301 |
< |
kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2581 |
> |
TCut kcut(cutmass&&cutOSSF&&cutnJets); |
2582 |
> |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2583 |
> |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2584 |
|
hJZBpos->SetLineColor(kBlack); |
2585 |
|
hJZBneg->SetLineColor(kRed); |
2586 |
|
|
2587 |
< |
Int_t nbins = 5; |
2306 |
< |
Float_t xmax = 100.; |
2307 |
< |
|
2308 |
< |
|
2309 |
< |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2310 |
< |
zcan->SetLogy(1); |
2311 |
< |
|
2587 |
> |
hJZBpos->SetMinimum(1.0); |
2588 |
|
hJZBpos->Draw("e1"); |
2589 |
|
hJZBneg->Draw("same,hist"); |
2590 |
|
hJZBpos->Draw("same,e1"); // So it's on top... |
2604 |
|
hratio->GetYaxis()->SetTitle("Observed/Predicted"); |
2605 |
|
hratio->Draw("e1"); |
2606 |
|
|
2607 |
< |
TLine *top = new TLine(sbg_min,1.25,sbg_max,1.25); |
2608 |
< |
TLine *center = new TLine(sbg_min,1.0,sbg_max,1.0); |
2609 |
< |
TLine *bottom = new TLine(sbg_min,0.75,sbg_max,0.75); |
2607 |
> |
TLine *top = new TLine(binning[0],1.25,binning[binning.size()-1],1.25); |
2608 |
> |
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2609 |
> |
TLine *bottom = new TLine(binning[0],0.75,binning[binning.size()-1],0.75); |
2610 |
|
|
2611 |
|
|
2612 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
2648 |
|
tout << "\\begin{tabular}{l|cc}" << endl; |
2649 |
|
tout << "\\hline" << endl; |
2650 |
|
tout << "& {\\OFZP} & {\\OFSB} \\\\\\hline" << endl; |
2651 |
< |
tout << "\\#(events) & "<<OFSB<<" & "<<OFZP<<"\\\\ \\hline" << endl; |
2651 |
> |
tout << "\\#(events) & "<<OFZP<<" & "<<OFSB<<"\\\\ \\hline" << endl; |
2652 |
|
tout << "\\end{tabular}" << endl; |
2653 |
|
tout << "\\end{center}" << endl; |
2654 |
|
tout << "\\end{table}" << endl; |
2666 |
|
|
2667 |
|
TCanvas *cannie = new TCanvas("cannie","cannie"); |
2668 |
|
|
2669 |
< |
for(int icut=0;icut<jzb_cuts.size();icut++) { |
2669 |
> |
for(int icut=0;icut<(int)jzb_cuts.size();icut++) { |
2670 |
|
float currcut=jzb_cuts[icut]; |
2671 |
|
int nbins=1;float low=currcut; |
2672 |
|
vector<int> mysample; |
2725 |
|
//prediction part |
2726 |
|
if(is_data) cout << "Data prediction & "; |
2727 |
|
if(subselection!="none") cout << subselection << " prediction &"; |
2728 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
2728 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
2729 |
|
|
2730 |
|
cout << endl; |
2731 |
|
//observation part |
2732 |
|
if(is_data) cout << "Data observation & "; |
2733 |
|
if(subselection!="none") cout << subselection << " observation &"; |
2734 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
2734 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
2735 |
|
cout << endl; |
2736 |
|
cout << "_________________________________________________________________" << endl; |
2737 |
|
delete cannie; |
2766 |
|
int nbins = sizeof(xbins)/sizeof(float)-1; |
2767 |
|
int markers[] = { 20, 26, 21, 24, 22, 25, 28 }; |
2768 |
|
|
2769 |
< |
TH1F* heff = new TH1F("heff", "JZB eff ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
2770 |
< |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
2771 |
< |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
2769 |
> |
|
2770 |
> |
TH1F* heff = new TH1F("heff", "JZB eff ; generator JZB [GeV]; efficiency",nbins,xbins); |
2771 |
> |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator JZB [GeV]; efficiency",nbins,xbins); |
2772 |
> |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator JZB [GeV]; efficiency",nbins,xbins); |
2773 |
|
|
2774 |
|
TCut kgen(genMassCut&&"genZPt>0&&genNjets>2&&abs(genMID)==23"&&cutOSSF); |
2775 |
|
TCut kreco(cutmass); |
2785 |
|
TCanvas *can = new TCanvas("can","Canvas for JZB Efficiency",600,600); |
2786 |
|
can->SetGridx(1); |
2787 |
|
can->SetGridy(1); |
2788 |
+ |
can->SetLeftMargin(0.16); |
2789 |
+ |
can->SetRightMargin(0.05); |
2790 |
|
TLegend *leg = make_legend("",0.6,0.2,false,0.89,0.5); |
2791 |
+ |
leg->SetBorderSize(1); |
2792 |
+ |
leg->SetLineColor(kBlack); |
2793 |
+ |
leg->SetTextFont(62); |
2794 |
|
|
2795 |
< |
|
2514 |
< |
|
2515 |
< |
for ( int icut=0; icut<jzb_bins.size(); ++icut ) { |
2795 |
> |
for ( int icut=0; icut<(int)jzb_bins.size(); ++icut ) { |
2796 |
|
|
2797 |
|
ostringstream selection; |
2798 |
|
selection << mcjzb << ">" << jzb_bins[icut]; |
2808 |
|
} |
2809 |
|
|
2810 |
|
heff->GetXaxis()->SetRangeUser(min, max); |
2811 |
+ |
// heff->GetXaxis()->SetLabelSize(0.05); // paper style. overruled. |
2812 |
+ |
// heff->GetYaxis()->SetLabelSize(0.05); // paper style. overruled. |
2813 |
+ |
// heff->GetXaxis()->SetTitleSize(0.06); // paper style. overruled. |
2814 |
+ |
// heff->GetYaxis()->SetTitleSize(0.06); // paper style. overruled. |
2815 |
|
heff->SetMarkerStyle(markers[icut]); |
2816 |
|
heff->Fit("func","Q+","same"); |
2817 |
|
|
2823 |
|
|
2824 |
|
// Store plot |
2825 |
|
TH1F* h = (TH1F*)heff->Clone(hname); |
2826 |
+ |
h->SetNdivisions(505,"X"); |
2827 |
|
if ( icut) h->Draw("same"); |
2828 |
|
else h->Draw(); |
2829 |
|
char htitle[256]; sprintf(htitle,"JZB > %3.0f GeV", jzb_bins[icut]); |
2844 |
|
// Calls the above function for each signal sample |
2845 |
|
void plot_jzb_sel_eff(string mcjzb, samplecollection &signalsamples, vector<float> bins ) |
2846 |
|
{ |
2847 |
< |
for (int isignal=0; isignal<signalsamples.collection.size();isignal++) { |
2847 |
> |
for (int isignal=0; isignal<(int)signalsamples.collection.size();isignal++) { |
2848 |
|
dout << "JZB selection efficiency curve: " << std::endl; |
2849 |
|
JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples |
2850 |
|
} |
2887 |
|
TH1F *RcorrJZBSBeemm; |
2888 |
|
TH1F *LcorrJZBSBeemm; |
2889 |
|
|
2890 |
< |
TH1F *RcorrJZBeemmNoS; |
2890 |
> |
// TH1F *RcorrJZBeemmNoS; |
2891 |
|
|
2892 |
|
//these are for the ratio |
2893 |
|
TH1F *JRcorrJZBeemm = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2971 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
2972 |
|
string ytitle("ratio"); |
2973 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
2974 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,use_data!=1,ytitle); |
2974 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,false,ytitle); |
2975 |
|
|
2976 |
|
TH1F *allevents = qcdsamples.Draw("allevents","pfJetGoodNum",1,0,100, "internal code", "events", "" ,mc, luminosity); |
2977 |
|
TH1F *ossf = qcdsamples.Draw("ossf","pfJetGoodNum",1,0,100, "internal code", "events", cutOSSF ,mc, luminosity); |
3018 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral() << endl; |
3019 |
|
|
3020 |
|
dout << endl; |
3021 |
< |
for(int i=0;i<bins.size();i++) { |
3021 |
> |
for(int i=0;i<(int)bins.size();i++) { |
3022 |
|
dout << " JZB > " << bins[i] << " : " << endl; |
3023 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
3024 |
|
if(PlottingSetup::RestrictToMassPeak) { |
3066 |
|
leg->SetY2(1.0); |
3067 |
|
|
3068 |
|
|
3069 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
3069 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3070 |
|
string nowname=(allsamples.collection)[isample].filename; |
3071 |
|
cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl; |
3072 |
|
individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
3090 |
|
ptsancan->cd(2); |
3091 |
|
fpt2->Draw(); |
3092 |
|
|
3093 |
< |
for(int isample=0;isample<allsamples.collection.size();isample++) { |
3093 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3094 |
|
ptsancan->cd(1); |
3095 |
|
individualpt1histos[isample]->DrawNormalized("same,histo"); |
3096 |
|
ptsancan->cd(2); |
3106 |
|
void do_mlls_plot(string mcjzb) { |
3107 |
|
cout << "At this point we'd plot the mll distribution" << endl; |
3108 |
|
TCanvas *sigcan = new TCanvas("sigcan","sigcan"); |
3109 |
< |
for(int isig=0;isig<(signalsamples.collection).size();isig++) { |
3109 |
> |
for(int isig=0;isig<(int)(signalsamples.collection).size();isig++) { |
3110 |
|
if(!(signalsamples.collection)[isig].events) continue; |
3111 |
|
string nowname=(signalsamples.collection)[isig].filename; |
3112 |
|
TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname)); |
3145 |
|
findme.push_back("TTJets"); |
3146 |
|
findme.push_back("LM"); |
3147 |
|
|
3148 |
< |
for(int ifind=0;ifind<findme.size();ifind++) { |
3148 |
> |
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
3149 |
|
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
3150 |
|
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
3151 |
< |
for(int isel=0;isel<selsamples.size();isel++) { |
3151 |
> |
for(int isel=0;isel<(int)selsamples.size();isel++) { |
3152 |
|
cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
3153 |
|
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF); |
3154 |
|
} |