28 |
|
dout << "Info : The pt requirement is currently set to " << (const char*) passtrig << endl; |
29 |
|
dout << "Info : The mll requirement is currently set to " << (const char*) cutmass << endl; |
30 |
|
dout << "Info : The lepton requirement is currently set to " << (const char*) leptoncut << endl; |
31 |
+ |
dout << "Info : The weight applied to all MC is " << (const char*) cutWeight << endl; |
32 |
|
} |
33 |
|
|
34 |
|
|
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 |
|
|
102 |
|
|
103 |
|
dout << "Finding global peak : " << endl; |
104 |
|
find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma, dataSigma,result,doPUreweighting,""); |
101 |
– |
dout << "Finding peak for electrons : " << endl; |
102 |
– |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr, dataeepeak,dataeepeakerr,mcSigma, dataSigma,result,doPUreweighting,"_ele"); |
103 |
– |
dout << "Finding peak for muons : " << endl; |
104 |
– |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr, datammpeak,datammpeakerr,mcSigma, dataSigma,result,doPUreweighting,"_mu"); |
105 |
– |
|
106 |
– |
datajzb << "(" << jzbvariabledata; |
107 |
– |
mcjzb << "(" << jzbvariablemc; |
108 |
– |
|
109 |
– |
if(dataeepeak>0) datajzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
110 |
– |
else datajzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
111 |
– |
|
112 |
– |
if(datammpeak>0) datajzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
113 |
– |
else datajzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
114 |
– |
|
115 |
– |
if(datapeak>0) datajzb << "- (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
116 |
– |
else datajzb << "+ (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
105 |
|
|
106 |
< |
datajzb << ")"; |
107 |
< |
|
108 |
< |
if(mceepeak>0) mcjzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
109 |
< |
else mcjzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
110 |
< |
|
111 |
< |
if(mcmmpeak>0) mcjzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
112 |
< |
else mcjzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
113 |
< |
|
114 |
< |
if(mcpeak>0) mcjzb << "- (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
115 |
< |
else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
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 |
|
|
129 |
– |
mcjzb << ")"; |
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&&largerzero,data,luminosity); |
174 |
< |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,mc,luminosity); |
175 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,data,luminosity); |
176 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,data,luminosity); |
177 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,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&&largerzero,data, luminosity); |
193 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,data, luminosity); |
194 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,data, luminosity); |
195 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,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(mcjzb,0); |
587 |
< |
make_special_obs_pred_mll_plot(mcjzb,50); |
588 |
< |
make_special_obs_pred_mll_plot(mcjzb,100); |
589 |
< |
make_special_obs_pred_mll_plot(mcjzb,150); |
590 |
< |
make_special_obs_pred_mll_plot(mcjzb,200); |
591 |
< |
make_special_obs_pred_mll_plot(mcjzb,250); |
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_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; |
981 |
|
float low=0; |
982 |
|
float hi=500; |
983 |
|
|
930 |
– |
stringstream largerzeroS; |
931 |
– |
largerzeroS << "("<<jzb<<">0)"; |
932 |
– |
TCut largerzero(largerzeroS.str().c_str()); |
933 |
– |
stringstream smallerzeroS; |
934 |
– |
smallerzeroS << "("<<jzb<<"<0)"; |
935 |
– |
TCut smallerzero(smallerzeroS.str().c_str()); |
936 |
– |
|
984 |
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
985 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
986 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
987 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
988 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
985 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
986 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
987 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
988 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
989 |
|
|
990 |
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
991 |
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
1002 |
|
|
1003 |
|
//these are for the ratio |
1004 |
|
|
1005 |
< |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1006 |
< |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1007 |
< |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1008 |
< |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1005 |
> |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1006 |
> |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1007 |
> |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1008 |
> |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1009 |
|
|
1010 |
|
TH1F *JRcorrJZBSBem; |
1011 |
|
TH1F *JLcorrJZBSBem; |
1012 |
|
TH1F *JRcorrJZBSBeemm; |
1013 |
|
TH1F *JLcorrJZBSBeemm; |
1014 |
|
|
1015 |
< |
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,false); |
1015 |
> |
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false); |
1016 |
|
|
1017 |
|
|
1018 |
|
if(PlottingSetup::RestrictToMassPeak) { |
1019 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1020 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1021 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1022 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1019 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1020 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1021 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1022 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1023 |
|
|
1024 |
|
//these are for the ratio |
1025 |
< |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1026 |
< |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1027 |
< |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,use_signal); |
1028 |
< |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzero,is_data, luminosity,use_signal); |
1025 |
> |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1026 |
> |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1027 |
> |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1028 |
> |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1029 |
|
} |
1030 |
|
|
1031 |
|
TH1F *lm4RcorrJZBeemm; |
1032 |
< |
if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzero,is_data, luminosity,allsamples.FindSample("LM")); |
1032 |
> |
if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM")); |
1033 |
|
|
1034 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
1035 |
|
|
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 |
|
|
1190 |
|
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
1191 |
|
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
1192 |
|
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
1193 |
< |
speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
1193 |
> |
if(PlottingSetup::RestrictToMassPeak) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
1194 |
> |
else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f"); |
1195 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
1196 |
|
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1197 |
|
speciallegBpred->Draw(); |
1198 |
|
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys); |
1199 |
|
|
1200 |
|
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1201 |
< |
THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1201 |
> |
specialcanv->SetLogy(1); |
1202 |
> |
// THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1203 |
|
blankback->Draw(); |
1204 |
< |
kostack.Draw("same"); |
1204 |
> |
// kostack.Draw("same"); |
1205 |
> |
predcomposition.Draw(); |
1206 |
|
Bpred->Draw("hist,same"); |
1207 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1207 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1208 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1209 |
|
legBpred->Draw(); |
1210 |
|
DrawPrelim(); |
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; |
1361 |
|
|
1362 |
|
delete blankback; |
1363 |
|
|
1364 |
+ |
delete BpredSys; |
1365 |
|
if(PlottingSetup::RestrictToMassPeak) { |
1366 |
|
delete RcorrJZBSBem; |
1367 |
|
delete LcorrJZBSBem; |
2203 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev,true); |
2204 |
|
} |
2205 |
|
|
2206 |
< |
float find_one_correction_factor(string FindKeyword, TCut SpecialCut, string SaveAs) { |
2206 |
> |
float find_one_correction_factor(string FindKeyword, bool dodata, TCut SpecialCut, string SaveAs) { |
2207 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
2208 |
|
cancorr->SetLogz(); |
2209 |
|
cancorr->SetRightMargin(0.13); |
2210 |
< |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"&&SpecialCut); |
2210 |
> |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"&&SpecialCut&&passtrig); |
2211 |
|
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
2212 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
2213 |
|
vector<int> SampleIndices=allsamples.FindSample(FindKeyword); |
2214 |
< |
for(int iSample=0;iSample<SampleIndices.size();iSample++) { |
2215 |
< |
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << endl; |
2214 |
> |
for(int iSample=0;iSample<(int)SampleIndices.size();iSample++) { |
2215 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data && !dodata) continue; |
2216 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data ==false && dodata) continue; |
2217 |
> |
|
2218 |
> |
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << " for " << FindKeyword << endl; |
2219 |
|
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",zptforresponsepresentation*cutWeight); |
2220 |
|
} |
2221 |
|
|
2250 |
|
|
2251 |
|
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
2252 |
|
|
2253 |
+ |
dout << "Computing response corrections: " << endl; |
2254 |
|
//Step 1 : Get results |
2255 |
< |
float datacorrection=find_one_correction_factor("Data","","Data"); |
2256 |
< |
float mccorrection=find_one_correction_factor("DY","","MC"); |
2255 |
> |
float datacorrection=find_one_correction_factor("Data",true,"","Data"); |
2256 |
> |
float mccorrection=find_one_correction_factor("DY",false,"","MC"); |
2257 |
|
|
2258 |
< |
float dataEEcorrection=find_one_correction_factor("Data","id1==0","Data_ee"); |
2259 |
< |
float mcEEcorrection=find_one_correction_factor("DY","id1==0","MC_ee"); |
2258 |
> |
float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
2259 |
> |
float mcEEcorrection=find_one_correction_factor("DY",false,"id1==0","MC_ee"); |
2260 |
|
|
2261 |
< |
float dataMMcorrection=find_one_correction_factor("Data","id1==1","Data_mm"); |
2262 |
< |
float mcMMcorrection=find_one_correction_factor("DY","id1==1","MC_mm"); |
2261 |
> |
float dataMMcorrection=find_one_correction_factor("Data",true,"id1==1","Data_mm"); |
2262 |
> |
float mcMMcorrection=find_one_correction_factor("DY",false,"id1==1","MC_mm"); |
2263 |
|
|
2264 |
|
cout << "Corrections : " << endl; |
2265 |
|
cout << " Data : " << datacorrection << endl; |
2267 |
|
cout << " MC : " << mccorrection << endl; |
2268 |
|
cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
2269 |
|
|
2207 |
– |
cout << " result from new one for data: " << 0.937097 << endl; |
2208 |
– |
cout << " result from old one for data: " << 0.937097 << endl; |
2209 |
– |
cout << " result from new one for MC: " << 0.96848 << endl; |
2210 |
– |
cout << " result from old one for MC: " << 0.963502 << endl; |
2211 |
– |
|
2212 |
– |
|
2270 |
|
//Step 2: Processing the result and making it into something useful :-) |
2271 |
|
stringstream jzbvardatas; |
2272 |
|
jzbvardatas << "("; |
2279 |
|
|
2280 |
|
float averagecorrection=(dataMMcorrection+dataEEcorrection)/2.0; |
2281 |
|
|
2282 |
< |
if(averagecorrection>1) jzbvardatas<<"+((id1!=id2)*(jzb[1]-" << averagecorrection-1 << "*pt))"; |
2283 |
< |
if(averagecorrection<1) jzbvardatas<<"+((id1!=id2)*(jzb[1]-" << 1-averagecorrection << "*pt))"; |
2282 |
> |
if(datacorrection>=1) jzbvardatas<<"+((id1!=id2)*(jzb[1]-" << datacorrection-1 << "*pt))"; |
2283 |
> |
if(datacorrection<1) jzbvardatas<<"+((id1!=id2)*(jzb[1]+" << 1-datacorrection << "*pt))"; |
2284 |
|
|
2285 |
|
jzbvardatas << ")"; |
2286 |
|
jzbvardata=jzbvardatas.str(); |
2296 |
|
|
2297 |
|
float averagemccorrection=(mcMMcorrection+mcEEcorrection)/2.0; |
2298 |
|
|
2299 |
< |
if(averagemccorrection>1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]-" << averagemccorrection-1 << "*pt))"; |
2300 |
< |
if(averagemccorrection<1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]-" << 1-averagemccorrection << "*pt))"; |
2299 |
> |
if(mccorrection>=1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]-" << mccorrection-1 << "*pt))"; |
2300 |
> |
if(mccorrection<1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]+" << 1-mccorrection << "*pt))"; |
2301 |
|
|
2302 |
|
jzbvarmcs << ")"; |
2303 |
|
jzbvarmc=jzbvarmcs.str(); |
2399 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
2400 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
2401 |
|
TCut weightbackup=cutWeight; |
2345 |
– |
// cutWeight="1.0"; |
2346 |
– |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2402 |
|
|
2403 |
+ |
bool doPURW=false; |
2404 |
+ |
|
2405 |
+ |
|
2406 |
+ |
if(!doPURW) { |
2407 |
+ |
cutWeight="1.0"; |
2408 |
+ |
// Do it without PU re-weighting |
2409 |
+ |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2410 |
+ |
stringstream resultsNoPU; |
2411 |
+ |
stringstream noPUdatajzb; |
2412 |
+ |
stringstream noPUmcjzb; |
2413 |
+ |
|
2414 |
+ |
stringstream mcjzbnoPU; |
2415 |
+ |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb); |
2416 |
+ |
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2417 |
+ |
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2418 |
+ |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzbnoPU.str() << endl; |
2419 |
+ |
|
2420 |
+ |
mcjzb = mcjzbnoPU.str(); |
2421 |
+ |
|
2422 |
+ |
} |
2423 |
+ |
|
2424 |
+ |
|
2425 |
+ |
|
2426 |
+ |
|
2427 |
+ |
|
2428 |
+ |
|
2429 |
+ |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2430 |
|
|
2431 |
|
TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2432 |
|
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2464 |
|
} |
2465 |
|
|
2466 |
|
vector<TH1F*> histos; |
2467 |
+ |
TZem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2468 |
+ |
TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2469 |
|
histos.push_back(TZem); |
2470 |
|
histos.push_back(TZeemm); |
2471 |
|
if(PlottingSetup::RestrictToMassPeak) { |
2472 |
+ |
TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2473 |
+ |
TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2474 |
|
histos.push_back(TSem); |
2475 |
|
histos.push_back(TSeemm); |
2476 |
|
} |
2513 |
|
TSeemm->Draw("same"); |
2514 |
|
} |
2515 |
|
|
2516 |
< |
float linepos=0.25; |
2517 |
< |
if(PlottingSetup::RestrictToMassPeak) linepos=0.25; |
2518 |
< |
if(!PlottingSetup::RestrictToMassPeak) linepos=0.1; //sys uncertainty for iJZB |
2516 |
> |
float linepos=emuncertONPEAK; |
2517 |
> |
if(!PlottingSetup::RestrictToMassPeak) linepos=emuncertOFFPEAK; |
2518 |
> |
|
2519 |
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2520 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2521 |
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2597 |
|
tcan->SetLogy(0); |
2598 |
|
rightofzp->Divide(rightsfzp); |
2599 |
|
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
2600 |
< |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.0); |
2600 |
> |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.5); |
2601 |
|
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
2602 |
|
rightofzp->Draw(); |
2603 |
|
if(PlottingSetup::RestrictToMassPeak) { |
2657 |
|
|
2658 |
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) { |
2659 |
|
vector<float> nicer_binning; |
2660 |
< |
nicer_binning.push_back(-125); |
2660 |
> |
|
2661 |
> |
/* nicer_binning.push_back(-400); |
2662 |
> |
nicer_binning.push_back(-250); |
2663 |
> |
nicer_binning.push_back(-200); |
2664 |
> |
nicer_binning.push_back(-150); |
2665 |
> |
nicer_binning.push_back(-100); |
2666 |
> |
nicer_binning.push_back(-50); |
2667 |
> |
nicer_binning.push_back(-20); |
2668 |
> |
|
2669 |
> |
nicer_binning.push_back(0); |
2670 |
> |
nicer_binning.push_back(20); |
2671 |
> |
nicer_binning.push_back(50); |
2672 |
> |
nicer_binning.push_back(100); |
2673 |
> |
nicer_binning.push_back(150); |
2674 |
> |
nicer_binning.push_back(200); |
2675 |
> |
nicer_binning.push_back(250); |
2676 |
> |
nicer_binning.push_back(400);*/ |
2677 |
> |
|
2678 |
|
nicer_binning.push_back(-100); |
2576 |
– |
nicer_binning.push_back(-75); |
2679 |
|
nicer_binning.push_back(-50); |
2680 |
|
nicer_binning.push_back(-25); |
2681 |
|
nicer_binning.push_back(0); |
2690 |
|
nicer_binning.push_back(230); |
2691 |
|
nicer_binning.push_back(280); |
2692 |
|
nicer_binning.push_back(400); |
2693 |
+ |
|
2694 |
|
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
2695 |
|
} |
2696 |
|
|
2697 |
|
|
2698 |
< |
void zjets_prediction_comparison(string mcjzbWithPU) { |
2698 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa) { |
2699 |
|
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2700 |
|
zcan->SetLogy(1); |
2701 |
|
TCut weightbackup=cutWeight; |
2702 |
|
|
2703 |
< |
/* |
2703 |
> |
|
2704 |
|
// Do it without PU re-weighting |
2705 |
|
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2706 |
|
stringstream resultsNoPU; |
2707 |
+ |
stringstream noPUdatajzb; |
2708 |
+ |
stringstream noPUmcjzb; |
2709 |
|
|
2710 |
|
stringstream mcjzbnoPU; |
2711 |
< |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,true); |
2711 |
> |
// void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb) |
2712 |
> |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb); |
2713 |
|
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2714 |
|
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2715 |
+ |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzbnoPU.str() << endl; |
2716 |
|
|
2717 |
|
string mcjzb = mcjzbnoPU.str(); |
2611 |
– |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl; |
2718 |
|
|
2719 |
|
cutWeight="1.0"; |
2720 |
< |
*/ |
2615 |
< |
string mcjzb = mcjzbWithPU; // this is with PURW, if you want without it you have to uncomment the part above (and comment out this line) |
2720 |
> |
|
2721 |
|
|
2722 |
|
vector<float> binning; |
2723 |
|
binning.push_back(0); |
2724 |
+ |
binning.push_back(10); |
2725 |
|
binning.push_back(20); |
2726 |
|
binning.push_back(40); |
2727 |
< |
binning.push_back(60); |
2622 |
< |
binning.push_back(80); |
2727 |
> |
// binning.push_back(80); |
2728 |
|
binning.push_back(100); |
2729 |
|
// float sbg_min=0.; |
2730 |
|
// float sbg_max=100.; |
2756 |
|
TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio"); |
2757 |
|
hratio->Divide(hJZBneg); |
2758 |
|
|
2759 |
+ |
for(int i=1;i<=hJZBpos->GetNbinsX();i++) { |
2760 |
+ |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << endl; |
2761 |
+ |
} |
2762 |
+ |
|
2763 |
|
zcan->SetLogy(0); |
2764 |
|
hratio->GetYaxis()->SetRangeUser(0,2.5); |
2765 |
|
hratio->GetYaxis()->SetTitle("Observed/Predicted"); |
3332 |
|
|
3333 |
|
TCanvas *testcanv = new TCanvas("testcanv","testcanv"); |
3334 |
|
testcanv->cd(); |
3335 |
< |
switch_overunderflow(true); |
3335 |
> |
// switch_overunderflow(true); |
3336 |
|
TH1F *ptdistr = allsamples.Draw("ptdistr","pt1",100,30,200, "p_{T} [GeV]", "events", cutOSSF,data,luminosity); |
3337 |
|
switch_overunderflow(false); |
3338 |
|
ptdistr->Draw(); |