1 |
|
#include <iostream> |
2 |
|
#include <vector> |
3 |
|
#include <sys/stat.h> |
4 |
+ |
#include <math.h> |
5 |
|
|
6 |
|
#include <TCut.h> |
7 |
|
#include <TROOT.h> |
22 |
|
using namespace PlottingSetup; |
23 |
|
|
24 |
|
namespace ZbData { |
24 |
– |
vector<float> data_over_mc; |
25 |
– |
|
25 |
|
TCut ZplusBsel("pt1>20&&pt2>20&&mll>60&&mll<120&&id1==id2"); |
26 |
|
TCut LeadingB("ZbCHS3010_bTagProbCSVBP[0]>0.898"); |
27 |
|
TCut EtaB("abs(ZbCHS3010_pfJetGoodEta[0])<1.3"); |
103 |
|
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* AND THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*// |
104 |
|
|
105 |
|
|
106 |
< |
void print_yield(TCut cut) { |
106 |
> |
class CutYields{ |
107 |
> |
public: |
108 |
> |
float data; |
109 |
> |
float Zb; |
110 |
> |
float Zc; |
111 |
> |
float Zl; |
112 |
> |
float tt; |
113 |
> |
float SiTo; |
114 |
> |
float Dibosons; |
115 |
> |
float WJets; |
116 |
> |
float Other; |
117 |
> |
|
118 |
> |
CutYields(); |
119 |
> |
}; |
120 |
> |
|
121 |
> |
CutYields::CutYields() { |
122 |
> |
this->data=0; |
123 |
> |
this->Zb=0; |
124 |
> |
this->Zc=0; |
125 |
> |
this->Zl=0; |
126 |
> |
this->tt=0; |
127 |
> |
this->SiTo=0; |
128 |
> |
this->Dibosons=0; |
129 |
> |
this->WJets=0; |
130 |
> |
this->Other=0; |
131 |
> |
} |
132 |
> |
|
133 |
> |
std::ostream &operator<<(std::ostream &ostr, CutYields y) |
134 |
> |
{ |
135 |
> |
return ostr << y.data << ";" << y.Zb << ";" << y.Zc << ";" << y.Zl << ";" << y.tt << ";" << y.SiTo << ";" << y.Dibosons << ";" << y.WJets << ";" << endl; |
136 |
> |
} |
137 |
> |
|
138 |
> |
|
139 |
> |
CutYields print_yield(TCut cut) { |
140 |
> |
|
141 |
> |
CutYields Yield; |
142 |
|
TH1F *data = allsamples.Draw("data", "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,data,luminosity); |
143 |
|
dout << " Yields for " << (const char*) cut << endl; |
144 |
< |
dout << " data: " << data->Integral() << endl; |
144 |
> |
// dout << " data: " << data->Integral() << endl; |
145 |
> |
|
146 |
> |
Yield.data=data->Integral(); |
147 |
|
THStack mcm = allsamples.DrawStack("mc", "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,mc,luminosity); |
148 |
|
int nhists = mcm.GetHists()->GetEntries(); |
113 |
– |
dout << "Going to loop over " << nhists << " histograms " << endl; |
149 |
|
TFile *test = new TFile("test.root","RECREATE"); |
150 |
|
mcm.Write(); |
151 |
|
test->Close(); |
152 |
|
for (int i = 0; i < nhists; i++) { |
153 |
|
TH1* hist = static_cast<TH1*>(mcm.GetHists()->At(i)); |
154 |
< |
cout << " " << hist->GetName() << ": " << hist->Integral() << endl; |
154 |
> |
string name=hist->GetName(); |
155 |
> |
if(Contains(name,"t_bar_t")) Yield.tt+=hist->Integral(); |
156 |
> |
if(Contains(name,"W_Jets")) Yield.WJets+=hist->Integral(); |
157 |
> |
if(Contains(name,"Single_top")) Yield.SiTo+=hist->Integral(); |
158 |
> |
if(Contains(name,"Dibosons")) Yield.Dibosons+=hist->Integral(); |
159 |
> |
if(Contains(name,"Z_l_")) Yield.Zl+=hist->Integral(); |
160 |
> |
if(Contains(name,"Z_c_")) Yield.Zc+=hist->Integral(); |
161 |
> |
if(Contains(name,"Z_b_")) Yield.Zb+=hist->Integral(); |
162 |
|
} |
163 |
< |
|
163 |
> |
|
164 |
> |
cout << Yield << endl; |
165 |
|
cout << endl << endl; |
166 |
|
|
167 |
|
delete data; |
168 |
+ |
CleanLegends(); |
169 |
+ |
DeleteStack(mcm); |
170 |
+ |
|
171 |
+ |
return Yield; |
172 |
|
} |
173 |
|
|
174 |
|
void draw_kin_variable(string variable, TCut cut, int nbins, float min, float max, string xlabel, string saveas, bool dologscale, string speciallabel="") { |
128 |
– |
|
175 |
|
TCanvas *ckin = new TCanvas("ckin","kin variable canvas"); |
176 |
< |
// ckin->SetLogy(dologscale); |
176 |
> |
if(dologscale) ckin->SetLogy(1); |
177 |
|
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
178 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
179 |
|
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
180 |
|
if(dologscale) datahisto->SetMaximum(3*datahisto->GetMaximum()); |
181 |
|
else datahisto->SetMaximum(1.5*datahisto->GetMaximum()); |
182 |
< |
|
182 |
> |
|
183 |
> |
float SumMC=0.0; |
184 |
> |
TIter nextH(mcstack.GetHists()); |
185 |
> |
TH1F* h; |
186 |
> |
while ( h = (TH1F*)nextH() ) { |
187 |
> |
SumMC += h->Integral(); |
188 |
> |
} |
189 |
> |
float scale = datahisto->Integral()/SumMC; |
190 |
> |
|
191 |
> |
// Re-scale stack to data integral |
192 |
> |
nextH = TIter(mcstack.GetHists()); |
193 |
> |
|
194 |
> |
while ( h = (TH1F*)nextH() ) { |
195 |
> |
h->Scale(scale); |
196 |
> |
} |
197 |
> |
|
198 |
|
TText *speciall; |
199 |
|
datahisto->Draw("e1"); |
200 |
|
ckin->Update(); |
201 |
|
mcstack.Draw("histo,same"); |
202 |
|
datahisto->Draw("same,e1"); |
203 |
|
TLegend *kinleg = allsamples.allbglegend(); |
204 |
+ |
|
205 |
|
kinleg->Draw(); |
206 |
|
|
207 |
|
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
208 |
|
kinpad->cd(); |
209 |
< |
kinpad->SetLogy(dologscale); |
209 |
> |
if(dologscale) kinpad->SetLogy(1); |
210 |
|
datahisto->Draw("e1"); |
211 |
|
mcstack.Draw("histo,same"); |
212 |
|
datahisto->Draw("same,e1"); |
214 |
|
kinleg->Draw(); |
215 |
|
DrawPrelim(); |
216 |
|
saveas="kin/"+saveas; |
217 |
+ |
kinpad->cd(); |
218 |
+ |
|
219 |
|
if(speciallabel!="") { |
220 |
< |
speciall = new TText(0.2,0.8,speciallabel.c_str()); |
220 |
> |
speciall = write_title(speciallabel); |
221 |
> |
speciall->SetX(0.18); |
222 |
> |
speciall->SetTextAlign(11); |
223 |
> |
speciall->SetTextSize(0.03); |
224 |
> |
speciall->SetY(0.85); |
225 |
|
speciall->Draw(); |
226 |
|
} |
159 |
– |
save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas); |
160 |
– |
|
227 |
|
|
228 |
< |
ZbData::data_over_mc.push_back(datahisto->Integral()/CollapseStack(mcstack)->Integral()); |
228 |
> |
save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas); |
229 |
|
|
230 |
|
datahisto->Delete(); |
231 |
+ |
delete kinleg; |
232 |
|
delete ckin; |
233 |
+ |
CleanLegends(); |
234 |
+ |
DeleteStack(mcstack); |
235 |
|
} |
236 |
< |
|
236 |
> |
|
237 |
|
void print_all_b_yields() { |
238 |
+ |
vector<CutYields> yields; |
239 |
|
cout << "Basic selection with a b jet" << endl; |
240 |
< |
print_yield(ZplusBsel&&"ZbCHS3010_pfJetGoodNumBtag>0"); |
240 |
> |
yields.push_back(print_yield(ZplusBsel&&"ZbCHS3010_pfJetGoodNumBtag>0")); |
241 |
|
cout << "Leading jet is a b-jet " << endl; |
242 |
< |
print_yield(ZplusBsel&&LeadingB); |
242 |
> |
yields.push_back(print_yield(ZplusBsel&&LeadingB)); |
243 |
|
cout << "|#eta_{b}|<1.3 " << endl; |
244 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB); |
244 |
> |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB)); |
245 |
|
cout << "|#delta#phi(b<Z)|>2.7" << endl; |
246 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut); |
246 |
> |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut)); |
247 |
|
cout << "30<ptZ<1000 GeV" << endl; |
248 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"); |
248 |
> |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000")); |
249 |
|
cout << "#alpha < 0.35" << endl; |
250 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.35"); |
250 |
> |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.35")); |
251 |
|
cout << "#alpha < 0.3" << endl; |
252 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.3"); |
253 |
< |
cout << "#alpha < 0.2" << endl; |
254 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.2"); |
252 |
> |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.3")); |
253 |
> |
/* cout << "#alpha < 0.2" << endl; |
254 |
> |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.2")); |
255 |
|
cout << "#alpha < 0.15" << endl; |
256 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.15"); |
256 |
> |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.15")); |
257 |
|
cout << "#alpha < 0.1" << endl; |
258 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.1"); |
258 |
> |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.1"));*/ |
259 |
> |
|
260 |
> |
for(int iy=0;iy<yields.size();iy++) { |
261 |
> |
cout << yields[iy] << endl; |
262 |
> |
} |
263 |
|
} |
264 |
|
|
265 |
|
void DrawEvilCutFlow() { |
287 |
|
|
288 |
|
|
289 |
|
TH1F *data = allsamples.Draw("data", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity); |
290 |
< |
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity); |
290 |
> |
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity); |
291 |
|
|
292 |
|
float runningsum=0; |
293 |
|
for(int i=data->GetNbinsX();i>0;i--) { |
337 |
|
DrawPrelim(); |
338 |
|
|
339 |
|
CompleteSave(can,"CutFlow"); |
340 |
+ |
CleanLegends(); |
341 |
+ |
DeleteStack(mcm); |
342 |
+ |
|
343 |
|
} |
344 |
|
|
345 |
|
void draw_Zb_kin_vars() { |
346 |
< |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",25,0,200,"Z p_{T}","Official/Zpt",1); |
347 |
< |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt",1); |
348 |
< |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt",1); |
349 |
< |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/SubLeadingJetPt_Over_ZPt",1); |
350 |
< |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<50", 40,0,2,"#alpha","Official/alpha_pt_30_to_50",1); |
351 |
< |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>50&&pt<75", 40,0,2,"#alpha","Official/alpha_50_to_75",1); |
352 |
< |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>75&&pt<125", 40,0,2,"#alpha","Official/alpha_pt_75_to_125",1); |
353 |
< |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>125&&pt<1000",40,0,2,"#alpha","Official/alpha_pt_125_to_1000",1); |
354 |
< |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",40,0,2,"#alpha","Official/alpha_pt_30_to_1000",1); |
355 |
< |
|
356 |
< |
draw_kin_variable("ZbCHS3010_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>30&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",0); |
357 |
< |
|
281 |
< |
/* |
282 |
< |
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,0,200,"p_{T}^{l1}","Lep/pt1",1); |
283 |
< |
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id1==0",20,0,200,"p_{T}^{e1}","Lep/pt1_e",1); |
284 |
< |
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id1==1",20,0,200,"p_{T}^{#mu1}","Lep/pt1_m",1); |
285 |
< |
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,0,200,"p_{T}^{l2}","Lep/pt2",1); |
286 |
< |
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id2==0",20,0,200,"p_{T}^{e2}","Lep/pt2_e",1); |
287 |
< |
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id2==1",20,0,200,"p_{T}^{#mu2}","Lep/pt2_m",1); |
288 |
< |
draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta1",1); |
289 |
< |
draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id1==0",20,-3.1,3.1,"#eta^{e1}","Lep/eta1_e",1); |
290 |
< |
draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id1==1",20,-3.1,3.1,"#eta^{m1}","Lep/eta1_m",1); |
291 |
< |
draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta2",1); |
292 |
< |
draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id2==0",20,-3.1,3.1,"#eta^{e2}","Lep/eta2_e",1); |
293 |
< |
draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000&&id2==1",20,-3.1,3.1,"#eta^{#mu2}","Lep/eta2_m",1); |
294 |
< |
draw_kin_variable("numVtx",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",30,0,30,"N(Vtx)","Lep/nVtx",1); |
295 |
< |
*/ |
346 |
> |
|
347 |
> |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Z p_{T}","Official/Zpt",1); |
348 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt",1); |
349 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt",1); |
350 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/SubLeadingJetPt_Over_ZPt",1); |
351 |
> |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<50"), 40,0,2,"#alpha","Official/alpha_pt_30_to_50",1); |
352 |
> |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>50&&pt<75"), 40,0,2,"#alpha","Official/alpha_50_to_75",1); |
353 |
> |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>75&&pt<125"), 40,0,2,"#alpha","Official/alpha_pt_75_to_125",1); |
354 |
> |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>125&&pt<1000"),40,0,2,"#alpha","Official/alpha_pt_125_to_1000",1); |
355 |
> |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),40,0,2,"#alpha","Official/alpha_pt_30_to_1000",1); |
356 |
> |
|
357 |
> |
draw_kin_variable("ZbCHS3010_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&TCut("pt>30&&pt<1000&&pfBJetDphiZ[0]>0"),30,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",0); |
358 |
|
} |
359 |
|
|
360 |
|
void draw_mpf_vars() { |
361 |
< |
ZbData::data_over_mc.clear(); |
362 |
< |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.3",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
363 |
< |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.2",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
364 |
< |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.15",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
365 |
< |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.1",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
366 |
< |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.05",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
367 |
< |
|
368 |
< |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.3",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p3",0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
369 |
< |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.2",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p2",0,"#alpha<0.2, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
370 |
< |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.15",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p15",0,"#alpha<0.15, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
371 |
< |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.1",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p1",0,"#alpha<0.1, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
310 |
< |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"ZbCHS3010_alpha<0.05",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz__mpf_alpha_smaller_0p05",0,"#alpha<0.05, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
361 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.3"), 20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
362 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.2"), 20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
363 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.15"),20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
364 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.1"), 20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
365 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.05"),20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
366 |
> |
|
367 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.3"), 20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p3", 0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
368 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.2"), 20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p2", 0,"#alpha<0.2, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
369 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.15"),20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p15", 0,"#alpha<0.15, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
370 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.1"), 20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p1", 0,"#alpha<0.1, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
371 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.05"),20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz__mpf_alpha_smaller_0p05",0,"#alpha<0.05, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
372 |
|
} |
373 |
|
|
313 |
– |
/*double GetMedian(TH1F *histo) { |
314 |
– |
int numBins = histo->GetXaxis()->GetNbins(); |
315 |
– |
Double_t x[numBins]; |
316 |
– |
Double_t y[numBins]; |
317 |
– |
for (int i = 1; i <= numBins; i++) { |
318 |
– |
x[i] = histo->GetBinCenter(i); |
319 |
– |
y[i] = histo->GetBinContent(i); |
320 |
– |
} |
321 |
– |
return TMath::Median(numBins, &x, &y); |
322 |
– |
}*/ |
323 |
– |
|
374 |
|
Value get_Zb_data_over_mc(string ContainerName, ZbResultContainer &res, string variable, string variable2, TCut cut, string saveas, float pt1, float pt2, float a1, float a2) { |
375 |
|
// write_warning(__FUNCTION__,"Debugging this function, therefore always returning 3.1415+/-1.010101"); return Value(3.1415,1.010101); |
376 |
|
TCanvas *cn = new TCanvas("cn","cn"); |
381 |
|
|
382 |
|
|
383 |
|
if(Contains(variable,"pfJetGood")) varname="R_{abs}"; |
384 |
< |
TH1F *hdata = allsamples.Draw("hdata",variable,1200,0,30, varname, "events", cut,data,luminosity); |
385 |
< |
TH1F *hmc = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc, luminosity); |
384 |
> |
// TH1F *hdata = allsamples.Draw("hdata",variable,1200,0,30, varname, "events", cut,data,luminosity); |
385 |
> |
// TH1F *hmc = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc, luminosity); |
386 |
> |
TH1F *hdata = allsamples.Draw("hdata",variable,1200,0.5,1.5, varname, "events", cut,data,luminosity); // making it more precise |
387 |
> |
TH1F *hmc = allsamples.Draw("hmc" , variable,1200,0.5,1.5, varname, "events", cut, mc, luminosity); // making it more precise |
388 |
|
hmc->SetLineColor(kBlue); |
389 |
|
|
390 |
|
float a=hdata->GetMean(); |
409 |
|
} |
410 |
|
|
411 |
|
cn->cd(); |
412 |
< |
hdata->GetYaxis()->SetTitle("events / 0.1"); |
412 |
> |
hdata->Rebin(0.05*1200/(1.5-0.5)); |
413 |
> |
hmc->Rebin(0.05*1200/(1.5-0.5)); |
414 |
> |
hdata->GetYaxis()->SetTitle("events / 0.05"); |
415 |
|
hdata->SetMarkerColor(kRed); |
416 |
|
if(DoFit) { |
417 |
|
gaus_mc->SetLineColor(kBlue); |
421 |
|
hdata->GetXaxis()->SetRangeUser(0,2); |
422 |
|
hdata->GetYaxis()->SetTitleOffset(1.3); |
423 |
|
hdata->Draw("e1"); |
424 |
+ |
|
425 |
+ |
hmc->Scale(hdata->Integral()/hmc->Integral()); |
426 |
+ |
if(hmc->GetMaximum()>hdata->GetMaximum()) hdata->SetMaximum((hmc->GetMaximum()+sqrt((double)hmc->GetMaximum()))*1.2); |
427 |
+ |
|
428 |
|
hmc->Draw("histo,same"); |
429 |
|
hdata->Draw("e1,same"); |
430 |
|
if(DoFit) { |
472 |
|
} |
473 |
|
|
474 |
|
int nFakes=1; |
475 |
< |
ZbResultContainer Fake_new_data_mc_agreement_2d(string AlphaVariable, string ContainerName, TCut BTagCut, TCut BTagWgt) { |
476 |
< |
write_warning(__FUNCTION__,"You are using the fake way to extract the correction ... "); |
477 |
< |
nFakes++; |
478 |
< |
ZbResultContainer results(ContainerName); |
475 |
> |
|
476 |
> |
float PurityInclusive=0.05; |
477 |
> |
float PurityLoose=0.20; |
478 |
> |
float PurityMedium=0.54; |
479 |
> |
float PurityTight=0.82; |
480 |
> |
|
481 |
> |
|
482 |
> |
void DeterminePurity(TCut basecut, int nptcuts, float ptcuts[], string AlphaVariable, string ContainerName, float FaceValueToBeTakenAt) { |
483 |
|
|
484 |
+ |
bool ComputePurity=false; |
485 |
|
|
486 |
< |
results.MPF_Result_FaceValue=Value(1+nFakes*0.02,0.03); |
487 |
< |
results.Rabs_Result_FaceValue=Value(2,0.02); |
488 |
< |
results.MPF_Result_Extrapolated=Value(3,0.03); |
489 |
< |
results.Rabs_Result_Extrapolated=Value(4,0.04); |
490 |
< |
cout << "The fake result for " << ContainerName << " for the MPF face value is " << results.MPF_Result_FaceValue << endl; |
491 |
< |
|
492 |
< |
return results; |
486 |
> |
if(ContainerName=="inclusive") ComputePurity=true; |
487 |
> |
if(ContainerName=="loose") ComputePurity=true; |
488 |
> |
if(ContainerName=="medium") ComputePurity=true; |
489 |
> |
if(ContainerName=="reference") ComputePurity=true; |
490 |
> |
|
491 |
> |
if(!ComputePurity) return; |
492 |
> |
|
493 |
> |
stringstream specialcut; |
494 |
> |
specialcut << "((pt>30&& pt< 1000) && (" << AlphaVariable << "<" << FaceValueToBeTakenAt << "))"; |
495 |
> |
|
496 |
> |
THStack mcm = allsamples.DrawStack("mcm" , "mpf",1200,0,30, "MPF", "events", TCut(basecut && specialcut.str().c_str()), mc, luminosity); |
497 |
> |
int nhists = mcm.GetHists()->GetEntries(); |
498 |
> |
|
499 |
> |
float total=0; |
500 |
> |
float Zb=0; |
501 |
> |
|
502 |
> |
for (int i = 0; i < nhists; i++) { |
503 |
> |
TH1* hist = static_cast<TH1*>(mcm.GetHists()->At(i)); |
504 |
> |
string name=hist->GetName(); |
505 |
> |
if(Contains(name,"t_bar_t")) total+=hist->Integral(); |
506 |
> |
if(Contains(name,"W_Jets")) total+=hist->Integral(); |
507 |
> |
if(Contains(name,"Single_top")) total+=hist->Integral(); |
508 |
> |
if(Contains(name,"Dibosons")) total+=hist->Integral(); |
509 |
> |
if(Contains(name,"Z_l_")) total+=hist->Integral(); |
510 |
> |
if(Contains(name,"Z_c_")) total+=hist->Integral(); |
511 |
> |
if(Contains(name,"Z_b_")) { |
512 |
> |
total+=hist->Integral(); |
513 |
> |
Zb+=hist->Integral(); |
514 |
> |
} |
515 |
> |
} |
516 |
> |
|
517 |
> |
float purity=Zb/total; |
518 |
> |
dout << "Determined a purity of " << 100*purity << " % for the container " << ContainerName << endl; |
519 |
> |
|
520 |
> |
if(ContainerName=="inclusive") PurityInclusive=purity; |
521 |
> |
if(ContainerName=="loose") PurityLoose=purity; |
522 |
> |
if(ContainerName=="medium") PurityMedium=purity; |
523 |
> |
if(ContainerName=="reference") PurityTight=purity; |
524 |
> |
|
525 |
> |
DeleteStack(mcm); |
526 |
> |
} |
527 |
> |
|
528 |
> |
string NiceAlphaPrint(float alpha) { |
529 |
> |
//get in : 0.3, return 0p3 ... |
530 |
> |
stringstream res; |
531 |
> |
res << int(alpha) << "p" << int(100*alpha); |
532 |
> |
return res.str(); |
533 |
|
} |
534 |
|
|
432 |
– |
|
535 |
|
ZbResultContainer new_data_mc_agreement_2d(bool gofast, string AlphaVariable, string ContainerName, TCut BTagCut, TCut BTagWgt, float FaceValueToBeTakenAt) { |
536 |
|
|
537 |
+ |
|
538 |
|
if(gofast) write_info(__FUNCTION__,"Fast mode activated for "+ContainerName); |
539 |
|
ZbResultContainer results(ContainerName); |
540 |
|
|
541 |
|
cutWeight=STDWEIGHT*BTagWgt; |
542 |
|
LeadingB=BTagCut; |
543 |
|
|
544 |
+ |
|
545 |
|
gStyle->SetOptFit(0); |
546 |
|
TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut); |
547 |
|
const int nalphacuts=6; |
548 |
|
float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3,0.35}; |
549 |
|
|
550 |
+ |
|
551 |
|
const int nptcuts=5; |
552 |
|
float ptcuts[nptcuts]={30,50,75,125,1000}; |
553 |
|
|
554 |
< |
|
554 |
> |
DeterminePurity(basecut, nptcuts,ptcuts, AlphaVariable, ContainerName, FaceValueToBeTakenAt); |
555 |
|
|
556 |
|
float MPF_Results[nalphacuts][nptcuts]; |
557 |
|
float MPF_Errors[nalphacuts][nptcuts]; |
573 |
|
ahigh=alphacuts[ia]; |
574 |
|
} |
575 |
|
cout << specialcut.str() << endl; |
576 |
< |
Value MPF_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia]), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh); |
577 |
< |
Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"ZbCHS3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia]), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh); |
576 |
> |
Value MPF_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(NiceAlphaPrint(alphacuts[ia])), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh); |
577 |
> |
Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"ZbCHS3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(NiceAlphaPrint(alphacuts[ia])), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh); |
578 |
|
|
579 |
|
MPF_Results[ia][ipt]=MPF_data_over_mc.getValue(); |
580 |
|
MPF_Errors[ia][ipt]=MPF_data_over_mc.getError(); |
642 |
|
|
643 |
|
|
644 |
|
|
540 |
– |
|
645 |
|
if(!gofast) { |
646 |
|
can->cd(); |
647 |
|
mpf_gr->SetMarkerStyle(21); |
735 |
|
rabs_gr->Draw("P"); |
736 |
|
rabs_pol_complete->Draw("same"); |
737 |
|
|
634 |
– |
|
738 |
|
float rabs_a=rabs_pol->GetParameter(0); |
739 |
|
float rabs_b=rabs_pol->GetParameter(1); |
740 |
|
RABS_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),rabs_a); |
1388 |
|
// compare_selection("Zb40"); |
1389 |
|
|
1390 |
|
if(!doquick) { |
1391 |
< |
print_all_b_yields(); |
1392 |
< |
draw_mpf_vars(); |
1393 |
< |
DrawEvilCutFlow(); |
1391 |
> |
//draw_kin_variable("mll","",28,60.0,200.0,"m_{ll}","mll",1,"");//nice and quick test to see if the normalization is ok (i.e. all data is processed etc.) |
1392 |
> |
//print_all_b_yields(); |
1393 |
> |
// draw_mpf_vars(); |
1394 |
> |
//DrawEvilCutFlow(); |
1395 |
|
|
1396 |
< |
draw_Zb_kin_vars(); |
1396 |
> |
// draw_Zb_kin_vars(); |
1397 |
|
|
1398 |
|
} |
1399 |
|
|
1412 |
|
|
1413 |
|
ZbResultContainer inclusive = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","inclusive",TCut("mll>0"),TCut("1.0"),0.3); |
1414 |
|
ZbResultContainer Reference = new_data_mc_agreement_2d(slow,"ZbCHS3010_alpha","reference",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3); |
1415 |
+ |
|
1416 |
+ |
ZbResultContainer NeutrinoQ = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","NeutrinoQ",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp*(1.0*softMuon)"),0.3); |
1417 |
+ |
ZbResultContainer ANeutrinoQ = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","ANeutrinoQ",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp*(1.0*(1.0-softMuon))"),0.3); |
1418 |
+ |
|
1419 |
|
ZbResultContainer effmistagUp = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","effmistagUp",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp"),0.3); |
1420 |
|
ZbResultContainer effmistagDown = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","effmistagDown",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTDown"),0.3); |
1421 |
|
ZbResultContainer medium = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","medium",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.679"),TCut("ZbCHS3010_BTagWgtM"),0.3); |
1423 |
|
ZbResultContainer AlphaUp = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaUp","AlphaUp",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3); |
1424 |
|
ZbResultContainer AlphaDown = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaDown","AlphaDown",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3); |
1425 |
|
|
1426 |
< |
ZbResultContainer AlphaThresholdVariationDown10 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown10",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3-0.1*0.3); |
1427 |
< |
ZbResultContainer AlphaThresholdVariationDown30 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown30",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3-0.3*0.3); |
1428 |
< |
ZbResultContainer AlphaThresholdVariationUp10 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp10",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3+0.1*0.3); |
1429 |
< |
ZbResultContainer AlphaThresholdVariationUp30 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp30",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3+0.3*0.3); |
1426 |
> |
ZbResultContainer L5inclusive = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaL5","L5inclusive",TCut("mll>0"),TCut("1.0"),0.3); |
1427 |
> |
ZbResultContainer L5Reference = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaL5","L5reference",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3); |
1428 |
> |
|
1429 |
> |
ZbResultContainer AlphaThresholdVariationDown10 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown10", TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"), TCut("ZbCHS3010_BTagWgtT"),0.3-0.1*0.3); |
1430 |
> |
ZbResultContainer AlphaThresholdVariationUp10 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp10", TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"), TCut("ZbCHS3010_BTagWgtT"),0.3+0.1*0.3); |
1431 |
> |
ZbResultContainer AlphaThresholdVariationDown30 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown30", TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"), TCut("ZbCHS3010_BTagWgtT"),0.3-0.3*0.3); |
1432 |
> |
ZbResultContainer AlphaThresholdVariationUp30 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp30", TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"), TCut("ZbCHS3010_BTagWgtT"),0.3+0.3*0.3); |
1433 |
> |
ZbResultContainer AlphaThresholdVariationDown10inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown10inc",TCut("mll>0"), TCut("1.0"),0.3-0.1*0.3); |
1434 |
> |
ZbResultContainer AlphaThresholdVariationUp10inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp10inc", TCut("mll>0"), TCut("1.0"),0.3+0.1*0.3); |
1435 |
> |
ZbResultContainer AlphaThresholdVariationDown30inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown30inc",TCut("mll>0"), TCut("1.0"),0.3-0.3*0.3); |
1436 |
> |
ZbResultContainer AlphaThresholdVariationUp30inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp30inc", TCut("mll>0"), TCut("1.0"),0.3+0.3*0.3); |
1437 |
|
|
1438 |
|
//and now let's compute some systematics! |
1439 |
|
//1 alpha variation |
1444 |
|
float SysMPF_EFF_down = Reference.MPF_Result_FaceValue.getValue()-effmistagDown.MPF_Result_FaceValue.getValue(); |
1445 |
|
float SysMPF_EFF_up = Reference.MPF_Result_FaceValue.getValue()-effmistagUp.MPF_Result_FaceValue.getValue(); |
1446 |
|
|
1447 |
< |
//3 purity |
1447 |
> |
//3 Presence of soft muons (->neutrino question) |
1448 |
> |
float SysMPF_Neutrino_up = Reference.MPF_Result_FaceValue.getValue()-NeutrinoQ.MPF_Result_FaceValue.getValue(); |
1449 |
> |
float SysMPF_Neutrino_down = Reference.MPF_Result_FaceValue.getValue()-ANeutrinoQ.MPF_Result_FaceValue.getValue(); |
1450 |
> |
|
1451 |
> |
//4 purity |
1452 |
|
zbcanvas->cd(); |
1453 |
|
gStyle->SetOptFit(0); |
1454 |
|
write_info(__FUNCTION__,"Don't know the exact purity at the moment, still needs to be determined!"); |
1459 |
|
purityhisto->GetYaxis()->CenterTitle(); |
1460 |
|
|
1461 |
|
TGraphErrors *gSysMPF_Purity = new TGraphErrors(); |
1462 |
< |
gSysMPF_Purity->SetPoint(0,0.05,inclusive.MPF_Result_FaceValue.getValue()); |
1462 |
> |
|
1463 |
> |
gSysMPF_Purity->SetPoint(0,PurityInclusive,inclusive.MPF_Result_FaceValue.getValue()); |
1464 |
|
gSysMPF_Purity->SetPointError(0,0.0,inclusive.MPF_Result_FaceValue.getError()); |
1465 |
|
|
1466 |
< |
gSysMPF_Purity->SetPoint(1,0.20,loose.MPF_Result_FaceValue.getValue());//x value? |
1466 |
> |
gSysMPF_Purity->SetPoint(1,PurityLoose,loose.MPF_Result_FaceValue.getValue());//x value? |
1467 |
|
gSysMPF_Purity->SetPointError(1,0.0,loose.MPF_Result_FaceValue.getError()); |
1468 |
< |
gSysMPF_Purity->SetPoint(2,0.54,medium.MPF_Result_FaceValue.getValue());//x value? |
1468 |
> |
gSysMPF_Purity->SetPoint(2,PurityMedium,medium.MPF_Result_FaceValue.getValue());//x value? |
1469 |
|
gSysMPF_Purity->SetPointError(2,0.0,medium.MPF_Result_FaceValue.getError()); |
1470 |
< |
gSysMPF_Purity->SetPoint(3,0.82,Reference.MPF_Result_FaceValue.getValue());//x value? |
1470 |
> |
gSysMPF_Purity->SetPoint(3,PurityTight,Reference.MPF_Result_FaceValue.getValue());//x value? |
1471 |
|
gSysMPF_Purity->SetPointError(3,0.0,Reference.MPF_Result_FaceValue.getError()); |
1472 |
|
|
1473 |
|
|
1514 |
|
|
1515 |
|
float SysMPF_Purity = abs(ExtrapolatedResult-Reference.MPF_Result_FaceValue.getValue()); |
1516 |
|
|
1517 |
< |
float sys_alpha = abs(SysMPF_Alpha_down)>abs(SysMPF_Alpha_up)?abs(SysMPF_Alpha_down):abs(SysMPF_Alpha_up); |
1518 |
< |
float sys_eff = abs(SysMPF_EFF_down)>abs(SysMPF_EFF_up)?abs(SysMPF_EFF_down):abs(SysMPF_EFF_up); |
1519 |
< |
float sys_purity = abs(SysMPF_Purity); |
1520 |
< |
float sys = sqrt(sys_alpha*sys_alpha+sys_eff*sys_eff+sys_purity*sys_purity); |
1517 |
> |
float sys_alpha = abs(SysMPF_Alpha_down)>abs(SysMPF_Alpha_up)?abs(SysMPF_Alpha_down):abs(SysMPF_Alpha_up); |
1518 |
> |
float sys_eff = abs(SysMPF_EFF_down)>abs(SysMPF_EFF_up)?abs(SysMPF_EFF_down):abs(SysMPF_EFF_up); |
1519 |
> |
float sys_purity = abs(SysMPF_Purity); |
1520 |
> |
float sys_neutrino = abs(SysMPF_Neutrino_down)>abs(SysMPF_Neutrino_up)?abs(SysMPF_Neutrino_down):abs(SysMPF_Neutrino_up); |
1521 |
> |
float sys = sqrt(sys_alpha*sys_alpha+sys_eff*sys_eff+sys_purity*sys_purity+sys_neutrino*sys_neutrino); |
1522 |
|
|
1523 |
|
dout << "MPF METHOD:" << endl; |
1524 |
|
dout << " Systematics : down up (selected)" << endl; |
1525 |
< |
dout << " Alpha variation : " << SysMPF_Alpha_down << " , " << SysMPF_Alpha_up << " ( " << sys_alpha << ") " << endl; |
1525 |
> |
dout << " Oversmearing : " << SysMPF_Alpha_down << " , " << SysMPF_Alpha_up << " ( " << sys_alpha << ") " << endl; |
1526 |
|
dout << " eff/mistag variation : " << SysMPF_EFF_down << " , " << SysMPF_EFF_up << " ( " << sys_eff << ") " << endl; |
1527 |
|
dout << " purity : " << SysMPF_Purity << " ( " << sys_purity << " )" << endl; |
1528 |
< |
dout << " total : " << sys << endl; |
1528 |
> |
dout << " neutrino : " << SysMPF_Neutrino_down << " , " << SysMPF_Neutrino_up << " ( " << sys_neutrino << ") " << endl; |
1529 |
> |
dout << " total : " << sys << " (note that this is the sys on C_{abs}^{b}, not yet on C_{corr} - there will also be an additional source!)" << endl; |
1530 |
|
dout << endl << endl; |
1531 |
|
dout << " FINAL RESULTS : " << endl; |
1532 |
|
dout << " C_{abs}^{b} = " << Reference.MPF_Result_FaceValue << " (stat) +/- " << sys << " (sys) " << endl; |
1536 |
|
sysfinal *= sqrt(sys*sys/(Reference.MPF_Result_FaceValue.getValue()*Reference.MPF_Result_FaceValue.getValue())); |
1537 |
|
//yes, this could be simplified but it would look like a bug. |
1538 |
|
|
1539 |
+ |
|
1540 |
+ |
|
1541 |
+ |
|
1542 |
+ |
dout << "Note: Varying the alpha cut (->face value) we get the following results: " << endl; |
1543 |
+ |
dout << "-30%: " << AlphaThresholdVariationDown30.MPF_Result_FaceValue/AlphaThresholdVariationDown30inc.MPF_Result_FaceValue << " (stat)" << endl; |
1544 |
+ |
dout << "-10%: " << AlphaThresholdVariationDown10.MPF_Result_FaceValue/AlphaThresholdVariationDown10inc.MPF_Result_FaceValue << " (stat)" << endl; |
1545 |
+ |
dout << " 0%: " << Reference.MPF_Result_FaceValue/inclusive.MPF_Result_FaceValue << " (stat) +/- " << endl; |
1546 |
+ |
dout << "+10%: " << AlphaThresholdVariationUp10.MPF_Result_FaceValue/AlphaThresholdVariationUp10inc.MPF_Result_FaceValue << " (stat)" << endl; |
1547 |
+ |
dout << "+30%: " << AlphaThresholdVariationUp30.MPF_Result_FaceValue/AlphaThresholdVariationUp30inc.MPF_Result_FaceValue << " (stat)" << endl; |
1548 |
+ |
|
1549 |
+ |
dout << " XCheck for Rabs, varying the alpha cut (->face value) we get the following results: " << endl; |
1550 |
+ |
dout << " -30%: " << AlphaThresholdVariationDown30.Rabs_Result_FaceValue/AlphaThresholdVariationDown30inc.Rabs_Result_FaceValue << " (stat)" << endl; |
1551 |
+ |
dout << " -10%: " << AlphaThresholdVariationDown10.Rabs_Result_FaceValue/AlphaThresholdVariationDown10inc.Rabs_Result_FaceValue << " (stat)" << endl; |
1552 |
+ |
dout << " 0%: " << Reference.Rabs_Result_FaceValue/inclusive.Rabs_Result_FaceValue << " (stat) +/- " << endl; |
1553 |
+ |
dout << " +10%: " << AlphaThresholdVariationUp10.Rabs_Result_FaceValue/AlphaThresholdVariationUp10inc.Rabs_Result_FaceValue << " (stat)" << endl; |
1554 |
+ |
dout << " +30%: " << AlphaThresholdVariationUp30.Rabs_Result_FaceValue/AlphaThresholdVariationUp30inc.Rabs_Result_FaceValue << " (stat)" << endl; |
1555 |
+ |
|
1556 |
+ |
|
1557 |
+ |
float sys_alphavar_up = abs(AlphaThresholdVariationUp30.MPF_Result_FaceValue.getValue()/AlphaThresholdVariationUp30inc.MPF_Result_FaceValue.getValue() - Reference.MPF_Result_FaceValue.getValue()/inclusive.MPF_Result_FaceValue.getValue()); |
1558 |
+ |
float sys_alphavar_down = abs(AlphaThresholdVariationDown30.MPF_Result_FaceValue.getValue()/AlphaThresholdVariationDown30inc.MPF_Result_FaceValue.getValue() - Reference.MPF_Result_FaceValue.getValue()/inclusive.MPF_Result_FaceValue.getValue()); |
1559 |
+ |
float sys_alphavar = sys_alphavar_up>sys_alphavar_down?sys_alphavar_up:sys_alphavar_down; |
1560 |
+ |
|
1561 |
+ |
dout << " -> Additional systematic (from 30%) : " << sys_alphavar << endl; |
1562 |
+ |
sysfinal=sqrt(sysfinal*sysfinal+sys_alphavar*sys_alphavar); |
1563 |
+ |
dout << "Final systematic is : " << sysfinal << endl; |
1564 |
+ |
|
1565 |
+ |
dout << " ******************************************** < FINAL RESULT > ******************************************** " << endl; |
1566 |
|
dout << " C_{corr} = " << Reference.MPF_Result_FaceValue/inclusive.MPF_Result_FaceValue << " (stat) +/- " << sysfinal << " (sys) " << endl; |
1567 |
+ |
dout << " ******************************************** < /FINAL RESULT > ******************************************** " << endl; |
1568 |
+ |
|
1569 |
+ |
dout << "Note that if L5 corrections are applied, we get " << L5Reference.MPF_Result_FaceValue/L5inclusive.MPF_Result_FaceValue << " (stat) " << endl; |
1570 |
|
|
1571 |
|
LeadingB=TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"); |
1572 |
|
|
1617 |
|
|
1618 |
|
|
1619 |
|
TH1F *data = allsamples.Draw("data", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity); |
1620 |
< |
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity); |
1620 |
> |
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity); |
1621 |
|
|
1622 |
|
float runningsum=0; |
1623 |
|
for(int i=data->GetNbinsX();i>0;i--) { |
1686 |
|
|
1687 |
|
delete crap; |
1688 |
|
delete data; |
1689 |
< |
|
1689 |
> |
CleanLegends(); |
1690 |
> |
DeleteStack(mcm); |
1691 |
> |
|
1692 |
|
|
1693 |
|
} |