86 |
|
|
87 |
|
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb) |
88 |
|
{ |
89 |
+ |
|
90 |
+ |
bool DoInvidualeemmPeaks=false; |
91 |
+ |
|
92 |
|
float mcpeak, datapeak; |
93 |
|
float mcpeakerr, datapeakerr; |
94 |
|
|
103 |
|
dout << "Finding global peak : " << endl; |
104 |
|
find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma, dataSigma,result,doPUreweighting,""); |
105 |
|
|
106 |
< |
dout << "Finding peak for electrons : " << endl; |
107 |
< |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr, dataeepeak,dataeepeakerr,mcSigma, dataSigma,result,doPUreweighting,"_ele"); |
108 |
< |
dout << "Finding peak for muons : " << endl; |
109 |
< |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr, datammpeak,datammpeakerr,mcSigma, dataSigma,result,doPUreweighting,"_mu"); |
110 |
< |
|
111 |
< |
datajzb << "(" << jzbvariabledata; |
112 |
< |
mcjzb << "(" << jzbvariablemc; |
113 |
< |
|
114 |
< |
if(dataeepeak>0) datajzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
115 |
< |
else datajzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
116 |
< |
|
117 |
< |
if(datammpeak>0) datajzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
118 |
< |
else datajzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
119 |
< |
|
120 |
< |
if(datapeak>0) datajzb << "- (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
121 |
< |
else datajzb << "+ (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
122 |
< |
|
123 |
< |
datajzb << ")"; |
124 |
< |
|
125 |
< |
if(mceepeak>0) mcjzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
126 |
< |
else mcjzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
127 |
< |
|
128 |
< |
if(mcmmpeak>0) mcjzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
129 |
< |
else mcjzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
130 |
< |
|
131 |
< |
if(mcpeak>0) mcjzb << "- (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
132 |
< |
else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
133 |
< |
|
134 |
< |
mcjzb << ")"; |
106 |
> |
if(DoInvidualeemmPeaks) { |
107 |
> |
dout << "Finding peak for electrons : " << endl; |
108 |
> |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr, dataeepeak,dataeepeakerr,mcSigma, dataSigma,result,doPUreweighting,"_ele"); |
109 |
> |
dout << "Finding peak for muons : " << endl; |
110 |
> |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr, datammpeak,datammpeakerr,mcSigma, dataSigma,result,doPUreweighting,"_mu"); |
111 |
> |
|
112 |
> |
datajzb << "(" << jzbvariabledata; |
113 |
> |
mcjzb << "(" << jzbvariablemc; |
114 |
> |
|
115 |
> |
if(dataeepeak>0) datajzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
116 |
> |
else datajzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
117 |
> |
|
118 |
> |
if(datammpeak>0) datajzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
119 |
> |
else datajzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
120 |
> |
|
121 |
> |
if(datapeak>0) datajzb << "- (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
122 |
> |
else datajzb << "+ (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
123 |
> |
|
124 |
> |
datajzb << ")"; |
125 |
> |
|
126 |
> |
if(mceepeak>0) mcjzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
127 |
> |
else mcjzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
128 |
> |
|
129 |
> |
if(mcmmpeak>0) mcjzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
130 |
> |
else mcjzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
131 |
> |
|
132 |
> |
if(mcpeak>0) mcjzb << "- (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
133 |
> |
else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
134 |
> |
|
135 |
> |
mcjzb << ")"; |
136 |
> |
} else { |
137 |
> |
datajzb << "(" << jzbvariabledata; |
138 |
> |
mcjzb << "(" << jzbvariablemc; |
139 |
> |
|
140 |
> |
if(datapeak>0) datajzb << "- " << TMath::Abs(datapeak) << " "; |
141 |
> |
else datajzb << "+ " << TMath::Abs(datapeak) << " "; |
142 |
> |
|
143 |
> |
datajzb << ")"; |
144 |
> |
|
145 |
> |
if(mcpeak>0) mcjzb << "- " << TMath::Abs(mcpeak) << " "; |
146 |
> |
else mcjzb << "+ " << TMath::Abs(mcpeak) << " "; |
147 |
> |
|
148 |
> |
mcjzb << ")"; |
149 |
> |
} |
150 |
> |
|
151 |
|
|
152 |
|
} |
153 |
|
|
154 |
< |
void make_special_obs_pred_mll_plot(string mcjzb, float jzbthreshold) { |
154 |
> |
void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold) { |
155 |
|
float min=70.0; |
156 |
|
float max=115.0; |
157 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
158 |
< |
min=10; |
159 |
< |
max=150; |
158 |
> |
min=20; |
159 |
> |
max=200; |
160 |
|
} |
161 |
|
int nbins=int((max-min)/5); |
162 |
|
|
163 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
164 |
|
|
165 |
|
stringstream largerzeroS; |
166 |
< |
largerzeroS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
167 |
< |
TCut largerzero(largerzeroS.str().c_str()); |
166 |
> |
largerzeroS << "(" << datajzb << ">" << jzbthreshold << ")"; |
167 |
> |
TCut largerzeroD(largerzeroS.str().c_str()); |
168 |
|
|
169 |
|
stringstream smallerzeroS; |
170 |
< |
smallerzeroS << "(" << mcjzb << "<-" << jzbthreshold << ")"; |
171 |
< |
TCut smallerzero(smallerzeroS.str().c_str()); |
172 |
< |
|
173 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity); |
174 |
< |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets,mc,luminosity); |
175 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity); |
176 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data,luminosity); |
177 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data,luminosity); |
170 |
> |
smallerzeroS << "(" << datajzb << "<-" << jzbthreshold << ")"; |
171 |
> |
TCut smallerzeroD(smallerzeroS.str().c_str()); |
172 |
> |
|
173 |
> |
|
174 |
> |
stringstream largerzeroMS; |
175 |
> |
largerzeroMS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
176 |
> |
TCut largerzeroM(largerzeroMS.str().c_str()); |
177 |
> |
|
178 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroD,data,luminosity); |
179 |
> |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroM,mc,luminosity); |
180 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzeroD,data,luminosity); |
181 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzeroD,data,luminosity); |
182 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzeroD,data,luminosity); |
183 |
|
|
184 |
|
TH1F *RcorrJZBSBem; |
185 |
|
TH1F *LcorrJZBSBem; |
189 |
|
// TH1F *RcorrJZBeemmNoS; |
190 |
|
|
191 |
|
if(PlottingSetup::RestrictToMassPeak) { |
192 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,data, luminosity); |
193 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,data, luminosity); |
194 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,data, luminosity); |
195 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,data, luminosity); |
192 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,data, luminosity); |
193 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,data, luminosity); |
194 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,data, luminosity); |
195 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzeroD,data, luminosity); |
196 |
|
} |
197 |
|
|
198 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
224 |
|
stringstream saveas; |
225 |
|
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold; |
226 |
|
CompleteSave(ckin,saveas.str()); |
227 |
+ |
|
228 |
+ |
|
229 |
+ |
|
230 |
+ |
RcorrJZBeemm->Draw(); |
231 |
+ |
Bpred->Draw("histo,same"); |
232 |
+ |
RcorrJZBeemm->Draw("same"); |
233 |
+ |
|
234 |
+ |
TLegend *leg2 = make_legend(); |
235 |
+ |
leg2->SetX1(0.58); |
236 |
+ |
leg2->AddEntry(RcorrJZBeemm,"observed (data)","l"); |
237 |
+ |
leg2->AddEntry(Bpred,"predicted (data)","l"); |
238 |
+ |
leg2->Draw("same"); |
239 |
+ |
|
240 |
+ |
saveas.str(""); |
241 |
+ |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold << "_nomc"; |
242 |
+ |
CompleteSave(ckin,saveas.str()); |
243 |
+ |
|
244 |
+ |
|
245 |
|
|
246 |
|
delete RcorrJZBeemm; |
247 |
|
delete LcorrJZBeemm; |
383 |
|
draw_separation_lines=true; |
384 |
|
} |
385 |
|
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
386 |
< |
if(Contains(filename,"mll_aboveJZB100")) cut=cutOSSF&&cutnJets&&ibasiccut; |
386 |
> |
if(Contains(filename,"aboveJZB")) cut=cutOSSF&&cutnJets&&ibasiccut; |
387 |
> |
if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0"; |
388 |
> |
if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1"; |
389 |
|
if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut; |
390 |
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF; |
391 |
|
if(filename=="mll_inclusive_osof") cut=cutOSOF; |
497 |
|
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,data,luminosity); |
498 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
499 |
|
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
500 |
< |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum315",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
501 |
< |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum285",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
500 |
> |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNump1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
501 |
> |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNumn1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
502 |
|
|
503 |
|
datahisto->SetMinimum(1); |
504 |
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); // in line with kinematic plots style |
565 |
|
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
566 |
|
stringstream jzbcut; |
567 |
|
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
568 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
569 |
< |
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); |
570 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
571 |
< |
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); |
568 |
> |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
569 |
> |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
570 |
> |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB100",doPF,true); |
571 |
> |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB100",doPF,true); |
572 |
|
stringstream jzbcut2; |
573 |
|
jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
574 |
< |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
575 |
< |
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); |
574 |
> |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
575 |
> |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB150",doPF,true); |
576 |
> |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB150",doPF,true); |
577 |
> |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB150",doPF,true); |
578 |
|
stringstream jzbcut3; |
579 |
|
jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
580 |
< |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); |
581 |
< |
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); |
580 |
> |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); |
581 |
> |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true); |
582 |
> |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_ee_aboveJZB50",doPF,true); |
583 |
> |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_mm_aboveJZB50",doPF,true); |
584 |
> |
|
585 |
> |
|
586 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,0); |
587 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,50); |
588 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,100); |
589 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,150); |
590 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,200); |
591 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,250); |
592 |
|
|
593 |
< |
make_special_obs_pred_mll_plot(mcjzb,0); |
538 |
< |
make_special_obs_pred_mll_plot(mcjzb,50); |
539 |
< |
make_special_obs_pred_mll_plot(mcjzb,100); |
540 |
< |
make_special_obs_pred_mll_plot(mcjzb,150); |
541 |
< |
make_special_obs_pred_mll_plot(mcjzb,200); |
542 |
< |
make_special_obs_pred_mll_plot(mcjzb,250); |
593 |
> |
make_JES_plot(); |
594 |
|
} |
595 |
|
|
596 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
624 |
|
TCanvas *ccomp = new TCanvas("ccomp","Comparison plot",600,400); |
625 |
|
ccomp->SetLogy(log); |
626 |
|
TH1F *datahisto = allsamples.Draw("datahisto", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity); |
627 |
< |
TH1F *lm4histo = signalsamples.Draw("lm4histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity,signalsamples.FindSample("LM4")); |
627 |
> |
TH1F *lm4histo = signalsamples.Draw("lm4histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity,signalsamples.FindSample("LM")); |
628 |
|
THStack mcstack = allsamples.DrawStack("mcstack",var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb], mc, luminosity); |
629 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
630 |
|
if (ymax>ymin) datahisto->SetMaximum(ymax); |
658 |
|
dout << "Creating comparison plots for signal and control regions" << endl; |
659 |
|
// Compare a few quantities in the signal region and all 7 control regions |
660 |
|
|
661 |
< |
switch_overunderflow(true); // switching overflow/underflow bins on |
661 |
> |
// switch_overunderflow(true); // switching overflow/underflow bins on |
662 |
|
|
663 |
|
|
664 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
971 |
|
|
972 |
|
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
973 |
|
{ |
974 |
< |
switch_overunderflow(true); |
974 |
> |
// switch_overunderflow(true); |
975 |
|
bool is_data=false; |
976 |
|
bool use_signal=false; |
977 |
|
if(use_data==1) is_data=true; |
1151 |
|
legBpred->AddEntry(Bpred,"predicted","l"); |
1152 |
|
// legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1153 |
|
// legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
1154 |
< |
legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1154 |
> |
legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l"); |
1155 |
|
legBpred->Draw(); |
1156 |
|
DrawPrelim(); |
1157 |
|
|
1211 |
|
CompleteSave(specialcanv,subdir+"Bpred_Data_____PredictionCompositioninMC"); |
1212 |
|
Bpred->SetLineWidth((int)CurrentBpredLineWidth); |
1213 |
|
|
1214 |
+ |
|
1215 |
+ |
//for(int i=1;i<=Bpred->GetNbinsX();i++) cout << Bpred->GetBinLowEdge(i) << ";" << Bpred->GetBinLowEdge(i)+Bpred->GetBinWidth(i) << ";;" << RcorrJZBeemm->GetBinContent(i) << ";" << LcorrJZBeemm->GetBinContent(i) << ";" << RcorrJZBem->GetBinContent(i) << ";" << LcorrJZBem->GetBinContent(i) << endl; |
1216 |
+ |
|
1217 |
|
delete speciallegBpred; |
1218 |
|
delete Zjetspred; |
1219 |
|
delete TTbarpred; |
1344 |
|
} |
1345 |
|
} |
1346 |
|
|
1347 |
+ |
TFile *f = new TFile("tester.root","RECREATE"); |
1348 |
+ |
RcorrJZBeemm->Write(); |
1349 |
+ |
Bpred->Write(); |
1350 |
+ |
f->Close(); |
1351 |
+ |
|
1352 |
|
delete RcorrJZBeemm; |
1353 |
|
delete LcorrJZBeemm; |
1354 |
|
delete RcorrJZBem; |
1834 |
|
} |
1835 |
|
|
1836 |
|
} |
1837 |
+ |
|
1838 |
+ |
|
1839 |
+ |
void draw_normalized_data_vs_data_histo(TCut cut1, TCut cut2, string variable, string legentry1, string legentry2, string savename, TCanvas *can,vector<float> binning) { |
1840 |
+ |
TPad *jzbpad = new TPad("jzbpad","jzbpad",0,0,1,1); |
1841 |
+ |
jzbpad->cd(); |
1842 |
+ |
jzbpad->SetLogy(1); |
1843 |
+ |
string xlabel="JZB [GeV]"; |
1844 |
+ |
|
1845 |
+ |
TH1F *datahisto1 = allsamples.Draw("datahisto1",variable,binning, xlabel, "events",cut1,data,luminosity); |
1846 |
+ |
datahisto1->SetLineColor(kRed); |
1847 |
+ |
datahisto1->SetMarkerColor(kRed); |
1848 |
+ |
TH1F *datahisto2 = allsamples.Draw("datahisto2",variable,binning, xlabel, "events",cut2,data,luminosity); |
1849 |
+ |
datahisto2->SetLineColor(kBlue); |
1850 |
+ |
datahisto2->SetMarkerColor(kBlue); |
1851 |
+ |
|
1852 |
+ |
datahisto2->SetMarkerSize(DataMarkerSize); |
1853 |
+ |
datahisto1->DrawNormalized("e1"); |
1854 |
+ |
datahisto2->DrawNormalized("histo,same"); |
1855 |
+ |
datahisto1->DrawNormalized("same,e1"); |
1856 |
+ |
|
1857 |
+ |
TLegend *leg = make_legend(); |
1858 |
+ |
leg->AddEntry(datahisto1,legentry1.c_str()); |
1859 |
+ |
leg->AddEntry(datahisto2,legentry2.c_str()); |
1860 |
+ |
leg->Draw(); |
1861 |
+ |
|
1862 |
+ |
save_with_ratio(datahisto1,datahisto2,jzbpad->cd(),("jzb/"+savename)); |
1863 |
+ |
|
1864 |
+ |
datahisto1->Delete(); |
1865 |
+ |
datahisto2->Delete(); |
1866 |
+ |
} |
1867 |
+ |
|
1868 |
+ |
|
1869 |
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1870 |
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas"); |
1871 |
|
float max=jzbHigh ; |
1889 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1890 |
|
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
1891 |
|
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
1892 |
+ |
|
1893 |
+ |
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm",can,binning); |
1894 |
+ |
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarse",can,coarse_binning); |
1895 |
+ |
|
1896 |
|
} |
1897 |
|
|
1898 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarse",can,coarse_binning); |
2239 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev,true); |
2240 |
|
} |
2241 |
|
|
2242 |
< |
float find_one_correction_factor(string FindKeyword, TCut SpecialCut, string SaveAs) { |
2242 |
> |
float find_one_correction_factor(string FindKeyword, bool dodata, TCut SpecialCut, string SaveAs) { |
2243 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
2244 |
|
cancorr->SetLogz(); |
2245 |
|
cancorr->SetRightMargin(0.13); |
2247 |
|
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
2248 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
2249 |
|
vector<int> SampleIndices=allsamples.FindSample(FindKeyword); |
2250 |
< |
for(int iSample=0;iSample<SampleIndices.size();iSample++) { |
2250 |
> |
for(int iSample=0;iSample<(int)SampleIndices.size();iSample++) { |
2251 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data && !dodata) continue; |
2252 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data ==false && dodata) continue; |
2253 |
> |
|
2254 |
|
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << " for " << FindKeyword << endl; |
2255 |
|
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",zptforresponsepresentation*cutWeight); |
2256 |
|
} |
2288 |
|
|
2289 |
|
dout << "Computing response corrections: " << endl; |
2290 |
|
//Step 1 : Get results |
2291 |
< |
float datacorrection=find_one_correction_factor("Data","","Data"); |
2292 |
< |
float mccorrection=find_one_correction_factor("DY","","MC"); |
2291 |
> |
float datacorrection=find_one_correction_factor("Data",true,"","Data"); |
2292 |
> |
float mccorrection=find_one_correction_factor("DY",false,"","MC"); |
2293 |
|
|
2294 |
< |
float dataEEcorrection=find_one_correction_factor("Data","id1==0","Data_ee"); |
2295 |
< |
float mcEEcorrection=find_one_correction_factor("DY","id1==0","MC_ee"); |
2294 |
> |
float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
2295 |
> |
float mcEEcorrection=find_one_correction_factor("DY",false,"id1==0","MC_ee"); |
2296 |
|
|
2297 |
< |
float dataMMcorrection=find_one_correction_factor("Data","id1==1","Data_mm"); |
2298 |
< |
float mcMMcorrection=find_one_correction_factor("DY","id1==1","MC_mm"); |
2297 |
> |
float dataMMcorrection=find_one_correction_factor("Data",true,"id1==1","Data_mm"); |
2298 |
> |
float mcMMcorrection=find_one_correction_factor("DY",false,"id1==1","MC_mm"); |
2299 |
|
|
2300 |
|
cout << "Corrections : " << endl; |
2301 |
|
cout << " Data : " << datacorrection << endl; |
2435 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
2436 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
2437 |
|
TCut weightbackup=cutWeight; |
2340 |
– |
// cutWeight="1.0"; |
2341 |
– |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2438 |
|
|
2439 |
+ |
bool doPURW=false; |
2440 |
+ |
|
2441 |
+ |
|
2442 |
+ |
if(!doPURW) { |
2443 |
+ |
cutWeight="1.0"; |
2444 |
+ |
// Do it without PU re-weighting |
2445 |
+ |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2446 |
+ |
stringstream resultsNoPU; |
2447 |
+ |
stringstream noPUdatajzb; |
2448 |
+ |
stringstream noPUmcjzb; |
2449 |
+ |
|
2450 |
+ |
stringstream mcjzbnoPU; |
2451 |
+ |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb); |
2452 |
+ |
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2453 |
+ |
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2454 |
+ |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzbnoPU.str() << endl; |
2455 |
+ |
|
2456 |
+ |
mcjzb = mcjzbnoPU.str(); |
2457 |
+ |
|
2458 |
+ |
} |
2459 |
+ |
|
2460 |
+ |
|
2461 |
+ |
|
2462 |
+ |
|
2463 |
+ |
|
2464 |
+ |
|
2465 |
+ |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2466 |
|
|
2467 |
|
TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2468 |
|
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2500 |
|
} |
2501 |
|
|
2502 |
|
vector<TH1F*> histos; |
2503 |
+ |
TZem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2504 |
+ |
TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2505 |
|
histos.push_back(TZem); |
2506 |
|
histos.push_back(TZeemm); |
2507 |
|
if(PlottingSetup::RestrictToMassPeak) { |
2508 |
+ |
TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2509 |
+ |
TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2510 |
|
histos.push_back(TSem); |
2511 |
|
histos.push_back(TSeemm); |
2512 |
|
} |
2549 |
|
TSeemm->Draw("same"); |
2550 |
|
} |
2551 |
|
|
2552 |
< |
float linepos=0.25; |
2553 |
< |
if(PlottingSetup::RestrictToMassPeak) linepos=0.25; |
2554 |
< |
if(!PlottingSetup::RestrictToMassPeak) linepos=0.1; //sys uncertainty for iJZB |
2552 |
> |
float linepos=emuncertONPEAK; |
2553 |
> |
if(!PlottingSetup::RestrictToMassPeak) linepos=emuncertOFFPEAK; |
2554 |
> |
|
2555 |
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2556 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2557 |
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2693 |
|
|
2694 |
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) { |
2695 |
|
vector<float> nicer_binning; |
2696 |
< |
nicer_binning.push_back(-125); |
2696 |
> |
|
2697 |
> |
/* nicer_binning.push_back(-400); |
2698 |
> |
nicer_binning.push_back(-250); |
2699 |
> |
nicer_binning.push_back(-200); |
2700 |
> |
nicer_binning.push_back(-150); |
2701 |
> |
nicer_binning.push_back(-100); |
2702 |
> |
nicer_binning.push_back(-50); |
2703 |
> |
nicer_binning.push_back(-20); |
2704 |
> |
|
2705 |
> |
nicer_binning.push_back(0); |
2706 |
> |
nicer_binning.push_back(20); |
2707 |
> |
nicer_binning.push_back(50); |
2708 |
> |
nicer_binning.push_back(100); |
2709 |
> |
nicer_binning.push_back(150); |
2710 |
> |
nicer_binning.push_back(200); |
2711 |
> |
nicer_binning.push_back(250); |
2712 |
> |
nicer_binning.push_back(400);*/ |
2713 |
> |
|
2714 |
|
nicer_binning.push_back(-100); |
2571 |
– |
nicer_binning.push_back(-75); |
2715 |
|
nicer_binning.push_back(-50); |
2716 |
|
nicer_binning.push_back(-25); |
2717 |
|
nicer_binning.push_back(0); |
2726 |
|
nicer_binning.push_back(230); |
2727 |
|
nicer_binning.push_back(280); |
2728 |
|
nicer_binning.push_back(400); |
2729 |
+ |
|
2730 |
|
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
2731 |
|
} |
2732 |
|
|
2733 |
|
|
2734 |
< |
void zjets_prediction_comparison(string mcjzbWithPU) { |
2734 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa) { |
2735 |
|
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2736 |
|
zcan->SetLogy(1); |
2737 |
|
TCut weightbackup=cutWeight; |
2738 |
|
|
2739 |
< |
/* |
2739 |
> |
|
2740 |
|
// Do it without PU re-weighting |
2741 |
|
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2742 |
|
stringstream resultsNoPU; |
2743 |
+ |
stringstream noPUdatajzb; |
2744 |
+ |
stringstream noPUmcjzb; |
2745 |
|
|
2746 |
|
stringstream mcjzbnoPU; |
2747 |
< |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,true); |
2747 |
> |
// void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb) |
2748 |
> |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb); |
2749 |
|
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2750 |
|
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2751 |
+ |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzbnoPU.str() << endl; |
2752 |
|
|
2753 |
|
string mcjzb = mcjzbnoPU.str(); |
2606 |
– |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl; |
2754 |
|
|
2755 |
|
cutWeight="1.0"; |
2756 |
< |
*/ |
2610 |
< |
string mcjzb = mcjzbWithPU; // this is with PURW, if you want without it you have to uncomment the part above (and comment out this line) |
2756 |
> |
|
2757 |
|
|
2758 |
|
vector<float> binning; |
2759 |
|
binning.push_back(0); |
2760 |
+ |
binning.push_back(10); |
2761 |
|
binning.push_back(20); |
2762 |
|
binning.push_back(40); |
2763 |
< |
binning.push_back(60); |
2617 |
< |
binning.push_back(80); |
2763 |
> |
// binning.push_back(80); |
2764 |
|
binning.push_back(100); |
2765 |
|
// float sbg_min=0.; |
2766 |
|
// float sbg_max=100.; |
3368 |
|
|
3369 |
|
TCanvas *testcanv = new TCanvas("testcanv","testcanv"); |
3370 |
|
testcanv->cd(); |
3371 |
< |
switch_overunderflow(true); |
3371 |
> |
// switch_overunderflow(true); |
3372 |
|
TH1F *ptdistr = allsamples.Draw("ptdistr","pt1",100,30,200, "p_{T} [GeV]", "events", cutOSSF,data,luminosity); |
3373 |
|
switch_overunderflow(false); |
3374 |
|
ptdistr->Draw(); |