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 &DataSigma, 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,method,saveas); |
56 |
> |
DataPeak=find_peak(rawJZBeemmData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,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,method,saveas); |
66 |
> |
DataPeak=find_peak(reducedData, rawJZBeemmData, -40, 40, data, DataPeakError,DataSigma,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 << " +/- ?? (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; |
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 |
+ |
|
90 |
+ |
bool DoInvidualeemmPeaks=false; |
91 |
+ |
|
92 |
+ |
float mcpeak, datapeak; |
93 |
+ |
float mcpeakerr, datapeakerr; |
94 |
+ |
|
95 |
+ |
float mceepeak,mcmmpeak; |
96 |
+ |
float mceepeakerr,mcmmpeakerr; |
97 |
+ |
|
98 |
+ |
float datammpeak,dataeepeak; |
99 |
+ |
float datammpeakerr,dataeepeakerr; |
100 |
+ |
|
101 |
+ |
float mcSigma, dataSigma; |
102 |
+ |
|
103 |
+ |
dout << "Finding global peak : " << endl; |
104 |
+ |
find_one_peak_combination(TCut(""),mcpeak,mcpeakerr, datapeak,datapeakerr,mcSigma, dataSigma,result,doPUreweighting,""); |
105 |
+ |
|
106 |
+ |
if(DoInvidualeemmPeaks) { |
107 |
+ |
dout << "Finding peak for electrons : " << endl; |
108 |
+ |
find_one_peak_combination(TCut("id1==0"),mceepeak,mceepeakerr, dataeepeak,dataeepeakerr,mcSigma, dataSigma,result,doPUreweighting,"_ele"); |
109 |
+ |
dout << "Finding peak for muons : " << endl; |
110 |
+ |
find_one_peak_combination(TCut("id1==1"),mcmmpeak,mcmmpeakerr, datammpeak,datammpeakerr,mcSigma, dataSigma,result,doPUreweighting,"_mu"); |
111 |
+ |
|
112 |
+ |
datajzb << "(" << jzbvariabledata; |
113 |
+ |
mcjzb << "(" << jzbvariablemc; |
114 |
+ |
|
115 |
+ |
if(dataeepeak>0) datajzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
116 |
+ |
else datajzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(dataeepeak) << " "; |
117 |
+ |
|
118 |
+ |
if(datammpeak>0) datajzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
119 |
+ |
else datajzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(datammpeak) << " "; |
120 |
+ |
|
121 |
+ |
if(datapeak>0) datajzb << "- (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
122 |
+ |
else datajzb << "+ (id1!=id2)*" << TMath::Abs(datapeak) << " "; |
123 |
+ |
|
124 |
+ |
datajzb << ")"; |
125 |
+ |
|
126 |
+ |
if(mceepeak>0) mcjzb << "- (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
127 |
+ |
else mcjzb << "+ (id1==id2)*(id1==0)*" << TMath::Abs(mceepeak) << " "; |
128 |
+ |
|
129 |
+ |
if(mcmmpeak>0) mcjzb << "- (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
130 |
+ |
else mcjzb << "+ (id1==id2)*(id1==1)*" << TMath::Abs(mcmmpeak) << " "; |
131 |
+ |
|
132 |
+ |
if(mcpeak>0) mcjzb << "- (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
133 |
+ |
else mcjzb << "+ (id1!=id2)*" << TMath::Abs(mcpeak) << " "; |
134 |
+ |
|
135 |
+ |
mcjzb << ")"; |
136 |
+ |
} else { |
137 |
+ |
datajzb << "(" << jzbvariabledata; |
138 |
+ |
mcjzb << "(" << jzbvariablemc; |
139 |
+ |
|
140 |
+ |
if(datapeak>0) datajzb << "- " << TMath::Abs(datapeak) << " "; |
141 |
+ |
else datajzb << "+ " << TMath::Abs(datapeak) << " "; |
142 |
+ |
|
143 |
+ |
datajzb << ")"; |
144 |
+ |
|
145 |
+ |
if(mcpeak>0) mcjzb << "- " << TMath::Abs(mcpeak) << " "; |
146 |
+ |
else mcjzb << "+ " << TMath::Abs(mcpeak) << " "; |
147 |
+ |
|
148 |
+ |
mcjzb << ")"; |
149 |
+ |
} |
150 |
+ |
|
151 |
+ |
|
152 |
+ |
} |
153 |
+ |
|
154 |
+ |
void make_special_obs_pred_mll_plot(string mcjzb, float jzbthreshold) { |
155 |
+ |
float min=70.0; |
156 |
+ |
float max=115.0; |
157 |
+ |
if(!PlottingSetup::RestrictToMassPeak) { |
158 |
+ |
min=10; |
159 |
+ |
max=150; |
160 |
+ |
} |
161 |
+ |
int nbins=int((max-min)/5); |
162 |
+ |
|
163 |
+ |
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
164 |
+ |
|
165 |
+ |
stringstream largerzeroS; |
166 |
+ |
largerzeroS << "(" << mcjzb << ">" << jzbthreshold << ")"; |
167 |
+ |
TCut largerzero(largerzeroS.str().c_str()); |
168 |
+ |
|
169 |
+ |
stringstream smallerzeroS; |
170 |
+ |
smallerzeroS << "(" << mcjzb << "<-" << jzbthreshold << ")"; |
171 |
+ |
TCut smallerzero(smallerzeroS.str().c_str()); |
172 |
+ |
|
173 |
+ |
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity); |
174 |
+ |
THStack mcRcorrJZBeemm = allsamples.DrawStack("mcRcorrJZBeemm","mll",nbins,min,max, "m_{ll} [GeV}", "events", cutmass&&cutOSSF&&cutnJets,mc,luminosity); |
175 |
+ |
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSSF&&cutnJets,data,luminosity); |
176 |
+ |
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data,luminosity); |
177 |
+ |
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem", "mll",nbins,min,max, "m_{ll} [GeV]", "events", cutmass&&cutOSOF&&cutnJets,data,luminosity); |
178 |
+ |
|
179 |
+ |
TH1F *RcorrJZBSBem; |
180 |
+ |
TH1F *LcorrJZBSBem; |
181 |
+ |
TH1F *RcorrJZBSBeemm; |
182 |
+ |
TH1F *LcorrJZBSBeemm; |
183 |
+ |
|
184 |
+ |
// TH1F *RcorrJZBeemmNoS; |
185 |
+ |
|
186 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
187 |
+ |
RcorrJZBSBem = allsamples.Draw("RcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,data, luminosity); |
188 |
+ |
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem", "mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,data, luminosity); |
189 |
+ |
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,data, luminosity); |
190 |
+ |
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm","mll",nbins,min,max, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,data, luminosity); |
191 |
+ |
} |
192 |
+ |
|
193 |
+ |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
194 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
195 |
+ |
Bpred->Add(RcorrJZBem,1.0/3.); |
196 |
+ |
Bpred->Add(LcorrJZBem,-1.0/3.); |
197 |
+ |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
198 |
+ |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
199 |
+ |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
200 |
+ |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
201 |
+ |
} else { |
202 |
+ |
Bpred->Add(RcorrJZBem,1.0); |
203 |
+ |
Bpred->Add(LcorrJZBem,-1.0); |
204 |
+ |
} |
205 |
+ |
|
206 |
+ |
Bpred->SetLineColor(kRed); |
207 |
+ |
|
208 |
+ |
RcorrJZBeemm->Draw(); |
209 |
+ |
mcRcorrJZBeemm.Draw("same"); |
210 |
+ |
Bpred->Draw("histo,same"); |
211 |
+ |
RcorrJZBeemm->Draw("same"); |
212 |
+ |
|
213 |
+ |
TLegend *leg = allsamples.allbglegend(); |
214 |
+ |
leg->SetX1(0.58); |
215 |
+ |
leg->AddEntry(RcorrJZBeemm,"observed (data)","l"); |
216 |
+ |
leg->AddEntry(Bpred,"predicted (data)","l"); |
217 |
+ |
leg->Draw("same"); |
218 |
+ |
|
219 |
+ |
stringstream saveas; |
220 |
+ |
saveas << "kin/Mll_After_Cut/Cut_At" << jzbthreshold; |
221 |
+ |
CompleteSave(ckin,saveas.str()); |
222 |
+ |
|
223 |
+ |
delete RcorrJZBeemm; |
224 |
+ |
delete LcorrJZBeemm; |
225 |
+ |
delete RcorrJZBem; |
226 |
+ |
delete LcorrJZBem; |
227 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
228 |
+ |
delete RcorrJZBSBeemm; |
229 |
+ |
delete LcorrJZBSBeemm; |
230 |
+ |
delete RcorrJZBSBem; |
231 |
+ |
delete LcorrJZBSBem; |
232 |
+ |
} |
233 |
+ |
delete Bpred; |
234 |
+ |
delete ckin; |
235 |
+ |
} |
236 |
+ |
|
237 |
|
void make_special_mll_plot(int nbins, float min, float max, bool logscale,string xlabel) { |
238 |
|
|
239 |
|
TCanvas *ckin = new TCanvas("ckin","Kinematic Plots (in the making)",600,600); |
268 |
|
TIter next(bgleg->GetListOfPrimitives()); |
269 |
|
TObject* obj; |
270 |
|
// Copy the nice bkgd legend skipping the "data" |
271 |
< |
while ( obj = next() ) |
271 |
> |
while ( (obj = next()) ) |
272 |
|
if ( strcmp(((TLegendEntry*)obj)->GetObject()->GetName(),"datahistoOSSF") ) |
273 |
|
kinleg->GetListOfPrimitives()->Add(obj); |
274 |
|
|
287 |
|
TIter next(hmc.GetHists()); |
288 |
|
TObject* obj; |
289 |
|
TH1* hratio = NULL; |
290 |
< |
while ( obj = next() ) { |
290 |
> |
while ( (obj = next()) ) { |
291 |
|
if ( !hratio ) { |
292 |
|
hratio = (TH1*)obj->Clone(); |
293 |
|
hratio->SetName("hratio"); |
348 |
|
TCut cut; |
349 |
|
cut=cutmass&&cutOSSF&&cutnJets&&ibasiccut; |
350 |
|
if(filename=="nJets") cut=cutmass&&cutOSSF&&ibasiccut; |
351 |
+ |
if(filename=="nJets_osof") cut=cutmass&&cutOSOF&&ibasiccut; |
352 |
|
if(filename=="nJets_nocuts_except_mll_ossf") cut=cutmass&&cutOSSF; |
353 |
|
if(filename=="mll") { |
354 |
|
cut=cutOSSF&&cutnJets&&ibasiccut; |
360 |
|
draw_separation_lines=true; |
361 |
|
} |
362 |
|
if(filename=="mll_mm") cut=cutOSSF&&cutnJets&&ibasiccut&&"id1==1"; |
363 |
< |
if(filename=="mll_aboveJZB100") cut=cutOSSF&&cutnJets&&ibasiccut; |
363 |
> |
if(Contains(filename,"mll_aboveJZB100")) cut=cutOSSF&&cutnJets&&ibasiccut; |
364 |
> |
if(Contains(filename,"mll_osof_aboveJZB")) cut=cutOSOF&&cutnJets&&ibasiccut; |
365 |
|
if(filename=="mll_inclusive"||filename=="mll_inclusive_highrange") cut=cutOSSF; |
366 |
|
if(filename=="mll_inclusive_osof") cut=cutOSOF; |
367 |
|
if(filename=="mll_inclusive_ee") cut=cutOSSF&&"id1==0"; |
376 |
|
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
377 |
|
if(variable=="pfJetGoodPt[0]") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
378 |
|
if(variable=="pt") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
379 |
< |
if(filename=="mll_inclusive") datahisto->SetMinimum(1); |
379 |
> |
if(filename=="mll_inclusive"||filename=="mll_inclusive_mm"||filename=="mll_inclusive_ee") datahisto->SetMinimum(1); |
380 |
|
if(filename=="mll_osof") datahisto->SetMaximum(10*datahisto->GetMaximum()); |
381 |
|
if(filename=="mll_osof") datahisto->SetMinimum(9); |
214 |
– |
|
382 |
|
datahisto->SetMaximum(5.3*datahisto->GetMaximum()); |
383 |
|
datahisto->Draw("e1"); |
384 |
|
ckin->Update(); |
458 |
|
delete ckin; |
459 |
|
} |
460 |
|
|
294 |
– |
|
461 |
|
void make_JES_plot() { |
462 |
|
|
463 |
|
int nbins=10; |
509 |
|
bool dolog=true; |
510 |
|
bool nolog=false; |
511 |
|
if(doPF) write_warning(__FUNCTION__,"Please use caution when trying to produce PF plots; not all versions of the JZB trees have these variables!"); |
512 |
< |
float mll_low=40; |
512 |
> |
float mll_low=50; |
513 |
|
float mll_hi=160; |
514 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
515 |
< |
mll_low=30; |
516 |
< |
mll_hi=180; |
515 |
> |
mll_low=20; |
516 |
> |
mll_hi=210; |
517 |
|
} |
518 |
+ |
|
519 |
+ |
make_kin_plot("met[4]","",40,0,200,dolog,"MET [GeV]","met",doPF,true); |
520 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll",doPF,true); |
521 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof",doPF,true,true); |
522 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_ee",doPF,true); |
524 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive",doPF,true); |
525 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_ee",doPF,true); |
526 |
|
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_mm",doPF,true); |
527 |
< |
make_kin_plot("mll","",(int)((mll_hi-mll_low)),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
527 |
> |
make_kin_plot("mll","",(int)((mll_hi-mll_low))/2,mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_inclusive_osof",doPF,true); |
528 |
|
make_kin_plot("mll","",(int)((350-mll_low)),mll_low,350,dolog,"m_{ll} [GeV]","mll_inclusive_highrange",doPF); |
529 |
< |
make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
530 |
< |
make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
529 |
> |
make_kin_plot("numVtx","",(int)(30.5-(-0.5)),-0.5,30.5,nolog,"N(Vtx)","numVtx",doPF); |
530 |
> |
// make_kin_plot("jetpt[0]","",40,0,200,dolog,"leading jet p_{T} [GeV]","pfJetGoodPt_0",doPF); |
531 |
> |
// make_kin_plot("jeteta[0]","",40,-5,5,nolog,"leading jet #eta","pfJetGoodEta_0",doPF); |
532 |
|
make_kin_plot("pt","",50,0,400,dolog,"Z p_{T} [GeV]","Zpt",doPF); |
533 |
|
make_kin_plot("pt1","",50,0,100,nolog,"p_{T} [GeV]","pt1",doPF); |
534 |
|
make_kin_plot("pt2","",50,0,100,nolog,"p_{T} [GeV]","pt2",doPF); |
535 |
|
make_kin_plot("eta1","",40,-5,5,nolog,"#eta_{l}","eta",doPF); |
536 |
|
make_kin_plot("jzb[1]","",100,-150,150,dolog,"JZB [GeV]","jzb_ossf",doPF); |
537 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets",doPF); |
538 |
< |
make_kin_plot("pfJetGoodNum","",8,0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
537 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets",doPF); |
538 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_osof",doPF); |
539 |
> |
make_kin_plot("pfJetGoodNum40","",9,-0.5,8.5,dolog,"nJets","nJets_nocuts_except_mll_ossf",doPF); |
540 |
|
if(!doPF) make_special_mll_plot((int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]"); |
541 |
|
stringstream jzbcut; |
542 |
|
jzbcut << "((is_data&&("<<datajzb<<")>100)||(!is_data&&("<<mcjzb<<")>100))"; |
543 |
|
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
544 |
+ |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
545 |
+ |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB100",doPF,true); |
546 |
+ |
make_kin_plot("mll",jzbcut.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB100",doPF,true); |
547 |
+ |
stringstream jzbcut2; |
548 |
+ |
jzbcut2 << "((is_data&&("<<datajzb<<")>150)||(!is_data&&("<<mcjzb<<")>150))"; |
549 |
+ |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB150",doPF,true); |
550 |
+ |
make_kin_plot("mll",jzbcut2.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB150",doPF,true); |
551 |
+ |
stringstream jzbcut3; |
552 |
+ |
jzbcut3 << "((is_data&&("<<datajzb<<")>50)||(!is_data&&("<<mcjzb<<")>50))"; |
553 |
+ |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_aboveJZB50",doPF,true); |
554 |
+ |
make_kin_plot("mll",jzbcut3.str(),(int)((mll_hi-mll_low)/5),mll_low,mll_hi,dolog,"m_{ll} [GeV]","mll_osof_aboveJZB50",doPF,true,true); |
555 |
+ |
|
556 |
+ |
make_special_obs_pred_mll_plot(mcjzb,0); |
557 |
+ |
make_special_obs_pred_mll_plot(mcjzb,50); |
558 |
+ |
make_special_obs_pred_mll_plot(mcjzb,100); |
559 |
+ |
make_special_obs_pred_mll_plot(mcjzb,150); |
560 |
+ |
make_special_obs_pred_mll_plot(mcjzb,200); |
561 |
+ |
make_special_obs_pred_mll_plot(mcjzb,250); |
562 |
|
} |
563 |
|
|
564 |
|
void make_comp_plot( string var, string xlabel, string filename, float jzbcut, string mcjzb, string datajzb, |
630 |
|
|
631 |
|
|
632 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- the arguments changed |
633 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
633 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
634 |
|
float jzbcut=jzb_cuts[ijzb]; // Comparison plots are done for this JZB cut |
635 |
|
float mll_low=50;float mll_high=170; |
636 |
|
if(!PlottingSetup::RestrictToMassPeak) { |
667 |
|
|
668 |
|
float simulatedlumi=luminosity;//in pb please - adjust to your likings |
669 |
|
|
670 |
< |
TH1F *JZBplotZJETs = allsamples.Draw("JZBplotZJETs",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("DYJetsToLL")); |
671 |
< |
TH1F *JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM4")); |
670 |
> |
TH1F *JZBplotZJETs = allsamples.Draw("JZBplotZJETs",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("/DY")); |
671 |
> |
TH1F *JZBplotLM4; |
672 |
> |
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")); |
673 |
> |
else JZBplotLM4 = allsamples.Draw("JZBplotLM4",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("LM3")); |
674 |
|
TH1F *JZBplotTtbar = allsamples.Draw("JZBplotTtbar",jzbvariablemc,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events",cutmass&&cutOSSF&&cutnJets,mc,simulatedlumi,allsamples.FindSample("TTJets")); |
675 |
|
|
676 |
|
JZBplotTtbar->SetLineColor(allsamples.GetColor("TTJet")); |
694 |
|
TLegend *signal_bg_comparison_leg2 = make_legend("",0.55,0.75,false); |
695 |
|
signal_bg_comparison_leg2->AddEntry(JZBplotZJETs,"Z+Jets","f"); |
696 |
|
signal_bg_comparison_leg2->AddEntry(JZBplotTtbar,"t#bar{t}","f"); |
697 |
< |
signal_bg_comparison_leg2->AddEntry(JZBplotLM4,"LM4","f"); |
697 |
> |
if(PlottingSetup::RestrictToMassPeak) signal_bg_comparison_leg2->AddEntry(JZBplotLM4,"LM4","f"); |
698 |
> |
else signal_bg_comparison_leg2->AddEntry(JZBplotLM4,"LM3","f"); |
699 |
|
signal_bg_comparison_leg2->Draw(); |
700 |
|
DrawMCPrelim(simulatedlumi); |
701 |
|
CompleteSave(can,"jzb_bg_vs_signal_distribution"); |
937 |
|
return return_functions; |
938 |
|
} |
939 |
|
|
940 |
< |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float sigma, float high, int use_data, bool overlay_signal = false ) |
940 |
> |
void do_prediction_plot(string jzb, TCanvas *globalcanvas, float high, int use_data, bool overlay_signal = false,string subdir="" ) |
941 |
|
{ |
942 |
+ |
switch_overunderflow(true); |
943 |
|
bool is_data=false; |
944 |
|
bool use_signal=false; |
945 |
|
if(use_data==1) is_data=true; |
948 |
|
if(is_data) nbins=50; |
949 |
|
float low=0; |
950 |
|
float hi=500; |
951 |
+ |
|
952 |
|
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
953 |
|
TH1F *RcorrJZBeemm = allsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
954 |
|
TH1F *LcorrJZBeemm = allsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
955 |
|
TH1F *RcorrJZBem = allsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
956 |
|
TH1F *LcorrJZBem = allsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
957 |
+ |
|
958 |
|
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
959 |
|
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
960 |
|
blankback->GetXaxis()->CenterTitle(); |
969 |
|
TH1F *RcorrJZBeemmNoS; |
970 |
|
|
971 |
|
//these are for the ratio |
972 |
+ |
|
973 |
|
TH1F *JRcorrJZBeemm = allsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
974 |
|
TH1F *JLcorrJZBeemm = allsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
975 |
|
TH1F *JRcorrJZBem = allsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
988 |
|
LcorrJZBSBem = allsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
989 |
|
RcorrJZBSBeemm = allsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
990 |
|
LcorrJZBSBeemm = allsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
991 |
< |
|
991 |
> |
|
992 |
|
//these are for the ratio |
993 |
|
JRcorrJZBSBem = allsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
994 |
|
JLcorrJZBSBem = allsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
995 |
|
JRcorrJZBSBeemm = allsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
996 |
|
JLcorrJZBSBeemm = allsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
802 |
– |
|
997 |
|
} |
998 |
|
|
999 |
|
TH1F *lm4RcorrJZBeemm; |
1000 |
< |
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")); |
1000 |
> |
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")); |
1001 |
|
|
1002 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
1003 |
|
|
1006 |
|
|
1007 |
|
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
1008 |
|
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
1009 |
+ |
|
1010 |
+ |
TH1F *BpredSys = new TH1F("Bpredsys","Bpredsys",PlottingSetup::global_ratio_binning.size()-1,&PlottingSetup::global_ratio_binning[0]); |
1011 |
+ |
ClearHisto(BpredSys); |
1012 |
+ |
|
1013 |
|
if(PlottingSetup::RestrictToMassPeak) { |
1014 |
|
Bpred->Add(RcorrJZBem,1.0/3.); |
1015 |
|
Bpred->Add(LcorrJZBem,-1.0/3.); |
1032 |
|
JBpred->Add(JLcorrJZBSBem,-1.0/3.); |
1033 |
|
JBpred->Add(JRcorrJZBSBeemm,1.0/3.); |
1034 |
|
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.); |
1035 |
+ |
|
1036 |
+ |
//Systematics: |
1037 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertONPEAK*zjetsestimateuncertONPEAK); |
1038 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
1039 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertONPEAK*emuncertONPEAK*(1.0/9)); |
1040 |
+ |
AddSquared(BpredSys,JRcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
1041 |
+ |
AddSquared(BpredSys,JLcorrJZBSBem,emsidebanduncertONPEAK*emsidebanduncertONPEAK*(1.0/9)); |
1042 |
+ |
AddSquared(BpredSys,JRcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
1043 |
+ |
AddSquared(BpredSys,JLcorrJZBSBeemm,eemmsidebanduncertONPEAK*eemmsidebanduncertONPEAK*(1.0/9)); |
1044 |
|
} else { |
1045 |
|
Bpred->Add(RcorrJZBem,1.0); |
1046 |
|
Bpred->Add(LcorrJZBem,-1.0); |
1050 |
|
//these are for the ratio |
1051 |
|
JBpred->Add(JRcorrJZBem,1.0); |
1052 |
|
JBpred->Add(JLcorrJZBem,-1.0); |
1053 |
+ |
|
1054 |
+ |
//Systematics |
1055 |
+ |
AddSquared(BpredSys,JLcorrJZBeemm,zjetsestimateuncertOFFPEAK*zjetsestimateuncertOFFPEAK); |
1056 |
+ |
AddSquared(BpredSys,JRcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
1057 |
+ |
AddSquared(BpredSys,JLcorrJZBem,emuncertOFFPEAK*emuncertOFFPEAK); |
1058 |
+ |
|
1059 |
|
} |
1060 |
|
|
1061 |
< |
|
1061 |
> |
SQRT(BpredSys); |
1062 |
> |
BpredSys->Divide(JBpred); |
1063 |
> |
|
1064 |
|
|
1065 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
1066 |
|
TH1F *Tpred = (TH1F*)RcorrJZBem->Clone("Bpred"); |
1105 |
|
blankback->Draw(); |
1106 |
|
if(use_data==1) |
1107 |
|
{ |
1108 |
+ |
//Bpred->SetLineWidth(3); //paper style.overruled. |
1109 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style.overruled. |
1110 |
|
analytical_function = do_extended_fit_to_plot(Bpred,Tpred,LcorrJZBeemm,LcorrJZBem,is_data); |
1111 |
|
kinpad->cd();//necessary because the extended fit function creates its own canvas |
1112 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1113 |
|
|
1114 |
|
Bpred->Draw("hist,same"); |
1115 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1115 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1116 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1117 |
+ |
lm4RcorrJZBeemm->Draw("hist,same"); |
1118 |
|
legBpred->AddEntry(RcorrJZBeemm,"observed","p"); |
1119 |
|
legBpred->AddEntry(Bpred,"predicted","l"); |
1120 |
< |
legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1121 |
< |
legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
1122 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1120 |
> |
// legBpred->AddEntry(analytical_function[1],"predicted fit","l"); |
1121 |
> |
// legBpred->AddEntry(analytical_function[2],"stat. uncert.","l"); |
1122 |
> |
legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1123 |
|
legBpred->Draw(); |
1124 |
|
DrawPrelim(); |
1125 |
|
|
1126 |
|
//this plot shows what the prediction is composed of |
1127 |
< |
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1128 |
< |
specialcanv->SetLogy(1); |
1129 |
< |
Zjetspred->SetFillColor(kYellow); |
1130 |
< |
Zjetspred->SetLineColor(kYellow); |
1131 |
< |
TTbarpred->SetFillColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1132 |
< |
TTbarpred->SetLineColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1127 |
> |
TPad *predcomppad = new TPad("predcomppad","predcomppad",0,0,1,1); |
1128 |
> |
float CurrentBpredLineWidth=Bpred->GetLineWidth(); |
1129 |
> |
Bpred->SetLineWidth(2); |
1130 |
> |
predcomppad->cd(); |
1131 |
> |
predcomppad->SetLogy(1); |
1132 |
> |
|
1133 |
> |
TH1F *jzbnegative = (TH1F*)LcorrJZBeemm->Clone("jzbnegative"); |
1134 |
> |
TH1F *sidebandsemu = (TH1F*)Bpred->Clone("sidebandsemu"); |
1135 |
> |
sidebandsemu->Add(jzbnegative,-1); |
1136 |
> |
|
1137 |
> |
jzbnegative->SetFillColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
1138 |
> |
jzbnegative->SetLineColor(allsamples.GetColor((allsamples.FindSample("DY"))[0])); |
1139 |
> |
sidebandsemu->SetLineColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1140 |
> |
sidebandsemu->SetFillColor(allsamples.GetColor((allsamples.FindSample("TTJets"))[0])); |
1141 |
> |
|
1142 |
|
THStack predcomposition("predcomposition","prediction composition"); |
1143 |
< |
predcomposition.Add(TTbarpred); |
1144 |
< |
predcomposition.Add(Zjetspred); |
1143 |
> |
predcomposition.Add(sidebandsemu); |
1144 |
> |
predcomposition.Add(jzbnegative); |
1145 |
|
blankback->Draw(); |
1146 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1147 |
|
predcomposition.Draw("histo,same");// |
1148 |
|
Bpred->Draw("hist,same"); |
1149 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1149 |
> |
// analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1150 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1151 |
< |
legBpred->Draw(); |
1151 |
> |
// lm4RcorrJZBeemm->SetLineColor(kOrange+1); |
1152 |
> |
lm4RcorrJZBeemm->SetLineWidth(2); |
1153 |
> |
//lm4RcorrJZBeemm->SetLineWidth(2); // paper style. overruled. |
1154 |
> |
lm4RcorrJZBeemm->Draw("histo,same"); |
1155 |
|
DrawPrelim(); |
1156 |
< |
TLegend *specialleg = new TLegend(0.6,0.4,0.89,0.55); |
1157 |
< |
specialleg->SetFillColor(kWhite);specialleg->SetLineColor(kWhite); |
1158 |
< |
specialleg->AddEntry(Zjetspred,"Z+Jets prediction","f"); |
1159 |
< |
specialleg->AddEntry(TTbarpred,"t#bar{t} prediction","f"); |
1160 |
< |
specialleg->Draw("same"); |
1161 |
< |
CompleteSave(specialcanv,"Bpred_Data_____PredictionComposition"); |
1162 |
< |
|
1163 |
< |
THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1156 |
> |
TLegend *speciallegBpred = make_legend("",0.45,0.55); |
1157 |
> |
//TLegend *speciallegBpred = make_legend("",0.35,0.55); // paper style. overruled. |
1158 |
> |
speciallegBpred->AddEntry(RcorrJZBeemm,"Data","pl"); |
1159 |
> |
speciallegBpred->AddEntry(Bpred,"Total background","l"); |
1160 |
> |
speciallegBpred->AddEntry(jzbnegative,"JZB<0 (data)","f"); |
1161 |
> |
if(PlottingSetup::RestrictToMassPeak) speciallegBpred->AddEntry(sidebandsemu,"Sidebands/e#mu (data)","f"); |
1162 |
> |
else speciallegBpred->AddEntry(sidebandsemu,"e#mu (data)","f"); |
1163 |
> |
// speciallegBpred->AddEntry(lm4RcorrJZBeemmC,"LM4","l"); |
1164 |
> |
speciallegBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1165 |
> |
speciallegBpred->Draw(); |
1166 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,predcomppad,subdir+"Bpred_Data_____PredictionComposition",true,true,"data/pred",BpredSys); |
1167 |
> |
|
1168 |
> |
TCanvas *specialcanv = new TCanvas("specialcanv","specialcanv"); |
1169 |
> |
specialcanv->SetLogy(1); |
1170 |
> |
// THStack kostack = allsamples.DrawStack("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,!is_data, luminosity,use_signal); |
1171 |
|
blankback->Draw(); |
1172 |
< |
kostack.Draw("same"); |
1172 |
> |
// kostack.Draw("same"); |
1173 |
> |
predcomposition.Draw(); |
1174 |
|
Bpred->Draw("hist,same"); |
1175 |
< |
analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1175 |
> |
//analytical_function[0]->Draw("same"); analytical_function[1]->Draw("same");analytical_function[2]->Draw("same"); |
1176 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1177 |
|
legBpred->Draw(); |
1178 |
|
DrawPrelim(); |
1179 |
< |
CompleteSave(specialcanv,"Bpred_Data_____PredictionCompositioninMC"); |
1179 |
> |
CompleteSave(specialcanv,subdir+"Bpred_Data_____PredictionCompositioninMC"); |
1180 |
> |
Bpred->SetLineWidth((int)CurrentBpredLineWidth); |
1181 |
|
|
1182 |
< |
delete specialcanv; |
944 |
< |
delete specialleg; |
1182 |
> |
delete speciallegBpred; |
1183 |
|
delete Zjetspred; |
1184 |
|
delete TTbarpred; |
1185 |
|
|
1187 |
|
} |
1188 |
|
if(use_data==0) { |
1189 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1190 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1191 |
|
Bpred->Draw("hist,same"); |
1192 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1193 |
< |
legBpred->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1194 |
< |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1193 |
> |
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1194 |
> |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1195 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
1196 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
1197 |
|
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1202 |
|
} |
1203 |
|
if(use_data==2) { |
1204 |
|
RcorrJZBeemm->Draw("e1x0,same"); |
1205 |
+ |
//Bpred->SetLineWidth(3); // paper style. overruled. |
1206 |
|
Bpred->Draw("hist,same"); |
1207 |
|
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1208 |
< |
legBpred->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1208 |
> |
legBpred->AddEntry(RcorrJZBeemm,"MC true","p"); |
1209 |
|
legBpred->AddEntry(Bpred,"MC predicted","l"); |
1210 |
< |
legBpred2->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1210 |
> |
legBpred2->AddEntry(RcorrJZBeemm,"MC true","p"); |
1211 |
|
legBpred2->AddEntry(Bpred,"MC predicted","l"); |
1212 |
|
{ |
1213 |
|
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 --> now only allowed for root >=v5.30 |
1218 |
|
// CompleteSave(globalcanvas,"Bpred_MCwithS"); // done below in save_with_ratio |
1219 |
|
} |
1220 |
|
{ |
1221 |
+ |
//lm4RcorrJZBeemm->SetLineWidth(3); //paper style. overruled. |
1222 |
+ |
//RcorrJZBeemmNoS->SetLineWidth(3); //paper style. overruled. |
1223 |
+ |
//lm4RcorrJZBeemm->SetLineStyle(2); //paper style. overruled. |
1224 |
+ |
//RcorrJZBeemmNoS->SetLineStyle(3); //paper style. overruled. |
1225 |
+ |
//lm4RcorrJZBeemm->SetLineColor(kOrange+1); //paper style. overruled. |
1226 |
+ |
|
1227 |
|
RcorrJZBeemmNoS->SetLineStyle(2); |
1228 |
|
legBpred2->AddEntry(RcorrJZBeemmNoS,"MC B","l"); |
1229 |
|
legBpred2->AddEntry(lm4RcorrJZBeemm,"MC S","l"); |
1242 |
|
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
1243 |
|
string ytitle("ratio"); |
1244 |
|
if ( use_data==1 ) ytitle = "data/pred"; |
1245 |
< |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1245 |
> |
//save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,Bpredsaveas,true,use_data!=1,ytitle); |
1246 |
> |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,subdir+Bpredsaveas,true,true,ytitle,BpredSys);//not extending the y range anymore up to 4 |
1247 |
|
|
1248 |
|
|
1249 |
|
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1250 |
< |
/// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1251 |
< |
if(!PlottingSetup::RestrictToMassPeak) return; |
1252 |
< |
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1253 |
< |
Bpredem->Add(RcorrJZBem); |
1254 |
< |
Bpredem->Add(LcorrJZBem,-1); |
1255 |
< |
TH1F *BpredSBem = (TH1F*)LcorrJZBeemm->Clone("BpredSBem"); |
1256 |
< |
BpredSBem->Add(RcorrJZBSBem); |
1257 |
< |
Bpred->Add(LcorrJZBSBem,-1); |
1258 |
< |
TH1F *BpredSBeemm = (TH1F*)LcorrJZBeemm->Clone("BpredSBeemm"); |
1259 |
< |
BpredSBeemm->Add(RcorrJZBSBeemm); |
1260 |
< |
BpredSBeemm->Add(LcorrJZBSBeemm,-1.0); |
1261 |
< |
globalcanvas->cd(); |
1262 |
< |
globalcanvas->SetLogy(1); |
1263 |
< |
|
1264 |
< |
RcorrJZBeemm->SetMarkerStyle(20); |
1265 |
< |
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high); |
1266 |
< |
blankback->Draw(); |
1267 |
< |
RcorrJZBeemm->Draw("e1x0,same"); |
1268 |
< |
RcorrJZBeemm->SetMarkerSize(DataMarkerSize); |
1269 |
< |
|
1270 |
< |
Bpredem->SetLineColor(kRed+1); |
1271 |
< |
Bpredem->SetStats(0); |
1272 |
< |
Bpredem->Draw("hist,same"); |
1273 |
< |
|
1274 |
< |
BpredSBem->SetLineColor(kGreen+2);//TColor::GetColor("#0B6138")); |
1275 |
< |
BpredSBem->SetLineStyle(2); |
1276 |
< |
BpredSBem->Draw("hist,same"); |
1277 |
< |
|
1278 |
< |
BpredSBeemm->SetLineColor(kBlue+1); |
1279 |
< |
BpredSBeemm->SetLineStyle(3); |
1280 |
< |
BpredSBeemm->Draw("hist,same"); |
1281 |
< |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1282 |
< |
|
1283 |
< |
TLegend *legBpredc = make_legend("",0.6,0.55); |
1284 |
< |
if(use_data==1) |
1285 |
< |
{ |
1286 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
1287 |
< |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
1288 |
< |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
1289 |
< |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
1290 |
< |
legBpredc->Draw(); |
1291 |
< |
CompleteSave(globalcanvas,"Bpred_Data_comparison"); |
1292 |
< |
} |
1293 |
< |
if(use_data==0) { |
1294 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1295 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1296 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1297 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1298 |
< |
legBpredc->Draw(); |
1299 |
< |
CompleteSave(globalcanvas,"Bpred_MC_comparison"); |
1300 |
< |
} |
1301 |
< |
if(use_data==2) { |
1302 |
< |
legBpredc->AddEntry(RcorrJZBeemm,"MC observed","p"); |
1303 |
< |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1304 |
< |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1305 |
< |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1306 |
< |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1307 |
< |
legBpredc->Draw(); |
1308 |
< |
CompleteSave(globalcanvas,"Bpred_MCwithS_comparison"); |
1250 |
> |
// The part below is meaningless for the offpeak analysis (it's a comparison of the different estimates but there is but one estimate!) |
1251 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
1252 |
> |
TH1F *Bpredem = (TH1F*)LcorrJZBeemm->Clone("Bpredem"); |
1253 |
> |
Bpredem->Add(RcorrJZBem); |
1254 |
> |
Bpredem->Add(LcorrJZBem,-1); |
1255 |
> |
TH1F *BpredSBem = (TH1F*)LcorrJZBeemm->Clone("BpredSBem"); |
1256 |
> |
BpredSBem->Add(RcorrJZBSBem); |
1257 |
> |
Bpred->Add(LcorrJZBSBem,-1); |
1258 |
> |
TH1F *BpredSBeemm = (TH1F*)LcorrJZBeemm->Clone("BpredSBeemm"); |
1259 |
> |
BpredSBeemm->Add(RcorrJZBSBeemm); |
1260 |
> |
BpredSBeemm->Add(LcorrJZBSBeemm,-1.0); |
1261 |
> |
globalcanvas->cd(); |
1262 |
> |
globalcanvas->SetLogy(1); |
1263 |
> |
|
1264 |
> |
RcorrJZBeemm->SetMarkerStyle(20); |
1265 |
> |
RcorrJZBeemm->GetXaxis()->SetRangeUser(0,high); |
1266 |
> |
blankback->Draw(); |
1267 |
> |
RcorrJZBeemm->Draw("e1x0,same"); |
1268 |
> |
RcorrJZBeemm->SetMarkerSize(DataMarkerSize); |
1269 |
> |
|
1270 |
> |
Bpredem->SetLineColor(kRed+1); |
1271 |
> |
Bpredem->SetStats(0); |
1272 |
> |
Bpredem->Draw("hist,same"); |
1273 |
> |
|
1274 |
> |
BpredSBem->SetLineColor(kGreen+2);//TColor::GetColor("#0B6138")); |
1275 |
> |
BpredSBem->SetLineStyle(2); |
1276 |
> |
BpredSBem->Draw("hist,same"); |
1277 |
> |
|
1278 |
> |
BpredSBeemm->SetLineColor(kBlue+1); |
1279 |
> |
BpredSBeemm->SetLineStyle(3); |
1280 |
> |
BpredSBeemm->Draw("hist,same"); |
1281 |
> |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
1282 |
> |
|
1283 |
> |
TLegend *legBpredc = make_legend("",0.6,0.55); |
1284 |
> |
if(use_data==1) |
1285 |
> |
{ |
1286 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"observed","p"); |
1287 |
> |
legBpredc->AddEntry(Bpredem,"OFZP","l"); |
1288 |
> |
legBpredc->AddEntry(BpredSBem,"OFSB","l"); |
1289 |
> |
legBpredc->AddEntry(BpredSBeemm,"SFSB","l"); |
1290 |
> |
legBpredc->Draw(); |
1291 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_Data_comparison"); |
1292 |
> |
} |
1293 |
> |
if(use_data==0) { |
1294 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1295 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1296 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1297 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1298 |
> |
legBpredc->Draw(); |
1299 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_MC_comparison"); |
1300 |
> |
} |
1301 |
> |
if(use_data==2) { |
1302 |
> |
legBpredc->AddEntry(RcorrJZBeemm,"MC true","p"); |
1303 |
> |
legBpredc->AddEntry(Bpredem,"MC OFZP","l"); |
1304 |
> |
legBpredc->AddEntry(BpredSBem,"MC OFSB","l"); |
1305 |
> |
legBpredc->AddEntry(BpredSBeemm,"MC SFSB","l"); |
1306 |
> |
if ( overlay_signal ) legBpred->AddEntry(lm4RcorrJZBeemm,"LM4","l"); |
1307 |
> |
legBpredc->Draw(); |
1308 |
> |
CompleteSave(globalcanvas,subdir+"Bpred_MCwithS_comparison"); |
1309 |
> |
} |
1310 |
|
} |
1311 |
+ |
|
1312 |
+ |
TFile *f = new TFile("tester.root","RECREATE"); |
1313 |
+ |
RcorrJZBeemm->Write(); |
1314 |
+ |
Bpred->Write(); |
1315 |
+ |
f->Close(); |
1316 |
+ |
|
1317 |
|
delete RcorrJZBeemm; |
1318 |
|
delete LcorrJZBeemm; |
1319 |
|
delete RcorrJZBem; |
1326 |
|
|
1327 |
|
delete blankback; |
1328 |
|
|
1329 |
+ |
delete BpredSys; |
1330 |
|
if(PlottingSetup::RestrictToMassPeak) { |
1331 |
|
delete RcorrJZBSBem; |
1332 |
|
delete LcorrJZBSBem; |
1339 |
|
delete JLcorrJZBSBeemm; |
1340 |
|
} |
1341 |
|
if(overlay_signal || use_data==2) delete lm4RcorrJZBeemm; |
1342 |
+ |
switch_overunderflow(false); |
1343 |
|
} |
1344 |
|
|
1345 |
|
void do_prediction_plots(string mcjzb, string datajzb, float DataSigma, float MCSigma, bool overlay_signal ) { |
1346 |
|
TCanvas *globalcanvas = new TCanvas("globalcanvas","Prediction Canvas"); |
1347 |
< |
do_prediction_plot(datajzb,globalcanvas,DataSigma,jzbHigh ,data,overlay_signal); |
1348 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mc,overlay_signal); |
1349 |
< |
do_prediction_plot(mcjzb,globalcanvas,MCSigma,jzbHigh ,mcwithsignal,overlay_signal); |
1347 |
> |
do_prediction_plot(datajzb,globalcanvas,jzbHigh ,data,overlay_signal); |
1348 |
> |
if ( !PlottingSetup::Approved ) { |
1349 |
> |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mc,overlay_signal); |
1350 |
> |
do_prediction_plot(mcjzb,globalcanvas,jzbHigh ,mcwithsignal,overlay_signal); |
1351 |
> |
} else { |
1352 |
> |
write_info(__FUNCTION__,"You set approved to true, therefore not producing prediction/observation plots for MC with and without signal."); |
1353 |
> |
} |
1354 |
|
} |
1355 |
|
|
1356 |
|
void do_ratio_plot(int is_data,vector<float> binning, string jzb, TCanvas *can, float high=-9999) { |
1518 |
|
Float_t ymin = 1.e-5, ymax = 0.25; |
1519 |
|
TCanvas *can = new TCanvas("can","Lepton Comparison Canvas"); |
1520 |
|
can->SetLogy(1); |
1521 |
< |
TH1F *eemc = allsamples.Draw("eemc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("DYJetsToLL")); |
1522 |
< |
TH1F *mmmc = allsamples.Draw("mmmc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("DYJetsToLL")); |
1521 |
> |
TH1F *eemc = allsamples.Draw("eemc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("/DY")); |
1522 |
> |
TH1F *mmmc = allsamples.Draw("mmmc","mll",50,50,150, "mll [GeV]", "events", cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("/DY")); |
1523 |
|
eemc->SetLineColor(kBlue); |
1524 |
|
mmmc->SetLineColor(kRed); |
1525 |
|
eemc->SetMinimum(0.1); |
1584 |
|
DrawPrelim(); |
1585 |
|
save_with_ratio(jeed,jmmd,eemmpad->cd(),"lepton_comparison/jzb_Comparing_ee_mm_data"); |
1586 |
|
|
1587 |
< |
TH1F *zjeed = allsamples.Draw("zjeed",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("DYJets")); |
1588 |
< |
TH1F *zjmmd = allsamples.Draw("zjmmd",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("DYJets")); |
1589 |
< |
TH1F *zjeemmd = allsamples.Draw("zjeemmd",jzbvariablemc,int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets, mc, luminosity,allsamples.FindSample("DYJets")); |
1587 |
> |
TH1F *zjeed = allsamples.Draw("zjeed",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==0)",mc, luminosity,allsamples.FindSample("/DY")); |
1588 |
> |
TH1F *zjmmd = allsamples.Draw("zjmmd",jzbvariablemc, int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets&&"(id1==1)",mc, luminosity,allsamples.FindSample("/DY")); |
1589 |
> |
TH1F *zjeemmd = allsamples.Draw("zjeemmd",jzbvariablemc,int((jzbHigh+150)/5),-150,jzbHigh , "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets, mc, luminosity,allsamples.FindSample("/DY")); |
1590 |
|
dout << "Z+Jets ee : " << zjeed->GetMean() << "+/-" << zjeed->GetMeanError() << endl; |
1591 |
|
dout << "Z+Jets ee : " << zjmmd->GetMean() << "+/-" << zjmmd->GetMeanError() << endl; |
1592 |
|
dout << "Z+Jets eemd : " << zjeemmd->GetMean() << "+/-" << zjeemmd->GetMeanError() << endl; |
1700 |
|
TText *writeline1 = write_cut_on_canvas(write_cut.c_str()); |
1701 |
|
writeline1->SetTextSize(0.035); |
1702 |
|
writeline1->Draw(); |
1703 |
< |
save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
1703 |
> |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad->cd(),("jzb/"+savename)); |
1704 |
> |
else save_with_ratio(datahisto,mcstack,jzbpad->cd(),savename); |
1705 |
|
TPad *jzbpad2 = new TPad("jzbpad2","jzbpad2",0,0,1,1); |
1706 |
|
jzbpad2->cd(); |
1707 |
|
jzbpad2->SetLogy(1); |
1716 |
|
writeline1->SetTextSize(0.035); |
1717 |
|
writeline1->Draw(); |
1718 |
|
DrawPrelim(); |
1719 |
< |
save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
1719 |
> |
if(!Contains(savename,"Dibosons")) save_with_ratio(datahisto,mcstack,jzbpad2->cd(),("jzb/PositiveSideOnly/"+savename+"")); |
1720 |
> |
else save_with_ratio(datahisto,mcstack,jzbpad2->cd(),(savename+"__PosOnly")); |
1721 |
|
datahisto->Delete(); |
1722 |
|
mcstack.Delete(); |
1723 |
|
} |
1725 |
|
Double_t GausR(Double_t *x, Double_t *par) { |
1726 |
|
return gRandom->Gaus(x[0],par[0]); |
1727 |
|
} |
1728 |
+ |
|
1729 |
+ |
void produce_stretched_jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1730 |
+ |
TCanvas *dican = new TCanvas("dican","JZB Plots Canvas"); |
1731 |
+ |
float max=jzbHigh ; |
1732 |
+ |
float min=-120; |
1733 |
+ |
int nbins=(int)((max-min)/5.0); // we want 5 GeV/bin |
1734 |
+ |
int coarserbins=int(nbins/2.0); |
1735 |
+ |
int rebinnedbins=int(nbins/4.0); |
1736 |
+ |
|
1737 |
+ |
vector<float>binning;vector<float>coarse_binning;vector<float>coarsest_binning; |
1738 |
+ |
for(int i=0;i<=nbins;i++)binning.push_back(min+i*(max-min)/((float)nbins)); |
1739 |
+ |
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
1740 |
+ |
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
1741 |
+ |
|
1742 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP",dican,binning); |
1743 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP",dican,binning); |
1744 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_SFZP",dican,binning); |
1745 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_SFZP",dican,binning); |
1746 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"Dibosons/ee/jzb_OS_OFZP",dican,binning); |
1747 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"Dibosons/mm/jzb_OS_OFZP",dican,binning); |
1748 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB",dican,binning); |
1749 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB",dican,binning); |
1750 |
+ |
|
1751 |
+ |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_SFZP_coarse",dican,coarse_binning); |
1752 |
+ |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"Dibosons/jzb_OS_OFZP_coarse",dican,coarse_binning); |
1753 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_SFSB_coarse",dican,coarse_binning); |
1754 |
+ |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"Dibosons/jzb_OS_OFSB_coarse",dican,coarse_binning); |
1755 |
+ |
|
1756 |
+ |
delete dican; |
1757 |
+ |
} |
1758 |
|
|
1759 |
+ |
|
1760 |
+ |
void diboson_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1761 |
+ |
vector<int> SamplesToBeModified = allsamples.FindSampleBySampleName("WW/WZ/ZZ"); |
1762 |
+ |
|
1763 |
+ |
if(SamplesToBeModified.size()==0 || SamplesToBeModified[0]==-1) { |
1764 |
+ |
write_error(__FUNCTION__,"Could not find any diboson samples - aborting diboson plots"); |
1765 |
+ |
return; |
1766 |
+ |
} |
1767 |
+ |
|
1768 |
+ |
float stretchfactor = 100.0; |
1769 |
+ |
vector<string> labels; |
1770 |
+ |
|
1771 |
+ |
|
1772 |
+ |
dout << "Going to increase the cross section for diboson samples ... " << endl; |
1773 |
+ |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
1774 |
+ |
float origxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1775 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].xs=origxs*stretchfactor; |
1776 |
+ |
dout << " Increased xs for sample " << (allsamples.collection)[SamplesToBeModified[i]].filename << " from " << origxs << " to " << (allsamples.collection)[SamplesToBeModified[i]].xs << " (by a factor of " << stretchfactor << ")" << endl; |
1777 |
+ |
labels.push_back((allsamples.collection)[SamplesToBeModified[i]].samplename); |
1778 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].samplename=any2string(int(stretchfactor))+" x "+(allsamples.collection)[SamplesToBeModified[i]].samplename; |
1779 |
+ |
dout << " (also renamed it to " << (allsamples.collection)[SamplesToBeModified[i]].samplename << " )" << endl; |
1780 |
+ |
} |
1781 |
+ |
|
1782 |
+ |
dout << "Going to produce JZB plots" << endl; |
1783 |
+ |
produce_stretched_jzb_plots(mcjzb,datajzb,ratio_binning); |
1784 |
+ |
TCanvas *gloca = new TCanvas("gloca","gloca"); |
1785 |
+ |
|
1786 |
+ |
dout << "Going to produce prediction plots" << endl; |
1787 |
+ |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do only MC plots, no signal |
1788 |
+ |
do_prediction_plot(mcjzb, gloca, PlottingSetup::jzbHigh, 0, false,"Dibosons/Bpred/" ); // do MC plots with signal |
1789 |
+ |
delete gloca; |
1790 |
+ |
|
1791 |
+ |
dout << "Going to reset the cross section for diboson samples ... " << endl; |
1792 |
+ |
for(int i=0;i<(int)SamplesToBeModified.size();i++) { |
1793 |
+ |
float Upxs=(allsamples.collection)[SamplesToBeModified[i]].xs; |
1794 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].xs=(allsamples.collection)[SamplesToBeModified[i]].xs*(1.0/stretchfactor); |
1795 |
+ |
string Upname=(allsamples.collection)[SamplesToBeModified[i]].samplename; |
1796 |
+ |
(allsamples.collection)[SamplesToBeModified[i]].samplename=labels[i]; |
1797 |
+ |
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; |
1798 |
+ |
|
1799 |
+ |
} |
1800 |
+ |
|
1801 |
+ |
} |
1802 |
|
void jzb_plots(string mcjzb, string datajzb,vector<float> ratio_binning) { |
1803 |
|
TCanvas *can = new TCanvas("can","JZB Plots Canvas"); |
1804 |
|
float max=jzbHigh ; |
1812 |
|
for(int i=0;i<=coarserbins;i++)coarse_binning.push_back(min+i*(max-min)/((float)coarserbins)); |
1813 |
|
for(int i=0;i<=rebinnedbins;i++)coarsest_binning.push_back(min+i*(max-min)/((float)rebinnedbins)); |
1814 |
|
|
1815 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
1816 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
1817 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
1818 |
< |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
1819 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
1820 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
1821 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1822 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
1823 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
1815 |
> |
if ( !PlottingSetup::Approved ) { |
1816 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP",can,binning); |
1817 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP",can,binning); |
1818 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_SFZP",can,binning); |
1819 |
> |
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_SFZP",can,binning); |
1820 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==0",datajzb,mcjzb,"ee/jzb_OS_OFZP",can,binning); |
1821 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass&&"id1==1",datajzb,mcjzb,"mm/jzb_OS_OFZP",can,binning); |
1822 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1823 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB",can,binning); |
1824 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB",can,binning); |
1825 |
> |
} |
1826 |
|
|
1827 |
|
draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarse",can,coarse_binning); |
1828 |
< |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
1829 |
< |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1830 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
1831 |
< |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
1832 |
< |
|
1833 |
< |
// draw_pure_jzb_histo(cutOSSF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_SFZP_coarsest",can,coarsest_binning); |
1834 |
< |
// 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); |
1828 |
> |
if ( !PlottingSetup::Approved ) { |
1829 |
> |
draw_pure_jzb_histo(cutOSOF&&cutnJets&&cutmass,datajzb,mcjzb,"jzb_OS_OFZP_coarse",can,coarse_binning); |
1830 |
> |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak |
1831 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSSF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_SFSB_coarse",can,coarse_binning); |
1832 |
> |
if(PlottingSetup::RestrictToMassPeak) draw_pure_jzb_histo(cutOSOF&&cutnJets&&sidebandcut,datajzb,mcjzb,"jzb_OS_OFSB_coarse",can,coarse_binning); |
1833 |
> |
} |
1834 |
> |
delete can; |
1835 |
|
} |
1836 |
|
|
1837 |
|
|
1886 |
|
string posneg[] = {"pos","neg"}; |
1887 |
|
TCut tkRegions[] = {cutOSSF&&cutnJets&&cutmass,cutOSOF&&cutnJets&&cutmass,cutOSSF&&cutnJets&&sidebandcut,cutOSOF&&cutnJets&&sidebandcut}; |
1888 |
|
|
1889 |
< |
for(int ijzb=0;ijzb<jzb_cuts.size();ijzb++) { |
1889 |
> |
for(int ijzb=0;ijzb<(int)jzb_cuts.size();ijzb++) { |
1890 |
|
TCut jzbMC[] = { give_jzb_expression(mcjzb,jzb_cuts[ijzb],"pos"), give_jzb_expression(mcjzb,jzb_cuts[ijzb],"neg") }; |
1891 |
|
dout << "_________________________________________________________" << endl; |
1892 |
|
dout << "Table for JZB> " << jzb_cuts[ijzb] << endl; |
1893 |
< |
for(int isample=0;isample<(allsamples.collection).size();isample++) { |
1893 |
> |
for(int isample=0;isample<(int)(allsamples.collection).size();isample++) { |
1894 |
|
if(!(allsamples.collection)[isample].is_data) dout << (allsamples.collection)[isample].samplename << " & "; |
1895 |
|
else dout << "Sample & "; |
1896 |
|
for(int iregion=0;iregion<nRegions;iregion++) { |
2149 |
|
|
2150 |
|
void draw_ttbar_and_zjets_shape(string mcjzb, string datajzb) { |
2151 |
|
int all_leptons=-1; |
1818 |
– |
int electrons_only=0; |
1819 |
– |
int mu_only=1; |
1820 |
– |
int twojetswith50gev=1; |
2152 |
|
int threejetswith30gev=0; |
2153 |
|
/* |
2154 |
+ |
int twojetswith50gev=1; |
2155 |
+ |
int electrons_only=0; |
2156 |
+ |
int mu_only=1; |
2157 |
+ |
|
2158 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,twojetswith50gev); |
2159 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev); |
2160 |
|
|
2168 |
|
draw_ttbar_and_zjets_shape_for_one_configuration(mcjzb,datajzb,all_leptons,threejetswith30gev,true); |
2169 |
|
} |
2170 |
|
|
2171 |
< |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
1837 |
< |
//first: colorful plots |
2171 |
> |
float find_one_correction_factor(string FindKeyword, TCut SpecialCut, string SaveAs) { |
2172 |
|
TCanvas *cancorr = new TCanvas("cancorr","Canvas for Response Correction"); |
2173 |
|
cancorr->SetLogz(); |
2174 |
|
cancorr->SetRightMargin(0.13); |
2175 |
< |
flag_this_change(__FUNCTION__,__LINE__,false);//PlottingSetup::RestrictToMassPeak |
2176 |
< |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"); |
2175 |
> |
TCut zptforresponsepresentation("pt<600"&&cutmass&&cutOSSF&&"((sumJetPt[1]/pt)<5.0)"&&SpecialCut&&passtrig); |
2176 |
> |
if(PlottingSetup::DoBTag) zptforresponsepresentation=zptforresponsepresentation&&PlottingSetup::bTagRequirement; |
2177 |
|
TH2F *niceresponseplotd = new TH2F("niceresponseplotd","",100,0,600,100,0,5); |
2178 |
< |
(allsamples.collection)[allsamples.FindSample("Data")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotd",zptforresponsepresentation); |
2178 |
> |
vector<int> SampleIndices=allsamples.FindSample(FindKeyword); |
2179 |
> |
for(int iSample=0;iSample<SampleIndices.size();iSample++) { |
2180 |
> |
dout << " Response correction : Using sample " << (allsamples.collection)[SampleIndices[iSample]].filename << " for " << FindKeyword << endl; |
2181 |
> |
(allsamples.collection)[SampleIndices[iSample]].events->Draw("sumJetPt[1]/pt:pt>>+niceresponseplotd",zptforresponsepresentation*cutWeight); |
2182 |
> |
} |
2183 |
> |
|
2184 |
|
niceresponseplotd->SetStats(0); |
2185 |
|
niceresponseplotd->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2186 |
|
niceresponseplotd->GetYaxis()->SetTitle("Response"); |
2189 |
|
niceresponseplotd->Draw("COLZ"); |
2190 |
|
TProfile * profd = (TProfile*)niceresponseplotd->ProfileX(); |
2191 |
|
profd->SetMarkerSize(DataMarkerSize); |
2192 |
< |
profd->Fit("pol0","","same,e1",30,400); |
2192 |
> |
profd->Fit("pol0","","same,e1",100,400); |
2193 |
|
DrawPrelim(); |
2194 |
< |
TText* title = write_text(0.5,0.7,"Data"); |
2194 |
> |
string stitle="Data"; |
2195 |
> |
if(!Contains(FindKeyword,"Data")) stitle="MC"; |
2196 |
> |
TText* title = write_text(0.5,0.7,stitle.c_str()); |
2197 |
|
title->SetTextAlign(12); |
2198 |
|
title->Draw(); |
2199 |
|
TF1 *datapol=(TF1*)profd->GetFunction("pol0"); |
2200 |
< |
float datacorrection=datapol->GetParameter(0); |
2201 |
< |
stringstream dataresstring; |
2202 |
< |
dataresstring<<"Response: "<<std::setprecision(2)<<100*datacorrection<<" %"; |
2203 |
< |
TText* restitle = write_text(0.5,0.65,dataresstring.str()); |
2200 |
> |
float correction=datapol->GetParameter(0); |
2201 |
> |
stringstream resstring; |
2202 |
> |
resstring<<"Response: "<<std::setprecision(2)<<100*correction<<" %"; |
2203 |
> |
TText* restitle = write_text(0.5,0.65,resstring.str()); |
2204 |
|
restitle->SetTextAlign(12); |
2205 |
|
restitle->SetTextSize(0.03); |
2206 |
|
restitle->Draw(); |
2207 |
< |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_Data"); |
2208 |
< |
|
2209 |
< |
TH2F *niceresponseplotm = new TH2F("niceresponseplotm","",100,0,600,100,0,5); |
2210 |
< |
(allsamples.collection)[allsamples.FindSample("DY")[0]].events->Draw("sumJetPt[1]/pt:pt>>niceresponseplotm",zptforresponsepresentation); |
2211 |
< |
niceresponseplotm->SetStats(0); |
2212 |
< |
niceresponseplotm->GetXaxis()->SetTitle("Z p_{T} [GeV]"); |
2213 |
< |
niceresponseplotm->GetYaxis()->SetTitle("Response"); |
1873 |
< |
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"); |
2207 |
> |
CompleteSave(cancorr,"ResponseCorrection/Response_Correction_Illustration_New_"+SaveAs); |
2208 |
> |
delete cancorr; |
2209 |
> |
delete niceresponseplotd; |
2210 |
> |
return correction; |
2211 |
> |
} |
2212 |
> |
|
2213 |
> |
void find_correction_factors(string &jzbvardata,string &jzbvarmc) { |
2214 |
|
|
2215 |
+ |
dout << "Computing response corrections: " << endl; |
2216 |
+ |
//Step 1 : Get results |
2217 |
+ |
float datacorrection=find_one_correction_factor("Data","","Data"); |
2218 |
+ |
float mccorrection=find_one_correction_factor("DY","","MC"); |
2219 |
+ |
|
2220 |
+ |
float dataEEcorrection=find_one_correction_factor("Data","id1==0","Data_ee"); |
2221 |
+ |
float mcEEcorrection=find_one_correction_factor("DY","id1==0","MC_ee"); |
2222 |
+ |
|
2223 |
+ |
float dataMMcorrection=find_one_correction_factor("Data","id1==1","Data_mm"); |
2224 |
+ |
float mcMMcorrection=find_one_correction_factor("DY","id1==1","MC_mm"); |
2225 |
+ |
|
2226 |
+ |
cout << "Corrections : " << endl; |
2227 |
+ |
cout << " Data : " << datacorrection << endl; |
2228 |
+ |
cout << " ee (" << dataEEcorrection << ") , mm (" << dataMMcorrection << ")" << endl; |
2229 |
+ |
cout << " MC : " << mccorrection << endl; |
2230 |
+ |
cout << " ee (" << mcEEcorrection << ") , mm (" << mcMMcorrection << ")" << endl; |
2231 |
|
|
2232 |
< |
//Step 2: Getting the result |
1896 |
< |
// TCut zptcutforresponse("pt>30&&pt<300&&TMath::Abs(91.2-mll)<20&&id1==id2&&(ch1*ch2<0)"); |
2232 |
> |
//Step 2: Processing the result and making it into something useful :-) |
2233 |
|
stringstream jzbvardatas; |
2234 |
< |
if(datacorrection>1) jzbvardatas<<"(jzb[1]-"<<datacorrection-1<<"*pt)"; |
2235 |
< |
if(datacorrection<1) jzbvardatas<<"(jzb[1]+"<<1-datacorrection<<"*pt)"; |
2234 |
> |
jzbvardatas << "("; |
2235 |
> |
|
2236 |
> |
if(dataEEcorrection>=1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]-" << dataEEcorrection-1 << "*pt))"; |
2237 |
> |
if(dataEEcorrection<1) jzbvardatas<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-dataEEcorrection << "*pt))"; |
2238 |
> |
|
2239 |
> |
if(dataMMcorrection>=1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]-" << dataMMcorrection-1 << "*pt))"; |
2240 |
> |
if(dataMMcorrection<1) jzbvardatas<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-dataMMcorrection << "*pt))"; |
2241 |
> |
|
2242 |
> |
float averagecorrection=(dataMMcorrection+dataEEcorrection)/2.0; |
2243 |
> |
|
2244 |
> |
if(datacorrection>=1) jzbvardatas<<"+((id1!=id2)*(jzb[1]-" << datacorrection-1 << "*pt))"; |
2245 |
> |
if(datacorrection<1) jzbvardatas<<"+((id1!=id2)*(jzb[1]+" << 1-datacorrection << "*pt))"; |
2246 |
> |
|
2247 |
> |
jzbvardatas << ")"; |
2248 |
|
jzbvardata=jzbvardatas.str(); |
2249 |
+ |
|
2250 |
|
stringstream jzbvarmcs; |
2251 |
< |
if(mccorrection>1) jzbvarmcs<<"(jzb[1]-"<<mccorrection-1<<"*pt)"; |
2252 |
< |
if(mccorrection<1) jzbvarmcs<<"(jzb[1]+"<<1-mccorrection<<"*pt)"; |
2251 |
> |
jzbvarmcs << "("; |
2252 |
> |
|
2253 |
> |
if(mcEEcorrection>=1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]-" << mcEEcorrection-1 << "*pt))"; |
2254 |
> |
if(mcEEcorrection<1) jzbvarmcs<<"((id1==0&&id1==id2)*(jzb[1]+" << 1-mcEEcorrection << "*pt))"; |
2255 |
> |
|
2256 |
> |
if(mcMMcorrection>=1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]-" << mcMMcorrection-1 << "*pt))"; |
2257 |
> |
if(mcMMcorrection<1) jzbvarmcs<<"+((id1==1&&id1==id2)*(jzb[1]+" << 1-mcMMcorrection << "*pt))"; |
2258 |
> |
|
2259 |
> |
float averagemccorrection=(mcMMcorrection+mcEEcorrection)/2.0; |
2260 |
> |
|
2261 |
> |
if(mccorrection>=1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]-" << mccorrection-1 << "*pt))"; |
2262 |
> |
if(mccorrection<1) jzbvarmcs<<"+((id1!=id2)*(jzb[1]+" << 1-mccorrection << "*pt))"; |
2263 |
> |
|
2264 |
> |
jzbvarmcs << ")"; |
2265 |
|
jzbvarmc=jzbvarmcs.str(); |
2266 |
+ |
|
2267 |
|
dout << "JZB Z pt correction summary : " << endl; |
2268 |
|
dout << " Data: The response is " << datacorrection << " --> jzb variable is now : " << jzbvardata << endl; |
2269 |
|
dout << " MC : The response is " << mccorrection << " --> jzb variable is now : " << jzbvarmc << endl; |
2270 |
+ |
|
2271 |
|
} |
2272 |
|
|
2273 |
|
void pick_up_events(string cut) { |
2275 |
|
allsamples.PickUpEvents(cut); |
2276 |
|
} |
2277 |
|
|
2278 |
< |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError) { |
2278 |
> |
void save_template(string mcjzb, string datajzb,vector<float> jzb_cuts,float MCPeakError,float DataPeakError, vector<float> jzb_shape_limit_bins) { |
2279 |
|
dout << "Saving configuration template!" << endl; |
2280 |
|
ofstream configfile; |
2281 |
|
configfile.open("../DistributedModelCalculations/last_configuration.C"); |
2295 |
|
configfile<<"string datajzb=\"datajzb_ERROR\";\n"; |
2296 |
|
configfile<<"string mcjzb=\"mcjzb_ERROR\";\n"; |
2297 |
|
configfile<<"vector<float>jzb_cuts;\n"; |
2298 |
+ |
configfile<<"vector<float>jzb_shape_limit_bins;\n"; |
2299 |
|
configfile<<"float MCPeakError=-999;\n"; |
2300 |
+ |
configfile<<"float DataPeakError=-999;\n"; |
2301 |
|
configfile<<"}\n\n"; |
2302 |
|
|
2303 |
|
configfile<<"void read_config() {\n"; |
2304 |
|
configfile<<"datajzb=\""<<datajzb<<"\";\n"; |
2305 |
|
configfile<<"mcjzb=\""<<mcjzb<<"\";\n\n"; |
2306 |
< |
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n\n"; |
2307 |
< |
for(int i=0;i<jzb_cuts.size();i++) configfile<<"jzb_cuts.push_back("<<jzb_cuts[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2306 |
> |
configfile<<"\n\nMCPeakError="<<MCPeakError<<";\n"; |
2307 |
> |
configfile<<"DataPeakError="<<DataPeakError<<";\n\n"; |
2308 |
> |
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"; |
2309 |
|
configfile<<"\n\n"; |
2310 |
< |
for(int i=0;i<Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2311 |
< |
for(int i=0;i<Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2312 |
< |
for(int i=0;i<Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2310 |
> |
for(int i=0;i<(int)Nobs.size();i++) configfile<<"Nobs.push_back("<<Nobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2311 |
> |
for(int i=0;i<(int)Npred.size();i++) configfile<<"Npred.push_back("<<Npred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2312 |
> |
for(int i=0;i<(int)Nprederr.size();i++) configfile<<"Nprederr.push_back("<<Nprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2313 |
> |
configfile<<"\n\n"; |
2314 |
> |
for(int i=0;i<(int)flippedNobs.size();i++) configfile<<"flippedNobs.push_back("<<flippedNobs[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2315 |
> |
for(int i=0;i<(int)flippedNpred.size();i++) configfile<<"flippedNpred.push_back("<<flippedNpred[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2316 |
> |
for(int i=0;i<(int)flippedNprederr.size();i++) configfile<<"flippedNprederr.push_back("<<flippedNprederr[i]<<"); // JZB cut at " << jzb_cuts[i] << "\n"; |
2317 |
> |
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"; |
2318 |
|
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"; |
2319 |
|
configfile<<"\n\n"; |
2320 |
|
configfile<<"luminosity="<<luminosity<<";\n"; |
2321 |
+ |
configfile<<"RestrictToMassPeak="<<RestrictToMassPeak<<";//defines the type of analysis we're running\n"; |
2322 |
|
|
2323 |
|
configfile<<"\n\ncout << \"Configuration successfully loaded!\" << endl; \n \n } \n \n"; |
2324 |
|
|
2341 |
|
float max=histos[0]->GetMaximum(); |
2342 |
|
if(manualmin>=0) min=manualmin; |
2343 |
|
else { |
2344 |
< |
for(int i=1;i<histos.size();i++) { |
2344 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2345 |
|
float curmin=get_nonzero_minimum(histos[i]); |
2346 |
|
float curmax=histos[i]->GetMaximum(); |
2347 |
|
if(curmin<min) min=curmin; |
2352 |
|
histos[0]->Draw(drawoption.c_str()); |
2353 |
|
stringstream drawopt; |
2354 |
|
drawopt << drawoption << ",same"; |
2355 |
< |
for(int i=1;i<histos.size();i++) { |
2355 |
> |
for(int i=1;i<(int)histos.size();i++) { |
2356 |
|
histos[i]->Draw(drawopt.str().c_str()); |
2357 |
|
} |
2358 |
|
} |
2361 |
|
//in the case of the on peak analysis, we compare the 3 control regions to the real value |
2362 |
|
//in the case of the OFF peak analysis, we compare our control region to the real value |
2363 |
|
TCut weightbackup=cutWeight; |
2364 |
< |
cutWeight="1.0"; |
2364 |
> |
// cutWeight="1.0"; |
2365 |
|
float simulatedlumi = luminosity; //in pb please - adjust to your likings |
2366 |
< |
|
2366 |
> |
for(int i=0;i<binning.size();i++) cout << "Bin i : " << binning[i] << endl; |
2367 |
|
|
2368 |
|
TH1F *TZem = systsamples.Draw("TZem",mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2369 |
|
TH1F *nTZem = systsamples.Draw("nTZem","-"+mcjzb,binning,"JZB [GeV]","events",cutmass&&cutOSOF&&cutnJets,mc,simulatedlumi,systsamples.FindSample("TTJets")); |
2401 |
|
} |
2402 |
|
|
2403 |
|
vector<TH1F*> histos; |
2404 |
+ |
TZem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2405 |
+ |
TZeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2406 |
|
histos.push_back(TZem); |
2407 |
|
histos.push_back(TZeemm); |
2408 |
|
if(PlottingSetup::RestrictToMassPeak) { |
2409 |
+ |
TSeemm->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2410 |
+ |
TSem->GetXaxis()->SetRangeUser(-100,binning[binning.size()-1]); |
2411 |
|
histos.push_back(TSem); |
2412 |
|
histos.push_back(TSeemm); |
2413 |
|
} |
2423 |
|
leg->Draw("same"); |
2424 |
|
DrawMCPrelim(simulatedlumi); |
2425 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison"); |
2053 |
– |
|
2426 |
|
TH1F *TZemcopy = (TH1F*)TZem->Clone("TZemcopy"); |
2427 |
|
TH1F *TZeemmcopy = (TH1F*)TZeemm->Clone("TZeemmcopy"); |
2428 |
< |
TH1F *TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2429 |
< |
TH1F *TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2428 |
> |
TH1F *TSeemmcopy; |
2429 |
> |
TH1F *TSemcopy; |
2430 |
> |
if(PlottingSetup::RestrictToMassPeak) { |
2431 |
> |
TSeemmcopy = (TH1F*)TSeemm->Clone("TSeemmcopy"); |
2432 |
> |
TSemcopy = (TH1F*)TSem->Clone("TSemcopy"); |
2433 |
> |
} |
2434 |
|
|
2435 |
|
TZem->Divide(TZeemm); |
2436 |
|
TZem->SetMarkerStyle(21); |
2452 |
|
|
2453 |
|
float linepos=0.25; |
2454 |
|
if(PlottingSetup::RestrictToMassPeak) linepos=0.25; |
2455 |
+ |
if(!PlottingSetup::RestrictToMassPeak) linepos=0.1; //sys uncertainty for iJZB |
2456 |
|
TLine *top = new TLine(binning[0],1.0+linepos,binning[binning.size()-1],1.0+linepos); |
2457 |
|
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2458 |
|
TLine *bottom = new TLine(binning[0],1.0-linepos,binning[binning.size()-1],1.0-linepos); |
2459 |
|
|
2460 |
+ |
/*write_warning(__FUNCTION__,"These two lines are to be removed!"); |
2461 |
+ |
TLine *topalt = new TLine(binning[0],1.0+0.1,binning[binning.size()-1],1.0+0.1); |
2462 |
+ |
TLine *bottomalt = new TLine(binning[0],1.0-0.1,binning[binning.size()-1],1.0-0.1); |
2463 |
+ |
topalt->SetLineColor(kRed);topalt->SetLineStyle(3); |
2464 |
+ |
bottomalt->SetLineColor(kRed);bottomalt->SetLineStyle(3); |
2465 |
+ |
topalt->Draw("same");bottomalt->Draw("same");*/ |
2466 |
+ |
|
2467 |
+ |
|
2468 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
2469 |
|
bottom->SetLineColor(kBlue);bottom->SetLineStyle(2); |
2470 |
|
center->SetLineColor(kBlue); |
2489 |
|
CompleteSave(tcan,"Systematics/"+prestring+"/ttbar_shape_comparison_ratio"); |
2490 |
|
|
2491 |
|
|
2107 |
– |
|
2492 |
|
///-------------- second part: only look at the quantity we actually care about! |
2493 |
|
TH1F *leftsfzp = (TH1F*)nTZeemm->Clone("leftsfzp"); |
2494 |
|
TH1F *rightsfzp = (TH1F*)TZeemmcopy->Clone("rightsfzp"); |
2534 |
|
tcan->SetLogy(0); |
2535 |
|
rightofzp->Divide(rightsfzp); |
2536 |
|
rightofzp->GetXaxis()->SetRangeUser(0.0,binning[binning.size()-1]); |
2537 |
< |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.0); |
2537 |
> |
rightofzp->GetYaxis()->SetRangeUser(0.0,2.5); |
2538 |
|
rightofzp->GetYaxis()->SetTitle("#deltaJZB ratio"); |
2539 |
|
rightofzp->Draw(); |
2540 |
|
if(PlottingSetup::RestrictToMassPeak) { |
2594 |
|
|
2595 |
|
void ttbar_sidebands_comparison(string mcjzb, vector<float> jzb_binning) { |
2596 |
|
vector<float> nicer_binning; |
2597 |
< |
nicer_binning.push_back(-125); |
2597 |
> |
/* |
2598 |
> |
nicer_binning.push_back(-400); |
2599 |
> |
nicer_binning.push_back(-250); |
2600 |
> |
nicer_binning.push_back(-200); |
2601 |
> |
nicer_binning.push_back(-150); |
2602 |
> |
nicer_binning.push_back(-100); |
2603 |
> |
nicer_binning.push_back(-50); |
2604 |
> |
nicer_binning.push_back(-20); |
2605 |
> |
|
2606 |
> |
nicer_binning.push_back(0); |
2607 |
> |
nicer_binning.push_back(20); |
2608 |
> |
nicer_binning.push_back(50); |
2609 |
> |
nicer_binning.push_back(100); |
2610 |
> |
nicer_binning.push_back(150); |
2611 |
> |
nicer_binning.push_back(200); |
2612 |
> |
nicer_binning.push_back(250); |
2613 |
> |
nicer_binning.push_back(400); |
2614 |
> |
*/ |
2615 |
|
nicer_binning.push_back(-100); |
2215 |
– |
nicer_binning.push_back(-75); |
2616 |
|
nicer_binning.push_back(-50); |
2617 |
|
nicer_binning.push_back(-25); |
2618 |
|
nicer_binning.push_back(0); |
2627 |
|
nicer_binning.push_back(230); |
2628 |
|
nicer_binning.push_back(280); |
2629 |
|
nicer_binning.push_back(400); |
2630 |
+ |
|
2631 |
|
ttbar_sidebands_comparison(mcjzb,nicer_binning, "ttbar/"); |
2632 |
|
} |
2633 |
|
|
2634 |
|
|
2635 |
< |
void zjets_prediction_comparison() { |
2635 |
> |
void zjets_prediction_comparison(string mcjzbWithPU) { |
2636 |
> |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2637 |
> |
zcan->SetLogy(1); |
2638 |
> |
TCut weightbackup=cutWeight; |
2639 |
> |
|
2640 |
> |
/* |
2641 |
|
// Do it without PU re-weighting |
2642 |
|
float MCPeakNoPU=0,MCPeakErrorNoPU=0,DataPeakNoPU=0,DataPeakErrorNoPU=0,MCSigma=0,DataSigma=0; |
2643 |
|
stringstream resultsNoPU; |
2644 |
|
|
2645 |
|
stringstream mcjzbnoPU; |
2646 |
< |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,false); |
2646 |
> |
find_peaks(MCPeakNoPU,MCPeakErrorNoPU, DataPeakNoPU, DataPeakErrorNoPU,MCSigma,DataSigma,resultsNoPU,true); |
2647 |
|
if(MCPeakNoPU>0) mcjzbnoPU<<"("<<jzbvariablemc<<"-"<<TMath::Abs(MCPeakNoPU)<<")"; |
2648 |
|
else mcjzbnoPU<<"("<<jzbvariablemc<<"+"<<TMath::Abs(MCPeakNoPU)<<")"; |
2649 |
|
|
2650 |
|
string mcjzb = mcjzbnoPU.str(); |
2651 |
|
dout << "The peak corrected JZB expression for MC without pileup is : " << mcjzb << endl; |
2652 |
|
|
2247 |
– |
TCut weightbackup=cutWeight; |
2653 |
|
cutWeight="1.0"; |
2654 |
< |
float sbg_min=0.; |
2655 |
< |
float sbg_max=100.; |
2656 |
< |
int sbg_nbins=5; |
2654 |
> |
*/ |
2655 |
> |
string mcjzb = mcjzbWithPU; // this is with PURW, if you want without it you have to uncomment the part above (and comment out this line) |
2656 |
> |
|
2657 |
> |
vector<float> binning; |
2658 |
> |
binning.push_back(0); |
2659 |
> |
binning.push_back(20); |
2660 |
> |
binning.push_back(40); |
2661 |
> |
binning.push_back(60); |
2662 |
> |
binning.push_back(80); |
2663 |
> |
binning.push_back(100); |
2664 |
> |
// float sbg_min=0.; |
2665 |
> |
// float sbg_max=100.; |
2666 |
> |
// int sbg_nbins=5; |
2667 |
|
float simulatedlumi = luminosity;//in pb please - adjust to your likings |
2668 |
|
|
2669 |
|
TCut kPos((mcjzb+">0").c_str()); |
2670 |
|
TCut kNeg((mcjzb+"<0").c_str()); |
2671 |
|
string var( "abs("+mcjzb+")" ); |
2672 |
|
|
2673 |
< |
TCut kcut(cutmass&&cutOSSF&&"pfJetGoodNum>2"); |
2674 |
< |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2675 |
< |
kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("DYJets")); |
2261 |
< |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,sbg_nbins,sbg_min,sbg_max, "JZB [GeV]", "events", |
2262 |
< |
kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("DYJets")); |
2673 |
> |
TCut kcut(cutmass&&cutOSSF&&cutnJets); |
2674 |
> |
TH1F *hJZBpos = systsamples.Draw("hJZBpos",var,binning, "JZB [GeV]", "events",kcut&&kPos,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2675 |
> |
TH1F *hJZBneg = systsamples.Draw("hJZBneg",var,binning, "JZB [GeV]", "events",kcut&&kNeg,mc,simulatedlumi,systsamples.FindSample("/DY")); |
2676 |
|
hJZBpos->SetLineColor(kBlack); |
2677 |
|
hJZBneg->SetLineColor(kRed); |
2678 |
|
|
2679 |
< |
Int_t nbins = 5; |
2267 |
< |
Float_t xmax = 100.; |
2268 |
< |
|
2269 |
< |
|
2270 |
< |
TCanvas *zcan = new TCanvas("zcan","zcan"); |
2271 |
< |
zcan->SetLogy(1); |
2272 |
< |
|
2679 |
> |
hJZBpos->SetMinimum(1.0); |
2680 |
|
hJZBpos->Draw("e1"); |
2681 |
|
hJZBneg->Draw("same,hist"); |
2682 |
|
hJZBpos->Draw("same,e1"); // So it's on top... |
2691 |
|
TH1F* hratio = (TH1F*)hJZBpos->Clone("hratio"); |
2692 |
|
hratio->Divide(hJZBneg); |
2693 |
|
|
2694 |
+ |
for(int i=1;i<=hJZBpos->GetNbinsX();i++) { |
2695 |
+ |
cout << "Positive: " << hJZBpos->GetBinContent(i) << " vs Negative : " << hJZBneg->GetBinContent(i) << endl; |
2696 |
+ |
} |
2697 |
+ |
|
2698 |
|
zcan->SetLogy(0); |
2699 |
|
hratio->GetYaxis()->SetRangeUser(0,2.5); |
2700 |
|
hratio->GetYaxis()->SetTitle("Observed/Predicted"); |
2701 |
|
hratio->Draw("e1"); |
2702 |
|
|
2703 |
< |
TLine *top = new TLine(sbg_min,1.25,sbg_max,1.25); |
2704 |
< |
TLine *center = new TLine(sbg_min,1.0,sbg_max,1.0); |
2705 |
< |
TLine *bottom = new TLine(sbg_min,0.75,sbg_max,0.75); |
2703 |
> |
TLine *top = new TLine(binning[0],1.25,binning[binning.size()-1],1.25); |
2704 |
> |
TLine *center = new TLine(binning[0],1.0,binning[binning.size()-1],1.0); |
2705 |
> |
TLine *bottom = new TLine(binning[0],0.75,binning[binning.size()-1],0.75); |
2706 |
|
|
2707 |
|
|
2708 |
|
top->SetLineColor(kBlue);top->SetLineStyle(2); |
2744 |
|
tout << "\\begin{tabular}{l|cc}" << endl; |
2745 |
|
tout << "\\hline" << endl; |
2746 |
|
tout << "& {\\OFZP} & {\\OFSB} \\\\\\hline" << endl; |
2747 |
< |
tout << "\\#(events) & "<<OFSB<<" & "<<OFZP<<"\\\\ \\hline" << endl; |
2747 |
> |
tout << "\\#(events) & "<<OFZP<<" & "<<OFSB<<"\\\\ \\hline" << endl; |
2748 |
|
tout << "\\end{tabular}" << endl; |
2749 |
|
tout << "\\end{center}" << endl; |
2750 |
|
tout << "\\end{table}" << endl; |
2762 |
|
|
2763 |
|
TCanvas *cannie = new TCanvas("cannie","cannie"); |
2764 |
|
|
2765 |
< |
for(int icut=0;icut<jzb_cuts.size();icut++) { |
2765 |
> |
for(int icut=0;icut<(int)jzb_cuts.size();icut++) { |
2766 |
|
float currcut=jzb_cuts[icut]; |
2767 |
|
int nbins=1;float low=currcut; |
2768 |
|
vector<int> mysample; |
2821 |
|
//prediction part |
2822 |
|
if(is_data) cout << "Data prediction & "; |
2823 |
|
if(subselection!="none") cout << subselection << " prediction &"; |
2824 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
2824 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutprediction[ij] << " vs " << metcutprediction[ij] << " & "; |
2825 |
|
|
2826 |
|
cout << endl; |
2827 |
|
//observation part |
2828 |
|
if(is_data) cout << "Data observation & "; |
2829 |
|
if(subselection!="none") cout << subselection << " observation &"; |
2830 |
< |
for(int ij=0;ij<jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
2830 |
> |
for(int ij=0;ij<(int)jzb_cuts.size();ij++) cout << jzbcutobservation[ij] << " vs " << metcutobservation[ij] << " & "; |
2831 |
|
cout << endl; |
2832 |
|
cout << "_________________________________________________________________" << endl; |
2833 |
|
delete cannie; |
2862 |
|
int nbins = sizeof(xbins)/sizeof(float)-1; |
2863 |
|
int markers[] = { 20, 26, 21, 24, 22, 25, 28 }; |
2864 |
|
|
2865 |
< |
TH1F* heff = new TH1F("heff", "JZB eff ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
2866 |
< |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
2867 |
< |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator-level JZB [GeV]; efficiency",nbins,xbins); |
2865 |
> |
|
2866 |
> |
TH1F* heff = new TH1F("heff", "JZB eff ; generator JZB [GeV]; efficiency",nbins,xbins); |
2867 |
> |
TH1F* hgen = new TH1F("hgen", "JZB gen ; generator JZB [GeV]; efficiency",nbins,xbins); |
2868 |
> |
TH1F* hreco = new TH1F("hreco","JZB reco ; generator JZB [GeV]; efficiency",nbins,xbins); |
2869 |
|
|
2870 |
|
TCut kgen(genMassCut&&"genZPt>0&&genNjets>2&&abs(genMID)==23"&&cutOSSF); |
2871 |
|
TCut kreco(cutmass); |
2881 |
|
TCanvas *can = new TCanvas("can","Canvas for JZB Efficiency",600,600); |
2882 |
|
can->SetGridx(1); |
2883 |
|
can->SetGridy(1); |
2884 |
+ |
can->SetLeftMargin(0.16); |
2885 |
+ |
can->SetRightMargin(0.05); |
2886 |
|
TLegend *leg = make_legend("",0.6,0.2,false,0.89,0.5); |
2887 |
+ |
leg->SetBorderSize(1); |
2888 |
+ |
leg->SetLineColor(kBlack); |
2889 |
+ |
leg->SetTextFont(62); |
2890 |
|
|
2891 |
< |
|
2475 |
< |
|
2476 |
< |
for ( int icut=0; icut<jzb_bins.size(); ++icut ) { |
2891 |
> |
for ( int icut=0; icut<(int)jzb_bins.size(); ++icut ) { |
2892 |
|
|
2893 |
|
ostringstream selection; |
2894 |
|
selection << mcjzb << ">" << jzb_bins[icut]; |
2904 |
|
} |
2905 |
|
|
2906 |
|
heff->GetXaxis()->SetRangeUser(min, max); |
2907 |
+ |
// heff->GetXaxis()->SetLabelSize(0.05); // paper style. overruled. |
2908 |
+ |
// heff->GetYaxis()->SetLabelSize(0.05); // paper style. overruled. |
2909 |
+ |
// heff->GetXaxis()->SetTitleSize(0.06); // paper style. overruled. |
2910 |
+ |
// heff->GetYaxis()->SetTitleSize(0.06); // paper style. overruled. |
2911 |
|
heff->SetMarkerStyle(markers[icut]); |
2912 |
|
heff->Fit("func","Q+","same"); |
2913 |
|
|
2919 |
|
|
2920 |
|
// Store plot |
2921 |
|
TH1F* h = (TH1F*)heff->Clone(hname); |
2922 |
+ |
h->SetNdivisions(505,"X"); |
2923 |
|
if ( icut) h->Draw("same"); |
2924 |
|
else h->Draw(); |
2925 |
|
char htitle[256]; sprintf(htitle,"JZB > %3.0f GeV", jzb_bins[icut]); |
2940 |
|
// Calls the above function for each signal sample |
2941 |
|
void plot_jzb_sel_eff(string mcjzb, samplecollection &signalsamples, vector<float> bins ) |
2942 |
|
{ |
2943 |
< |
for (int isignal=0; isignal<signalsamples.collection.size();isignal++) { |
2943 |
> |
for (int isignal=0; isignal<(int)signalsamples.collection.size();isignal++) { |
2944 |
|
dout << "JZB selection efficiency curve: " << std::endl; |
2945 |
|
JZBSelEff(mcjzb,(signalsamples.collection)[isignal].events,(signalsamples.collection)[isignal].samplename,bins); // Only for some selected samples |
2946 |
|
} |
2947 |
|
} |
2948 |
+ |
|
2949 |
+ |
void qcd_plots(string datajzb, string mcjzb, vector<float> bins) { |
2950 |
+ |
// What this function aims to do: |
2951 |
+ |
// Illustrate cut flow for QCD (requiring only one lepton, requiring etc.) |
2952 |
+ |
// Illustrate how little QCD is left over! i.e. make some pointless JZB plot with only QCD to visualize the fact that there's not much really. |
2953 |
+ |
TCanvas *can = new TCanvas("can","can"); |
2954 |
+ |
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
2955 |
+ |
kinpad->cd(); |
2956 |
+ |
|
2957 |
+ |
string jzb=mcjzb; |
2958 |
|
|
2959 |
+ |
float hi=400; |
2960 |
+ |
bool use_signal=false; |
2961 |
+ |
bool use_data=false; |
2962 |
+ |
|
2963 |
+ |
bool is_data=false; |
2964 |
+ |
int nbins=50;//100; |
2965 |
+ |
float low=0; |
2966 |
+ |
float high=500; |
2967 |
+ |
int versok=false; |
2968 |
+ |
if(gROOT->GetVersionInt()>=53000) versok=true; |
2969 |
+ |
|
2970 |
+ |
TH1F *blankback = new TH1F("blankback","blankback",int(high/10),0,high); |
2971 |
+ |
TH1F *RcorrJZBeemm = qcdsamples.Draw("RcorrJZBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2972 |
+ |
TH1F *LcorrJZBeemm = qcdsamples.Draw("LcorrJZBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2973 |
+ |
TH1F *RcorrJZBem = qcdsamples.Draw("RcorrJZBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2974 |
+ |
TH1F *LcorrJZBem = qcdsamples.Draw("LcorrJZBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2975 |
+ |
blankback->GetXaxis()->SetTitle(RcorrJZBeemm->GetXaxis()->GetTitle()); |
2976 |
+ |
blankback->GetYaxis()->SetTitle(RcorrJZBeemm->GetYaxis()->GetTitle()); |
2977 |
+ |
blankback->GetXaxis()->CenterTitle(); |
2978 |
+ |
blankback->GetYaxis()->CenterTitle(); |
2979 |
+ |
|
2980 |
+ |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
2981 |
+ |
TH1F *RcorrJZBSBem; |
2982 |
+ |
TH1F *LcorrJZBSBem; |
2983 |
+ |
TH1F *RcorrJZBSBeemm; |
2984 |
+ |
TH1F *LcorrJZBSBeemm; |
2985 |
+ |
|
2986 |
+ |
// TH1F *RcorrJZBeemmNoS; |
2987 |
+ |
|
2988 |
+ |
//these are for the ratio |
2989 |
+ |
TH1F *JRcorrJZBeemm = qcdsamples.Draw("JRcorrJZBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2990 |
+ |
TH1F *JLcorrJZBeemm = qcdsamples.Draw("JLcorrJZBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
2991 |
+ |
TH1F *JRcorrJZBem = qcdsamples.Draw("JRcorrJZBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2992 |
+ |
TH1F *JLcorrJZBem = qcdsamples.Draw("JLcorrJZBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", cutmass&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
2993 |
+ |
|
2994 |
+ |
TH1F *JRcorrJZBSBem; |
2995 |
+ |
TH1F *JLcorrJZBSBem; |
2996 |
+ |
TH1F *JRcorrJZBSBeemm; |
2997 |
+ |
TH1F *JLcorrJZBSBeemm; |
2998 |
+ |
|
2999 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
3000 |
+ |
RcorrJZBSBem = qcdsamples.Draw("RcorrJZBSBem",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3001 |
+ |
LcorrJZBSBem = qcdsamples.Draw("LcorrJZBSBem",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3002 |
+ |
RcorrJZBSBeemm = qcdsamples.Draw("RcorrJZBSBeemm",jzb.c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3003 |
+ |
LcorrJZBSBeemm = qcdsamples.Draw("LcorrJZBSBeemm",("-"+jzb).c_str(),nbins,low,hi, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3004 |
+ |
|
3005 |
+ |
//these are for the ratio |
3006 |
+ |
JRcorrJZBSBem = qcdsamples.Draw("JRcorrJZBSBem",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3007 |
+ |
JLcorrJZBSBem = qcdsamples.Draw("JLcorrJZBSBem",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSOF&&cutnJets,is_data, luminosity,use_signal); |
3008 |
+ |
JRcorrJZBSBeemm = qcdsamples.Draw("JRcorrJZBSBeemm",jzb.c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3009 |
+ |
JLcorrJZBSBeemm = qcdsamples.Draw("JLcorrJZBSBeemm",("-"+jzb).c_str(),PlottingSetup::global_ratio_binning, "JZB [GeV]", "events", sidebandcut&&cutOSSF&&cutnJets,is_data, luminosity,use_signal); |
3010 |
+ |
|
3011 |
+ |
} |
3012 |
+ |
|
3013 |
+ |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed. |
3014 |
+ |
|
3015 |
+ |
TH1F *Zjetspred = (TH1F*)LcorrJZBeemm->Clone("Zjetspred"); |
3016 |
+ |
TH1F *TTbarpred = (TH1F*)RcorrJZBem->Clone("TTbarpred"); |
3017 |
+ |
|
3018 |
+ |
TH1F *Bpred = (TH1F*)LcorrJZBeemm->Clone("Bpred"); |
3019 |
+ |
TH1F *JBpred = (TH1F*)JLcorrJZBeemm->Clone("Bpred"); |
3020 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
3021 |
+ |
Bpred->Add(RcorrJZBem,1.0/3.); |
3022 |
+ |
Bpred->Add(LcorrJZBem,-1.0/3.); |
3023 |
+ |
Bpred->Add(RcorrJZBSBem,1.0/3.); |
3024 |
+ |
Bpred->Add(LcorrJZBSBem,-1.0/3.); |
3025 |
+ |
Bpred->Add(RcorrJZBSBeemm,1.0/3.); |
3026 |
+ |
Bpred->Add(LcorrJZBSBeemm,-1.0/3.); |
3027 |
+ |
|
3028 |
+ |
TTbarpred->Scale(1.0/3); |
3029 |
+ |
Zjetspred->Add(LcorrJZBem,-1.0/3.); |
3030 |
+ |
Zjetspred->Add(LcorrJZBSBem,-1.0/3.); |
3031 |
+ |
TTbarpred->Add(RcorrJZBSBem,1.0/3.); |
3032 |
+ |
Zjetspred->Add(LcorrJZBSBeemm,-1.0/3.); |
3033 |
+ |
TTbarpred->Add(RcorrJZBSBeemm,1.0/3.); |
3034 |
+ |
|
3035 |
+ |
//these are for the ratio |
3036 |
+ |
JBpred->Add(JRcorrJZBem,1.0/3.); |
3037 |
+ |
JBpred->Add(JLcorrJZBem,-1.0/3.); |
3038 |
+ |
JBpred->Add(JRcorrJZBSBem,1.0/3.); |
3039 |
+ |
JBpred->Add(JLcorrJZBSBem,-1.0/3.); |
3040 |
+ |
JBpred->Add(JRcorrJZBSBeemm,1.0/3.); |
3041 |
+ |
JBpred->Add(JLcorrJZBSBeemm,-1.0/3.); |
3042 |
+ |
} else { |
3043 |
+ |
Bpred->Add(RcorrJZBem,1.0); |
3044 |
+ |
Bpred->Add(LcorrJZBem,-1.0); |
3045 |
+ |
|
3046 |
+ |
Zjetspred->Add(LcorrJZBem,-1.0); |
3047 |
+ |
|
3048 |
+ |
//these are for the ratio |
3049 |
+ |
JBpred->Add(JRcorrJZBem,1.0); |
3050 |
+ |
JBpred->Add(JLcorrJZBem,-1.0); |
3051 |
+ |
} |
3052 |
+ |
|
3053 |
+ |
|
3054 |
+ |
flag_this_change(__FUNCTION__,__LINE__,true);//PlottingSetup::RestrictToMassPeak ---- prediction changed |
3055 |
+ |
|
3056 |
+ |
TLegend *legBpred = make_legend("",0.6,0.55,false); |
3057 |
+ |
RcorrJZBeemm->Draw("e1x0,same"); |
3058 |
+ |
Bpred->Draw("hist,same"); |
3059 |
+ |
RcorrJZBeemm->Draw("e1x0,same");//HAVE IT ON TOP! |
3060 |
+ |
legBpred->AddEntry(RcorrJZBeemm,"MC observed","p"); |
3061 |
+ |
legBpred->AddEntry(Bpred,"MC predicted","l"); |
3062 |
+ |
if(versok) legBpred->AddEntry((TObject*)0,"",""); // Just for alignment // causes seg fault on root v5.18 |
3063 |
+ |
if(versok) legBpred->AddEntry((TObject*)0,"",""); // causes seg fault on root v5.18 |
3064 |
+ |
legBpred->Draw(); |
3065 |
+ |
DrawMCPrelim(); |
3066 |
+ |
|
3067 |
+ |
//3rd last argument: do special bpred ratio, 2nd last argument: extended range!, last: y-axis title |
3068 |
+ |
string ytitle("ratio"); |
3069 |
+ |
if ( use_data==1 ) ytitle = "data/pred"; |
3070 |
+ |
save_with_ratio(JRcorrJZBeemm,JBpred,kinpad,"QCD/Bpred",true,false,ytitle); |
3071 |
+ |
|
3072 |
+ |
TH1F *allevents = qcdsamples.Draw("allevents","pfJetGoodNum",1,0,100, "internal code", "events", "" ,mc, luminosity); |
3073 |
+ |
TH1F *ossf = qcdsamples.Draw("ossf","pfJetGoodNum",1,0,100, "internal code", "events", cutOSSF ,mc, luminosity); |
3074 |
+ |
TH1F *osof = qcdsamples.Draw("osof","pfJetGoodNum",1,0,100, "internal code", "events", cutOSOF ,mc, luminosity); |
3075 |
+ |
TH1F *njossf = qcdsamples.Draw("njossf","pfJetGoodNum",1,0,100, "internal code", "events", cutnJets&&cutOSSF ,mc, luminosity); |
3076 |
+ |
TH1F *njosof = qcdsamples.Draw("njosof","pfJetGoodNum",1,0,100, "internal code", "events", cutnJets&&cutOSOF ,mc, luminosity); |
3077 |
+ |
|
3078 |
+ |
dout << "______________________________________________" << endl; |
3079 |
+ |
dout << "QCD contribution: " << endl; |
3080 |
+ |
dout << "Total number of events: " << allevents->Integral() << endl; |
3081 |
+ |
dout << "OSSF events: " << ossf->Integral() << endl; |
3082 |
+ |
dout << "OSOF events: " << osof->Integral() << endl; |
3083 |
+ |
dout << "OSSF events with >=3 jets:" << njossf->Integral() << endl; |
3084 |
+ |
dout << "OSOF events with >=3 jets:" << njosof->Integral() << endl; |
3085 |
+ |
dout << "(note that no mass requirement has been imposed)" << endl; |
3086 |
+ |
|
3087 |
+ |
dout << "______________________________________________" << endl; |
3088 |
+ |
dout << "How QCD shows up in the different regions: " << endl; |
3089 |
+ |
dout << "OSSF: " << endl; |
3090 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
3091 |
+ |
dout << " Z window: \t" << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
3092 |
+ |
dout << " sideband: \t" << RcorrJZBSBeemm->Integral() << " (JZB>0) , " << LcorrJZBSBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBSBeemm->Integral() + LcorrJZBSBeemm->Integral() << endl; |
3093 |
+ |
} else { |
3094 |
+ |
dout << " " << RcorrJZBeemm->Integral() << " (JZB>0) , " << LcorrJZBeemm->Integral() << " (JZB<0) --> total: " << RcorrJZBeemm->Integral() + LcorrJZBeemm->Integral() << endl; |
3095 |
+ |
} |
3096 |
+ |
dout << "OSOF: " << endl; |
3097 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
3098 |
+ |
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
3099 |
+ |
dout << " sideband: \t" << RcorrJZBSBem->Integral() << " (JZB>0) , " << LcorrJZBSBem->Integral() << " (JZB<0) --> total: " << RcorrJZBSBem->Integral() + LcorrJZBSBem->Integral() << endl; |
3100 |
+ |
} else { |
3101 |
+ |
dout << " Z window: \t" << RcorrJZBem->Integral() << " (JZB>0) , " << LcorrJZBem->Integral() << " (JZB<0) --> total: " << RcorrJZBem->Integral() + LcorrJZBem->Integral() << endl; |
3102 |
+ |
} |
3103 |
+ |
dout << "Therefore: " << endl; |
3104 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
3105 |
+ |
dout << " Prediction increases by : " << LcorrJZBeemm->Integral() << " + (1.0/3)*(" << RcorrJZBSBeemm->Integral() <<"-"<< LcorrJZBSBeemm->Integral() << ") (SFSB) "; |
3106 |
+ |
dout << " + (1.0/3)*(" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) "; |
3107 |
+ |
dout << " + (1.0/3)*(" << RcorrJZBSBem->Integral() <<"-"<< LcorrJZBSBem->Integral() << ") (OFSB) "; |
3108 |
+ |
dout << " = " << LcorrJZBeemm->Integral() + (1.0/3)*(RcorrJZBSBeemm->Integral() - LcorrJZBSBeemm->Integral() + RcorrJZBem->Integral() - LcorrJZBem->Integral() + RcorrJZBSBem->Integral() - LcorrJZBSBem->Integral()) << endl; |
3109 |
+ |
} else { |
3110 |
+ |
dout << " Prediction increases by : " << LcorrJZBeemm->Integral(); |
3111 |
+ |
dout << " + (" << RcorrJZBem->Integral() <<"-"<< LcorrJZBem->Integral() << ") (OFZP) "; |
3112 |
+ |
dout << " = " << LcorrJZBeemm->Integral() + RcorrJZBem->Integral() - LcorrJZBem->Integral() << endl; |
3113 |
+ |
} |
3114 |
+ |
dout << " Observation increases by : " << RcorrJZBeemm->Integral() << endl; |
3115 |
+ |
|
3116 |
+ |
dout << endl; |
3117 |
+ |
for(int i=0;i<(int)bins.size();i++) { |
3118 |
+ |
dout << " JZB > " << bins[i] << " : " << endl; |
3119 |
+ |
dout << " Observation increases by : " << RcorrJZBeemm->Integral(RcorrJZBeemm->FindBin(bins[i]),RcorrJZBeemm->GetNbinsX()) << endl; |
3120 |
+ |
if(PlottingSetup::RestrictToMassPeak) { |
3121 |
+ |
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; |
3122 |
+ |
} else { |
3123 |
+ |
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; |
3124 |
+ |
} |
3125 |
+ |
} |
3126 |
+ |
|
3127 |
+ |
delete can; |
3128 |
+ |
delete allevents; |
3129 |
+ |
if(ossf) delete ossf; |
3130 |
+ |
if(RcorrJZBem) delete RcorrJZBem; |
3131 |
+ |
if(LcorrJZBem) delete LcorrJZBem; |
3132 |
+ |
if(RcorrJZBeemm) delete RcorrJZBeemm; |
3133 |
+ |
if(LcorrJZBeemm) delete LcorrJZBeemm; |
3134 |
+ |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBem) delete RcorrJZBSBem; |
3135 |
+ |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBem) delete LcorrJZBSBem; |
3136 |
+ |
if(PlottingSetup::RestrictToMassPeak&&RcorrJZBSBeemm) delete RcorrJZBSBeemm; |
3137 |
+ |
if(PlottingSetup::RestrictToMassPeak&&LcorrJZBSBeemm) delete LcorrJZBSBeemm; |
3138 |
+ |
} |
3139 |
+ |
|
3140 |
+ |
void check_ptsanity() { |
3141 |
+ |
TCanvas *ptsancan = new TCanvas("ptsancan","ptsancan",600,1800); |
3142 |
+ |
TH1F *individualpt1histos[allsamples.collection.size()]; |
3143 |
+ |
TH1F *individualpt2histos[allsamples.collection.size()]; |
3144 |
+ |
TH1F *fpt1 = new TH1F("fpt1","fpt1",50,0,50); |
3145 |
+ |
fpt1->GetYaxis()->SetRangeUser(0,1); |
3146 |
+ |
fpt1->GetXaxis()->SetTitle("p_{T,1}"); |
3147 |
+ |
fpt1->GetXaxis()->CenterTitle(); |
3148 |
+ |
|
3149 |
+ |
TH1F *fpt2 = new TH1F("fpt2","fpt2",50,0,50); |
3150 |
+ |
fpt2->GetXaxis()->SetTitle("p_{T,2}"); |
3151 |
+ |
fpt2->GetXaxis()->CenterTitle(); |
3152 |
+ |
|
3153 |
+ |
ptsancan->Divide(1,3); |
3154 |
+ |
ptsancan->cd(1); |
3155 |
+ |
float maxpt1entry=0; |
3156 |
+ |
float maxpt2entry=0; |
3157 |
+ |
|
3158 |
+ |
TLegend *leg = make_legend(); |
3159 |
+ |
leg->SetX1(0.0); |
3160 |
+ |
leg->SetY1(0.0); |
3161 |
+ |
leg->SetX2(1.0); |
3162 |
+ |
leg->SetY2(1.0); |
3163 |
+ |
|
3164 |
+ |
|
3165 |
+ |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3166 |
+ |
string nowname=(allsamples.collection)[isample].filename; |
3167 |
+ |
cout << "Drawing: " << nowname << " (sample " << isample+1 << " / " << allsamples.collection.size() << ")" << endl; |
3168 |
+ |
individualpt1histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt1",50,0,50, "p_{T,1}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
3169 |
+ |
individualpt2histos[isample] = allsamples.Draw(GetNumericHistoName(),"pt2",50,0,50, "p_{T,2}", "events",cutOSSF&&cutnJets,mc,luminosity,allsamples.FindSample(nowname)); |
3170 |
+ |
individualpt1histos[isample]->SetLineColor(isample+1); |
3171 |
+ |
individualpt2histos[isample]->SetLineColor(isample+1); |
3172 |
+ |
float currmaxpt1entry=individualpt1histos[isample]->GetMaximum()/individualpt1histos[isample]->Integral(); |
3173 |
+ |
float currmaxpt2entry=individualpt2histos[isample]->GetMaximum()/individualpt2histos[isample]->Integral(); |
3174 |
+ |
cout << " pt 1 histo contains; " << individualpt1histos[isample]->Integral() << endl; |
3175 |
+ |
cout << " pt 2 histo contains; " << individualpt2histos[isample]->Integral() << endl; |
3176 |
+ |
if(currmaxpt1entry>maxpt1entry)maxpt1entry=currmaxpt1entry; |
3177 |
+ |
if(currmaxpt2entry>maxpt2entry)maxpt2entry=currmaxpt2entry; |
3178 |
+ |
leg->AddEntry(individualpt2histos[isample],((allsamples.collection)[isample].filename).c_str(),"f"); |
3179 |
+ |
} |
3180 |
+ |
|
3181 |
+ |
fpt1->GetYaxis()->SetRangeUser(0,maxpt1entry); |
3182 |
+ |
fpt2->GetYaxis()->SetRangeUser(0,maxpt2entry); |
3183 |
+ |
|
3184 |
+ |
ptsancan->cd(1); |
3185 |
+ |
fpt1->Draw(); |
3186 |
+ |
ptsancan->cd(2); |
3187 |
+ |
fpt2->Draw(); |
3188 |
+ |
|
3189 |
+ |
for(int isample=0;isample<(int)allsamples.collection.size();isample++) { |
3190 |
+ |
ptsancan->cd(1); |
3191 |
+ |
individualpt1histos[isample]->DrawNormalized("same,histo"); |
3192 |
+ |
ptsancan->cd(2); |
3193 |
+ |
individualpt2histos[isample]->DrawNormalized("same,histo"); |
3194 |
+ |
} |
3195 |
+ |
ptsancan->cd(3); |
3196 |
+ |
leg->Draw(); |
3197 |
+ |
CompleteSave(ptsancan,"PtSanityCheck"); |
3198 |
+ |
|
3199 |
+ |
delete ptsancan; |
3200 |
+ |
} |
3201 |
+ |
|
3202 |
+ |
void do_mlls_plot(string mcjzb) { |
3203 |
+ |
cout << "At this point we'd plot the mll distribution" << endl; |
3204 |
+ |
TCanvas *sigcan = new TCanvas("sigcan","sigcan"); |
3205 |
+ |
for(int isig=0;isig<(int)(signalsamples.collection).size();isig++) { |
3206 |
+ |
if(!(signalsamples.collection)[isig].events) continue; |
3207 |
+ |
string nowname=(signalsamples.collection)[isig].filename; |
3208 |
+ |
TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets,mc,luminosity,signalsamples.FindSample(nowname)); |
3209 |
+ |
// TH1F *mll = signalsamples.Draw("mllhisto","mll",150,0,150, "m_{ll}", "events","",mc,luminosity,signalsamples.FindSample(nowname)); |
3210 |
+ |
mll->SetLineColor(TColor::GetColor("#04B404")); |
3211 |
+ |
stringstream poscutS; |
3212 |
+ |
poscutS << "((" << mcjzb <<")>50)"; |
3213 |
+ |
TCut poscut(poscutS.str().c_str()); |
3214 |
+ |
TH1F *mllP = signalsamples.Draw("mllhistoP","mll",150,0,150, "m_{ll}", "events",cutOSSF&&cutnJets&&poscut,mc,luminosity,signalsamples.FindSample(nowname)); |
3215 |
+ |
mllP->SetLineColor(TColor::GetColor("#0040FF")); |
3216 |
+ |
mll->Draw("histo"); |
3217 |
+ |
mllP->Draw("histo,same"); |
3218 |
+ |
TLegend *leg = make_legend(); |
3219 |
+ |
leg->SetY1(0.8); |
3220 |
+ |
leg->AddEntry(mll,(signalsamples.collection)[isig].samplename.c_str(),"L"); |
3221 |
+ |
leg->AddEntry(mllP,((signalsamples.collection)[isig].samplename+", JZB>50").c_str(),"L"); |
3222 |
+ |
leg->Draw(); |
3223 |
+ |
TLine *lin = new TLine(71.2,0,71.2,mll->GetMaximum()); |
3224 |
+ |
TLine *lin2 = new TLine(111.2,0,111.2,mll->GetMaximum()); |
3225 |
+ |
lin->Draw("same"); |
3226 |
+ |
lin2->Draw("same"); |
3227 |
+ |
|
3228 |
+ |
CompleteSave(sigcan,"MllShape/"+(signalsamples.collection)[isig].samplename); |
3229 |
+ |
delete mll; |
3230 |
+ |
delete mllP; |
3231 |
+ |
} |
3232 |
+ |
} |
3233 |
+ |
|
3234 |
+ |
void met_vs_jzb_plots() { |
3235 |
+ |
|
3236 |
+ |
TCanvas *canmetjzb = new TCanvas("canmet","MET vs JZB canvas"); |
3237 |
+ |
canmetjzb->SetRightMargin(0.16); |
3238 |
+ |
|
3239 |
+ |
vector<string> findme; |
3240 |
+ |
findme.push_back("DY"); |
3241 |
+ |
findme.push_back("TTJets"); |
3242 |
+ |
findme.push_back("LM"); |
3243 |
+ |
|
3244 |
+ |
for(int ifind=0;ifind<(int)findme.size();ifind++) { |
3245 |
+ |
vector<int> selsamples = allsamples.FindSample(findme[ifind]); |
3246 |
+ |
TH2F *metvsjzb = new TH2F("metvsjzb","metvsjzb",200,0,100,400,-100,100); |
3247 |
+ |
for(int isel=0;isel<(int)selsamples.size();isel++) { |
3248 |
+ |
cout << "Producing MET:JZB plot ... working on sample: " << allsamples.collection[selsamples[isel]].filename << endl; |
3249 |
+ |
allsamples.collection[selsamples[isel]].events->Draw("jzb[1]:met[4]>>+metvsjzb",cutmass&&cutOSSF); |
3250 |
+ |
} |
3251 |
+ |
metvsjzb->Scale(allsamples.collection[selsamples[0]].weight); |
3252 |
+ |
metvsjzb->SetStats(0); |
3253 |
+ |
metvsjzb->GetXaxis()->SetTitle("MET (GeV)"); |
3254 |
+ |
metvsjzb->GetYaxis()->SetTitle("JZB (GeV)"); |
3255 |
+ |
metvsjzb->GetXaxis()->CenterTitle(); |
3256 |
+ |
metvsjzb->GetYaxis()->CenterTitle(); |
3257 |
+ |
metvsjzb->Draw("COLZ"); |
3258 |
+ |
TText* title = write_text(0.5,0.95,allsamples.collection[selsamples[0]].samplename); |
3259 |
+ |
title->SetTextAlign(12); |
3260 |
+ |
title->Draw(); |
3261 |
+ |
CompleteSave(canmetjzb,(string)"METvsJZBplots/"+findme[ifind]); |
3262 |
+ |
} |
3263 |
+ |
} |
3264 |
+ |
|
3265 |
|
|
3266 |
|
void test() { |
3267 |
|
|