23 |
|
void todo() { |
24 |
|
dout << "My to do list: " << endl; |
25 |
|
dout << " - ExperimentalModule::Poisson_ratio_plot : Get the second part to work!" << endl; |
26 |
+ |
dout << " - compare_onpeak_offpeak_signal_distributions: Implement this function ... " << endl; |
27 |
|
dout << "Info : The trigger requirement is currently set to " << (const char*) passtrig << endl; |
28 |
+ |
dout << "Info : The pt requirement is currently set to " << (const char*) passtrig << endl; |
29 |
+ |
dout << "Info : The mll requirement is currently set to " << (const char*) cutmass << endl; |
30 |
+ |
dout << "Info : The lepton requirement is currently set to " << (const char*) leptoncut << endl; |
31 |
+ |
dout << "Info : The weight applied to all MC is " << (const char*) cutWeight << endl; |
32 |
|
} |
33 |
|
|
34 |
< |
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &DataSigma, stringstream &result, bool doPUreweighting = true ) |
34 |
> |
|
35 |
> |
|
36 |
> |
void find_one_peak_combination(TCut specialcut, float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, float &MCSigma, float &MCSigmaError, float &DataSigma, float& DataSigmaError, stringstream &result, bool doPUreweighting = true, string saveas="") |
37 |
|
{ |
38 |
|
// Temporarily switch off PU reweighting, if asked |
39 |
|
TCut weightbackup=cutWeight; |
40 |
|
if ( !doPUreweighting ) cutWeight="1.0"; |
41 |
< |
|
41 |
> |
|
42 |
> |
int nbins=100; |
43 |
> |
if(PlottingSetup::DoBTag) nbins=25; |
44 |
> |
|
45 |
|
TCanvas *tempcan = new TCanvas("tempcan","Temporary canvas for peak finding preparations"); |
46 |
< |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,mc, luminosity); |
47 |
< |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data, luminosity); |
48 |
< |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,100,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,mc, luminosity); |
49 |
< |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,100, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data, luminosity); |
46 |
> |
TH1F *rawJZBeemmMC = allsamples.Draw("rawJZBeemmMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&specialcut,mc, luminosity); |
47 |
> |
TH1F *rawJZBeemmData = allsamples.Draw("rawJZBeemmData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&specialcut,data, luminosity); |
48 |
> |
TH1F *rawJZBemMC = allsamples.Draw("rawJZBemMC",jzbvariablemc,nbins,-50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&specialcut,mc, luminosity); |
49 |
> |
TH1F *rawJZBemData = allsamples.Draw("rawJZBemData",jzbvariabledata,nbins, -50,50, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&specialcut,data, luminosity); |
50 |
|
TH1F *rawttbarjzbeemmMC; |
51 |
|
|
52 |
|
if(method==doKM) { |
53 |
|
//we only need this histo for the KM fitting... |
54 |
< |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,100, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample("TTJet")); |
55 |
< |
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
56 |
< |
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
54 |
> |
rawttbarjzbeemmMC = allsamples.Draw("rawttbarjzbeemmMC",jzbvariablemc,nbins, -50,50, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&&specialcut,mc,luminosity,allsamples.FindSample("TTJet")); |
55 |
> |
MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas); |
56 |
> |
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas); |
57 |
> |
delete rawttbarjzbeemmMC; |
58 |
|
} |
59 |
|
else { |
60 |
|
TH1F *reducedMC = (TH1F*)rawJZBeemmMC->Clone(); |
62 |
|
reducedMC->Add(rawJZBemMC,-1); |
63 |
|
reducedData->Add(rawJZBemData,-1); |
64 |
|
//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) |
65 |
< |
MCPeak=find_peak(reducedMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
66 |
< |
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
67 |
< |
|
65 |
> |
MCPeak=find_peak(reducedMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,MCSigmaError,method,saveas); |
66 |
> |
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,DataSigmaError,method,saveas); |
67 |
> |
delete reducedMC; |
68 |
> |
delete reducedData; |
69 |
|
} |
70 |
|
|
71 |
|
// Revert to original PU reweighting |
73 |
|
|
74 |
|
// MCPeak=find_peak(rawJZBeemmMC, rawttbarjzbeemmMC, -40, 40, mc, MCPeakError,MCSigma,method); |
75 |
|
// DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,method); |
76 |
< |
dout << "We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl; |
77 |
< |
result << "We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- ?? (not impl.)" << endl; |
78 |
< |
dout << "We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl; |
79 |
< |
result << "We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- ?? (not impl.)" << endl; |
76 |
> |
dout << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
77 |
> |
result << " We have found the peak in Data at " << DataPeak << " +/- " << DataPeakError << " with sigma=" << DataSigma << " +/- " << DataSigmaError << endl; |
78 |
> |
dout << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
79 |
> |
result << " We have found the peak in MC at " << MCPeak << " +/- " << MCPeakError << " with sigma=" << MCSigma << " +/- " << MCSigmaError << endl; |
80 |
> |
delete rawJZBeemmData; |
81 |
> |
delete rawJZBeemmMC; |
82 |
> |
delete rawJZBemData; |
83 |
> |
delete rawJZBemMC; |
84 |
|
delete tempcan; |
85 |
|
} |
86 |
|
|
87 |
+ |
void find_peaks(float &MCPeak,float &MCPeakError, float &DataPeak, float &DataPeakError, stringstream &result, bool doPUreweighting, stringstream &datajzb, stringstream &mcjzb) |
88 |
+ |
{ |
89 |
+ |
switch_overunderflow(false); |
90 |
+ |
|
91 |
+ |
bool DoInvidualeemmPeaks=false; |
92 |
+ |
|
93 |
+ |
float mcpeak, datapeak; |
94 |
+ |
float mcpeakerr, datapeakerr; |
95 |
+ |
|
96 |
+ |
float mceepeak,mcmmpeak; |
97 |
+ |
float mceepeakerr,mcmmpeakerr; |
98 |
+ |
|
99 |
+ |
float datammpeak,dataeepeak; |
100 |
+ |
float datammpeakerr,dataeepeakerr; |
101 |
+ |
|
102 |
+ |
float mcSigma,mcSigmaError, dataSigma, dataSigmaError; |
103 |
+ |
|
104 |
+ |
dout << "Finding global peak : " << endl; |
105 |
+ |
find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma,mcSigmaError, dataSigma,dataSigmaError,result,doPUreweighting,""); |
106 |
+ |
|
107 |
+ |
if(DoInvidualeemmPeaks) { |
108 |
+ |
dout << "Finding peak for electrons : " << endl; |
109 |
+ |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr,dataeepeak,dataeepeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_ele"); |
110 |
+ |
dout << "Finding peak for muons : " << endl; |
111 |
+ |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr,datammpeak,datammpeakerr,mcSigma,mcSigmaError,dataSigma,dataSigmaError,result,doPUreweighting,"_mu"); |
112 |
+ |
|
113 |
+ |
datajzb << "(" << jzbvariabledata; |
114 |
+ |
mcjzb << "(" << jzbvariablemc; |
115 |
+ |
|
116 |
+ |
if(dataeepeak>0) datajzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
117 |
+ |
else datajzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
118 |
+ |
|
119 |
+ |
if(datammpeak>0) datajzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
120 |
+ |
else datajzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
121 |
+ |
|
122 |
+ |
if(datapeak>0) datajzb << "- (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
123 |
+ |
else datajzb << "+ (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
124 |
+ |
|
125 |
+ |
datajzb << ")"; |
126 |
+ |
|
127 |
+ |
if(mceepeak>0) mcjzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
128 |
+ |
else mcjzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
129 |
+ |
|
130 |
+ |
if(mcmmpeak>0) mcjzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
131 |
+ |
else mcjzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
132 |
+ |
|
133 |
+ |
if(mcpeak>0) mcjzb << "- (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
134 |
+ |
else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
135 |
+ |
|
136 |
+ |
mcjzb << ")"; |
137 |
+ |
} else { |
138 |
+ |
datajzb << "(" << jzbvariabledata; |
139 |
+ |
mcjzb << "(" << jzbvariablemc; |
140 |
+ |
|
141 |
+ |
if(datapeak>0) datajzb << "- " << TMath::Abs(datapeak) << " "; |
142 |
+ |
else datajzb << "+ " << TMath::Abs(datapeak) << " "; |
143 |
+ |
|
144 |
+ |
datajzb << ")"; |
145 |
+ |
|
146 |
+ |
if(mcpeak>0) mcjzb << "- " << TMath::Abs(mcpeak) << " "; |
147 |
+ |
else mcjzb << "+ " << TMath::Abs(mcpeak) << " "; |
148 |
+ |
|
149 |
+ |
mcjzb << ")"; |
150 |
+ |
} |
151 |
+ |
|
152 |
+ |
switch_overunderflow(true); |
153 |
+ |
|
154 |
+ |
} |
155 |
+ |
|
156 |
+ |
void make_special_obs_pred_mll_plot(string datajzb, string mcjzb, float jzbthreshold, float binWidth = 5.0) { |
157 |
+ |
float min=70.0; |
158 |
+ |
float max=115.0; |
159 |
+ |
if(!PlottingSetup::RestrictToMassPeak) { |
160 |
+ |
min=20; |
161 |
+ |
max=300; |
162 |
+ |
} |
163 |
+ |
int nbins=int((max-min)/binWidth); |
164 |
+ |
|
165 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
166 |
+ |
|
167 |
+ |
stringstream largerzeroS; |
168 |
+ |
largerzeroS << "(" << datajzb << ">" << jzbthreshold << ")"; |
169 |
+ |
TCut largerzeroD(largerzeroS.str().c_str()); |
170 |
+ |
|
171 |
+ |
stringstream smallerzeroS; |
172 |
+ |
smallerzeroS << "(" << datajzb << "<-" << jzbthreshold << ")"; |
173 |
+ |
TCut smallerzeroD(smallerzeroS.str().c_str()); |
174 |
+ |
|
175 |
+ |
|
176 |
+ |
stringstream largerzeroMS; |
177 |
+ |
largerzeroMS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
178 |
+ |
TCut largerzeroM(largerzeroMS.str().c_str()); |
179 |
+ |
|
180 |
+ |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroD,data,luminosity); |
181 |
+ |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets&&largerzeroM,mc,luminosity); |
182 |
+ |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&smallerzeroD,data,luminosity); |
183 |
+ |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&largerzeroD,data,luminosity); |
184 |
+ |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&smallerzeroD,data,luminosity); |
185 |
+ |
|
186 |
+ |
TH1F *RcorrJZBSBem; |
187 |
+ |
TH1F *LcorrJZBSBem; |
188 |
+ |
TH1F *RcorrJZBSBeemm; |
189 |
+ |
TH1F *LcorrJZBSBeemm; |
190 |
+ |
|
191 |
+ |
// TH1F *RcorrJZBeemmNoS; |
192 |
+ |
|
193 |
+ |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
194 |
+ |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&largerzeroD,data, luminosity); |
195 |
+ |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets&&smallerzeroD,data, luminosity); |
196 |
+ |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&largerzeroD,data, luminosity); |
197 |
+ |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets&&smallerzeroD,data, luminosity); |
198 |
+ |
} |
199 |
+ |
|
200 |
+ |
// Separate predictions |
201 |
+ |
TH1F* SFN = (TH1F*)LcorrJZBeemm->Clone("SFN"); |
202 |
+ |
TH1F* OFP = (TH1F*)RcorrJZBem->Clone("OFP"); |
203 |
+ |
TH1F* OFN = (TH1F*)LcorrJZBem->Clone("OFN"); |
204 |
+ |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
205 |
+ |
OFP->Scale(1.0/3.0); |
206 |
+ |
OFP->Add(RcorrJZBSBem,1.0/3.); |
207 |
+ |
OFP->Add(RcorrJZBSBeemm,1.0/3.); |
208 |
+ |
OFN->Scale(1.0/3.0); |
209 |
+ |
OFN->Add(LcorrJZBSBem,1.0/3.); |
210 |
+ |
OFN->Add(LcorrJZBSBeemm,1.0/3.); |
211 |
+ |
} |
212 |
+ |
|
213 |
+ |
TH1F* Bpred = (TH1F*)SFN->Clone("Bpred"); |
214 |
+ |
Bpred->Add(OFP); |
215 |
+ |
Bpred->Add(OFN,-1); |
216 |
+ |
Bpred->SetLineColor(kRed); |
217 |
+ |
|
218 |
+ |
RcorrJZBeemm->SetTitleOffset(1.3,"y"); |
219 |
+ |
RcorrJZBeemm->Draw(); |
220 |
+ |
mcRcorrJZBeemm.Draw("same"); |
221 |
+ |
Bpred->Draw("histo,same"); |
222 |
+ |
RcorrJZBeemm->Draw("same"); |
223 |
+ |
|
224 |
+ |
TLegend *leg = allsamples.allbglegend(); |
225 |
+ |
leg->SetX1(0.58); |
226 |
+ |
leg->AddEntry(RcorrJZBeemm,"observed (data)","l"); |
227 |
+ |
leg->AddEntry(Bpred,"predicted (data)","l"); |
228 |
+ |
leg->Draw("same"); |
229 |
+ |
|
230 |
+ |
stringstream saveas; |
231 |
+ |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold; |
232 |
+ |
CompleteSave(ckin,saveas.str()); |
233 |
+ |
|
234 |
+ |
// Draw all predictions overlayed |
235 |
+ |
unsigned int w = gStyle->GetHistLineWidth()+1; // Make line a bit wider, since we dash it |
236 |
+ |
SFN->SetLineColor(kGreen+2); |
237 |
+ |
SFN->SetLineStyle(2); |
238 |
+ |
SFN->SetLineWidth(w); |
239 |
+ |
OFP->SetLineColor(kBlue+2); |
240 |
+ |
OFP->SetLineStyle(2); |
241 |
+ |
OFP->SetLineWidth(w); |
242 |
+ |
OFN->SetLineColor(kMagenta+2); |
243 |
+ |
OFN->SetLineStyle(3); |
244 |
+ |
OFN->SetLineWidth(w); |
245 |
+ |
|
246 |
+ |
RcorrJZBeemm->Draw(); |
247 |
+ |
SFN->Draw("histo,same"); |
248 |
+ |
OFP->Draw("histo,same"); |
249 |
+ |
OFN->Draw("histo,same"); |
250 |
+ |
Bpred->Draw("histo,same"); |
251 |
+ |
RcorrJZBeemm->Draw("same"); |
252 |
+ |
|
253 |
+ |
TLegend *leg2 = make_legend("",0.52,0.7); |
254 |
+ |
leg2->AddEntry(RcorrJZBeemm,"observed (data)","lp"); |
255 |
+ |
leg2->AddEntry(Bpred,"predicted (data)","l"); |
256 |
+ |
leg2->AddEntry(SFN, " SF JZB<0","l"); |
257 |
+ |
leg2->AddEntry(OFN, " OF JZB<0","l"); |
258 |
+ |
leg2->AddEntry(OFP, " OF JZB>0","l"); |
259 |
+ |
leg2->Draw("same"); |
260 |
+ |
|
261 |
+ |
saveas.str(""); |
262 |
+ |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold << "_nomc"; |
263 |
+ |
CompleteSave(ckin,saveas.str()); |
264 |
+ |
|
265 |
+ |
delete RcorrJZBeemm; |
266 |
+ |
delete LcorrJZBeemm; |
267 |
+ |
delete RcorrJZBem; |
268 |
+ |
delete LcorrJZBem; |
269 |
+ |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
270 |
+ |
delete RcorrJZBSBeemm; |
271 |
+ |
delete LcorrJZBSBeemm; |
272 |
+ |
delete RcorrJZBSBem; |
273 |
+ |
delete LcorrJZBSBem; |
274 |
+ |
} |
275 |
+ |
delete Bpred; |
276 |
+ |
delete ckin; |
277 |
+ |
} |
278 |
+ |
|
279 |
|
void make_special_mll_plot(int nbins, float min, float max, bool logscale,string xlabel) { |
280 |
|
|
281 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
310 |
|
TIter next(bgleg->GetListOfPrimitives()); |
311 |
|
TObject* obj; |
312 |
|
// Copy the nice bkgd legend skipping the "data" |
313 |
< |
while ( obj = next() ) |
313 |
> |
while ( (obj = next()) ) |
314 |
|
if ( strcmp(((TLegendEntry*)obj)->GetObject()->GetName(),"datahistoOSSF") ) |
315 |
|
kinleg->GetListOfPrimitives()->Add(obj); |
316 |
|
|
329 |
|
TIter next(hmc.GetHists()); |
330 |
|
TObject* obj; |
331 |
|
TH1* hratio = NULL; |
332 |
< |
while ( obj = next() ) { |
332 |
> |
while ( (obj = next()) ) { |
333 |
|
if ( !hratio ) { |
334 |
|
hratio = (TH1*)obj->Clone(); |
335 |
|
hratio->SetName("hratio"); |
359 |
|
oneline->SetLineWidth(1); |
360 |
|
oneline->Draw("same"); |
361 |
|
} |
362 |
+ |
float make_one_OFSF_plot(string variable, string addcut, string legendTitle, int nbins, float min, float max, float ymax, bool logscale, |
363 |
+ |
string xlabel, string filename, bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.55) { |
364 |
+ |
|
365 |
+ |
TCut ibasiccut=basiccut; |
366 |
+ |
bool draw_separation_lines=false; |
367 |
+ |
|
368 |
+ |
if(addcut != "") ibasiccut = ibasiccut && addcut.c_str(); |
369 |
+ |
|
370 |
+ |
TCut cutSF; |
371 |
+ |
TCut cutOF; |
372 |
+ |
|
373 |
+ |
cutOF = cutOSOF&&cutnJets&&ibasiccut; |
374 |
+ |
cutSF = cutOSSF&&cutnJets&&ibasiccut; |
375 |
+ |
|
376 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
377 |
+ |
ckin->SetLogy(logscale); |
378 |
+ |
TH1F *datahistoSF = allsamples.Draw("datahistoSF",variable,nbins,min,max, xlabel, "events",cutSF,data,luminosity); |
379 |
+ |
TH1F *datahistoOF = allsamples.Draw("datahistoOF",variable,nbins,min,max, xlabel, "events",cutOF,data,luminosity); |
380 |
+ |
string signal("LM3"); |
381 |
+ |
TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
382 |
+ |
int idx = signalsamples.FindSample(signal)[0]; |
383 |
+ |
(signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cutSF); |
384 |
+ |
signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
385 |
+ |
signalhisto->SetLineColor((signalsamples.collection)[idx].samplecolor); |
386 |
+ |
signalhisto->SetLineStyle(2); |
387 |
+ |
datahistoSF->SetMarkerSize(DataMarkerSize); |
388 |
+ |
datahistoOF->SetLineColor(kRed); |
389 |
+ |
|
390 |
+ |
if ( !logscale ) { |
391 |
+ |
datahistoSF->SetMinimum(0); // Defaults |
392 |
+ |
} else { |
393 |
+ |
datahistoSF->SetMinimum(0.5); |
394 |
+ |
} |
395 |
+ |
if (ymax<0) { |
396 |
+ |
if ( logscale ) datahistoSF->SetMaximum(5.3*datahistoSF->GetMaximum()); |
397 |
+ |
else datahistoSF->SetMaximum(1.5*datahistoSF->GetMaximum()); |
398 |
+ |
} else { |
399 |
+ |
datahistoSF->SetMaximum(ymax); |
400 |
+ |
} |
401 |
+ |
|
402 |
+ |
float ymaxSet = datahistoSF->GetMaximum(); |
403 |
+ |
|
404 |
+ |
datahistoSF->GetXaxis()->SetTitle(xlabel.c_str()); |
405 |
+ |
datahistoSF->GetYaxis()->SetTitle("Events"); |
406 |
+ |
datahistoSF->GetXaxis()->CenterTitle(); |
407 |
+ |
datahistoSF->GetYaxis()->CenterTitle(); |
408 |
+ |
|
409 |
+ |
TLegend *mleg = make_legend(legendTitle.c_str(),legendPosition,0.7,false,legendPosition+0.2); |
410 |
+ |
mleg->AddEntry(datahistoSF, "Same-flavor", "PL"); |
411 |
+ |
if (datahistoOF->Integral()>0) { |
412 |
+ |
mleg->AddEntry(datahistoOF, "Opposite-flavor", "L"); |
413 |
+ |
} else { |
414 |
+ |
mleg->AddEntry((TObject*)0, "", ""); |
415 |
+ |
} |
416 |
+ |
mleg->AddEntry(signalhisto, "LM3", "L"); |
417 |
+ |
|
418 |
+ |
datahistoSF->Draw("E1"); |
419 |
+ |
if (datahistoOF->Integral()>0) datahistoOF->Draw("HIST,SAMES"); |
420 |
+ |
signalhisto->Draw("HIST,SAMES"); |
421 |
+ |
mleg->Draw(); |
422 |
+ |
DrawPrelim(); |
423 |
+ |
CompleteSave(ckin, "SFOF/" + filename); |
424 |
+ |
|
425 |
+ |
datahistoSF->Delete(); |
426 |
+ |
datahistoOF->Delete(); |
427 |
+ |
signalhisto->Delete(); |
428 |
+ |
delete mleg; |
429 |
+ |
delete ckin; |
430 |
+ |
|
431 |
+ |
return ymaxSet; |
432 |
+ |
|
433 |
+ |
} |
434 |
+ |
|
435 |
+ |
void make_OFSF_plots(string variable, string addcut, int nbins, float min, float max, bool logscale, string xlabel, string filename, |
436 |
+ |
bool plotratio=true, bool loadlastminmax=false, float legendPosition=0.55) { |
437 |
+ |
|
438 |
+ |
string mllcuts[] = { "mll>20","mll>20&&mll<70", "mll>75&&mll<105", "mll>120" }; |
439 |
+ |
string mllcutname[] = { "m_{ll} > 20 GeV", "20 < m_{ll} < 70 GeV", "75 < m_{ll} < 105 GeV", "m_{ll} > 120 GeV" }; |
440 |
+ |
string plotname[] = {"_all","_low","_peak","_high"}; |
441 |
+ |
float ymax; |
442 |
+ |
for ( int i=0; i<4; ++i ) { |
443 |
+ |
if ( addcut != "" ) mllcuts[i] += "&&"+addcut; |
444 |
+ |
if ( i==0 ) { |
445 |
+ |
ymax = make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, -1, logscale, xlabel, |
446 |
+ |
filename+plotname[i], plotratio, loadlastminmax, legendPosition ); |
447 |
+ |
} else { |
448 |
+ |
make_one_OFSF_plot(variable, mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
449 |
+ |
filename+plotname[i], plotratio, loadlastminmax, legendPosition ); |
450 |
+ |
} |
451 |
+ |
make_one_OFSF_plot(variable, "id1==1&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
452 |
+ |
filename+plotname[i]+"_mm", plotratio, loadlastminmax, legendPosition ); |
453 |
+ |
make_one_OFSF_plot(variable, "id1==0&&id1==id2&&"+mllcuts[i], mllcutname[i], nbins, min, max, ymax, logscale, xlabel, |
454 |
+ |
filename+plotname[i]+"_ee", plotratio, loadlastminmax, legendPosition ); |
455 |
+ |
} |
456 |
+ |
|
457 |
+ |
} |
458 |
+ |
|
459 |
|
|
460 |
|
float lastrange_min=0; |
461 |
|
float lastrange_max=0; |
487 |
|
TCut cut; |
488 |
|
cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut; |
489 |
|
if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut; |
490 |
+ |
if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut; |
491 |
|
if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF; |
492 |
|
if(filename=="mll") { |
493 |
|
cut=cutOSSF&&cutnJets&&ibasiccut; |
499 |
|
draw_separation_lines=true; |
500 |
|
} |
501 |
|
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
502 |
< |
if(filename=="mll_aboveJZB100") cut=cutOSSF&&cutnJets&&ibasiccut; |
502 |
> |
if(Contains(filename,"aboveJZB")) cut=cutOSSF&&cutnJets&&ibasiccut; |
503 |
> |
if(Contains(filename,"mll_ee_above")) cut=cut&&"id1==0"; |
504 |
> |
if(Contains(filename,"mll_mm_above")) cut=cut&&"id1==1"; |
505 |
> |
if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut; |
506 |
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF; |
507 |
|
if(filename=="mll_inclusive_osof") cut=cutOSOF; |
508 |
|
if(filename=="mll_inclusive_ee") cut=cutOSSF&&"id1==0"; |
514 |
|
ckin->SetLogy(logscale); |
515 |
|
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
516 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
517 |
< |
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
517 |
> |
if ( !logscale ) datahisto->SetMinimum(0); // Defaults |
518 |
> |
else datahisto->SetMinimum(0.5); |
519 |
> |
// Custom max. |
520 |
> |
if(variable=="TMath::Abs(pfJetDphiMet[0])") datahisto->SetMaximum(1.5*datahisto->GetMaximum()); |
521 |
|
if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
522 |
|
if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
523 |
< |
if(filename=="mll_inclusive") datahisto->SetMinimum(1); |
523 |
> |
if(filename=="mll_inclusive"||filename=="mll_inclusive_mm"||filename=="mll_inclusive_ee") datahisto->SetMinimum(1); |
524 |
|
if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
525 |
|
if(filename=="mll_osof") datahisto->SetMinimum(9); |
526 |
+ |
if (logscale) datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
527 |
+ |
else datahisto->SetMaximum(1.3*datahisto->GetMaximum()); |
528 |
|
|
529 |
< |
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
216 |
< |
datahisto->Draw("e1"); |
217 |
< |
ckin->Update(); |
529 |
> |
cout << "******** Cut used : " << (const char*) cut << endl; |
530 |
|
if(loadlastminmax) { |
531 |
|
datahisto->SetMinimum(lastrange_min); |
532 |
|
datahisto->SetMaximum(lastrange_max); |
536 |
|
} |
537 |
|
} |
538 |
|
|
539 |
+ |
// Draw signal by hand (for some reason I don't manage to use the sample class: it adds it to the stack!) |
540 |
+ |
string signal("LM3"); |
541 |
+ |
TH1F* signalhisto = new TH1F("signalhisto",signal.c_str(),nbins,min,max); |
542 |
+ |
int idx = signalsamples.FindSample(signal)[0]; |
543 |
+ |
(signalsamples.collection)[idx].events->Project("signalhisto",variable.c_str(),cut); |
544 |
+ |
signalhisto->Scale((signalsamples.collection)[idx].weight*luminosity); |
545 |
+ |
signalhisto->SetLineColor(kOrange); |
546 |
+ |
|
547 |
+ |
THStack mcstack = allsamples.DrawStack("mcstack", variable,nbins,min,max,xlabel,"events",cut,mc,luminosity); |
548 |
+ |
datahisto->Draw("e1"); |
549 |
+ |
ckin->Update(); |
550 |
|
mcstack.Draw("same"); |
551 |
+ |
|
552 |
|
datahisto->Draw("same,e1"); |
553 |
|
TLegend *kinleg = allsamples.allbglegend(); |
554 |
|
kinleg->Draw(); |
591 |
|
kinpad->SetLogy(logscale); |
592 |
|
datahisto->Draw("e1"); |
593 |
|
mcstack.Draw("same"); |
594 |
+ |
signalhisto->Draw("same"); |
595 |
|
datahisto->Draw("same,e1"); |
596 |
|
datahisto->Draw("same,axis"); |
597 |
|
if(RestrictToMassPeak&&draw_separation_lines) { |
599 |
|
upperboundary->Draw("same"); |
600 |
|
} |
601 |
|
|
602 |
+ |
kinleg->AddEntry("signalhisto",signal.c_str(),"l"); |
603 |
|
kinleg->Draw(); |
604 |
|
write_cut->Draw(); |
605 |
|
DrawPrelim(); |
617 |
|
delete ckin; |
618 |
|
} |
619 |
|
|
620 |
< |
|
295 |
< |
void make_JES_plot() { |
620 |
> |
void make_JES_plot(TCut cut, string name) { |
621 |
|
|
622 |
|
int nbins=10; |
623 |
|
float min=-0.5; |
624 |
|
float max = 9.5; |
625 |
|
bool logscale=true; |
626 |
|
string xlabel="nJets"; |
302 |
– |
TCut cut=cutmass&&cutOSSF&&basiccut; |
627 |
|
|
628 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
629 |
|
ckin->SetLogy(logscale); |
630 |
< |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,data,luminosity); |
630 |
> |
TH1F *datahisto = allsamples.Draw("datahisto","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,data,luminosity); |
631 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
632 |
< |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
633 |
< |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum315",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
634 |
< |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum285",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
632 |
> |
THStack mcstack = allsamples.DrawStack("mcstack","pfJetGoodNum40",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
633 |
> |
TH1F *JESup = allsamples.Draw("JESup","pfJetGoodNum40p1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
634 |
> |
TH1F *JESdn = allsamples.Draw("JESdn","pfJetGoodNum40n1sigma",nbins,min,max, xlabel, "events",cut,mc,luminosity); |
635 |
|
|
636 |
|
datahisto->SetMinimum(1); |
637 |
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); // in line with kinematic plots style |
656 |
|
TLegend *kinleg = allsamples.allbglegend(); |
657 |
|
kinleg->AddEntry(JESunc,"JES uncertainty","f"); |
658 |
|
kinleg->Draw(); |
659 |
< |
CompleteSave(ckin,"Systematics/JES"); |
659 |
> |
CompleteSave(ckin,"Systematics/JES"+name); |
660 |
|
datahisto->Delete(); |
661 |
|
delete ckin; |
662 |
|
|
667 |
|
bool dolog=true; |
668 |
|
bool nolog=false; |
669 |
|
if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!"); |
670 |
< |
float mll_low=40; |
670 |
> |
float mll_low=50; |
671 |
|
float mll_hi=160; |
672 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
673 |
< |
mll_low=30; |
674 |
< |
mll_hi=180; |
673 |
> |
mll_low=20; |
674 |
> |
mll_hi=300; |
675 |
|
} |
676 |
+ |
/* |
677 |
+ |
make_OFSF_plots("mll", "met[4]>100", 60, 20., 320., false, "m_{ll}", "mll", false, false); |
678 |
+ |
make_OFSF_plots("pfJetGoodNum40", "met[4]>100", 7, 3, 10, true, "#(jets)", "njets", false, false); |
679 |
+ |
make_OFSF_plots("pt1", "met[4]>100", 30, 0., 300., true, "p_{T,1}", "pt1", false, false); |
680 |
+ |
make_OFSF_plots("pt2", "met[4]>100", 22, 0., 220., true, "p_{T,2}", "pt2", false, false); |
681 |
+ |
make_OFSF_plots("eta1", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{1}", "eta1", false, false, 0.15); |
682 |
+ |
make_OFSF_plots("eta2", "met[4]>100", 10, -2.5, 2.5, false, "#eta_{2}", "eta2", false, false, 0.15); |
683 |
+ |
make_OFSF_plots("phi1", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{1}", "phi1", false, false, 0.2); |
684 |
+ |
make_OFSF_plots("phi2", "met[4]>100", 10, -TMath::Pi(), TMath::Pi(), false, "#phi_{2}", "phi2", false, false, 0.2); |
685 |
+ |
make_OFSF_plots("pfJetGoodPt[0]/pfJetGoodPt[1]", "met[4]>100", 20, 1, 10, true, "pt_{j}^{1}/pt_{j}^{2}", "jpt1pt2", false, false, 0.2); |
686 |
+ |
make_OFSF_plots("TMath::Abs(pfJetDphiMet[0])", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(jet1,MET)|", "dphij1met", false, false, 0.0); |
687 |
+ |
make_OFSF_plots("TMath::Abs(dphi)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,l2)|", "dphi", false, false, 0.2); |
688 |
+ |
make_OFSF_plots("TMath::Abs(dphiMet1)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l1,MET)|", "dphiMet1", false, false, 0.2); |
689 |
+ |
make_OFSF_plots("TMath::Abs(dphiMet2)", "met[4]>100", 16, 0, 3.2, false, "|#Delta#phi(l2,MET)|", "dphiMet2", false, false, 0.2); |
690 |
+ |
make_OFSF_plots("TMath::Min(TMath::Abs(dphiMet1), TMath::Abs(dphiMet2))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(l,MET)|)", "dphilc", false, false, 0.2); |
691 |
+ |
make_OFSF_plots("TMath::Min(TMath::Abs(pfJetDphiMet[0]), TMath::Min(TMath::Abs(pfJetDphiMet[1]), TMath::Abs(pfJetDphiMet[2])))", "met[4]>100", 16, 0, 3.2, false, "Min(|#Delta#phi(jet,MET)|)", "dphijc", false, false, 0.2); |
692 |
+ |
make_OFSF_plots("TMath::Min((TMath::Pi()-TMath::Abs(dphiMet1)), (TMath::Pi() - TMath::Abs(dphiMet2)))", "met[4]>100", 16, 0, 3.2, false, "Min(#pi - |#Delta#phi(l,MET)|)", "dphilco", false, false, 0.2); |
693 |
+ |
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]))))", "met[4]>100", 16, 0, 3.2, false, "Min(#Pi - |#Delta#phi(jet,MET)|)", "dphijco", false, false, 0.2); |
694 |
+ |
|
695 |
+ |
make_kin_plot("met[4]","",70,0,350,dolog,"MET [GeV]","met",doPF,true); |
696 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
697 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
698 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
699 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_mm",doPF,true); |
700 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
701 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
702 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
703 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
704 |
< |
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
361 |
< |
make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
362 |
< |
make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
363 |
< |
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
364 |
< |
make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF); |
365 |
< |
make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF); |
366 |
< |
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF); |
367 |
< |
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF); |
368 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF); |
369 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
700 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
701 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
702 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
703 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/5,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
704 |
> |
make_kin_plot("mll","",(int)((350-mll_low))/5,mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
705 |
|
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
706 |
+ |
|
707 |
+ |
make_kin_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","",45,1,10,dolog,"pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",doPF,true); |
708 |
+ |
make_kin_plot("TMath::Abs(pfJetDphiMet[0])","",32,0,3.2,nolog,"|#Delta#phi(jet1,MET)|","dphiJ1MET",doPF,true); |
709 |
+ |
|
710 |
+ |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
711 |
+ |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
712 |
+ |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
713 |
+ |
|
714 |
+ |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
715 |
+ |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
716 |
+ |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
717 |
+ |
*/ |
718 |
+ |
make_kin_plot("pt","",50,0,500,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
719 |
+ |
make_kin_plot("pt1","",50,0,200,nolog,"p_{T} [GeV]","pt1",doPF); |
720 |
+ |
make_kin_plot("pt2","",50,0,200,nolog,"p_{T} [GeV]","pt2",doPF); |
721 |
+ |
make_kin_plot("eta1","",40,-3,3,nolog,"#eta_{l}","eta",doPF); |
722 |
+ |
make_kin_plot("jzb[1]","",100,-150,200,dolog,"JZB [GeV]","jzb_ossf",doPF); |
723 |
|
stringstream jzbcut; |
724 |
|
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
725 |
< |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
725 |
> |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
726 |
> |
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); |
727 |
> |
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); |
728 |
> |
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); |
729 |
> |
stringstream jzbcut2; |
730 |
> |
jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
731 |
> |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
732 |
> |
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); |
733 |
> |
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); |
734 |
> |
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); |
735 |
> |
stringstream jzbcut3; |
736 |
> |
jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
737 |
> |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,nolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); |
738 |
> |
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); |
739 |
> |
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); |
740 |
> |
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); |
741 |
> |
|
742 |
> |
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); |
743 |
> |
//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); |
744 |
> |
//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); |
745 |
> |
|
746 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,0); |
747 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,50); |
748 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,80); |
749 |
> |
make_special_obs_pred_mll_plot(datajzb,mcjzb,100); |
750 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,150); |
751 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,200); |
752 |
> |
// make_special_obs_pred_mll_plot(datajzb,mcjzb,250); |
753 |
> |
|
754 |
> |
make_JES_plot(cutmass&&cutOSSF&&basiccut,"_ossf"); |
755 |
> |
make_JES_plot(cutmass&&cutOSOF&&basiccut,"_osof"); |
756 |
> |
|
757 |
> |
string regioncut[4] = {"mll>0&&","mll>20&&mll<70&&","mll>70&&mll<110&&","mll>110&&"}; |
758 |
> |
string regionname[4] = {"global","lowmass","Zregion","highmass"}; |
759 |
> |
bool StoreRatioPlots=false; |
760 |
> |
for(int iregion=0;iregion<4;iregion++) { |
761 |
> |
cout << regionname[iregion] << " : " << regioncut[iregion] << endl; |
762 |
> |
|
763 |
> |
//Z properties |
764 |
> |
make_kin_plot("pt","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),40,0,200,dolog,"p_{T}^{ee} [GeV] (MET>100GeV)","Z/ZPT_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
765 |
> |
make_kin_plot("pt","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),40,0,200,dolog,"p_{T}^{#mu#mu} [GeV] (MET>100GeV)","Z/ZPT_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
766 |
> |
|
767 |
> |
make_kin_plot("phi","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),32,-3.2,3.2,nolog,"#phi^{ee} (MET>100GeV)","Z/ZPhi_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
768 |
> |
make_kin_plot("phi","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu#mu} (MET>100GeV)","Z/ZPhi_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
769 |
> |
|
770 |
> |
make_kin_plot("eta","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),30,-3.0,3.0,nolog,"#eta^{ee} (MET>100GeV)","Z/ZEta_ee_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
771 |
> |
make_kin_plot("eta","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutOSSF&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu#mu} (MET>100GeV)","Z/ZEta_mm_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
772 |
> |
|
773 |
> |
// lepton properties |
774 |
> |
make_kin_plot("pt1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{e1} [GeV] (MET>100GeV)","Lepton/LeadingElectronPt_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
775 |
> |
make_kin_plot("pt1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{#mu1} [GeV] (MET>100GeV)","Lepton/LeadingMuonPt_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
776 |
> |
make_kin_plot("pt2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{e2} [GeV] (MET>100GeV)","Lepton/SubLeadingElectronPt_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
777 |
> |
make_kin_plot("pt2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),40,0,200,dolog,"p_{T}^{#mu2} [GeV] (MET>100GeV)","Lepton/SubLeadingMuonPt_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
778 |
> |
|
779 |
> |
make_kin_plot("phi1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{e1} (MET>100GeV)","Lepton/LeadingElectronPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
780 |
> |
make_kin_plot("phi1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu1} (MET>100GeV)","Lepton/LeadingMuonPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
781 |
> |
make_kin_plot("phi2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{e2} (MET>100GeV)","Lepton/SubLeadingElectronPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
782 |
> |
make_kin_plot("phi2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),32,-3.2,3.2,nolog,"#phi^{#mu2} (MET>100GeV)","Lepton/SubLeadingMuonPhi_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
783 |
> |
|
784 |
> |
make_kin_plot("eta1","met[4]>100&&id1==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{e1} (MET>100GeV)","Lepton/LeadingElectronEta_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
785 |
> |
make_kin_plot("eta1","met[4]>100&&id1==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu1} (MET>100GeV)","Lepton/LeadingMuonEta_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
786 |
> |
make_kin_plot("eta2","met[4]>100&&id2==0&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{e2} (MET>100GeV)","Lepton/SubLeadingElectronEta_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
787 |
> |
make_kin_plot("eta2","met[4]>100&&id2==1&&"+regioncut[iregion]+(const char*)TCut(cutmass&&cutnJets),30,-3.0,3.0,nolog,"#eta^{#mu2} (MET>100GeV)","Lepton/SubLeadingMuonEta_met100_"+regionname[iregion],doPF,StoreRatioPlots); |
788 |
> |
|
789 |
> |
|
790 |
> |
} |
791 |
> |
|
792 |
|
} |
793 |
|
|
794 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
795 |
|
int nbins, float xmin, float xmax, bool log, |
796 |
|
float ymin=0, float ymax=0, bool leftJustified=false ) { |
797 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
797 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- WATCH OUT: the argument in the function changed! |
798 |
|
|
799 |
|
TCut weightbackup=cutWeight;//backing up the correct weight (restoring below!) |
800 |
|
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__)); |
801 |
< |
if(var=="numVtx") cutWeight=TCut("1.0"); |
801 |
> |
//if(var=="numVtx") cutWeight=TCut("1.0"); |
802 |
|
TCut jzbData[]= { TCut(TString(datajzb+">"+any2string(jzbcut))),TCut(TString(datajzb+"<-"+any2string(jzbcut))) }; |
803 |
|
TCut jzbMC[] = { TCut(TString(mcjzb+">"+any2string(jzbcut))),TCut(TString(mcjzb+"<-"+any2string(jzbcut))) }; |
804 |
|
|
805 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- below: the next ~20 lines changed! |
806 |
|
int nRegions=4; |
807 |
< |
if(!PlottingSetup::RestrictToMassPeak) { |
807 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
808 |
|
nRegions=2; |
809 |
|
} |
810 |
|
|
822 |
|
TCanvas *ccomp = new TCanvas("ccomp","Comparison plot",600,400); |
823 |
|
ccomp->SetLogy(log); |
824 |
|
TH1F *datahisto = allsamples.Draw("datahisto", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity); |
825 |
< |
TH1F *lm4histo = signalsamples.Draw("lm4histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbData[ijzb],data,luminosity,signalsamples.FindSample("LM4")); |
825 |
> |
TH1F *lm3histo = signalsamples.Draw("lm3histo", var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb],data,luminosity,signalsamples.FindSample("LM3")); |
826 |
|
THStack mcstack = allsamples.DrawStack("mcstack",var,nbins,xmin,xmax,xlabel,"events",kRegions[iregion]&&jzbMC[ijzb], mc, luminosity); |
827 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
828 |
|
if (ymax>ymin) datahisto->SetMaximum(ymax); |
829 |
< |
lm4histo->SetLineStyle(2); |
829 |
> |
lm3histo->SetLineStyle(2); |
830 |
|
datahisto->Draw("e1"); |
831 |
|
mcstack.Draw("same"); |
832 |
|
datahisto->Draw("same,e1"); |
833 |
< |
// lm4histo->Draw("hist,same"); |
833 |
> |
lm3histo->Draw("hist,same"); |
834 |
|
TLegend *kinleg = allsamples.allbglegend((sRegions[iregion]+(ijzb?"neg":"pos")).c_str()); |
835 |
|
if ( leftJustified ) { |
836 |
|
Float_t w = kinleg->GetX2()-kinleg->GetX1(); |
837 |
|
kinleg->SetX1(0.2); |
838 |
|
kinleg->SetX2(0.2+w); |
839 |
|
} |
840 |
< |
// kinleg->AddEntry(lm4histo,"LM4","l"); |
840 |
> |
kinleg->AddEntry(lm3histo,"LM3","l"); |
841 |
|
kinleg->Draw(); |
842 |
|
TText* write_variable = write_text(0.99,0.01,var); |
843 |
|
write_variable->SetTextAlign(31); |
846 |
|
CompleteSave(ccomp,"compare/JZBcut_at_"+any2string(jzbcut)+"/"+filename+"/"+filename+sRegions[iregion]+(ijzb?"neg":"pos")); |
847 |
|
delete datahisto; |
848 |
|
delete ccomp; |
849 |
< |
delete lm4histo; |
849 |
> |
delete lm3histo; |
850 |
|
} |
851 |
|
cutWeight=weightbackup; |
852 |
|
} |
856 |
|
dout << "Creating comparison plots for signal and control regions" << endl; |
857 |
|
// Compare a few quantities in the signal region and all 7 control regions |
858 |
|
|
859 |
< |
switch_overunderflow(true); // switching overflow/underflow bins on |
859 |
> |
// switch_overunderflow(true); // switching overflow/underflow bins on |
860 |
|
|
861 |
|
|
862 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
863 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
863 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
864 |
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut |
865 |
|
float mll_low=50;float mll_high=170; |
866 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
867 |
< |
mll_high=200; |
868 |
< |
mll_low=50; |
867 |
> |
mll_high=300; |
868 |
> |
mll_low=20; |
869 |
|
} |
870 |
< |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,30,mll_low,mll_high,false,0,16.); |
870 |
> |
make_comp_plot("pfJetGoodPt[0]/pfJetGoodPt[1]","pt_{j}^{1}/pt_{j}^{2}","j1j2ratio",jzbcut,mcjzb,datajzb,100,0,10,true); |
871 |
> |
make_comp_plot("TMath::Abs(pfJetDphiMet[0])","|#Delta#phi(jet1,MET)|","dphiJ1MET",jzbcut,mcjzb,datajzb,32,0,3.2,false,0,0,true); |
872 |
> |
|
873 |
> |
make_comp_plot("mll","m_{ll} [GeV]","mll",jzbcut,mcjzb,datajzb,56,mll_low,mll_high,false,0,16.); |
874 |
|
make_comp_plot("met[4]","pfMET [GeV]","pfmet",jzbcut,mcjzb,datajzb,18,0,360,false,0,16.); |
875 |
< |
make_comp_plot("pfJetGoodNum","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
875 |
> |
make_comp_plot("pfJetGoodNum40","#(jets)","njets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
876 |
> |
make_comp_plot("pfJetGoodNumBtag","#(b-jets)","nBjets",jzbcut,mcjzb,datajzb,10,0,10, false,0,35.); |
877 |
|
make_comp_plot("pt","Z p_{T} [GeV]","Zpt",jzbcut,mcjzb,datajzb,26,0,525,false,0.,21.); |
878 |
< |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,20,0.,20.,false,0,16.); |
878 |
> |
make_comp_plot("numVtx","#(prim. vertices)","nvtx",jzbcut,mcjzb,datajzb,40,0.,40.,false,0,16.); |
879 |
|
make_comp_plot("TMath::Abs(dphi)","#Delta#phi(leptons)","dphilep",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
880 |
|
make_comp_plot("TMath::Abs(dphi_sumJetVSZ[1])","#Delta#phi(Z,jets)","dphiZjets",jzbcut,mcjzb,datajzb,10,0.,3.1415,false,0,16.,true); |
881 |
+ |
make_comp_plot("eta1","#eta_1","eta1",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
882 |
+ |
make_comp_plot("eta2","#eta_2","eta2",jzbcut,mcjzb,datajzb,10,0.,2.5,false,0,16.); |
883 |
|
} |
884 |
|
|
885 |
|
switch_overunderflow(false); // switching overflow/underflow bins off |
904 |
|
float simulatedlumi=luminosity;//in pb please - adjust to your likings |
905 |
|
|
906 |
|
TH1F *JZBplotZJETs = allsamples.Draw("JZBplotZJETs",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/DY")); |
907 |
< |
TH1F *JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM4")); |
907 |
> |
TH1F *JZBplotLM4; |
908 |
> |
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")); |
909 |
> |
else JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM3")); |
910 |
|
TH1F *JZBplotTtbar = allsamples.Draw("JZBplotTtbar",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("TTJets")); |
911 |
|
|
912 |
|
JZBplotTtbar->SetLineColor(allsamples.GetColor("TTJet")); |
930 |
|
TLegend *signal_bg_comparison_leg2 = make_legend("",0.55,0.75,false); |
931 |
|
signal_bg_comparison_leg2->AddEntry(JZBplotZJETs,"Z+Jets","f"); |
932 |
|
signal_bg_comparison_leg2->AddEntry(JZBplotTtbar,"t#bar{t}","f"); |
933 |
< |
signal_bg_comparison_leg2->AddEntry(JZBplotLM4,"LM4","f"); |
933 |
> |
if(PlottingSetup::RestrictToMassPeak) signal_bg_comparison_leg2->AddEntry(JZBplotLM4,"LM4","f"); |
934 |
> |
else signal_bg_comparison_leg2->AddEntry(JZBplotLM4,"LM3","f"); |
935 |
|
signal_bg_comparison_leg2->Draw(); |
936 |
|
DrawMCPrelim(simulatedlumi); |
937 |
|
CompleteSave(can,"jzb_bg_vs_signal_distribution"); |
1078 |
|
// 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) |
1079 |
|
TF1 *ttbarlogpar = do_logpar_fit_to_plot(Tprediction); |
1080 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1081 |
< |
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); |
1081 |
> |
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); |
1082 |
|
|
1083 |
|
|
1084 |
|
TF1 *ttbarlogparP = new TF1("ttbarlogparP",LogParabolaP,0,(prediction->GetXaxis()->GetBinLowEdge(prediction->GetNbinsX())+prediction->GetXaxis()->GetBinWidth(prediction->GetNbinsX())),8); |
1173 |
|
return return_functions; |
1174 |
|
} |
1175 |
|
|
1176 |
< |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false ) |
1176 |
> |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
1177 |
|
{ |
1178 |
+ |
// switch_overunderflow(true); |
1179 |
|
bool is_data=false; |
1180 |
|
bool use_signal=false; |
1181 |
|
if(use_data==1) is_data=true; |
1184 |
|
if(is_data) nbins=50; |
1185 |
|
float low=0; |
1186 |
|
float hi=500; |
1187 |
+ |
|
1188 |
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
1189 |
|
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1190 |
|
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1191 |
|
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1192 |
|
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1193 |
+ |
|
1194 |
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
1195 |
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
1196 |
|
blankback->GetXaxis()->CenterTitle(); |
1205 |
|
TH1F *RcorrJZBeemmNoS; |
1206 |
|
|
1207 |
|
//these are for the ratio |
1208 |
+ |
|
1209 |
|
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1210 |
|
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1211 |
|
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1219 |
|
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); |
1220 |
|
|
1221 |
|
|
1222 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1222 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1223 |
|
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1224 |
|
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1225 |
|
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1226 |
|
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1227 |
< |
|
1227 |
> |
|
1228 |
|
//these are for the ratio |
1229 |
|
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1230 |
|
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
1231 |
|
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
1232 |
|
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
802 |
– |
|
1233 |
|
} |
1234 |
|
|
1235 |
|
TH1F *lm4RcorrJZBeemm; |
1236 |
< |
if(overlay_signal || use_data == 2 ) lm4RcorrJZBeemm = allsamples.Draw("lm4RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,allsamples.FindSample("LM4")); |
1236 |
> |
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")); |
1237 |
|
|
1238 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
1239 |
|
|
1242 |
|
|
1243 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
1244 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
1245 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1245 |
> |
|
1246 |
> |
TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]); |
1247 |
> |
ClearHisto(BpredSys); |
1248 |
> |
|
1249 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1250 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
1251 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
1252 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
1268 |
|
JBpred->Add(JLcorrJZBSBem,-1.0/3.); |
1269 |
|
JBpred->Add(JRcorrJZBSBeemm,1.0/3.); |
1270 |
|
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.); |
1271 |
+ |
|
1272 |
+ |
//Systematics: |
1273 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertONPEAK*zjetsestimateuncertONPEAK); |
1274 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
1275 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
1276 |
+ |
AddSquared(BpredSys,JRcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
1277 |
+ |
AddSquared(BpredSys,JLcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
1278 |
+ |
AddSquared(BpredSys,JRcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
1279 |
+ |
AddSquared(BpredSys,JLcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
1280 |
|
} else { |
1281 |
|
Bpred->Add(RcorrJZBem,1.0); |
1282 |
|
Bpred->Add(LcorrJZBem,-1.0); |
1286 |
|
//these are for the ratio |
1287 |
|
JBpred->Add(JRcorrJZBem,1.0); |
1288 |
|
JBpred->Add(JLcorrJZBem,-1.0); |
1289 |
+ |
|
1290 |
+ |
//Systematics |
1291 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertOFFPEAK*zjetsestimateuncertOFFPEAK); |
1292 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
1293 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
1294 |
+ |
|
1295 |
|
} |
1296 |
|
|
1297 |
< |
|
1297 |
> |
SQRT(BpredSys); |
1298 |
> |
BpredSys->Divide(JBpred); |
1299 |
> |
|
1300 |
|
|
1301 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
1302 |
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred"); |
1303 |
|
Tpred->Add(LcorrJZBem,-1.0); |
1304 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1304 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1305 |
|
Tpred->Add(RcorrJZBSBem,1.0); |
1306 |
|
Tpred->Add(LcorrJZBSBem,-1.0); |
1307 |
|
Tpred->Add(RcorrJZBSBeemm,1.0); |
1341 |
|
blankback->Draw(); |
1342 |
|
if(use_data==1) |
1343 |
|
{ |
1344 |
+ |
//Bpred->SetLineWidth(3); //paper style.overruled. |
1345 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style.overruled. |
1346 |
|
analytical_function = do_extended_fit_to_plot(Bpred,Tpred,LcorrJZBeemm,LcorrJZBem,is_data); |
1347 |
|
kinpad->cd();//necessary because the extended fit function creates its own canvas |
1348 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1349 |
|
|
1350 |
|
Bpred->Draw("hist,same"); |
1351 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1351 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1352 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1353 |
+ |
lm4RcorrJZBeemm->Draw("hist,same"); |
1354 |
|
legBpred->AddEntry(RcorrJZBeemm,"observed","p"); |
1355 |
|
legBpred->AddEntry(Bpred,"predicted","l"); |
1356 |
< |
legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1357 |
< |
legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
1358 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1356 |
> |
// legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1357 |
> |
// legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
1358 |
> |
legBpred->AddEntry(lm4RcorrJZBeemm,(allsamples.collection[allsamples.FindSample("LM")[0]].samplename).c_str(),"l"); |
1359 |
|
legBpred->Draw(); |
1360 |
|
DrawPrelim(); |
1361 |
|
|
1362 |
|
//this plot shows what the prediction is composed of |
1363 |
< |
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1364 |
< |
specialcanv->SetLogy(1); |
1365 |
< |
Zjetspred->SetFillColor(kYellow); |
1366 |
< |
Zjetspred->SetLineColor(kYellow); |
1367 |
< |
TTbarpred->SetFillColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1368 |
< |
TTbarpred->SetLineColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1363 |
> |
TPad *predcomppad = new TPad("predcomppad","predcomppad",0,0,1,1); |
1364 |
> |
float CurrentBpredLineWidth=Bpred->GetLineWidth(); |
1365 |
> |
Bpred->SetLineWidth(2); |
1366 |
> |
predcomppad->cd(); |
1367 |
> |
predcomppad->SetLogy(1); |
1368 |
> |
|
1369 |
> |
TH1F *jzbnegative = (TH1F*)LcorrJZBeemm->Clone("jzbnegative"); |
1370 |
> |
TH1F *sidebandsemu = (TH1F*)Bpred->Clone("sidebandsemu"); |
1371 |
> |
sidebandsemu->Add(jzbnegative,-1); |
1372 |
> |
|
1373 |
> |
jzbnegative->SetFillColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
1374 |
> |
jzbnegative->SetLineColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
1375 |
> |
sidebandsemu->SetLineColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1376 |
> |
sidebandsemu->SetFillColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1377 |
> |
|
1378 |
|
THStack predcomposition("predcomposition","prediction composition"); |
1379 |
< |
predcomposition.Add(TTbarpred); |
1380 |
< |
predcomposition.Add(Zjetspred); |
1379 |
> |
predcomposition.Add(sidebandsemu); |
1380 |
> |
predcomposition.Add(jzbnegative); |
1381 |
|
blankback->Draw(); |
1382 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1383 |
|
predcomposition.Draw("histo,same");// |
1384 |
|
Bpred->Draw("hist,same"); |
1385 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1385 |
> |
// analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1386 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1387 |
< |
legBpred->Draw(); |
1387 |
> |
// lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
1388 |
> |
lm4RcorrJZBeemm->SetLineWidth(2); |
1389 |
> |
//lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled. |
1390 |
> |
lm4RcorrJZBeemm->Draw("histo,same"); |
1391 |
|
DrawPrelim(); |
1392 |
< |
TLegend *specialleg = new TLegend(0.6,0.4,0.89,0.55); |
1393 |
< |
specialleg->SetFillColor(kWhite);specialleg->SetLineColor(kWhite); |
1394 |
< |
specialleg->AddEntry(Zjetspred,"Z+Jets prediction","f"); |
1395 |
< |
specialleg->AddEntry(TTbarpred,"t#bar{t} prediction","f"); |
1396 |
< |
specialleg->Draw("same"); |
1397 |
< |
CompleteSave(specialcanv,"Bpred_Data_____PredictionComposition"); |
1398 |
< |
|
1399 |
< |
THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1392 |
> |
TLegend *speciallegBpred = make_legend("",0.45,0.55); |
1393 |
> |
//TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled. |
1394 |
> |
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
1395 |
> |
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
1396 |
> |
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
1397 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
1398 |
> |
else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f"); |
1399 |
> |
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
1400 |
> |
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1401 |
> |
speciallegBpred->Draw(); |
1402 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys); |
1403 |
> |
|
1404 |
> |
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1405 |
> |
specialcanv->SetLogy(1); |
1406 |
> |
// THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1407 |
|
blankback->Draw(); |
1408 |
< |
kostack.Draw("same"); |
1408 |
> |
// kostack.Draw("same"); |
1409 |
> |
predcomposition.Draw(); |
1410 |
|
Bpred->Draw("hist,same"); |
1411 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1411 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1412 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1413 |
|
legBpred->Draw(); |
1414 |
|
DrawPrelim(); |
1415 |
< |
CompleteSave(specialcanv,"Bpred_Data_____PredictionCompositioninMC"); |
1415 |
> |
CompleteSave(specialcanv,subdir+"Bpred_Data_____PredictionCompositioninMC"); |
1416 |
> |
Bpred->SetLineWidth((int)CurrentBpredLineWidth); |
1417 |
> |
|
1418 |
|
|
1419 |
< |
delete specialcanv; |
1420 |
< |
delete specialleg; |
1419 |
> |
//for(int i=1;i<=Bpred->GetNbinsX();i++) cout << Bpred->GetBinLowEdge(i) << ";" << Bpred->GetBinLowEdge(i)+Bpred->GetBinWidth(i) << ";;" << RcorrJZBeemm->GetBinContent(i) << ";" << LcorrJZBeemm->GetBinContent(i) << ";" << RcorrJZBem->GetBinContent(i) << ";" << LcorrJZBem->GetBinContent(i) << endl; |
1420 |
> |
|
1421 |
> |
delete speciallegBpred; |
1422 |
|
delete Zjetspred; |
1423 |
|
delete TTbarpred; |
1424 |
|
|
1426 |
|
} |
1427 |
|
if(use_data==0) { |
1428 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1429 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1430 |
|
Bpred->Draw("hist,same"); |
1431 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1432 |
< |
legBpred->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1433 |
< |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1432 |
> |
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1433 |
> |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1434 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
1435 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
1436 |
|
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1441 |
|
} |
1442 |
|
if(use_data==2) { |
1443 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1444 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1445 |
|
Bpred->Draw("hist,same"); |
1446 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1447 |
< |
legBpred->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1447 |
> |
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1448 |
|
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1449 |
< |
legBpred2->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1449 |
> |
legBpred2->AddEntry(RcorrJZBeemm,"MC true","p"); |
1450 |
|
legBpred2->AddEntry(Bpred,"MC predicted","l"); |
1451 |
|
{ |
1452 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 --> now only allowed for root >=v5.30 |
1457 |
|
// CompleteSave(globalcanvas,"Bpred_MCwithS"); // done below in save_with_ratio |
1458 |
|
} |
1459 |
|
{ |
1460 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style. overruled. |
1461 |
+ |
//RcorrJZBeemmNoS->SetLineWidth(3); //paper style. overruled. |
1462 |
+ |
//lm4RcorrJZBeemm->SetLineStyle(2); //paper style. overruled. |
1463 |
+ |
//RcorrJZBeemmNoS->SetLineStyle(3); //paper style. overruled. |
1464 |
+ |
//lm4RcorrJZBeemm->SetLineColor(kOrange+1); //paper style. overruled. |
1465 |
+ |
|
1466 |
|
RcorrJZBeemmNoS->SetLineStyle(2); |
1467 |
|
legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l"); |
1468 |
|
legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
1481 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
1482 |
|
string ytitle("ratio"); |
1483 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
1484 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1484 |
> |
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1485 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,false,ytitle,BpredSys);//not extending the y range anymore up to 4 |
1486 |
|
|
1487 |
|
|
1488 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1489 |
< |
/// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1490 |
< |
if(!PlottingSetup::RestrictToMassPeak) return; |
1491 |
< |
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1492 |
< |
Bpredem->Add(RcorrJZBem); |
1493 |
< |
Bpredem->Add(LcorrJZBem,-1); |
1494 |
< |
TH1F *BpredSBem = (TH1F*)LcorrJZBeemm->Clone("BpredSBem"); |
1495 |
< |
BpredSBem->Add(RcorrJZBSBem); |
1496 |
< |
Bpred->Add(LcorrJZBSBem,-1); |
1497 |
< |
TH1F *BpredSBeemm = (TH1F*)LcorrJZBeemm->Clone("BpredSBeemm"); |
1498 |
< |
BpredSBeemm->Add(RcorrJZBSBeemm); |
1499 |
< |
BpredSBeemm->Add(LcorrJZBSBeemm,-1.0); |
1500 |
< |
globalcanvas->cd(); |
1501 |
< |
globalcanvas->SetLogy(1); |
1502 |
< |
|
1503 |
< |
RcorrJZBeemm->SetMarkerStyle(20); |
1504 |
< |
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high); |
1505 |
< |
blankback->Draw(); |
1506 |
< |
RcorrJZBeemm->Draw("e1x0,same"); |
1507 |
< |
RcorrJZBeemm->SetMarkerSize(DataMarkerSize); |
1508 |
< |
|
1509 |
< |
Bpredem->SetLineColor(kRed+1); |
1510 |
< |
Bpredem->SetStats(0); |
1511 |
< |
Bpredem->Draw("hist,same"); |
1512 |
< |
|
1513 |
< |
BpredSBem->SetLineColor(kGreen+2);//TColor::GetColor("#0B6138")); |
1514 |
< |
BpredSBem->SetLineStyle(2); |
1515 |
< |
BpredSBem->Draw("hist,same"); |
1516 |
< |
|
1517 |
< |
BpredSBeemm->SetLineColor(kBlue+1); |
1518 |
< |
BpredSBeemm->SetLineStyle(3); |
1519 |
< |
BpredSBeemm->Draw("hist,same"); |
1520 |
< |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1521 |
< |
|
1522 |
< |
TLegend *legBpredc = make_legend("",0.6,0.55); |
1523 |
< |
if(use_data==1) |
1524 |
< |
{ |
1525 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
1526 |
< |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
1527 |
< |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
1528 |
< |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
1529 |
< |
legBpredc->Draw(); |
1530 |
< |
CompleteSave(globalcanvas,"Bpred_Data_comparison"); |
1531 |
< |
} |
1532 |
< |
if(use_data==0) { |
1533 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1534 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1535 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1536 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1537 |
< |
legBpredc->Draw(); |
1538 |
< |
CompleteSave(globalcanvas,"Bpred_MC_comparison"); |
1539 |
< |
} |
1540 |
< |
if(use_data==2) { |
1541 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1542 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1543 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1544 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1545 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1546 |
< |
legBpredc->Draw(); |
1547 |
< |
CompleteSave(globalcanvas,"Bpred_MCwithS_comparison"); |
1489 |
> |
// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1490 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1491 |
> |
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1492 |
> |
Bpredem->Add(RcorrJZBem); |
1493 |
> |
Bpredem->Add(LcorrJZBem,-1); |
1494 |
> |
TH1F *BpredSBem = (TH1F*)LcorrJZBeemm->Clone("BpredSBem"); |
1495 |
> |
BpredSBem->Add(RcorrJZBSBem); |
1496 |
> |
Bpred->Add(LcorrJZBSBem,-1); |
1497 |
> |
TH1F *BpredSBeemm = (TH1F*)LcorrJZBeemm->Clone("BpredSBeemm"); |
1498 |
> |
BpredSBeemm->Add(RcorrJZBSBeemm); |
1499 |
> |
BpredSBeemm->Add(LcorrJZBSBeemm,-1.0); |
1500 |
> |
globalcanvas->cd(); |
1501 |
> |
globalcanvas->SetLogy(1); |
1502 |
> |
|
1503 |
> |
RcorrJZBeemm->SetMarkerStyle(20); |
1504 |
> |
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high); |
1505 |
> |
blankback->Draw(); |
1506 |
> |
RcorrJZBeemm->Draw("e1x0,same"); |
1507 |
> |
RcorrJZBeemm->SetMarkerSize(DataMarkerSize); |
1508 |
> |
|
1509 |
> |
Bpredem->SetLineColor(kRed+1); |
1510 |
> |
Bpredem->SetStats(0); |
1511 |
> |
Bpredem->Draw("hist,same"); |
1512 |
> |
|
1513 |
> |
BpredSBem->SetLineColor(kGreen+2);//TColor::GetColor("#0B6138")); |
1514 |
> |
BpredSBem->SetLineStyle(2); |
1515 |
> |
BpredSBem->Draw("hist,same"); |
1516 |
> |
|
1517 |
> |
BpredSBeemm->SetLineColor(kBlue+1); |
1518 |
> |
BpredSBeemm->SetLineStyle(3); |
1519 |
> |
BpredSBeemm->Draw("hist,same"); |
1520 |
> |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1521 |
> |
|
1522 |
> |
TLegend *legBpredc = make_legend("",0.6,0.55); |
1523 |
> |
if(use_data==1) |
1524 |
> |
{ |
1525 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
1526 |
> |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
1527 |
> |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
1528 |
> |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
1529 |
> |
legBpredc->Draw(); |
1530 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_Data_comparison"); |
1531 |
> |
} |
1532 |
> |
if(use_data==0) { |
1533 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1534 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1535 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1536 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1537 |
> |
legBpredc->Draw(); |
1538 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_MC_comparison"); |
1539 |
> |
} |
1540 |
> |
if(use_data==2) { |
1541 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1542 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1543 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1544 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1545 |
> |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1546 |
> |
legBpredc->Draw(); |
1547 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison"); |
1548 |
> |
} |
1549 |
|
} |
1550 |
+ |
|
1551 |
+ |
TFile *f = new TFile("tester.root","RECREATE"); |
1552 |
+ |
RcorrJZBeemm->Write(); |
1553 |
+ |
Bpred->Write(); |
1554 |
+ |
f->Close(); |
1555 |
+ |
|
1556 |
|
delete RcorrJZBeemm; |
1557 |
|
delete LcorrJZBeemm; |
1558 |
|
delete RcorrJZBem; |
1565 |
|
|
1566 |
|
delete blankback; |
1567 |
|
|
1568 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1568 |
> |
delete BpredSys; |
1569 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1570 |
|
delete RcorrJZBSBem; |
1571 |
|
delete LcorrJZBSBem; |
1572 |
|
delete RcorrJZBSBeemm; |
1578 |
|
delete JLcorrJZBSBeemm; |
1579 |
|
} |
1580 |
|
if(overlay_signal || use_data==2) delete lm4RcorrJZBeemm; |
1581 |
+ |
switch_overunderflow(false); |
1582 |
|
} |
1583 |
|
|
1584 |
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) { |
1585 |
|
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
1586 |
< |
do_prediction_plot(datajzb,globalcanvas,DataSigma,jzbHigh ,data,overlay_signal); |
1587 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal); |
1588 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal); |
1586 |
> |
do_prediction_plot(datajzb,globalcanvas,jzbHigh ,data,overlay_signal); |
1587 |
> |
if ( !PlottingSetup::Approved ) { |
1588 |
> |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mc,overlay_signal); |
1589 |
> |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mcwithsignal,overlay_signal); |
1590 |
> |
} else { |
1591 |
> |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
1592 |
> |
} |
1593 |
|
} |
1594 |
|
|
1595 |
|
void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) { |
1607 |
|
TH1F *RcorrJZBSBeemm; |
1608 |
|
TH1F *LcorrJZBSbeemm; |
1609 |
|
|
1610 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1610 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1611 |
|
RcorrJZBSBem = allsamples.Draw("RcorrJZBSbem",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1612 |
|
LcorrJZBSBem = allsamples.Draw("LcorrJZBSbem",("-"+jzb).c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,do_data, luminosity,dosignal); |
1613 |
|
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSbeemm",jzb.c_str(),binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,do_data, luminosity,dosignal); |
1619 |
|
|
1620 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1621 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
1622 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
1622 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
1623 |
|
Bpred->Add(RcorrJZBem,1.0/3); |
1624 |
|
Bpred->Add(LcorrJZBem,-1.0/3); |
1625 |
|
Bpred->Add(RcorrJZBSBem,1.0/3); |
1926 |
|
datahisto->Draw("same,e1"); |
1927 |
|
|
1928 |
|
TLegend *leg; |
1929 |
< |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
1930 |
< |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
1931 |
< |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
1932 |
< |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
1933 |
< |
else { |
1934 |
< |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
1935 |
< |
exit(-1); |
1936 |
< |
} |
1929 |
> |
if (!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) { |
1930 |
> |
if(is_OF(cut)) leg = allsamples.allbglegend("Opposite flavor",datahisto); |
1931 |
> |
else leg = allsamples.allbglegend("Same flavor",datahisto); |
1932 |
> |
} else { |
1933 |
> |
if(is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("OFZP",datahisto); |
1934 |
> |
else if(!is_OF(cut) && is_ZP(cut)) leg = allsamples.allbglegend("SFZP",datahisto); |
1935 |
> |
else if( is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("OFSB",datahisto); |
1936 |
> |
else if(!is_OF(cut) && !is_ZP(cut)) leg = allsamples.allbglegend("SFSB",datahisto); |
1937 |
> |
else { |
1938 |
> |
std::cerr << "Unable to decode cut: " << cut.GetTitle() << std::endl; |
1939 |
> |
exit(-1); |
1940 |
> |
} |
1941 |
> |
} |
1942 |
|
leg->Draw(); |
1943 |
|
string write_cut = decipher_cut(cut,""); |
1944 |
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str()); |
1945 |
|
writeline1->SetTextSize(0.035); |
1946 |
|
writeline1->Draw(); |
1947 |
< |
save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
1947 |
> |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
1948 |
> |
else save_with_ratio(datahisto,mcstack,jzbpad->cd(),savename); |
1949 |
|
TPad *jzbpad2 = new TPad("jzbpad2","jzbpad2",0,0,1,1); |
1950 |
|
jzbpad2->cd(); |
1951 |
|
jzbpad2->SetLogy(1); |
1960 |
|
writeline1->SetTextSize(0.035); |
1961 |
|
writeline1->Draw(); |
1962 |
|
DrawPrelim(); |
1963 |
< |
save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
1963 |
> |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
1964 |
> |
else save_with_ratio(datahisto,mcstack,jzbpad2->cd(),(savename+"__PosOnly")); |
1965 |
|
datahisto->Delete(); |
1966 |
|
mcstack.Delete(); |
1967 |
|
} |
1969 |
|
Double_t GausR(Double_t *x, Double_t *par) { |
1970 |
|
return gRandom->Gaus(x[0],par[0]); |
1971 |
|
} |
1972 |
+ |
|
1973 |
+ |
void produce_stretched_jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1974 |
+ |
TCanvas *dican = new TCanvas("dican","JZB Plots Canvas"); |
1975 |
+ |
float max=jzbHigh ; |
1976 |
+ |
float min=-120; |
1977 |
+ |
int nbins=(int)((max-min)/5.0); // we want 5 GeV/bin |
1978 |
+ |
int coarserbins=int(nbins/2.0); |
1979 |
+ |
int rebinnedbins=int(nbins/4.0); |
1980 |
|
|
1981 |
+ |
vector<float>binning;vector<float>coarse_binning;vector<float>coarsest_binning; |
1982 |
+ |
for(int i=0;i<=nbins;i++)binning.push_back(min+i*(max-min)/((float)nbins)); |
1983 |
+ |
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
1984 |
+ |
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
1985 |
+ |
|
1986 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP",dican,binning); |
1987 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP",dican,binning); |
1988 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_SFZP",dican,binning); |
1989 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning); |
1990 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning); |
1991 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning); |
1992 |
+ |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
1993 |
+ |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
1994 |
+ |
|
1995 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning); |
1996 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning); |
1997 |
+ |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
1998 |
+ |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
1999 |
+ |
|
2000 |
+ |
delete dican; |
2001 |
+ |
} |
2002 |
+ |
|
2003 |
+ |
|
2004 |
+ |
void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
2005 |
+ |
vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ"); |
2006 |
+ |
|
2007 |
+ |
if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) { |
2008 |
+ |
write_error(__FUNCTION__,"Could not find any diboson samples - aborting diboson plots"); |
2009 |
+ |
return; |
2010 |
+ |
} |
2011 |
+ |
|
2012 |
+ |
float stretchfactor = 100.0; |
2013 |
+ |
vector<string> labels; |
2014 |
+ |
|
2015 |
+ |
|
2016 |
+ |
dout << "Going to increase the cross section for diboson samples ... " << endl; |
2017 |
+ |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
2018 |
+ |
float origxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
2019 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].xs=origxs*stretchfactor; |
2020 |
+ |
dout << " Increased xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].filename << " from " << origxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ")" << endl; |
2021 |
+ |
labels.push_back((allsamples.collection)[SamplesToBeModified[i]].samplename); |
2022 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].samplename=any2string(int(stretchfactor))+" x "+(allsamples.collection)[SamplesToBeModified[i]].samplename; |
2023 |
+ |
dout << " (also renamed it to " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " )" << endl; |
2024 |
+ |
} |
2025 |
+ |
|
2026 |
+ |
dout << "Going to produce JZB plots" << endl; |
2027 |
+ |
produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning); |
2028 |
+ |
TCanvas *gloca = new TCanvas("gloca","gloca"); |
2029 |
+ |
|
2030 |
+ |
dout << "Going to produce prediction plots" << endl; |
2031 |
+ |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
2032 |
+ |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
2033 |
+ |
delete gloca; |
2034 |
+ |
|
2035 |
+ |
dout << "Going to reset the cross section for diboson samples ... " << endl; |
2036 |
+ |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
2037 |
+ |
float Upxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
2038 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].xs=(allsamples.collection)[SamplesToBeModified[i]].xs*(1.0/stretchfactor); |
2039 |
+ |
string Upname=(allsamples.collection)[SamplesToBeModified[i]].samplename; |
2040 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].samplename=labels[i]; |
2041 |
+ |
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; |
2042 |
+ |
|
2043 |
+ |
} |
2044 |
+ |
|
2045 |
+ |
} |
2046 |
+ |
|
2047 |
+ |
|
2048 |
+ |
void draw_normalized_data_vs_data_histo(TCut cut1, TCut cut2, string variable, string legentry1, string legentry2, string savename, TCanvas *can,vector<float> binning) { |
2049 |
+ |
TPad *jzbpad = new TPad("jzbpad","jzbpad",0,0,1,1); |
2050 |
+ |
jzbpad->cd(); |
2051 |
+ |
jzbpad->SetLogy(1); |
2052 |
+ |
string xlabel="JZB [GeV]"; |
2053 |
+ |
|
2054 |
+ |
TH1F *datahisto1 = allsamples.Draw("datahisto1",variable,binning, xlabel, "events",cut1,data,luminosity); |
2055 |
+ |
datahisto1->SetLineColor(kRed); |
2056 |
+ |
datahisto1->SetMarkerColor(kRed); |
2057 |
+ |
TH1F *datahisto2 = allsamples.Draw("datahisto2",variable,binning, xlabel, "events",cut2,data,luminosity); |
2058 |
+ |
datahisto2->SetLineColor(kBlue); |
2059 |
+ |
datahisto2->SetMarkerColor(kBlue); |
2060 |
+ |
|
2061 |
+ |
datahisto2->SetMarkerSize(DataMarkerSize); |
2062 |
+ |
datahisto1->DrawNormalized("e1"); |
2063 |
+ |
datahisto2->DrawNormalized("histo,same"); |
2064 |
+ |
datahisto1->DrawNormalized("same,e1"); |
2065 |
+ |
|
2066 |
+ |
TLegend *leg = make_legend(); |
2067 |
+ |
leg->AddEntry(datahisto1,legentry1.c_str()); |
2068 |
+ |
leg->AddEntry(datahisto2,legentry2.c_str()); |
2069 |
+ |
leg->Draw(); |
2070 |
+ |
|
2071 |
+ |
save_with_ratio(datahisto1,datahisto2,jzbpad->cd(),("jzb/"+savename)); |
2072 |
+ |
|
2073 |
+ |
datahisto1->Delete(); |
2074 |
+ |
datahisto2->Delete(); |
2075 |
+ |
} |
2076 |
+ |
|
2077 |
+ |
|
2078 |
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
2079 |
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas"); |
2080 |
|
float max=jzbHigh ; |
2088 |
|
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
2089 |
|
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
2090 |
|
|
2091 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
2092 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
2093 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
2094 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
2095 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
2096 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
2097 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2098 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
2099 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
2091 |
> |
if ( !PlottingSetup::Approved ) { |
2092 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
2093 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
2094 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
2095 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
2096 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
2097 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
2098 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2099 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
2100 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
2101 |
> |
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); |
2102 |
> |
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); |
2103 |
> |
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); |
2104 |
> |
|
2105 |
> |
} |
2106 |
|
|
2107 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarse",can,coarse_binning); |
2108 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
2109 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2110 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
2111 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
2112 |
< |
|
2113 |
< |
// draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarsest",can,coarsest_binning); |
2114 |
< |
// draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarsest",can,coarsest_binning); |
1498 |
< |
// flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1499 |
< |
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarsest",can,coarsest_binning); |
1500 |
< |
// if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarsest",can,coarsest_binning); |
2108 |
> |
if ( !PlottingSetup::Approved ) { |
2109 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
2110 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
2111 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
2112 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
2113 |
> |
} |
2114 |
> |
delete can; |
2115 |
|
} |
2116 |
|
|
2117 |
|
|
2161 |
|
TCanvas *yica = new TCanvas("yica","yield canvas"); |
2162 |
|
|
2163 |
|
int nRegions=4; |
2164 |
< |
if(!PlottingSetup::RestrictToMassPeak) nRegions=2; |
2164 |
> |
if(!PlottingSetup::RestrictToMassPeak||!PlottingSetup::UseSidebandsForcJZB) nRegions=2; |
2165 |
|
string tsRegions[] = {"SFZP","OFZP","SFSB","OFSB"}; |
2166 |
|
string posneg[] = {"pos","neg"}; |
2167 |
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut}; |
2168 |
|
|
2169 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
2169 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
2170 |
|
TCut jzbMC[] = { give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"), give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg") }; |
2171 |
|
dout << "_________________________________________________________" << endl; |
2172 |
|
dout << "Table for JZB> " << jzb_cuts[ijzb] << endl; |
2173 |
< |
for(int isample=0;isample<(allsamples.collection).size();isample++) { |
2173 |
> |
for(int isample=0;isample<(int)(allsamples.collection).size();isample++) { |
2174 |
|
if(!(allsamples.collection)[isample].is_data) dout << (allsamples.collection)[isample].samplename << " & "; |
2175 |
|
else dout << "Sample & "; |
2176 |
|
for(int iregion=0;iregion<nRegions;iregion++) { |
2429 |
|
|
2430 |
|
void draw_ttbar_and_zjets_shape(string mcjzb, string datajzb) { |
2431 |
|
int all_leptons=-1; |
1818 |
– |
int electrons_only=0; |
1819 |
– |
int mu_only=1; |
1820 |
– |
int twojetswith50gev=1; |
2432 |
|
int threejetswith30gev=0; |
2433 |
|
/* |
2434 |
+ |
int twojetswith50gev=1; |
2435 |
+ |
int electrons_only=0; |
2436 |
+ |
int mu_only=1; |
2437 |
+ |
|
2438 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,twojetswith50gev); |
2439 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev); |
2440 |
|
|
2448 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev,true); |
2449 |
|
} |
2450 |
|
|
2451 |
< |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
1837 |
< |
//first: colorful plots |
2451 |
> |
float find_one_correction_factor(string FindKeyword, bool dodata, TCut SpecialCut, string SaveAs) { |
2452 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
2453 |
|
cancorr->SetLogz(); |
2454 |
|
cancorr->SetRightMargin(0.13); |
2455 |
< |
flag_this_change(__FUNCTION__,__LINE__,false);//PlottingSetup::RestrictToMassPeak |
2456 |
< |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"); |
2455 |
> |
TCut zptforresponsepresentation(Restrmasscut&&SpecialCut&&passtrig); |
2456 |
> |
|
2457 |
> |
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
2458 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
2459 |
< |
(allsamples.collection)[allsamples.FindSample("Data")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotd",zptforresponsepresentation); |
2459 |
> |
niceresponseplotd->Sumw2(); |
2460 |
> |
TH2F* emuResponse = (TH2F*)niceresponseplotd->Clone("emuResponse"); |
2461 |
> |
vector<int> SampleIndices=allsamples.FindSample(FindKeyword); |
2462 |
> |
for(int iSample=0;iSample<(int)SampleIndices.size();iSample++) { |
2463 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data && !dodata) continue; |
2464 |
> |
if((allsamples.collection)[SampleIndices[iSample]].is_data ==false && dodata) continue; |
2465 |
> |
|
2466 |
> |
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << " for " << FindKeyword << endl; |
2467 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",(zptforresponsepresentation&&cutOSSF)*cutWeight); |
2468 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+emuResponse",(zptforresponsepresentation&&cutOSOF)*cutWeight); |
2469 |
> |
} |
2470 |
> |
niceresponseplotd->Add(emuResponse,-1); |
2471 |
> |
|
2472 |
|
niceresponseplotd->SetStats(0); |
2473 |
|
niceresponseplotd->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2474 |
|
niceresponseplotd->GetYaxis()->SetTitle("Response"); |
2476 |
|
niceresponseplotd->GetYaxis()->CenterTitle(); |
2477 |
|
niceresponseplotd->Draw("COLZ"); |
2478 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
2479 |
+ |
profd->Rebin(2); |
2480 |
|
profd->SetMarkerSize(DataMarkerSize); |
2481 |
< |
profd->Fit("pol0","","same,e1",30,400); |
2481 |
> |
profd->Fit("pol0","","same,e1",100,400); |
2482 |
|
DrawPrelim(); |
2483 |
< |
TText* title = write_text(0.5,0.7,"Data"); |
2483 |
> |
string stitle="Data"; |
2484 |
> |
if(!Contains(FindKeyword,"Data")) stitle="MC"; |
2485 |
> |
TText* title = write_text(0.5,0.7,stitle.c_str()); |
2486 |
|
title->SetTextAlign(12); |
2487 |
|
title->Draw(); |
2488 |
|
TF1 *datapol=(TF1*)profd->GetFunction("pol0"); |
2489 |
< |
float datacorrection=datapol->GetParameter(0); |
2490 |
< |
stringstream dataresstring; |
2491 |
< |
dataresstring<<"Response: "<<std::setprecision(2)<<100*datacorrection<<" %"; |
2492 |
< |
TText* restitle = write_text(0.5,0.65,dataresstring.str()); |
2489 |
> |
float correction=datapol->GetParameter(0); |
2490 |
> |
stringstream resstring; |
2491 |
> |
resstring<<"Response: "<<std::setprecision(2)<<100*correction<<" %"; |
2492 |
> |
TText* restitle = write_text(0.5,0.65,resstring.str()); |
2493 |
|
restitle->SetTextAlign(12); |
2494 |
|
restitle->SetTextSize(0.03); |
2495 |
|
restitle->Draw(); |
2496 |
< |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_Data"); |
2497 |
< |
|
2498 |
< |
TH2F *niceresponseplotm = new TH2F("niceresponseplotm","",100,0,600,100,0,5); |
2499 |
< |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation); |
2500 |
< |
niceresponseplotm->SetStats(0); |
2501 |
< |
niceresponseplotm->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2502 |
< |
niceresponseplotm->GetYaxis()->SetTitle("Response"); |
2503 |
< |
niceresponseplotm->GetXaxis()->CenterTitle(); |
1874 |
< |
niceresponseplotm->GetYaxis()->CenterTitle(); |
1875 |
< |
niceresponseplotm->Draw("COLZ"); |
1876 |
< |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt",zptforresponsepresentation,"PROF,same"); |
1877 |
< |
TProfile * profm = (TProfile*)niceresponseplotm->ProfileX(); |
1878 |
< |
profm->SetMarkerSize(DataMarkerSize); |
1879 |
< |
profm->Fit("pol0","","same,e1",30,400); |
1880 |
< |
DrawMCPrelim(); |
1881 |
< |
title = write_text(0.5,0.7,"MC simulation"); |
1882 |
< |
title->SetTextAlign(12); |
1883 |
< |
title->Draw(); |
1884 |
< |
TF1 *mcpol=(TF1*)profm->GetFunction("pol0"); |
1885 |
< |
float mccorrection=mcpol->GetParameter(0); |
1886 |
< |
stringstream mcresstring; |
1887 |
< |
mcresstring<<"Response: "<<std::setprecision(2)<<100*mccorrection<<" %"; |
1888 |
< |
TText* mcrestitle = write_text(0.5,0.65,mcresstring.str()); |
1889 |
< |
mcrestitle->SetTextAlign(12); |
1890 |
< |
mcrestitle->SetTextSize(0.03); |
1891 |
< |
mcrestitle->Draw(); |
1892 |
< |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_MC"); |
2496 |
> |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_New_"+SaveAs); |
2497 |
> |
delete cancorr; |
2498 |
> |
delete niceresponseplotd; |
2499 |
> |
delete profd; |
2500 |
> |
return correction; |
2501 |
> |
} |
2502 |
> |
|
2503 |
> |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
2504 |
|
|
2505 |
+ |
dout << "Computing response corrections: " << endl; |
2506 |
+ |
//Step 1 : Get results |
2507 |
+ |
float datacorrection=find_one_correction_factor("Data",true,"","Data"); |
2508 |
+ |
float mccorrection=find_one_correction_factor("DY",false,"","MC"); |
2509 |
+ |
|
2510 |
+ |
float dataEEcorrection=find_one_correction_factor("Data",true,"id1==0","Data_ee"); |
2511 |
+ |
float mcEEcorrection=find_one_correction_factor("DY",false,"id1==0","MC_ee"); |
2512 |
+ |
|
2513 |
+ |
float dataMMcorrection=find_one_correction_factor("Data",true,"id1==1","Data_mm"); |
2514 |
+ |
float mcMMcorrection=find_one_correction_factor("DY",false,"id1==1","MC_mm"); |
2515 |
+ |
|
2516 |
+ |
cout << "Corrections : " << endl; |
2517 |
+ |
cout << " Data : " << datacorrection << endl; |
2518 |
+ |
cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
2519 |
+ |
cout << " MC : " << mccorrection << endl; |
2520 |
+ |
cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
2521 |
|
|
2522 |
< |
//Step 2: Getting the result |
1896 |
< |
// TCut zptcutforresponse("pt>30&&pt<300&&TMath::Abs(91.2-mll)<20&&id1==id2&&(ch1*ch2<0)"); |
2522 |
> |
//Step 2: Processing the result and making it into something useful :-) |
2523 |
|
stringstream jzbvardatas; |
2524 |
< |
if(datacorrection>1) jzbvardatas<<"(jzb[1]-"<<datacorrection-1<<"*pt)"; |
2525 |
< |
if(datacorrection<1) jzbvardatas<<"(jzb[1]+"<<1-datacorrection<<"*pt)"; |
2524 |
> |
jzbvardatas << "("; |
2525 |
> |
|
2526 |
> |
if(dataEEcorrection>=1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]-" << dataEEcorrection-1 << "*pt))"; |
2527 |
> |
if(dataEEcorrection<1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-dataEEcorrection << "*pt))"; |
2528 |
> |
|
2529 |
> |
if(dataMMcorrection>=1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]-" << dataMMcorrection-1 << "*pt))"; |
2530 |
> |
if(dataMMcorrection<1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-dataMMcorrection << "*pt))"; |
2531 |
> |
|
2532 |
> |
float averagecorrection=(dataMMcorrection+dataEEcorrection)/2.0; |
2533 |
> |
|
2534 |
> |
if(datacorrection>=1) jzbvardatas<<"+((id1!=id2)*(jzb[1]-" << datacorrection-1 << "*pt))"; |
2535 |
> |
if(datacorrection<1) jzbvardatas<<"+((id1!=id2)*(jzb[1]+" << 1-datacorrection << "*pt))"; |
2536 |
> |
|
2537 |
> |
jzbvardatas << ")"; |
2538 |
|
jzbvardata=jzbvardatas.str(); |
2539 |
+ |
|
2540 |
|
stringstream jzbvarmcs; |
2541 |
< |
if(mccorrection>1) jzbvarmcs<<"(jzb[1]-"<<mccorrection-1<<"*pt)"; |
2542 |
< |
if(mccorrection<1) jzbvarmcs<<"(jzb[1]+"<<1-mccorrection<<"*pt)"; |
2541 |
> |
jzbvarmcs << "("; |
2542 |
> |
|
2543 |
> |
if(mcEEcorrection>=1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]-" << mcEEcorrection-1 << "*pt))"; |
2544 |
> |
if(mcEEcorrection<1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-mcEEcorrection << "*pt))"; |
2545 |
> |
|
2546 |
> |
if(mcMMcorrection>=1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]-" << mcMMcorrection-1 << "*pt))"; |
2547 |
> |
if(mcMMcorrection<1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-mcMMcorrection << "*pt))"; |
2548 |
> |
|
2549 |
> |
float averagemccorrection=(mcMMcorrection+mcEEcorrection)/2.0; |
2550 |
> |
|
2551 |
> |
if(mccorrection>=1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]-" << mccorrection-1 << "*pt))"; |
2552 |
> |
if(mccorrection<1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]+" << 1-mccorrection << "*pt))"; |
2553 |
> |
|
2554 |
> |
jzbvarmcs << ")"; |
2555 |
|
jzbvarmc=jzbvarmcs.str(); |
2556 |
+ |
|
2557 |
|
dout << "JZB Z pt correction summary : " << endl; |
2558 |
|
dout << " Data: The response is " << datacorrection << " --> jzb variable is now : " << jzbvardata << endl; |
2559 |
|
dout << " MC : The response is " << mccorrection << " --> jzb variable is now : " << jzbvarmc << endl; |
2560 |
+ |
|
2561 |
|
} |
2562 |
|
|
2563 |
|
void pick_up_events(string cut) { |
2565 |
|
allsamples.PickUpEvents(cut); |
2566 |
|
} |
2567 |
|
|
2568 |
< |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError) { |
2568 |
> |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) { |
2569 |
|
dout << "Saving configuration template!" << endl; |
2570 |
|
ofstream configfile; |
2571 |
|
configfile.open("../DistributedModelCalculations/last_configuration.C"); |
2585 |
|
configfile<<"string datajzb=\"datajzb_ERROR\";\n"; |
2586 |
|
configfile<<"string mcjzb=\"mcjzb_ERROR\";\n"; |
2587 |
|
configfile<<"vector<float>jzb_cuts;\n"; |
2588 |
+ |
configfile<<"vector<float>jzb_shape_limit_bins;\n"; |
2589 |
|
configfile<<"float MCPeakError=-999;\n"; |
2590 |
+ |
configfile<<"float DataPeakError=-999;\n"; |
2591 |
|
configfile<<"}\n\n"; |
2592 |
|
|
2593 |
|
configfile<<"void read_config() {\n"; |
2594 |
|
configfile<<"datajzb=\""<<datajzb<<"\";\n"; |
2595 |
|
configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n"; |
2596 |
< |
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n\n"; |
2597 |
< |
for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2596 |
> |
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n"; |
2597 |
> |
configfile<<"DataPeakError="<<DataPeakError<<";\n\n"; |
2598 |
> |
for(int i=0;i<(int)jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2599 |
|
configfile<<"\n\n"; |
2600 |
< |
for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2601 |
< |
for(int i=0;i<Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2602 |
< |
for(int i=0;i<Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2600 |
> |
for(int i=0;i<(int)Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2601 |
> |
for(int i=0;i<(int)Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2602 |
> |
for(int i=0;i<(int)Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2603 |
> |
configfile<<"\n\n"; |
2604 |
> |
for(int i=0;i<(int)flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2605 |
> |
for(int i=0;i<(int)flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2606 |
> |
for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2607 |
> |
for(int i=0;i<(int)jzb_shape_limit_bins.size();i++) configfile<<"jzb_shape_limit_bins.push_back("<<jzb_shape_limit_bins[i]<<"); // JZB shape bin boundary at " << jzb_shape_limit_bins[i] << "\n"; |
2608 |
|
configfile<<"\n\n"; |
1948 |
– |
for(int i=0;i<flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
1949 |
– |
for(int i=0;i<flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
1950 |
– |
for(int i=0;i<flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2609 |
|
configfile<<"\n\n"; |
2610 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
2611 |
+ |
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
2612 |
+ |
configfile<<"UseSidebandsForcJZB="<<UseSidebandsForcJZB<<";//tells us whether to use the sidebands or not\n"; |
2613 |
|
|
2614 |
|
configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n"; |
2615 |
|
|
2632 |
|
float max=histos[0]->GetMaximum(); |
2633 |
|
if(manualmin>=0) min=manualmin; |
2634 |
|
else { |
2635 |
< |
for(int i=1;i<histos.size();i++) { |
2635 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2636 |
|
float curmin=get_nonzero_minimum(histos[i]); |
2637 |
|
float curmax=histos[i]->GetMaximum(); |
2638 |
|
if(curmin<min) min=curmin; |
2643 |
|
histos[0]->Draw(drawoption.c_str()); |
2644 |
|
stringstream drawopt; |
2645 |
|
drawopt << drawoption << ",same"; |
2646 |
< |
for(int i=1;i<histos.size();i++) { |
2646 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2647 |
|
histos[i]->Draw(drawopt.str().c_str()); |
2648 |
|
} |
2649 |
|
} |
2652 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
2653 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
2654 |
|
TCut weightbackup=cutWeight; |
1995 |
– |
cutWeight="1.0"; |
1996 |
– |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2655 |
|
|
2656 |
+ |
bool doPURW=false; |
2657 |
+ |
|
2658 |
+ |
|
2659 |
+ |
if(!doPURW) { |
2660 |
+ |
dout << "Not doing PU reweighting for ttbar closure test" << endl; |
2661 |
+ |
cutWeight="1.0"; |
2662 |
+ |
// Do it without PU re-weighting |
2663 |
+ |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2664 |
+ |
stringstream resultsNoPU; |
2665 |
+ |
stringstream noPUdatajzb; |
2666 |
+ |
stringstream noPUmcjzb; |
2667 |
+ |
|
2668 |
+ |
stringstream mcjzbnoPU; |
2669 |
+ |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,true,noPUdatajzb,noPUmcjzb); |
2670 |
+ |
mcjzb = noPUmcjzb.str(); |
2671 |
+ |
} |
2672 |
+ |
|
2673 |
+ |
|
2674 |
+ |
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2675 |
|
|
2676 |
< |
TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2676 |
> |
TH1F *TZem = systsamples.Draw("TZem", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2677 |
|
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2678 |
|
TH1F *TSem; |
2679 |
|
TH1F *nTSem; |
2680 |
< |
TH1F *TZeemm = systsamples.Draw("TZeemm",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2680 |
> |
TH1F *TZeemm = systsamples.Draw("TZeemm", mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2681 |
|
TH1F *nTZeemm = systsamples.Draw("nTZeemm","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2682 |
|
TH1F *TSeemm; |
2683 |
|
TH1F *nTSeemm; |
2684 |
|
|
2685 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2686 |
< |
TSem = systsamples.Draw("TSem",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2687 |
< |
nTSem = systsamples.Draw("nTSem","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2688 |
< |
TSeemm = systsamples.Draw("TSeemm",mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2685 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2686 |
> |
TSem = systsamples.Draw("TSem", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2687 |
> |
nTSem = systsamples.Draw("nTSem", "-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2688 |
> |
TSeemm = systsamples.Draw("TSeemm", mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2689 |
|
nTSeemm = systsamples.Draw("nTSeemm","-"+mcjzb,binning,"JZB [GeV]","events",sidebandcut&&cutOSSF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2690 |
|
} |
2691 |
|
|
2692 |
|
TCanvas *tcan = new TCanvas("tcan","tcan"); |
2016 |
– |
|
2693 |
|
tcan->SetLogy(1); |
2694 |
|
|
2695 |
|
TZeemm->SetLineColor(kBlack); |
2698 |
|
TZem->SetMarkerColor(kRed); |
2699 |
|
|
2700 |
|
|
2701 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2701 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2702 |
|
TSem->SetLineColor(TColor::GetColor("#00A616")); |
2703 |
|
TSeemm->SetLineColor(kMagenta+2); |
2704 |
|
TSem->SetMarkerColor(TColor::GetColor("#00A616")); |
2708 |
|
} |
2709 |
|
|
2710 |
|
vector<TH1F*> histos; |
2711 |
+ |
TZem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2712 |
+ |
TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2713 |
|
histos.push_back(TZem); |
2714 |
|
histos.push_back(TZeemm); |
2715 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2715 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2716 |
> |
TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2717 |
> |
TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2718 |
|
histos.push_back(TSem); |
2719 |
|
histos.push_back(TSeemm); |
2720 |
|
} |
2721 |
< |
draw_all_ttbar_histos(tcan,histos,"histo",0.04); |
2721 |
> |
draw_all_ttbar_histos(tcan,histos,"histo",1); |
2722 |
|
|
2723 |
|
TLegend *leg = make_legend("MC t#bar{t}",0.6,0.65,false); |
2724 |
|
leg->AddEntry(TZeemm,"SFZP","l"); |
2725 |
|
leg->AddEntry(TZem,"OFZP","l"); |
2726 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2726 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2727 |
|
leg->AddEntry(TSeemm,"SFSB","l"); |
2728 |
|
leg->AddEntry(TSem,"OFSB","l"); |
2729 |
|
} |
2730 |
|
leg->Draw("same"); |
2731 |
|
DrawMCPrelim(simulatedlumi); |
2732 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison"); |
2053 |
– |
|
2733 |
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
2734 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
2735 |
< |
TH1F *TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2736 |
< |
TH1F *TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2735 |
> |
TH1F *TSeemmcopy; |
2736 |
> |
TH1F *TSemcopy; |
2737 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2738 |
> |
TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2739 |
> |
TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2740 |
> |
} |
2741 |
|
|
2742 |
|
TZem->Divide(TZeemm); |
2743 |
|
TZem->SetMarkerStyle(21); |
2744 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2744 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2745 |
|
TSem->Divide(TZeemm); |
2746 |
|
TSeemm->Divide(TZeemm); |
2747 |
|
TSem->SetMarkerStyle(24); |
2748 |
|
TSeemm->SetMarkerStyle(32); |
2749 |
< |
} |
2749 |
> |
} |
2750 |
|
|
2751 |
|
tcan->SetLogy(0); |
2752 |
|
TZem->GetYaxis()->SetRangeUser(0,2.5); |
2753 |
|
TZem->GetYaxis()->SetTitle("ratio"); |
2754 |
|
TZem->Draw(); |
2755 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2755 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2756 |
|
TSem->Draw("same"); |
2757 |
|
TSeemm->Draw("same"); |
2758 |
|
} |
2759 |
|
|
2760 |
< |
float linepos=0.25; |
2761 |
< |
if(PlottingSetup::RestrictToMassPeak) linepos=0.25; |
2760 |
> |
float linepos=emuncertONPEAK; |
2761 |
> |
if(!PlottingSetup::RestrictToMassPeak) linepos=emuncertOFFPEAK; |
2762 |
> |
|
2763 |
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2764 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2765 |
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2766 |
|
|
2767 |
+ |
/*write_warning(__FUNCTION__,"These two lines are to be removed!"); |
2768 |
+ |
TLine *topalt = new TLine(binning[0],1.0+0.1,binning[binning.size()-1],1.0+0.1); |
2769 |
+ |
TLine *bottomalt = new TLine(binning[0],1.0-0.1,binning[binning.size()-1],1.0-0.1); |
2770 |
+ |
topalt->SetLineColor(kRed);topalt->SetLineStyle(3); |
2771 |
+ |
bottomalt->SetLineColor(kRed);bottomalt->SetLineStyle(3); |
2772 |
+ |
topalt->Draw("same");bottomalt->Draw("same");*/ |
2773 |
+ |
|
2774 |
+ |
|
2775 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
2776 |
|
bottom->SetLineColor(kBlue);bottom->SetLineStyle(2); |
2777 |
|
center->SetLineColor(kBlue); |
2782 |
|
|
2783 |
|
TLegend *leg2 = make_legend("MC t#bar{t}",0.55,0.75,false); |
2784 |
|
leg2->AddEntry(TZem,"OFZP / SFZP","ple"); |
2785 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2785 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2786 |
|
leg2->AddEntry(TSeemm,"SFSB / SFZP","ple"); |
2787 |
|
leg2->AddEntry(TSem,"OFSB / SFZP","ple"); |
2788 |
|
} |
2795 |
|
DrawMCPrelim(simulatedlumi); |
2796 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio"); |
2797 |
|
|
2798 |
+ |
if (0) { // Turn this off: we don't need this |
2799 |
|
|
2800 |
+ |
///-------------- second part: only look at the quantity we actually care about! |
2801 |
+ |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
2802 |
+ |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
2803 |
+ |
rightsfzp->Add(leftsfzp,-1); |
2804 |
+ |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
2805 |
+ |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
2806 |
+ |
rightofzp->Add(leftofzp,-1); |
2807 |
+ |
TH1F *leftofsb; |
2808 |
+ |
TH1F *rightofsb; |
2809 |
+ |
TH1F *leftsfsb; |
2810 |
+ |
TH1F *rightsfsb; |
2811 |
+ |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2812 |
+ |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
2813 |
+ |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
2814 |
+ |
rightofsb->Add(leftofsb,-1); |
2815 |
+ |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
2816 |
+ |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
2817 |
+ |
rightsfsb->Add(leftsfsb,-1); |
2818 |
+ |
} |
2819 |
|
|
2820 |
< |
///-------------- second part: only look at the quantity we actually care about! |
2821 |
< |
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
2822 |
< |
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
2823 |
< |
rightsfzp->Add(leftsfzp,-1); |
2824 |
< |
TH1F *leftofzp = (TH1F*)nTZem->Clone("leftofzp"); |
2825 |
< |
TH1F *rightofzp = (TH1F*)TZemcopy->Clone("rightofzp"); |
2826 |
< |
rightofzp->Add(leftofzp,-1); |
2827 |
< |
TH1F *leftofsb; |
2828 |
< |
TH1F *rightofsb; |
2829 |
< |
TH1F *leftsfsb; |
2118 |
< |
TH1F *rightsfsb; |
2119 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2120 |
< |
leftofsb = (TH1F*)nTSem->Clone("leftofsb"); |
2121 |
< |
rightofsb = (TH1F*)TSemcopy->Clone("rightofsb"); |
2122 |
< |
rightofsb->Add(leftofsb,-1); |
2123 |
< |
leftsfsb = (TH1F*)nTSeemm->Clone("leftsfsb"); |
2124 |
< |
rightsfsb = (TH1F*)TSeemmcopy->Clone("rightsfsb"); |
2125 |
< |
rightsfsb->Add(leftsfsb,-1); |
2126 |
< |
} |
2820 |
> |
tcan->SetLogy(1); |
2821 |
> |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
2822 |
> |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
2823 |
> |
rightsfzp->Draw("histo"); |
2824 |
> |
rightofzp->Draw("histo,same"); |
2825 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2826 |
> |
rightofsb->Draw("histo,same"); |
2827 |
> |
rightsfsb->Draw("histo,same"); |
2828 |
> |
} |
2829 |
> |
DrawMCPrelim(simulatedlumi); |
2830 |
|
|
2831 |
< |
tcan->SetLogy(1); |
2832 |
< |
rightsfzp->GetXaxis()->SetRangeUser(0,binning[binning.size()-1]); |
2833 |
< |
rightsfzp->GetYaxis()->SetTitle("#deltaJZB / 25 GeV"); |
2834 |
< |
rightsfzp->Draw("histo"); |
2835 |
< |
rightofzp->Draw("histo,same"); |
2836 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2837 |
< |
rightofsb->Draw("histo,same"); |
2838 |
< |
rightsfsb->Draw("histo,same"); |
2136 |
< |
} |
2137 |
< |
DrawMCPrelim(simulatedlumi); |
2831 |
> |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
2832 |
> |
legA->AddEntry(rightsfzp,"SFZP","l"); |
2833 |
> |
legA->AddEntry(rightofzp,"OFZP","l"); |
2834 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2835 |
> |
legA->AddEntry(rightofsb,"SFSB","l"); |
2836 |
> |
legA->AddEntry(rightsfsb,"OFSB","l"); |
2837 |
> |
} |
2838 |
> |
legA->Draw(); |
2839 |
|
|
2840 |
< |
TLegend *legA = make_legend("MC t#bar{t}",0.6,0.65,false); |
2140 |
< |
legA->AddEntry(rightsfzp,"SFZP","l"); |
2141 |
< |
legA->AddEntry(rightofzp,"OFZP","l"); |
2142 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2143 |
< |
legA->AddEntry(rightofsb,"SFSB","l"); |
2144 |
< |
legA->AddEntry(rightsfsb,"OFSB","l"); |
2145 |
< |
} |
2146 |
< |
legA->Draw(); |
2840 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
2841 |
|
|
2842 |
< |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison"); |
2842 |
> |
tcan->SetLogy(0); |
2843 |
> |
rightofzp->Divide(rightsfzp); |
2844 |
> |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
2845 |
> |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.5); |
2846 |
> |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
2847 |
> |
rightofzp->Draw(); |
2848 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2849 |
> |
rightofsb->Divide(rightsfzp); |
2850 |
> |
rightsfsb->Divide(rightsfzp); |
2851 |
> |
rightofsb->Draw("same"); |
2852 |
> |
rightsfsb->Draw("same"); |
2853 |
> |
} |
2854 |
|
|
2855 |
< |
tcan->SetLogy(0); |
2856 |
< |
rightofzp->Divide(rightsfzp); |
2857 |
< |
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
2858 |
< |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.0); |
2859 |
< |
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
2860 |
< |
rightofzp->Draw(); |
2861 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2862 |
< |
rightofsb->Divide(rightsfzp); |
2863 |
< |
rightsfsb->Divide(rightsfzp); |
2864 |
< |
rightofsb->Draw("same"); |
2865 |
< |
rightsfsb->Draw("same"); |
2866 |
< |
} |
2867 |
< |
|
2868 |
< |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2869 |
< |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
2870 |
< |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2871 |
< |
|
2872 |
< |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
2873 |
< |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
2874 |
< |
center2->SetLineColor(kBlue); |
2875 |
< |
|
2876 |
< |
top2->Draw("same"); |
2877 |
< |
center2->Draw("same"); |
2878 |
< |
bottom2->Draw("same"); |
2879 |
< |
|
2880 |
< |
rightofzp->SetMarkerStyle(21); |
2881 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2177 |
< |
rightofsb->SetMarkerStyle(24); |
2178 |
< |
rightsfsb->SetMarkerStyle(32); |
2179 |
< |
} |
2180 |
< |
|
2181 |
< |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
2182 |
< |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
2183 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2184 |
< |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
2185 |
< |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
2186 |
< |
} |
2187 |
< |
leg3->AddEntry(bottom,"syst. envelope","l"); |
2188 |
< |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
2189 |
< |
leg3->SetY1(0.65); |
2855 |
> |
TLine *top2 = new TLine(0.0,1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2856 |
> |
TLine *center2 = new TLine(0.0,1.0,binning[binning.size()-1],1.0); |
2857 |
> |
TLine *bottom2 = new TLine(0.0,1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2858 |
> |
|
2859 |
> |
top2->SetLineColor(kBlue);top2->SetLineStyle(2); |
2860 |
> |
bottom2->SetLineColor(kBlue);bottom2->SetLineStyle(2); |
2861 |
> |
center2->SetLineColor(kBlue); |
2862 |
> |
|
2863 |
> |
top2->Draw("same"); |
2864 |
> |
center2->Draw("same"); |
2865 |
> |
bottom2->Draw("same"); |
2866 |
> |
|
2867 |
> |
rightofzp->SetMarkerStyle(21); |
2868 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2869 |
> |
rightofsb->SetMarkerStyle(24); |
2870 |
> |
rightsfsb->SetMarkerStyle(32); |
2871 |
> |
} |
2872 |
> |
|
2873 |
> |
TLegend *leg3 = make_legend("MC t#bar{t}",0.55,0.75,false); |
2874 |
> |
leg3->AddEntry(rightofzp,"OFZP / SFZP","ple"); |
2875 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2876 |
> |
leg3->AddEntry(rightsfsb,"SFSB / SFZP","ple"); |
2877 |
> |
leg3->AddEntry(rightofsb,"OFSB / SFZP","ple"); |
2878 |
> |
} |
2879 |
> |
leg3->AddEntry(bottom,"syst. envelope","l"); |
2880 |
> |
leg3->SetX1(0.25);leg3->SetX2(0.6); |
2881 |
> |
leg3->SetY1(0.65); |
2882 |
|
|
2883 |
< |
leg3->Draw("same"); |
2883 |
> |
leg3->Draw("same"); |
2884 |
|
|
2885 |
< |
DrawMCPrelim(simulatedlumi); |
2886 |
< |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
2885 |
> |
DrawMCPrelim(simulatedlumi); |
2886 |
> |
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_deltajzb_comparison_ratio"); |
2887 |
> |
|
2888 |
> |
} |
2889 |
|
|
2890 |
|
delete TZem; |
2891 |
|
delete nTZem; |
2892 |
|
delete TZeemm; |
2893 |
|
delete nTZeemm; |
2894 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
2894 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
2895 |
|
delete TSem; |
2896 |
|
delete nTSem; |
2897 |
|
delete TSeemm; |
2904 |
|
|
2905 |
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) { |
2906 |
|
vector<float> nicer_binning; |
2907 |
< |
nicer_binning.push_back(-125); |
2907 |
> |
|
2908 |
> |
/* nicer_binning.push_back(-400); |
2909 |
> |
nicer_binning.push_back(-250); |
2910 |
> |
nicer_binning.push_back(-200); |
2911 |
> |
nicer_binning.push_back(-150); |
2912 |
> |
nicer_binning.push_back(-100); |
2913 |
> |
nicer_binning.push_back(-50); |
2914 |
> |
nicer_binning.push_back(-20); |
2915 |
> |
|
2916 |
> |
nicer_binning.push_back(0); |
2917 |
> |
nicer_binning.push_back(20); |
2918 |
> |
nicer_binning.push_back(50); |
2919 |
> |
nicer_binning.push_back(100); |
2920 |
> |
nicer_binning.push_back(150); |
2921 |
> |
nicer_binning.push_back(200); |
2922 |
> |
nicer_binning.push_back(250); |
2923 |
> |
nicer_binning.push_back(400);*/ |
2924 |
> |
|
2925 |
|
nicer_binning.push_back(-100); |
2215 |
– |
nicer_binning.push_back(-75); |
2926 |
|
nicer_binning.push_back(-50); |
2927 |
|
nicer_binning.push_back(-25); |
2928 |
|
nicer_binning.push_back(0); |
2932 |
|
nicer_binning.push_back(100); |
2933 |
|
nicer_binning.push_back(125); |
2934 |
|
nicer_binning.push_back(150); |
2935 |
< |
nicer_binning.push_back(175); |
2935 |
> |
//nicer_binning.push_back(175); |
2936 |
|
nicer_binning.push_back(200); |
2937 |
< |
nicer_binning.push_back(230); |
2938 |
< |
nicer_binning.push_back(280); |
2937 |
> |
nicer_binning.push_back(250); |
2938 |
> |
nicer_binning.push_back(300); |
2939 |
|
nicer_binning.push_back(400); |
2940 |
+ |
|
2941 |
|
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
2942 |
|
} |
2943 |
|
|
2944 |
|
|
2945 |
< |
void zjets_prediction_comparison() { |
2946 |
< |
// Do it without PU re-weighting |
2947 |
< |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2948 |
< |
stringstream resultsNoPU; |
2949 |
< |
|
2950 |
< |
stringstream mcjzbnoPU; |
2951 |
< |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,false); |
2952 |
< |
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2953 |
< |
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2945 |
> |
void zjets_prediction_comparison(string mcjzbWithPUa) { |
2946 |
> |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2947 |
> |
// zcan->SetLogy(1); |
2948 |
> |
TCut weightbackup=cutWeight; |
2949 |
> |
|
2950 |
> |
bool UsePURW=false; |
2951 |
> |
|
2952 |
> |
|
2953 |
> |
string mcjzb; |
2954 |
> |
if(UsePURW) { |
2955 |
> |
mcjzb=mcjzbWithPUa; |
2956 |
> |
} else { |
2957 |
> |
// Do it without PU re-weighting |
2958 |
> |
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2959 |
> |
stringstream resultsNoPU; |
2960 |
> |
stringstream noPUdatajzb; |
2961 |
> |
stringstream noPUmcjzb; |
2962 |
> |
|
2963 |
> |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,resultsNoPU,false,noPUdatajzb,noPUmcjzb); |
2964 |
> |
dout << "The peak corrected JZB expression for MC without pileup is : " << noPUmcjzb.str() << endl; |
2965 |
> |
|
2966 |
> |
mcjzb = noPUmcjzb.str(); |
2967 |
> |
|
2968 |
> |
cutWeight="1.0"; |
2969 |
> |
} |
2970 |
|
|
2971 |
< |
string mcjzb = mcjzbnoPU.str(); |
2972 |
< |
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl; |
2971 |
> |
|
2972 |
> |
vector<float> binning; |
2973 |
> |
binning.push_back(0); |
2974 |
> |
binning.push_back(10); |
2975 |
> |
binning.push_back(20); |
2976 |
> |
binning.push_back(40); |
2977 |
> |
binning.push_back(60); |
2978 |
> |
// binning.push_back(50); |
2979 |
> |
// binning.push_back(60); |
2980 |
> |
// binning.push_back(70); |
2981 |
> |
// binning.push_back(80); |
2982 |
> |
// binning.push_back(90); |
2983 |
> |
binning.push_back(100); |
2984 |
|
|
2247 |
– |
TCut weightbackup=cutWeight; |
2248 |
– |
cutWeight="1.0"; |
2249 |
– |
float sbg_min=0.; |
2250 |
– |
float sbg_max=100.; |
2251 |
– |
int sbg_nbins=5; |
2985 |
|
float simulatedlumi = luminosity;//in pb please - adjust to your likings |
2986 |
|
|
2987 |
|
TCut kPos((mcjzb+">0").c_str()); |
2988 |
|
TCut kNeg((mcjzb+"<0").c_str()); |
2989 |
|
string var( "abs("+mcjzb+")" ); |
2990 |
+ |
|
2991 |
+ |
TCut notTau("abs(genMID1)!=15"); |
2992 |
+ |
TCut ONLYTau("mll>20"); |
2993 |
+ |
|
2994 |
|
|
2995 |
< |
TCut kcut(cutmass&&cutOSSF&&"pfJetGoodNum>2"); |
2996 |
< |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2997 |
< |
kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2261 |
< |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2262 |
< |
kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2995 |
> |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2996 |
> |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets&¬Tau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2997 |
> |
|
2998 |
|
hJZBpos->SetLineColor(kBlack); |
2999 |
|
hJZBneg->SetLineColor(kRed); |
3000 |
|
|
3001 |
< |
Int_t nbins = 5; |
2267 |
< |
Float_t xmax = 100.; |
2268 |
< |
|
2269 |
< |
|
2270 |
< |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2271 |
< |
zcan->SetLogy(1); |
2272 |
< |
|
3001 |
> |
hJZBpos->SetMinimum(1.0); |
3002 |
|
hJZBpos->Draw("e1"); |
3003 |
|
hJZBneg->Draw("same,hist"); |
3004 |
|
hJZBpos->Draw("same,e1"); // So it's on top... |
3005 |
|
|
3006 |
< |
TLegend *leg = make_legend("MC Z+jets",0.55,0.75,false); |
3006 |
> |
TLegend *leg = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.55,0.75,false); |
3007 |
|
leg->AddEntry(hJZBpos,"Observed","pe"); |
3008 |
|
leg->AddEntry(hJZBneg,"Predicted","l"); |
3009 |
|
leg->Draw("same"); |
3010 |
|
DrawMCPrelim(simulatedlumi); |
3011 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction"); |
3011 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction"); |
3012 |
|
|
3013 |
|
TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio"); |
3014 |
|
hratio->Divide(hJZBneg); |
3015 |
|
|
3016 |
+ |
for(int i=1;i<=hJZBpos->GetNbinsX();i++) { |
3017 |
+ |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << " (ratio : " << hJZBpos->GetBinContent(i) / hJZBneg->GetBinContent(i) << endl; |
3018 |
+ |
} |
3019 |
+ |
|
3020 |
|
zcan->SetLogy(0); |
3021 |
< |
hratio->GetYaxis()->SetRangeUser(0,2.5); |
3021 |
> |
hratio->GetYaxis()->SetRangeUser(0,2.0); |
3022 |
|
hratio->GetYaxis()->SetTitle("Observed/Predicted"); |
3023 |
|
hratio->Draw("e1"); |
3024 |
|
|
3025 |
< |
TLine *top = new TLine(sbg_min,1.25,sbg_max,1.25); |
3026 |
< |
TLine *center = new TLine(sbg_min,1.0,sbg_max,1.0); |
3027 |
< |
TLine *bottom = new TLine(sbg_min,0.75,sbg_max,0.75); |
3025 |
> |
TLine *top = new TLine(binning[0],1.25,binning[binning.size()-1],1.25); |
3026 |
> |
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
3027 |
> |
TLine *bottom = new TLine(binning[0],0.75,binning[binning.size()-1],0.75); |
3028 |
|
|
3029 |
|
|
3030 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
3035 |
|
center->Draw("same"); |
3036 |
|
bottom->Draw("same"); |
3037 |
|
|
3038 |
< |
TLegend *leg2 = make_legend("MC Z+jets",0.25,0.75,false); |
3038 |
> |
TLegend *leg2 = make_legend("MC Z+jets #rightarrow ee,#mu#mu",0.25,0.75,false); |
3039 |
|
leg2->AddEntry(hratio,"obs / pred","pe"); |
3040 |
|
leg2->AddEntry(bottom,"syst. envelope","l"); |
3041 |
|
leg2->Draw("same"); |
3042 |
|
DrawMCPrelim(simulatedlumi); |
3043 |
< |
CompleteSave(zcan,"Systematics/zjets_prediction_ratio"); |
3043 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemm_prediction_ratio"); |
3044 |
> |
|
3045 |
> |
TCut reducedNJets(cutnJets); |
3046 |
> |
|
3047 |
> |
TH1F *TAUhJZBpos = systsamples.Draw("TAUhJZBpos",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3048 |
> |
TH1F *LcorrJZBeemm = systsamples.Draw("LcorrJZBeemm",var,binning, "JZB [GeV]", "events",cutmass&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3049 |
> |
TH1F *RcorrJZBem = systsamples.Draw("RcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3050 |
> |
TH1F *LcorrJZBem = systsamples.Draw("LcorrJZBem",var,binning, "JZB [GeV]", "events",cutmass&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3051 |
> |
|
3052 |
> |
TH1F *RcorrJZBSBem; |
3053 |
> |
TH1F *LcorrJZBSBem; |
3054 |
> |
TH1F *RcorrJZBSBeemm; |
3055 |
> |
TH1F *LcorrJZBSBeemm; |
3056 |
> |
|
3057 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3058 |
> |
RcorrJZBSBem = systsamples.Draw("RcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3059 |
> |
LcorrJZBSBem = systsamples.Draw("LcorrJZBSBem",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSOF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3060 |
> |
RcorrJZBSBeemm = systsamples.Draw("RcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3061 |
> |
LcorrJZBSBeemm = systsamples.Draw("LcorrJZBSBeemm",var,binning, "JZB [GeV]", "events",sidebandcut&&cutOSSF&&reducedNJets&&ONLYTau&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
3062 |
> |
} |
3063 |
> |
|
3064 |
> |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
3065 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3066 |
> |
Bpred->Add(RcorrJZBem,1.0/3.); |
3067 |
> |
Bpred->Add(LcorrJZBem,-1.0/3.); |
3068 |
> |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3069 |
> |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
3070 |
> |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
3071 |
> |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
3072 |
> |
} else { |
3073 |
> |
Bpred->Add(RcorrJZBem,1.0); |
3074 |
> |
Bpred->Add(LcorrJZBem,-1.0); |
3075 |
> |
} |
3076 |
> |
|
3077 |
> |
Bpred->SetLineColor(kRed); |
3078 |
> |
|
3079 |
> |
TAUhJZBpos->SetLineColor(kBlack); |
3080 |
> |
Bpred->SetLineColor(kRed); |
3081 |
> |
|
3082 |
> |
TAUhJZBpos->SetMinimum(1.0); |
3083 |
> |
TAUhJZBpos->Draw("e1"); |
3084 |
> |
Bpred->Draw("same,hist"); |
3085 |
> |
TAUhJZBpos->Draw("same,e1"); |
3086 |
> |
|
3087 |
> |
TLegend *TAUleg = make_legend("MC Z+jets #rightarrow ee,#mu#mu,#tau#tau",0.55,0.75,false); |
3088 |
> |
TAUleg->AddEntry(TAUhJZBpos,"Observed","pe"); |
3089 |
> |
TAUleg->AddEntry(Bpred,"Predicted","l"); |
3090 |
> |
TAUleg->Draw("same"); |
3091 |
> |
DrawMCPrelim(simulatedlumi); |
3092 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction"); |
3093 |
> |
|
3094 |
> |
TH1F* TAUhratio = (TH1F*)TAUhJZBpos->Clone("TAUhratio"); |
3095 |
> |
TAUhratio->Divide(Bpred); |
3096 |
> |
|
3097 |
> |
for(int i=1;i<=TAUhJZBpos->GetNbinsX();i++) { |
3098 |
> |
cout << "ee/mm/tautau observed: " << TAUhJZBpos->GetBinContent(i) << " vs predicted : " << Bpred->GetBinContent(i) << " (ratio : " << TAUhJZBpos->GetBinContent(i) / Bpred->GetBinContent(i) << endl; |
3099 |
> |
} |
3100 |
> |
|
3101 |
> |
zcan->SetLogy(0); |
3102 |
> |
TAUhratio->GetYaxis()->SetRangeUser(0,2.5); |
3103 |
> |
TAUhratio->GetYaxis()->SetTitle("Observed/Predicted"); |
3104 |
> |
TAUhratio->Draw("e1"); |
3105 |
> |
|
3106 |
> |
top->Draw("same"); |
3107 |
> |
center->Draw("same"); |
3108 |
> |
bottom->Draw("same"); |
3109 |
> |
|
3110 |
> |
TLegend *TAUleg2 = make_legend("MC Z+jets #rightarrow #tau#tau",0.25,0.75,false); |
3111 |
> |
TAUleg2->AddEntry(TAUhratio,"obs / pred","pe"); |
3112 |
> |
TAUleg2->AddEntry(bottom,"syst. envelope","l"); |
3113 |
> |
TAUleg2->Draw("same"); |
3114 |
> |
DrawMCPrelim(simulatedlumi); |
3115 |
> |
CompleteSave(zcan,"Systematics/ZJets/zjets_eemumutautau_prediction_ratio"); |
3116 |
> |
|
3117 |
> |
delete Bpred; |
3118 |
> |
delete TAUhJZBpos; |
3119 |
> |
delete LcorrJZBeemm; |
3120 |
> |
delete RcorrJZBem; |
3121 |
> |
delete LcorrJZBem; |
3122 |
> |
|
3123 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3124 |
> |
delete RcorrJZBSBem; |
3125 |
> |
delete LcorrJZBSBem; |
3126 |
> |
delete RcorrJZBSBeemm; |
3127 |
> |
delete LcorrJZBSBeemm; |
3128 |
> |
} |
3129 |
> |
|
3130 |
|
|
3131 |
|
delete zcan; |
3132 |
|
cutWeight=weightbackup; |
3152 |
|
tout << "\\begin{tabular}{l|cc}" << endl; |
3153 |
|
tout << "\\hline" << endl; |
3154 |
|
tout << "& {\\OFZP} & {\\OFSB} \\\\\\hline" << endl; |
3155 |
< |
tout << "\\#(events) & "<<OFSB<<" & "<<OFZP<<"\\\\ \\hline" << endl; |
3155 |
> |
tout << "\\#(events) & "<<OFZP<<" & "<<OFSB<<"\\\\ \\hline" << endl; |
3156 |
|
tout << "\\end{tabular}" << endl; |
3157 |
|
tout << "\\end{center}" << endl; |
3158 |
|
tout << "\\end{table}" << endl; |
3170 |
|
|
3171 |
|
TCanvas *cannie = new TCanvas("cannie","cannie"); |
3172 |
|
|
3173 |
< |
for(int icut=0;icut<jzb_cuts.size();icut++) { |
3173 |
> |
for(int icut=0;icut<(int)jzb_cuts.size();icut++) { |
3174 |
|
float currcut=jzb_cuts[icut]; |
3175 |
|
int nbins=1;float low=currcut; |
3176 |
|
vector<int> mysample; |
3185 |
|
TH1F *RcorrJZBSBeemm; |
3186 |
|
TH1F *LcorrJZBSBeemm; |
3187 |
|
|
3188 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3188 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3189 |
|
RcorrJZBSBem = coll.Draw("RcorrJZBSBem",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
3190 |
|
LcorrJZBSBem = coll.Draw("LcorrJZBSBem",("-("+jzbexpr+")").c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity, mysample); |
3191 |
|
RcorrJZBSBeemm = coll.Draw("RcorrJZBSBeemm",jzbexpr.c_str(),nbins,low,14000, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity, mysample); |
3193 |
|
} |
3194 |
|
|
3195 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
3196 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3196 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3197 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
3198 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
3199 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3229 |
|
//prediction part |
3230 |
|
if(is_data) cout << "Data prediction & "; |
3231 |
|
if(subselection!="none") cout << subselection << " prediction &"; |
3232 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
3232 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
3233 |
|
|
3234 |
|
cout << endl; |
3235 |
|
//observation part |
3236 |
|
if(is_data) cout << "Data observation & "; |
3237 |
|
if(subselection!="none") cout << subselection << " observation &"; |
3238 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
3238 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
3239 |
|
cout << endl; |
3240 |
|
cout << "_________________________________________________________________" << endl; |
3241 |
|
delete cannie; |
3270 |
|
int nbins = sizeof(xbins)/sizeof(float)-1; |
3271 |
|
int markers[] = { 20, 26, 21, 24, 22, 25, 28 }; |
3272 |
|
|
3273 |
< |
TH1F* heff = new TH1F("heff", "JZB eff ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
3274 |
< |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
3275 |
< |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
3273 |
> |
|
3274 |
> |
TH1F* heff = new TH1F("heff", "JZB eff ; generator JZB [GeV]; efficiency",nbins,xbins); |
3275 |
> |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator JZB [GeV]; efficiency",nbins,xbins); |
3276 |
> |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator JZB [GeV]; efficiency",nbins,xbins); |
3277 |
|
|
3278 |
|
TCut kgen(genMassCut&&"genZPt>0&&genNjets>2&&abs(genMID)==23"&&cutOSSF); |
3279 |
|
TCut kreco(cutmass); |
3289 |
|
TCanvas *can = new TCanvas("can","Canvas for JZB Efficiency",600,600); |
3290 |
|
can->SetGridx(1); |
3291 |
|
can->SetGridy(1); |
3292 |
+ |
can->SetLeftMargin(0.16); |
3293 |
+ |
can->SetRightMargin(0.05); |
3294 |
|
TLegend *leg = make_legend("",0.6,0.2,false,0.89,0.5); |
3295 |
+ |
leg->SetBorderSize(1); |
3296 |
+ |
leg->SetLineColor(kBlack); |
3297 |
+ |
leg->SetTextFont(62); |
3298 |
|
|
3299 |
< |
|
2475 |
< |
|
2476 |
< |
for ( int icut=0; icut<jzb_bins.size(); ++icut ) { |
3299 |
> |
for ( int icut=0; icut<(int)jzb_bins.size(); ++icut ) { |
3300 |
|
|
3301 |
|
ostringstream selection; |
3302 |
|
selection << mcjzb << ">" << jzb_bins[icut]; |
3312 |
|
} |
3313 |
|
|
3314 |
|
heff->GetXaxis()->SetRangeUser(min, max); |
3315 |
+ |
// heff->GetXaxis()->SetLabelSize(0.05); // paper style. overruled. |
3316 |
+ |
// heff->GetYaxis()->SetLabelSize(0.05); // paper style. overruled. |
3317 |
+ |
// heff->GetXaxis()->SetTitleSize(0.06); // paper style. overruled. |
3318 |
+ |
// heff->GetYaxis()->SetTitleSize(0.06); // paper style. overruled. |
3319 |
|
heff->SetMarkerStyle(markers[icut]); |
3320 |
|
heff->Fit("func","Q+","same"); |
3321 |
|
|
3327 |
|
|
3328 |
|
// Store plot |
3329 |
|
TH1F* h = (TH1F*)heff->Clone(hname); |
3330 |
+ |
h->SetNdivisions(505,"X"); |
3331 |
|
if ( icut) h->Draw("same"); |
3332 |
|
else h->Draw(); |
3333 |
|
char htitle[256]; sprintf(htitle,"JZB > %3.0f GeV", jzb_bins[icut]); |
3348 |
|
// Calls the above function for each signal sample |
3349 |
|
void plot_jzb_sel_eff(string mcjzb, samplecollection &signalsamples, vector<float> bins ) |
3350 |
|
{ |
3351 |
< |
for (int isignal=0; isignal<signalsamples.collection.size();isignal++) { |
3351 |
> |
for (int isignal=0; isignal<(int)signalsamples.collection.size();isignal++) { |
3352 |
|
dout << "JZB selection efficiency curve: " << std::endl; |
3353 |
|
JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples |
3354 |
|
} |
3391 |
|
TH1F *RcorrJZBSBeemm; |
3392 |
|
TH1F *LcorrJZBSBeemm; |
3393 |
|
|
3394 |
< |
TH1F *RcorrJZBeemmNoS; |
3394 |
> |
// TH1F *RcorrJZBeemmNoS; |
3395 |
|
|
3396 |
|
//these are for the ratio |
3397 |
|
TH1F *JRcorrJZBeemm = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3404 |
|
TH1F *JRcorrJZBSBeemm; |
3405 |
|
TH1F *JLcorrJZBSBeemm; |
3406 |
|
|
3407 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3407 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3408 |
|
RcorrJZBSBem = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3409 |
|
LcorrJZBSBem = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3410 |
|
RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3425 |
|
|
3426 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
3427 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
3428 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3428 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3429 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
3430 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
3431 |
|
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3475 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
3476 |
|
string ytitle("ratio"); |
3477 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
3478 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,use_data!=1,ytitle); |
3478 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,false,ytitle); |
3479 |
|
|
3480 |
|
TH1F *allevents = qcdsamples.Draw("allevents","pfJetGoodNum",1,0,100, "internal code", "events", "" ,mc, luminosity); |
3481 |
|
TH1F *ossf = qcdsamples.Draw("ossf","pfJetGoodNum",1,0,100, "internal code", "events", cutOSSF ,mc, luminosity); |
3495 |
|
dout << "______________________________________________" << endl; |
3496 |
|
dout << "How QCD shows up in the different regions: " << endl; |
3497 |
|
dout << "OSSF: " << endl; |
3498 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3498 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3499 |
|
dout << " Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
3500 |
|
dout << " sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl; |
3501 |
|
} else { |
3502 |
|
dout << " " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
3503 |
|
} |
3504 |
|
dout << "OSOF: " << endl; |
3505 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3505 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3506 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
3507 |
|
dout << " sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl; |
3508 |
|
} else { |
3509 |
|
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
3510 |
|
} |
3511 |
|
dout << "Therefore: " << endl; |
3512 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3512 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3513 |
|
dout << " Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) "; |
3514 |
|
dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) "; |
3515 |
|
dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) "; |
3522 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral() << endl; |
3523 |
|
|
3524 |
|
dout << endl; |
3525 |
< |
for(int i=0;i<bins.size();i++) { |
3525 |
> |
for(int i=0;i<(int)bins.size();i++) { |
3526 |
|
dout << " JZB > " << bins[i] << " : " << endl; |
3527 |
|
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
3528 |
< |
if(PlottingSetup::RestrictToMassPeak) { |
3528 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB) { |
3529 |
|
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; |
3530 |
|
} else { |
3531 |
|
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; |
3539 |
|
if(LcorrJZBem) delete LcorrJZBem; |
3540 |
|
if(RcorrJZBeemm) delete RcorrJZBeemm; |
3541 |
|
if(LcorrJZBeemm) delete LcorrJZBeemm; |
3542 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem; |
3543 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem; |
3544 |
< |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
3545 |
< |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
3542 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBem) delete RcorrJZBSBem; |
3543 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBem) delete LcorrJZBSBem; |
3544 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
3545 |
> |
if(PlottingSetup::RestrictToMassPeak&&PlottingSetup::UseSidebandsForcJZB&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
3546 |
> |
} |
3547 |
> |
|
3548 |
> |
void check_ptsanity() { |
3549 |
> |
TCanvas *ptsancan = new TCanvas("ptsancan","ptsancan",600,1800); |
3550 |
> |
TH1F *individualpt1histos[allsamples.collection.size()]; |
3551 |
> |
TH1F *individualpt2histos[allsamples.collection.size()]; |
3552 |
> |
TH1F *fpt1 = new TH1F("fpt1","fpt1",50,0,50); |
3553 |
> |
fpt1->GetYaxis()->SetRangeUser(0,1); |
3554 |
> |
fpt1->GetXaxis()->SetTitle("p_{T,1}"); |
3555 |
> |
fpt1->GetXaxis()->CenterTitle(); |
3556 |
> |
|
3557 |
> |
TH1F *fpt2 = new TH1F("fpt2","fpt2",50,0,50); |
3558 |
> |
fpt2->GetXaxis()->SetTitle("p_{T,2}"); |
3559 |
> |
fpt2->GetXaxis()->CenterTitle(); |
3560 |
> |
|
3561 |
> |
ptsancan->Divide(1,3); |
3562 |
> |
ptsancan->cd(1); |
3563 |
> |
float maxpt1entry=0; |
3564 |
> |
float maxpt2entry=0; |
3565 |
> |
|
3566 |
> |
TLegend *leg = make_legend(); |
3567 |
> |
leg->SetX1(0.0); |
3568 |
> |
leg->SetY1(0.0); |
3569 |
> |
leg->SetX2(1.0); |
3570 |
> |
leg->SetY2(1.0); |
3571 |
> |
|
3572 |
> |
|
3573 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3574 |
> |
string nowname=(allsamples.collection)[isample].filename; |
3575 |
> |
cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl; |
3576 |
> |
individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
3577 |
> |
individualpt2histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt2",50,0,50, "p_{T,2}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
3578 |
> |
individualpt1histos[isample]->SetLineColor(isample+1); |
3579 |
> |
individualpt2histos[isample]->SetLineColor(isample+1); |
3580 |
> |
float currmaxpt1entry=individualpt1histos[isample]->GetMaximum()/individualpt1histos[isample]->Integral(); |
3581 |
> |
float currmaxpt2entry=individualpt2histos[isample]->GetMaximum()/individualpt2histos[isample]->Integral(); |
3582 |
> |
cout << " pt 1 histo contains; " << individualpt1histos[isample]->Integral() << endl; |
3583 |
> |
cout << " pt 2 histo contains; " << individualpt2histos[isample]->Integral() << endl; |
3584 |
> |
if(currmaxpt1entry>maxpt1entry)maxpt1entry=currmaxpt1entry; |
3585 |
> |
if(currmaxpt2entry>maxpt2entry)maxpt2entry=currmaxpt2entry; |
3586 |
> |
leg->AddEntry(individualpt2histos[isample],((allsamples.collection)[isample].filename).c_str(),"f"); |
3587 |
> |
} |
3588 |
> |
|
3589 |
> |
fpt1->GetYaxis()->SetRangeUser(0,maxpt1entry); |
3590 |
> |
fpt2->GetYaxis()->SetRangeUser(0,maxpt2entry); |
3591 |
> |
|
3592 |
> |
ptsancan->cd(1); |
3593 |
> |
fpt1->Draw(); |
3594 |
> |
ptsancan->cd(2); |
3595 |
> |
fpt2->Draw(); |
3596 |
> |
|
3597 |
> |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3598 |
> |
ptsancan->cd(1); |
3599 |
> |
individualpt1histos[isample]->DrawNormalized("same,histo"); |
3600 |
> |
ptsancan->cd(2); |
3601 |
> |
individualpt2histos[isample]->DrawNormalized("same,histo"); |
3602 |
> |
} |
3603 |
> |
ptsancan->cd(3); |
3604 |
> |
leg->Draw(); |
3605 |
> |
CompleteSave(ptsancan,"PtSanityCheck"); |
3606 |
> |
|
3607 |
> |
delete ptsancan; |
3608 |
> |
} |
3609 |
> |
|
3610 |
> |
void do_mlls_plot(string mcjzb) { |
3611 |
> |
cout << "At this point we'd plot the mll distribution" << endl; |
3612 |
> |
TCanvas *sigcan = new TCanvas("sigcan","sigcan"); |
3613 |
> |
for(int isig=0;isig<(int)(signalsamples.collection).size();isig++) { |
3614 |
> |
if(!(signalsamples.collection)[isig].events) continue; |
3615 |
> |
string nowname=(signalsamples.collection)[isig].filename; |
3616 |
> |
TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname)); |
3617 |
> |
// TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events","",mc,luminosity,signalsamples.FindSample(nowname)); |
3618 |
> |
mll->SetLineColor(TColor::GetColor("#04B404")); |
3619 |
> |
stringstream poscutS; |
3620 |
> |
poscutS << "((" << mcjzb <<")>50)"; |
3621 |
> |
TCut poscut(poscutS.str().c_str()); |
3622 |
> |
TH1F *mllP = signalsamples.Draw("mllhistoP","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets&&poscut,mc,luminosity,signalsamples.FindSample(nowname)); |
3623 |
> |
mllP->SetLineColor(TColor::GetColor("#0040FF")); |
3624 |
> |
mll->Draw("histo"); |
3625 |
> |
mllP->Draw("histo,same"); |
3626 |
> |
TLegend *leg = make_legend(); |
3627 |
> |
leg->SetY1(0.8); |
3628 |
> |
leg->AddEntry(mll,(signalsamples.collection)[isig].samplename.c_str(),"L"); |
3629 |
> |
leg->AddEntry(mllP,((signalsamples.collection)[isig].samplename+", JZB>50").c_str(),"L"); |
3630 |
> |
leg->Draw(); |
3631 |
> |
TLine *lin = new TLine(71.2,0,71.2,mll->GetMaximum()); |
3632 |
> |
TLine *lin2 = new TLine(111.2,0,111.2,mll->GetMaximum()); |
3633 |
> |
lin->Draw("same"); |
3634 |
> |
lin2->Draw("same"); |
3635 |
> |
|
3636 |
> |
CompleteSave(sigcan,"MllShape/"+(signalsamples.collection)[isig].samplename); |
3637 |
> |
delete mll; |
3638 |
> |
delete mllP; |
3639 |
> |
} |
3640 |
|
} |
3641 |
|
|
3642 |
+ |
void met_vs_jzb_plots(string datajzb, string mcjzb) { |
3643 |
+ |
|
3644 |
+ |
TCanvas *canmetjzb = new TCanvas("canmet","MET vs JZB canvas"); |
3645 |
+ |
canmetjzb->SetRightMargin(0.16); |
3646 |
+ |
|
3647 |
+ |
vector<string> findme; |
3648 |
+ |
findme.push_back("DY"); |
3649 |
+ |
findme.push_back("TTJets"); |
3650 |
+ |
findme.push_back("LM"); |
3651 |
+ |
/* |
3652 |
+ |
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
3653 |
+ |
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
3654 |
+ |
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
3655 |
+ |
for(int isel=0;isel<(int)selsamples.size();isel++) { |
3656 |
+ |
dout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
3657 |
+ |
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF&&cutnJets); |
3658 |
+ |
} |
3659 |
+ |
metvsjzb->Scale(allsamples.collection[selsamples[0]].weight); |
3660 |
+ |
metvsjzb->SetStats(0); |
3661 |
+ |
metvsjzb->GetXaxis()->SetTitle("MET (GeV)"); |
3662 |
+ |
metvsjzb->GetYaxis()->SetTitle("JZB (GeV)"); |
3663 |
+ |
metvsjzb->GetXaxis()->CenterTitle(); |
3664 |
+ |
metvsjzb->GetYaxis()->CenterTitle(); |
3665 |
+ |
metvsjzb->Draw("COLZ"); |
3666 |
+ |
TText* title = write_text(0.5,0.95,allsamples.collection[selsamples[0]].samplename); |
3667 |
+ |
title->SetTextAlign(12); |
3668 |
+ |
title->Draw(); |
3669 |
+ |
CompleteSave(canmetjzb,(string)"METvsJZBplots/"+findme[ifind]); |
3670 |
+ |
} |
3671 |
+ |
*/ |
3672 |
+ |
|
3673 |
+ |
dout << "About to produce MET plot for DY split up by JZB" << endl; |
3674 |
+ |
|
3675 |
+ |
int nbins=14; |
3676 |
+ |
float low=0; |
3677 |
+ |
float high=140; |
3678 |
+ |
|
3679 |
+ |
stringstream sLEFT; |
3680 |
+ |
sLEFT << "((" << mcjzb << ")<0)"; |
3681 |
+ |
TCut LEFT(sLEFT.str().c_str()); |
3682 |
+ |
stringstream sRIGHT; |
3683 |
+ |
sRIGHT << "((" << mcjzb << ")>0)"; |
3684 |
+ |
TCut RIGHT(sRIGHT.str().c_str()); |
3685 |
+ |
|
3686 |
+ |
TH1F *metleft = allsamples.Draw("metleft","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3687 |
+ |
TH1F *metleftO = allsamples.Draw("metleftO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3688 |
+ |
TH1F *metright = allsamples.Draw("metright","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3689 |
+ |
TH1F *metrightO = allsamples.Draw("metrightO","met[4]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3690 |
+ |
|
3691 |
+ |
|
3692 |
+ |
TH1F *Bpred = (TH1F*)metleft->Clone("Bpred"); |
3693 |
+ |
Bpred->Add(metleftO,-1); |
3694 |
+ |
Bpred->Add(metrightO); |
3695 |
+ |
TH1F *obs = (TH1F*)metright->Clone("obs"); |
3696 |
+ |
|
3697 |
+ |
metleft->Add(metleftO,-1); |
3698 |
+ |
metright->Add(metrightO,-1); |
3699 |
+ |
|
3700 |
+ |
metleft->SetLineColor(kRed); |
3701 |
+ |
metright->SetLineColor(kBlack); |
3702 |
+ |
TPad *metpad = new TPad("metpad","metpad",0,0,1,1); |
3703 |
+ |
metpad->cd(); |
3704 |
+ |
metpad->SetLogy(1); |
3705 |
+ |
metleft->Draw("histo"); |
3706 |
+ |
metright->Draw("same"); |
3707 |
+ |
TLegend *lg = make_legend(); |
3708 |
+ |
lg->SetX1(0.5); |
3709 |
+ |
lg->SetY1(0.7); |
3710 |
+ |
lg->AddEntry(metright,"JZB>0 (OSOF corrected)","P"); |
3711 |
+ |
lg->AddEntry(metleft,"JZB<0 (OSOF corrected)","L"); |
3712 |
+ |
lg->SetHeader("DY"); |
3713 |
+ |
|
3714 |
+ |
lg->Draw(); |
3715 |
+ |
save_with_ratio(metright,metleft,metpad->cd(),"METvsJZBplots/ComparingLeftToRightinMETspectrum"); |
3716 |
+ |
|
3717 |
+ |
TPad *metpad3 = new TPad("metpad3","metpad3",0,0,1,1); |
3718 |
+ |
metpad3->cd(); |
3719 |
+ |
metpad3->SetLogy(1); |
3720 |
+ |
Bpred->SetLineColor(kRed); |
3721 |
+ |
Bpred->Draw("histo"); |
3722 |
+ |
obs->SetLineColor(kBlack); |
3723 |
+ |
obs->Draw("same"); |
3724 |
+ |
TLegend *lg2 = make_legend(); |
3725 |
+ |
lg2->SetX1(0.5); |
3726 |
+ |
lg2->SetY1(0.7); |
3727 |
+ |
lg2->AddEntry(obs,"observed","P"); |
3728 |
+ |
lg2->AddEntry(Bpred,"predicted","L"); |
3729 |
+ |
lg2->SetHeader("DY"); |
3730 |
+ |
|
3731 |
+ |
lg2->Draw(); |
3732 |
+ |
|
3733 |
+ |
save_with_ratio(obs,Bpred,metpad3->cd(),"METvsJZBplots/ComparingPredObsinMET"); |
3734 |
+ |
|
3735 |
+ |
TPad *metpad2 = new TPad("metpad2","metpad2",0,0,1,1); |
3736 |
+ |
metpad2->cd(); |
3737 |
+ |
metpad2->SetLogy(1); |
3738 |
+ |
|
3739 |
+ |
TH1F *metlefta = allsamples.Draw("metlefta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3740 |
+ |
TH1F *metleftOa = allsamples.Draw("metleftOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity, allsamples.FindSample("DYJets")); |
3741 |
+ |
TH1F *metrighta = allsamples.Draw("metrighta","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3742 |
+ |
TH1F *metrightOa = allsamples.Draw("metrightOa","met[2]",nbins,low,high, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity, allsamples.FindSample("DYJets")); |
3743 |
+ |
|
3744 |
+ |
metlefta->Add(metleftOa,-1); |
3745 |
+ |
metrighta->Add(metrightOa,-1); |
3746 |
+ |
|
3747 |
+ |
metlefta->SetLineColor(kRed); |
3748 |
+ |
metpad2->cd(); |
3749 |
+ |
metlefta->Draw("histo"); |
3750 |
+ |
metrighta->Draw("same"); |
3751 |
+ |
lg->Draw(); |
3752 |
+ |
save_with_ratio(metrighta,metlefta,metpad2->cd(),"METvsJZBplots/ComparingLeftToRightinMET_type1_spectrum"); |
3753 |
+ |
|
3754 |
+ |
delete Bpred; |
3755 |
+ |
delete obs; |
3756 |
+ |
|
3757 |
+ |
float newhigh=300; |
3758 |
+ |
int newNBins=30; |
3759 |
+ |
|
3760 |
+ |
TPad *metpad4 = new TPad("metpad4","metpad4",0,0,1,1); |
3761 |
+ |
TH1F *Ametleft = allsamples.Draw("Ametleft","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&LEFT,mc, luminosity); |
3762 |
+ |
TH1F *AmetleftO = allsamples.Draw("AmetleftO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&LEFT,mc, luminosity); |
3763 |
+ |
TH1F *Ametright = allsamples.Draw("Ametright","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&RIGHT,mc, luminosity); |
3764 |
+ |
TH1F *AmetrightO = allsamples.Draw("AmetrightO","met[4]",newNBins,low,newhigh, "MET [GeV]", "events", cutmass&&cutOSOF&&cutnJets&&RIGHT,mc, luminosity); |
3765 |
+ |
|
3766 |
+ |
TH1F *aBpred = (TH1F*)Ametleft->Clone("aBpred"); |
3767 |
+ |
aBpred->Add(AmetleftO,-1); |
3768 |
+ |
aBpred->Add(AmetrightO); |
3769 |
+ |
aBpred->SetLineColor(kRed); |
3770 |
+ |
|
3771 |
+ |
TH1F *aobs = (TH1F*)Ametright->Clone("aobs"); |
3772 |
+ |
metpad4->cd(); |
3773 |
+ |
metpad4->SetLogy(1); |
3774 |
+ |
aobs->Draw(); |
3775 |
+ |
aBpred->Draw("histo,same"); |
3776 |
+ |
aobs->Draw("same"); |
3777 |
+ |
lg->SetHeader("All MC"); |
3778 |
+ |
lg->Draw(); |
3779 |
+ |
save_with_ratio(aobs,aBpred,metpad4->cd(),"METvsJZBplots/ComparingPredObsinMET_ALLSAMPLES"); |
3780 |
+ |
|
3781 |
+ |
|
3782 |
+ |
delete lg; |
3783 |
+ |
delete canmetjzb; |
3784 |
+ |
delete metleft; |
3785 |
+ |
delete metleftO; |
3786 |
+ |
delete metright; |
3787 |
+ |
delete metrightO; |
3788 |
+ |
} |
3789 |
+ |
|
3790 |
+ |
|
3791 |
|
void test() { |
3792 |
|
|
3793 |
|
TCanvas *testcanv = new TCanvas("testcanv","testcanv"); |
3794 |
|
testcanv->cd(); |
3795 |
< |
switch_overunderflow(true); |
3795 |
> |
// switch_overunderflow(true); |
3796 |
|
TH1F *ptdistr = allsamples.Draw("ptdistr","pt1",100,30,200, "p_{T} [GeV]", "events", cutOSSF,data,luminosity); |
3797 |
|
switch_overunderflow(false); |
3798 |
|
ptdistr->Draw(); |