15 |
|
#include <TSQLResult.h> |
16 |
|
#include <TProfile.h> |
17 |
|
#include <TLegendEntry.h> |
18 |
+ |
#include "TMath.h" |
19 |
+ |
#include "Math/DistFunc.h" |
20 |
|
|
21 |
|
using namespace std; |
22 |
|
|
34 |
|
} |
35 |
|
|
36 |
|
|
37 |
+ |
namespace PeakLibrary { |
38 |
+ |
bool StoreHistos=false; |
39 |
+ |
vector<TH1F*> DataHistogram; |
40 |
+ |
vector<TH1F*> MCHistogram; |
41 |
+ |
} |
42 |
+ |
|
43 |
|
|
44 |
< |
void find_one_peak_combination(TCut specialcut, float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &DataSigma, stringstream &result, bool doPUreweighting = true, string saveas="") |
44 |
> |
void find_one_peak_combination(TCut specialcut, bool SwitchOffNJetsCut, float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &MCSigmaError, float &DataSigma, float& DataSigmaError, stringstream &result, bool doPUreweighting = true, string saveas="") |
45 |
|
{ |
46 |
|
// Temporarily switch off PU reweighting, if asked |
47 |
|
TCut weightbackup=cutWeight; |
50 |
|
int nbins=100; |
51 |
|
if(PlottingSetup::DoBTag) nbins=25; |
52 |
|
|
53 |
+ |
TCut nJetsCut(cutnJets); |
54 |
+ |
if(SwitchOffNJetsCut) nJetsCut=specialcut; |
55 |
+ |
|
56 |
+ |
|
57 |
|
TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations"); |
58 |
< |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&specialcut,mc, luminosity); |
59 |
< |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&specialcut,data, luminosity); |
60 |
< |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&specialcut,mc, luminosity); |
61 |
< |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&specialcut,data, luminosity); |
58 |
> |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&nJetsCut&&specialcut,mc, luminosity); |
59 |
> |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&nJetsCut&&specialcut,data, luminosity); |
60 |
> |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&nJetsCut&&specialcut,mc, luminosity); |
61 |
> |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&nJetsCut&&specialcut,data, luminosity); |
62 |
|
TH1F *rawttbarjzbeemmMC; |
63 |
|
|
64 |
|
if(method==doKM) { |
65 |
|
//we only need this histo for the KM fitting... |
66 |
< |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,nbins, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&specialcut,mc,luminosity,allsamples.FindSample("TTJet")); |
67 |
< |
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method,saveas); |
68 |
< |
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method,saveas); |
66 |
> |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,nbins, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&nJetsCut&&specialcut,mc,luminosity,allsamples.FindSample("TTJet")); |
67 |
> |
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas); |
68 |
> |
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas); |
69 |
|
delete rawttbarjzbeemmMC; |
70 |
|
} |
71 |
|
else { |
74 |
|
reducedMC->Add(rawJZBemMC,-1); |
75 |
|
reducedData->Add(rawJZBemData,-1); |
76 |
|
//this is Kostas' way of doing it - we subtract em to get rid of some of the ttbar contribution (in reality, of flavor-symmetric contribution) |
77 |
< |
MCPeak=find_peak(reducedMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method,saveas); |
78 |
< |
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method,saveas); |
77 |
> |
MCPeak=find_peak(reducedMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas); |
78 |
> |
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas); |
79 |
|
delete reducedMC; |
80 |
|
delete reducedData; |
81 |
|
} |
85 |
|
|
86 |
|
// MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
87 |
|
// DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
88 |
< |
dout << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl; |
89 |
< |
result << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl; |
90 |
< |
dout << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl; |
91 |
< |
result << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl; |
92 |
< |
delete rawJZBeemmData; |
93 |
< |
delete rawJZBeemmMC; |
88 |
> |
dout << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
89 |
> |
result << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
90 |
> |
dout << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
91 |
> |
result << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
92 |
> |
|
93 |
> |
if(!PeakLibrary::StoreHistos) { |
94 |
> |
delete rawJZBeemmData; |
95 |
> |
delete rawJZBeemmMC; |
96 |
> |
} else { |
97 |
> |
rawJZBeemmMC->SetName(GetNumericHistoName().c_str()); |
98 |
> |
rawJZBeemmData->SetName(GetNumericHistoName().c_str()); |
99 |
> |
rawJZBeemmMC->Add(rawJZBemMC,-1); |
100 |
> |
rawJZBeemmData->Add(rawJZBemData,-1); |
101 |
> |
PeakLibrary::DataHistogram.push_back(rawJZBeemmData); |
102 |
> |
PeakLibrary::MCHistogram.push_back(rawJZBeemmMC); |
103 |
> |
} |
104 |
> |
|
105 |
> |
|
106 |
> |
|
107 |
|
delete rawJZBemData; |
108 |
|
delete rawJZBemMC; |
109 |
|
delete tempcan; |
110 |
|
} |
111 |
|
|
112 |
< |
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb) |
112 |
> |
|
113 |
> |
void FindPeakPileUpCorrection() { |
114 |
> |
bool StoreResultsInSeparateFile=true; |
115 |
> |
PeakLibrary::StoreHistos=true; |
116 |
> |
|
117 |
> |
|
118 |
> |
dout << "Finding peak position as a function of PU" << endl; |
119 |
> |
float MCPeak, MCPeakError, DataPeak, DataPeakError; |
120 |
> |
stringstream result, datajzb, mcjzb; |
121 |
> |
bool doPUreweighting=true; |
122 |
> |
bool SwitchOffNJetsCut=false; |
123 |
> |
|
124 |
> |
|
125 |
> |
TCanvas *can = new TCanvas("can","can"); |
126 |
> |
float mcSigma,mcSigmaError,dataSigma,dataSigmaError; |
127 |
> |
|
128 |
> |
const int nbins=10; |
129 |
> |
float NumVtxBin[nbins] = {0,7,9,11,13,15,17,19,21,50}; |
130 |
> |
|
131 |
> |
stringstream NowCut; |
132 |
> |
|
133 |
> |
|
134 |
> |
Double_t mc_peak_x[nbins]; |
135 |
> |
Double_t mc_peak_y[nbins]; |
136 |
> |
Double_t mc_peak_dxh[nbins]; |
137 |
> |
Double_t mc_peak_dxl[nbins]; |
138 |
> |
Double_t mc_peak_dy[nbins]; |
139 |
> |
|
140 |
> |
Double_t data_peak_x[nbins]; |
141 |
> |
Double_t data_peak_y[nbins]; |
142 |
> |
Double_t data_peak_dxh[nbins]; |
143 |
> |
Double_t data_peak_dxl[nbins]; |
144 |
> |
Double_t data_peak_dy[nbins]; |
145 |
> |
|
146 |
> |
Double_t mc_width_x[nbins]; |
147 |
> |
Double_t mc_width_y[nbins]; |
148 |
> |
Double_t mc_width_dxh[nbins]; |
149 |
> |
Double_t mc_width_dxl[nbins]; |
150 |
> |
Double_t mc_width_dy[nbins]; |
151 |
> |
|
152 |
> |
Double_t data_width_x[nbins]; |
153 |
> |
Double_t data_width_y[nbins]; |
154 |
> |
Double_t data_width_dxh[nbins]; |
155 |
> |
Double_t data_width_dxl[nbins]; |
156 |
> |
Double_t data_width_dy[nbins]; |
157 |
> |
|
158 |
> |
for(int i=0;i<nbins-1;i++) { |
159 |
> |
NowCut.str(""); |
160 |
> |
NowCut << "numVtx>" << NumVtxBin[i] << "&&numVtx<=" << NumVtxBin[i+1]; |
161 |
> |
cout << "NVtx cut is now : " << NowCut.str() << endl; |
162 |
> |
find_one_peak_combination(TCut(NowCut.str().c_str()),SwitchOffNJetsCut,MCPeak,MCPeakError, DataPeak,DataPeakError,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
163 |
> |
cout << " " << MCPeak << " +/- " << MCPeakError << endl; |
164 |
> |
cout << " " << DataPeak << " +/- " << DataPeakError << endl; |
165 |
> |
|
166 |
> |
TH1F *hDataSFNumVtx = allsamples.Draw("hDataSFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSSF&&cutnJets&&TCut(NowCut.str().c_str()),data, luminosity); |
167 |
> |
TH1F *hDataOFNumVtx = allsamples.Draw("hDataOFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSOF&&cutnJets&&TCut(NowCut.str().c_str()),data, luminosity); |
168 |
> |
TH1F *hMCSFNumVtx = allsamples.Draw("hMCSFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSSF&&cutnJets&&TCut(NowCut.str().c_str()),mc, luminosity); |
169 |
> |
TH1F *hMCOFNumVtx = allsamples.Draw("hMCOFNumVtx","numVtx",100,-0.5,49.5, "N_{vtx}", "events", cutmass&&cutOSOF&&cutnJets&&TCut(NowCut.str().c_str()),mc, luminosity); |
170 |
> |
|
171 |
> |
hDataSFNumVtx->Add(hDataOFNumVtx,-1); |
172 |
> |
hMCSFNumVtx->Add(hMCOFNumVtx,-1); |
173 |
> |
|
174 |
> |
mc_peak_x[i]=hMCSFNumVtx->GetMean(); |
175 |
> |
mc_peak_y[i]=MCPeak; |
176 |
> |
mc_peak_dy[i]=MCPeakError; |
177 |
> |
|
178 |
> |
data_peak_x[i]=hDataSFNumVtx->GetMean(); |
179 |
> |
data_peak_y[i]=DataPeak; |
180 |
> |
data_peak_dy[i]=DataPeakError; |
181 |
> |
|
182 |
> |
mc_width_x[i]=hMCSFNumVtx->GetMean(); |
183 |
> |
mc_width_y[i]=mcSigma; |
184 |
> |
mc_width_dy[i]=mcSigmaError; |
185 |
> |
|
186 |
> |
data_width_x[i]=hDataSFNumVtx->GetMean(); |
187 |
> |
data_width_y[i]=dataSigma; |
188 |
> |
data_width_dy[i]=dataSigmaError; |
189 |
> |
|
190 |
> |
delete hDataSFNumVtx; |
191 |
> |
delete hDataOFNumVtx; |
192 |
> |
delete hMCSFNumVtx; |
193 |
> |
delete hMCOFNumVtx; |
194 |
> |
} |
195 |
> |
|
196 |
> |
for(int i=0;i<nbins-1;i++) { |
197 |
> |
if(i==0) { |
198 |
> |
data_width_dxl[i]=data_width_x[i]; |
199 |
> |
data_peak_dxl[i]=data_peak_x[i]; |
200 |
> |
data_width_dxh[i]=0.5*(data_width_x[i+1]-data_width_x[i]); |
201 |
> |
data_peak_dxh[i]=0.5*(data_peak_x[i+1]-data_peak_x[i]); |
202 |
> |
|
203 |
> |
mc_width_dxl[i]=mc_width_x[i]; |
204 |
> |
mc_peak_dxl[i]=mc_peak_x[i]; |
205 |
> |
mc_width_dxh[i]=0.5*(mc_width_x[i+1]-mc_width_x[i]); |
206 |
> |
mc_peak_dxh[i]=0.5*(mc_peak_x[i+1]-mc_peak_x[i]); |
207 |
> |
} else if(i==nbins-2) { |
208 |
> |
data_width_dxl[i]=0.5*(data_width_x[i]-data_width_x[i-1]); |
209 |
> |
data_peak_dxl[i]=0.5*(data_peak_x[i]-data_peak_x[i-1]); |
210 |
> |
data_width_dxh[i]=50-data_width_x[i]; |
211 |
> |
data_peak_dxh[i]=50-data_peak_x[i]; |
212 |
> |
|
213 |
> |
mc_width_dxl[i]=0.5*(mc_width_x[i]-mc_width_x[i-1]); |
214 |
> |
mc_peak_dxl[i]=0.5*(mc_peak_x[i]-mc_peak_x[i-1]); |
215 |
> |
mc_width_dxh[i]=50-mc_width_x[i]; |
216 |
> |
mc_peak_dxh[i]=50-mc_peak_x[i]; |
217 |
> |
} else { |
218 |
> |
data_width_dxl[i]=0.5*(data_width_x[i]-data_width_x[i-1]); |
219 |
> |
data_peak_dxl[i]=0.5*(data_peak_x[i]-data_peak_x[i-1]); |
220 |
> |
data_width_dxh[i]=0.5*(data_width_x[i+1]-data_width_x[i]); |
221 |
> |
data_peak_dxh[i]=0.5*(data_peak_x[i+1]-data_peak_x[i]); |
222 |
> |
|
223 |
> |
mc_width_dxl[i]=0.5*(mc_width_x[i]-mc_width_x[i-1]); |
224 |
> |
mc_peak_dxl[i]=0.5*(mc_peak_x[i]-mc_peak_x[i-1]); |
225 |
> |
mc_width_dxh[i]=0.5*(mc_width_x[i+1]-mc_width_x[i]); |
226 |
> |
mc_peak_dxh[i]=0.5*(mc_peak_x[i+1]-mc_peak_x[i]); |
227 |
> |
} |
228 |
> |
} |
229 |
> |
|
230 |
> |
TGraphAsymmErrors *gMCPeak = new TGraphAsymmErrors(nbins-1,mc_peak_x,mc_peak_y,mc_peak_dxl,mc_peak_dxh,mc_peak_dy,mc_peak_dy); |
231 |
> |
gMCPeak->SetTitle("gMCPeak"); |
232 |
> |
gMCPeak->SetName("gMCPeak"); |
233 |
> |
|
234 |
> |
TGraphAsymmErrors *gDataPeak = new TGraphAsymmErrors(nbins-1,data_peak_x,data_peak_y,data_peak_dxl,data_peak_dxh,data_peak_dy,data_peak_dy); |
235 |
> |
gDataPeak->SetTitle("gDataPeak"); |
236 |
> |
gDataPeak->SetName("gDataPeak"); |
237 |
> |
|
238 |
> |
TGraphAsymmErrors *gMCWidth = new TGraphAsymmErrors(nbins-1,mc_width_x,mc_width_y,mc_width_dxl,mc_width_dxh,mc_width_dy,mc_width_dy); |
239 |
> |
gMCWidth->SetTitle("gMCWidth"); |
240 |
> |
gMCWidth->SetName("gMCWidth"); |
241 |
> |
|
242 |
> |
TGraphAsymmErrors *gDataWidth = new TGraphAsymmErrors(nbins-1,data_width_x,data_width_y,data_width_dxl,data_width_dxh,data_width_dy,data_width_dy); |
243 |
> |
gDataWidth->SetTitle("gDataWidth"); |
244 |
> |
gDataWidth->SetName("gDataWidth"); |
245 |
> |
|
246 |
> |
can->cd(); |
247 |
> |
gMCPeak->GetXaxis()->SetTitle("N(Vertices)"); |
248 |
> |
gMCPeak->GetYaxis()->SetTitle("Peak position"); |
249 |
> |
gMCPeak->GetXaxis()->CenterTitle(); |
250 |
> |
gMCPeak->GetYaxis()->CenterTitle(); |
251 |
> |
gDataPeak->GetXaxis()->SetTitle("N(Vertices)"); |
252 |
> |
gDataPeak->GetYaxis()->SetTitle("Peak position"); |
253 |
> |
gDataPeak->GetXaxis()->CenterTitle(); |
254 |
> |
gDataPeak->GetYaxis()->CenterTitle(); |
255 |
> |
|
256 |
> |
gDataWidth->GetXaxis()->SetTitle("N(Vertices)"); |
257 |
> |
gDataWidth->GetYaxis()->SetTitle("#sigma_{JZB}"); |
258 |
> |
gDataWidth->GetXaxis()->CenterTitle(); |
259 |
> |
gDataWidth->GetYaxis()->CenterTitle(); |
260 |
> |
gMCWidth->GetXaxis()->SetTitle("N(Vertices)"); |
261 |
> |
gMCWidth->GetYaxis()->SetTitle("#sigma_{JZB}"); |
262 |
> |
gMCWidth->GetXaxis()->CenterTitle(); |
263 |
> |
gMCWidth->GetYaxis()->CenterTitle(); |
264 |
> |
|
265 |
> |
gMCPeak->SetFillColor(TColor::GetColor("#2E9AFE")); |
266 |
> |
gDataPeak->SetFillColor(TColor::GetColor("#2E9AFE")); |
267 |
> |
gDataWidth->SetFillColor(TColor::GetColor("#2E9AFE")); |
268 |
> |
gMCWidth->SetFillColor(TColor::GetColor("#2E9AFE")); |
269 |
> |
|
270 |
> |
can->cd(); |
271 |
> |
gMCPeak->Draw("A2"); |
272 |
> |
DrawMCPrelim(); |
273 |
> |
CompleteSave(can,"PUStudy/MCPeak"); |
274 |
> |
|
275 |
> |
can->cd(); |
276 |
> |
gStyle->SetOptFit(0); |
277 |
> |
gMCPeak->Fit("pol1"); |
278 |
> |
gMCPeak->GetYaxis()->SetRangeUser(0,15); |
279 |
> |
TF1 *MCFit = (TF1*)gMCPeak->GetFunction("pol1"); |
280 |
> |
|
281 |
> |
gMCPeak->Draw("A2"); |
282 |
> |
MCFit->SetLineColor(kBlue); |
283 |
> |
MCFit->SetLineWidth(2); |
284 |
> |
MCFit->Draw("same"); |
285 |
> |
stringstream mresult; |
286 |
> |
mresult << "Slope: " << std::setprecision(2) << MCFit->GetParameter(1) << " +/- " << MCFit->GetParError(1); |
287 |
> |
TText* mrestitle = write_text(0.7,0.2,mresult.str()); |
288 |
> |
mrestitle->Draw(); |
289 |
> |
DrawMCPrelim(); |
290 |
> |
CompleteSave(can,"PUStudy/MCPeak_Fit"); |
291 |
> |
|
292 |
> |
gMCPeak->Draw("A2"); |
293 |
> |
DrawMCPrelim(); |
294 |
> |
CompleteSave(can,"PUStudy/MCWidth"); |
295 |
> |
|
296 |
> |
|
297 |
> |
can->cd(); |
298 |
> |
gDataPeak->Draw("A2"); |
299 |
> |
DrawPrelim(); |
300 |
> |
CompleteSave(can,"PUStudy/DataPeak"); |
301 |
> |
|
302 |
> |
can->cd(); |
303 |
> |
gStyle->SetOptFit(0); |
304 |
> |
gDataPeak->GetYaxis()->SetRangeUser(0,15); |
305 |
> |
gDataPeak->Fit("pol1"); |
306 |
> |
|
307 |
> |
TF1 *DataFit = (TF1*)gDataPeak->GetFunction("pol1"); |
308 |
> |
DataFit->SetLineColor(kBlue); |
309 |
> |
DataFit->SetLineWidth(2); |
310 |
> |
DataFit->Draw("same"); |
311 |
> |
stringstream dresult; |
312 |
> |
dresult << "Slope: " << std::setprecision(2) << DataFit->GetParameter(1) << " +/- " << DataFit->GetParError(1); |
313 |
> |
TText* drestitle = write_text(0.7,0.2,dresult.str()); |
314 |
> |
drestitle->Draw(); |
315 |
> |
DrawPrelim(); |
316 |
> |
CompleteSave(can,"PUStudy/DataPeak_Fit"); |
317 |
> |
|
318 |
> |
can->cd(); |
319 |
> |
gDataWidth->Draw("A2"); |
320 |
> |
DrawPrelim(); |
321 |
> |
CompleteSave(can,"PUStudy/DataWidth"); |
322 |
> |
|
323 |
> |
if(StoreResultsInSeparateFile) { |
324 |
> |
TFile *PeakFinding = new TFile("PeakFindingWithPeakCorrection.root","RECREATE"); |
325 |
> |
gMCPeak->Write(); |
326 |
> |
gDataPeak->Write(); |
327 |
> |
gMCWidth->Write(); |
328 |
> |
gDataWidth->Write(); |
329 |
> |
PeakFinding->Close(); |
330 |
> |
} |
331 |
> |
|
332 |
> |
|
333 |
> |
dout << "The suggested correction for Data is : " << DataFit->GetParameter(1) << endl; |
334 |
> |
dout << "The suggested correction for MC is : " << MCFit->GetParameter(1) << endl; |
335 |
> |
|
336 |
> |
TLegend *leg = make_legend(); |
337 |
> |
can->cd(); |
338 |
> |
int j=0; |
339 |
> |
for(int i=PeakLibrary::DataHistogram.size()-5;i<PeakLibrary::DataHistogram.size();i++) { |
340 |
> |
PeakLibrary::DataHistogram[i]->Rebin(5); |
341 |
> |
PeakLibrary::DataHistogram[i]->SetLineColor(j+1); |
342 |
> |
if(i==PeakLibrary::DataHistogram.size()-5) PeakLibrary::DataHistogram[i]->DrawNormalized("histo"); |
343 |
> |
else PeakLibrary::DataHistogram[i]->DrawNormalized("histo,same"); |
344 |
> |
stringstream name; |
345 |
> |
name << NumVtxBin[j] << " < N_{vtx} < " << NumVtxBin[j+1]; |
346 |
> |
leg->AddEntry(PeakLibrary::DataHistogram[i],name.str().c_str(),"l"); |
347 |
> |
j++; |
348 |
> |
} |
349 |
> |
|
350 |
> |
leg->Draw(); |
351 |
> |
DrawPrelim(); |
352 |
> |
CompleteSave(can,"PUStudy/DataOverview"); |
353 |
> |
|
354 |
> |
TLegend *leg2 = make_legend(); |
355 |
> |
can->cd(); |
356 |
> |
j=0; |
357 |
> |
for(int i=PeakLibrary::MCHistogram.size()-5;i<PeakLibrary::MCHistogram.size();i++) { |
358 |
> |
PeakLibrary::MCHistogram[i]->Rebin(5); |
359 |
> |
PeakLibrary::MCHistogram[i]->SetLineColor(j+1); |
360 |
> |
if(i==PeakLibrary::MCHistogram.size()-5) PeakLibrary::MCHistogram[i]->DrawNormalized("histo"); |
361 |
> |
else PeakLibrary::MCHistogram[i]->DrawNormalized("histo,same"); |
362 |
> |
stringstream name; |
363 |
> |
name << NumVtxBin[j] << " < N_{vtx} < " << NumVtxBin[j+1]; |
364 |
> |
leg->AddEntry(PeakLibrary::MCHistogram[i],name.str().c_str(),"l"); |
365 |
> |
j++; |
366 |
> |
} |
367 |
> |
|
368 |
> |
leg->Draw(); |
369 |
> |
DrawPrelim(); |
370 |
> |
CompleteSave(can,"PUStudy/MCOverview"); |
371 |
> |
|
372 |
> |
delete can; |
373 |
> |
PeakLibrary::StoreHistos=false; |
374 |
> |
} |
375 |
> |
|
376 |
> |
|
377 |
> |
|
378 |
> |
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb, string sSpecialCut="", bool SwitchOffNJetsCut=false) |
379 |
|
{ |
380 |
+ |
bool overunderflowstatus=addoverunderflowbins; |
381 |
+ |
switch_overunderflow(false); |
382 |
+ |
|
383 |
+ |
TCut SpecialCut("mll>=0"); |
384 |
+ |
if(sSpecialCut!="") SpecialCut=TCut(sSpecialCut.c_str()); |
385 |
|
|
386 |
|
bool DoInvidualeemmPeaks=false; |
387 |
|
|
394 |
|
float datammpeak,dataeepeak; |
395 |
|
float datammpeakerr,dataeepeakerr; |
396 |
|
|
397 |
< |
float mcSigma, dataSigma; |
397 |
> |
float mcSigma,mcSigmaError, dataSigma, dataSigmaError; |
398 |
|
|
399 |
|
dout << "Finding global peak : " << endl; |
400 |
< |
find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma, dataSigma,result,doPUreweighting,""); |
400 |
> |
find_one_peak_combination(SpecialCut,SwitchOffNJetsCut,mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
401 |
|
|
402 |
|
if(DoInvidualeemmPeaks) { |
403 |
|
dout << "Finding peak for electrons : " << endl; |
404 |
< |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr, dataeepeak,dataeepeakerr,mcSigma, dataSigma,result,doPUreweighting,"_ele"); |
404 |
> |
find_one_peak_combination(SpecialCut&&TCut("id1==0"),SwitchOffNJetsCut,mceepeak,mceepeakerr,dataeepeak,dataeepeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_ele"); |
405 |
|
dout << "Finding peak for muons : " << endl; |
406 |
< |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr, datammpeak,datammpeakerr,mcSigma, dataSigma,result,doPUreweighting,"_mu"); |
406 |
> |
find_one_peak_combination(SpecialCut&&TCut("id1==1"),SwitchOffNJetsCut,mcmmpeak,mcmmpeakerr,datammpeak,datammpeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_mu"); |
407 |
|
|
408 |
|
datajzb << "(" << jzbvariabledata; |
409 |
|
mcjzb << "(" << jzbvariablemc; |
429 |
|
else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
430 |
|
|
431 |
|
mcjzb << ")"; |
432 |
+ |
|
433 |
|
} else { |
434 |
|
datajzb << "(" << jzbvariabledata; |
435 |
< |
mcjzb << "(" << jzbvariablemc; |
435 |
> |
mcjzb << "(" << jzbvariablemc; |
436 |
|
|
437 |
|
if(datapeak>0) datajzb << "- " << TMath::Abs(datapeak) << " "; |
438 |
|
else datajzb << "+ " << TMath::Abs(datapeak) << " "; |
444 |
|
|
445 |
|
mcjzb << ")"; |
446 |
|
} |
150 |
– |
|
447 |
|
|
448 |
+ |
MCPeak=mcpeak; |
449 |
+ |
MCPeakError=mcpeakerr; |
450 |
+ |
DataPeak=datapeak; |
451 |
+ |
DataPeakError=datapeakerr; |
452 |
+ |
switch_overunderflow(overunderflowstatus); |
453 |
|
} |
454 |
|
|
455 |
< |
void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold) { |
455 |
> |
void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold, float binWidth, int MCorData) { |
456 |
|
float min=70.0; |
457 |
|
float max=115.0; |
458 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
459 |
|
min=20; |
460 |
< |
max=200; |
460 |
> |
max=300; |
461 |
|
} |
462 |
< |
int nbins=int((max-min)/5); |
462 |
> |
int nbins=int((max-min)/binWidth); |
463 |
> |
|
464 |
> |
string prefix=""; |
465 |
> |
if(MCorData==mc) prefix="MC__"; |
466 |
> |
|
467 |
> |
|
468 |
> |
if(MCorData==mc) datajzb=mcjzb; |
469 |
|
|
470 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
471 |
|
|
482 |
|
largerzeroMS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
483 |
|
TCut largerzeroM(largerzeroMS.str().c_str()); |
484 |
|
|
485 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroD,data,luminosity); |
486 |
< |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroM,mc,luminosity); |
487 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzeroD,data,luminosity); |
488 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzeroD,data,luminosity); |
489 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzeroD,data,luminosity); |
485 |
> |
|
486 |
> |
stringstream smallerzeroMS; |
487 |
> |
smallerzeroMS << "(" << mcjzb << "<-" << jzbthreshold << ")"; |
488 |
> |
TCut smallerzeroM(smallerzeroMS.str().c_str()); |
489 |
> |
|
490 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroD,MCorData,luminosity); |
491 |
> |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroM,mc,luminosity); |
492 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzeroD,MCorData,luminosity); |
493 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzeroD,MCorData,luminosity); |
494 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzeroD,MCorData,luminosity); |
495 |
|
|
496 |
|
TH1F *RcorrJZBSBem; |
497 |
|
TH1F *LcorrJZBSBem; |
500 |
|
|
501 |
|
// TH1F *RcorrJZBeemmNoS; |
502 |
|
|
503 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
504 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,data, luminosity); |
505 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,data, luminosity); |
506 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,data, luminosity); |
507 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzeroD,data, luminosity); |
503 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
504 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,MCorData, luminosity); |
505 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,MCorData, luminosity); |
506 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,MCorData, luminosity); |
507 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzeroD,MCorData, luminosity); |
508 |
|
} |
509 |
+ |
|
510 |
+ |
// Separate predictions |
511 |
+ |
TH1F* SFN = (TH1F*)LcorrJZBeemm->Clone("SFN"); |
512 |
+ |
TH1F* OFP = (TH1F*)RcorrJZBem->Clone("OFP"); |
513 |
+ |
TH1F* OFN = (TH1F*)LcorrJZBem->Clone("OFN"); |
514 |
|
|
515 |
< |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
516 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
517 |
< |
Bpred->Add(RcorrJZBem,1.0/3.); |
518 |
< |
Bpred->Add(LcorrJZBem,-1.0/3.); |
519 |
< |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
520 |
< |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
521 |
< |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
522 |
< |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
515 |
> |
TH1F *BpredSys = (TH1F*)SFN->Clone("BpredSys"); |
516 |
> |
ClearHisto(BpredSys); |
517 |
> |
AddSquared(BpredSys,SFN,pow(PlottingSetup::zjetsestimateuncertOFFPEAK,2)); |
518 |
> |
|
519 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
520 |
> |
OFP->Scale(1.0/3.0); |
521 |
> |
OFP->Add(RcorrJZBSBem,1.0/3.); |
522 |
> |
OFP->Add(RcorrJZBSBeemm,1.0/3.); |
523 |
> |
OFN->Scale(1.0/3.0); |
524 |
> |
OFN->Add(LcorrJZBSBem,1.0/3.); |
525 |
> |
OFN->Add(LcorrJZBSBeemm,1.0/3.); |
526 |
> |
AddSquared(BpredSys,RcorrJZBem,pow((1.0/3) * PlottingSetup::emuncertOFFPEAK,2)); |
527 |
> |
AddSquared(BpredSys,RcorrJZBSBem,pow((1.0/3) * PlottingSetup::emuncertOFFPEAK,2)); |
528 |
> |
AddSquared(BpredSys,RcorrJZBSBeemm,pow((1.0/3) * PlottingSetup::emuncertOFFPEAK,2)); |
529 |
|
} else { |
530 |
< |
Bpred->Add(RcorrJZBem,1.0); |
531 |
< |
Bpred->Add(LcorrJZBem,-1.0); |
530 |
> |
AddSquared(BpredSys,OFN,pow(PlottingSetup::emuncertOFFPEAK,2)); |
531 |
> |
} |
532 |
> |
|
533 |
> |
SQRT(BpredSys); |
534 |
> |
|
535 |
> |
TGraphErrors *BpredSysBand = new TGraphErrors(); |
536 |
> |
// TH1F *BpredSysBand = (TH1F*)BpredSys->Clone("BpredSysBand"); |
537 |
> |
|
538 |
> |
for(int i=1;i<=BpredSys->GetNbinsX();i++) { |
539 |
> |
/*BpredSysBand->SetBinError(i,BpredSysBand->GetBinContent(i)); |
540 |
> |
BpredSysBand->SetBinContent(i,0);*/ |
541 |
> |
float dx=0.5*BpredSys->GetBinWidth(i); |
542 |
> |
float dy=BpredSys->GetBinContent(i); |
543 |
> |
BpredSysBand->SetPoint(i-1,BpredSys->GetBinCenter(i),0); |
544 |
> |
BpredSysBand->SetPointError(i-1,dx,dy); |
545 |
|
} |
546 |
|
|
547 |
+ |
delete BpredSys; |
548 |
+ |
BpredSysBand->SetFillColor(TColor::GetColor("#2E9AFE")); |
549 |
+ |
|
550 |
+ |
TH1F* Bpred = (TH1F*)SFN->Clone("Bpred"); |
551 |
+ |
Bpred->Add(OFP); |
552 |
+ |
Bpred->Add(OFN,-1); |
553 |
|
Bpred->SetLineColor(kRed); |
554 |
|
|
555 |
+ |
RcorrJZBeemm->SetTitleOffset(1.3,"y"); |
556 |
|
RcorrJZBeemm->Draw(); |
557 |
< |
mcRcorrJZBeemm.Draw("same"); |
557 |
> |
mcRcorrJZBeemm.Draw("histo,same"); |
558 |
|
Bpred->Draw("histo,same"); |
559 |
|
RcorrJZBeemm->Draw("same"); |
560 |
|
|
561 |
|
TLegend *leg = allsamples.allbglegend(); |
562 |
|
leg->SetX1(0.58); |
563 |
< |
leg->AddEntry(RcorrJZBeemm,"observed (data)","l"); |
563 |
> |
// leg->AddEntry(RcorrJZBeemm,"observed (data)","l"); |
564 |
|
leg->AddEntry(Bpred,"predicted (data)","l"); |
565 |
|
leg->Draw("same"); |
566 |
|
|
567 |
|
stringstream saveas; |
568 |
< |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold; |
568 |
> |
saveas << "kin/Mll_After_Cut/" << prefix << "Cut_At" << jzbthreshold; |
569 |
|
CompleteSave(ckin,saveas.str()); |
570 |
|
|
571 |
< |
|
571 |
> |
// Draw all predictions overlayed |
572 |
> |
unsigned int w = gStyle->GetHistLineWidth()+1; // Make line a bit wider, since we dash it |
573 |
> |
SFN->SetLineColor(kGreen+2); |
574 |
> |
SFN->SetLineStyle(2); |
575 |
> |
SFN->SetLineWidth(w); |
576 |
> |
OFP->SetLineColor(kBlue+2); |
577 |
> |
OFP->SetLineStyle(2); |
578 |
> |
OFP->SetLineWidth(w); |
579 |
> |
OFN->SetLineColor(kMagenta+2); |
580 |
> |
OFN->SetLineStyle(3); |
581 |
> |
OFN->SetLineWidth(w); |
582 |
|
|
583 |
|
RcorrJZBeemm->Draw(); |
584 |
+ |
SFN->Draw("histo,same"); |
585 |
+ |
OFP->Draw("histo,same"); |
586 |
+ |
OFN->Draw("histo,same"); |
587 |
|
Bpred->Draw("histo,same"); |
588 |
|
RcorrJZBeemm->Draw("same"); |
589 |
|
|
590 |
< |
TLegend *leg2 = make_legend(); |
591 |
< |
leg2->SetX1(0.58); |
592 |
< |
leg2->AddEntry(RcorrJZBeemm,"observed (data)","l"); |
593 |
< |
leg2->AddEntry(Bpred,"predicted (data)","l"); |
590 |
> |
TLegend *leg2 = make_legend("",0.52,0.7); |
591 |
> |
if(MCorData==data) { |
592 |
> |
leg2->AddEntry(RcorrJZBeemm,"observed (data)","lp"); |
593 |
> |
leg2->AddEntry(Bpred,"predicted (data)","l"); |
594 |
> |
} else { |
595 |
> |
leg2->AddEntry(RcorrJZBeemm,"true (MC)","lp"); |
596 |
> |
leg2->AddEntry(Bpred,"predicted (MC)","l"); |
597 |
> |
} |
598 |
> |
|
599 |
> |
if(jzbthreshold>0) { |
600 |
> |
leg2->AddEntry(SFN, (" SF JZB<-"+any2string(jzbthreshold)).c_str(),"l"); |
601 |
> |
leg2->AddEntry(OFN, (" OF JZB<-"+any2string(jzbthreshold)).c_str(),"l"); |
602 |
> |
} else { |
603 |
> |
leg2->AddEntry(SFN, " SF JZB<0","l"); |
604 |
> |
leg2->AddEntry(OFN, " OF JZB<0","l"); |
605 |
> |
} |
606 |
> |
leg2->AddEntry(OFP, (" OF JZB>"+any2string(jzbthreshold)).c_str(),"l"); |
607 |
|
leg2->Draw("same"); |
608 |
|
|
609 |
|
saveas.str(""); |
610 |
< |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold << "_nomc"; |
610 |
> |
saveas << "kin/Mll_After_Cut/" << prefix << "Cut_At" << jzbthreshold << "_nomc"; |
611 |
|
CompleteSave(ckin,saveas.str()); |
612 |
|
|
613 |
|
|
614 |
+ |
TH1F *diff = (TH1F*)RcorrJZBeemm->Clone("diff"); |
615 |
+ |
diff->Add(Bpred,-1); |
616 |
+ |
|
617 |
+ |
TLegend *dleg = make_legend(); |
618 |
+ |
if(MCorData==data) dleg->AddEntry(diff,"Obs-predicted","p"); |
619 |
+ |
else dleg->AddEntry(diff,"True-predicted","p"); |
620 |
+ |
dleg->AddEntry(BpredSysBand,"Sys. envelope","f"); |
621 |
+ |
dleg->SetY1(0.7); |
622 |
+ |
|
623 |
+ |
|
624 |
+ |
diff->GetYaxis()->SetTitle("true - predicted"); |
625 |
+ |
if(MCorData==data) diff->GetYaxis()->SetTitle("observed - predicted"); |
626 |
+ |
diff->Draw("e1"); |
627 |
+ |
BpredSysBand->Draw("e2"); |
628 |
+ |
diff->Draw("e1,same"); |
629 |
+ |
dleg->Draw(); |
630 |
+ |
|
631 |
+ |
if(MCorData==data) DrawPrelim(); |
632 |
+ |
else DrawMCPrelim(); |
633 |
+ |
|
634 |
+ |
saveas.str(""); |
635 |
+ |
saveas << "kin/Mll_After_Cut/" << prefix << "Cut_At" << jzbthreshold << "_nomc_Diff"; |
636 |
+ |
CompleteSave(ckin,saveas.str()); |
637 |
|
|
638 |
+ |
delete BpredSysBand; |
639 |
+ |
delete diff; |
640 |
+ |
|
641 |
|
delete RcorrJZBeemm; |
642 |
|
delete LcorrJZBeemm; |
643 |
|
delete RcorrJZBem; |
644 |
|
delete LcorrJZBem; |
645 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
645 |
> |
|
646 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
647 |
|
delete RcorrJZBSBeemm; |
648 |
|
delete LcorrJZBSBeemm; |
649 |
|
delete RcorrJZBSBem; |
651 |
|
} |
652 |
|
delete Bpred; |
653 |
|
delete ckin; |
654 |
+ |
CleanLegends(); |
655 |
|
} |
656 |
|
|
657 |
|
void make_special_mll_plot(int nbins, float min, float max, bool logscale,string xlabel) { |
672 |
|
datahistoOSSF->SetMarkerSize(DataMarkerSize); |
673 |
|
datahistoOSSF->Draw(); |
674 |
|
|
675 |
< |
mcstackOSSF.Draw("same"); |
675 |
> |
mcstackOSSF.Draw("histo,same"); |
676 |
|
datahistoOSSF->Draw("same"); |
677 |
|
|
678 |
|
datahistoOSOF->SetMarkerColor(TColor::GetColor("#FE642E")); |
698 |
|
delete datahistoOSOF; |
699 |
|
delete datahistoOSSF; |
700 |
|
delete ckin; |
701 |
+ |
CleanLegends(); |
702 |
|
} |
703 |
|
|
704 |
|
|
739 |
|
oneline->Draw("same"); |
740 |
|
} |
741 |
|
|
742 |
+ |
float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale, |
743 |
+ |
string xlabel, string filename, float legendPosition=0.55) { |
744 |
+ |
|
745 |
+ |
TCut ibasiccut=basiccut; |
746 |
+ |
bool draw_separation_lines=false; |
747 |
+ |
|
748 |
+ |
if(addcut != "") ibasiccut = ibasiccut && addcut.c_str(); |
749 |
+ |
|
750 |
+ |
TCut cutSF; |
751 |
+ |
TCut cutOF; |
752 |
+ |
|
753 |
+ |
cout << "Going to use cutOSSF " << (const char*) cutOSSF << " and cutnJets " << (const char*) cutnJets << " and ibasiccut " << (const char*) ibasiccut << endl; |
754 |
+ |
cutOF = cutOSOF&&cutnJets&&ibasiccut; |
755 |
+ |
cutSF = cutOSSF&&cutnJets&&ibasiccut; |
756 |
+ |
|
757 |
+ |
TCanvas *ofsf_can = new TCanvas("ofsf_can","ofsf_can"); |
758 |
+ |
|
759 |
+ |
TPad* rcan = new TPad("rcan","rcan",0,0,1,1); |
760 |
+ |
rcan->SetLogy(logscale); |
761 |
+ |
rcan->cd(); |
762 |
+ |
|
763 |
+ |
std::cout << "OF/SF comparison: variable = " << variable << ", cut = " << cutSF.GetTitle() << std::endl; |
764 |
+ |
TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity); |
765 |
+ |
TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity); |
766 |
+ |
// string signal("LM3"); |
767 |
+ |
// TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
768 |
+ |
// int idx = signalsamples.FindSample(signal)[0]; |
769 |
+ |
// (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF); |
770 |
+ |
// signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
771 |
+ |
// signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor); |
772 |
+ |
// signalhisto->SetLineStyle(2); |
773 |
+ |
datahistoSF->SetMarkerSize(DataMarkerSize); |
774 |
+ |
datahistoOF->SetLineColor(kRed); |
775 |
+ |
datahistoOF->SetLineWidth(2); |
776 |
+ |
|
777 |
+ |
datahistoOF->Scale(1.02); // R(SF/OF) |
778 |
+ |
|
779 |
+ |
if ( !logscale ) { |
780 |
+ |
datahistoSF->SetMinimum(0); // Defaults |
781 |
+ |
} else { |
782 |
+ |
datahistoSF->SetMinimum(0.5); |
783 |
+ |
} |
784 |
+ |
if (ymax<0) { |
785 |
+ |
if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum()); |
786 |
+ |
else datahistoSF->SetMaximum(0.8*datahistoSF->GetMaximum()); |
787 |
+ |
} else { |
788 |
+ |
datahistoSF->SetMaximum(ymax); |
789 |
+ |
} |
790 |
+ |
|
791 |
+ |
float ymaxSet = datahistoSF->GetMaximum(); |
792 |
+ |
|
793 |
+ |
datahistoSF->GetXaxis()->SetTitle(xlabel.c_str()); |
794 |
+ |
datahistoSF->GetYaxis()->SetTitle("Events"); |
795 |
+ |
datahistoSF->GetXaxis()->CenterTitle(); |
796 |
+ |
datahistoSF->GetYaxis()->CenterTitle(); |
797 |
+ |
|
798 |
+ |
TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.6,false,legendPosition+0.2); |
799 |
+ |
mleg->AddEntry(datahistoSF, "Same-flavor", "PL"); |
800 |
+ |
if (datahistoOF->Integral()>0) { |
801 |
+ |
mleg->AddEntry(datahistoOF, "OF based estimate", "L"); |
802 |
+ |
} else { |
803 |
+ |
mleg->AddEntry((TObject*)0, "", ""); |
804 |
+ |
} |
805 |
+ |
//mleg->AddEntry(signalhisto, "LM3", "L"); |
806 |
+ |
|
807 |
+ |
datahistoSF->Draw("E1"); |
808 |
+ |
|
809 |
+ |
TH1F *syshisto = (TH1F*)datahistoOF->Clone("syshisto"); |
810 |
+ |
TGraphAsymmErrors *datahistoOFboxes = produce_ratio_graph(datahistoOF); |
811 |
+ |
for(int i=0;i<datahistoOFboxes->GetN();i++) { |
812 |
+ |
float ex=datahistoOFboxes->GetErrorX(i); |
813 |
+ |
float ey=datahistoOFboxes->GetErrorY(i); |
814 |
+ |
double x,y; |
815 |
+ |
datahistoOFboxes->GetPoint(i,x,y); |
816 |
+ |
float pey = sqrt(pow(y*0.07,2)+pow(datahistoOF->GetBinError(i+1),2)); |
817 |
+ |
datahistoOFboxes->SetPointError(ex,ex,pey,pey); |
818 |
+ |
syshisto->SetBinContent(i+1,0.07); |
819 |
+ |
syshisto->SetBinError(i+1,0.07); |
820 |
+ |
if(y<0.01) datahistoOF->SetBinContent(i+1,0); |
821 |
+ |
} |
822 |
+ |
mleg->AddEntry(datahistoOFboxes,"Total uncert.","F"); |
823 |
+ |
datahistoOFboxes->SetFillColor(TColor::GetColor("#2E9AFE")); |
824 |
+ |
|
825 |
+ |
if (datahistoOF->Integral()>0) datahistoOFboxes->Draw("20"); |
826 |
+ |
if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES"); |
827 |
+ |
|
828 |
+ |
datahistoSF->Draw("E1,same"); |
829 |
+ |
|
830 |
+ |
//signalhisto->Draw("HIST,SAMES"); |
831 |
+ |
mleg->Draw(); |
832 |
+ |
DrawPrelim(); |
833 |
+ |
if (datahistoOF->Integral()>0) { |
834 |
+ |
// Save_With_Ratio( datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF" ); |
835 |
+ |
save_with_ratio_and_sys_band(0, datahistoSF, datahistoOF, rcan, "SFOF/" + filename, false, false, "SF/OF",syshisto); |
836 |
+ |
} else { |
837 |
+ |
CompleteSave(rcan, "SFOF/" + filename); |
838 |
+ |
} |
839 |
+ |
|
840 |
+ |
datahistoSF->Delete(); |
841 |
+ |
datahistoOF->Delete(); |
842 |
+ |
//signalhisto->Delete(); |
843 |
+ |
delete datahistoOFboxes; |
844 |
+ |
delete syshisto; |
845 |
+ |
delete mleg; |
846 |
+ |
delete rcan; |
847 |
+ |
delete ofsf_can; |
848 |
+ |
return ymaxSet; |
849 |
+ |
} |
850 |
+ |
|
851 |
+ |
// Compare data to data |
852 |
+ |
float make_data_comparison_plot(string variable, TCut cut, int nbins, float min, float max, float ymax, bool logscale, |
853 |
+ |
string xlabel, string filename, float legendPosition=0.55) { |
854 |
+ |
|
855 |
+ |
TCut ibasiccut=basiccut&&cut; |
856 |
+ |
|
857 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
858 |
+ |
TPad* rcan = new TPad("rcan","rcan",0,0,1,1); |
859 |
+ |
rcan->SetLogy(logscale); |
860 |
+ |
rcan->cd(); |
861 |
+ |
|
862 |
+ |
std::cout << "Data comparison: variable = " << variable << ", cut = " << ibasiccut.GetTitle() << std::endl; |
863 |
+ |
|
864 |
+ |
TH1F *data1 = allsamples.Draw("data1",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity); |
865 |
+ |
TH1F *data2 = comparesamples.Draw("data2",variable,nbins,min,max, xlabel, "events",ibasiccut,data,luminosity); |
866 |
+ |
data1->Scale(5.0/9.2); |
867 |
+ |
|
868 |
+ |
data1->SetMarkerSize(DataMarkerSize); |
869 |
+ |
data2->SetLineColor(kRed); |
870 |
+ |
|
871 |
+ |
if ( !logscale ) { |
872 |
+ |
data1->SetMinimum(0); // Defaults |
873 |
+ |
} else { |
874 |
+ |
data1->SetMinimum(0.5); |
875 |
+ |
} |
876 |
+ |
if (ymax<0) { |
877 |
+ |
if ( logscale ) data1->SetMaximum(5.3*data1->GetMaximum()); |
878 |
+ |
else data1->SetMaximum(1.5*data1->GetMaximum()); |
879 |
+ |
} else { |
880 |
+ |
data1->SetMaximum(ymax); |
881 |
+ |
} |
882 |
+ |
|
883 |
+ |
float ymaxSet = data1->GetMaximum(); |
884 |
+ |
|
885 |
+ |
data1->GetXaxis()->SetTitle(xlabel.c_str()); |
886 |
+ |
data1->GetYaxis()->SetTitle("Events"); |
887 |
+ |
data1->GetXaxis()->CenterTitle(); |
888 |
+ |
data1->GetYaxis()->CenterTitle(); |
889 |
+ |
|
890 |
+ |
TLegend *mleg = make_legend("",legendPosition,0.7,false,legendPosition+0.2); |
891 |
+ |
mleg->AddEntry(data1, "2012 data (scaled)", "PL"); |
892 |
+ |
mleg->AddEntry(data2, "2011 data", "L"); |
893 |
+ |
|
894 |
+ |
data1->Draw("E1"); |
895 |
+ |
data2->Draw("HIST,SAMES"); |
896 |
+ |
mleg->Draw(); |
897 |
+ |
DrawPrelim(); |
898 |
+ |
Save_With_Ratio( data1, data2, rcan, "compareData/" + filename, false, false, "new/old" ); |
899 |
+ |
|
900 |
+ |
data1->Delete(); |
901 |
+ |
data2->Delete(); |
902 |
+ |
delete mleg; |
903 |
+ |
delete rcan; |
904 |
+ |
delete ckin; |
905 |
+ |
|
906 |
+ |
} |
907 |
+ |
|
908 |
+ |
void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale, |
909 |
+ |
string xlabel, string filename, float tymax=-1, float legendPosition=0.55) { |
910 |
+ |
|
911 |
+ |
string mllcuts[] = { "mll>20","mll>15&&mll<70", "mll>75&&mll<105", "mll>120" }; |
912 |
+ |
string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "70 < m_{ll} < 110 GeV", "m_{ll} > 120 GeV" }; |
913 |
+ |
string plotname[] = {"_all","_low","_peak","_high"}; |
914 |
+ |
float ymax; |
915 |
+ |
if(tymax>0) ymax=tymax; |
916 |
+ |
|
917 |
+ |
int start = 0; |
918 |
+ |
if ( !PlottingSetup::openBox ) start = 3; |
919 |
+ |
|
920 |
+ |
for ( int i=start; i<4; ++i ) { |
921 |
+ |
if ( addcut != "" ) mllcuts[i] += "&&"+addcut; |
922 |
+ |
if ( i==start && !(tymax>0) ) { |
923 |
+ |
ymax = make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, -1, logscale, xlabel, |
924 |
+ |
filename+plotname[i], legendPosition ); |
925 |
+ |
} else { |
926 |
+ |
make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
927 |
+ |
filename+plotname[i], legendPosition ); |
928 |
+ |
} |
929 |
+ |
make_one_OFSF_plot(variable, "id1==1&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
930 |
+ |
filename+plotname[i]+"_mm", legendPosition ); |
931 |
+ |
make_one_OFSF_plot(variable, "id1==0&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
932 |
+ |
filename+plotname[i]+"_ee", legendPosition ); |
933 |
+ |
} |
934 |
+ |
|
935 |
+ |
} |
936 |
+ |
|
937 |
+ |
TCut ReplaceInCut(TCut cut, string replacethis, string withthis) { |
938 |
+ |
string scut=(string)(const char*)cut; |
939 |
+ |
string acut=ReplaceAll(scut,replacethis,withthis); |
940 |
+ |
return TCut(acut.c_str()); |
941 |
+ |
} |
942 |
+ |
|
943 |
+ |
void DoMCSystPlot(string datavariable, string mcvariable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
944 |
+ |
TCut cut=addcut&&basiccut; |
945 |
+ |
|
946 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
947 |
+ |
ckin->SetLogy(dolog); |
948 |
+ |
cout << "\r Creating " << filename << " : data (1/6)" << std::flush; |
949 |
+ |
TH1F *datahisto = allsamples.Draw("datahisto",datavariable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
950 |
+ |
datahisto->SetMarkerSize(DataMarkerSize); |
951 |
+ |
if ( !dolog ) datahisto->SetMinimum(0); // Defaults |
952 |
+ |
else datahisto->SetMinimum(0.5); |
953 |
+ |
if (dolog) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
954 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
955 |
+ |
cout << "\r Creating " << filename << " : MC central (2/6)" << std::flush; |
956 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
957 |
+ |
TH1F *MCcentral = CollapseStack(mcstack); |
958 |
+ |
|
959 |
+ |
TCut bkpcut = cut; |
960 |
+ |
cut = ReplaceInCut(cut,"pfJetGoodNum40","pfJetGoodNum40p1sigma"); |
961 |
+ |
cout << "\r Creating " << filename << " : MC JES up (3/6)" << std::flush; |
962 |
+ |
TH1F *MCJESup = allsamples.Draw("MCJESup", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
963 |
+ |
|
964 |
+ |
cut = ReplaceInCut(cut,"pfJetGoodNum40p1sigma","pfJetGoodNum40n1sigma"); |
965 |
+ |
cout << "\r Creating " << filename << " : MC JES down (4/6)" << std::flush; |
966 |
+ |
TH1F *MCJESdn = allsamples.Draw("MCJESdn", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
967 |
+ |
|
968 |
+ |
cut=bkpcut; |
969 |
+ |
TCut bkpweight = cutWeight; |
970 |
+ |
cutWeight= ReplaceInCut(cutWeight,"weight","PUweightUP"); |
971 |
+ |
cout << "\r Creating " << filename << " : MC PU up (5/6)" << std::flush; |
972 |
+ |
TH1F *MCPUup = allsamples.Draw("MCPUup", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
973 |
+ |
|
974 |
+ |
cutWeight= ReplaceInCut(cutWeight,"PUweightUP","PUweightDOWN"); |
975 |
+ |
cout << "\r Creating " << filename << " : MC PU down (6/6)" << std::flush; |
976 |
+ |
TH1F *MCPUdn = allsamples.Draw("MCPUdn", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
977 |
+ |
cutWeight=bkpweight; |
978 |
+ |
cout << "\r Creating " << filename << " : Processing systematics ..." << std::flush; |
979 |
+ |
TH1F *Systematic = (TH1F*)MCPUdn->Clone("Systematic"); |
980 |
+ |
for(int i=1;i<=Systematic->GetNbinsX();i++) { |
981 |
+ |
float jesdn = abs(MCcentral->GetBinContent(i)-MCJESdn->GetBinContent(i)); |
982 |
+ |
float jesup = abs(MCcentral->GetBinContent(i)-MCJESup->GetBinContent(i)); |
983 |
+ |
float jes = jesdn>jesup?jesdn:jesup; |
984 |
+ |
|
985 |
+ |
float PUup = abs(MCcentral->GetBinContent(i)-MCPUup->GetBinContent(i)); |
986 |
+ |
float PUdn = abs(MCcentral->GetBinContent(i)-MCPUdn->GetBinContent(i)); |
987 |
+ |
float pu = PUdn>PUup?PUdn:PUup; |
988 |
+ |
|
989 |
+ |
float sys=sqrt(jes*jes+pu*pu); |
990 |
+ |
sys/=MCcentral->GetBinContent(i); |
991 |
+ |
if(MCcentral->GetBinContent(i)==0) sys=0; |
992 |
+ |
Systematic->SetBinContent(i,sys); |
993 |
+ |
} |
994 |
+ |
|
995 |
+ |
datahisto->Draw("e1"); |
996 |
+ |
ckin->Update(); |
997 |
+ |
mcstack.Draw("histo,same"); |
998 |
+ |
|
999 |
+ |
datahisto->Draw("same,e1"); |
1000 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
1001 |
+ |
kinleg->Draw(); |
1002 |
+ |
|
1003 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1004 |
+ |
kinpad->SetLogy(dolog); |
1005 |
+ |
kinpad->cd(); |
1006 |
+ |
datahisto->Draw("e1"); |
1007 |
+ |
mcstack.Draw("histo,same"); |
1008 |
+ |
datahisto->Draw("same,e1"); |
1009 |
+ |
datahisto->Draw("same,axis"); |
1010 |
+ |
|
1011 |
+ |
kinleg->Draw("same"); |
1012 |
+ |
DrawPrelim(); |
1013 |
+ |
string saveas="kin/"+filename; |
1014 |
+ |
|
1015 |
+ |
cout << "Passing filename to be saved : " << filename << " as " << saveas << endl; |
1016 |
+ |
save_with_ratio_and_sys_band(0.0, datahisto, CollapseStack(mcstack), kinpad->cd(), saveas, false, false, "data/mc",Systematic ); |
1017 |
+ |
|
1018 |
+ |
ckin->cd(); |
1019 |
+ |
MCcentral->SetFillColor(kWhite); |
1020 |
+ |
MCcentral->SetLineColor(kBlack); |
1021 |
+ |
MCcentral->SetLineWidth(2); |
1022 |
+ |
MCPUdn->SetLineColor(kRed); |
1023 |
+ |
MCPUup->SetLineColor(kYellow); |
1024 |
+ |
MCJESdn->SetLineColor(kBlue); |
1025 |
+ |
MCJESup->SetLineColor(kGreen); |
1026 |
+ |
|
1027 |
+ |
TLegend *legsmall = new TLegend(0.0,0.85,1.0,1.00); |
1028 |
+ |
legsmall->SetNColumns(5); |
1029 |
+ |
legsmall->AddEntry(MCcentral,"central","L"); |
1030 |
+ |
legsmall->AddEntry(MCPUdn,"PU down","L"); |
1031 |
+ |
legsmall->AddEntry(MCPUup,"PU up","L"); |
1032 |
+ |
legsmall->AddEntry(MCJESdn,"JES down","L"); |
1033 |
+ |
legsmall->AddEntry(MCJESup,"JES up","L"); |
1034 |
+ |
legsmall->SetFillColor(kWhite); |
1035 |
+ |
legsmall->SetBorderSize(0); |
1036 |
+ |
|
1037 |
+ |
datahisto->Draw("e1"); |
1038 |
+ |
MCcentral->Draw("histo,same"); |
1039 |
+ |
MCPUdn->Draw("histo,same"); |
1040 |
+ |
MCPUup->Draw("histo,same"); |
1041 |
+ |
MCJESdn->Draw("histo,same"); |
1042 |
+ |
MCJESup->Draw("histo,same"); |
1043 |
+ |
datahisto->Draw("e1,same"); |
1044 |
+ |
legsmall->Draw(); |
1045 |
+ |
CompleteSave(ckin,saveas+"___AllLines"); |
1046 |
+ |
|
1047 |
+ |
delete datahisto; |
1048 |
+ |
delete MCcentral; |
1049 |
+ |
delete MCPUdn; |
1050 |
+ |
delete MCPUup; |
1051 |
+ |
delete MCJESdn; |
1052 |
+ |
delete MCJESup; |
1053 |
+ |
delete ckin; |
1054 |
+ |
} |
1055 |
+ |
|
1056 |
+ |
void DoMCSystPlot(string variable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
1057 |
+ |
DoMCSystPlot(variable, variable, nbins, min, max, addcut, dolog, xlabel, filename); |
1058 |
+ |
} |
1059 |
+ |
|
1060 |
|
float lastrange_min=0; |
1061 |
|
float lastrange_max=0; |
1062 |
|
|
1065 |
|
// TCut basiccut("(pfJetGoodNum>=2&&pfJetGoodID[0])&&(pfJetGoodNum>=2&&pfJetGoodID[1])&&(passed_triggers||!is_data)"); |
1066 |
|
TCut ibasiccut=basiccut; |
1067 |
|
bool draw_separation_lines=false; |
1068 |
+ |
bool drawsignal = false; |
1069 |
|
|
1070 |
|
if(isPF) ibasiccut=basiccut&&"pfjzb[0]>-998"; |
1071 |
|
|
1087 |
|
//Step 2: Refine the cut |
1088 |
|
TCut cut; |
1089 |
|
cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut; |
1090 |
< |
if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut; |
1091 |
< |
if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut; |
1090 |
> |
if(filename=="nJets" || filename=="nJets_inclusive" || filename=="nJets_met100" || filename=="nJets_inclusive_met100") cut=cutmass&&cutOSSF&&ibasiccut; |
1091 |
> |
if(filename=="nJets_osof" || filename=="nJets_osof_inclusive" || filename=="nJets_osof_met100" || filename=="nJets_osof_inclusive_met100") cut=cutmass&&cutOSOF&&ibasiccut; |
1092 |
|
if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF; |
1093 |
< |
if(filename=="mll") { |
1093 |
> |
if(filename=="mll"||filename=="mll_met100") { |
1094 |
|
cut=cutOSSF&&cutnJets&&ibasiccut; |
1095 |
|
draw_separation_lines=true; |
1096 |
|
} |
1097 |
< |
if(filename=="mll_ee") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0"; |
1098 |
< |
if(filename=="mll_osof") { |
1097 |
> |
if(filename=="mll_ee"||filename=="mll_ee_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==0"; |
1098 |
> |
if(filename=="mll_mm"||filename=="mll_mm_met100") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
1099 |
> |
if(filename=="mll_osof"||filename=="mll_osof_met100") { |
1100 |
|
cut=cutOSOF&&cutnJets&&ibasiccut; |
1101 |
|
draw_separation_lines=true; |
1102 |
|
} |
385 |
– |
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
1103 |
|
if(Contains(filename,"aboveJZB")) cut=cutOSSF&&cutnJets&&ibasiccut; |
1104 |
|
if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0"; |
1105 |
|
if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1"; |
1110 |
|
if(filename=="mll_inclusive_mm") cut=cutOSSF&&"id1==1"; |
1111 |
|
if(filename=="pfJetGoodEta_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets; |
1112 |
|
if(filename=="pfJetGoodPt_0") cut=cutOSSF&&cutmass&&ibasiccut&&cutnJets; |
1113 |
+ |
if(filename=="numVtx") cut=cutmass&&ibasiccut; |
1114 |
|
|
1115 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
1116 |
|
ckin->SetLogy(logscale); |
1117 |
|
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
1118 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
1119 |
< |
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
1119 |
> |
if ( !logscale ) datahisto->SetMinimum(0); // Defaults |
1120 |
> |
else datahisto->SetMinimum(0.5); |
1121 |
> |
// Custom max. |
1122 |
> |
if(variable=="TMath::Abs(pfJetDphiMet[0])") datahisto->SetMaximum(1.5*datahisto->GetMaximum()); |
1123 |
|
if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
1124 |
|
if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
1125 |
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_mm"||filename=="mll_inclusive_ee") datahisto->SetMinimum(1); |
1126 |
|
if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
1127 |
|
if(filename=="mll_osof") datahisto->SetMinimum(9); |
1128 |
< |
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
1129 |
< |
datahisto->Draw("e1"); |
1130 |
< |
ckin->Update(); |
1128 |
> |
if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
1129 |
> |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
1130 |
> |
|
1131 |
> |
cout << "******** Cut used : " << (const char*) cut << " for plot " << filename << endl; |
1132 |
|
if(loadlastminmax) { |
1133 |
|
datahisto->SetMinimum(lastrange_min); |
1134 |
|
datahisto->SetMaximum(lastrange_max); |
1138 |
|
} |
1139 |
|
} |
1140 |
|
|
1141 |
< |
mcstack.Draw("same"); |
1141 |
> |
// Draw signal by hand (for some reason I don't manage to use the sample class: it adds it to the stack!) |
1142 |
> |
string signal("LM3"); |
1143 |
> |
TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
1144 |
> |
int idx = signalsamples.FindSample(signal)[0]; |
1145 |
> |
if(drawsignal) (signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut); |
1146 |
> |
if(drawsignal) signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
1147 |
> |
if(drawsignal) signalhisto->SetLineColor(kOrange); |
1148 |
> |
|
1149 |
> |
THStack mcstack = allsamples.DrawStack("mcstack", variable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
1150 |
> |
datahisto->Draw("e1"); |
1151 |
> |
ckin->Update(); |
1152 |
> |
mcstack.Draw("histo,same"); |
1153 |
> |
|
1154 |
|
datahisto->Draw("same,e1"); |
1155 |
|
TLegend *kinleg = allsamples.allbglegend(); |
1156 |
|
kinleg->Draw(); |
1192 |
|
kinpad->cd(); |
1193 |
|
kinpad->SetLogy(logscale); |
1194 |
|
datahisto->Draw("e1"); |
1195 |
< |
mcstack.Draw("same"); |
1195 |
> |
mcstack.Draw("histo,same"); |
1196 |
> |
if(drawsignal) signalhisto->Draw("same"); |
1197 |
|
datahisto->Draw("same,e1"); |
1198 |
|
datahisto->Draw("same,axis"); |
1199 |
|
if(RestrictToMassPeak&&draw_separation_lines) { |
1201 |
|
upperboundary->Draw("same"); |
1202 |
|
} |
1203 |
|
|
1204 |
+ |
if(drawsignal) kinleg->AddEntry("signalhisto",signal.c_str(),"l"); |
1205 |
|
kinleg->Draw(); |
1206 |
|
write_cut->Draw(); |
1207 |
|
DrawPrelim(); |
1208 |
|
string saveas="kin/"+filename; |
1209 |
|
if(isPF) saveas="kin/"+filename+"__PF"; |
1210 |
< |
save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas); |
1210 |
> |
Save_With_Ratio(datahisto,mcstack,kinpad->cd(),saveas); |
1211 |
|
// if(isPF) CompleteSave(with_ratio,"kin/"+filename+"__PF_withratio"); |
1212 |
|
// else CompleteSave(with_ratio,"kin/"+filename+"_withratio"); |
1213 |
|
// delete with_ratio; |
1216 |
|
else CompleteSave(ckin,"kin/"+filename); |
1217 |
|
} |
1218 |
|
datahisto->Delete(); |
1219 |
+ |
delete signalhisto; |
1220 |
+ |
delete ckin; |
1221 |
+ |
} |
1222 |
+ |
|
1223 |
+ |
|
1224 |
+ |
void make_plain_kin_plot(string variable, string addcut, int nbins, float min, float max, bool logscale, |
1225 |
+ |
string xlabel, string filename, bool isPF=true, bool plotratio=true, bool loadlastminmax=false ) { |
1226 |
+ |
TCut cut=TCut(addcut.c_str())&&basiccut; |
1227 |
+ |
|
1228 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
1229 |
+ |
ckin->SetLogy(logscale); |
1230 |
+ |
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
1231 |
+ |
datahisto->SetMarkerSize(DataMarkerSize); |
1232 |
+ |
if ( !logscale ) datahisto->SetMinimum(0); // Defaults |
1233 |
+ |
else datahisto->SetMinimum(0.5); |
1234 |
+ |
// Custom max. |
1235 |
+ |
if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
1236 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
1237 |
+ |
|
1238 |
+ |
cout << "******** Cut used : " << (const char*) cut << " for plot " << filename << endl; |
1239 |
+ |
if(loadlastminmax) { |
1240 |
+ |
datahisto->SetMinimum(lastrange_min); |
1241 |
+ |
datahisto->SetMaximum(lastrange_max); |
1242 |
+ |
if(logscale) { |
1243 |
+ |
datahisto->SetMinimum(pow(10,lastrange_min)); |
1244 |
+ |
datahisto->SetMaximum(pow(10,lastrange_max)); |
1245 |
+ |
} |
1246 |
+ |
} |
1247 |
+ |
|
1248 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", variable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
1249 |
+ |
datahisto->Draw("e1"); |
1250 |
+ |
ckin->Update(); |
1251 |
+ |
mcstack.Draw("histo,same"); |
1252 |
+ |
|
1253 |
+ |
datahisto->Draw("same,e1"); |
1254 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
1255 |
+ |
kinleg->Draw(); |
1256 |
+ |
|
1257 |
+ |
lastrange_min=ckin->GetUymin(); |
1258 |
+ |
lastrange_max=ckin->GetUymax(); |
1259 |
+ |
|
1260 |
+ |
if ( plotratio ) { |
1261 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1262 |
+ |
kinpad->cd(); |
1263 |
+ |
kinpad->SetLogy(logscale); |
1264 |
+ |
datahisto->Draw("e1"); |
1265 |
+ |
mcstack.Draw("histo,same"); |
1266 |
+ |
datahisto->Draw("same,e1"); |
1267 |
+ |
datahisto->Draw("same,axis"); |
1268 |
+ |
|
1269 |
+ |
kinleg->Draw(); |
1270 |
+ |
DrawPrelim(); |
1271 |
+ |
string saveas="kin/"+filename; |
1272 |
+ |
if(isPF) saveas="kin/"+filename+"__PF"; |
1273 |
+ |
Save_With_Ratio(datahisto,mcstack,kinpad->cd(),saveas); |
1274 |
+ |
} else { |
1275 |
+ |
if(isPF) CompleteSave(ckin,"kin/"+filename+"__PF"); |
1276 |
+ |
else CompleteSave(ckin,"kin/"+filename); |
1277 |
+ |
} |
1278 |
+ |
datahisto->Delete(); |
1279 |
|
delete ckin; |
1280 |
|
} |
1281 |
|
|
1282 |
< |
void make_JES_plot() { |
1282 |
> |
|
1283 |
> |
void make_JES_plot(TCut cut, string name) { |
1284 |
|
|
1285 |
|
int nbins=10; |
1286 |
|
float min=-0.5; |
1287 |
|
float max = 9.5; |
1288 |
|
bool logscale=true; |
1289 |
|
string xlabel="nJets"; |
493 |
– |
TCut cut=cutmass&&cutOSSF&&basiccut; |
1290 |
|
|
1291 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
1292 |
|
ckin->SetLogy(logscale); |
1293 |
< |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,data,luminosity); |
1293 |
> |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,data,luminosity); |
1294 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
1295 |
< |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
1296 |
< |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNump1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
1297 |
< |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNumn1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
1295 |
> |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
1296 |
> |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum40p1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
1297 |
> |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum40n1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
1298 |
|
|
1299 |
|
datahisto->SetMinimum(1); |
1300 |
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); // in line with kinematic plots style |
1313 |
|
JESunc->SetFillColor(TColor::GetColor("#00ADE1")); |
1314 |
|
JESunc->SetFillStyle(3002); |
1315 |
|
datahisto->Draw("e1"); |
1316 |
< |
mcstack.Draw("same"); |
1316 |
> |
mcstack.Draw("histo,same"); |
1317 |
|
JESunc->Draw("2"); |
1318 |
|
datahisto->Draw("same,e1"); |
1319 |
|
TLegend *kinleg = allsamples.allbglegend(); |
1320 |
|
kinleg->AddEntry(JESunc,"JES uncertainty","f"); |
1321 |
|
kinleg->Draw(); |
1322 |
< |
CompleteSave(ckin,"Systematics/JES"); |
1322 |
> |
CompleteSave(ckin,"Systematics/JES"+name); |
1323 |
|
datahisto->Delete(); |
1324 |
|
delete ckin; |
1325 |
+ |
delete JESunc; |
1326 |
+ |
delete JESup; |
1327 |
+ |
delete JESdn; |
1328 |
+ |
CleanLegends(); |
1329 |
+ |
} |
1330 |
+ |
|
1331 |
+ |
string Cut2Str(TCut cut) { |
1332 |
+ |
return ((string)(const char*)cut); |
1333 |
+ |
} |
1334 |
+ |
|
1335 |
+ |
void MakeElegantTwoThreeComparisons() { |
1336 |
+ |
|
1337 |
+ |
TCut signal("met[4]>100&&met[4]<150&&mll>20"&&PlottingSetup::basicqualitycut); |
1338 |
+ |
TCut TwoJets("pfJetGoodNum40==2"); |
1339 |
+ |
TCut ThreeJets("pfJetGoodNum40>=3"); |
1340 |
+ |
|
1341 |
+ |
float min=20; |
1342 |
+ |
float max=300; |
1343 |
+ |
int nbins=int((max-min)/5.0); |
1344 |
+ |
string xlabel="m_{ll} [GeV]"; |
1345 |
+ |
|
1346 |
+ |
TCanvas *can2 = new TCanvas("can2","can2"); |
1347 |
+ |
TH1F *TwoOF = allsamples.Draw("TwoOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1348 |
+ |
TH1F *TwoSF = allsamples.Draw("TwoSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&TwoJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1349 |
+ |
TH1F *ThreeOF = allsamples.Draw("ThreeOF","mll",nbins,min,max, xlabel, "events",cutOSOF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1350 |
+ |
TH1F *ThreeSF = allsamples.Draw("ThreeSF","mll",nbins,min,max, xlabel, "events",cutOSSF&&signal&&ThreeJets,mc,luminosity,allsamples.FindSample("/TT_")); |
1351 |
+ |
|
1352 |
+ |
can2->cd(1); |
1353 |
+ |
|
1354 |
+ |
TwoSF->SetFillColor(kWhite); |
1355 |
+ |
TwoOF->SetFillColor(kWhite); |
1356 |
+ |
ThreeSF->SetFillColor(kWhite); |
1357 |
+ |
ThreeOF->SetFillColor(kWhite); |
1358 |
+ |
|
1359 |
+ |
TPad *kin3 = new TPad("kin3","kin3",0,0,1,1); |
1360 |
+ |
kin3->cd(); |
1361 |
+ |
TwoOF->Draw("histo"); |
1362 |
+ |
TwoSF->Draw("e1,same"); |
1363 |
+ |
TLegend *leg_SFOF_Two = make_legend(); |
1364 |
+ |
leg_SFOF_Two->SetHeader("t#bar{t} MC:"); |
1365 |
+ |
leg_SFOF_Two->AddEntry(TwoOF,"OF, nJets==2","l"); |
1366 |
+ |
leg_SFOF_Two->AddEntry(TwoSF,"SF, nJets==2","lp"); |
1367 |
+ |
leg_SFOF_Two->Draw(); |
1368 |
+ |
Save_With_Ratio(TwoSF,TwoOF,kin3->cd(),"DoubleRatios/SFOF_Two"); |
1369 |
+ |
|
1370 |
+ |
TPad *kin4 = new TPad("kin4","kin4",0,0,1,1); |
1371 |
+ |
kin4->cd(); |
1372 |
+ |
ThreeOF->Draw("histo"); |
1373 |
+ |
ThreeSF->Draw("e1,same"); |
1374 |
+ |
TLegend *leg_SFOF_Three = make_legend(); |
1375 |
+ |
leg_SFOF_Three->SetHeader("t#bar{t} MC:"); |
1376 |
+ |
leg_SFOF_Three->AddEntry(TwoOF,"OF, nJet#geq3","l"); |
1377 |
+ |
leg_SFOF_Three->AddEntry(TwoSF,"SF, nJets#geq3","lp"); |
1378 |
+ |
leg_SFOF_Three->Draw(); |
1379 |
+ |
Save_With_Ratio(ThreeSF,ThreeOF,kin4->cd(),"DoubleRatios/SFOF_Three"); |
1380 |
+ |
|
1381 |
+ |
|
1382 |
+ |
TwoSF->Scale(ThreeSF->Integral()/TwoSF->Integral()); |
1383 |
+ |
TPad *kin = new TPad("kin","kin",0,0,1,1); |
1384 |
+ |
kin->cd(); |
1385 |
+ |
TwoSF->Draw("histo"); |
1386 |
+ |
ThreeSF->Draw("e1,same"); |
1387 |
+ |
TLegend *leg_SF_Two_Three = make_legend(); |
1388 |
+ |
leg_SF_Two_Three->SetHeader("t#bar{t} MC:"); |
1389 |
+ |
leg_SF_Two_Three->AddEntry(TwoSF,"#splitline{SF, nJets==2}{ (scaled)}","l"); |
1390 |
+ |
leg_SF_Two_Three->AddEntry(ThreeSF,"SF, nJets#geq3","lp"); |
1391 |
+ |
leg_SF_Two_Three->Draw(); |
1392 |
+ |
Save_With_Ratio(TwoSF,ThreeSF,kin->cd(),"DoubleRatios/SF_Two_Three"); |
1393 |
+ |
|
1394 |
+ |
TwoOF->Scale(ThreeOF->Integral()/TwoOF->Integral()); |
1395 |
+ |
TPad *kin2 = new TPad("kin2","kin2",0,0,1,1); |
1396 |
+ |
kin2->cd(); |
1397 |
+ |
TwoOF->Draw("histo"); |
1398 |
+ |
ThreeOF->Draw("e1,same"); |
1399 |
+ |
TLegend *leg_OF_Two_Three = make_legend(); |
1400 |
+ |
leg_OF_Two_Three->SetHeader("t#bar{t} MC:"); |
1401 |
+ |
leg_OF_Two_Three->AddEntry(TwoSF,"#splitline{OF, nJets==2}{ (scaled)}","l"); |
1402 |
+ |
leg_OF_Two_Three->AddEntry(ThreeSF,"OF, nJets#geq3","lp"); |
1403 |
+ |
leg_OF_Two_Three->Draw(); |
1404 |
+ |
Save_With_Ratio(TwoOF,ThreeOF,kin2->cd(),"DoubleRatios/OF_Two_Three"); |
1405 |
+ |
|
1406 |
+ |
} |
1407 |
+ |
|
1408 |
+ |
void PresentRange(TH1F *Down, TH1F *Up, TH1F *central, TVirtualPad *pad, string title) { |
1409 |
+ |
pad->cd(); |
1410 |
+ |
TGraphErrors *gr = new TGraphErrors(Down->GetNbinsX()); |
1411 |
+ |
for(int i=1;i<=Down->GetNbinsX();i++) { |
1412 |
+ |
float average=0.5*(Down->GetBinContent(i)+Up->GetBinContent(i)); |
1413 |
+ |
float error=abs(Down->GetBinContent(i)-average); |
1414 |
+ |
gr->SetPoint(i-1,Down->GetBinCenter(i),average); |
1415 |
+ |
gr->SetPointError(i-1,Down->GetBinWidth(i)/2.0,error); |
1416 |
+ |
} |
1417 |
+ |
gr->SetFillColor(TColor::GetColor("#F79F81")); |
1418 |
+ |
gr->GetYaxis()->SetRangeUser(0,2); |
1419 |
+ |
gr->GetXaxis()->SetTitle(central->GetXaxis()->GetTitle()); |
1420 |
+ |
gr->GetYaxis()->SetTitle(central->GetYaxis()->GetTitle()); |
1421 |
+ |
gr->GetXaxis()->CenterTitle(); |
1422 |
+ |
gr->GetYaxis()->CenterTitle(); |
1423 |
+ |
|
1424 |
+ |
gr->Draw("A2"); |
1425 |
+ |
central->Draw("e1,same"); |
1426 |
+ |
DrawMCPrelim(); |
1427 |
+ |
TText *rtitle = write_text(0.8,0.8,title); |
1428 |
+ |
TLine *line = new TLine(Down->GetBinLowEdge(1),1.0,Down->GetBinLowEdge(Down->GetNbinsX())+Down->GetBinWidth(Down->GetNbinsX()),1.0); |
1429 |
+ |
line->SetLineColor(kBlue); |
1430 |
+ |
line->SetLineStyle(2); |
1431 |
+ |
line->Draw("same"); |
1432 |
+ |
rtitle->Draw("same"); |
1433 |
+ |
} |
1434 |
+ |
|
1435 |
+ |
TH1F* ProduceTTbarRatio(TH1F *datahisto, TH1F *fullmc, TH1F *originalttbar, TH1F *httbar) { |
1436 |
+ |
TH1F *basehisto = (TH1F*)fullmc->Clone("basehisto"); |
1437 |
+ |
basehisto->Add(originalttbar,-1); |
1438 |
+ |
basehisto->Add(httbar); |
1439 |
+ |
|
1440 |
+ |
string sname=httbar->GetName(); |
1441 |
+ |
sname="R"+sname.substr(1,sname.length()); |
1442 |
+ |
TH1F *ratio = (TH1F*)datahisto->Clone(sname.c_str()); |
1443 |
+ |
ratio->Divide(basehisto); |
1444 |
+ |
delete basehisto; |
1445 |
+ |
return ratio; |
1446 |
+ |
} |
1447 |
+ |
|
1448 |
+ |
void make_ttbar_comparison(string datavariable, string mcvariable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
1449 |
+ |
|
1450 |
+ |
TCut cut=addcut&&basiccut; |
1451 |
+ |
|
1452 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
1453 |
+ |
ckin->SetLogy(dolog); |
1454 |
+ |
cout << "\r Creating " << filename << " : data (1/7)" << std::flush; |
1455 |
+ |
TH1F *datahisto = allsamples.Draw("datahisto",datavariable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
1456 |
+ |
datahisto->SetMarkerSize(DataMarkerSize); |
1457 |
+ |
if ( !dolog ) datahisto->SetMinimum(0); // Defaults |
1458 |
+ |
else datahisto->SetMinimum(0.5); |
1459 |
+ |
if (dolog) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
1460 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
1461 |
+ |
cout << "\r Creating " << filename << " : MC central (stack) (2/7)" << std::flush; |
1462 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
1463 |
+ |
TH1F *MCcentral = CollapseStack(mcstack); |
1464 |
+ |
|
1465 |
+ |
cout << "\r Creating " << filename << " : MC central (histo) (3/7)" << std::flush; |
1466 |
+ |
TH1F *TCentral = allsamples.Draw ("TCentral", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,allsamples.FindSample("/TT_")); |
1467 |
+ |
TH1F *RCentral = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TCentral); |
1468 |
+ |
|
1469 |
+ |
cout << "\r Creating " << filename << " : MC Matching up (4/7)" << std::flush; |
1470 |
+ |
TH1F *TMatchingUp = systsamples.Draw("TMatchingUp", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_matchingup")); |
1471 |
+ |
TH1F *RMatchingUp = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TMatchingUp); |
1472 |
+ |
|
1473 |
+ |
cout << "\r Creating " << filename << " : MC Matching down (5/7)" << std::flush; |
1474 |
+ |
TH1F *TMatchingDown = systsamples.Draw("TMatchingDown",mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_matchingdown")); |
1475 |
+ |
TH1F *RMatchingDown = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TMatchingDown); |
1476 |
+ |
|
1477 |
+ |
cout << "\r Creating " << filename << " : MC Scale up (6/7)" << std::flush; |
1478 |
+ |
TH1F *TScaleUp = systsamples.Draw("TScaleUp", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_scaleup")); |
1479 |
+ |
TH1F *RScaleUp = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TScaleUp); |
1480 |
+ |
|
1481 |
+ |
cout << "\r Creating " << filename << " : MC Scale down (7/7)" << std::flush; |
1482 |
+ |
TH1F *TScaleDown = systsamples.Draw("TScaleDown", mcvariable,nbins,min,max,xlabel,"events",cut,mc,luminosity,systsamples.FindSample("TTJets_scaledown")); |
1483 |
+ |
TH1F *RScaleDown = ProduceTTbarRatio(datahisto,MCcentral,TCentral,TScaleDown); |
1484 |
+ |
|
1485 |
+ |
datahisto->Draw("e1"); |
1486 |
+ |
ckin->Update(); |
1487 |
+ |
mcstack.Draw("histo,same"); |
1488 |
+ |
|
1489 |
+ |
datahisto->Draw("same,e1"); |
1490 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
1491 |
+ |
kinleg->Draw(); |
1492 |
+ |
|
1493 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1494 |
+ |
kinpad->SetLogy(dolog); |
1495 |
+ |
kinpad->cd(); |
1496 |
+ |
datahisto->Draw("e1"); |
1497 |
+ |
mcstack.Draw("histo,same"); |
1498 |
+ |
datahisto->Draw("same,e1"); |
1499 |
+ |
datahisto->Draw("same,axis"); |
1500 |
+ |
|
1501 |
+ |
kinleg->Draw("same"); |
1502 |
+ |
DrawPrelim(); |
1503 |
+ |
string saveas="kin/"+filename; |
1504 |
+ |
|
1505 |
+ |
cout << "Passing filename to be saved : " << filename << " as " << saveas << endl; |
1506 |
+ |
Save_With_Ratio( datahisto, CollapseStack(mcstack), kinpad->cd(), saveas, false, false, "data/mc"); |
1507 |
+ |
delete kinpad; |
1508 |
+ |
|
1509 |
+ |
ckin->cd(); |
1510 |
+ |
TCentral->SetLineColor(kBlack); |
1511 |
+ |
|
1512 |
+ |
TMatchingUp->SetLineColor(TColor::GetColor("#2c17b1"));//blue |
1513 |
+ |
TMatchingUp->SetLineStyle(2);//dashed |
1514 |
+ |
TMatchingDown->SetLineColor(TColor::GetColor("#2c17b1")); |
1515 |
+ |
TMatchingDown->SetLineStyle(3);//dotted |
1516 |
+ |
|
1517 |
+ |
TScaleUp->SetLineColor(TColor::GetColor("#FF8500"));//orange |
1518 |
+ |
TScaleUp->SetLineStyle(2);//dashed |
1519 |
+ |
TScaleDown->SetLineColor(TColor::GetColor("#FF8500")); |
1520 |
+ |
TScaleDown->SetLineStyle(3);//dotted |
1521 |
+ |
|
1522 |
+ |
MCcentral->SetLineStyle(3); |
1523 |
+ |
MCcentral->SetLineColor(kRed); |
1524 |
+ |
|
1525 |
+ |
TCentral->Draw("e1,same"); |
1526 |
+ |
TCentral->Draw("histo,same"); |
1527 |
+ |
TMatchingUp->Draw("histo,same"); |
1528 |
+ |
TMatchingDown->Draw("histo,same"); |
1529 |
+ |
TScaleUp->Draw("histo,same"); |
1530 |
+ |
TScaleDown->Draw("histo,same"); |
1531 |
+ |
|
1532 |
+ |
TLegend *sleg = make_legend(); |
1533 |
+ |
sleg->AddEntry(TCentral,"Central","L"); |
1534 |
+ |
sleg->AddEntry(TMatchingUp,"matching up","L"); |
1535 |
+ |
sleg->AddEntry(TMatchingDown,"matching down","L"); |
1536 |
+ |
sleg->AddEntry(TScaleUp,"scale up","L"); |
1537 |
+ |
sleg->AddEntry(TScaleDown,"scale down","L"); |
1538 |
+ |
sleg->Draw(); |
1539 |
+ |
|
1540 |
+ |
CompleteSave(ckin,saveas+"___AllLines"); |
1541 |
+ |
ckin->cd(); |
1542 |
+ |
ckin->SetLogy(0); |
1543 |
+ |
|
1544 |
+ |
RCentral->SetLineColor(kBlack); |
1545 |
+ |
|
1546 |
+ |
RMatchingUp->SetLineColor(TColor::GetColor("#2c17b1"));//blue |
1547 |
+ |
RMatchingUp->SetLineStyle(2);//dashed |
1548 |
+ |
RMatchingDown->SetLineColor(TColor::GetColor("#2c17b1")); |
1549 |
+ |
RMatchingDown->SetLineStyle(3);//dotted |
1550 |
+ |
|
1551 |
+ |
RScaleUp->SetLineColor(TColor::GetColor("#FF8500"));//orange |
1552 |
+ |
RScaleUp->SetLineStyle(2);//dashed |
1553 |
+ |
RScaleDown->SetLineColor(TColor::GetColor("#FF8500")); |
1554 |
+ |
RScaleDown->SetLineStyle(3);//dotted |
1555 |
+ |
|
1556 |
+ |
RCentral->GetYaxis()->SetRangeUser(0,2); |
1557 |
+ |
RCentral->Draw("e1"); |
1558 |
+ |
RMatchingUp->Draw("histo,same"); |
1559 |
+ |
RMatchingDown->Draw("histo,same"); |
1560 |
+ |
RScaleUp->Draw("histo,same"); |
1561 |
+ |
RScaleDown->Draw("histo,same"); |
1562 |
+ |
|
1563 |
+ |
CompleteSave(ckin,saveas+"___AllRatios"); |
1564 |
+ |
|
1565 |
+ |
TCanvas *multicanvas = new TCanvas("multicanvas","multicanvas",1400,700); |
1566 |
+ |
multicanvas->Divide(2,1); |
1567 |
+ |
PresentRange(RMatchingUp,RMatchingDown,RCentral,multicanvas->cd(1),"Matching"); |
1568 |
+ |
PresentRange(RScaleUp,RScaleDown,RCentral,multicanvas->cd(2),"Scale"); |
1569 |
+ |
CompleteSave(multicanvas,saveas+"___RangeIllustration"); |
1570 |
+ |
|
1571 |
+ |
|
1572 |
+ |
delete datahisto; |
1573 |
+ |
delete TCentral; |
1574 |
+ |
delete TMatchingUp; |
1575 |
+ |
delete TMatchingDown; |
1576 |
+ |
delete TScaleUp; |
1577 |
+ |
delete TScaleDown; |
1578 |
+ |
// delete Ttmass166; |
1579 |
+ |
// delete Ttmass169; |
1580 |
+ |
// delete Ttmass175; |
1581 |
+ |
// delete Ttmass178; |
1582 |
+ |
|
1583 |
+ |
delete ckin; |
1584 |
+ |
|
1585 |
+ |
} |
1586 |
+ |
|
1587 |
+ |
void make_ttbar_comparison(string variable, int nbins, float min, float max, TCut addcut, bool dolog, string xlabel, string filename) { |
1588 |
+ |
make_ttbar_comparison(variable, variable, nbins, min, max, addcut, dolog, xlabel, filename); |
1589 |
+ |
} |
1590 |
|
|
1591 |
+ |
void ProduceJanPlots() { |
1592 |
+ |
TCanvas *c1 = new TCanvas("c1","c1"); |
1593 |
+ |
TH1F *metSF = allsamples.Draw("metSF","met[4]",30,100,400, "E_{T}^{miss} [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity); |
1594 |
+ |
TH1F *metOF = allsamples.Draw("metOF","met[4]",30,100,400, "E_{T}^{miss} [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity); |
1595 |
+ |
|
1596 |
+ |
TPad* rcan = new TPad("rcan","rcan",0,0,1,1); |
1597 |
+ |
rcan->cd(); |
1598 |
+ |
|
1599 |
+ |
metOF->SetLineColor(kRed); |
1600 |
+ |
metSF->Draw("e1"); |
1601 |
+ |
metOF->Draw("histo,same"); |
1602 |
+ |
metSF->Draw("e1,same"); |
1603 |
+ |
|
1604 |
+ |
TLegend *leg = make_legend(); |
1605 |
+ |
|
1606 |
+ |
leg->AddEntry(metSF,"Data SF","p"); |
1607 |
+ |
leg->AddEntry(metOF,"Data OF","l"); |
1608 |
+ |
leg->Draw(); |
1609 |
+ |
|
1610 |
+ |
DrawPrelim(); |
1611 |
+ |
|
1612 |
+ |
Save_With_Ratio(metSF,metOF,rcan,"JanPlots/ETHConfig",false,false,"SF/OF"); |
1613 |
+ |
|
1614 |
+ |
delete rcan; |
1615 |
+ |
delete metSF; |
1616 |
+ |
delete metOF; |
1617 |
+ |
delete c1; |
1618 |
+ |
} |
1619 |
+ |
|
1620 |
+ |
THStack MakeOneSystematicsPlot(TCut cut, string saveas, string variation, TH1F *hdata, string variable, int nbins, float bmin, float bmax, string label, TH1F* &thisto) { |
1621 |
+ |
THStack SystPlot = allsamples.DrawStack(variation,variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity); |
1622 |
+ |
|
1623 |
+ |
//now need to process the plot (calculate the variation and set the member of thstack accordingly!) |
1624 |
+ |
if(variation!="Central") { |
1625 |
+ |
TH1F *varttbar; |
1626 |
+ |
if(variation=="MatchingUp") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_matchingup_TuneZ2s")); |
1627 |
+ |
if(variation=="MatchingDown") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_matchingdown")); |
1628 |
+ |
if(variation=="ScaleUp") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_scaleup")); |
1629 |
+ |
if(variation=="ScaleDown") varttbar = systsamples.Draw("varttbar",variable,nbins,bmin,bmax,label,"events",cut,mc,PlottingSetup::luminosity,systsamples.FindSample("TTJets_scaledown")); |
1630 |
+ |
assert(varttbar); |
1631 |
+ |
|
1632 |
+ |
TIter nextHisto(SystPlot.GetHists()); |
1633 |
+ |
TH1F* h; |
1634 |
+ |
while ( h = (TH1F*)nextHisto() ) { |
1635 |
+ |
if(Contains(h->GetName(),"t_bar_t")) { |
1636 |
+ |
varttbar->Scale(h->Integral()/varttbar->Integral()); |
1637 |
+ |
for(int i=0;i<=h->GetNbinsX()+1;i++) {//note that we deliberatly consider the under/overflow bin as well! |
1638 |
+ |
h->SetBinContent(i,varttbar->GetBinContent(i)); |
1639 |
+ |
h->SetBinError(i,varttbar->GetBinError(i)); |
1640 |
+ |
} |
1641 |
+ |
thisto=(TH1F*)varttbar->Clone(variation.c_str()); |
1642 |
+ |
SystPlot.Modified(); |
1643 |
+ |
} |
1644 |
+ |
} |
1645 |
+ |
delete varttbar; |
1646 |
+ |
} else { |
1647 |
+ |
TIter nextHisto(SystPlot.GetHists()); |
1648 |
+ |
TH1F* h; |
1649 |
+ |
while ( h = (TH1F*)nextHisto() ) { |
1650 |
+ |
if(Contains(h->GetName(),"t_bar_t")) thisto=(TH1F*)h->Clone(variation.c_str()); |
1651 |
+ |
} |
1652 |
+ |
} |
1653 |
+ |
|
1654 |
+ |
TLegend *fullleg = allsamples.allbglegend(); |
1655 |
+ |
fullleg->SetHeader(variation.c_str()); |
1656 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1657 |
+ |
kinpad->SetLogy(1); |
1658 |
+ |
kinpad->cd(); |
1659 |
+ |
|
1660 |
+ |
hdata->Draw("e1"); |
1661 |
+ |
SystPlot.Draw("histo,same"); |
1662 |
+ |
hdata->Draw("e1,same"); |
1663 |
+ |
fullleg->Draw(); |
1664 |
+ |
DrawPrelim(); |
1665 |
+ |
|
1666 |
+ |
Save_With_Ratio(hdata,SystPlot,kinpad,saveas+"_"+variation); |
1667 |
+ |
CleanLegends(); |
1668 |
+ |
|
1669 |
+ |
delete kinpad; |
1670 |
+ |
return SystPlot; |
1671 |
|
} |
1672 |
+ |
|
1673 |
+ |
|
1674 |
+ |
|
1675 |
+ |
void ProduceMCSystematicPlot(string variable, int nbins, float bmin, float bmax, string label, TCut thiscut, string saveas) { |
1676 |
+ |
TCanvas *ca = new TCanvas("ca","ca"); |
1677 |
+ |
TH1F *hdata = allsamples.Draw("hdata",variable,nbins,bmin,bmax,label,"events",thiscut,data,luminosity); |
1678 |
+ |
|
1679 |
+ |
TH1F *tScaleUp,*tScaleDown,*tMatchingUp,*tMatchingDown,*tCentral; |
1680 |
+ |
|
1681 |
+ |
THStack ScaleUp = MakeOneSystematicsPlot(thiscut,saveas,"ScaleUp",hdata,variable, nbins, bmin, bmax, label,tScaleUp); |
1682 |
+ |
THStack ScaleDown = MakeOneSystematicsPlot(thiscut,saveas,"ScaleDown",hdata,variable, nbins, bmin, bmax, label,tScaleDown); |
1683 |
+ |
THStack MatchingUp = MakeOneSystematicsPlot(thiscut,saveas,"MatchingUp",hdata,variable, nbins, bmin, bmax, label,tMatchingUp); |
1684 |
+ |
THStack MatchingDown = MakeOneSystematicsPlot(thiscut,saveas,"MatchingDown",hdata,variable, nbins, bmin, bmax, label,tMatchingDown); |
1685 |
+ |
|
1686 |
+ |
TH1F *HScaleUp = CollapseStack(ScaleUp); |
1687 |
+ |
TH1F *HScaleDown = CollapseStack(ScaleDown); |
1688 |
+ |
TH1F *HMatchingUp = CollapseStack(MatchingUp); |
1689 |
+ |
TH1F *HMatchingDown = CollapseStack(MatchingDown); |
1690 |
+ |
|
1691 |
+ |
THStack Central = MakeOneSystematicsPlot(thiscut,saveas,"Central",hdata,variable, nbins, bmin, bmax, label,tCentral); |
1692 |
+ |
TH1F *HCentral = CollapseStack(Central); |
1693 |
+ |
|
1694 |
+ |
TH1F *Systematic = (TH1F*)hdata->Clone("Systematic"); |
1695 |
+ |
for(int i=1;i<=Systematic->GetNbinsX();i++) { |
1696 |
+ |
float matchingup = abs(HMatchingUp->GetBinContent(i)-HCentral->GetBinContent(i)); |
1697 |
+ |
float matchingdown = abs(HMatchingDown->GetBinContent(i)-HCentral->GetBinContent(i)); |
1698 |
+ |
float scaleup = abs(HScaleUp->GetBinContent(i)-HCentral->GetBinContent(i)); |
1699 |
+ |
float scaledown = abs(HScaleDown->GetBinContent(i)-HCentral->GetBinContent(i)); |
1700 |
+ |
|
1701 |
+ |
float matching = matchingup>matchingdown?matchingup:matchingdown; |
1702 |
+ |
float scale = scaleup>scaledown?scaleup:scaledown; |
1703 |
+ |
|
1704 |
+ |
float sys=sqrt(matching*matching+scale*scale); |
1705 |
+ |
sys/=HCentral->GetBinContent(i); |
1706 |
+ |
if(HCentral->GetBinContent(i)==0) sys=0; |
1707 |
+ |
Systematic->SetBinContent(i,sys); |
1708 |
+ |
} |
1709 |
+ |
|
1710 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1711 |
+ |
kinpad->SetLogy(1); |
1712 |
+ |
kinpad->cd(); |
1713 |
+ |
if(variable=="genMET") { |
1714 |
+ |
Central.Draw("histo"); |
1715 |
+ |
} else { |
1716 |
+ |
hdata->Draw("e1"); |
1717 |
+ |
Central.Draw("histo,same"); |
1718 |
+ |
hdata->Draw("e1,same"); |
1719 |
+ |
} |
1720 |
+ |
|
1721 |
+ |
DrawPrelim(); |
1722 |
+ |
|
1723 |
+ |
save_with_ratio_and_sys_band( 0.0, hdata, HCentral, kinpad->cd(), saveas, false, false, "data/mc",Systematic ); |
1724 |
+ |
|
1725 |
+ |
kinpad->cd(); |
1726 |
+ |
tCentral->SetFillColor(kWhite); |
1727 |
+ |
tCentral->SetLineColor(kBlack); |
1728 |
+ |
tScaleUp->SetLineColor(kRed); |
1729 |
+ |
tScaleDown->SetLineColor(kRed); |
1730 |
+ |
tMatchingUp->SetLineColor(kBlue); |
1731 |
+ |
tMatchingDown->SetLineColor(kBlue); |
1732 |
+ |
tScaleUp->SetLineStyle(2); |
1733 |
+ |
tScaleDown->SetLineStyle(3); |
1734 |
+ |
tMatchingUp->SetLineStyle(2); |
1735 |
+ |
tMatchingDown->SetLineStyle(3); |
1736 |
+ |
|
1737 |
+ |
TLegend *leg2 = make_legend(); |
1738 |
+ |
leg2->AddEntry(hdata,"Data","p"); |
1739 |
+ |
leg2->AddEntry(tCentral,"Central (ttbar)","l"); |
1740 |
+ |
leg2->AddEntry(tScaleUp,"ScaleUp (ttbar)","l"); |
1741 |
+ |
leg2->AddEntry(tScaleDown,"ScaleDown (ttbar)","l"); |
1742 |
+ |
leg2->AddEntry(tMatchingUp,"MatchingUp (ttbar)","l"); |
1743 |
+ |
leg2->AddEntry(tMatchingDown,"MatchingDown (ttbar)","l"); |
1744 |
+ |
if(variable=="genMET") { |
1745 |
+ |
Central.Draw("histo"); |
1746 |
+ |
}else { |
1747 |
+ |
hdata->Draw("e1"); |
1748 |
+ |
Central.Draw("histo,same"); |
1749 |
+ |
hdata->Draw("e1,same"); |
1750 |
+ |
} |
1751 |
+ |
tCentral->Draw("histo,same"); |
1752 |
+ |
tScaleUp->Draw("histo,same"); |
1753 |
+ |
tScaleDown->Draw("histo,same"); |
1754 |
+ |
tMatchingUp->Draw("histo,same"); |
1755 |
+ |
tMatchingDown->Draw("histo,same"); |
1756 |
+ |
leg2->Draw(); |
1757 |
+ |
|
1758 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison"); |
1759 |
+ |
|
1760 |
+ |
gStyle->SetOptFit(0); |
1761 |
+ |
|
1762 |
+ |
kinpad->cd(); |
1763 |
+ |
kinpad->SetLogy(0); |
1764 |
+ |
TH1F *MatchingRatio = (TH1F*)tMatchingUp->Clone("MatchingRatio"); |
1765 |
+ |
MatchingRatio->Divide(tMatchingDown); |
1766 |
+ |
TLine *lone = new TLine(tScaleUp->GetBinLowEdge(1),1,tScaleUp->GetBinLowEdge(tScaleUp->GetNbinsX())+tScaleUp->GetBinWidth(tScaleUp->GetNbinsX()),1); |
1767 |
+ |
lone->SetLineColor(TColor::GetColor("#01DF01")); |
1768 |
+ |
lone->SetLineStyle(2); |
1769 |
+ |
TH1F *ScaleRatio = (TH1F*)tScaleUp->Clone("ScaleRatio"); |
1770 |
+ |
ScaleRatio->Divide(tScaleDown); |
1771 |
+ |
MatchingRatio->GetYaxis()->SetRangeUser(0,3); |
1772 |
+ |
MatchingRatio->Draw("e1"); |
1773 |
+ |
TF1 *QP1 = new TF1("QP1","[0]+[1]*x",50,200);//simple linear function ranging from 50 to 200 |
1774 |
+ |
MatchingRatio->Fit("QP1","R"); |
1775 |
+ |
lone->Draw(); |
1776 |
+ |
stringstream summary; |
1777 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
1778 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
1779 |
+ |
TText *infobox = write_title(summary.str()); |
1780 |
+ |
infobox->SetX(0.75); |
1781 |
+ |
infobox->SetTextSize(0.03); |
1782 |
+ |
infobox->SetY(0.75); |
1783 |
+ |
infobox->Draw(); |
1784 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_MatchingUpDividedMatchingDown"); |
1785 |
+ |
kinpad->cd(); |
1786 |
+ |
ScaleRatio->GetYaxis()->SetRangeUser(0,3); |
1787 |
+ |
ScaleRatio->Draw("e1"); |
1788 |
+ |
ScaleRatio->Fit("QP1","R"); |
1789 |
+ |
summary.str(""); |
1790 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
1791 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
1792 |
+ |
TText *infobox2 = write_title(summary.str()); |
1793 |
+ |
infobox2->SetX(0.75); |
1794 |
+ |
infobox2->SetTextSize(0.03); |
1795 |
+ |
infobox2->SetY(0.75); |
1796 |
+ |
infobox2->Draw(); |
1797 |
+ |
|
1798 |
+ |
lone->Draw(); |
1799 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_ScaleUpDividedScaleDown"); |
1800 |
+ |
|
1801 |
+ |
|
1802 |
+ |
delete QP1; |
1803 |
+ |
delete infobox; |
1804 |
+ |
delete infobox2; |
1805 |
+ |
delete MatchingRatio; |
1806 |
+ |
delete ScaleRatio; |
1807 |
+ |
DeleteStack(ScaleUp); |
1808 |
+ |
DeleteStack(ScaleDown); |
1809 |
+ |
DeleteStack(MatchingUp); |
1810 |
+ |
DeleteStack(MatchingDown); |
1811 |
+ |
delete leg2; |
1812 |
+ |
CleanLegends(); |
1813 |
+ |
DeleteStack(Central); |
1814 |
+ |
delete Systematic; |
1815 |
+ |
delete HScaleUp; |
1816 |
+ |
delete HScaleDown; |
1817 |
+ |
delete HMatchingUp; |
1818 |
+ |
delete HMatchingDown; |
1819 |
+ |
delete hdata; |
1820 |
+ |
delete HCentral; |
1821 |
+ |
delete ca; |
1822 |
+ |
} |
1823 |
+ |
|
1824 |
+ |
TH1F* ImposeBinning(TH1F *binninghisto, TH1F* histo) { |
1825 |
+ |
float val=0,err=0; |
1826 |
+ |
vector<float> bins; |
1827 |
+ |
vector<float> vals; |
1828 |
+ |
vector<float> errs; |
1829 |
+ |
|
1830 |
+ |
bins.push_back(binninghisto->GetBinLowEdge(1)); |
1831 |
+ |
int iBin=1; |
1832 |
+ |
|
1833 |
+ |
for(unsigned int i=1;i<histo->GetNbinsX();i++) {//going to second last one on purpose! |
1834 |
+ |
if((histo->GetBinLowEdge(i)+0.00001>=binninghisto->GetBinLowEdge(iBin)+binninghisto->GetBinWidth(iBin))) { |
1835 |
+ |
bins.push_back(histo->GetBinLowEdge(i)); |
1836 |
+ |
vals.push_back(val);val=0; |
1837 |
+ |
errs.push_back(err);err=0; |
1838 |
+ |
iBin++; |
1839 |
+ |
} |
1840 |
+ |
val+=histo->GetBinContent(i); |
1841 |
+ |
err=sqrt(err*err+histo->GetBinError(i)*histo->GetBinError(i)); |
1842 |
+ |
} |
1843 |
+ |
bins.push_back(histo->GetBinLowEdge(histo->GetNbinsX())+histo->GetBinWidth(histo->GetNbinsX())); |
1844 |
+ |
vals.push_back(val);val=0; |
1845 |
+ |
errs.push_back(err);err=0; |
1846 |
+ |
|
1847 |
+ |
TH1F *h = new TH1F(("r"+(string)histo->GetName()).c_str(),("r"+(string)histo->GetName()).c_str(),bins.size()-1,&bins[0]); |
1848 |
+ |
for(unsigned int i=0;i<vals.size();i++) { |
1849 |
+ |
h->SetBinContent(i+1,vals[i]); |
1850 |
+ |
h->SetBinError(i+1,errs[i]); |
1851 |
+ |
} |
1852 |
+ |
|
1853 |
+ |
h->GetXaxis()->SetTitle(histo->GetXaxis()->GetTitle()); |
1854 |
+ |
h->GetYaxis()->SetTitle(histo->GetYaxis()->GetTitle()); |
1855 |
+ |
|
1856 |
+ |
h->GetXaxis()->CenterTitle(); |
1857 |
+ |
h->GetYaxis()->CenterTitle(); |
1858 |
+ |
|
1859 |
+ |
return h; |
1860 |
+ |
} |
1861 |
+ |
|
1862 |
+ |
|
1863 |
+ |
TH1F* ReBinOptimizingStats(int nbins, TH1F *histo) { |
1864 |
+ |
float statsperbin = (1/(float)nbins) * histo->Integral(); |
1865 |
+ |
float val=0,err=0; |
1866 |
+ |
vector<float> bins; |
1867 |
+ |
vector<float> vals; |
1868 |
+ |
vector<float> errs; |
1869 |
+ |
|
1870 |
+ |
bins.push_back(histo->GetBinLowEdge(1)); |
1871 |
+ |
for(unsigned int i=1;i<=histo->GetNbinsX();i++) { |
1872 |
+ |
val+=histo->GetBinContent(i); |
1873 |
+ |
err=sqrt(err*err+histo->GetBinError(i)*histo->GetBinError(i)); |
1874 |
+ |
if( val/statsperbin > 0.85) { |
1875 |
+ |
if(bins.size()<nbins) { |
1876 |
+ |
bins.push_back(histo->GetBinLowEdge(i)+histo->GetBinWidth(i)); |
1877 |
+ |
vals.push_back(val);val=0; |
1878 |
+ |
errs.push_back(err);err=0; |
1879 |
+ |
} |
1880 |
+ |
} |
1881 |
+ |
if(i==histo->GetNbinsX()) { |
1882 |
+ |
bins.push_back(histo->GetBinLowEdge(i)+histo->GetBinWidth(i)); |
1883 |
+ |
vals.push_back(val);val=0; |
1884 |
+ |
errs.push_back(err);err=0; |
1885 |
+ |
} |
1886 |
+ |
} |
1887 |
+ |
TH1F *h = new TH1F(("r"+(string)histo->GetName()).c_str(),("r"+(string)histo->GetName()).c_str(),bins.size()-1,&bins[0]); |
1888 |
+ |
|
1889 |
+ |
h->GetXaxis()->SetTitle(histo->GetXaxis()->GetTitle()); |
1890 |
+ |
h->GetYaxis()->SetTitle(histo->GetYaxis()->GetTitle()); |
1891 |
+ |
|
1892 |
+ |
h->GetXaxis()->CenterTitle(); |
1893 |
+ |
h->GetYaxis()->CenterTitle(); |
1894 |
+ |
|
1895 |
+ |
for(unsigned int i=0;i<vals.size();i++) { |
1896 |
+ |
h->SetBinContent(i+1,vals[i]); |
1897 |
+ |
h->SetBinError(i+1,errs[i]); |
1898 |
+ |
} |
1899 |
+ |
|
1900 |
+ |
return h; |
1901 |
+ |
} |
1902 |
+ |
|
1903 |
+ |
|
1904 |
+ |
|
1905 |
+ |
void ShowBinning(TH1F *histo) { |
1906 |
+ |
cout << "Showing binning for " << histo->GetName() << " (\" " << histo->GetTitle() << "\")" << endl; |
1907 |
+ |
for(unsigned int i=1;i<=histo->GetNbinsX();i++) cout << " Bin " << i << " : " << histo->GetBinLowEdge(i) << " , " << histo->GetBinLowEdge(i) + histo->GetBinWidth(i) << " : " << histo->GetBinContent(i) << endl; |
1908 |
+ |
} |
1909 |
+ |
|
1910 |
+ |
void QuickProduceMCSystematicPlot(string variable, int nbins, float bmin, float bmax, string label, TCut thiscut, string saveas) { |
1911 |
+ |
TCanvas *ca = new TCanvas("ca","ca"); |
1912 |
+ |
TH1F *tScaleUp = systsamples.Draw("tScaleUp",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("scaleup")); |
1913 |
+ |
TH1F *tScaleDown = systsamples.Draw("tScaleDown",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("scaledown")); |
1914 |
+ |
TH1F *tMatchingUp = systsamples.Draw("tMatchingUp",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("matchingup")); |
1915 |
+ |
TH1F *tMatchingDown = systsamples.Draw("tMatchingDown",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("matchingdown")); |
1916 |
+ |
TH1F *tCentral = systsamples.Draw("tCentral",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity,systsamples.FindSample("TTJets_MassiveBinDECAY_TuneZ2sta")); |
1917 |
+ |
|
1918 |
+ |
tScaleUp->Scale(1.0/tScaleUp->Integral()); |
1919 |
+ |
tScaleDown->Scale(1.0/tScaleDown->Integral()); |
1920 |
+ |
tMatchingDown->Scale(1.0/tMatchingDown->Integral()); |
1921 |
+ |
tMatchingUp->Scale(1.0/tMatchingUp->Integral()); |
1922 |
+ |
tCentral->Scale(1.0/tCentral->Integral()); |
1923 |
+ |
|
1924 |
+ |
cout << "At this point we want to rebin the scale/matching histograms so we get decent stats!" << endl; |
1925 |
+ |
|
1926 |
+ |
|
1927 |
+ |
TH1F *rtScaleUp = ReBinOptimizingStats(7,tScaleUp); // using the scale up sample to get the binning (shouldn't use the central one for obvious reasons) |
1928 |
+ |
TH1F *rtScaleDown = ImposeBinning(rtScaleUp,tScaleDown); |
1929 |
+ |
TH1F *rtMatchingDown = ImposeBinning(rtScaleUp,tMatchingDown); |
1930 |
+ |
TH1F *rtMatchingUp = ImposeBinning(rtScaleUp,tMatchingUp); |
1931 |
+ |
TH1F *rtCentral = ImposeBinning(rtScaleUp,tCentral); |
1932 |
+ |
|
1933 |
+ |
float min=rtScaleUp->GetMinimum(); |
1934 |
+ |
float max=rtScaleUp->GetMaximum(); |
1935 |
+ |
|
1936 |
+ |
if(rtScaleDown->GetMinimum()<min) min=rtScaleDown->GetMinimum(); |
1937 |
+ |
if(rtMatchingDown->GetMinimum()<min) min=rtMatchingDown->GetMinimum(); |
1938 |
+ |
if(rtMatchingDown->GetMinimum()<min) min=rtMatchingDown->GetMinimum(); |
1939 |
+ |
if(rtMatchingUp->GetMinimum()<min) min=rtMatchingUp->GetMinimum(); |
1940 |
+ |
if(rtCentral->GetMinimum()<min) min=rtCentral->GetMinimum(); |
1941 |
+ |
|
1942 |
+ |
if(rtScaleDown->GetMaximum()<min) max=rtScaleDown->GetMaximum(); |
1943 |
+ |
if(rtMatchingDown->GetMaximum()<min) max=rtMatchingDown->GetMaximum(); |
1944 |
+ |
if(rtMatchingDown->GetMaximum()<min) max=rtMatchingDown->GetMaximum(); |
1945 |
+ |
if(rtMatchingUp->GetMaximum()<min) max=rtMatchingUp->GetMaximum(); |
1946 |
+ |
if(rtCentral->GetMaximum()<min) max=rtCentral->GetMaximum(); |
1947 |
+ |
|
1948 |
+ |
rtCentral->SetMaximum(1.2*max); |
1949 |
+ |
rtCentral->SetMinimum(0.8*min); |
1950 |
+ |
|
1951 |
+ |
/* tScaleUp->Rebin(40); |
1952 |
+ |
tScaleDown->Rebin(40); |
1953 |
+ |
tMatchingDown->Rebin(40); |
1954 |
+ |
tMatchingUp->Rebin(40); |
1955 |
+ |
tCentral->Rebin(40);*/ |
1956 |
+ |
|
1957 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
1958 |
+ |
kinpad->SetLogy(1); |
1959 |
+ |
kinpad->cd(); |
1960 |
+ |
tCentral->SetFillColor(kWhite); |
1961 |
+ |
tCentral->SetLineColor(kBlack); |
1962 |
+ |
tScaleUp->SetLineColor(kRed); |
1963 |
+ |
tScaleDown->SetLineColor(kRed); |
1964 |
+ |
tMatchingUp->SetLineColor(kBlue); |
1965 |
+ |
tMatchingDown->SetLineColor(kBlue); |
1966 |
+ |
tScaleUp->SetLineStyle(2); |
1967 |
+ |
tScaleDown->SetLineStyle(3); |
1968 |
+ |
tMatchingUp->SetLineStyle(2); |
1969 |
+ |
tMatchingDown->SetLineStyle(3); |
1970 |
+ |
|
1971 |
+ |
rtScaleDown->SetLineColor(kRed); |
1972 |
+ |
rtMatchingUp->SetLineColor(kBlue); |
1973 |
+ |
rtMatchingDown->SetLineColor(kBlue); |
1974 |
+ |
rtScaleUp->SetLineStyle(2); |
1975 |
+ |
rtScaleDown->SetLineStyle(3); |
1976 |
+ |
rtMatchingUp->SetLineStyle(2); |
1977 |
+ |
rtMatchingDown->SetLineStyle(3); |
1978 |
+ |
|
1979 |
+ |
TLegend *leg2 = make_legend(); |
1980 |
+ |
leg2->AddEntry(tCentral,"Central (ttbar)","l"); |
1981 |
+ |
leg2->AddEntry(tScaleUp,"ScaleUp (ttbar)","l"); |
1982 |
+ |
leg2->AddEntry(tScaleDown,"ScaleDown (ttbar)","l"); |
1983 |
+ |
leg2->AddEntry(tMatchingUp,"MatchingUp (ttbar)","l"); |
1984 |
+ |
leg2->AddEntry(tMatchingDown,"MatchingDown (ttbar)","l"); |
1985 |
+ |
|
1986 |
+ |
tCentral->Draw("histo"); |
1987 |
+ |
tScaleUp->Draw("histo,same"); |
1988 |
+ |
tScaleDown->Draw("histo,same"); |
1989 |
+ |
tMatchingUp->Draw("histo,same"); |
1990 |
+ |
tMatchingDown->Draw("histo,same"); |
1991 |
+ |
leg2->Draw(); |
1992 |
+ |
DrawMCPrelim(); |
1993 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison"); |
1994 |
+ |
kinpad->cd(); |
1995 |
+ |
kinpad->SetLogy(0); |
1996 |
+ |
rtCentral->Draw("histo"); |
1997 |
+ |
rtScaleUp->Draw("histo,same"); |
1998 |
+ |
rtScaleDown->Draw("histo,same"); |
1999 |
+ |
rtMatchingUp->Draw("histo,same"); |
2000 |
+ |
rtMatchingDown->Draw("histo,same"); |
2001 |
+ |
leg2->Draw(); |
2002 |
+ |
DrawMCPrelim(); |
2003 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison__REBINNED"); |
2004 |
+ |
|
2005 |
+ |
|
2006 |
+ |
gStyle->SetOptFit(0); |
2007 |
+ |
|
2008 |
+ |
kinpad->cd(); |
2009 |
+ |
kinpad->SetLogy(0); |
2010 |
+ |
TH1F *MatchingRatio = (TH1F*)rtMatchingUp->Clone("MatchingRatio"); |
2011 |
+ |
MatchingRatio->Divide(rtMatchingDown); |
2012 |
+ |
TLine *lone = new TLine(tScaleUp->GetBinLowEdge(1),1,tScaleUp->GetBinLowEdge(tScaleUp->GetNbinsX())+tScaleUp->GetBinWidth(tScaleUp->GetNbinsX()),1); |
2013 |
+ |
lone->SetLineColor(TColor::GetColor("#01DF01")); |
2014 |
+ |
lone->SetLineStyle(2); |
2015 |
+ |
TH1F *ScaleRatio = (TH1F*)rtScaleUp->Clone("ScaleRatio"); |
2016 |
+ |
ScaleRatio->Divide(rtScaleDown); |
2017 |
+ |
MatchingRatio->GetYaxis()->SetRangeUser(0,3); |
2018 |
+ |
MatchingRatio->Draw("e1"); |
2019 |
+ |
TF1 *QP1 = new TF1("QP1","[0]+[1]*x",50,200);//simple linear function ranging from 50 to 200 |
2020 |
+ |
if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") MatchingRatio->Fit("QP1","RQ"); |
2021 |
+ |
lone->Draw(); |
2022 |
+ |
stringstream summary; |
2023 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
2024 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
2025 |
+ |
TText *infobox = write_title(summary.str()); |
2026 |
+ |
infobox->SetX(0.75); |
2027 |
+ |
infobox->SetTextSize(0.03); |
2028 |
+ |
infobox->SetY(0.75); |
2029 |
+ |
if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") infobox->Draw(); |
2030 |
+ |
DrawMCPrelim(); |
2031 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_MatchingUpDividedMatchingDown"); |
2032 |
+ |
kinpad->cd(); |
2033 |
+ |
ScaleRatio->GetYaxis()->SetRangeUser(0,3); |
2034 |
+ |
ScaleRatio->Draw("e1"); |
2035 |
+ |
if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") ScaleRatio->Fit("QP1","RQ"); |
2036 |
+ |
summary.str(""); |
2037 |
+ |
summary << " #splitline{Fit result for f(x) = a+bx :}{#splitline{a=" << DigitsAfterComma(QP1->GetParameter(0),4) << " +/- " << DigitsAfterComma(QP1->GetParError(0),4) << "}{b=" << DigitsAfterComma(QP1->GetParameter(1),4); |
2038 |
+ |
summary << " +/- " << DigitsAfterComma(QP1->GetParError(1),4) << "}}"; |
2039 |
+ |
TText *infobox2 = write_title(summary.str()); |
2040 |
+ |
infobox2->SetX(0.75); |
2041 |
+ |
infobox2->SetTextSize(0.03); |
2042 |
+ |
infobox2->SetY(0.75); |
2043 |
+ |
if(variable=="genMET" || variable=="met[4]" || variable=="met[1]") infobox2->Draw(); |
2044 |
+ |
|
2045 |
+ |
lone->Draw(); |
2046 |
+ |
DrawMCPrelim(); |
2047 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_ScaleUpDividedScaleDown"); |
2048 |
+ |
|
2049 |
+ |
kinpad->cd(); |
2050 |
+ |
TH1F *SysMatching = (TH1F*)rtMatchingDown->Clone("SysMatching"); |
2051 |
+ |
TH1F *SysScale = (TH1F*)rtScaleDown->Clone("SysMatching"); |
2052 |
+ |
TH1F *SysHisto = (TH1F*)rtScaleDown->Clone("SysHisto"); |
2053 |
+ |
|
2054 |
+ |
for(int i=1;i<=SysScale->GetNbinsX();i++) { |
2055 |
+ |
float matching, scale; |
2056 |
+ |
bool AssumeFactor=false; |
2057 |
+ |
if(AssumeFactor) { |
2058 |
+ |
// assume that an upward/downward variation means a change by a constant factor, i.e. f(up) = alpha * f(central) |
2059 |
+ |
matching=0.; |
2060 |
+ |
scale=0.; |
2061 |
+ |
} else { |
2062 |
+ |
// assume that the central value is exactly between up & down, i.e. central = (up-down)/2 |
2063 |
+ |
matching = fabs( ( rtMatchingUp->GetBinContent(i) - rtMatchingDown->GetBinContent(i)) / (rtMatchingUp->GetBinContent(i) + rtMatchingDown->GetBinContent(i)) ); |
2064 |
+ |
scale = fabs( ( rtScaleUp->GetBinContent(i) - rtScaleDown->GetBinContent(i)) / (rtScaleUp->GetBinContent(i) + rtScaleDown->GetBinContent(i)) ); |
2065 |
+ |
} |
2066 |
+ |
|
2067 |
+ |
SysMatching->SetBinContent(i,1+matching); |
2068 |
+ |
SysScale->SetBinContent(i,1+scale); |
2069 |
+ |
SysHisto->SetBinContent(i,sqrt(matching*matching+scale*scale)+1); |
2070 |
+ |
} |
2071 |
+ |
|
2072 |
+ |
SysHisto->SetLineColor(kGreen); |
2073 |
+ |
|
2074 |
+ |
SysMatching->SetMaximum(3.0); |
2075 |
+ |
SysMatching->SetMinimum(0.0); |
2076 |
+ |
SysMatching->Draw("histo"); |
2077 |
+ |
SysScale->Draw("histo,same"); |
2078 |
+ |
SysHisto->Draw("histo,same"); |
2079 |
+ |
CompleteSave(kinpad,saveas+"__TTbarComparison_DerivedSystematic"); |
2080 |
+ |
|
2081 |
+ |
delete SysMatching; |
2082 |
+ |
delete SysScale; |
2083 |
+ |
|
2084 |
+ |
if(!Contains(variable,"gen")) { |
2085 |
+ |
TH1F *hdata = allsamples.Draw("hdata", variable,nbins,bmin,bmax,label,"events",thiscut,data,luminosity); |
2086 |
+ |
THStack smc = allsamples.DrawStack("smc",variable,nbins,bmin,bmax,label,"events",thiscut,mc,luminosity); |
2087 |
+ |
|
2088 |
+ |
TH1F *Systematic = (TH1F*)hdata->Clone("Systematic"); |
2089 |
+ |
|
2090 |
+ |
for(int i=1;i<=Systematic->GetNbinsX();i++) { |
2091 |
+ |
int iBin=SysHisto->FindBin(Systematic->GetBinCenter(i)); |
2092 |
+ |
if(iBin>SysHisto->GetNbinsX()) --iBin; // if we're over the end of the histo, use the last bin |
2093 |
+ |
float sys = SysHisto->GetBinContent(iBin)-1; |
2094 |
+ |
Systematic->SetBinContent(i,sys); |
2095 |
+ |
} |
2096 |
+ |
|
2097 |
+ |
kinpad->cd(); |
2098 |
+ |
TLegend *leg = allsamples.allbglegend(); |
2099 |
+ |
hdata->Draw(); |
2100 |
+ |
smc.Draw("histo,same"); |
2101 |
+ |
hdata->Draw("same"); |
2102 |
+ |
leg->Draw(); |
2103 |
+ |
DrawPrelim(); |
2104 |
+ |
save_with_ratio_and_sys_band( 0.0, hdata, CollapseStack(smc), kinpad->cd(), saveas+"__DataVsMC", false, false, "data/mc",Systematic ); |
2105 |
+ |
|
2106 |
+ |
delete Systematic; |
2107 |
+ |
delete hdata; |
2108 |
+ |
} |
2109 |
+ |
|
2110 |
+ |
|
2111 |
+ |
delete SysHisto; |
2112 |
+ |
delete tScaleUp; |
2113 |
+ |
delete tScaleDown; |
2114 |
+ |
delete tCentral; |
2115 |
+ |
delete tMatchingUp; |
2116 |
+ |
delete tMatchingDown; |
2117 |
+ |
delete rtScaleUp; |
2118 |
+ |
delete rtScaleDown; |
2119 |
+ |
delete rtCentral; |
2120 |
+ |
delete rtMatchingUp; |
2121 |
+ |
delete rtMatchingDown; |
2122 |
+ |
delete QP1; |
2123 |
+ |
delete infobox; |
2124 |
+ |
delete infobox2; |
2125 |
+ |
delete MatchingRatio; |
2126 |
+ |
delete ScaleRatio; |
2127 |
+ |
delete leg2; |
2128 |
+ |
CleanLegends(); |
2129 |
+ |
delete ca; |
2130 |
+ |
} |
2131 |
+ |
|
2132 |
+ |
void ProduceMCSystematicPlots() { |
2133 |
+ |
cout << "Getting ready to produce systematic plots " << endl; |
2134 |
+ |
TCut cutweightBKP = cutWeight; |
2135 |
+ |
|
2136 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor"); |
2137 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor"); |
2138 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor"); |
2139 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor"); |
2140 |
+ |
|
2141 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE"); |
2142 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE"); |
2143 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE_HighMass"); |
2144 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE_HighMass"); |
2145 |
+ |
|
2146 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE"); |
2147 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE"); |
2148 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE_HighMass"); |
2149 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE_HighMass"); |
2150 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_SameFlavor"); |
2151 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/ETH_OppositeFlavor"); |
2152 |
+ |
|
2153 |
+ |
|
2154 |
+ |
|
2155 |
+ |
cout << "Kicking cutWeight " << (const char*) cutWeight << endl; |
2156 |
+ |
cout << "Keeping OSSF cut " << (const char*)cutOSSF << endl; |
2157 |
+ |
cutWeight="1.0"; |
2158 |
+ |
|
2159 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE__NOPURW"); |
2160 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE__NOPURW"); |
2161 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
2162 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/ETH_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
2163 |
+ |
|
2164 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE__NOPURW"); |
2165 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE__NOPURW"); |
2166 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/ETH_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
2167 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/ETH_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
2168 |
+ |
|
2169 |
+ |
|
2170 |
+ |
// -------------------------------------- ***** AACHEN ***** -------------------------------------- |
2171 |
+ |
|
2172 |
+ |
/* |
2173 |
+ |
cutWeight=cutweightBKP; |
2174 |
+ |
TCut essentialcutBKP = essentialcut; |
2175 |
+ |
cout << (const char*) essentialcut << endl; |
2176 |
+ |
|
2177 |
+ |
essentialcut = TCut((ReplaceAll((const char*)essentialcut,"pt2>20","pt2>10")).c_str()); |
2178 |
+ |
essentialcut = TCut((ReplaceAll((const char*)essentialcut,"abs(eta1)<1.4","abs(eta1)<2.4")).c_str()); |
2179 |
+ |
essentialcut = TCut((ReplaceAll((const char*)essentialcut,"abs(eta2)<1.4","abs(eta2)<2.4")).c_str()); |
2180 |
+ |
|
2181 |
+ |
TCut cutnJetsBKP = cutnJets; |
2182 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"pt2>20","pt2>10")).c_str()); |
2183 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"pfJetGoodNum40>=3","pfJetGoodNum40>=2")).c_str()); |
2184 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"abs(eta2)<1.4","abs(eta2)<2.4")).c_str()); |
2185 |
+ |
cutnJets = TCut((ReplaceAll((const char*)cutnJets,"abs(eta1)<1.4","abs(eta1)<2.4")).c_str()); |
2186 |
+ |
|
2187 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor"); |
2188 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor"); |
2189 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor"); |
2190 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor"); |
2191 |
+ |
|
2192 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE"); |
2193 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE"); |
2194 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE_HighMass"); |
2195 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE_HighMass"); |
2196 |
+ |
|
2197 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE"); |
2198 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE"); |
2199 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE_HighMass"); |
2200 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE_HighMass"); |
2201 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSSF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/Aachen_SameFlavor"); |
2202 |
+ |
QuickProduceMCSystematicPlot("pfJetGoodNum40",8,-0.5,7.5,"NJets",cutOSOF&&cutnJets&&TCut("mll>20&&mll<70&&met[4]>100"),"MCSystPlots/NJets/Aachen_OppositeFlavor"); |
2203 |
+ |
|
2204 |
+ |
|
2205 |
+ |
|
2206 |
+ |
cout << "Kicking cutWeight " << (const char*) cutWeight << endl; |
2207 |
+ |
cout << "Keeping OSSF cut " << (const char*)cutOSSF << endl; |
2208 |
+ |
cutWeight="1.0"; |
2209 |
+ |
|
2210 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE__NOPURW"); |
2211 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE__NOPURW"); |
2212 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
2213 |
+ |
QuickProduceMCSystematicPlot("genMET",20,0,200,"gen#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/genMET/Aachen_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
2214 |
+ |
|
2215 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE__NOPURW"); |
2216 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>20&&mll<70"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE__NOPURW"); |
2217 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSSF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_SameFlavor_INCLUSIVE_HighMass__NOPURW"); |
2218 |
+ |
QuickProduceMCSystematicPlot("met[4]",20,0,200,"PF#slash{E}_{T} [GeV]",cutOSOF&&TCut("mll>120"),"MCSystPlots/MET/Aachen_OppositeFlavor_INCLUSIVE_HighMass__NOPURW"); |
2219 |
+ |
|
2220 |
+ |
cutnJets = cutnJetsBKP; |
2221 |
+ |
cutWeight = cutweightBKP; |
2222 |
+ |
essentialcut = essentialcutBKP; |
2223 |
+ |
*/ |
2224 |
+ |
write_error(__FUNCTION__,"Still need to add systematic shape");assert(0); |
2225 |
+ |
} |
2226 |
+ |
|
2227 |
+ |
void MakeTauPlot(string label, TCut pcut, string filename, bool TauOnly) { |
2228 |
+ |
TCut cut=pcut&&basiccut; |
2229 |
+ |
string variable="mll"; |
2230 |
+ |
string xlabel="m_{ll} [GeV]"; |
2231 |
+ |
int nbins=40; |
2232 |
+ |
float min=0; |
2233 |
+ |
float max=200; |
2234 |
+ |
|
2235 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
2236 |
+ |
TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cut&&cutOSSF,data,luminosity); |
2237 |
+ |
TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cut&&cutOSOF,data,luminosity); |
2238 |
+ |
TH1F *tauSF = allsamples.Draw("tauSF",variable,nbins,min,max, xlabel, "events",cut&&cutOSSF,data,luminosity,systsamples.FindSample("DYToTauTau")); |
2239 |
+ |
TH1F *tauOF = allsamples.Draw("tauOF",variable,nbins,min,max, xlabel, "events",cut&&cutOSOF,data,luminosity,systsamples.FindSample("DYToTauTau")); |
2240 |
+ |
datahistoSF->SetMarkerSize(DataMarkerSize); |
2241 |
+ |
datahistoSF->SetMaximum(1.3*datahistoSF->GetMaximum()); |
2242 |
+ |
datahistoOF->SetMarkerSize(DataMarkerSize); |
2243 |
+ |
datahistoOF->SetMaximum(1.3*datahistoOF->GetMaximum()); |
2244 |
+ |
|
2245 |
+ |
THStack mcstackSF = allsamples.DrawStack("mcstackSF", variable,nbins,min,max,xlabel,"events",cut&&cutOSSF,mc,luminosity); |
2246 |
+ |
THStack mcstackOF = allsamples.DrawStack("mcstackOF", variable,nbins,min,max,xlabel,"events",cut&&cutOSOF,mc,luminosity); |
2247 |
+ |
datahistoSF->Draw("e1"); |
2248 |
+ |
ckin->Update(); |
2249 |
+ |
mcstackSF.Draw("histo,same"); |
2250 |
+ |
|
2251 |
+ |
datahistoSF->Draw("same,e1"); |
2252 |
+ |
TLegend *kinleg = allsamples.allbglegend(); |
2253 |
+ |
kinleg->Draw(); |
2254 |
+ |
|
2255 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
2256 |
+ |
kinpad->cd(); |
2257 |
+ |
datahistoSF->Draw("e1"); |
2258 |
+ |
mcstackSF.Draw("histo,same"); |
2259 |
+ |
datahistoSF->Draw("same,e1"); |
2260 |
+ |
datahistoSF->Draw("same,axis"); |
2261 |
+ |
kinleg->Draw(); |
2262 |
+ |
DrawPrelim(); |
2263 |
+ |
Save_With_Ratio(datahistoSF,mcstackSF,kinpad->cd(),filename+"__SF_mc"); |
2264 |
+ |
|
2265 |
+ |
kinpad->cd(); |
2266 |
+ |
datahistoOF->Draw("e1"); |
2267 |
+ |
mcstackOF.Draw("histo,same"); |
2268 |
+ |
datahistoOF->Draw("same,e1"); |
2269 |
+ |
datahistoOF->Draw("same,axis"); |
2270 |
+ |
kinleg->Draw(); |
2271 |
+ |
DrawPrelim(); |
2272 |
+ |
Save_With_Ratio(datahistoOF,mcstackOF,kinpad->cd(),filename+"__OF_mc"); |
2273 |
+ |
|
2274 |
+ |
kinpad->cd(); |
2275 |
+ |
tauSF->Draw("e1"); |
2276 |
+ |
tauOF->Draw("histo,same"); |
2277 |
+ |
tauSF->Draw("e1,same"); |
2278 |
+ |
TLegend *legtau = make_legend(); |
2279 |
+ |
legtau->AddEntry(tauSF,"DY->#tau#tau, SF","p"); |
2280 |
+ |
legtau->AddEntry(tauSF,"DY->#tau#tau, OF","l"); |
2281 |
+ |
legtau->Draw(); |
2282 |
+ |
DrawPrelim(); |
2283 |
+ |
Save_With_Ratio(tauSF,tauOF,kinpad->cd(),filename+"__Tau_SF_vs_OF"); |
2284 |
+ |
|
2285 |
+ |
delete datahistoSF; |
2286 |
+ |
delete datahistoOF; |
2287 |
+ |
delete tauSF; |
2288 |
+ |
delete tauOF; |
2289 |
+ |
delete kinpad; |
2290 |
+ |
delete ckin; |
2291 |
+ |
CleanLegends(); |
2292 |
+ |
} |
2293 |
+ |
|
2294 |
+ |
|
2295 |
+ |
void TauQuestion() { |
2296 |
+ |
// MakeTauPlot("MET>100 GeV, #geq 3 jets",cutnJets&&TCut("met[4]>100"),"TauQ/MET100_3Jets",true); |
2297 |
+ |
// MakeTauPlot("MET>100 GeV",TCut("met[4]>100"),"TauQ/MET100",true); |
2298 |
+ |
// MakeTauPlot("MET>0 GeV",TCut("met[4]>0"),"TauQ/MET0",true); |
2299 |
+ |
MakeTauPlot("b-tag veto, 50<MET<100",TCut("pfJetGoodNumBtag30==0&&met[4]>50&&met[4]<100"),"TauQ/ControlPlots",false); |
2300 |
+ |
} |
2301 |
+ |
|
2302 |
+ |
void ProduceOFSFPlots(string mcjzb, string datajzb, bool isAachen) { |
2303 |
+ |
string BaseMetCut="met[4]>100"; |
2304 |
+ |
string Prefix="ETH/"; |
2305 |
+ |
if(isAachen) { |
2306 |
+ |
BaseMetCut="met[4]>150"; |
2307 |
+ |
Prefix="Aachen/"; |
2308 |
+ |
} |
2309 |
+ |
|
2310 |
+ |
// make_OFSF_plots("met[4]", BaseMetCut, 30, 100., 400., true, "E_{T}^{miss}", Prefix+"MET",1500); |
2311 |
+ |
// make_OFSF_plots("pfJetGoodNumBtag30", BaseMetCut, 6, -0.5, 5.5, true, "N_{b-jets}", Prefix+"nbjets",5000); |
2312 |
+ |
make_OFSF_plots("max(eta1,eta2)", BaseMetCut, 20, -2.4, 2.4, true, "max(#eta_{l1},#eta_{l2})", Prefix+"MaxEta",-1); |
2313 |
+ |
// make_OFSF_plots("st", BaseMetCut, 20, 0, 2000., false, "#tilde{S}_{T}", Prefix+"FrankT",120); |
2314 |
+ |
// make_OFSF_plots("pt1+pt2+met[4]+Sum$(pfJetGoodPt)", BaseMetCut, 20, 0, 2000., false, "#tilde{S}_{T}", Prefix+"POOR_FrankT",120); |
2315 |
+ |
|
2316 |
+ |
|
2317 |
+ |
// make_OFSF_plots("mt2j", BaseMetCut, 35, 0, 700., false, "M_{T2J}", Prefix+"MT2J"); |
2318 |
+ |
// |
2319 |
+ |
// make_OFSF_plots("ml1b", BaseMetCut, 20, 0, 800., false, "m_{l_{1}b}", Prefix+"ML1B"); |
2320 |
+ |
// make_OFSF_plots("ml2b", BaseMetCut, 20, 0, 400., false, "m_{l_{2}b}", Prefix+"ML2B"); |
2321 |
+ |
// make_OFSF_plots("min(ml1b,ml2b)", BaseMetCut, 20, 0, 400., false, "m_{lb}", Prefix+"MLB"); |
2322 |
+ |
// |
2323 |
+ |
// make_OFSF_plots(datajzb, BaseMetCut, 55, -100, 450., false, "JZB", Prefix+"JZB_In_Signal_Region"); |
2324 |
+ |
// make_OFSF_plots("mt2", BaseMetCut, 15, 0, 150., false, "M_{T2}", Prefix+"MT2"); |
2325 |
+ |
// make_OFSF_plots("d2", BaseMetCut, 20, 0, 200., true, "D2", Prefix+"D2"); |
2326 |
+ |
make_OFSF_plots("pfJetGoodNum40", BaseMetCut, 10, -0.5, 9.5, true, "N_{jets}", Prefix+"nJets"); |
2327 |
+ |
// |
2328 |
+ |
// make_OFSF_plots("mll", BaseMetCut, 60, 20., 320., false, "m_{ll}", Prefix+"mll"); |
2329 |
+ |
// make_OFSF_plots("leptonNum", BaseMetCut, 3, 2, 5., false, "N(leptons)", Prefix+"NLeptons"); |
2330 |
+ |
// |
2331 |
+ |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut, 7, 3, 10, true, "#(jets)", Prefix+"njets"); |
2332 |
+ |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut+"&&pfJetGoodNumBtag30==0", 7, 3, 10, true, "#(jets)", Prefix+"njets_btagVeto"); |
2333 |
+ |
// make_OFSF_plots("pfJetGoodNum40", BaseMetCut"&&pfJetGoodNumBtag30>0", 7, 3, 10, true, "#(jets)", Prefix+"njets_AtLeastOneBJet30"); |
2334 |
+ |
// |
2335 |
+ |
// make_OFSF_plots("pfJetGoodPtBtag[0]", BaseMetCut+"&&pfJetGoodNumBtag30>0", 20, 0, 400, true, "p_{T}(leading b-jet)", Prefix+"ptb1"); |
2336 |
+ |
make_OFSF_plots("pfJetGoodPt", BaseMetCut, 30, 0., 400., true, "p_{T}^{J}", Prefix+"ptJet"); |
2337 |
+ |
// |
2338 |
+ |
// make_OFSF_plots("iso1", BaseMetCut, 20, 0, 0.3, true, "lepton 1 isolation", Prefix+"iso1"); |
2339 |
+ |
// make_OFSF_plots("iso2", BaseMetCut, 20, 0, 0.3, true, "lepton 2 isolation", Prefix+"iso2"); |
2340 |
+ |
make_OFSF_plots("pt", BaseMetCut, 30, 0., 300., true, "p_{ll}", Prefix+"pt"); |
2341 |
+ |
make_OFSF_plots("pt1", BaseMetCut, 30, 0., 300., true, "p_{T,1}", Prefix+"pt1"); |
2342 |
+ |
make_OFSF_plots("pt2", BaseMetCut, 22, 0., 220., true, "p_{T,2}", Prefix+"pt2"); |
2343 |
+ |
// make_OFSF_plots("eta1", BaseMetCut, 10, -2.5, 2.5, false, "#eta_{1}", Prefix+"eta1", -1, 0.15); |
2344 |
+ |
// make_OFSF_plots("eta2", BaseMetCut, 10, -2.5, 2.5, false, "#eta_{2}", Prefix+"eta2", -1, 0.15); |
2345 |
+ |
// make_OFSF_plots("phi1", BaseMetCut, 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", Prefix+"phi1", -1, 0.2); |
2346 |
+ |
// make_OFSF_plots("phi2", BaseMetCut, 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", Prefix+"phi2", -1, 0.2); |
2347 |
+ |
// make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", BaseMetCut, 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", Prefix+"jpt1pt2", -1, 0.2); |
2348 |
+ |
make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", Prefix+"dphij1met", -1, 0.2); |
2349 |
+ |
|
2350 |
+ |
// make_OFSF_plots("TMath::Abs(dphi)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", Prefix+"dphi", -1, 0.2); |
2351 |
+ |
// make_OFSF_plots("TMath::Abs(dphiMet1)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", Prefix+"dphiMet1", -1, 0.2); |
2352 |
+ |
// make_OFSF_plots("TMath::Abs(dphiMet2)", BaseMetCut, 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", Prefix+"dphiMet2", -1, 0.2); |
2353 |
+ |
// make_OFSF_plots("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", BaseMetCut, 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", Prefix+"dphilc"); |
2354 |
+ |
// make_OFSF_plots("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", BaseMetCut, 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", Prefix+"dphijc"); |
2355 |
+ |
// make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", BaseMetCut, 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(l,MET)|)", Prefix+"dphilco"); |
2356 |
+ |
// make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(pfJetDphiMet[0])), TMath::Min( (TMath::Pi()-TMath::Abs(pfJetDphiMet[1])), (TMath::Pi() - TMath::Abs(pfJetDphiMet[2]))))", BaseMetCut, 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(jet,MET)|)", Prefix+"dphijco"); |
2357 |
+ |
|
2358 |
+ |
} |
2359 |
+ |
|
2360 |
+ |
void ProduceOFSFPlots(string mcjzb, string datajzb) { |
2361 |
+ |
|
2362 |
+ |
|
2363 |
+ |
//FIRST : ETH SELECTION |
2364 |
+ |
ProduceOFSFPlots(mcjzb,datajzb,0); // this is the ETH selection |
2365 |
+ |
|
2366 |
+ |
string backup_cutnJets = (const char*)cutnJets; |
2367 |
+ |
cutnJets = ReplaceInCut(cutnJets,"pfJetGoodNum40>=3","pfJetGoodNum40>=2"); |
2368 |
+ |
cutnJets = ReplaceInCut(cutnJets,"1.4","2.4"); |
2369 |
+ |
|
2370 |
+ |
string backup_basiccut = (const char*)basiccut; |
2371 |
+ |
basiccut = ReplaceInCut(basiccut,"1.4","2.4"); |
2372 |
+ |
|
2373 |
+ |
string backup_essential = (const char*) essentialcut; |
2374 |
+ |
essentialcut = ReplaceInCut(essentialcut,"1.4","2.4"); |
2375 |
+ |
|
2376 |
+ |
ProduceOFSFPlots(mcjzb,datajzb,1); // this is the Aachen selection |
2377 |
+ |
|
2378 |
+ |
cutnJets = TCut(backup_cutnJets.c_str()); |
2379 |
+ |
basiccut = TCut(backup_basiccut.c_str()); |
2380 |
+ |
essentialcut = TCut(backup_essential.c_str()); |
2381 |
+ |
} |
2382 |
+ |
|
2383 |
|
|
2384 |
|
void do_kinematic_plots(string mcjzb, string datajzb, bool doPF=false) |
2385 |
|
{ |
2386 |
+ |
// switch_overunderflow(true); |
2387 |
|
bool dolog=true; |
2388 |
|
bool nolog=false; |
2389 |
+ |
|
2390 |
+ |
bool doOFSF = false; |
2391 |
+ |
bool doKin = false; |
2392 |
+ |
bool doDataComp = false; |
2393 |
+ |
bool MakeTwoThreeJetComparison = false; |
2394 |
+ |
|
2395 |
+ |
|
2396 |
|
if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!"); |
2397 |
|
float mll_low=50; |
2398 |
|
float mll_hi=160; |
2399 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
2400 |
|
mll_low=20; |
2401 |
< |
mll_hi=210; |
2401 |
> |
mll_hi=320; |
2402 |
|
} |
2403 |
|
|
2404 |
< |
make_kin_plot("met[4]","",40,0,200,dolog,"MET [GeV]","met",doPF,true); |
545 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
546 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
547 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
548 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true); |
549 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
550 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
551 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
552 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/2,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
553 |
< |
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
554 |
< |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
555 |
< |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
556 |
< |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
557 |
< |
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
558 |
< |
make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF); |
559 |
< |
make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF); |
560 |
< |
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF); |
561 |
< |
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF); |
562 |
< |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
563 |
< |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
564 |
< |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
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,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,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,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); |
2404 |
> |
if(MakeTwoThreeJetComparison) MakeElegantTwoThreeComparisons(); |
2405 |
|
|
2406 |
< |
make_JES_plot(); |
2406 |
> |
//TauQuestion(); |
2407 |
> |
|
2408 |
> |
//ProduceJanPlots(); |
2409 |
> |
//ProduceMCSystematicPlots(); |
2410 |
> |
//assert(0); |
2411 |
> |
// make_plain_kin_plot("pt",Cut2Str(cutOSSF&&TCut("mll>20&&pfJetGoodNumBtag30>=2")),40,0,200,nolog,"Z p_{T}","PlotForKostas",doPF,true); |
2412 |
> |
|
2413 |
> |
if ( doOFSF ) ProduceOFSFPlots(mcjzb,datajzb); |
2414 |
> |
|
2415 |
> |
if ( doDataComp) { |
2416 |
> |
TCut mllCut(""); |
2417 |
> |
float massmin = 15.; |
2418 |
> |
float massmax = 315; |
2419 |
> |
int massnbins = 60; |
2420 |
> |
/* if ( !PlottingSetup::openBox ) { |
2421 |
> |
mllCut = "mll>70"; |
2422 |
> |
massmin = 120; |
2423 |
> |
massmax = 360; |
2424 |
> |
massnbins = 14; |
2425 |
> |
}*/ |
2426 |
> |
|
2427 |
> |
TCut cutSignal = cutmass&&cutnJets&&"met[4]>100"; |
2428 |
> |
|
2429 |
> |
make_data_comparison_plot("numVtx", "",40, -0.5, 39.5,-1., true, "N(Vertices)", "numVtx"); |
2430 |
> |
make_data_comparison_plot("pfJetGoodEta[0]", "",50, -3.0, 3.0,-1., true, "N(Jets)", "pfJetGoodEta0"); |
2431 |
> |
|
2432 |
> |
|
2433 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSOF,10, -0.5, 9.5,-1., true, "N(Jets)", "njets_OF"); |
2434 |
> |
make_data_comparison_plot("met[4]", cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_inclusive"); |
2435 |
> |
make_data_comparison_plot("met[1]", cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_inclusive"); |
2436 |
> |
make_data_comparison_plot("met[4]", cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_inclusive"); |
2437 |
> |
make_data_comparison_plot("met[1]", cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_inclusive"); |
2438 |
> |
|
2439 |
> |
make_data_comparison_plot("met[4]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "pfMET", "met_SF_exclusive"); |
2440 |
> |
make_data_comparison_plot("met[1]", cutnJets&&cutOSSF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_SF_exclusive"); |
2441 |
> |
make_data_comparison_plot("met[4]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "pfMET", "met_OF_exclusive"); |
2442 |
> |
make_data_comparison_plot("met[1]", cutnJets&&cutOSOF,60, 0., 300.,-1., true, "type 1 corrected pfMET", "mett1_OF_exclusive"); |
2443 |
> |
|
2444 |
> |
|
2445 |
> |
string basiccutsaved = (const char*)basiccut; |
2446 |
> |
|
2447 |
> |
string newbasiccut=basiccutsaved; |
2448 |
> |
|
2449 |
> |
size_t found; |
2450 |
> |
found = newbasiccut.find( "pt2>20" ); |
2451 |
> |
while (found!=string::npos){ |
2452 |
> |
newbasiccut.replace( found, string( "pt2>20" ).length(), "pt2>10" ); |
2453 |
> |
found = newbasiccut.find( "pt2>20" ); |
2454 |
> |
} |
2455 |
> |
basiccut=TCut(newbasiccut.c_str()); |
2456 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSSF,60, 0., 300.,-1., false, "mll", "mll_SF_Aachen_pt2010_met"); |
2457 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[4]>150")&&cutOSOF,60, 0., 300.,-1., false, "mll", "mll_OF_Aachen_pt2010_met"); |
2458 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_Aachen_pt2010_t1cpfmet"); |
2459 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=2&&met[1]>150")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_Aachen_pt2010_t1cpfmet"); |
2460 |
> |
basiccut=TCut(basiccutsaved.c_str()); |
2461 |
> |
|
2462 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSSF, 8, 0., 8.,-1., true, "#(jets)", "njets_SF"); |
2463 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSOF, 8, 0., 8.,-1., true, "#(jets)", "njets_OF"); |
2464 |
> |
|
2465 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_met"); |
2466 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[4]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_met"); |
2467 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSSF,60, 0., 300.,-1., true, "mll", "mll_SF_ETH_t1cpfmet"); |
2468 |
> |
make_data_comparison_plot("mll", TCut("pfJetGoodNum40>=3&&met[1]>100")&&cutOSOF,60, 0., 300.,-1., true, "mll", "mll_OF_ETH_t1cpfmet"); |
2469 |
> |
|
2470 |
> |
|
2471 |
> |
make_data_comparison_plot("mll", cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive"); |
2472 |
> |
make_data_comparison_plot("mll", cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_ee"); |
2473 |
> |
make_data_comparison_plot("mll", cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_inclusive_mm"); |
2474 |
> |
make_data_comparison_plot("mll", cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_inclusive"); |
2475 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==0"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_ee"); |
2476 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSSF&&TCut("id1==1"),60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive_mm"); |
2477 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSSF,60, 15., 315.,-1., true, "m_{ll}", "mll_SF_exclusive"); |
2478 |
> |
make_data_comparison_plot("mll", cutnJets&&cutOSOF,60, 15., 315.,-1., true, "m_{ll}", "mll_OF_exclusive"); |
2479 |
> |
|
2480 |
> |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig"); |
2481 |
> |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig"); |
2482 |
> |
|
2483 |
> |
make_data_comparison_plot("mll", TCut("abs(eta1)<1.4&&abs(eta2)<1.4") && cutOSSF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_central"); |
2484 |
> |
make_data_comparison_plot("mll", TCut("abs(eta1)<1.4&&abs(eta2)<1.4") && cutOSOF&&cutSignal&&mllCut, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_central"); |
2485 |
> |
|
2486 |
> |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_btagVeto"); |
2487 |
> |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30==0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_btagVeto"); |
2488 |
> |
|
2489 |
> |
make_data_comparison_plot("mll", cutOSSF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_sig_AtLeastOneBJet"); |
2490 |
> |
make_data_comparison_plot("mll", cutOSOF&&cutSignal&&mllCut&&"pfJetGoodNumBtag30>0", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig_AtLeastOneBJet"); |
2491 |
> |
|
2492 |
> |
|
2493 |
> |
make_data_comparison_plot("mll", mllCut&&cutOSOF&&cutSignal, massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_sig"); |
2494 |
> |
make_data_comparison_plot("mll", cutmass&&cutOSSF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_SF_CR"); |
2495 |
> |
make_data_comparison_plot("mll", cutmass&&cutOSOF&&"met[4]>100&&met[4]<150&&pfJetGoodNum40==2", massnbins, 15., 315.,-1., false, "m_{ll}", "mll_OF_CR"); |
2496 |
> |
|
2497 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_SF_sig"); |
2498 |
> |
make_data_comparison_plot("pfJetGoodNum40", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(jets)", "njets_OF_sig"); |
2499 |
> |
make_data_comparison_plot("pfJetGoodNumBtag30", cutOSSF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_SF_sig"); |
2500 |
> |
make_data_comparison_plot("pfJetGoodNumBtag30", cutOSOF&&cutSignal&&mllCut, 8, 0., 8.,-1., false, "#(b-jets)", "nbjets_OF_sig"); |
2501 |
> |
|
2502 |
> |
} |
2503 |
> |
|
2504 |
> |
|
2505 |
> |
if ( doKin ) { |
2506 |
> |
string mllCut(""); |
2507 |
> |
/* |
2508 |
> |
make_plain_kin_plot("mll",Cut2Str(cutOSSF&&TCut("mll>20")),56,20,300,dolog,"m_{ll}","NoPreselection/mll_SF",doPF,true); |
2509 |
> |
make_plain_kin_plot("mll",Cut2Str(cutOSOF&&TCut("mll>20")),56,20,300,dolog,"m_{ll}","NoPreselection/mll_OF",doPF,true); |
2510 |
> |
|
2511 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&TCut("mll>20")),80,0,400,dolog,"E_{T}^{miss}","NoPreselection/met_SF",doPF,true); |
2512 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>20")),80,0,400,dolog,"E_{T}^{miss}","NoPreselection/met_OF",doPF,true); |
2513 |
> |
|
2514 |
> |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSSF&&TCut("mll>20")),20,0,800,dolog,"H_{T}","NoPreselection/HT_SF",doPF,true); |
2515 |
> |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSOF&&TCut("mll>20")),20,0,800,dolog,"H_{T}","NoPreselection/HT_OF",doPF,true); |
2516 |
> |
|
2517 |
> |
make_plain_kin_plot("pfJetGoodNum40",Cut2Str(cutOSSF&&TCut("mll>20")),10,-0.5,9.5,dolog,"n_{jets}","NoPreselection/NJets_SF",doPF,true); |
2518 |
> |
make_plain_kin_plot("pfJetGoodNum40",Cut2Str(cutOSOF&&TCut("mll>20")),10,-0.5,9.5,dolog,"n_{jets}","NoPreselection/NJets_OF",doPF,true); |
2519 |
> |
|
2520 |
> |
make_plain_kin_plot("pfJetGoodNumBtag30",Cut2Str(cutOSSF&&TCut("mll>20")),10,-0.5,9.5,dolog,"n_{btags}","NoPreselection/NBTags_SF",doPF,true); |
2521 |
> |
make_plain_kin_plot("pfJetGoodNumBtag30",Cut2Str(cutOSOF&&TCut("mll>20")),10,-0.5,9.5,dolog,"n_{btags}","NoPreselection/NBTags_OF",doPF,true); |
2522 |
> |
|
2523 |
> |
make_plain_kin_plot("pt1",Cut2Str(cutOSSF&&TCut("mll>20")),80,0,400,dolog,"p_{T}^{1}","NoPreselection/Pt1_SF",doPF,true); |
2524 |
> |
make_plain_kin_plot("pt1",Cut2Str(cutOSOF&&TCut("mll>20")),80,0,400,dolog,"p_{T}^{1}","NoPreselection/Pt1_OF",doPF,true); |
2525 |
> |
|
2526 |
> |
make_plain_kin_plot("pt2",Cut2Str(cutOSSF&&TCut("mll>20")),80,0,400,dolog,"p_{T}^{2}","NoPreselection/Pt2_SF",doPF,true); |
2527 |
> |
make_plain_kin_plot("pt2",Cut2Str(cutOSOF&&TCut("mll>20")),80,0,400,dolog,"p_{T}^{2}","NoPreselection/Pt2_OF",doPF,true); |
2528 |
> |
|
2529 |
> |
|
2530 |
> |
assert(0); |
2531 |
> |
make_plain_kin_plot("mll",Cut2Str(cutOSSF&&TCut("mll>60&&mll<120")),60,60,120,dolog,"m_{ll}","TestingLuminosity_SF",doPF,true); |
2532 |
> |
make_plain_kin_plot("mll",Cut2Str(cutOSOF&&TCut("mll>60&&mll<120")),60,60,120,dolog,"m_{ll}","TestingLuminosity_OF",doPF,true); |
2533 |
> |
|
2534 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_0j",doPF,true); |
2535 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_1j",doPF,true); |
2536 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_2j",doPF,true); |
2537 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/MET_OF_30to70_3j",doPF,true); |
2538 |
> |
|
2539 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_0j",doPF,true); |
2540 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_1j",doPF,true); |
2541 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_2j",doPF,true); |
2542 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/MET_OF_Z_3j",doPF,true); |
2543 |
> |
|
2544 |
> |
|
2545 |
> |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSOF&&cutnJets),120,0,1200,dolog,"H_{T}","HT_3jets_OF",doPF,true); |
2546 |
> |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSSF&&cutnJets) ,120,0,1200,dolog,"H_{T}","HT_3jets_SF",doPF,true); |
2547 |
> |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSOF&&cutnJets&&TCut("met[4]>100")),120,0,1200,dolog,"H_{T}","HT_3jets_OF_MET100",doPF,true); |
2548 |
> |
make_plain_kin_plot("pfTightHT",Cut2Str(cutOSSF&&cutnJets&&TCut("met[4]>100")) ,120,0,1200,dolog,"H_{T}","HT_3jets_SF_MET100",doPF,true); |
2549 |
> |
|
2550 |
> |
|
2551 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_0j",doPF,true); |
2552 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_1j",doPF,true); |
2553 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_2j",doPF,true); |
2554 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_30to70_3j",doPF,true); |
2555 |
> |
|
2556 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_0j",doPF,true); |
2557 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_1j",doPF,true); |
2558 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_2j",doPF,true); |
2559 |
> |
make_plain_kin_plot("met[1]",Cut2Str(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==3")),40,0,400,dolog,"PFMET","Debunking/T1MET_OF_Z_3j",doPF,true); |
2560 |
> |
|
2561 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&cutnJets&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_SF_20to70",doPF,true); |
2562 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&cutnJets&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_OF_20to70",doPF,true); |
2563 |
> |
|
2564 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&cutnJets&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_SF_above120",doPF,true); |
2565 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&cutnJets&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_OF_above120",doPF,true); |
2566 |
> |
|
2567 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&TCut("pfJetGoodNum40==2")&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_SF_20to70___2jetsonly",doPF,true); |
2568 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("pfJetGoodNum40==2")&&TCut("mll>20&&mll<70")),50,0,300,dolog,"PFMET","MET_OF_20to70___2jetsonly",doPF,true); |
2569 |
> |
|
2570 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSSF&&TCut("pfJetGoodNum40==2")&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_SF_above120___2jetsonly",doPF,true); |
2571 |
> |
make_plain_kin_plot("met[4]",Cut2Str(cutOSOF&&TCut("pfJetGoodNum40==2")&&TCut("mll>120")),50,0,300,dolog,"PFMET","MET_OF_above120___2jetsonly",doPF,true); |
2572 |
> |
|
2573 |
> |
|
2574 |
> |
make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true); |
2575 |
> |
make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true); |
2576 |
> |
// Plots in signal region |
2577 |
> |
make_kin_plot("met[4]","",70,0,350,dolog,"#slash{E}_{T} [GeV]","met",doPF,true); |
2578 |
> |
|
2579 |
> |
|
2580 |
> |
make_kin_plot("MetFactor","",20,0,2,nolog,"MetFactor","MetFactor",doPF,true); |
2581 |
> |
|
2582 |
> |
make_ttbar_comparison("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_30to70_2j__ALLMCSAMPLES"); |
2583 |
> |
/* |
2584 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_OF_30to70_0j"); |
2585 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_OF_30to70_1j"); |
2586 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_30to70_2j"); |
2587 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_OF_30to70_3j"); |
2588 |
> |
|
2589 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_SF_30to70_0j"); |
2590 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_SF_30to70_1j"); |
2591 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_SF_30to70_2j"); |
2592 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSSF&&TCut("mll>30&&mll<70&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_SF_30to70_3j"); |
2593 |
> |
|
2594 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==0")),dolog,"PFMET","Debunking/MET_OF_Z_0j"); |
2595 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfJetGoodNum40==1")),dolog,"PFMET","Debunking/MET_OF_Z_1j"); |
2596 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==2")),dolog,"PFMET","Debunking/MET_OF_Z_2j"); |
2597 |
> |
DoMCSystPlot("met[4]",40,0,400,(cutOSOF&&TCut("mll>80&&mll<100&&pfTightHT>100&&pfJetGoodNum40==3")),dolog,"PFMET","Debunking/MET_OF_Z_3j"); |
2598 |
> |
|
2599 |
> |
|
2600 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSSF,dolog,"m_{ll} [GeV]","kinSys/mll"); |
2601 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSSF&&TCut("id1==0"),dolog,"m_{ll} [GeV]","kinSys/mll_ee"); |
2602 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSSF&&TCut("id1==1"),dolog,"m_{ll} [GeV]","kinSys/mll_mm"); |
2603 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutnJets&&cutOSOF,dolog,"m_{ll} [GeV]","kinSys/mll_osof"); |
2604 |
> |
|
2605 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutOSSF,dolog,"m_{ll} [GeV]","kinSys/mll_inclusive"); |
2606 |
> |
DoMCSystPlot("mll", (int)((mll_hi-mll_low)/5),mll_low,mll_hi,cutOSOF,dolog,"m_{ll} [GeV]","kinSys/mll_inclusive_osof"); |
2607 |
> |
|
2608 |
> |
DoMCSystPlot("pfJetGoodNum40", 9,-0.5,8.5,cutOSSF,dolog,"nJets","kinSys/nJets_ossf"); |
2609 |
> |
DoMCSystPlot("pfJetGoodNum40", 9,-0.5,8.5,cutOSOF,dolog,"nJets","kinSys/nJets_osof"); |
2610 |
> |
|
2611 |
> |
DoMCSystPlot("pfJetGoodPt[0]/pfJetGoodPt[1]",45,1,10,cutnJets&&cutOSSF,dolog,"p_{T}^{J1} / p_{T}^{J2}","kinSys/j1j2ratio"); |
2612 |
> |
DoMCSystPlot("TMath::Abs(pfJetDphiMet[0])",32,0,3.2,cutnJets&&cutOSSF,dolog,"|#Delta#phi(jet1,MET)|","kinSys/dphiJ1MET"); |
2613 |
> |
DoMCSystPlot(datajzb,mcjzb, (int)((PlottingSetup::jzbHigh+110)/10),-110,PlottingSetup::jzbHigh,cutnJets&&cutOSSF&&Restrmasscut,dolog,"m_{ll} [GeV]","kinSys/jzb_OS_SFZP"); |
2614 |
> |
DoMCSystPlot(datajzb,mcjzb, (int)((PlottingSetup::jzbHigh+110)/10),-110,PlottingSetup::jzbHigh,cutnJets&&cutOSOF&&Restrmasscut,dolog,"m_{ll} [GeV]","kinSys/jzb_OS_OFZP"); |
2615 |
> |
|
2616 |
> |
make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
2617 |
> |
make_kin_plot("mll","mll>20",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
2618 |
> |
make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
2619 |
> |
make_kin_plot("mll","mll>20"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true); |
2620 |
> |
|
2621 |
> |
make_kin_plot("pfJetGoodNum40",mllCut,9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
2622 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
2623 |
> |
|
2624 |
> |
make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_met100",doPF,true); |
2625 |
> |
make_kin_plot("mll","mll>20&&met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_met100",doPF,true,true); |
2626 |
> |
make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee_met100",doPF,true); |
2627 |
> |
make_kin_plot("mll","mll>20&&met[4]>100"+mllCut,(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm_met100",doPF,true); |
2628 |
> |
|
2629 |
> |
|
2630 |
> |
make_kin_plot("pfJetGoodNum40","met[4]>100"+mllCut,9,-0.5,8.5,dolog,"nJets","nJets_met100",doPF); |
2631 |
> |
make_kin_plot("pfJetGoodNum40","met[4]>100",9,-0.5,8.5,dolog,"nJets","nJets_osof_met100",doPF); |
2632 |
> |
|
2633 |
> |
// Further inclusive invariant mass plots |
2634 |
> |
make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
2635 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
2636 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
2637 |
> |
make_kin_plot("mll",mllCut,(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
2638 |
> |
|
2639 |
> |
make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
2640 |
> |
//if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
2641 |
> |
|
2642 |
> |
|
2643 |
> |
// Number of jets |
2644 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_inclusive",doPF); |
2645 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof_inclusive",doPF); |
2646 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
2647 |
> |
|
2648 |
> |
// Others |
2649 |
> |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
2650 |
> |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
2651 |
> |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
2652 |
> |
make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
2653 |
> |
make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF); |
2654 |
> |
make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF); |
2655 |
> |
make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF); |
2656 |
> |
make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF); |
2657 |
> |
// stringstream jzbcut; |
2658 |
> |
// jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
2659 |
> |
// make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
2660 |
> |
// 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); |
2661 |
> |
// 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); |
2662 |
> |
// 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); |
2663 |
> |
// stringstream jzbcut2; |
2664 |
> |
// jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
2665 |
> |
// make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
2666 |
> |
// 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); |
2667 |
> |
// 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); |
2668 |
> |
// 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); |
2669 |
> |
// stringstream jzbcut3; |
2670 |
> |
// jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
2671 |
> |
// make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); |
2672 |
> |
// 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); |
2673 |
> |
// 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); |
2674 |
> |
// 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); |
2675 |
> |
|
2676 |
> |
// make_kin_plot("mll","met[4]>100",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV] (MET>100GeV)","mll_met100_ll",doPF,true); |
2677 |
> |
//make_kin_plot("mll","met[4]>150&&id1==0",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ee} [GeV] (MET>150GeV)","mll_met150_ee",doPF,true); |
2678 |
> |
//make_kin_plot("mll","met[4]>150&&id1==1",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{#mu#mu} [GeV] (MET>150GeV)","mll_met150_mm",doPF,true);*/ |
2679 |
> |
} |
2680 |
> |
|
2681 |
> |
int jzbcuts[7]={0,50,80,100,150,200,250}; |
2682 |
> |
int MCorData[2]={data,mc}; |
2683 |
> |
|
2684 |
> |
for(int d=0;d<2;d++) { |
2685 |
> |
for(int j=0;j<7;j++) { |
2686 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,jzbcuts[j],5.0,MCorData[d]); // 5.0 is the binwidth |
2687 |
> |
} |
2688 |
> |
} |
2689 |
> |
|
2690 |
> |
/* |
2691 |
> |
make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf"); |
2692 |
> |
make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof"); |
2693 |
> |
*/ |
2694 |
> |
switch_overunderflow(false); |
2695 |
|
} |
2696 |
|
|
2697 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
2698 |
|
int nbins, float xmin, float xmax, bool log, |
2699 |
|
float ymin=0, float ymax=0, bool leftJustified=false ) { |
2700 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
2700 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
2701 |
|
|
2702 |
|
TCut weightbackup=cutWeight;//backing up the correct weight (restoring below!) |
2703 |
|
if(weightbackup==TCut("1.0")||weightbackup==TCut("1")) write_warning(__FUNCTION__,"WATCH OUT THE WEIGHT HAS POSSIBLY NOT BEEN RESET!!!! PLEASE CHANGE LINE "+any2string(__LINE__)); |
2704 |
< |
if(var=="numVtx") cutWeight=TCut("1.0"); |
2704 |
> |
//if(var=="numVtx") cutWeight=TCut("1.0"); |
2705 |
|
TCut jzbData[]= { TCut(TString(datajzb+">"+any2string(jzbcut))),TCut(TString(datajzb+"<-"+any2string(jzbcut))) }; |
2706 |
|
TCut jzbMC[] = { TCut(TString(mcjzb+">"+any2string(jzbcut))),TCut(TString(mcjzb+"<-"+any2string(jzbcut))) }; |
2707 |
|
|
2708 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- below: the next ~20 lines changed! |
2709 |
|
int nRegions=4; |
2710 |
< |
if(!PlottingSetup::RestrictToMassPeak) { |
2710 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
2711 |
|
nRegions=2; |
2712 |
|
} |
2713 |
|
|
2714 |
|
string sRegions[] = { "SFZP","OFZP","SFSB","OFSB" }; |
2715 |
+ |
if(!RestrictToMassPeak) { |
2716 |
+ |
sRegions[0]="SF"; |
2717 |
+ |
sRegions[1]="OF"; |
2718 |
+ |
} |
2719 |
|
TCut kRegions[] = { cutOSSF&&cutnJets&&cutmass, cutOSOF&&cutnJets&&cutmass, |
2720 |
|
cutOSSF&&cutnJets&&sidebandcut, cutOSOF&&cutnJets&&sidebandcut }; |
2721 |
|
|
2729 |
|
TCanvas *ccomp = new TCanvas("ccomp","Comparison plot",600,400); |
2730 |
|
ccomp->SetLogy(log); |
2731 |
|
TH1F *datahisto = allsamples.Draw("datahisto", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity); |
2732 |
< |
TH1F *lm4histo = signalsamples.Draw("lm4histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity,signalsamples.FindSample("LM")); |
2732 |
> |
TH1F *lm3histo = signalsamples.Draw("lm3histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb],data,luminosity,signalsamples.FindSample("LM3")); |
2733 |
|
THStack mcstack = allsamples.DrawStack("mcstack",var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb], mc, luminosity); |
2734 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
2735 |
|
if (ymax>ymin) datahisto->SetMaximum(ymax); |
2736 |
< |
lm4histo->SetLineStyle(2); |
2736 |
> |
lm3histo->SetLineStyle(2); |
2737 |
|
datahisto->Draw("e1"); |
2738 |
< |
mcstack.Draw("same"); |
2738 |
> |
mcstack.Draw("histo,same"); |
2739 |
|
datahisto->Draw("same,e1"); |
2740 |
< |
// lm4histo->Draw("hist,same"); |
2740 |
> |
lm3histo->Draw("hist,same"); |
2741 |
|
TLegend *kinleg = allsamples.allbglegend((sRegions[iregion]+(ijzb?"neg":"pos")).c_str()); |
2742 |
|
if ( leftJustified ) { |
2743 |
|
Float_t w = kinleg->GetX2()-kinleg->GetX1(); |
2744 |
|
kinleg->SetX1(0.2); |
2745 |
|
kinleg->SetX2(0.2+w); |
2746 |
|
} |
2747 |
< |
// kinleg->AddEntry(lm4histo,"LM4","l"); |
2747 |
> |
kinleg->AddEntry(lm3histo,"LM3","l"); |
2748 |
|
kinleg->Draw(); |
2749 |
|
TText* write_variable = write_text(0.99,0.01,var); |
2750 |
|
write_variable->SetTextAlign(31); |
2753 |
|
CompleteSave(ccomp,"compare/JZBcut_at_"+any2string(jzbcut)+"/"+filename+"/"+filename+sRegions[iregion]+(ijzb?"neg":"pos")); |
2754 |
|
delete datahisto; |
2755 |
|
delete ccomp; |
2756 |
< |
delete lm4histo; |
2756 |
> |
delete lm3histo; |
2757 |
|
} |
2758 |
|
cutWeight=weightbackup; |
2759 |
|
} |
2765 |
|
|
2766 |
|
// switch_overunderflow(true); // switching overflow/underflow bins on |
2767 |
|
|
2768 |
< |
|
2768 |
> |
switch_overunderflow(true); |
2769 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
2770 |
|
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
2771 |
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut |
2772 |
|
float mll_low=50;float mll_high=170; |
2773 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
2774 |
< |
mll_high=200; |
2775 |
< |
mll_low=50; |
2774 |
> |
mll_high=300; |
2775 |
> |
mll_low=20; |
2776 |
|
} |
2777 |
< |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,30,mll_low,mll_high,false,0,16.); |
2778 |
< |
make_comp_plot("met[4]","pfMET [GeV]","pfmet",jzbcut,mcjzb,datajzb,18,0,360,false,0,16.); |
2779 |
< |
make_comp_plot("pfJetGoodNum","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
2777 |
> |
make_comp_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",jzbcut,mcjzb,datajzb,100,0,10,true); |
2778 |
> |
make_comp_plot("TMath::Abs(pfJetDphiMet[0])","|#Delta#phi(jet1,MET)|","dphiJ1MET",jzbcut,mcjzb,datajzb,32,0,3.2,false,0,0,true); |
2779 |
> |
|
2780 |
> |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,56,mll_low,mll_high,false,0,16.); |
2781 |
> |
make_comp_plot("met[4]","E_{T}^{miss} [GeV]","pfmet",jzbcut,mcjzb,datajzb,18,0,360,false,0,16.); |
2782 |
> |
make_comp_plot("pfJetGoodNum40","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
2783 |
> |
make_comp_plot("pfJetGoodNumBtag","#(b-jets)","nBjets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
2784 |
|
make_comp_plot("pt","Z p_{T} [GeV]","Zpt",jzbcut,mcjzb,datajzb,26,0,525,false,0.,21.); |
2785 |
< |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,20,0.,20.,false,0,16.); |
2785 |
> |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,40,0.,40.,false,0,16.); |
2786 |
|
make_comp_plot("TMath::Abs(dphi)","#Delta#phi(leptons)","dphilep",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
2787 |
|
make_comp_plot("TMath::Abs(dphi_sumJetVSZ[1])","#Delta#phi(Z,jets)","dphiZjets",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
2788 |
+ |
make_comp_plot("eta1","#eta_1","eta1",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
2789 |
+ |
make_comp_plot("eta2","#eta_2","eta2",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
2790 |
|
} |
2791 |
|
|
2792 |
|
switch_overunderflow(false); // switching overflow/underflow bins off |
2810 |
|
|
2811 |
|
float simulatedlumi=luminosity;//in pb please - adjust to your likings |
2812 |
|
|
2813 |
< |
TH1F *JZBplotZJETs = allsamples.Draw("JZBplotZJETs",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/DY")); |
2813 |
> |
TH1F *JZBplotZJETs = allsamples.Draw("JZBplotZJETs",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
2814 |
|
TH1F *JZBplotLM4; |
2815 |
|
if(PlottingSetup::RestrictToMassPeak) JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM4")); |
2816 |
|
else JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM3")); |
2817 |
< |
TH1F *JZBplotTtbar = allsamples.Draw("JZBplotTtbar",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("TTJets")); |
2817 |
> |
TH1F *JZBplotTtbar = allsamples.Draw("JZBplotTtbar",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("TT_")); |
2818 |
|
|
2819 |
|
JZBplotTtbar->SetLineColor(allsamples.GetColor("TTJet")); |
2820 |
|
JZBplotZJETs->SetFillColor(allsamples.GetColor("DY")); |
2825 |
|
|
2826 |
|
JZBplotTtbar->SetMaximum(JZBplotZJETs->GetMaximum()); |
2827 |
|
JZBplotTtbar->SetMinimum(0.01); |
2828 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2828 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2829 |
|
JZBplotTtbar->DrawClone("histo"); |
2830 |
|
JZBplotZJETs->Draw("histo,same"); |
2831 |
|
JZBplotTtbar->SetFillColor(0); |
2832 |
|
JZBplotTtbar->DrawClone("histo,same"); |
2833 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2833 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2834 |
|
JZBplotLM4->Draw("histo,same"); |
2835 |
|
|
2836 |
|
|
2868 |
|
// Draw all plots overlaid |
2869 |
|
JZBplotTtbar->SetMaximum(JZBplotZJETs->GetMaximum()); |
2870 |
|
JZBplotTtbar->SetMinimum(0.01); |
2871 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2871 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2872 |
|
JZBplotTtbar->DrawClone("histo"); |
2873 |
|
JZBplotZJETs->Draw("histo,same"); |
2874 |
|
JZBplotTtbar->SetFillColor(0); |
2875 |
|
JZBplotTtbar->DrawClone("histo,same"); |
2876 |
< |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TTJets")); |
2876 |
> |
JZBplotTtbar->SetFillColor(allsamples.GetColor("TT_")); |
2877 |
|
|
2878 |
|
JZBplotSMS1->SetLineColor(kRed+1); |
2879 |
|
JZBplotSMS2->SetLineColor(kBlue+1); |
2985 |
|
// the line above is not necessary anymore as we're now looking at a prediction without Z+Jets, and not multiplied with (1.0/3) |
2986 |
|
TF1 *ttbarlogpar = do_logpar_fit_to_plot(Tprediction); |
2987 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2988 |
< |
if(PlottingSetup::RestrictToMassPeak) ttbarlogpar->SetParameter(0,1.0/3*ttbarlogpar->GetParameter(0));//correcting for the fact that we didn't multiply with (1.0/3); |
2988 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) ttbarlogpar->SetParameter(0,1.0/3*ttbarlogpar->GetParameter(0));//correcting for the fact that we didn't multiply with (1.0/3); |
2989 |
|
|
2990 |
|
|
2991 |
|
TF1 *ttbarlogparP = new TF1("ttbarlogparP",LogParabolaP,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8); |
3080 |
|
return return_functions; |
3081 |
|
} |
3082 |
|
|
3083 |
< |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
3083 |
> |
void do_prediction_plot(TCut addcut, string Cname, string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
3084 |
|
{ |
3085 |
< |
// switch_overunderflow(true); |
3085 |
> |
|
3086 |
|
bool is_data=false; |
3087 |
|
bool use_signal=false; |
3088 |
|
if(use_data==1) is_data=true; |
3089 |
|
if(use_data==2) use_signal=true; |
3090 |
< |
int nbins=50;//100; |
3091 |
< |
if(is_data) nbins=50; |
3090 |
> |
int nbins=int(high/10);//100; |
3091 |
> |
if(is_data) nbins=int(high/10); |
3092 |
|
float low=0; |
3093 |
< |
float hi=500; |
3093 |
> |
float hi=high; |
3094 |
> |
|
3095 |
> |
stringstream cutpositiveS; |
3096 |
> |
cutpositiveS << "(" << jzb << ">0)"; |
3097 |
> |
TCut cutpositive(cutpositiveS.str().c_str()); |
3098 |
> |
stringstream cutnegativeS; |
3099 |
> |
cutnegativeS << "(" << jzb << "<0)"; |
3100 |
> |
TCut cutnegative(cutnegativeS.str().c_str()); |
3101 |
> |
|
3102 |
|
|
3103 |
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
3104 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3105 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3106 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3107 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3104 |
> |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3105 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3106 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3107 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3108 |
|
|
3109 |
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
3110 |
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
3119 |
|
|
3120 |
|
TH1F *RcorrJZBeemmNoS; |
3121 |
|
|
3122 |
< |
//these are for the ratio |
3123 |
< |
|
3124 |
< |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3125 |
< |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3126 |
< |
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); |
3122 |
> |
//these are for the ratio |
3123 |
> |
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3124 |
> |
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutnegative&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3125 |
> |
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3126 |
> |
TH1F *JLcorrJZBem = allsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutnegative&&cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3127 |
|
|
3128 |
|
TH1F *JRcorrJZBSBem; |
3129 |
|
TH1F *JLcorrJZBSBem; |
3130 |
|
TH1F *JRcorrJZBSBeemm; |
3131 |
|
TH1F *JLcorrJZBSBeemm; |
3132 |
|
|
3133 |
< |
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); |
3133 |
> |
if(use_data==2 || overlay_signal) RcorrJZBeemmNoS = allsamples.Draw("RcorrJZBeemmNoS",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,false); |
3134 |
|
|
3135 |
|
|
3136 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3137 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3138 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3139 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3140 |
< |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3136 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3137 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3138 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3139 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3140 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3141 |
|
|
3142 |
|
//these are for the ratio |
3143 |
< |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3144 |
< |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3145 |
< |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3146 |
< |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3143 |
> |
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3144 |
> |
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3145 |
> |
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutpositive&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3146 |
> |
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", addcut&&cutnegative&&sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3147 |
|
} |
3148 |
|
|
3149 |
|
TH1F *lm4RcorrJZBeemm; |
3150 |
< |
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")); |
3150 |
> |
if(overlay_signal || use_data == 2 || use_data == 1) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", addcut&&cutpositive&&cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM")); |
3151 |
|
|
3152 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
3153 |
|
|
3160 |
|
TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]); |
3161 |
|
ClearHisto(BpredSys); |
3162 |
|
|
3163 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3163 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3164 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
3165 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
3166 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3211 |
|
SQRT(BpredSys); |
3212 |
|
BpredSys->Divide(JBpred); |
3213 |
|
|
1096 |
– |
|
3214 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
3215 |
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred"); |
3216 |
|
Tpred->Add(LcorrJZBem,-1.0); |
3217 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3217 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3218 |
|
Tpred->Add(RcorrJZBSBem,1.0); |
3219 |
|
Tpred->Add(LcorrJZBSBem,-1.0); |
3220 |
|
Tpred->Add(RcorrJZBSBeemm,1.0); |
3263 |
|
Bpred->Draw("hist,same"); |
3264 |
|
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
3265 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
3266 |
< |
lm4RcorrJZBeemm->Draw("hist,same"); |
3266 |
> |
//lm4RcorrJZBeemm->Draw("hist,same"); |
3267 |
|
legBpred->AddEntry(RcorrJZBeemm,"observed","p"); |
3268 |
|
legBpred->AddEntry(Bpred,"predicted","l"); |
3269 |
|
// legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
3270 |
|
// legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
3271 |
< |
legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l"); |
3271 |
> |
// legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l"); |
3272 |
|
legBpred->Draw(); |
3273 |
|
DrawPrelim(); |
3274 |
|
|
3278 |
|
Bpred->SetLineWidth(2); |
3279 |
|
predcomppad->cd(); |
3280 |
|
predcomppad->SetLogy(1); |
1164 |
– |
|
3281 |
|
TH1F *jzbnegative = (TH1F*)LcorrJZBeemm->Clone("jzbnegative"); |
3282 |
|
TH1F *sidebandsemu = (TH1F*)Bpred->Clone("sidebandsemu"); |
3283 |
|
sidebandsemu->Add(jzbnegative,-1); |
3284 |
|
|
3285 |
|
jzbnegative->SetFillColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
3286 |
|
jzbnegative->SetLineColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
3287 |
< |
sidebandsemu->SetLineColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
3288 |
< |
sidebandsemu->SetFillColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
3287 |
> |
sidebandsemu->SetLineColor(allsamples.GetColor((allsamples.FindSample("TT_"))[0])); |
3288 |
> |
sidebandsemu->SetFillColor(allsamples.GetColor((allsamples.FindSample("TT_"))[0])); |
3289 |
|
|
3290 |
|
THStack predcomposition("predcomposition","prediction composition"); |
3291 |
|
predcomposition.Add(sidebandsemu); |
3299 |
|
// lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
3300 |
|
lm4RcorrJZBeemm->SetLineWidth(2); |
3301 |
|
//lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled. |
3302 |
< |
lm4RcorrJZBeemm->Draw("histo,same"); |
3302 |
> |
// lm4RcorrJZBeemm->Draw("histo,same"); |
3303 |
|
DrawPrelim(); |
3304 |
|
TLegend *speciallegBpred = make_legend("",0.45,0.55); |
3305 |
|
//TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled. |
3306 |
|
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
3307 |
|
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
3308 |
|
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
3309 |
< |
if(PlottingSetup::RestrictToMassPeak) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
3309 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
3310 |
|
else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f"); |
3311 |
|
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
3312 |
< |
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3312 |
> |
// speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3313 |
|
speciallegBpred->Draw(); |
3314 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys); |
3314 |
> |
Save_With_Ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition"+Cname,true,true,"data/pred",BpredSys); |
3315 |
> |
delete predcomppad; |
3316 |
|
|
3317 |
|
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
3318 |
|
specialcanv->SetLogy(1); |
3319 |
|
// THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
3320 |
|
blankback->Draw(); |
3321 |
|
// kostack.Draw("same"); |
3322 |
< |
predcomposition.Draw(); |
3322 |
> |
predcomposition.Draw("hist"); |
3323 |
|
Bpred->Draw("hist,same"); |
3324 |
|
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
3325 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
3346 |
|
legBpred->AddEntry(Bpred,"MC predicted","l"); |
3347 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
3348 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
3349 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3349 |
> |
// if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3350 |
|
legBpred->Draw(); |
3351 |
|
DrawMCPrelim(); |
3352 |
|
Bpredsaveas="Bpred_MC"; |
3391 |
|
} |
3392 |
|
|
3393 |
|
|
3394 |
+ |
Bpredsaveas+="_"+Cname+"_"; |
3395 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
3396 |
|
string ytitle("ratio"); |
3397 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
3398 |
|
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
3399 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,true,ytitle,BpredSys);//not extending the y range anymore up to 4 |
3399 |
> |
Save_With_Ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle,BpredSys);//not extending the y range anymore up to 4 |
3400 |
> |
|
3401 |
> |
delete kinpad; |
3402 |
> |
|
3403 |
|
|
3404 |
|
|
3405 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3406 |
|
// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
3407 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3407 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3408 |
|
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
3409 |
|
Bpredem->Add(RcorrJZBem); |
3410 |
|
Bpredem->Add(LcorrJZBem,-1); |
3440 |
|
if(use_data==1) |
3441 |
|
{ |
3442 |
|
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
3443 |
< |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
3444 |
< |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
3445 |
< |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
3443 |
> |
if(RestrictToMassPeak) { |
3444 |
> |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
3445 |
> |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
3446 |
> |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
3447 |
> |
} else legBpredc->AddEntry(Bpredem,"OF","l"); |
3448 |
> |
|
3449 |
> |
|
3450 |
|
legBpredc->Draw(); |
3451 |
|
CompleteSave(globalcanvas,subdir+"Bpred_Data_comparison"); |
3452 |
|
} |
3453 |
|
if(use_data==0) { |
3454 |
|
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
3455 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3456 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3457 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3455 |
> |
if(RestrictToMassPeak) { |
3456 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3457 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3458 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3459 |
> |
} else legBpredc->AddEntry(Bpredem,"MC OF","l"); |
3460 |
> |
|
3461 |
|
legBpredc->Draw(); |
3462 |
|
CompleteSave(globalcanvas,subdir+"Bpred_MC_comparison"); |
3463 |
|
} |
3464 |
|
if(use_data==2) { |
3465 |
|
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
3466 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3467 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3468 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3469 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3466 |
> |
if(RestrictToMassPeak) { |
3467 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
3468 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
3469 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
3470 |
> |
} else { |
3471 |
> |
legBpredc->AddEntry(Bpredem,"MC OF","l"); |
3472 |
> |
} |
3473 |
> |
// if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
3474 |
|
legBpredc->Draw(); |
3475 |
|
CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison"); |
3476 |
|
} |
3477 |
|
} |
3478 |
|
|
1347 |
– |
TFile *f = new TFile("tester.root","RECREATE"); |
1348 |
– |
RcorrJZBeemm->Write(); |
1349 |
– |
Bpred->Write(); |
1350 |
– |
f->Close(); |
1351 |
– |
|
3479 |
|
delete RcorrJZBeemm; |
3480 |
|
delete LcorrJZBeemm; |
3481 |
|
delete RcorrJZBem; |
3489 |
|
delete blankback; |
3490 |
|
|
3491 |
|
delete BpredSys; |
3492 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3492 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3493 |
|
delete RcorrJZBSBem; |
3494 |
|
delete LcorrJZBSBem; |
3495 |
|
delete RcorrJZBSBeemm; |
3501 |
|
delete JLcorrJZBSBeemm; |
3502 |
|
} |
3503 |
|
if(overlay_signal || use_data==2) delete lm4RcorrJZBeemm; |
1377 |
– |
switch_overunderflow(false); |
3504 |
|
} |
3505 |
|
|
3506 |
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) { |
3507 |
< |
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
1382 |
< |
do_prediction_plot(datajzb,globalcanvas,jzbHigh ,data,overlay_signal); |
1383 |
< |
if ( !PlottingSetup::Approved ) { |
1384 |
< |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mc,overlay_signal); |
1385 |
< |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mcwithsignal,overlay_signal); |
1386 |
< |
} else { |
1387 |
< |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
1388 |
< |
} |
1389 |
< |
} |
1390 |
< |
|
1391 |
< |
void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) { |
1392 |
< |
bool do_data=0; |
1393 |
< |
bool dosignal=0; |
1394 |
< |
if(is_data==1) do_data=1; |
1395 |
< |
if(is_data==2) dosignal=1; |
1396 |
< |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1397 |
< |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1398 |
< |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1399 |
< |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1400 |
< |
|
1401 |
< |
TH1F *RcorrJZBSBem; |
1402 |
< |
TH1F *LcorrJZBSBem; |
1403 |
< |
TH1F *RcorrJZBSBeemm; |
1404 |
< |
TH1F *LcorrJZBSbeemm; |
3507 |
> |
switch_overunderflow(true); |
3508 |
|
|
3509 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3510 |
< |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSbem",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1408 |
< |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSbem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1409 |
< |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSbeemm",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1410 |
< |
LcorrJZBSbeemm = allsamples.Draw("LcorrJZBSbeemm",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1411 |
< |
} |
3509 |
> |
TCut cuts[3] = {TCut("mll>0"),Restrmasscut,TCut("mll>20&&mll<70")}; |
3510 |
> |
string cutnames[3] = {"NoMassCut","ZWindow","LowMassRegion2070"}; |
3511 |
|
|
3512 |
< |
|
3513 |
< |
|
3514 |
< |
|
3515 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3516 |
< |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
3517 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3518 |
< |
Bpred->Add(RcorrJZBem,1.0/3); |
3519 |
< |
Bpred->Add(LcorrJZBem,-1.0/3); |
3520 |
< |
Bpred->Add(RcorrJZBSBem,1.0/3); |
1422 |
< |
Bpred->Add(LcorrJZBSBem,-1.0/3); |
1423 |
< |
Bpred->Add(RcorrJZBSBeemm,1.0/3); |
1424 |
< |
Bpred->Add(LcorrJZBSbeemm,-1.0/3); |
1425 |
< |
} else { |
1426 |
< |
Bpred->Add(RcorrJZBem,1.0); |
1427 |
< |
Bpred->Add(LcorrJZBem,-1.0); |
3512 |
> |
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
3513 |
> |
for(int i=0;i<3;i++) { |
3514 |
> |
do_prediction_plot(cuts[i],cutnames[i],datajzb,globalcanvas,jzbHigh ,data,overlay_signal); |
3515 |
> |
if ( !PlottingSetup::Approved ) { |
3516 |
> |
do_prediction_plot(cuts[i],cutnames[i],mcjzb,globalcanvas,jzbHigh ,mc,overlay_signal); |
3517 |
> |
do_prediction_plot(cuts[i],cutnames[i],mcjzb,globalcanvas,jzbHigh ,mcwithsignal,overlay_signal); |
3518 |
> |
} else { |
3519 |
> |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
3520 |
> |
} |
3521 |
|
} |
1429 |
– |
|
1430 |
– |
can->cd(); |
1431 |
– |
can->SetLogy(0); |
1432 |
– |
Bpred->SetLineColor(kRed); |
1433 |
– |
Bpred->SetStats(0); |
1434 |
– |
if(high>0) Bpred->GetXaxis()->SetRangeUser(0,high); |
1435 |
– |
TH1F *JZBratioforfitting=(TH1F*)RcorrJZBeemm->Clone("JZBratioforfitting"); |
1436 |
– |
JZBratioforfitting->Divide(Bpred); |
1437 |
– |
TGraphAsymmErrors *JZBratio = histRatio(RcorrJZBeemm,Bpred,is_data,binning,false); |
1438 |
– |
|
1439 |
– |
|
1440 |
– |
JZBratio->SetTitle(""); |
1441 |
– |
JZBratio->GetYaxis()->SetRangeUser(0.0,9.0); |
1442 |
– |
// if(is_data==1) JZBratio->GetXaxis()->SetRangeUser(0,jzbHigh ); |
1443 |
– |
|
1444 |
– |
TF1 *pol0 = new TF1("pol0","[0]",0,1000); |
1445 |
– |
TF1 *pol0d = new TF1("pol0","[0]",0,1000); |
1446 |
– |
// straightline_fit->SetParameter(0,1); |
1447 |
– |
JZBratioforfitting->Fit(pol0,"Q0R","",0,30); |
1448 |
– |
pol0d->SetParameter(0,pol0->GetParameter(0)); |
1449 |
– |
|
1450 |
– |
JZBratio->GetYaxis()->SetTitle("Observed/Predicted"); |
1451 |
– |
JZBratio->GetXaxis()->SetTitle("JZB [GeV]"); |
1452 |
– |
if ( high>0 ) JZBratio->GetXaxis()->SetRangeUser(0.0,high); |
1453 |
– |
JZBratio->GetYaxis()->SetNdivisions(519); |
1454 |
– |
JZBratio->GetYaxis()->SetRangeUser(0.0,4.0); |
1455 |
– |
JZBratio->GetYaxis()->CenterTitle(); |
1456 |
– |
JZBratio->GetXaxis()->CenterTitle(); |
1457 |
– |
JZBratio->SetMarkerSize(DataMarkerSize); |
1458 |
– |
JZBratio->Draw("AP"); |
1459 |
– |
/////---------------------------- |
1460 |
– |
TPaveText *writeresult = new TPaveText(0.15,0.78,0.49,0.91,"blNDC"); |
1461 |
– |
writeresult->SetFillStyle(4000); |
1462 |
– |
writeresult->SetFillColor(kWhite); |
1463 |
– |
writeresult->SetTextFont(42); |
1464 |
– |
writeresult->SetTextSize(0.03); |
1465 |
– |
writeresult->SetTextAlign(12); |
1466 |
– |
ostringstream jzb_agreement_data_text; |
1467 |
– |
jzb_agreement_data_text<< setprecision(2) << "mean =" << pol0->GetParameter(0) << " #pm " << setprecision(1) << pol0->GetParError(0); |
1468 |
– |
if(is_data==1) fitresultconstdata=pol0->GetParameter(0);// data |
1469 |
– |
if(is_data==0) fitresultconstmc=pol0->GetParameter(0); // monte carlo, no signal |
1470 |
– |
/* if(is_data) writeresult->AddText("Data closure test"); |
1471 |
– |
else writeresult->AddText("MC closure test"); |
1472 |
– |
*/ |
1473 |
– |
writeresult->AddText(jzb_agreement_data_text.str().c_str()); |
1474 |
– |
// writeresult->Draw("same"); |
1475 |
– |
// pol0d->Draw("same"); |
1476 |
– |
TF1 *topline = new TF1("","1.5",0,1000); |
1477 |
– |
TF1 *bottomline = new TF1("","0.5",0,1000); |
1478 |
– |
topline->SetLineColor(kBlue); |
1479 |
– |
topline->SetLineStyle(2); |
1480 |
– |
bottomline->SetLineColor(kBlue); |
1481 |
– |
bottomline->SetLineStyle(2); |
1482 |
– |
// topline->Draw("same"); |
1483 |
– |
// bottomline->Draw("same"); |
1484 |
– |
TF1 *oneline = new TF1("","1.0",0,1000); |
1485 |
– |
oneline->SetLineColor(kBlue); |
1486 |
– |
oneline->SetLineStyle(1); |
1487 |
– |
oneline->Draw("same"); |
1488 |
– |
TLegend *phony_leg = make_legend("ratio",0.6,0.55,false);//this line is just to have the default CMS Preliminary (...) on the canvas as well. |
1489 |
– |
if(is_data==1) DrawPrelim(); |
1490 |
– |
else DrawMCPrelim(); |
1491 |
– |
TLegend *leg = new TLegend(0.55,0.75,0.89,0.89); |
1492 |
– |
leg->SetTextFont(42); |
1493 |
– |
leg->SetTextSize(0.04); |
1494 |
– |
// if(is_data==1) leg->SetHeader("Ratio (data)"); |
1495 |
– |
// else leg->SetHeader("Ratio (MC)"); |
1496 |
– |
|
1497 |
– |
TString MCtitle("MC "); |
1498 |
– |
if (is_data==1) MCtitle = ""; |
1499 |
– |
|
1500 |
– |
leg->SetFillStyle(4000); |
1501 |
– |
leg->SetFillColor(kWhite); |
1502 |
– |
leg->SetTextFont(42); |
1503 |
– |
// leg->AddEntry(topline,"+20\% sys envelope","l"); |
1504 |
– |
leg->AddEntry(JZBratio,MCtitle+"obs / "+MCtitle+"pred","p"); |
1505 |
– |
leg->AddEntry(oneline,"ratio = 1","l"); |
1506 |
– |
// leg->AddEntry(pol0d,"fit in [0,30] GeV","l"); |
1507 |
– |
// leg->AddEntry(bottomline,"#pm50% envelope","l"); |
1508 |
– |
|
1509 |
– |
|
1510 |
– |
//leg->Draw("same"); // no longer drawing legend |
1511 |
– |
|
1512 |
– |
if(is_data==1) CompleteSave(can, "jzb_ratio_data"); |
1513 |
– |
if(is_data==0) CompleteSave(can, "jzb_ratio_mc"); |
1514 |
– |
if(is_data==2) CompleteSave(can, "jzb_ratio_mc_BandS");//special case, MC with signal! |
3522 |
|
|
3523 |
< |
delete RcorrJZBeemm; |
3524 |
< |
delete LcorrJZBeemm; |
1518 |
< |
delete RcorrJZBem; |
1519 |
< |
delete LcorrJZBem; |
1520 |
< |
|
1521 |
< |
delete RcorrJZBSBem; |
1522 |
< |
delete LcorrJZBSBem; |
1523 |
< |
delete RcorrJZBSBeemm; |
1524 |
< |
delete LcorrJZBSbeemm; |
1525 |
< |
} |
1526 |
< |
|
1527 |
< |
void do_ratio_plots(string mcjzb,string datajzb,vector<float> ratio_binning) { |
1528 |
< |
TCanvas *globalc = new TCanvas("globalc","Ratio Plot Canvas"); |
1529 |
< |
globalc->SetLogy(0); |
1530 |
< |
|
1531 |
< |
do_ratio_plot(mc,ratio_binning,mcjzb,globalc, jzbHigh ); |
1532 |
< |
do_ratio_plot(data,ratio_binning,datajzb,globalc, jzbHigh ); |
1533 |
< |
do_ratio_plot(mcwithsignal,ratio_binning,mcjzb,globalc, jzbHigh ); |
3523 |
> |
delete globalcanvas; |
3524 |
> |
switch_overunderflow(false); |
3525 |
|
} |
3526 |
|
|
3527 |
|
string give_jzb_expression(float peak, int type) { |
3544 |
|
Float_t ymin = 1.e-5, ymax = 0.25; |
3545 |
|
TCanvas *can = new TCanvas("can","Lepton Comparison Canvas"); |
3546 |
|
can->SetLogy(1); |
3547 |
< |
TH1F *eemc = allsamples.Draw("eemc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("/DY")); |
3548 |
< |
TH1F *mmmc = allsamples.Draw("mmmc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("/DY")); |
3547 |
> |
TH1F *eemc = allsamples.Draw("eemc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("DYJetsToLL")); |
3548 |
> |
TH1F *mmmc = allsamples.Draw("mmmc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("DYJetsToLL")); |
3549 |
|
eemc->SetLineColor(kBlue); |
3550 |
|
mmmc->SetLineColor(kRed); |
3551 |
|
eemc->SetMinimum(0.1); |
3608 |
|
eemmlegend->AddEntry(jmmd,"#mu#mu","l"); |
3609 |
|
eemmlegend->Draw(); |
3610 |
|
DrawPrelim(); |
3611 |
< |
save_with_ratio(jeed,jmmd,eemmpad->cd(),"lepton_comparison/jzb_Comparing_ee_mm_data"); |
3611 |
> |
Save_With_Ratio(jeed,jmmd,eemmpad->cd(),"lepton_comparison/jzb_Comparing_ee_mm_data"); |
3612 |
|
|
3613 |
< |
TH1F *zjeed = allsamples.Draw("zjeed",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("/DY")); |
3614 |
< |
TH1F *zjmmd = allsamples.Draw("zjmmd",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("/DY")); |
3615 |
< |
TH1F *zjeemmd = allsamples.Draw("zjeemmd",jzbvariablemc,int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets, mc, luminosity,allsamples.FindSample("/DY")); |
3613 |
> |
TH1F *zjeed = allsamples.Draw("zjeed",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("DYJetsToLL")); |
3614 |
> |
TH1F *zjmmd = allsamples.Draw("zjmmd",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("DYJetsToLL")); |
3615 |
> |
TH1F *zjeemmd = allsamples.Draw("zjeemmd",jzbvariablemc,int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets, mc, luminosity,allsamples.FindSample("DYJetsToLL")); |
3616 |
|
dout << "Z+Jets ee : " << zjeed->GetMean() << "+/-" << zjeed->GetMeanError() << endl; |
3617 |
|
dout << "Z+Jets ee : " << zjmmd->GetMean() << "+/-" << zjmmd->GetMeanError() << endl; |
3618 |
|
dout << "Z+Jets eemd : " << zjeemmd->GetMean() << "+/-" << zjeemmd->GetMeanError() << endl; |
3709 |
|
datahisto->SetMinimum(0.1); |
3710 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
3711 |
|
datahisto->Draw("e1"); |
3712 |
< |
mcstack.Draw("same"); |
3712 |
> |
mcstack.Draw("histo,same"); |
3713 |
|
datahisto->Draw("same,e1"); |
3714 |
|
|
3715 |
|
TLegend *leg; |
3716 |
< |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
3717 |
< |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
3718 |
< |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
3719 |
< |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
3720 |
< |
else { |
3721 |
< |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
3722 |
< |
exit(-1); |
3723 |
< |
} |
3716 |
> |
if (!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
3717 |
> |
if(is_OF(cut)) leg = allsamples.allbglegend("Opposite flavor",datahisto); |
3718 |
> |
else leg = allsamples.allbglegend("Same flavor",datahisto); |
3719 |
> |
} else { |
3720 |
> |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
3721 |
> |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
3722 |
> |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
3723 |
> |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
3724 |
> |
else { |
3725 |
> |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
3726 |
> |
exit(-1); |
3727 |
> |
} |
3728 |
> |
} |
3729 |
|
leg->Draw(); |
3730 |
|
string write_cut = decipher_cut(cut,""); |
3731 |
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str()); |
3732 |
|
writeline1->SetTextSize(0.035); |
3733 |
|
writeline1->Draw(); |
3734 |
< |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
3735 |
< |
else save_with_ratio(datahisto,mcstack,jzbpad->cd(),savename); |
3734 |
> |
if(!Contains(savename,"Dibosons")) Save_With_Ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
3735 |
> |
else Save_With_Ratio(datahisto,mcstack,jzbpad->cd(),savename); |
3736 |
|
TPad *jzbpad2 = new TPad("jzbpad2","jzbpad2",0,0,1,1); |
3737 |
|
jzbpad2->cd(); |
3738 |
|
jzbpad2->SetLogy(1); |
3740 |
|
datahisto->SetMinimum(0.1); |
3741 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
3742 |
|
datahisto->Draw("e1"); |
3743 |
< |
mcstack.Draw("same"); |
3743 |
> |
mcstack.Draw("histo,same"); |
3744 |
|
datahisto->Draw("same,e1"); |
3745 |
|
leg->SetHeader(""); |
3746 |
|
leg->Draw(); |
3747 |
|
writeline1->SetTextSize(0.035); |
3748 |
|
writeline1->Draw(); |
3749 |
|
DrawPrelim(); |
3750 |
< |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
3751 |
< |
else save_with_ratio(datahisto,mcstack,jzbpad2->cd(),(savename+"__PosOnly")); |
3750 |
> |
if(!Contains(savename,"Dibosons")) Save_With_Ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
3751 |
> |
else Save_With_Ratio(datahisto,mcstack,jzbpad2->cd(),(savename+"__PosOnly")); |
3752 |
|
datahisto->Delete(); |
3753 |
|
mcstack.Delete(); |
3754 |
|
} |
3776 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning); |
3777 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning); |
3778 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning); |
3779 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
3780 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
3779 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
3780 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
3781 |
|
|
3782 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning); |
3783 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning); |
3784 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
3785 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
3784 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
3785 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
3786 |
|
|
3787 |
|
delete dican; |
3788 |
|
} |
3789 |
|
|
3790 |
|
|
3791 |
|
void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
3792 |
+ |
switch_overunderflow(true); |
3793 |
|
vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ"); |
3794 |
|
|
3795 |
|
if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) { |
3816 |
|
TCanvas *gloca = new TCanvas("gloca","gloca"); |
3817 |
|
|
3818 |
|
dout << "Going to produce prediction plots" << endl; |
3819 |
< |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
3820 |
< |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
3819 |
> |
do_prediction_plot(TCut("mll>0"),"",mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
3820 |
> |
do_prediction_plot(TCut("mll>0"),"",mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
3821 |
|
delete gloca; |
3822 |
|
|
3823 |
|
dout << "Going to reset the cross section for diboson samples ... " << endl; |
3829 |
|
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; |
3830 |
|
|
3831 |
|
} |
3832 |
< |
|
3832 |
> |
// switch_overunderflow(false); |
3833 |
|
} |
3834 |
|
|
3835 |
|
|
3856 |
|
leg->AddEntry(datahisto2,legentry2.c_str()); |
3857 |
|
leg->Draw(); |
3858 |
|
|
3859 |
< |
save_with_ratio(datahisto1,datahisto2,jzbpad->cd(),("jzb/"+savename)); |
3859 |
> |
Save_With_Ratio(datahisto1,datahisto2,jzbpad->cd(),("jzb/"+savename)); |
3860 |
|
|
3861 |
|
datahisto1->Delete(); |
3862 |
|
datahisto2->Delete(); |
3864 |
|
|
3865 |
|
|
3866 |
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
3867 |
+ |
switch_overunderflow(true); |
3868 |
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas"); |
3869 |
|
float max=jzbHigh ; |
3870 |
|
float min=-120; |
3885 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
3886 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
3887 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3888 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
3889 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
1892 |
< |
|
3888 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
3889 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
3890 |
|
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); |
3891 |
|
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); |
3892 |
+ |
draw_normalized_data_vs_data_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,"ee","mm","jzb_ee_vs_mm_coarsest",can,coarsest_binning); |
3893 |
|
|
3894 |
|
} |
3895 |
|
|
3897 |
|
if ( !PlottingSetup::Approved ) { |
3898 |
|
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
3899 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
3900 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
3901 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
3900 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
3901 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
3902 |
|
} |
3903 |
|
delete can; |
3904 |
+ |
switch_overunderflow(false); |
3905 |
|
} |
3906 |
|
|
3907 |
|
|
3945 |
|
// \SFZPJZBPOS |
3946 |
|
// Sample & \OFZPJZBPOS & \OFZPJZBNEG & \SFZPJZBPOS & \SFZPJZBNEG & \OFSBJZBPOS & \OFSBJZBNEG & \SFSBJZBPOS & \SFSBJZBNEG \\\hline |
3947 |
|
|
3948 |
+ |
|
3949 |
+ |
void compute_Improved_MC_yields(string mcjzb,vector<float> jzb_cuts) { |
3950 |
+ |
dout << "Calculating background yields in MC:" << endl; |
3951 |
+ |
|
3952 |
+ |
TCanvas *yica = new TCanvas("yica","yield canvas"); |
3953 |
+ |
|
3954 |
+ |
int nRegions=2; |
3955 |
+ |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) nRegions=2; |
3956 |
+ |
string tsRegions[] = {"SFZP","OFZP"}; |
3957 |
+ |
string posneg[] = {"pos","neg"}; |
3958 |
+ |
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass}; |
3959 |
+ |
|
3960 |
+ |
|
3961 |
+ |
|
3962 |
+ |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
3963 |
+ |
TCut posJZB = give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"); |
3964 |
+ |
TCut negJZB = give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg"); |
3965 |
+ |
|
3966 |
+ |
dout << "_________________________________________________________" << endl; |
3967 |
+ |
dout << "Table for JZB> " << jzb_cuts[ijzb] << endl; |
3968 |
+ |
|
3969 |
+ |
|
3970 |
+ |
THStack *spstack = new THStack(allsamples.DrawStack("spstack","mll<10e6||mll>1",1,0,500,"tester","events",cutOSSF&&cutnJets&&cutmass&&posJZB,mc,luminosity)); |
3971 |
+ |
THStack *snstack = new THStack(allsamples.DrawStack("snstack","mll<10e6||mll>1",1,0,500,"tester","events",cutOSSF&&cutnJets&&cutmass&&negJZB,mc,luminosity)); |
3972 |
+ |
THStack *opstack = new THStack(allsamples.DrawStack("opstack","mll<10e6||mll>1",1,0,500,"tester","events",cutOSOF&&cutnJets&&cutmass&&posJZB,mc,luminosity)); |
3973 |
+ |
THStack *onstack = new THStack(allsamples.DrawStack("onstack","mll<10e6||mll>1",1,0,500,"tester","events",cutOSOF&&cutnJets&&cutmass&&negJZB,mc,luminosity)); |
3974 |
+ |
|
3975 |
+ |
|
3976 |
+ |
vector<pair<string,Value> > obs_yields = WriteYield(spstack, -10, 10, true); |
3977 |
+ |
vector<pair<string,Value> > neg_sf_yields = WriteYield(snstack, -10, 10, true); |
3978 |
+ |
vector<pair<string,Value> > pos_of_yields = WriteYield(opstack, -10, 10, true); |
3979 |
+ |
vector<pair<string,Value> > neg_of_yields = WriteYield(onstack, -10, 10, true); |
3980 |
+ |
|
3981 |
+ |
Value TotObs=Value(0,0); |
3982 |
+ |
Value TotPred=Value(0,0); |
3983 |
+ |
|
3984 |
+ |
for(int ientry=0;ientry<obs_yields.size();ientry++) { |
3985 |
+ |
if(Contains(obs_yields[ientry].first,"t_bar_t")) continue; // ttbar |
3986 |
+ |
if(Contains(obs_yields[ientry].first,"W_Jets")) continue; // W+Jets |
3987 |
+ |
if(Contains(obs_yields[ientry].first,"WW_")) continue; // WW (fully flavor symmetric) |
3988 |
+ |
if(Contains(obs_yields[ientry].first,"Single_top")) continue; // Single Top |
3989 |
+ |
if(Contains(obs_yields[ientry].first,"ee_mumu")) continue; // DY |
3990 |
+ |
if(Contains(obs_yields[ientry].first,"tau_tau")) continue; // DY |
3991 |
+ |
Value pred = neg_sf_yields[ientry].second + pos_of_yields[ientry].second - neg_of_yields[ientry].second; |
3992 |
+ |
Value obs=obs_yields[ientry].second; |
3993 |
+ |
Value diff=obs-pred; |
3994 |
+ |
dout << obs_yields[ientry].first << "\t & \t " << obs << " \t & \t " << pred << "\t & \t " << diff << endl; |
3995 |
+ |
TotObs=TotObs+obs_yields[ientry].second; |
3996 |
+ |
TotPred=TotPred+pred; |
3997 |
+ |
} |
3998 |
+ |
|
3999 |
+ |
float Systematic=sqrt(pow(TotPred.getValue(),2)*0.5*0.5 + pow(TotObs.getValue(),2)*0.5*0.5); |
4000 |
+ |
|
4001 |
+ |
|
4002 |
+ |
} |
4003 |
+ |
|
4004 |
+ |
delete yica; |
4005 |
+ |
} |
4006 |
+ |
|
4007 |
|
void compute_MC_yields(string mcjzb,vector<float> jzb_cuts) { |
4008 |
|
dout << "Calculating background yields in MC:" << endl; |
4009 |
|
|
4010 |
|
TCanvas *yica = new TCanvas("yica","yield canvas"); |
4011 |
|
|
4012 |
|
int nRegions=4; |
4013 |
< |
if(!PlottingSetup::RestrictToMassPeak) nRegions=2; |
4013 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) nRegions=2; |
4014 |
|
string tsRegions[] = {"SFZP","OFZP","SFSB","OFSB"}; |
4015 |
|
string posneg[] = {"pos","neg"}; |
4016 |
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut}; |
4099 |
|
TText *titlecenter; |
4100 |
|
bool frommc=false; |
4101 |
|
if(frommc) { |
4102 |
< |
osof = allsamples.Draw("osof",datajzb,40,-200,200, "JZB [GeV]", "events", massat40&&cutOSSF&&jetcut&&lepcut,mc,luminosity,allsamples.FindSample("TTJets")); |
4102 |
> |
osof = allsamples.Draw("osof",datajzb,40,-200,200, "JZB [GeV]", "events", massat40&&cutOSSF&&jetcut&&lepcut,mc,luminosity,allsamples.FindSample("TT_")); |
4103 |
|
titlecenter = write_title("Extracting ttbar shape (from ossf MC)"); |
4104 |
|
} |
4105 |
|
else { |
4301 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
4302 |
|
cancorr->SetLogz(); |
4303 |
|
cancorr->SetRightMargin(0.13); |
4304 |
< |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"&&SpecialCut&&passtrig); |
4304 |
> |
TCut zptforresponsepresentation(Restrmasscut&&SpecialCut&&passtrig); |
4305 |
> |
|
4306 |
|
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
4307 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
4308 |
+ |
niceresponseplotd->Sumw2(); |
4309 |
+ |
TH2F* emuResponse = (TH2F*)niceresponseplotd->Clone("emuResponse"); |
4310 |
|
vector<int> SampleIndices=allsamples.FindSample(FindKeyword); |
4311 |
|
for(int iSample=0;iSample<(int)SampleIndices.size();iSample++) { |
4312 |
|
if((allsamples.collection)[SampleIndices[iSample]].is_data && !dodata) continue; |
4313 |
|
if((allsamples.collection)[SampleIndices[iSample]].is_data ==false && dodata) continue; |
4314 |
|
|
4315 |
|
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << " for " << FindKeyword << endl; |
4316 |
< |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",zptforresponsepresentation*cutWeight); |
4316 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",(zptforresponsepresentation&&cutOSSF)*cutWeight); |
4317 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+emuResponse",(zptforresponsepresentation&&cutOSOF)*cutWeight); |
4318 |
|
} |
4319 |
< |
|
4319 |
> |
|
4320 |
> |
niceresponseplotd->Add(emuResponse,-1); |
4321 |
> |
|
4322 |
> |
//TF1 *resp_func = new TF1("resp_func","[0]+[1]/x + [2]/pow(x,2)",10,600); |
4323 |
> |
|
4324 |
|
niceresponseplotd->SetStats(0); |
4325 |
|
niceresponseplotd->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
4326 |
|
niceresponseplotd->GetYaxis()->SetTitle("Response"); |
4328 |
|
niceresponseplotd->GetYaxis()->CenterTitle(); |
4329 |
|
niceresponseplotd->Draw("COLZ"); |
4330 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
4331 |
+ |
profd->Rebin(2); |
4332 |
|
profd->SetMarkerSize(DataMarkerSize); |
4333 |
+ |
//profd->Fit(resp_func,"","same,e1",10,400); |
4334 |
|
profd->Fit("pol0","","same,e1",100,400); |
4335 |
+ |
//resp_func->SetLineColor(kBlue); |
4336 |
|
DrawPrelim(); |
4337 |
|
string stitle="Data"; |
4338 |
|
if(!Contains(FindKeyword,"Data")) stitle="MC"; |
4339 |
|
TText* title = write_text(0.5,0.7,stitle.c_str()); |
4340 |
|
title->SetTextAlign(12); |
4341 |
|
title->Draw(); |
4342 |
+ |
// TF1 *datapol=(TF1*)profd->GetFunction("pol0"); |
4343 |
|
TF1 *datapol=(TF1*)profd->GetFunction("pol0"); |
4344 |
|
float correction=datapol->GetParameter(0); |
4345 |
+ |
|
4346 |
+ |
// float correction=resp_func->GetParameter(0); |
4347 |
|
stringstream resstring; |
4348 |
|
resstring<<"Response: "<<std::setprecision(2)<<100*correction<<" %"; |
4349 |
|
TText* restitle = write_text(0.5,0.65,resstring.str()); |
4353 |
|
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_New_"+SaveAs); |
4354 |
|
delete cancorr; |
4355 |
|
delete niceresponseplotd; |
4356 |
+ |
delete profd; |
4357 |
|
return correction; |
4358 |
|
} |
4359 |
|
|
4364 |
|
float datacorrection=find_one_correction_factor("Data",true,"","Data"); |
4365 |
|
float mccorrection=find_one_correction_factor("DY",false,"","MC"); |
4366 |
|
|
4367 |
< |
float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
4367 |
> |
/* float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
4368 |
|
float mcEEcorrection=find_one_correction_factor("DY",false,"id1==0","MC_ee"); |
4369 |
|
|
4370 |
|
float dataMMcorrection=find_one_correction_factor("Data",true,"id1==1","Data_mm"); |
4371 |
|
float mcMMcorrection=find_one_correction_factor("DY",false,"id1==1","MC_mm"); |
4372 |
< |
|
4372 |
> |
*/ |
4373 |
|
cout << "Corrections : " << endl; |
4374 |
|
cout << " Data : " << datacorrection << endl; |
4375 |
< |
cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
4375 |
> |
// cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
4376 |
|
cout << " MC : " << mccorrection << endl; |
4377 |
< |
cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
4377 |
> |
// cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
4378 |
|
|
4379 |
|
//Step 2: Processing the result and making it into something useful :-) |
4380 |
|
stringstream jzbvardatas; |
4381 |
+ |
/* |
4382 |
|
jzbvardatas << "("; |
4383 |
|
|
4384 |
|
if(dataEEcorrection>=1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]-" << dataEEcorrection-1 << "*pt))"; |
4394 |
|
|
4395 |
|
jzbvardatas << ")"; |
4396 |
|
jzbvardata=jzbvardatas.str(); |
4397 |
< |
|
4397 |
> |
*/ |
4398 |
|
stringstream jzbvarmcs; |
4399 |
+ |
/* |
4400 |
|
jzbvarmcs << "("; |
4401 |
< |
|
4401 |
> |
|
4402 |
|
if(mcEEcorrection>=1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]-" << mcEEcorrection-1 << "*pt))"; |
4403 |
|
if(mcEEcorrection<1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-mcEEcorrection << "*pt))"; |
4404 |
|
|
4412 |
|
|
4413 |
|
jzbvarmcs << ")"; |
4414 |
|
jzbvarmc=jzbvarmcs.str(); |
4415 |
< |
|
4415 |
> |
*/ |
4416 |
> |
|
4417 |
> |
if(datacorrection>=1) jzbvardatas<<"(jzb[1]-" << datacorrection-1 << "*pt)"; |
4418 |
> |
if(datacorrection<1) jzbvardatas<<"(jzb[1]+" << 1-datacorrection << "*pt)"; |
4419 |
> |
|
4420 |
> |
if(mccorrection>=1) jzbvarmcs<<"(jzb[1]-" << mccorrection-1 << "*pt)"; |
4421 |
> |
if(mccorrection<1) jzbvarmcs<<"(jzb[1]+" << 1-mccorrection << "*pt)"; |
4422 |
> |
|
4423 |
> |
jzbvardata = jzbvardatas.str(); |
4424 |
> |
jzbvarmc = jzbvarmcs.str(); |
4425 |
> |
|
4426 |
|
dout << "JZB Z pt correction summary : " << endl; |
4427 |
|
dout << " Data: The response is " << datacorrection << " --> jzb variable is now : " << jzbvardata << endl; |
4428 |
|
dout << " MC : The response is " << mccorrection << " --> jzb variable is now : " << jzbvarmc << endl; |
4429 |
|
|
4430 |
|
} |
4431 |
|
|
4432 |
< |
void pick_up_events(string cut) { |
4433 |
< |
dout << "Picking up events with cut " << cut << endl; |
2349 |
< |
allsamples.PickUpEvents(cut); |
4432 |
> |
void pick_up_events(string cut, string filename, bool QuietMode=false) { |
4433 |
> |
allsamples.PickUpEvents(cut,filename,QuietMode); |
4434 |
|
} |
4435 |
|
|
4436 |
|
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) { |
4477 |
|
configfile<<"\n\n"; |
4478 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
4479 |
|
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
4480 |
+ |
configfile<<"UseSidebandsForcJZB="<<UseSidebandsForcJZB<<";//tells us whether to use the sidebands or not\n"; |
4481 |
|
|
4482 |
|
configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n"; |
4483 |
|
|
4516 |
|
} |
4517 |
|
} |
4518 |
|
|
4519 |
< |
void ttbar_sidebands_comparison(string mcjzb, vector<float> binning, string prestring) { |
4519 |
> |
void ttbar_sidebands_comparison(string mcjzb, vector<float> binning, string prestring, TCut cut) { |
4520 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
4521 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
4522 |
|
TCut weightbackup=cutWeight; |
4523 |
+ |
switch_overunderflow(true); |
4524 |
|
|
4525 |
< |
bool doPURW=false; |
4525 |
> |
bool doPURW=true; |
4526 |
|
|
4527 |
|
|
4528 |
|
if(!doPURW) { |
4529 |
+ |
dout << "Not doing PU reweighting for ttbar closure test" << endl; |
4530 |
|
cutWeight="1.0"; |
4531 |
|
// Do it without PU re-weighting |
4532 |
|
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
4536 |
|
|
4537 |
|
stringstream mcjzbnoPU; |
4538 |
|
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb); |
4539 |
< |
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 |
< |
|
4539 |
> |
mcjzb = noPUmcjzb.str(); |
4540 |
|
} |
4541 |
|
|
4542 |
< |
|
2461 |
< |
|
2462 |
< |
|
2463 |
< |
|
2464 |
< |
|
4542 |
> |
|
4543 |
|
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
4544 |
|
|
4545 |
< |
TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4546 |
< |
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4545 |
> |
TH1F *TZem = allsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4546 |
> |
TH1F *nTZem = allsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4547 |
|
TH1F *TSem; |
4548 |
|
TH1F *nTSem; |
4549 |
< |
TH1F *TZeemm = systsamples.Draw("TZeemm",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4550 |
< |
TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4549 |
> |
TH1F *TZeemm = allsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4550 |
> |
TH1F *nTZeemm = allsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4551 |
|
TH1F *TSeemm; |
4552 |
|
TH1F *nTSeemm; |
4553 |
|
|
4554 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4555 |
< |
TSem = systsamples.Draw("TSem",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4556 |
< |
nTSem = systsamples.Draw("nTSem","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4557 |
< |
TSeemm = systsamples.Draw("TSeemm",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4558 |
< |
nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
4554 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4555 |
> |
TSem = allsamples.Draw("TSem", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4556 |
> |
nTSem = allsamples.Draw("nTSem", "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4557 |
> |
TSeemm = allsamples.Draw("TSeemm", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4558 |
> |
nTSeemm = allsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets&&cut,mc,simulatedlumi,allsamples.FindSample("/TT")); |
4559 |
|
} |
4560 |
|
|
4561 |
|
TCanvas *tcan = new TCanvas("tcan","tcan"); |
2484 |
– |
|
4562 |
|
tcan->SetLogy(1); |
4563 |
|
|
4564 |
|
TZeemm->SetLineColor(kBlack); |
4567 |
|
TZem->SetMarkerColor(kRed); |
4568 |
|
|
4569 |
|
|
4570 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4570 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4571 |
|
TSem->SetLineColor(TColor::GetColor("#00A616")); |
4572 |
|
TSeemm->SetLineColor(kMagenta+2); |
4573 |
|
TSem->SetMarkerColor(TColor::GetColor("#00A616")); |
4581 |
|
TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
4582 |
|
histos.push_back(TZem); |
4583 |
|
histos.push_back(TZeemm); |
4584 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4584 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4585 |
|
TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
4586 |
|
TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
4587 |
|
histos.push_back(TSem); |
4588 |
|
histos.push_back(TSeemm); |
4589 |
|
} |
4590 |
< |
draw_all_ttbar_histos(tcan,histos,"histo",0.04); |
4590 |
> |
draw_all_ttbar_histos(tcan,histos,"histo",8); |
4591 |
|
|
4592 |
|
TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false); |
4593 |
|
leg->AddEntry(TZeemm,"SFZP","l"); |
4594 |
|
leg->AddEntry(TZem,"OFZP","l"); |
4595 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4595 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4596 |
|
leg->AddEntry(TSeemm,"SFSB","l"); |
4597 |
|
leg->AddEntry(TSem,"OFSB","l"); |
4598 |
|
} |
4599 |
|
leg->Draw("same"); |
4600 |
|
DrawMCPrelim(simulatedlumi); |
4601 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison"); |
4602 |
+ |
|
4603 |
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
4604 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
4605 |
|
TH1F *TSeemmcopy; |
4606 |
|
TH1F *TSemcopy; |
4607 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4607 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4608 |
|
TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
4609 |
|
TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
4610 |
|
} |
4611 |
|
|
4612 |
|
TZem->Divide(TZeemm); |
4613 |
|
TZem->SetMarkerStyle(21); |
4614 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4614 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4615 |
|
TSem->Divide(TZeemm); |
4616 |
|
TSeemm->Divide(TZeemm); |
4617 |
|
TSem->SetMarkerStyle(24); |
4618 |
|
TSeemm->SetMarkerStyle(32); |
4619 |
< |
} |
4619 |
> |
} |
4620 |
|
|
4621 |
|
tcan->SetLogy(0); |
4622 |
|
TZem->GetYaxis()->SetRangeUser(0,2.5); |
4623 |
|
TZem->GetYaxis()->SetTitle("ratio"); |
4624 |
|
TZem->Draw(); |
4625 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4625 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4626 |
|
TSem->Draw("same"); |
4627 |
|
TSeemm->Draw("same"); |
4628 |
|
} |
4652 |
|
|
4653 |
|
TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false); |
4654 |
|
leg2->AddEntry(TZem,"OFZP / SFZP","ple"); |
4655 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4655 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4656 |
|
leg2->AddEntry(TSeemm,"SFSB / SFZP","ple"); |
4657 |
|
leg2->AddEntry(TSem,"OFSB / SFZP","ple"); |
4658 |
|
} |
4665 |
|
DrawMCPrelim(simulatedlumi); |
4666 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio"); |
4667 |
|
|
4668 |
+ |
|
4669 |
+ |
if (0) { // Turn this off: we don't need this |
4670 |
|
|
4671 |
< |
///-------------- second part: only look at the quantity we actually care about! |
4672 |
< |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
4673 |
< |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
4674 |
< |
rightsfzp->Add(leftsfzp,-1); |
4675 |
< |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
4676 |
< |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
4677 |
< |
rightofzp->Add(leftofzp,-1); |
4678 |
< |
TH1F *leftofsb; |
4679 |
< |
TH1F *rightofsb; |
4680 |
< |
TH1F *leftsfsb; |
4681 |
< |
TH1F *rightsfsb; |
4682 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4683 |
< |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
4684 |
< |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
4685 |
< |
rightofsb->Add(leftofsb,-1); |
4686 |
< |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
4687 |
< |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
4688 |
< |
rightsfsb->Add(leftsfsb,-1); |
4689 |
< |
} |
4671 |
> |
///-------------- second part: only look at the quantity we actually care about! |
4672 |
> |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
4673 |
> |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
4674 |
> |
rightsfzp->Add(leftsfzp,-1); |
4675 |
> |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
4676 |
> |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
4677 |
> |
rightofzp->Add(leftofzp,-1); |
4678 |
> |
TH1F *leftofsb; |
4679 |
> |
TH1F *rightofsb; |
4680 |
> |
TH1F *leftsfsb; |
4681 |
> |
TH1F *rightsfsb; |
4682 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4683 |
> |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
4684 |
> |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
4685 |
> |
rightofsb->Add(leftofsb,-1); |
4686 |
> |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
4687 |
> |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
4688 |
> |
rightsfsb->Add(leftsfsb,-1); |
4689 |
> |
} |
4690 |
|
|
4691 |
< |
tcan->SetLogy(1); |
4692 |
< |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
4693 |
< |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
4694 |
< |
rightsfzp->Draw("histo"); |
4695 |
< |
rightofzp->Draw("histo,same"); |
4696 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4697 |
< |
rightofsb->Draw("histo,same"); |
4698 |
< |
rightsfsb->Draw("histo,same"); |
4699 |
< |
} |
4700 |
< |
DrawMCPrelim(simulatedlumi); |
4691 |
> |
tcan->SetLogy(1); |
4692 |
> |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
4693 |
> |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
4694 |
> |
rightsfzp->Draw("histo"); |
4695 |
> |
rightofzp->Draw("histo,same"); |
4696 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4697 |
> |
rightofsb->Draw("histo,same"); |
4698 |
> |
rightsfsb->Draw("histo,same"); |
4699 |
> |
} |
4700 |
> |
DrawMCPrelim(simulatedlumi); |
4701 |
|
|
4702 |
< |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
4703 |
< |
legA->AddEntry(rightsfzp,"SFZP","l"); |
4704 |
< |
legA->AddEntry(rightofzp,"OFZP","l"); |
4705 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4706 |
< |
legA->AddEntry(rightofsb,"SFSB","l"); |
4707 |
< |
legA->AddEntry(rightsfsb,"OFSB","l"); |
4708 |
< |
} |
4709 |
< |
legA->Draw(); |
4702 |
> |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
4703 |
> |
legA->AddEntry(rightsfzp,"SFZP","l"); |
4704 |
> |
legA->AddEntry(rightofzp,"OFZP","l"); |
4705 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4706 |
> |
legA->AddEntry(rightofsb,"SFSB","l"); |
4707 |
> |
legA->AddEntry(rightsfsb,"OFSB","l"); |
4708 |
> |
} |
4709 |
> |
legA->Draw(); |
4710 |
|
|
4711 |
< |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
4711 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
4712 |
|
|
4713 |
< |
tcan->SetLogy(0); |
4714 |
< |
rightofzp->Divide(rightsfzp); |
4715 |
< |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
4716 |
< |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.5); |
4717 |
< |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
4718 |
< |
rightofzp->Draw(); |
4719 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4720 |
< |
rightofsb->Divide(rightsfzp); |
4721 |
< |
rightsfsb->Divide(rightsfzp); |
4722 |
< |
rightofsb->Draw("same"); |
4723 |
< |
rightsfsb->Draw("same"); |
4724 |
< |
} |
4713 |
> |
tcan->SetLogy(0); |
4714 |
> |
rightofzp->Divide(rightsfzp); |
4715 |
> |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
4716 |
> |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.5); |
4717 |
> |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
4718 |
> |
rightofzp->Draw(); |
4719 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4720 |
> |
rightofsb->Divide(rightsfzp); |
4721 |
> |
rightsfsb->Divide(rightsfzp); |
4722 |
> |
rightofsb->Draw("same"); |
4723 |
> |
rightsfsb->Draw("same"); |
4724 |
> |
} |
4725 |
|
|
4726 |
< |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
4727 |
< |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
4728 |
< |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
4726 |
> |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
4727 |
> |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
4728 |
> |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
4729 |
> |
|
4730 |
> |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
4731 |
> |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
4732 |
> |
center2->SetLineColor(kBlue); |
4733 |
> |
|
4734 |
> |
top2->Draw("same"); |
4735 |
> |
center2->Draw("same"); |
4736 |
> |
bottom2->Draw("same"); |
4737 |
> |
|
4738 |
> |
rightofzp->SetMarkerStyle(21); |
4739 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4740 |
> |
rightofsb->SetMarkerStyle(24); |
4741 |
> |
rightsfsb->SetMarkerStyle(32); |
4742 |
> |
} |
4743 |
> |
|
4744 |
> |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
4745 |
> |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
4746 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4747 |
> |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
4748 |
> |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
4749 |
> |
} |
4750 |
> |
leg3->AddEntry(bottom,"syst. envelope","l"); |
4751 |
> |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
4752 |
> |
leg3->SetY1(0.65); |
4753 |
|
|
4754 |
< |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
2651 |
< |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
2652 |
< |
center2->SetLineColor(kBlue); |
4754 |
> |
leg3->Draw("same"); |
4755 |
|
|
4756 |
< |
top2->Draw("same"); |
4757 |
< |
center2->Draw("same"); |
2656 |
< |
bottom2->Draw("same"); |
2657 |
< |
|
2658 |
< |
rightofzp->SetMarkerStyle(21); |
2659 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2660 |
< |
rightofsb->SetMarkerStyle(24); |
2661 |
< |
rightsfsb->SetMarkerStyle(32); |
2662 |
< |
} |
4756 |
> |
DrawMCPrelim(simulatedlumi); |
4757 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
4758 |
|
|
2664 |
– |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
2665 |
– |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
2666 |
– |
if(PlottingSetup::RestrictToMassPeak) { |
2667 |
– |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
2668 |
– |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
4759 |
|
} |
2670 |
– |
leg3->AddEntry(bottom,"syst. envelope","l"); |
2671 |
– |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
2672 |
– |
leg3->SetY1(0.65); |
2673 |
– |
|
2674 |
– |
leg3->Draw("same"); |
2675 |
– |
|
2676 |
– |
DrawMCPrelim(simulatedlumi); |
2677 |
– |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
4760 |
|
|
4761 |
|
delete TZem; |
4762 |
|
delete nTZem; |
4763 |
|
delete TZeemm; |
4764 |
|
delete nTZeemm; |
4765 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
4765 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4766 |
|
delete TSem; |
4767 |
|
delete nTSem; |
4768 |
|
delete TSeemm; |
4771 |
|
|
4772 |
|
delete tcan; |
4773 |
|
cutWeight=weightbackup; |
4774 |
+ |
switch_overunderflow(false); |
4775 |
|
} |
4776 |
|
|
4777 |
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) { |
4804 |
|
nicer_binning.push_back(100); |
4805 |
|
nicer_binning.push_back(125); |
4806 |
|
nicer_binning.push_back(150); |
4807 |
< |
nicer_binning.push_back(175); |
4807 |
> |
//nicer_binning.push_back(175); |
4808 |
|
nicer_binning.push_back(200); |
4809 |
< |
nicer_binning.push_back(230); |
4810 |
< |
nicer_binning.push_back(280); |
4811 |
< |
nicer_binning.push_back(400); |
4809 |
> |
// nicer_binning.push_back(250); |
4810 |
> |
// nicer_binning.push_back(300); |
4811 |
> |
// nicer_binning.push_back(400); |
4812 |
> |
|
4813 |
> |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/",TCut("mll>0")); |
4814 |
> |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/CutAt20",TCut("mll>20")); |
4815 |
> |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/LowMassRegion2070",TCut("mll>20&&mll<70")); |
4816 |
> |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/ZWindow",Restrmasscut); |
4817 |
|
|
2730 |
– |
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
4818 |
|
} |
4819 |
|
|
4820 |
|
|
4821 |
< |
void zjets_prediction_comparison(string mcjzbWithPUa) { |
4821 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa, TCut massregioncut, string massregionname) { |
4822 |
> |
cout << "****************************************************************************************************************************************************************" << endl; |
4823 |
|
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2736 |
– |
zcan->SetLogy(1); |
4824 |
|
TCut weightbackup=cutWeight; |
4825 |
+ |
|
4826 |
+ |
bool UsePURW=true; |
4827 |
+ |
|
4828 |
+ |
|
4829 |
+ |
string mcjzb; |
4830 |
+ |
if(UsePURW) { |
4831 |
+ |
mcjzb=mcjzbWithPUa; |
4832 |
+ |
cout << "Using PURW peak positions" << endl; |
4833 |
+ |
} else { |
4834 |
+ |
// Do it without PU re-weighting |
4835 |
+ |
cutWeight="1.0"; |
4836 |
+ |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
4837 |
+ |
stringstream resultsNoPU; |
4838 |
+ |
stringstream noPUdatajzb; |
4839 |
+ |
stringstream noPUmcjzb; |
4840 |
+ |
|
4841 |
+ |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,false,noPUdatajzb,noPUmcjzb); |
4842 |
+ |
dout << "The peak corrected JZB expression for MC without pileup is : " << noPUmcjzb.str() << endl; |
4843 |
+ |
|
4844 |
+ |
mcjzb = noPUmcjzb.str(); |
4845 |
+ |
|
4846 |
+ |
} |
4847 |
|
|
4848 |
< |
|
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 |
< |
// 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(); |
2754 |
< |
|
2755 |
< |
cutWeight="1.0"; |
2756 |
< |
|
4848 |
> |
|
4849 |
|
|
4850 |
|
vector<float> binning; |
4851 |
|
binning.push_back(0); |
4852 |
|
binning.push_back(10); |
4853 |
< |
binning.push_back(20); |
4854 |
< |
binning.push_back(40); |
4855 |
< |
// binning.push_back(80); |
4853 |
> |
binning.push_back(30); |
4854 |
> |
// binning.push_back(40); |
4855 |
> |
// binning.push_back(60); |
4856 |
> |
binning.push_back(50); |
4857 |
> |
// binning.push_back(60); |
4858 |
> |
// binning.push_back(70); |
4859 |
> |
// binning.push_back(80); |
4860 |
> |
// binning.push_back(90); |
4861 |
|
binning.push_back(100); |
4862 |
< |
// float sbg_min=0.; |
2766 |
< |
// float sbg_max=100.; |
2767 |
< |
// int sbg_nbins=5; |
4862 |
> |
|
4863 |
|
float simulatedlumi = luminosity;//in pb please - adjust to your likings |
4864 |
|
|
4865 |
|
TCut kPos((mcjzb+">0").c_str()); |
4866 |
|
TCut kNeg((mcjzb+"<0").c_str()); |
4867 |
+ |
TCut reducedNJets(cutnJets); |
4868 |
|
string var( "abs("+mcjzb+")" ); |
4869 |
< |
|
4870 |
< |
TCut kcut(cutmass&&cutOSSF&&cutnJets); |
4871 |
< |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4872 |
< |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
4869 |
> |
|
4870 |
> |
|
4871 |
> |
TCut notTau("!EventZToTaus"); |
4872 |
> |
TCut ee_mm_tautau("mll>0"); |
4873 |
> |
|
4874 |
> |
TH1F *hJZBpos = allsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4875 |
> |
TH1F *hJZBneg = allsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4876 |
> |
|
4877 |
|
hJZBpos->SetLineColor(kBlack); |
4878 |
|
hJZBneg->SetLineColor(kRed); |
4879 |
|
|
4882 |
|
hJZBneg->Draw("same,hist"); |
4883 |
|
hJZBpos->Draw("same,e1"); // So it's on top... |
4884 |
|
|
4885 |
< |
TLegend *leg = make_legend("MC Z+jets",0.55,0.75,false); |
4885 |
> |
TLegend *leg = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.55,0.75,false); |
4886 |
|
leg->AddEntry(hJZBpos,"Observed","pe"); |
4887 |
|
leg->AddEntry(hJZBneg,"Predicted","l"); |
4888 |
|
leg->Draw("same"); |
4889 |
|
DrawMCPrelim(simulatedlumi); |
4890 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction"); |
4890 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction"+any2string(massregionname)); |
4891 |
|
|
4892 |
|
TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio"); |
4893 |
|
hratio->Divide(hJZBneg); |
4894 |
|
|
4895 |
|
for(int i=1;i<=hJZBpos->GetNbinsX();i++) { |
4896 |
< |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << endl; |
4896 |
> |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " +/- " << hJZBpos->GetBinError(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << " +/- " << hJZBneg->GetBinError(i) << " (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << " +/- " << (hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i)) * sqrt(pow(hJZBpos->GetBinError(i)/hJZBpos->GetBinContent(i),2) + pow(hJZBneg->GetBinError(i)/hJZBneg->GetBinContent(i),2)) << ")" << endl; |
4897 |
|
} |
4898 |
|
|
4899 |
< |
zcan->SetLogy(0); |
4899 |
> |
// zcan->SetLogy(0); |
4900 |
|
hratio->GetYaxis()->SetRangeUser(0,2.5); |
4901 |
|
hratio->GetYaxis()->SetTitle("Observed/Predicted"); |
4902 |
|
hratio->Draw("e1"); |
4903 |
|
|
4904 |
< |
TLine *top = new TLine(binning[0],1.25,binning[binning.size()-1],1.25); |
4904 |
> |
TLine *top = new TLine(binning[0],1.2,binning[binning.size()-1],1.2); |
4905 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
4906 |
< |
TLine *bottom = new TLine(binning[0],0.75,binning[binning.size()-1],0.75); |
4906 |
> |
TLine *bottom = new TLine(binning[0],0.8,binning[binning.size()-1],0.8); |
4907 |
|
|
4908 |
|
|
4909 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
4914 |
|
center->Draw("same"); |
4915 |
|
bottom->Draw("same"); |
4916 |
|
|
4917 |
< |
TLegend *leg2 = make_legend("MC Z+jets",0.25,0.75,false); |
4917 |
> |
TLegend *leg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
4918 |
|
leg2->AddEntry(hratio,"obs / pred","pe"); |
4919 |
|
leg2->AddEntry(bottom,"syst. envelope","l"); |
4920 |
|
leg2->Draw("same"); |
4921 |
|
DrawMCPrelim(simulatedlumi); |
4922 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction_ratio"); |
4922 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio"+any2string(massregionname)); |
4923 |
> |
|
4924 |
> |
TH1F *TAUhJZBpos = allsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4925 |
> |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4926 |
> |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4927 |
> |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4928 |
> |
|
4929 |
> |
TH1F *RcorrJZBSBem; |
4930 |
> |
TH1F *LcorrJZBSBem; |
4931 |
> |
TH1F *RcorrJZBSBeemm; |
4932 |
> |
TH1F *LcorrJZBSBeemm; |
4933 |
> |
|
4934 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4935 |
> |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4936 |
> |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4937 |
> |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kPos&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4938 |
> |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ee_mm_tautau&&kNeg&&massregioncut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
4939 |
> |
} |
4940 |
> |
|
4941 |
> |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
4942 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
4943 |
> |
Bpred->Add(RcorrJZBem,1.0/3.); |
4944 |
> |
Bpred->Add(LcorrJZBem,-1.0/3.); |
4945 |
> |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
4946 |
> |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
4947 |
> |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
4948 |
> |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
4949 |
> |
} else { |
4950 |
> |
Bpred->Add(RcorrJZBem,1.0); |
4951 |
> |
Bpred->Add(LcorrJZBem,-1.0); |
4952 |
> |
} |
4953 |
> |
|
4954 |
> |
Bpred->SetLineColor(kRed); |
4955 |
> |
|
4956 |
> |
TAUhJZBpos->SetLineColor(kBlack); |
4957 |
> |
Bpred->SetLineColor(kRed); |
4958 |
> |
|
4959 |
> |
TAUhJZBpos->SetMinimum(1.0); |
4960 |
> |
TAUhJZBpos->Draw("e1"); |
4961 |
> |
Bpred->Draw("same,hist"); |
4962 |
> |
TAUhJZBpos->Draw("same,e1"); |
4963 |
> |
|
4964 |
> |
TLegend *TAUleg = make_legend("MC Z+jets #rightarrow ee,#mu#mu,#tau#tau",0.55,0.75,false); |
4965 |
> |
TAUleg->AddEntry(TAUhJZBpos,"Observed","pe"); |
4966 |
> |
TAUleg->AddEntry(Bpred,"Predicted","l"); |
4967 |
> |
TAUleg->Draw("same"); |
4968 |
> |
DrawMCPrelim(simulatedlumi); |
4969 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction__"+any2string(massregionname)); |
4970 |
> |
|
4971 |
> |
TH1F* TAUhratio = (TH1F*)TAUhJZBpos->Clone("TAUhratio"); |
4972 |
> |
TAUhratio->Divide(Bpred); |
4973 |
> |
|
4974 |
> |
for(int i=1;i<=TAUhJZBpos->GetNbinsX();i++) { |
4975 |
> |
cout << "ee/mm/tautau observed: " << TAUhJZBpos->GetBinContent(i) << " +/- " << TAUhJZBpos->GetBinError(i) << " vs Negative : " << Bpred->GetBinContent(i) << " +/- " << Bpred->GetBinError(i) << " (ratio : " << TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i) << " +/- " << (TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i)) * sqrt(pow(TAUhJZBpos->GetBinError(i)/TAUhJZBpos->GetBinContent(i),2) + pow(Bpred->GetBinError(i)/Bpred->GetBinContent(i),2)) << ")" << endl; |
4976 |
> |
|
4977 |
> |
|
4978 |
> |
} |
4979 |
> |
|
4980 |
> |
zcan->SetLogy(0); |
4981 |
> |
TAUhratio->GetYaxis()->SetRangeUser(0,2.5); |
4982 |
> |
TAUhratio->GetYaxis()->SetTitle("Observed/Predicted"); |
4983 |
> |
TAUhratio->Draw("e1"); |
4984 |
> |
|
4985 |
> |
top->Draw("same"); |
4986 |
> |
center->Draw("same"); |
4987 |
> |
bottom->Draw("same"); |
4988 |
> |
|
4989 |
> |
TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
4990 |
> |
TAUleg2->AddEntry(TAUhratio,"obs / pred","pe"); |
4991 |
> |
TAUleg2->AddEntry(bottom,"syst. envelope","l"); |
4992 |
> |
TAUleg2->Draw("same"); |
4993 |
> |
DrawMCPrelim(simulatedlumi); |
4994 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio"+any2string(massregionname)); |
4995 |
> |
|
4996 |
> |
delete Bpred; |
4997 |
> |
delete TAUhJZBpos; |
4998 |
> |
delete LcorrJZBeemm; |
4999 |
> |
delete RcorrJZBem; |
5000 |
> |
delete LcorrJZBem; |
5001 |
> |
delete hJZBpos; |
5002 |
> |
delete hJZBneg; |
5003 |
> |
|
5004 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5005 |
> |
delete RcorrJZBSBem; |
5006 |
> |
delete LcorrJZBSBem; |
5007 |
> |
delete RcorrJZBSBeemm; |
5008 |
> |
delete LcorrJZBSBeemm; |
5009 |
> |
} |
5010 |
> |
|
5011 |
> |
//*************************************************************************************************** |
5012 |
> |
|
5013 |
> |
string jzbvar=var; |
5014 |
> |
/* |
5015 |
> |
for(int i=0;i<60;i+=10) { |
5016 |
> |
stringstream sSpecialJZBCut; |
5017 |
> |
sSpecialJZBCut << jzbvar << ">" << i; |
5018 |
> |
TCut SpecialJZBCut(sSpecialJZBCut.str().c_str()); |
5019 |
> |
|
5020 |
> |
var="mll"; |
5021 |
> |
|
5022 |
> |
TH1F *FullJZBhJZBpos = allsamples.Draw("FullJZBhJZBpos",var,10,0,200, "m_{ll} [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&¬Tau&&kPos&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
5023 |
> |
TH1F *LcorrJZBPluseemm = allsamples.Draw("LcorrJZBPluseemm",var,10,0,200, "m_{ll} [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&¬Tau&&kNeg&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
5024 |
> |
TH1F *RcorrJZBPlusem = allsamples.Draw("RcorrJZBPlusem",var,10,0,200, "m_{ll} [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&¬Tau&&kPos&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
5025 |
> |
TH1F *LcorrJZBPlusem = allsamples.Draw("LcorrJZBPlusem",var,10,0,200, "m_{ll} [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&¬Tau&&kNeg&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
5026 |
> |
|
5027 |
> |
TH1F *RcorrJZBPlusSBem; |
5028 |
> |
TH1F *LcorrJZBPlusSBem; |
5029 |
> |
TH1F *RcorrJZBPlusSBeemm; |
5030 |
> |
TH1F *LcorrJZBPlusSBeemm; |
5031 |
> |
|
5032 |
> |
|
5033 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5034 |
> |
RcorrJZBPlusSBem = allsamples.Draw("RcorrJZBPlusSBem",var,10,0,200, "m_{ll} [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&¬Tau&&kPos&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
5035 |
> |
LcorrJZBPlusSBem = allsamples.Draw("LcorrJZBPlusSBem",var,10,0,200, "m_{ll} [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&¬Tau&&kNeg&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
5036 |
> |
RcorrJZBPlusSBeemm = allsamples.Draw("RcorrJZBPlusSBeemm",var,10,0,200, "m_{ll} [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&¬Tau&&kPos&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
5037 |
> |
LcorrJZBPlusSBeemm = allsamples.Draw("LcorrJZBPlusSBeemm",var,10,0,200, "m_{ll} [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&¬Tau&&kNeg&&massregioncut&&SpecialJZBCut,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
5038 |
> |
} |
5039 |
> |
|
5040 |
> |
TH1F *BpredPrime = (TH1F*)LcorrJZBPluseemm->Clone("BpredPrime"); |
5041 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5042 |
> |
BpredPrime->Add(RcorrJZBPlusem,1.0/3.); |
5043 |
> |
BpredPrime->Add(LcorrJZBPlusem,-1.0/3.); |
5044 |
> |
BpredPrime->Add(RcorrJZBPlusSBem,1.0/3.); |
5045 |
> |
BpredPrime->Add(LcorrJZBPlusSBem,-1.0/3.); |
5046 |
> |
BpredPrime->Add(RcorrJZBPlusSBeemm,1.0/3.); |
5047 |
> |
BpredPrime->Add(LcorrJZBPlusSBeemm,-1.0/3.); |
5048 |
> |
} else { |
5049 |
> |
BpredPrime->Add(RcorrJZBPlusem,1.0); |
5050 |
> |
BpredPrime->Add(LcorrJZBPlusem,-1.0); |
5051 |
> |
} |
5052 |
> |
|
5053 |
> |
BpredPrime->SetLineColor(kRed); |
5054 |
> |
|
5055 |
> |
FullJZBhJZBpos->SetLineColor(kBlack); |
5056 |
> |
BpredPrime->SetLineColor(kRed); |
5057 |
> |
|
5058 |
> |
FullJZBhJZBpos->SetMinimum(1.0); |
5059 |
> |
FullJZBhJZBpos->Draw("e1"); |
5060 |
> |
BpredPrime->Draw("same,hist"); |
5061 |
> |
FullJZBhJZBpos->Draw("same,e1"); |
5062 |
> |
|
5063 |
> |
TLegend *FullJZBleg = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.55,0.75,false); |
5064 |
> |
FullJZBleg->AddEntry(FullJZBhJZBpos,"Observed","pe"); |
5065 |
> |
FullJZBleg->AddEntry(BpredPrime,"Predicted","l"); |
5066 |
> |
FullJZBleg->Draw("same"); |
5067 |
> |
DrawMCPrelim(simulatedlumi); |
5068 |
> |
CompleteSave(zcan,"Systematics/ZJets/Mll_Distribution_JZB"+any2string(i)+"_zjets_eemumu_prediction__"+any2string(massregionname)); |
5069 |
> |
|
5070 |
> |
TH1F* FullJZBhratio = (TH1F*)FullJZBhJZBpos->Clone("FullJZBhratio"); |
5071 |
> |
FullJZBhratio->Divide(BpredPrime); |
5072 |
> |
|
5073 |
> |
zcan->SetLogy(0); |
5074 |
> |
FullJZBhratio->GetYaxis()->SetRangeUser(0,2.5); |
5075 |
> |
FullJZBhratio->GetYaxis()->SetTitle("Observed/Predicted"); |
5076 |
> |
FullJZBhratio->Draw("e1"); |
5077 |
> |
|
5078 |
> |
TLine *atop = new TLine(0,1.2,200,1.2); |
5079 |
> |
TLine *acenter = new TLine(0,1.0,200,1.0); |
5080 |
> |
TLine *abottom = new TLine(0,0.8,200,0.8); |
5081 |
> |
|
5082 |
> |
atop->SetLineColor(kBlue); |
5083 |
> |
atop->SetLineStyle(2); |
5084 |
> |
acenter->SetLineColor(kBlue); |
5085 |
> |
abottom->SetLineColor(kBlue); |
5086 |
> |
abottom->SetLineStyle(2); |
5087 |
> |
|
5088 |
> |
atop->Draw("same"); |
5089 |
> |
acenter->Draw("same"); |
5090 |
> |
abottom->Draw("same"); |
5091 |
> |
|
5092 |
> |
TLegend *FullJZBleg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
5093 |
> |
FullJZBleg2->AddEntry(FullJZBhratio,"obs / pred","pe"); |
5094 |
> |
FullJZBleg2->AddEntry(abottom,"syst. envelope","l"); |
5095 |
> |
FullJZBleg2->Draw("same"); |
5096 |
> |
DrawMCPrelim(simulatedlumi); |
5097 |
> |
CompleteSave(zcan,"Systematics/ZJets/Mll_Distribution_JZB"+any2string(i)+"zjets_eemumu_prediction_ratio"+any2string(massregionname)); |
5098 |
> |
|
5099 |
> |
|
5100 |
> |
delete BpredPrime; |
5101 |
> |
delete FullJZBhJZBpos; |
5102 |
> |
delete LcorrJZBPluseemm; |
5103 |
> |
delete RcorrJZBPlusem; |
5104 |
> |
delete LcorrJZBPlusem; |
5105 |
> |
// delete FullJZBhJZBpos; |
5106 |
> |
|
5107 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5108 |
> |
delete RcorrJZBPlusSBem; |
5109 |
> |
delete LcorrJZBPlusSBem; |
5110 |
> |
delete RcorrJZBPlusSBeemm; |
5111 |
> |
delete LcorrJZBPlusSBeemm; |
5112 |
> |
} |
5113 |
|
|
5114 |
+ |
} |
5115 |
+ |
//*************************************************************************************************** |
5116 |
+ |
*/ |
5117 |
|
delete zcan; |
5118 |
|
cutWeight=weightbackup; |
2826 |
– |
|
5119 |
|
} |
5120 |
|
|
5121 |
|
|
5122 |
< |
|
5122 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa) { |
5123 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>20"), "nomasscut"); |
5124 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("abs(mll-91)<10"), "Zwindow_10"); |
5125 |
> |
zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>20&&mll<70"), "LowMassRegion2070"); |
5126 |
> |
// zjets_prediction_comparison(mcjzbWithPUa, TCut("abs(mll-91)>10&&mll>20"), "Outside_Zwindow_10"); |
5127 |
> |
// zjets_prediction_comparison(mcjzbWithPUa, TCut("mll>110"), "HighMassRegion110"); |
5128 |
> |
} |
5129 |
> |
|
5130 |
|
void sideband_assessment(string datajzb, float min=30.0, float max=50.0) { |
5131 |
|
tout << endl << endl; |
5132 |
|
stringstream bordercut; |
5177 |
|
TH1F *RcorrJZBSBeemm; |
5178 |
|
TH1F *LcorrJZBSBeemm; |
5179 |
|
|
5180 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5180 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5181 |
|
RcorrJZBSBem = coll.Draw("RcorrJZBSBem",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
5182 |
|
LcorrJZBSBem = coll.Draw("LcorrJZBSBem",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
5183 |
|
RcorrJZBSBeemm = coll.Draw("RcorrJZBSBeemm",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity, mysample); |
5185 |
|
} |
5186 |
|
|
5187 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
5188 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5188 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5189 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
5190 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
5191 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
5234 |
|
} |
5235 |
|
|
5236 |
|
void met_jzb_cut(string datajzb, string mcjzb, vector<float> jzb_cut) { |
5237 |
+ |
cout << "You probably don't want --met, you want --metplots ... " << endl; |
5238 |
+ |
assert(0); |
5239 |
|
/*we want a table like this: |
5240 |
|
__________________ 50 | 100 | ... |
5241 |
|
| Data prediction | a vs b | a vs b | ... |
5398 |
|
TH1F *JRcorrJZBSBeemm; |
5399 |
|
TH1F *JLcorrJZBSBeemm; |
5400 |
|
|
5401 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5401 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5402 |
|
RcorrJZBSBem = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
5403 |
|
LcorrJZBSBem = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
5404 |
|
RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
5419 |
|
|
5420 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
5421 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
5422 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5422 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5423 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
5424 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
5425 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
5469 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
5470 |
|
string ytitle("ratio"); |
5471 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
5472 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,false,ytitle); |
5472 |
> |
Save_With_Ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,false,ytitle); |
5473 |
> |
delete kinpad; |
5474 |
|
|
5475 |
|
TH1F *allevents = qcdsamples.Draw("allevents","pfJetGoodNum",1,0,100, "internal code", "events", "" ,mc, luminosity); |
5476 |
|
TH1F *ossf = qcdsamples.Draw("ossf","pfJetGoodNum",1,0,100, "internal code", "events", cutOSSF ,mc, luminosity); |
5490 |
|
dout << "______________________________________________" << endl; |
5491 |
|
dout << "How QCD shows up in the different regions: " << endl; |
5492 |
|
dout << "OSSF: " << endl; |
5493 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5493 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5494 |
|
dout << " Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
5495 |
|
dout << " sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl; |
5496 |
|
} else { |
5497 |
|
dout << " " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
5498 |
|
} |
5499 |
|
dout << "OSOF: " << endl; |
5500 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5500 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5501 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
5502 |
|
dout << " sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl; |
5503 |
|
} else { |
5504 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
5505 |
|
} |
5506 |
|
dout << "Therefore: " << endl; |
5507 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5507 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5508 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) "; |
5509 |
|
dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) "; |
5510 |
|
dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) "; |
5520 |
|
for(int i=0;i<(int)bins.size();i++) { |
5521 |
|
dout << " JZB > " << bins[i] << " : " << endl; |
5522 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
5523 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
5523 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
5524 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + (1.0/3)*(RcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBSBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX())) << endl; |
5525 |
|
} else { |
5526 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) + RcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) - LcorrJZBem->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
5534 |
|
if(LcorrJZBem) delete LcorrJZBem; |
5535 |
|
if(RcorrJZBeemm) delete RcorrJZBeemm; |
5536 |
|
if(LcorrJZBeemm) delete LcorrJZBeemm; |
5537 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem; |
5538 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem; |
5539 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
5540 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
5537 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBem) delete RcorrJZBSBem; |
5538 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBem) delete LcorrJZBSBem; |
5539 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
5540 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
5541 |
|
} |
5542 |
|
|
5543 |
|
void check_ptsanity() { |
5634 |
|
} |
5635 |
|
} |
5636 |
|
|
5637 |
< |
void met_vs_jzb_plots() { |
5637 |
> |
void met_vs_jzb_plots(string datajzb, string mcjzb) { |
5638 |
|
|
5639 |
|
TCanvas *canmetjzb = new TCanvas("canmet","MET vs JZB canvas"); |
5640 |
|
canmetjzb->SetRightMargin(0.16); |
5641 |
|
|
5642 |
|
vector<string> findme; |
5643 |
|
findme.push_back("DY"); |
5644 |
< |
findme.push_back("TTJets"); |
5644 |
> |
findme.push_back("TT_"); |
5645 |
|
findme.push_back("LM"); |
5646 |
< |
|
5646 |
> |
/* |
5647 |
|
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
5648 |
|
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
5649 |
|
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
5650 |
|
for(int isel=0;isel<(int)selsamples.size();isel++) { |
5651 |
< |
cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
5652 |
< |
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF); |
5651 |
> |
dout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
5652 |
> |
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF&&cutnJets); |
5653 |
|
} |
5654 |
|
metvsjzb->Scale(allsamples.collection[selsamples[0]].weight); |
5655 |
|
metvsjzb->SetStats(0); |
5663 |
|
title->Draw(); |
5664 |
|
CompleteSave(canmetjzb,(string)"METvsJZBplots/"+findme[ifind]); |
5665 |
|
} |
5666 |
+ |
*/ |
5667 |
+ |
|
5668 |
+ |
dout << "About to produce MET plot for DY split up by JZB" << endl; |
5669 |
+ |
|
5670 |
+ |
int nbins=14; |
5671 |
+ |
float low=0; |
5672 |
+ |
float high=140; |
5673 |
+ |
|
5674 |
+ |
stringstream sLEFT; |
5675 |
+ |
sLEFT << "((" << mcjzb << ")<0)"; |
5676 |
+ |
TCut LEFT(sLEFT.str().c_str()); |
5677 |
+ |
stringstream sRIGHT; |
5678 |
+ |
sRIGHT << "((" << mcjzb << ")>0)"; |
5679 |
+ |
TCut RIGHT(sRIGHT.str().c_str()); |
5680 |
+ |
|
5681 |
+ |
TH1F *metleft = allsamples.Draw("metleft","met[4]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
5682 |
+ |
TH1F *metleftO = allsamples.Draw("metleftO","met[4]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
5683 |
+ |
TH1F *metright = allsamples.Draw("metright","met[4]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
5684 |
+ |
TH1F *metrightO = allsamples.Draw("metrightO","met[4]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
5685 |
+ |
|
5686 |
+ |
|
5687 |
+ |
TH1F *Bpred = (TH1F*)metleft->Clone("Bpred"); |
5688 |
+ |
Bpred->Add(metleftO,-1); |
5689 |
+ |
Bpred->Add(metrightO); |
5690 |
+ |
TH1F *obs = (TH1F*)metright->Clone("obs"); |
5691 |
+ |
|
5692 |
+ |
metleft->Add(metleftO,-1); |
5693 |
+ |
metright->Add(metrightO,-1); |
5694 |
+ |
|
5695 |
+ |
metleft->SetLineColor(kRed); |
5696 |
+ |
metright->SetLineColor(kBlack); |
5697 |
+ |
TPad *metpad = new TPad("metpad","metpad",0,0,1,1); |
5698 |
+ |
metpad->cd(); |
5699 |
+ |
metpad->SetLogy(1); |
5700 |
+ |
metleft->Draw("histo"); |
5701 |
+ |
metright->Draw("same"); |
5702 |
+ |
TLegend *lg = make_legend(); |
5703 |
+ |
lg->SetX1(0.5); |
5704 |
+ |
lg->SetY1(0.7); |
5705 |
+ |
lg->AddEntry(metright,"JZB>0 (OSOF corrected)","P"); |
5706 |
+ |
lg->AddEntry(metleft,"JZB<0 (OSOF corrected)","L"); |
5707 |
+ |
lg->SetHeader("DY"); |
5708 |
+ |
|
5709 |
+ |
lg->Draw(); |
5710 |
+ |
Save_With_Ratio(metright,metleft,metpad->cd(),"METvsJZBplots/ComparingLeftToRightinMETspectrum"); |
5711 |
+ |
|
5712 |
+ |
TPad *metpad3 = new TPad("metpad3","metpad3",0,0,1,1); |
5713 |
+ |
metpad3->cd(); |
5714 |
+ |
metpad3->SetLogy(1); |
5715 |
+ |
Bpred->SetLineColor(kRed); |
5716 |
+ |
Bpred->Draw("histo"); |
5717 |
+ |
obs->SetLineColor(kBlack); |
5718 |
+ |
obs->Draw("same"); |
5719 |
+ |
TLegend *lg2 = make_legend(); |
5720 |
+ |
lg2->SetX1(0.5); |
5721 |
+ |
lg2->SetY1(0.7); |
5722 |
+ |
lg2->AddEntry(obs,"observed","P"); |
5723 |
+ |
lg2->AddEntry(Bpred,"predicted","L"); |
5724 |
+ |
lg2->SetHeader("DY"); |
5725 |
+ |
|
5726 |
+ |
lg2->Draw(); |
5727 |
+ |
|
5728 |
+ |
Save_With_Ratio(obs,Bpred,metpad3->cd(),"METvsJZBplots/ComparingPredObsinMET"); |
5729 |
+ |
|
5730 |
+ |
TPad *metpad2 = new TPad("metpad2","metpad2",0,0,1,1); |
5731 |
+ |
metpad2->cd(); |
5732 |
+ |
metpad2->SetLogy(1); |
5733 |
+ |
|
5734 |
+ |
TH1F *metlefta = allsamples.Draw("metlefta","met[2]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
5735 |
+ |
TH1F *metleftOa = allsamples.Draw("metleftOa","met[2]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
5736 |
+ |
TH1F *metrighta = allsamples.Draw("metrighta","met[2]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
5737 |
+ |
TH1F *metrightOa = allsamples.Draw("metrightOa","met[2]",nbins,low,high, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
5738 |
+ |
|
5739 |
+ |
metlefta->Add(metleftOa,-1); |
5740 |
+ |
metrighta->Add(metrightOa,-1); |
5741 |
+ |
|
5742 |
+ |
metlefta->SetLineColor(kRed); |
5743 |
+ |
metpad2->cd(); |
5744 |
+ |
metlefta->Draw("histo"); |
5745 |
+ |
metrighta->Draw("same"); |
5746 |
+ |
lg->Draw(); |
5747 |
+ |
Save_With_Ratio(metrighta,metlefta,metpad2->cd(),"METvsJZBplots/ComparingLeftToRightinMET_type1_spectrum"); |
5748 |
+ |
|
5749 |
+ |
delete Bpred; |
5750 |
+ |
delete obs; |
5751 |
+ |
|
5752 |
+ |
float newhigh=300; |
5753 |
+ |
int newNBins=30; |
5754 |
+ |
|
5755 |
+ |
TPad *metpad4 = new TPad("metpad4","metpad4",0,0,1,1); |
5756 |
+ |
TH1F *Ametleft = allsamples.Draw("Ametleft","met[4]",newNBins,low,newhigh, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity); |
5757 |
+ |
TH1F *AmetleftO = allsamples.Draw("AmetleftO","met[4]",newNBins,low,newhigh, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity); |
5758 |
+ |
TH1F *Ametright = allsamples.Draw("Ametright","met[4]",newNBins,low,newhigh, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity); |
5759 |
+ |
TH1F *AmetrightO = allsamples.Draw("AmetrightO","met[4]",newNBins,low,newhigh, "#slash{E}_{T} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity); |
5760 |
+ |
|
5761 |
+ |
TH1F *aBpred = (TH1F*)Ametleft->Clone("aBpred"); |
5762 |
+ |
aBpred->Add(AmetleftO,-1); |
5763 |
+ |
aBpred->Add(AmetrightO); |
5764 |
+ |
aBpred->SetLineColor(kRed); |
5765 |
+ |
|
5766 |
+ |
TH1F *aobs = (TH1F*)Ametright->Clone("aobs"); |
5767 |
+ |
metpad4->cd(); |
5768 |
+ |
metpad4->SetLogy(1); |
5769 |
+ |
aobs->Draw(); |
5770 |
+ |
aBpred->Draw("histo,same"); |
5771 |
+ |
aobs->Draw("same"); |
5772 |
+ |
lg->SetHeader("All MC"); |
5773 |
+ |
lg->Draw(); |
5774 |
+ |
Save_With_Ratio(aobs,aBpred,metpad4->cd(),"METvsJZBplots/ComparingPredObsinMET_ALLSAMPLES"); |
5775 |
+ |
|
5776 |
+ |
|
5777 |
+ |
delete lg; |
5778 |
+ |
delete canmetjzb; |
5779 |
+ |
delete metleft; |
5780 |
+ |
delete metleftO; |
5781 |
+ |
delete metright; |
5782 |
+ |
delete metrightO; |
5783 |
+ |
} |
5784 |
+ |
|
5785 |
+ |
|
5786 |
+ |
void do_one_ttbar_test(TH1F* &observed, TH1F* &predicted, TH1F* &ratio, TH1F* &ratio2, string mcjzb, string prestring) { |
5787 |
+ |
|
5788 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
5789 |
+ |
write_error(__FUNCTION__,"This function (ttbar_tests) was not written for on-peak studies - sorry."); |
5790 |
+ |
assert(!PlottingSetup::RestrictToMassPeak); |
5791 |
+ |
} |
5792 |
+ |
|
5793 |
+ |
vector<float> binning; |
5794 |
+ |
|
5795 |
+ |
binning.push_back(-200); |
5796 |
+ |
binning.push_back(-150); |
5797 |
+ |
binning.push_back(-125); |
5798 |
+ |
binning.push_back(-100); |
5799 |
+ |
binning.push_back(-75); |
5800 |
+ |
binning.push_back(-50); |
5801 |
+ |
binning.push_back(-25); |
5802 |
+ |
binning.push_back(0); |
5803 |
+ |
binning.push_back(25); |
5804 |
+ |
binning.push_back(50); |
5805 |
+ |
binning.push_back(75); |
5806 |
+ |
binning.push_back(100); |
5807 |
+ |
binning.push_back(125); |
5808 |
+ |
binning.push_back(150); |
5809 |
+ |
binning.push_back(200); |
5810 |
+ |
|
5811 |
+ |
switch_overunderflow(true); |
5812 |
+ |
|
5813 |
+ |
TH1F *TZem = allsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,luminosity,allsamples.FindSample("/TT")); |
5814 |
+ |
TH1F *nTZem = allsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,luminosity,allsamples.FindSample("/TT")); |
5815 |
+ |
TH1F *TZeemm = allsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample("/TT")); |
5816 |
+ |
TH1F *nTZeemm = allsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample("/TT")); |
5817 |
+ |
|
5818 |
+ |
TCanvas *tcan = new TCanvas("tcan","tcan"); |
5819 |
+ |
tcan->SetLogy(1); |
5820 |
+ |
|
5821 |
+ |
TZeemm->SetLineColor(kBlack); |
5822 |
+ |
TZem->SetLineColor(kRed); |
5823 |
+ |
TZeemm->SetMarkerColor(kBlack); |
5824 |
+ |
TZem->SetMarkerColor(kRed); |
5825 |
+ |
|
5826 |
+ |
vector<TH1F*> histos; |
5827 |
+ |
// TZem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
5828 |
+ |
// TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
5829 |
+ |
histos.push_back(TZem); |
5830 |
+ |
histos.push_back(TZeemm); |
5831 |
+ |
draw_all_ttbar_histos(tcan,histos,"histo",8); |
5832 |
+ |
|
5833 |
+ |
TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false); |
5834 |
+ |
leg->AddEntry(TZeemm,"SFZP","l"); |
5835 |
+ |
leg->AddEntry(TZem,"OFZP","l"); |
5836 |
+ |
leg->Draw("same"); |
5837 |
+ |
DrawMCPrelim(); |
5838 |
+ |
CompleteSave(tcan,"Systematics/TtbarTests/"+prestring+"/ttbar_shape_comparison"); |
5839 |
+ |
|
5840 |
+ |
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
5841 |
+ |
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
5842 |
+ |
TH1F *TSeemmcopy; |
5843 |
+ |
TH1F *TSemcopy; |
5844 |
+ |
|
5845 |
+ |
predicted=(TH1F*)TZem->Clone(((string)"predicted_"+prestring).c_str()); |
5846 |
+ |
observed=(TH1F*)TZeemm->Clone(((string)"observed_"+prestring).c_str()); |
5847 |
+ |
|
5848 |
+ |
vector<float> posbinning; |
5849 |
+ |
for(unsigned int i=0;i<binning.size();i++) { |
5850 |
+ |
if(binning[i]<0) continue; |
5851 |
+ |
posbinning.push_back(binning[i]); |
5852 |
+ |
} |
5853 |
+ |
|
5854 |
+ |
TH1F *pred2 = new TH1F("pred2","pred2",posbinning.size()-1,&posbinning[0]);pred2->Sumw2(); |
5855 |
+ |
TH1F *obs2 = new TH1F("obs2","obs2",posbinning.size()-1,&posbinning[0]);obs2->Sumw2(); |
5856 |
+ |
|
5857 |
+ |
for(unsigned int i=1;i<=predicted->GetNbinsX();i++) { |
5858 |
+ |
int index=pred2->FindBin(abs(TZem->GetBinCenter(i))); |
5859 |
+ |
if(TZem->GetBinCenter(i)<0) { |
5860 |
+ |
//we're on the left: subtract em! |
5861 |
+ |
pred2->SetBinContent(index,pred2->GetBinContent(index)-TZem->GetBinContent(i)); |
5862 |
+ |
pred2->SetBinError(index,sqrt(pow(pred2->GetBinError(index),2)+pow(TZem->GetBinError(i),2))); |
5863 |
+ |
//we're on the left: add eemm! |
5864 |
+ |
pred2->SetBinContent(index,pred2->GetBinContent(index)+TZeemm->GetBinContent(i)); |
5865 |
+ |
pred2->SetBinError(index,sqrt(pow(pred2->GetBinError(index),2)+pow(TZeemm->GetBinError(i),2))); |
5866 |
+ |
} else { |
5867 |
+ |
//we're on the right: add em! |
5868 |
+ |
pred2->SetBinContent(index,pred2->GetBinContent(index)+TZem->GetBinContent(i)); |
5869 |
+ |
pred2->SetBinError(index,sqrt(pow(pred2->GetBinError(index),2)+pow(TZem->GetBinError(i),2))); |
5870 |
+ |
//we're on the left: add eemm! |
5871 |
+ |
obs2->SetBinContent(index,obs2->GetBinContent(index)+TZeemm->GetBinContent(i)); |
5872 |
+ |
obs2->SetBinError(index,sqrt(pow(pred2->GetBinError(index),2)+pow(TZeemm->GetBinError(i),2))); |
5873 |
+ |
} |
5874 |
+ |
} |
5875 |
+ |
|
5876 |
+ |
ratio2 = (TH1F*)pred2->Clone(((string)"ratio2_"+prestring).c_str()); |
5877 |
+ |
ratio2->Divide(obs2); |
5878 |
+ |
|
5879 |
+ |
TZem->Divide(TZeemm); |
5880 |
+ |
TZem->SetMarkerStyle(21); |
5881 |
+ |
|
5882 |
+ |
TZem->SetTitle("OF / SF"); |
5883 |
+ |
ratio = (TH1F*)TZem->Clone(((string)"ratio_"+prestring).c_str()); |
5884 |
+ |
|
5885 |
+ |
tcan->SetLogy(0); |
5886 |
+ |
TZem->GetYaxis()->SetRangeUser(0,2.5); |
5887 |
+ |
TZem->GetYaxis()->SetTitle("ratio"); |
5888 |
+ |
TZem->Draw(); |
5889 |
+ |
|
5890 |
+ |
float linepos=emuncertOFFPEAK; |
5891 |
+ |
|
5892 |
+ |
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
5893 |
+ |
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
5894 |
+ |
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
5895 |
+ |
|
5896 |
+ |
top->SetLineColor(kBlue);top->SetLineStyle(2); |
5897 |
+ |
bottom->SetLineColor(kBlue);bottom->SetLineStyle(2); |
5898 |
+ |
center->SetLineColor(kBlue); |
5899 |
+ |
|
5900 |
+ |
top->Draw("same"); |
5901 |
+ |
center->Draw("same"); |
5902 |
+ |
bottom->Draw("same"); |
5903 |
+ |
|
5904 |
+ |
TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false); |
5905 |
+ |
leg2->AddEntry(TZem,"OFZP / SFZP","ple"); |
5906 |
+ |
leg2->AddEntry(bottom,"syst. envelope","l"); |
5907 |
+ |
leg2->SetX1(0.25);leg2->SetX2(0.6); |
5908 |
+ |
leg2->SetY1(0.65); |
5909 |
+ |
|
5910 |
+ |
leg2->Draw("same"); |
5911 |
+ |
|
5912 |
+ |
DrawMCPrelim(); |
5913 |
+ |
CompleteSave(tcan,"Systematics/TtbarTests/"+prestring+"/ttbar_shape_comparison_ratio"); |
5914 |
+ |
|
5915 |
+ |
ratio2->SetLineColor(TZem->GetLineColor()); |
5916 |
+ |
ratio2->SetMarkerColor(TZem->GetMarkerColor()); |
5917 |
+ |
ratio2->GetYaxis()->SetRangeUser(0,2.5); |
5918 |
+ |
ratio2->GetYaxis()->SetTitle("ratio"); |
5919 |
+ |
ratio2->Draw(); |
5920 |
+ |
|
5921 |
+ |
TLine *top2 = new TLine(0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
5922 |
+ |
TLine *center2 = new TLine(0,1.0,binning[binning.size()-1],1.0); |
5923 |
+ |
TLine *bottom2 = new TLine(0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
5924 |
+ |
|
5925 |
+ |
top2->SetLineColor(kBlue);top->SetLineStyle(2); |
5926 |
+ |
bottom2->SetLineColor(kBlue);bottom->SetLineStyle(2); |
5927 |
+ |
center2->SetLineColor(kBlue); |
5928 |
+ |
|
5929 |
+ |
top2->Draw("same"); |
5930 |
+ |
center2->Draw("same"); |
5931 |
+ |
bottom2->Draw("same"); |
5932 |
+ |
|
5933 |
+ |
leg2->Draw("same"); |
5934 |
+ |
|
5935 |
+ |
DrawMCPrelim(); |
5936 |
+ |
CompleteSave(tcan,"Systematics/TtbarTests/"+prestring+"/ttbar_shape_comparison_FINALratio"); |
5937 |
+ |
|
5938 |
+ |
delete TZem; |
5939 |
+ |
delete nTZem; |
5940 |
+ |
delete TZeemm; |
5941 |
+ |
delete nTZeemm; |
5942 |
+ |
delete obs2; |
5943 |
+ |
delete pred2; |
5944 |
+ |
delete tcan; |
5945 |
+ |
switch_overunderflow(false); |
5946 |
|
} |
5947 |
+ |
|
5948 |
+ |
void IllustrateVariation(TH1F *vanilla_ratio, TH1F *response_only_up_ratio, TH1F *response_only_down_ratio, TH1F *reponse_plus_peak_up_ratio, TH1F *reponse_plus_peak_down_ratio, string PostString) { |
5949 |
|
|
5950 |
+ |
|
5951 |
+ |
TCanvas *ttcan2 = new TCanvas("ttcan2","ttcan2"); |
5952 |
+ |
vanilla_ratio->GetYaxis()->SetRangeUser(0.5,1.5); |
5953 |
+ |
vanilla_ratio->SetFillColor(kGreen); |
5954 |
+ |
vanilla_ratio->SetLineColor(kGreen); |
5955 |
+ |
vanilla_ratio->SetMarkerColor(kGreen); |
5956 |
+ |
vanilla_ratio->SetFillStyle(3001); |
5957 |
+ |
vanilla_ratio->Draw("e3"); |
5958 |
+ |
|
5959 |
+ |
response_only_up_ratio->SetFillColor(kRed); |
5960 |
+ |
response_only_up_ratio->SetMarkerColor(kRed); |
5961 |
+ |
response_only_up_ratio->SetLineColor(kRed); |
5962 |
+ |
response_only_up_ratio->SetFillStyle(3003); |
5963 |
+ |
response_only_up_ratio->Draw("e3,same"); |
5964 |
+ |
|
5965 |
+ |
response_only_down_ratio->SetFillColor(kOrange); |
5966 |
+ |
response_only_down_ratio->SetMarkerColor(kOrange); |
5967 |
+ |
response_only_down_ratio->SetLineColor(kOrange); |
5968 |
+ |
response_only_down_ratio->SetFillStyle(3004); |
5969 |
+ |
response_only_down_ratio->Draw("e3,same"); |
5970 |
+ |
|
5971 |
+ |
reponse_plus_peak_up_ratio->SetFillColor(TColor::GetColor("#BDBDBD")); |
5972 |
+ |
reponse_plus_peak_up_ratio->SetMarkerColor(TColor::GetColor("#BDBDBD")); |
5973 |
+ |
reponse_plus_peak_up_ratio->SetLineColor(TColor::GetColor("#BDBDBD")); |
5974 |
+ |
reponse_plus_peak_up_ratio->SetFillStyle(3005); |
5975 |
+ |
reponse_plus_peak_up_ratio->Draw("e3,same"); |
5976 |
+ |
|
5977 |
+ |
reponse_plus_peak_down_ratio->SetFillColor(kBlue); |
5978 |
+ |
reponse_plus_peak_down_ratio->SetMarkerColor(kBlue); |
5979 |
+ |
reponse_plus_peak_down_ratio->SetLineColor(kBlue); |
5980 |
+ |
reponse_plus_peak_down_ratio->SetFillStyle(3006); |
5981 |
+ |
reponse_plus_peak_down_ratio->Draw("e3,same"); |
5982 |
+ |
|
5983 |
+ |
TLine *llow = new TLine(vanilla_ratio->GetBinLowEdge(1),1.0-emuncertOFFPEAK,vanilla_ratio->GetBinLowEdge(vanilla_ratio->GetNbinsX())+vanilla_ratio->GetBinWidth(vanilla_ratio->GetNbinsX()),1.0-emuncertOFFPEAK); |
5984 |
+ |
TLine *lhi = new TLine(vanilla_ratio->GetBinLowEdge(1),1.0+emuncertOFFPEAK,vanilla_ratio->GetBinLowEdge(vanilla_ratio->GetNbinsX())+vanilla_ratio->GetBinWidth(vanilla_ratio->GetNbinsX()),1.0+emuncertOFFPEAK); |
5985 |
+ |
TLine *lOne = new TLine(vanilla_ratio->GetBinLowEdge(1),1.0,vanilla_ratio->GetBinLowEdge(vanilla_ratio->GetNbinsX())+vanilla_ratio->GetBinWidth(vanilla_ratio->GetNbinsX()),1.0); |
5986 |
+ |
|
5987 |
+ |
TLine *llowA = new TLine(vanilla_ratio->GetBinLowEdge(1),1.0-0.07,vanilla_ratio->GetBinLowEdge(vanilla_ratio->GetNbinsX())+vanilla_ratio->GetBinWidth(vanilla_ratio->GetNbinsX()),1.0-0.07); |
5988 |
+ |
TLine *lhiA = new TLine(vanilla_ratio->GetBinLowEdge(1),1.0+0.07,vanilla_ratio->GetBinLowEdge(vanilla_ratio->GetNbinsX())+vanilla_ratio->GetBinWidth(vanilla_ratio->GetNbinsX()),1.0+0.07); |
5989 |
+ |
|
5990 |
+ |
lhiA->SetLineColor(kRed); |
5991 |
+ |
lhiA->SetLineStyle(2); |
5992 |
+ |
llowA->SetLineColor(kRed); |
5993 |
+ |
llowA->SetLineStyle(2); |
5994 |
+ |
|
5995 |
+ |
llow->SetLineColor(kBlue); |
5996 |
+ |
llow->SetLineStyle(2); |
5997 |
+ |
lhi->SetLineColor(kBlue); |
5998 |
+ |
lhi->SetLineStyle(2); |
5999 |
+ |
lOne->SetLineColor(kBlue); |
6000 |
+ |
|
6001 |
+ |
llow->Draw(); |
6002 |
+ |
lhi->Draw(); |
6003 |
+ |
lOne->Draw(); |
6004 |
+ |
|
6005 |
+ |
llowA->Draw(); |
6006 |
+ |
lhiA->Draw(); |
6007 |
+ |
|
6008 |
+ |
TLegend *leg = make_legend(); |
6009 |
+ |
leg->SetX1(0.15); |
6010 |
+ |
leg->SetY1(0.7); |
6011 |
+ |
leg->AddEntry(vanilla_ratio,"Raw JZB","pf"); |
6012 |
+ |
leg->AddEntry(response_only_up_ratio,"With response correction","pf"); |
6013 |
+ |
leg->AddEntry(response_only_down_ratio,"With inverted response correction","pf"); |
6014 |
+ |
leg->AddEntry(reponse_plus_peak_up_ratio,"With response and peak correction","pf"); |
6015 |
+ |
leg->AddEntry(reponse_plus_peak_down_ratio,"With response and inverted peak corr.","pf"); |
6016 |
+ |
leg->AddEntry(lhi,"Systematic envelope","l"); |
6017 |
+ |
// leg->SetNColumns(2); |
6018 |
+ |
leg->Draw(); |
6019 |
+ |
|
6020 |
+ |
CompleteSave(ttcan2,"Systematics/TtbarTests/Comparison"+PostString); |
6021 |
+ |
|
6022 |
+ |
vanilla_ratio->GetYaxis()->SetRangeUser(0.6,1.4); |
6023 |
+ |
vanilla_ratio->Draw("e3"); |
6024 |
+ |
response_only_up_ratio->Draw("e3 same"); |
6025 |
+ |
response_only_down_ratio->Draw("e3 same"); |
6026 |
+ |
TLegend *leg2 = make_legend(); |
6027 |
+ |
leg2->SetX1(0.15); |
6028 |
+ |
leg2->SetY1(0.7); |
6029 |
+ |
leg2->AddEntry(vanilla_ratio,"Raw JZB","pf"); |
6030 |
+ |
leg2->AddEntry(response_only_up_ratio,"With response correction","pf"); |
6031 |
+ |
leg2->AddEntry(response_only_down_ratio,"With inverted response correction","pf"); |
6032 |
+ |
leg2->AddEntry(lhi,"Systematic envelope","l"); |
6033 |
+ |
leg2->Draw(); |
6034 |
+ |
llow->Draw(); |
6035 |
+ |
lOne->Draw(); |
6036 |
+ |
llowA->Draw(); |
6037 |
+ |
lhiA->Draw(); |
6038 |
+ |
|
6039 |
+ |
CompleteSave(ttcan2,"Systematics/TtbarTests/Comparison_Response"+PostString); |
6040 |
+ |
|
6041 |
+ |
response_only_up_ratio->GetYaxis()->SetRangeUser(0.6,1.4); |
6042 |
+ |
response_only_up_ratio->Draw("e3"); |
6043 |
+ |
reponse_plus_peak_up_ratio->Draw("e3 same"); |
6044 |
+ |
reponse_plus_peak_down_ratio->Draw("e3 same"); |
6045 |
+ |
TLegend *leg3 = make_legend(); |
6046 |
+ |
leg3->SetX1(0.15); |
6047 |
+ |
leg3->SetY1(0.7); |
6048 |
+ |
leg3->AddEntry(response_only_up_ratio,"With response correction","pf"); |
6049 |
+ |
leg3->AddEntry(reponse_plus_peak_up_ratio,"With response and peak correction","pf"); |
6050 |
+ |
leg3->AddEntry(reponse_plus_peak_down_ratio,"With response and inverted peak corr.","pf"); |
6051 |
+ |
leg3->AddEntry(lhi,"Systematic envelope","l"); |
6052 |
+ |
leg3->Draw(); |
6053 |
+ |
llow->Draw(); |
6054 |
+ |
lOne->Draw(); |
6055 |
+ |
llowA->Draw(); |
6056 |
+ |
lhiA->Draw(); |
6057 |
+ |
|
6058 |
+ |
CompleteSave(ttcan2,"Systematics/TtbarTests/Comparison_Peak"+PostString); |
6059 |
+ |
|
6060 |
+ |
delete ttcan2; |
6061 |
+ |
} |
6062 |
+ |
|
6063 |
+ |
void ttbar_correction_tests() { |
6064 |
+ |
TCanvas *ttcan = new TCanvas("ttcan","ttcan"); |
6065 |
+ |
|
6066 |
+ |
TH1F *vanilla_observed, *response_only_up_observed, *response_only_down_observed, *reponse_plus_peak_up_observed, *reponse_plus_peak_down_observed; |
6067 |
+ |
|
6068 |
+ |
TH1F *vanilla_predicted, *response_only_up_predicted, *response_only_down_predicted, *reponse_plus_peak_up_predicted, *reponse_plus_peak_down_predicted; |
6069 |
+ |
|
6070 |
+ |
TH1F *vanilla_ratio, *response_only_up_ratio, *response_only_down_ratio, *reponse_plus_peak_up_ratio, *reponse_plus_peak_down_ratio; |
6071 |
+ |
|
6072 |
+ |
TH1F *vanilla_ratio2, *response_only_up_ratio2, *response_only_down_ratio2, *reponse_plus_peak_up_ratio2, *reponse_plus_peak_down_ratio2; |
6073 |
+ |
|
6074 |
+ |
string vanilla="jzb[1]"; |
6075 |
+ |
string response_only_up="((jzb[1]+0.034665*pt))"; |
6076 |
+ |
string response_only_down="((jzb[1]-0.034665*pt))"; |
6077 |
+ |
string reponse_plus_peak_up="((jzb[1]+0.034665*pt)- 3.58273 )"; |
6078 |
+ |
string reponse_plus_peak_down="((jzb[1]+0.034665*pt)+ 3.58273 )"; |
6079 |
+ |
|
6080 |
+ |
do_one_ttbar_test(vanilla_observed,vanilla_predicted,vanilla_ratio,vanilla_ratio2,vanilla,"vanilla"); |
6081 |
+ |
do_one_ttbar_test(response_only_up_observed,response_only_up_predicted,response_only_up_ratio,response_only_up_ratio2,response_only_up,"response_only_up"); |
6082 |
+ |
do_one_ttbar_test(response_only_down_observed,response_only_down_predicted,response_only_down_ratio,response_only_down_ratio2,response_only_down,"response_only_down"); |
6083 |
+ |
do_one_ttbar_test(reponse_plus_peak_up_observed,reponse_plus_peak_up_predicted,reponse_plus_peak_up_ratio,reponse_plus_peak_up_ratio2,reponse_plus_peak_up,"reponse_plus_peak_up"); |
6084 |
+ |
do_one_ttbar_test(reponse_plus_peak_down_observed,reponse_plus_peak_down_predicted,reponse_plus_peak_down_ratio,reponse_plus_peak_down_ratio2,reponse_plus_peak_down,"reponse_plus_peak_down"); |
6085 |
+ |
|
6086 |
+ |
ttcan->cd(); |
6087 |
+ |
|
6088 |
+ |
IllustrateVariation(vanilla_ratio,response_only_up_ratio,response_only_down_ratio,reponse_plus_peak_up_ratio,reponse_plus_peak_down_ratio,"PartialRatio"); |
6089 |
+ |
IllustrateVariation(vanilla_ratio2,response_only_up_ratio2,response_only_down_ratio2,reponse_plus_peak_up_ratio2,reponse_plus_peak_down_ratio2,"FullRatio"); |
6090 |
+ |
|
6091 |
+ |
delete vanilla_observed; |
6092 |
+ |
delete response_only_up_observed; |
6093 |
+ |
delete response_only_down_observed; |
6094 |
+ |
delete reponse_plus_peak_up_observed; |
6095 |
+ |
delete reponse_plus_peak_down_observed; |
6096 |
+ |
|
6097 |
+ |
delete vanilla_predicted; |
6098 |
+ |
delete response_only_up_predicted; |
6099 |
+ |
delete response_only_down_predicted; |
6100 |
+ |
delete reponse_plus_peak_up_predicted; |
6101 |
+ |
delete reponse_plus_peak_down_predicted; |
6102 |
+ |
|
6103 |
+ |
delete vanilla_ratio; |
6104 |
+ |
delete response_only_up_ratio; |
6105 |
+ |
delete response_only_down_ratio; |
6106 |
+ |
delete reponse_plus_peak_up_ratio; |
6107 |
+ |
delete reponse_plus_peak_down_ratio; |
6108 |
+ |
|
6109 |
+ |
delete ttcan; |
6110 |
+ |
} |
6111 |
+ |
|
6112 |
+ |
void ttbar_region_search(string mcjzb) { |
6113 |
+ |
cout << "Looking for a nice control region" << endl; |
6114 |
+ |
TCanvas *can = new TCanvas("can","can",1200,1200); |
6115 |
+ |
can->Divide(2,2); |
6116 |
+ |
can->cd(1); |
6117 |
+ |
can->cd(1)->SetLogy(1); |
6118 |
+ |
|
6119 |
+ |
THStack JZBdistSF = allsamples.DrawStack("JZBdistSF",mcjzb,100,-150,150, "JZB [GeV]", "events", cutmass&&cutOSSF&&TCut("pfJetGoodNum40==2"),mc, luminosity); |
6120 |
+ |
THStack JZBdistOF = allsamples.DrawStack("JZBdistOF",mcjzb,100,-150,150, "JZB [GeV]", "events", cutmass&&cutOSOF&&TCut("pfJetGoodNum40==2"),mc, luminosity); |
6121 |
+ |
|
6122 |
+ |
JZBdistSF.Draw("histo"); |
6123 |
+ |
JZBdistSF.SetMaximum(1000); |
6124 |
+ |
JZBdistSF.SetMinimum(0.1); |
6125 |
+ |
JZBdistSF.Draw("histo"); |
6126 |
+ |
DrawMCPrelim(); |
6127 |
+ |
|
6128 |
+ |
can->cd(2); |
6129 |
+ |
can->cd(2)->SetLogy(1); |
6130 |
+ |
JZBdistOF.Draw("histo"); |
6131 |
+ |
JZBdistOF.SetMaximum(1000); |
6132 |
+ |
JZBdistOF.SetMinimum(0.1); |
6133 |
+ |
JZBdistOF.Draw("histo"); |
6134 |
+ |
DrawMCPrelim(); |
6135 |
+ |
|
6136 |
+ |
can->cd(3); |
6137 |
+ |
|
6138 |
+ |
|
6139 |
+ |
write_warning(__FUNCTION__,"Missing negative JZB subtraction "); |
6140 |
+ |
|
6141 |
+ |
DrawMCPrelim(); |
6142 |
+ |
|
6143 |
+ |
/* |
6144 |
+ |
THStack *Subtracted = new THStack(); |
6145 |
+ |
|
6146 |
+ |
TIter nextSF(JZBdistSF.GetHists()); |
6147 |
+ |
TIter nextOF(JZBdistOF.GetHists()); |
6148 |
+ |
TObject* SFobj; |
6149 |
+ |
TObject* OFobj; |
6150 |
+ |
|
6151 |
+ |
TH1* sfh = NULL; |
6152 |
+ |
TH1* ofh = NULL; |
6153 |
+ |
|
6154 |
+ |
while ( (SFobj = nextSF()) && (OFobj = nextOF()) ) { |
6155 |
+ |
TH1F *sfstart = (TH1*)SFobj->Clone(); |
6156 |
+ |
TH1F *ofstart = (TH1*)OFobj->Clone(); |
6157 |
+ |
TH1F *obs, *pred; |
6158 |
+ |
MakeObservationPrediction(obs,pred,sfstart,ofstart); |
6159 |
+ |
|
6160 |
+ |
if ( !hratio ) { |
6161 |
+ |
hratio = (TH1*)obj->Clone(); |
6162 |
+ |
hratio->SetName("hratio"); |
6163 |
+ |
} else hratio->Add( (TH1*)obj ); |
6164 |
+ |
|
6165 |
+ |
} |
6166 |
+ |
hratio->Divide(hdata); |
6167 |
+ |
*/ |
6168 |
+ |
|
6169 |
+ |
|
6170 |
+ |
can->cd(4); |
6171 |
+ |
JZBdistOF.Draw("histo"); |
6172 |
+ |
DrawMCPrelim(); |
6173 |
+ |
|
6174 |
+ |
|
6175 |
+ |
|
6176 |
+ |
CompleteSave(can,"Systematics/TtbarTests/ControlRegion"); |
6177 |
+ |
|
6178 |
+ |
CleanLegends(); |
6179 |
+ |
delete can; |
6180 |
+ |
} |
6181 |
+ |
|
6182 |
+ |
void ttbar_tests(string mcjzb) { |
6183 |
+ |
//ttbar_correction_tests(); |
6184 |
+ |
ttbar_region_search(mcjzb); |
6185 |
+ |
} |
6186 |
+ |
|
6187 |
+ |
Value GetYieldBetween(TH1F *h, float low, float high) { |
6188 |
+ |
float Yield=0; |
6189 |
+ |
float YieldErr=0; |
6190 |
+ |
for(int i=1;i<=h->GetNbinsX()+1;i++) { |
6191 |
+ |
if(h->GetBinLowEdge(i)+h->GetBinWidth(i)<=low) continue;// considered in the next bin |
6192 |
+ |
if(h->GetBinLowEdge(i)>=high) continue;//above the threshold, out! |
6193 |
+ |
Yield+=h->GetBinContent(i); |
6194 |
+ |
YieldErr=sqrt(YieldErr*YieldErr+h->GetBinError(i)*h->GetBinError(i)); |
6195 |
+ |
} |
6196 |
+ |
|
6197 |
+ |
Value a(Yield,YieldErr); |
6198 |
+ |
return a; |
6199 |
+ |
} |
6200 |
+ |
|
6201 |
+ |
|
6202 |
+ |
void make_SF_over_OF_plot(string datajzb, string mcjzb, TCut cut, string variable, int nbins, float xmin, float ymin, string varname, string filename) { |
6203 |
+ |
TCanvas *SFoOF_can = new TCanvas("SFoOF_can","SFoOF_can"); |
6204 |
+ |
TH1F *data_sf = allsamples.Draw("data_sf","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSSF,data,luminosity); |
6205 |
+ |
TH1F *data_of = allsamples.Draw("data_of","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSOF,data,luminosity); |
6206 |
+ |
|
6207 |
+ |
TH1F *mc_sf = allsamples.Draw("mc_sf","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSSF,mc,luminosity); |
6208 |
+ |
TH1F *mc_of = allsamples.Draw("mc_of","mll",20,0,200, "m_{ll} [GeV]", "events", cut&&cutOSOF,mc,luminosity); |
6209 |
+ |
|
6210 |
+ |
TH1F *mc_ratio = (TH1F*)mc_sf->Clone("mc_ratio"); |
6211 |
+ |
mc_ratio->Divide(mc_of); |
6212 |
+ |
|
6213 |
+ |
TH1F *data_ratio = (TH1F*)data_sf->Clone("data_ratio"); |
6214 |
+ |
data_ratio->Divide(data_of); |
6215 |
+ |
|
6216 |
+ |
mc_ratio->SetFillColor(TColor::GetColor("#00ADE1")); |
6217 |
+ |
mc_ratio->SetMarkerColor(TColor::GetColor("#00ADE1")); |
6218 |
+ |
mc_ratio->GetYaxis()->SetRangeUser(0.5,1.5); |
6219 |
+ |
|
6220 |
+ |
mc_ratio->GetYaxis()->SetTitle("R(SF / OF)"); |
6221 |
+ |
|
6222 |
+ |
|
6223 |
+ |
Value R_sf_of_low_mass = GetYieldBetween(data_sf,20,70)/GetYieldBetween(data_of,20,70); |
6224 |
+ |
Value R_sf_of_high_mass = GetYieldBetween(data_sf,120,200)/GetYieldBetween(data_of,120,200); |
6225 |
+ |
|
6226 |
+ |
Value R_sf_of_low_mass_mc = GetYieldBetween(mc_sf,20,70)/GetYieldBetween(mc_of,20,70); |
6227 |
+ |
Value R_sf_of_high_mass_mc = GetYieldBetween(mc_sf,120,200)/GetYieldBetween(mc_of,120,200); |
6228 |
+ |
|
6229 |
+ |
dout << "Ratio at low mass : " << R_sf_of_low_mass << " (mc : " << R_sf_of_low_mass_mc << " )" << endl; |
6230 |
+ |
dout << "Ratio at high mass : " << R_sf_of_high_mass << " (mc : " << R_sf_of_high_mass_mc << " )" << endl; |
6231 |
+ |
|
6232 |
+ |
TGraphAsymmErrors *gra = produce_ratio_graph(mc_ratio); |
6233 |
+ |
gra->Draw(); |
6234 |
+ |
mc_ratio->Draw(); |
6235 |
+ |
gra->Draw("e20"); |
6236 |
+ |
gra->SetFillColor(TColor::GetColor("#00ADE1")); |
6237 |
+ |
gra->SetMarkerColor(TColor::GetColor("#00ADE1")); |
6238 |
+ |
data_ratio->Draw("e1,same"); |
6239 |
+ |
|
6240 |
+ |
TLegend *leg = new TLegend(0.17,0.16,0.53,0.31); |
6241 |
+ |
// leg->SetHeader("R( SF / OF )"); |
6242 |
+ |
leg->SetFillColor(kWhite); |
6243 |
+ |
leg->SetBorderSize(0); |
6244 |
+ |
leg->AddEntry(data_ratio,"Data","p"); |
6245 |
+ |
leg->AddEntry(gra,"MC","fp"); |
6246 |
+ |
leg->Draw(); |
6247 |
+ |
|
6248 |
+ |
TLine *g = new TLine(0,1.0,200,1.0); |
6249 |
+ |
g->SetLineColor(kBlue); |
6250 |
+ |
g->Draw(); |
6251 |
+ |
|
6252 |
+ |
TLine *l = new TLine(70,0.5,70,1.5); |
6253 |
+ |
l->SetLineStyle(2); |
6254 |
+ |
l->SetLineColor(TColor::GetColor("#00ADE1")); |
6255 |
+ |
TLine *m = new TLine(120,0.5,120,1.5); |
6256 |
+ |
m->SetLineStyle(2); |
6257 |
+ |
m->SetLineColor(TColor::GetColor("#00ADE1")); |
6258 |
+ |
l->Draw(); |
6259 |
+ |
m->Draw(); |
6260 |
+ |
|
6261 |
+ |
|
6262 |
+ |
DrawPrelim(); |
6263 |
+ |
|
6264 |
+ |
CompleteSave(SFoOF_can,"iTTbar/"+filename+"SF_vs_OF"); |
6265 |
+ |
|
6266 |
+ |
delete leg; |
6267 |
+ |
delete mc_sf; |
6268 |
+ |
delete mc_of; |
6269 |
+ |
delete mc_ratio; |
6270 |
+ |
delete data_sf; |
6271 |
+ |
delete data_of; |
6272 |
+ |
delete data_ratio; |
6273 |
+ |
delete SFoOF_can; |
6274 |
+ |
} |
6275 |
+ |
|
6276 |
+ |
void make_iTTbar_JZB_plot(string datajzb, string mcjzb, TCut cut) { |
6277 |
+ |
TCanvas *can = new TCanvas("can","can"); |
6278 |
+ |
vector<float> binning; |
6279 |
+ |
binning.push_back(-100); |
6280 |
+ |
binning.push_back(-50); |
6281 |
+ |
binning.push_back(-20); |
6282 |
+ |
binning.push_back(0); |
6283 |
+ |
// binning.push_back(10); |
6284 |
+ |
binning.push_back(20); |
6285 |
+ |
// binning.push_back(30); |
6286 |
+ |
binning.push_back(50); |
6287 |
+ |
binning.push_back(100); |
6288 |
+ |
binning.push_back(300); |
6289 |
+ |
|
6290 |
+ |
TH1F *hdata = allsamples.Draw("hdata", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSSF,data,luminosity); |
6291 |
+ |
TH1F *hodata = allsamples.Draw("hodata", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSOF,data,luminosity); |
6292 |
+ |
TH1F *hndata = allsamples.Draw("hndata", "-"+datajzb,binning, "JZB [GeV]", "events", cut&&cutOSSF,data,luminosity); |
6293 |
+ |
TH1F *hnodata = allsamples.Draw("hnodata","-"+datajzb,binning, "JZB [GeV]", "events", cut&&cutOSOF,data,luminosity); |
6294 |
+ |
|
6295 |
+ |
TH1F *hmc = allsamples.Draw("hmc", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSSF,mc,luminosity); |
6296 |
+ |
TH1F *homc = allsamples.Draw("homc", datajzb, binning, "JZB [GeV]", "events", cut&&cutOSOF,mc,luminosity); |
6297 |
+ |
|
6298 |
+ |
hodata->SetLineColor(kRed); |
6299 |
+ |
hmc->SetLineColor(kRed); |
6300 |
+ |
// hodata->Add(hndata); |
6301 |
+ |
// hodata->Add(hnodata,-1); |
6302 |
+ |
|
6303 |
+ |
if(hdata->GetMaximum()>hodata->GetMaximum()) { |
6304 |
+ |
hdata->SetMinimum(1.0); |
6305 |
+ |
hdata->Draw(); |
6306 |
+ |
hodata->Draw("histo,same"); |
6307 |
+ |
hdata->Draw("same"); |
6308 |
+ |
} else { |
6309 |
+ |
hodata->SetMinimum(1.0); |
6310 |
+ |
hodata->Draw("histo"); |
6311 |
+ |
hdata->Draw("same"); |
6312 |
+ |
} |
6313 |
+ |
|
6314 |
+ |
CompleteSave(can,"iTTbar/JZB_plot"); |
6315 |
+ |
TH1F *ratio = (TH1F*)hdata->Clone("ratio"); |
6316 |
+ |
ratio->Divide(hodata); |
6317 |
+ |
ratio->GetYaxis()->SetTitle("obs/pred"); |
6318 |
+ |
ratio->GetYaxis()->SetRangeUser(0,2); |
6319 |
+ |
|
6320 |
+ |
ratio->Draw(); |
6321 |
+ |
TLine *l = new TLine(-100,1.0,300,1.0); |
6322 |
+ |
l->SetLineColor(kBlue); |
6323 |
+ |
l->SetLineStyle(2); |
6324 |
+ |
l->Draw(); |
6325 |
+ |
TLine *llow = new TLine(-100,1.0-0.07,300,1.0-0.07); |
6326 |
+ |
TLine *lhi = new TLine(-100,1.0+0.07,300,1.0+0.07); |
6327 |
+ |
llow->SetLineColor(kBlue); |
6328 |
+ |
llow->SetLineStyle(2); |
6329 |
+ |
llow->Draw(); |
6330 |
+ |
lhi->SetLineColor(kBlue); |
6331 |
+ |
lhi->SetLineStyle(2); |
6332 |
+ |
lhi->Draw(); |
6333 |
+ |
|
6334 |
+ |
CompleteSave(can,"iTTbar/JZB_plot_ratio"); |
6335 |
+ |
|
6336 |
+ |
delete hdata; |
6337 |
+ |
delete hodata; |
6338 |
+ |
delete ratio; |
6339 |
+ |
delete can; |
6340 |
+ |
// THStack *hmc = new THStack(allsamples.DrawStack("hmc","mll",40,0,200, "m_{ll} [GeV]", "events", cut&&cutOSSF,mc,luminosity)); |
6341 |
+ |
// THStack *homc = new THStack(allsamples.DrawStack("homc","mll",40,0,200, "m_{ll} [GeV]", "events", cut&&cutOSOF,mc,luminosity)); |
6342 |
+ |
} |
6343 |
+ |
|
6344 |
+ |
|
6345 |
+ |
|
6346 |
+ |
void MakeSpecialiTTbarClosurePlot(TCut fullcut, string datajzb, string mcjzb, string MassRegion) { |
6347 |
+ |
TCanvas *iTTbarClosureTestCanvas = new TCanvas("iTTbarClosureTestCanvas","iTTbarClosureTestCanvas"); |
6348 |
+ |
|
6349 |
+ |
vector<float> binning; |
6350 |
+ |
/* |
6351 |
+ |
binning.push_back(0); |
6352 |
+ |
binning.push_back(20); |
6353 |
+ |
binning.push_back(50); |
6354 |
+ |
binning.push_back(100); |
6355 |
+ |
// binning.push_back(200); |
6356 |
+ |
*/ |
6357 |
+ |
binning.push_back(0); |
6358 |
+ |
binning.push_back(10); |
6359 |
+ |
binning.push_back(30); |
6360 |
+ |
binning.push_back(50); |
6361 |
+ |
binning.push_back(100); |
6362 |
+ |
// binning.push_back(200); |
6363 |
+ |
|
6364 |
+ |
|
6365 |
+ |
TH1F *hdata = allsamples.Draw("hdata", datajzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1==id2"),data,luminosity); |
6366 |
+ |
TH1F *hodata = allsamples.Draw("hodata",datajzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1!=id2"),data,luminosity); |
6367 |
+ |
TH1F *hmc = allsamples.Draw("hmc", mcjzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1==id2"),mc,luminosity); |
6368 |
+ |
TH1F *homc = allsamples.Draw("homc", mcjzb,binning, "JZB [GeV]", "events", fullcut&&TCut("id1!=id2"),mc,luminosity); |
6369 |
+ |
|
6370 |
+ |
hdata->SetLineColor(kBlack); |
6371 |
+ |
hmc->SetLineColor(kBlack); |
6372 |
+ |
hodata->SetLineColor(kRed); |
6373 |
+ |
homc->SetLineColor(kRed); |
6374 |
+ |
hodata->SetMarkerColor(kRed); |
6375 |
+ |
|
6376 |
+ |
hdata->GetYaxis()->SetTitle("events"); |
6377 |
+ |
|
6378 |
+ |
float maximum=hdata->GetMaximum()+1.2*sqrt(hdata->GetMaximum()); |
6379 |
+ |
float minimum=hdata->GetMinimum()-1.2*sqrt(hdata->GetMinimum()); |
6380 |
+ |
if(hmc->GetMinimum()<minimum) minimum=hmc->GetMinimum()-1.2*sqrt(hmc->GetMinimum()); |
6381 |
+ |
if(hmc->GetMaximum()>maximum) maximum=hmc->GetMaximum()+1.2*sqrt(hmc->GetMaximum()); |
6382 |
+ |
if(homc->GetMinimum()<minimum) minimum=homc->GetMinimum()-1.2*sqrt(homc->GetMinimum()); |
6383 |
+ |
if(homc->GetMaximum()>maximum) maximum=homc->GetMaximum()+1.2*sqrt(homc->GetMaximum()); |
6384 |
+ |
if(hodata->GetMinimum()<minimum) minimum=hodata->GetMinimum()-1.2*sqrt(hodata->GetMinimum()); |
6385 |
+ |
if(hodata->GetMaximum()>maximum) maximum=hodata->GetMaximum()+1.2*sqrt(hodata->GetMaximum()); |
6386 |
+ |
|
6387 |
+ |
hdata->SetMaximum(maximum); |
6388 |
+ |
hdata->SetMinimum(minimum); |
6389 |
+ |
|
6390 |
+ |
|
6391 |
+ |
hdata->Draw(); |
6392 |
+ |
hmc->Draw("same,histo"); |
6393 |
+ |
homc->Draw("same,histo"); |
6394 |
+ |
hdata->Draw("same"); |
6395 |
+ |
hodata->Draw("same"); |
6396 |
+ |
|
6397 |
+ |
TLegend *leg = make_legend(); |
6398 |
+ |
leg->AddEntry(hdata,"SF data","pe"); |
6399 |
+ |
leg->AddEntry(hodata,"OF data","pe"); |
6400 |
+ |
leg->AddEntry(hmc,"SF MC","l"); |
6401 |
+ |
leg->AddEntry(homc,"OF MC","l"); |
6402 |
+ |
leg->Draw(); |
6403 |
+ |
|
6404 |
+ |
DrawPrelim(); |
6405 |
+ |
|
6406 |
+ |
CompleteSave(iTTbarClosureTestCanvas,"iTTbar/TTbar_CR_Closure_"+MassRegion); |
6407 |
+ |
|
6408 |
+ |
TH1F *ratio_data = (TH1F*)hdata->Clone("ratio_data"); |
6409 |
+ |
ratio_data->Divide(hodata); |
6410 |
+ |
TH1F *ratio_mc = (TH1F*)hmc->Clone("ratio_mc"); |
6411 |
+ |
ratio_mc->Divide(homc); |
6412 |
+ |
|
6413 |
+ |
ratio_mc->SetFillColor(kBlue); |
6414 |
+ |
ratio_mc->SetMarkerSize(0); |
6415 |
+ |
|
6416 |
+ |
TGraphAsymmErrors *eratio = produce_ratio_graph(ratio_mc); |
6417 |
+ |
|
6418 |
+ |
eratio->SetFillColor(TColor::GetColor("#00ADE1")); |
6419 |
+ |
ratio_data->GetYaxis()->SetRangeUser(0.5,1.5); |
6420 |
+ |
ratio_data->Draw("e1"); |
6421 |
+ |
eratio->Draw("20"); |
6422 |
+ |
ratio_data->Draw("e1,same"); |
6423 |
+ |
|
6424 |
+ |
TLegend *leg2 = make_legend(); |
6425 |
+ |
leg2->AddEntry(ratio_data,"R(SF/OF) in #bar{t}t CR, data","pe"); |
6426 |
+ |
leg2->AddEntry(eratio ,"R(SF/OF) in #bar{t}t CR, MC" ,"f"); |
6427 |
+ |
leg2->SetY1(0.8); |
6428 |
+ |
leg2->SetX1(0.45); |
6429 |
+ |
leg2->Draw(); |
6430 |
+ |
|
6431 |
+ |
DrawPrelim(); |
6432 |
+ |
CompleteSave(iTTbarClosureTestCanvas,"iTTbar/TTbar_CR_Closure_Ratio_"+MassRegion); |
6433 |
+ |
|
6434 |
+ |
TFile *f = new TFile("fout.root","RECREATE"); |
6435 |
+ |
eratio->Write(); |
6436 |
+ |
ratio_data->Write(); |
6437 |
+ |
leg2->Write(); |
6438 |
+ |
f->Close(); |
6439 |
+ |
|
6440 |
+ |
|
6441 |
+ |
delete leg; |
6442 |
+ |
delete leg2; |
6443 |
+ |
delete ratio_data; |
6444 |
+ |
delete ratio_mc; |
6445 |
+ |
delete hdata; |
6446 |
+ |
delete hmc; |
6447 |
+ |
delete hodata; |
6448 |
+ |
delete iTTbarClosureTestCanvas; |
6449 |
+ |
} |
6450 |
+ |
|
6451 |
+ |
|
6452 |
+ |
|
6453 |
+ |
void make_ijzb_ttbar_closure_test(string datajzb, string mcjzb) { |
6454 |
+ |
TCut tt_nJets("pfJetGoodNum40==2"); |
6455 |
+ |
TCut tt_bJet("pfJetGoodNumBtag40==2 && met[4]>10"); |
6456 |
+ |
TCut tt_LowMass("mll>20&&mll<70"); |
6457 |
+ |
TCut tt_HighMass("mll>120&&mll<200"); |
6458 |
+ |
TCut tt_noZ(tt_LowMass || tt_HighMass); |
6459 |
+ |
|
6460 |
+ |
/* |
6461 |
+ |
make_iTTbar_JZB_plot(datajzb, mcjzb,tt_nJets&&tt_bJet&&tt_noZ); |
6462 |
+ |
*/ |
6463 |
+ |
TCanvas *can = new TCanvas("can","can"); |
6464 |
+ |
|
6465 |
+ |
TH1F *hdata = allsamples.Draw( "hdata", "mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF,data,luminosity); |
6466 |
+ |
THStack *hmc = new THStack( allsamples.DrawStack( "hmc", "mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF,mc, luminosity)); |
6467 |
+ |
TH1F *hodata = allsamples.Draw( "hodata","mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF,data,luminosity); |
6468 |
+ |
THStack *homc = new THStack( allsamples.DrawStack( "homc", "mll",40,0,200, "m_{ll} [GeV]", "events", tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF,mc, luminosity)); |
6469 |
+ |
|
6470 |
+ |
TH1F *coll_hmc = CollapseStack(hmc); |
6471 |
+ |
TH1F *coll_homc = CollapseStack(homc); |
6472 |
+ |
|
6473 |
+ |
bool dolog=true; |
6474 |
+ |
bool nolog=false; |
6475 |
+ |
|
6476 |
+ |
dout << " SF: " << endl; |
6477 |
+ |
dout << " Data : " << hdata->Integral() << endl; |
6478 |
+ |
WriteYield(hmc, 0, 10000); |
6479 |
+ |
dout << " OF: " << endl; |
6480 |
+ |
dout << " Data : " << hodata->Integral() << endl; |
6481 |
+ |
WriteYield(homc, 0, 10000); |
6482 |
+ |
hodata->SetLineColor(kRed); |
6483 |
+ |
hdata->Draw(); |
6484 |
+ |
hmc->Draw("histo,same"); |
6485 |
+ |
hodata->Draw("histo,same"); |
6486 |
+ |
hdata->Draw("e1,same"); |
6487 |
+ |
DrawPrelim(); |
6488 |
+ |
CompleteSave(can,"TestingPrediction"); |
6489 |
+ |
|
6490 |
+ |
dout << "We get an expected ratio of " << coll_hmc->Integral()/coll_homc->Integral() << endl; |
6491 |
+ |
dout << "In data we find " << hdata->Integral()/hodata->Integral() << endl; |
6492 |
+ |
|
6493 |
+ |
Value R_sf_of_low_mass = GetYieldBetween(hdata,20,70)/GetYieldBetween(hodata,20,70); |
6494 |
+ |
Value R_sf_of_high_mass = GetYieldBetween(hdata,120,200)/GetYieldBetween(hodata,120,200); |
6495 |
+ |
|
6496 |
+ |
Value R_sf_of_low_mass_mc = GetYieldBetween(coll_hmc,20,70)/GetYieldBetween(coll_homc,20,70); |
6497 |
+ |
Value R_sf_of_high_mass_mc = GetYieldBetween(coll_hmc,120,200)/GetYieldBetween(coll_homc,120,200); |
6498 |
+ |
|
6499 |
+ |
dout << "Ratio at low mass : " << R_sf_of_low_mass << " (mc : " << R_sf_of_low_mass_mc << " )" << endl; |
6500 |
+ |
dout << "Ratio at high mass : " << R_sf_of_high_mass << " (mc : " << R_sf_of_high_mass_mc << " )" << endl; |
6501 |
+ |
|
6502 |
+ |
dout << "Composition at low mass : " << endl; |
6503 |
+ |
dout << "Same flavor: " << endl; |
6504 |
+ |
ProduceYields(20, 70, hdata, hmc); |
6505 |
+ |
dout << "Opposite flavor: " << endl; |
6506 |
+ |
ProduceYields(20, 70, hodata, homc); |
6507 |
+ |
|
6508 |
+ |
dout << endl << endl; |
6509 |
+ |
|
6510 |
+ |
dout << "Composition at high mass : " << endl; |
6511 |
+ |
dout << "Same flavor: " << endl; |
6512 |
+ |
ProduceYields(120, 200, hdata, hmc); |
6513 |
+ |
dout << "Opposite flavor: " << endl; |
6514 |
+ |
ProduceYields(120, 200, hodata, homc); |
6515 |
+ |
|
6516 |
+ |
|
6517 |
+ |
|
6518 |
+ |
|
6519 |
+ |
make_plain_kin_plot(mcjzb,(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF),20,-200,200,dolog,"JZB","iTTbar/JZB_SF",false,true); |
6520 |
+ |
make_plain_kin_plot(mcjzb,(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF),20,-200,200,dolog,"JZB","iTTbar/JZB_OF",false,true); |
6521 |
+ |
|
6522 |
+ |
make_plain_kin_plot("mll",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF),40,0,200,nolog,"m_{ll} [GeV]","iTTbar/mll_SF",false,true); |
6523 |
+ |
make_plain_kin_plot("mll",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF),40,0,200,nolog,"m_{ll} [GeV]","iTTbar/mll_OF",false,true); |
6524 |
+ |
|
6525 |
+ |
make_SF_over_OF_plot(datajzb, mcjzb,tt_nJets&&tt_bJet&&tt_noZ,"mll",20,0,200,"m_{ll} [GeV]","mll"); |
6526 |
+ |
|
6527 |
+ |
MakeSpecialiTTbarClosurePlot((tt_nJets&&tt_bJet&&tt_LowMass),datajzb,mcjzb,"LowMassRegion2070"); |
6528 |
+ |
MakeSpecialiTTbarClosurePlot((tt_nJets&&tt_bJet&&tt_HighMass),datajzb,mcjzb,"HighMassRegion"); |
6529 |
+ |
MakeSpecialiTTbarClosurePlot((tt_nJets&&tt_bJet&&tt_noZ),datajzb,mcjzb,"NoZ"); |
6530 |
+ |
|
6531 |
+ |
// make_plain_kin_plot("pfJetGoodNum40",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF),10,-0.5,9.5,dolog,"n_{jets}","iTTbar/nJets_SF",false,true); |
6532 |
+ |
// make_plain_kin_plot("pfJetGoodNum40",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF),10,-0.5,9.5,dolog,"n_{jets}","iTTbar/nJets_OF",false,true); |
6533 |
+ |
// |
6534 |
+ |
// make_plain_kin_plot("pfJetGoodNumBtag40",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSSF),10,-0.5,9.5,dolog,"n_{btags}","iTTbar/nBtags_SF",false,true); |
6535 |
+ |
// make_plain_kin_plot("pfJetGoodNumBtag40",(const char*) (tt_nJets&&tt_bJet&&tt_noZ&&cutOSOF),10,-0.5,9.5,dolog,"n_{btags}","iTTbar/nBtags_OF",false,true); |
6536 |
+ |
|
6537 |
+ |
|
6538 |
+ |
delete coll_hmc; |
6539 |
+ |
delete coll_homc; |
6540 |
+ |
delete hmc; |
6541 |
+ |
delete homc; |
6542 |
+ |
delete hdata; |
6543 |
+ |
delete hodata; |
6544 |
+ |
delete can; |
6545 |
+ |
} |
6546 |
+ |
|
6547 |
+ |
void compute_global_significance(float local_significance) { |
6548 |
+ |
float global_sigificance = ROOT::Math::normal_quantile_c(ROOT::Math::normal_cdf_c(local_significance,1)*4,1); |
6549 |
+ |
dout << "local significance : " << local_significance << endl; |
6550 |
+ |
dout << "global significance : " << global_sigificance << endl; |
6551 |
+ |
} |
6552 |
+ |
|
6553 |
|
|
6554 |
|
void test() { |
6555 |
|
|
6556 |
+ |
|
6557 |
+ |
float MCPeak, MCPeakError, DataPeak, DataPeakError; |
6558 |
+ |
stringstream result, datajzb, mcjzb; |
6559 |
+ |
bool doPUreweighting=true; |
6560 |
+ |
bool SwitchOffNJetsCut=false; |
6561 |
+ |
|
6562 |
+ |
|
6563 |
+ |
TCanvas *can = new TCanvas("can","can"); |
6564 |
+ |
float mcSigma,mcSigmaError,dataSigma,dataSigmaError; |
6565 |
+ |
|
6566 |
+ |
float NumVtxBin[6] = {0,5,10,15,20,30}; |
6567 |
+ |
|
6568 |
+ |
stringstream NowCut; |
6569 |
+ |
|
6570 |
+ |
TGraphErrors *gMCPeak = new TGraphErrors(); |
6571 |
+ |
gMCPeak->SetTitle("gMCPeak"); |
6572 |
+ |
gMCPeak->SetName("gMCPeak"); |
6573 |
+ |
TGraphErrors *gDataPeak = new TGraphErrors(); |
6574 |
+ |
gDataPeak->SetTitle("gDataPeak"); |
6575 |
+ |
gDataPeak->SetName("gDataPeak"); |
6576 |
+ |
TGraphErrors *gMCWidth = new TGraphErrors(); |
6577 |
+ |
gMCWidth->SetTitle("gMCWidth"); |
6578 |
+ |
gMCWidth->SetName("gMCWidth"); |
6579 |
+ |
TGraphErrors *gDataWidth = new TGraphErrors(); |
6580 |
+ |
gDataWidth->SetTitle("gDataWidth"); |
6581 |
+ |
gDataWidth->SetName("gDataWidth"); |
6582 |
+ |
|
6583 |
+ |
float AllMCPeaks[200]; |
6584 |
+ |
float AllMCPeaksErrors[200]; |
6585 |
+ |
|
6586 |
+ |
for(int i=10;i<180;i+=20) { |
6587 |
+ |
NowCut.str(""); |
6588 |
+ |
NowCut << "mll>=" << i << "&&mll<" << i+20; |
6589 |
+ |
find_one_peak_combination(TCut(NowCut.str().c_str()),SwitchOffNJetsCut,MCPeak,MCPeakError, DataPeak,DataPeakError,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
6590 |
+ |
AllMCPeaks[i]=MCPeak; |
6591 |
+ |
AllMCPeaksErrors[i]=MCPeakError; |
6592 |
+ |
} |
6593 |
+ |
|
6594 |
+ |
dout << "Summary : " << endl; |
6595 |
+ |
for(int i=10;i<180;i+=20) { |
6596 |
+ |
dout << "For the slice at [" << i << " , " << i+20 << "] we get a peak at " << AllMCPeaks[i] << " +/- " << AllMCPeaksErrors[i] << endl; |
6597 |
+ |
} |
6598 |
+ |
/* |
6599 |
|
TCanvas *testcanv = new TCanvas("testcanv","testcanv"); |
6600 |
|
testcanv->cd(); |
6601 |
|
// switch_overunderflow(true); |
6602 |
< |
TH1F *ptdistr = allsamples.Draw("ptdistr","pt1",100,30,200, "p_{T} [GeV]", "events", cutOSSF,data,luminosity); |
6603 |
< |
switch_overunderflow(false); |
6604 |
< |
ptdistr->Draw(); |
6605 |
< |
testcanv->SaveAs("test.png"); |
6606 |
< |
dout << "HELLO there!" << endl; |
6602 |
> |
TH1F *histo1 = new TH1F("histo","histo",100,0,1); |
6603 |
> |
histo1->Sumw2(); |
6604 |
> |
TH1F *histo2 = new TH1F("histo2","histo2",100,0,1); |
6605 |
> |
histo2->Sumw2(); |
6606 |
> |
|
6607 |
> |
for(int i=0;i<100;i++) { |
6608 |
> |
histo1->Fill(1.0/i,i); |
6609 |
> |
histo2->Fill(1.0/(i*i),i); |
6610 |
> |
} |
6611 |
> |
|
6612 |
> |
histo1->Draw(); |
6613 |
> |
histo2->Draw("e1,same"); |
6614 |
|
|
6615 |
+ |
Save_With_Ratio( histo1, histo2, testcanv->cd(), "Bullshit", false, false, "AnyCrap" ); |
6616 |
+ |
|
6617 |
+ |
|
6618 |
+ |
dout << "HELLO there!" << endl; |
6619 |
+ |
*/ |
6620 |
|
} |