1 |
buchmann |
1.1 |
#include <iostream>
|
2 |
|
|
#include <vector>
|
3 |
|
|
#include <sys/stat.h>
|
4 |
|
|
|
5 |
|
|
#include <TCut.h>
|
6 |
|
|
#include <TROOT.h>
|
7 |
|
|
#include <TCanvas.h>
|
8 |
|
|
#include <TMath.h>
|
9 |
|
|
#include <TColor.h>
|
10 |
|
|
#include <TPaveText.h>
|
11 |
|
|
#include <TRandom.h>
|
12 |
|
|
#include <TH1.h>
|
13 |
|
|
#include <TH2.h>
|
14 |
|
|
#include <TF1.h>
|
15 |
|
|
#include <TSQLResult.h>
|
16 |
|
|
#include <TProfile.h>
|
17 |
|
|
#include <TLegendEntry.h>
|
18 |
|
|
|
19 |
|
|
using namespace std;
|
20 |
|
|
|
21 |
|
|
using namespace PlottingSetup;
|
22 |
|
|
|
23 |
|
|
namespace ZbData {
|
24 |
|
|
vector<float> data_over_mc;
|
25 |
|
|
|
26 |
|
|
TCut ZplusBsel("pt1>20&&pt2>20&&mll>60&&mll<120");
|
27 |
buchmann |
1.4 |
TCut LeadingB("Zb30_bTagProbCSVBP[0]>0.679");
|
28 |
|
|
TCut EtaB("abs(Zb30_pfJetGoodEta[0])<1.3");
|
29 |
buchmann |
1.6 |
TCut PhiZcut("abs(pfJetDphiZ[0])>2.7");
|
30 |
buchmann |
1.1 |
|
31 |
|
|
}
|
32 |
|
|
|
33 |
|
|
using namespace ZbData;
|
34 |
|
|
|
35 |
buchmann |
1.7 |
|
36 |
|
|
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* DELETE EVERYTHING BETWEEN THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*//
|
37 |
|
|
void SpecialCutFlow(string identifier);
|
38 |
|
|
|
39 |
|
|
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* AND THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*//
|
40 |
|
|
|
41 |
|
|
|
42 |
buchmann |
1.1 |
void print_yield(TCut cut) {
|
43 |
|
|
TH1F *data = allsamples.Draw("data", "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,data,luminosity);
|
44 |
buchmann |
1.7 |
dout << " Yields for " << (const char*) cut << endl;
|
45 |
|
|
dout << " data: " << data->Integral() << endl;
|
46 |
|
|
/* THStack mcm = allsamples.DrawStack("mc", "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,mc,luminosity);
|
47 |
buchmann |
1.1 |
int nhists = mcm.GetHists()->GetEntries();
|
48 |
buchmann |
1.7 |
dout << "Going to loop over " << nhists << " histograms " << endl;
|
49 |
buchmann |
1.1 |
TFile *test = new TFile("test.root","RECREATE");
|
50 |
|
|
mcm.Write();
|
51 |
|
|
test->Close();
|
52 |
|
|
for (int i = 0; i < nhists; i++) {
|
53 |
|
|
TH1* hist = static_cast<TH1*>(mcm.GetHists()->At(i));
|
54 |
|
|
cout << " " << hist->GetName() << ": " << hist->Integral() << endl;
|
55 |
|
|
}
|
56 |
|
|
cout << endl << endl;
|
57 |
buchmann |
1.7 |
*/
|
58 |
buchmann |
1.1 |
delete data;
|
59 |
|
|
}
|
60 |
|
|
|
61 |
buchmann |
1.2 |
void draw_kin_variable(string variable, TCut cut, int nbins, float min, float max, string xlabel, string saveas, bool dologscale, string speciallabel="") {
|
62 |
buchmann |
1.1 |
|
63 |
|
|
TCanvas *ckin = new TCanvas("ckin","kin variable canvas");
|
64 |
|
|
ckin->SetLogy(dologscale);
|
65 |
|
|
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity);
|
66 |
|
|
datahisto->SetMarkerSize(DataMarkerSize);
|
67 |
|
|
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity);
|
68 |
buchmann |
1.2 |
if(dologscale) datahisto->SetMaximum(3*datahisto->GetMaximum());
|
69 |
|
|
else datahisto->SetMaximum(1.5*datahisto->GetMaximum());
|
70 |
|
|
TText *speciall;
|
71 |
|
|
if(speciallabel!="") {
|
72 |
|
|
speciall = new TText(0.2,0.8,speciallabel.c_str());
|
73 |
|
|
speciall->Draw();
|
74 |
|
|
}
|
75 |
buchmann |
1.1 |
datahisto->Draw("e1");
|
76 |
|
|
ckin->Update();
|
77 |
|
|
mcstack.Draw("same");
|
78 |
|
|
datahisto->Draw("same,e1");
|
79 |
|
|
TLegend *kinleg = allsamples.allbglegend();
|
80 |
|
|
kinleg->Draw();
|
81 |
|
|
|
82 |
|
|
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
|
83 |
|
|
kinpad->cd();
|
84 |
|
|
kinpad->SetLogy(dologscale);
|
85 |
|
|
datahisto->Draw("e1");
|
86 |
|
|
mcstack.Draw("same");
|
87 |
|
|
datahisto->Draw("same,e1");
|
88 |
|
|
datahisto->Draw("same,axis");
|
89 |
|
|
kinleg->Draw();
|
90 |
|
|
DrawPrelim();
|
91 |
|
|
saveas="kin/"+saveas;
|
92 |
|
|
save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas);
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
ZbData::data_over_mc.push_back(datahisto->Integral()/CollapseStack(mcstack)->Integral());
|
98 |
|
|
|
99 |
|
|
datahisto->Delete();
|
100 |
|
|
delete ckin;
|
101 |
|
|
}
|
102 |
|
|
|
103 |
|
|
Value getfrom2Dmap(TH2F *map, int ixbin, int iybin) {
|
104 |
|
|
Value sum(0,0);
|
105 |
|
|
for(int iy=1;iy<=iybin;iy++) {
|
106 |
|
|
sum=sum+Value(map->GetBinContent(ixbin,iy),map->GetBinError(ixbin,iy));
|
107 |
|
|
}
|
108 |
|
|
return sum;
|
109 |
|
|
}
|
110 |
|
|
|
111 |
|
|
void print_all_b_yields() {
|
112 |
|
|
cout << "Basic selection with a b jet" << endl;
|
113 |
buchmann |
1.4 |
print_yield(ZplusBsel&&"Zb30_pfJetGoodNumBtag>0");
|
114 |
buchmann |
1.2 |
cout << "Leading jet is a b-jet " << endl;
|
115 |
buchmann |
1.1 |
print_yield(ZplusBsel&&LeadingB);
|
116 |
|
|
cout << "|#eta_{b}|<1.3 " << endl;
|
117 |
|
|
print_yield(ZplusBsel&&LeadingB&&EtaB);
|
118 |
|
|
cout << "|#delta#phi(b<Z)|>2.7" << endl;
|
119 |
|
|
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
|
120 |
buchmann |
1.2 |
cout << "10<ptZ<1000 GeV" << endl;
|
121 |
buchmann |
1.1 |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000");
|
122 |
|
|
cout << "#alpha < 0.3" << endl;
|
123 |
buchmann |
1.6 |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb30_pfJetGoodPt[1]/pt)<0.3");
|
124 |
buchmann |
1.1 |
cout << "#alpha < 0.2" << endl;
|
125 |
buchmann |
1.6 |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb30_pfJetGoodPt[1]/pt)<0.2");
|
126 |
buchmann |
1.1 |
cout << "#alpha < 0.15" << endl;
|
127 |
buchmann |
1.6 |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb30_pfJetGoodPt[1]/pt)<0.15");
|
128 |
buchmann |
1.1 |
cout << "#alpha < 0.1" << endl;
|
129 |
buchmann |
1.6 |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb30_pfJetGoodPt[1]/pt)<0.1");
|
130 |
buchmann |
1.1 |
cout << "#alpha < 0.05" << endl;
|
131 |
buchmann |
1.6 |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb30_pfJetGoodPt[1]/pt)<0.05");
|
132 |
buchmann |
1.1 |
}
|
133 |
|
|
|
134 |
buchmann |
1.7 |
void DrawEvilCutFlow() {
|
135 |
|
|
stringstream MegaCut;
|
136 |
|
|
|
137 |
|
|
MegaCut << " 1*(" << (const char*) (ZplusBsel&&TCut("Zb30_pfJetGoodNumBtag>0")) << ")";
|
138 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB) << ")";
|
139 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB) << ")";
|
140 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut) << ")";
|
141 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000")) << ")";
|
142 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb30_alpha<0.3")) << ")";
|
143 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb30_alpha<0.2")) << ")";
|
144 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb30_alpha<0.15")) << ")";
|
145 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb30_alpha<0.1")) << ")";
|
146 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb30_alpha<0.05")) << ")";
|
147 |
|
|
MegaCut << " ";
|
148 |
|
|
|
149 |
|
|
TCanvas *can = new TCanvas("can","can");
|
150 |
|
|
can->SetLogy(1);
|
151 |
|
|
TCut basecut("mll>6||mll<10");
|
152 |
|
|
|
153 |
|
|
|
154 |
|
|
|
155 |
|
|
TLegend *leg = allsamples.allbglegend();
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
TH1F *data = allsamples.Draw("data", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity);
|
159 |
|
|
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
|
160 |
|
|
|
161 |
|
|
float runningsum=0;
|
162 |
|
|
for(int i=data->GetNbinsX();i>0;i--) {
|
163 |
|
|
runningsum+=data->GetBinContent(i);
|
164 |
|
|
data->SetBinContent(i,runningsum);
|
165 |
|
|
}
|
166 |
|
|
|
167 |
|
|
float minimum=data->GetMaximum();
|
168 |
|
|
|
169 |
|
|
TH1F* h;
|
170 |
|
|
TIter nextOF(mcm.GetHists());
|
171 |
|
|
while ( h = (TH1F*)nextOF() ) {
|
172 |
|
|
float runningsum=0;
|
173 |
|
|
minimum=data->GetMaximum();//done deliberately at each step so get the minimum of the last (!) contribution
|
174 |
|
|
for(int i=h->GetNbinsX();i>0;i--) {
|
175 |
|
|
runningsum+=h->GetBinContent(i);
|
176 |
|
|
h->SetBinContent(i,runningsum);
|
177 |
|
|
if(runningsum<minimum&&runningsum>0) minimum=runningsum;
|
178 |
|
|
}
|
179 |
|
|
}
|
180 |
|
|
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
data->SetMinimum(0.05*minimum);
|
184 |
|
|
can->cd(1)->SetBottomMargin(0.25);
|
185 |
|
|
data->GetXaxis()->SetBinLabel(1,"Pre-selection");
|
186 |
|
|
data->GetXaxis()->SetBinLabel(2,"Contains b jet");
|
187 |
|
|
data->GetXaxis()->SetBinLabel(3,"Leading jet is b-jet");
|
188 |
|
|
data->GetXaxis()->SetBinLabel(4,"|#eta_{b}|<1.3 ");
|
189 |
|
|
data->GetXaxis()->SetBinLabel(5,"|#delta#phi(b,Z)|>2.7");
|
190 |
|
|
data->GetXaxis()->SetBinLabel(6,"10<p_{T}^{Z}<1000 GeV");
|
191 |
|
|
data->GetXaxis()->SetBinLabel(7,"#alpha < 0.3");
|
192 |
|
|
data->GetXaxis()->SetBinLabel(8,"#alpha < 0.2");
|
193 |
|
|
data->GetXaxis()->SetBinLabel(9,"#alpha < 0.15");
|
194 |
|
|
data->GetXaxis()->SetBinLabel(10,"#alpha < 0.1");
|
195 |
|
|
data->GetXaxis()->SetBinLabel(11,"#alpha < 0.05");
|
196 |
|
|
data->GetXaxis()->LabelsOption("v");
|
197 |
|
|
|
198 |
|
|
data->Draw("e1");
|
199 |
|
|
mcm.Draw("same");
|
200 |
|
|
data->Draw("same,e1,axis");
|
201 |
|
|
data->Draw("same,e1");
|
202 |
|
|
// data->Draw("same,TEXT");
|
203 |
|
|
|
204 |
|
|
leg->Draw();
|
205 |
|
|
|
206 |
|
|
DrawPrelim();
|
207 |
|
|
|
208 |
|
|
CompleteSave(can,"CutFlow");
|
209 |
|
|
}
|
210 |
|
|
|
211 |
buchmann |
1.1 |
void draw_Zb_kin_vars() {
|
212 |
buchmann |
1.6 |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Z p_{T}","Official/Zpt",1);
|
213 |
|
|
draw_kin_variable("Zb30_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt",1);
|
214 |
|
|
draw_kin_variable("Zb30_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt",1);
|
215 |
|
|
draw_kin_variable("Zb30_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/SubLeadingJetPt_Over_ZPt",1);
|
216 |
buchmann |
1.7 |
draw_kin_variable("Zb30_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<50", 20,0,2,"#alpha","Official/alpha_pt_10_to_50",1);
|
217 |
|
|
draw_kin_variable("Zb30_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>50&&pt<100", 20,0,2,"#alpha","Official/alpha_50_to_100",1);
|
218 |
|
|
draw_kin_variable("Zb30_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>100&&pt<200", 20,0,2,"#alpha","Official/alpha_pt_100_to_200",1);
|
219 |
|
|
draw_kin_variable("Zb30_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>200&&pt<1000",20,0,2,"#alpha","Official/alpha_pt_200_to_1000",1);
|
220 |
buchmann |
1.6 |
|
221 |
|
|
draw_kin_variable("pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>10&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",0);
|
222 |
|
|
|
223 |
|
|
/*
|
224 |
|
|
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,200,"p_{T}^{l1}","Lep/pt1",1);
|
225 |
|
|
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==0",20,0,200,"p_{T}^{e1}","Lep/pt1_e",1);
|
226 |
|
|
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==1",20,0,200,"p_{T}^{#mu1}","Lep/pt1_m",1);
|
227 |
|
|
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,200,"p_{T}^{l2}","Lep/pt2",1);
|
228 |
|
|
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==0",20,0,200,"p_{T}^{e2}","Lep/pt2_e",1);
|
229 |
|
|
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==1",20,0,200,"p_{T}^{#mu2}","Lep/pt2_m",1);
|
230 |
|
|
draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta1",1);
|
231 |
|
|
draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==0",20,-3.1,3.1,"#eta^{e1}","Lep/eta1_e",1);
|
232 |
|
|
draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==1",20,-3.1,3.1,"#eta^{m1}","Lep/eta1_m",1);
|
233 |
|
|
draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta2",1);
|
234 |
|
|
draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==0",20,-3.1,3.1,"#eta^{e2}","Lep/eta2_e",1);
|
235 |
|
|
draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==1",20,-3.1,3.1,"#eta^{#mu2}","Lep/eta2_m",1);
|
236 |
|
|
draw_kin_variable("numVtx",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",30,0,30,"N(Vtx)","Lep/nVtx",1);
|
237 |
|
|
*/
|
238 |
buchmann |
1.1 |
}
|
239 |
|
|
|
240 |
|
|
void draw_mpf_vars() {
|
241 |
|
|
ZbData::data_over_mc.clear();
|
242 |
buchmann |
1.4 |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.3",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
243 |
|
|
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.2",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
244 |
|
|
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.15",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
245 |
|
|
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.1",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
246 |
|
|
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.05",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
247 |
|
|
|
248 |
|
|
draw_kin_variable("Zb30_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.3",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
249 |
|
|
draw_kin_variable("Zb30_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.2",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
250 |
|
|
draw_kin_variable("Zb30_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.15",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
251 |
|
|
draw_kin_variable("Zb30_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.1",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
252 |
|
|
draw_kin_variable("Zb30_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.05",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz__mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
253 |
buchmann |
1.1 |
}
|
254 |
|
|
|
255 |
buchmann |
1.2 |
Value get_Zb_data_over_mc(string variable, TCut cut) {
|
256 |
|
|
// write_warning(__FUNCTION__,"Debugging this function, therefore always returning 3.1415+/-1.010101"); return Value(3.1415,1.010101);
|
257 |
|
|
TH1F *hdata = allsamples.Draw("hdata",variable,1000,0,30, "#alpha [GeV]", "events", cut,data,luminosity);
|
258 |
|
|
TH1F *hmc = allsamples.Draw("hmc" , variable,1000,0,30, "#alpha [GeV]", "events", cut,mc, luminosity);
|
259 |
|
|
|
260 |
|
|
float a=hdata->GetMean();
|
261 |
|
|
float b=hmc->GetMean();
|
262 |
|
|
float da=hdata->GetMeanError();
|
263 |
|
|
float db=hmc->GetMeanError();
|
264 |
|
|
float factor = a / b;
|
265 |
|
|
float error = TMath::Sqrt( (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db);
|
266 |
|
|
delete hdata;
|
267 |
|
|
delete hmc;
|
268 |
|
|
return Value(factor,error);
|
269 |
|
|
}
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
void new_data_mc_agreement_2d() {
|
274 |
buchmann |
1.3 |
gStyle->SetOptFit(0);
|
275 |
buchmann |
1.2 |
TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
|
276 |
buchmann |
1.6 |
const int nalphacuts=6;
|
277 |
|
|
float alphacuts[nalphacuts] = {0.0,0.1,0.15,0.2,0.25,0.3};
|
278 |
buchmann |
1.5 |
int PointThree=-1;
|
279 |
|
|
for(int i=0;i<nalphacuts;i++) {
|
280 |
|
|
if((alphacuts[i]-0.3)<0.01) PointThree=i;
|
281 |
|
|
}
|
282 |
|
|
if(PointThree<0) {
|
283 |
|
|
write_warning(__FUNCTION__,"alpha=0.3 MUST BE ONE OF THE ALPHA VALUES!");
|
284 |
|
|
assert(PointThree<0);
|
285 |
|
|
}
|
286 |
|
|
|
287 |
buchmann |
1.2 |
const int nptcuts=5;
|
288 |
|
|
float ptcuts[nptcuts]={10,50,100,200,1000};
|
289 |
|
|
|
290 |
|
|
float MPF_Results[nalphacuts][nptcuts];
|
291 |
|
|
float MPF_Errors[nalphacuts][nptcuts];
|
292 |
|
|
float RABS_Results[nalphacuts][nptcuts];
|
293 |
|
|
float RABS_Errors[nalphacuts][nptcuts];
|
294 |
|
|
|
295 |
|
|
|
296 |
buchmann |
1.6 |
for(int ia=0;ia<nalphacuts-1;ia++) {
|
297 |
buchmann |
1.2 |
for(int ipt=0;ipt<nptcuts-1;ipt++) {
|
298 |
|
|
stringstream specialcut;
|
299 |
buchmann |
1.6 |
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (Zb30_alpha<" << alphacuts[ia+1] << "&&Zb30_alpha>" << alphacuts[ia] << "))";
|
300 |
buchmann |
1.2 |
Value MPF_data_over_mc = get_Zb_data_over_mc("mpf",TCut(basecut && specialcut.str().c_str()));
|
301 |
buchmann |
1.4 |
Value RABS_data_over_mc = get_Zb_data_over_mc("Zb30_pfJetGoodPt[0]/pt",TCut(basecut && specialcut.str().c_str()));
|
302 |
buchmann |
1.2 |
|
303 |
|
|
MPF_Results[ia][ipt]=MPF_data_over_mc.getValue();
|
304 |
|
|
MPF_Errors[ia][ipt]=MPF_data_over_mc.getError();
|
305 |
|
|
|
306 |
|
|
RABS_Results[ia][ipt]=RABS_data_over_mc.getValue();
|
307 |
|
|
RABS_Errors[ia][ipt]=RABS_data_over_mc.getError();
|
308 |
|
|
|
309 |
|
|
cout << "alpha cut at " << alphacuts[ia] << " and pt range " << ptcuts[ipt] << " , " << ptcuts[ipt+1] << " \t : \t" << specialcut.str() << " \t \t --> " << MPF_data_over_mc << " (MPF) " << RABS_data_over_mc << " (RABS)" << endl;
|
310 |
|
|
}
|
311 |
|
|
}
|
312 |
|
|
|
313 |
|
|
float MPF_ExtraPolatedResults[nptcuts];
|
314 |
|
|
float RABS_ExtraPolatedResults[nptcuts];
|
315 |
|
|
|
316 |
|
|
TCanvas *can = new TCanvas("can");
|
317 |
|
|
|
318 |
|
|
TGraphErrors *MPF_FinalGraph = new TGraphErrors();
|
319 |
|
|
TGraphErrors *RABS_FinalGraph = new TGraphErrors();
|
320 |
buchmann |
1.5 |
TGraphErrors *FaceValueAtPoint3 = new TGraphErrors();
|
321 |
buchmann |
1.2 |
|
322 |
|
|
for(int ipt=0;ipt<nptcuts-1;ipt++) {
|
323 |
|
|
|
324 |
|
|
stringstream filename;
|
325 |
|
|
filename << "Extrapolation/Zplusb_data_over_mc___" << ptcuts[ipt] << "_to_" << ptcuts[ipt+1];
|
326 |
|
|
cout << "Going to create histo for " << filename.str() << endl;
|
327 |
|
|
TGraphErrors *mpf_gr =new TGraphErrors();
|
328 |
|
|
TGraphErrors *rabs_gr =new TGraphErrors();
|
329 |
|
|
for(int ia=0;ia<nalphacuts;ia++) {
|
330 |
|
|
mpf_gr->SetPoint(ia,alphacuts[ia],MPF_Results[ia][ipt]);
|
331 |
|
|
mpf_gr->SetPointError(ia,0,MPF_Errors[ia][ipt]);
|
332 |
|
|
rabs_gr->SetPoint(ia,alphacuts[ia],RABS_Results[ia][ipt]);
|
333 |
|
|
rabs_gr->SetPointError(ia,0,RABS_Errors[ia][ipt]);
|
334 |
|
|
}
|
335 |
buchmann |
1.5 |
FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1]),MPF_Results[PointThree][ipt]);
|
336 |
|
|
FaceValueAtPoint3->SetPointError(ipt,0,MPF_Errors[PointThree][ipt]);
|
337 |
buchmann |
1.2 |
|
338 |
|
|
mpf_gr->SetMarkerStyle(21);
|
339 |
|
|
mpf_gr->SetMarkerColor(kBlue);
|
340 |
|
|
mpf_gr->Draw("AP");
|
341 |
buchmann |
1.3 |
mpf_gr->Fit("pol1","QE"); // quiet, use minos
|
342 |
|
|
mpf_gr->GetXaxis()->SetTitle("#alpha");
|
343 |
|
|
mpf_gr->GetXaxis()->CenterTitle();
|
344 |
|
|
mpf_gr->GetYaxis()->SetTitle("data/mc");
|
345 |
|
|
mpf_gr->GetYaxis()->CenterTitle();
|
346 |
buchmann |
1.2 |
TF1 *mpf_pol=(TF1*)mpf_gr->GetFunction("pol1");
|
347 |
|
|
float mpf_a=mpf_pol->GetParameter(0);
|
348 |
|
|
float mpf_b=mpf_pol->GetParameter(1);
|
349 |
|
|
MPF_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),mpf_a);
|
350 |
|
|
MPF_FinalGraph->SetPointError(ipt,0,mpf_pol->GetParError(0));
|
351 |
|
|
|
352 |
|
|
MPF_ExtraPolatedResults[ipt]=mpf_a;
|
353 |
|
|
|
354 |
|
|
stringstream mpf_info;
|
355 |
buchmann |
1.3 |
mpf_info << "#splitline{#splitline{#splitline{" << ptcuts[ipt] << " GeV < p_{T}^{Z} < " << ptcuts[ipt+1] << " GeV }{ (MPF) }}{Extrapolated value: " << std::setprecision(3) << mpf_a << "}}{#chi^{2}/NDF : " << mpf_pol->GetChisquare() << " / " << mpf_pol->GetNDF() << "}";
|
356 |
|
|
|
357 |
buchmann |
1.2 |
TText *mpf_mark = write_title(mpf_info.str());
|
358 |
|
|
mpf_mark->SetX(0.75);
|
359 |
|
|
mpf_mark->SetTextSize(0.03);
|
360 |
|
|
mpf_mark->SetY(0.75);
|
361 |
|
|
mpf_mark->Draw();
|
362 |
|
|
|
363 |
|
|
string filenamebkp=filename.str();
|
364 |
|
|
filename << "__MPF";
|
365 |
buchmann |
1.3 |
DrawPrelim();
|
366 |
buchmann |
1.2 |
CompleteSave(can,filename.str());
|
367 |
|
|
cout << "MPF : " << mpf_a << " + " << mpf_b << " * alpha " << endl;
|
368 |
|
|
|
369 |
|
|
filename.str("");
|
370 |
|
|
|
371 |
|
|
rabs_gr->SetMarkerStyle(21);
|
372 |
|
|
rabs_gr->SetMarkerColor(kBlue);
|
373 |
buchmann |
1.3 |
rabs_gr->Fit("pol1","QE"); // quiet, use minos
|
374 |
buchmann |
1.2 |
rabs_gr->Draw("AP");
|
375 |
buchmann |
1.3 |
rabs_gr->GetXaxis()->SetTitle("#alpha");
|
376 |
|
|
rabs_gr->GetXaxis()->CenterTitle();
|
377 |
|
|
rabs_gr->GetYaxis()->SetTitle("data/mc");
|
378 |
|
|
rabs_gr->GetYaxis()->CenterTitle();
|
379 |
|
|
|
380 |
buchmann |
1.2 |
TF1 *rabs_pol=(TF1*)rabs_gr->GetFunction("pol1");
|
381 |
|
|
float rabs_a=rabs_pol->GetParameter(0);
|
382 |
|
|
float rabs_b=rabs_pol->GetParameter(1);
|
383 |
|
|
RABS_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),rabs_a);
|
384 |
|
|
RABS_FinalGraph->SetPointError(ipt,0,rabs_pol->GetParError(0));
|
385 |
buchmann |
1.3 |
|
386 |
buchmann |
1.2 |
cout << "!+!+!+!+!+!+!+!+!+ Just added a point to the final plot : " << rabs_a << " +/- " << rabs_pol->GetParError(0) << endl;
|
387 |
|
|
|
388 |
|
|
|
389 |
|
|
stringstream rabs_info;
|
390 |
buchmann |
1.3 |
rabs_info << "#splitline{#splitline{#splitline{" << ptcuts[ipt] << " GeV < p_{T}^{Z} < " << ptcuts[ipt+1] << " GeV }{ (R_{abs}) }}{Extrapolated value: " << std::setprecision(3) << rabs_a << "}}{#chi^{2}/NDF : " << rabs_pol->GetChisquare() << " / " << rabs_pol->GetNDF() << "}";
|
391 |
buchmann |
1.2 |
TText *rabs_mark = write_title(rabs_info.str());
|
392 |
|
|
rabs_mark->SetX(0.75);
|
393 |
|
|
rabs_mark->SetTextSize(0.03);
|
394 |
|
|
rabs_mark->SetY(0.75);
|
395 |
|
|
rabs_mark->Draw();
|
396 |
buchmann |
1.3 |
|
397 |
|
|
|
398 |
buchmann |
1.2 |
|
399 |
|
|
RABS_ExtraPolatedResults[ipt]=rabs_a;
|
400 |
|
|
filename << filenamebkp << "__RABS";
|
401 |
buchmann |
1.3 |
DrawPrelim();
|
402 |
buchmann |
1.2 |
CompleteSave(can,filename.str());
|
403 |
|
|
cout << "RABS : " << rabs_a << " + " << rabs_b << " * alpha " << endl;
|
404 |
|
|
}
|
405 |
|
|
|
406 |
|
|
MPF_FinalGraph->SetMarkerStyle(21);
|
407 |
|
|
MPF_FinalGraph->SetMarkerColor(kRed);
|
408 |
buchmann |
1.3 |
MPF_FinalGraph->Fit("pol0","QE"); // quiet, use minos
|
409 |
|
|
|
410 |
buchmann |
1.2 |
TF1 *mpf_pol0=(TF1*)MPF_FinalGraph->GetFunction("pol0");
|
411 |
|
|
MPF_FinalGraph->Draw("AP");
|
412 |
buchmann |
1.3 |
MPF_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}");
|
413 |
|
|
MPF_FinalGraph->GetXaxis()->CenterTitle();
|
414 |
|
|
MPF_FinalGraph->GetYaxis()->SetTitle("data/mc");
|
415 |
|
|
MPF_FinalGraph->GetYaxis()->CenterTitle();
|
416 |
|
|
MPF_FinalGraph->Draw("AP");
|
417 |
|
|
|
418 |
buchmann |
1.2 |
stringstream mpf_result;
|
419 |
buchmann |
1.3 |
mpf_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/mpf_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0)) << "}{ (MPF)}";
|
420 |
buchmann |
1.2 |
TText *rmpf_final_mark = write_title(mpf_result.str());
|
421 |
|
|
rmpf_final_mark->SetX(0.75);
|
422 |
|
|
rmpf_final_mark->SetY(0.75);
|
423 |
|
|
rmpf_final_mark->SetTextSize(0.03);
|
424 |
|
|
rmpf_final_mark->Draw();
|
425 |
buchmann |
1.3 |
DrawPrelim();
|
426 |
buchmann |
1.5 |
float MPFResult=1/mpf_pol0->GetParameter(0);
|
427 |
|
|
float MPFResultError=mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0));
|
428 |
buchmann |
1.2 |
|
429 |
|
|
stringstream filename2;
|
430 |
|
|
filename2 << "Extrapolation/FINAL_RESULT_MPF";
|
431 |
|
|
CompleteSave(can,filename2.str());
|
432 |
|
|
|
433 |
|
|
|
434 |
|
|
RABS_FinalGraph->SetMarkerStyle(21);
|
435 |
|
|
RABS_FinalGraph->SetMarkerStyle(21);
|
436 |
|
|
RABS_FinalGraph->SetMarkerColor(kRed);
|
437 |
buchmann |
1.3 |
RABS_FinalGraph->Fit("pol0","QE"); // quiet, use minos
|
438 |
|
|
RABS_FinalGraph->Draw("AP");
|
439 |
|
|
RABS_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}");
|
440 |
|
|
RABS_FinalGraph->GetXaxis()->CenterTitle();
|
441 |
|
|
RABS_FinalGraph->GetYaxis()->SetTitle("data/mc");
|
442 |
|
|
RABS_FinalGraph->GetYaxis()->CenterTitle();
|
443 |
buchmann |
1.2 |
RABS_FinalGraph->Draw("AP");
|
444 |
|
|
TF1 *rabs_pol0=(TF1*)RABS_FinalGraph->GetFunction("pol0");
|
445 |
|
|
stringstream rabs_result;
|
446 |
buchmann |
1.3 |
rabs_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/rabs_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << rabs_pol0->GetParError(0)/(rabs_pol0->GetParameter(0)*rabs_pol0->GetParameter(0)) << "}{ (R_{abs})}";;
|
447 |
buchmann |
1.2 |
TText *rabs_final_mark = write_title(rabs_result.str());
|
448 |
|
|
rabs_final_mark->SetX(0.75);
|
449 |
|
|
rabs_final_mark->SetY(0.75);
|
450 |
|
|
rabs_final_mark->SetTextSize(0.03);
|
451 |
|
|
rabs_final_mark->Draw();
|
452 |
buchmann |
1.3 |
DrawPrelim();
|
453 |
buchmann |
1.2 |
|
454 |
buchmann |
1.5 |
float RabsResult=1/rabs_pol0->GetParameter(0);
|
455 |
|
|
float RabsResultError=rabs_pol0->GetParError(0)/(rabs_pol0->GetParameter(0)*rabs_pol0->GetParameter(0));
|
456 |
|
|
|
457 |
|
|
filename2.str("");
|
458 |
|
|
filename2 << "Extrapolation/FINAL_RESULT_RABS";
|
459 |
|
|
CompleteSave(can,filename2.str());
|
460 |
|
|
|
461 |
|
|
|
462 |
|
|
TCanvas *FaceValueCanvas = new TCanvas("FaceValueCanvas","FaceValueCanvas");
|
463 |
|
|
FaceValueAtPoint3->SetMarkerStyle(21);
|
464 |
|
|
FaceValueAtPoint3->SetMarkerStyle(21);
|
465 |
|
|
FaceValueAtPoint3->Fit("pol0","QE"); // quiet, use minos
|
466 |
|
|
FaceValueAtPoint3->Draw("AP");
|
467 |
|
|
FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}");
|
468 |
|
|
FaceValueAtPoint3->GetXaxis()->CenterTitle();
|
469 |
|
|
FaceValueAtPoint3->GetYaxis()->SetTitle("data/mc for #alpha<0.3");
|
470 |
|
|
FaceValueAtPoint3->GetYaxis()->CenterTitle();
|
471 |
|
|
FaceValueAtPoint3->Draw("AP");
|
472 |
|
|
TF1 *faceval_pol0=(TF1*)FaceValueAtPoint3->GetFunction("pol0");
|
473 |
|
|
stringstream faceval_result;
|
474 |
|
|
faceval_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/faceval_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0)) << "}{ (MPF at #alpha<0.3)}";;
|
475 |
|
|
TText *faceval_final_mark = write_title(faceval_result.str());
|
476 |
|
|
faceval_final_mark->SetX(0.75);
|
477 |
|
|
faceval_final_mark->SetY(0.75);
|
478 |
|
|
faceval_final_mark->SetTextSize(0.03);
|
479 |
|
|
faceval_final_mark->Draw();
|
480 |
|
|
DrawPrelim();
|
481 |
|
|
|
482 |
|
|
float FaceValResult=1/faceval_pol0->GetParameter(0);
|
483 |
|
|
float FaceValResultError=faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0));
|
484 |
|
|
|
485 |
buchmann |
1.2 |
filename2.str("");
|
486 |
|
|
filename2 << "Extrapolation/FINAL_RESULT_RABS";
|
487 |
|
|
CompleteSave(can,filename2.str());
|
488 |
|
|
|
489 |
buchmann |
1.5 |
cout << "FINAL RESULTS: " << endl;
|
490 |
|
|
cout << "MPF : " << MPFResult << " +/- " << MPFResultError << endl;
|
491 |
|
|
cout << "Rabs: " << RabsResult << " +/- " << RabsResultError << endl;
|
492 |
|
|
cout << "Face value at 0.3 :" << FaceValResult << " +/- " << FaceValResultError << endl;
|
493 |
buchmann |
1.2 |
|
494 |
|
|
delete can;
|
495 |
|
|
|
496 |
|
|
|
497 |
|
|
}
|
498 |
|
|
|
499 |
|
|
|
500 |
|
|
|
501 |
buchmann |
1.7 |
void compare_selection(string identifier) {
|
502 |
|
|
bool recognized_scenario=false;
|
503 |
|
|
|
504 |
|
|
cout << "Running with identifier " << identifier << endl;
|
505 |
|
|
if(identifier=="Zb30") {
|
506 |
|
|
LeadingB=TCut ("Zb30_bTagProbCSVBP[0]>0.679");
|
507 |
|
|
EtaB=TCut("abs(Zb30_pfJetGoodEta[0])<1.3");
|
508 |
|
|
PhiZcut=TCut("abs(Zb30_pfJetDphiZ[0])>2.7");
|
509 |
|
|
recognized_scenario=true;
|
510 |
|
|
}
|
511 |
|
|
|
512 |
|
|
if(identifier=="Zb2030") {
|
513 |
|
|
LeadingB=TCut ("Zb2030_bTagProbCSVBP[0]>0.679");
|
514 |
|
|
EtaB=TCut("abs(Zb2030_pfJetGoodEta[0])<1.3");
|
515 |
|
|
PhiZcut=TCut("abs(Zb2030_pfJetDphiZ[0])>2.7");
|
516 |
|
|
recognized_scenario=true;
|
517 |
|
|
}
|
518 |
|
|
|
519 |
|
|
if(identifier=="Zb1530") {
|
520 |
|
|
LeadingB=TCut ("Zb1530_bTagProbCSVBP[0]>0.679");
|
521 |
|
|
EtaB=TCut("abs(Zb1530_pfJetGoodEta[0])<1.3");
|
522 |
|
|
PhiZcut=TCut("abs(Zb1530_pfJetDphiZ[0])>2.7");
|
523 |
|
|
recognized_scenario=true;
|
524 |
|
|
}
|
525 |
|
|
|
526 |
|
|
if(identifier=="Zb3010") {
|
527 |
|
|
LeadingB=TCut ("Zb3010_bTagProbCSVBP[0]>0.679");
|
528 |
|
|
EtaB=TCut("abs(Zb3010_pfJetGoodEta[0])<1.3");
|
529 |
|
|
PhiZcut=TCut("abs(Zb3010_pfJetDphiZ[0])>2.7");
|
530 |
|
|
recognized_scenario=true;
|
531 |
|
|
}
|
532 |
|
|
|
533 |
|
|
if(identifier=="Zb30_SecEta3") {
|
534 |
|
|
LeadingB=TCut ("Zb30_SecEta3_bTagProbCSVBP[0]>0.679");
|
535 |
|
|
EtaB=TCut("abs(Zb30_SecEta3_pfJetGoodEta[0])<1.3");
|
536 |
|
|
PhiZcut=TCut("abs(Zb30_SecEta3_pfJetDphiZ[0])>2.7");
|
537 |
|
|
recognized_scenario=true;
|
538 |
|
|
}
|
539 |
|
|
|
540 |
|
|
if(identifier=="Zb30_SecEta5") {
|
541 |
|
|
LeadingB=TCut ("Zb30_SecEta5_bTagProbCSVBP[0]>0.679");
|
542 |
|
|
EtaB=TCut("abs(Zb30_SecEta5_pfJetGoodEta[0])<1.3");
|
543 |
|
|
PhiZcut=TCut("abs(Zb30_SecEta5_pfJetDphiZ[0])>2.7");
|
544 |
|
|
recognized_scenario=true;
|
545 |
|
|
}
|
546 |
|
|
|
547 |
|
|
if(identifier=="Zb30_p5Clean") {
|
548 |
|
|
LeadingB=TCut ("Zb30_p5Clean_bTagProbCSVBP[0]>0.679");
|
549 |
|
|
EtaB=TCut("abs(Zb30_p5Clean_pfJetGoodEta[0])<1.3");
|
550 |
|
|
PhiZcut=TCut("abs(Zb30_p5Clean_pfJetDphiZ[0])>2.7");
|
551 |
|
|
recognized_scenario=true;
|
552 |
|
|
}
|
553 |
|
|
|
554 |
|
|
if(identifier=="Zb30CHS") {
|
555 |
|
|
LeadingB=TCut ("Zb30CHS_bTagProbCSVBP[0]>0.679");
|
556 |
|
|
EtaB=TCut("abs(Zb30CHS_pfJetGoodEta[0])<1.3");
|
557 |
|
|
PhiZcut=TCut("abs(Zb30CHS_pfJetDphiZ[0])>2.7");
|
558 |
|
|
recognized_scenario=true;
|
559 |
|
|
}
|
560 |
|
|
|
561 |
|
|
assert(recognized_scenario);
|
562 |
|
|
|
563 |
|
|
cout << "Cuts: " << endl;
|
564 |
|
|
cout << " " << (const char*) LeadingB << endl;
|
565 |
|
|
cout << " " << (const char*) EtaB << endl;
|
566 |
|
|
cout << " " << (const char*) PhiZcut << endl;
|
567 |
|
|
|
568 |
|
|
cout << endl << endl;
|
569 |
|
|
|
570 |
|
|
SpecialCutFlow(identifier);
|
571 |
|
|
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Z p_{T}","Official/Zpt__"+identifier,1);
|
572 |
|
|
draw_kin_variable(identifier+"_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",40,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt__"+identifier,1);
|
573 |
|
|
draw_kin_variable(identifier+"_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",40,0,200,"Sub-Leading Jet Pt [GeV]","Official/Jet2Pt__"+identifier,1);
|
574 |
|
|
draw_kin_variable(identifier+"_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/SubLeadingJetPt_Over_ZPt__"+identifier,1);
|
575 |
|
|
draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<50",20,0,2,"#alpha","Official/alpha_pt_10_to_50__"+identifier,1);
|
576 |
|
|
draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>50&&pt<100",20,0,2,"#alpha","Official/alpha_50_to_100__"+identifier,1);
|
577 |
|
|
draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>100&&pt<200",20,0,2,"#alpha","Official/alpha_pt_100_to_200__"+identifier,1);
|
578 |
|
|
draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>200&&pt<1000",20,0,2,"#alpha","Official/alpha_pt_200_to_1000__"+identifier,1);
|
579 |
|
|
draw_kin_variable(identifier+"_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>10&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead__"+identifier,0);
|
580 |
|
|
|
581 |
|
|
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.3").c_str()),20,0,2,"Z+b MPF","mpf_alpha_smaller_0p3___"+identifier,0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
582 |
|
|
draw_kin_variable(identifier+"_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.3").c_str()),20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p3______"+identifier,0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
583 |
|
|
|
584 |
|
|
|
585 |
|
|
|
586 |
|
|
|
587 |
|
|
}
|
588 |
|
|
|
589 |
buchmann |
1.1 |
void do_basic_ZB_analysis() {
|
590 |
buchmann |
1.2 |
TCanvas *zbcanvas = new TCanvas("zbcanvas","zbcanvas");
|
591 |
buchmann |
1.1 |
|
592 |
buchmann |
1.7 |
// compare_selection("Zb30_p5Clean");
|
593 |
|
|
compare_selection("Zb30CHS");
|
594 |
|
|
compare_selection("Zb30");
|
595 |
|
|
compare_selection("Zb2030");
|
596 |
|
|
compare_selection("Zb1530");
|
597 |
|
|
compare_selection("Zb3010");
|
598 |
|
|
compare_selection("Zb30_SecEta3");
|
599 |
|
|
compare_selection("Zb30_SecEta5"); // buggy, ntuples need to be updated
|
600 |
|
|
|
601 |
|
|
|
602 |
|
|
|
603 |
|
|
// print_all_b_yields();
|
604 |
buchmann |
1.2 |
// draw_mpf_vars();
|
605 |
buchmann |
1.7 |
// DrawEvilCutFlow();
|
606 |
|
|
|
607 |
|
|
// draw_Zb_kin_vars();
|
608 |
|
|
|
609 |
|
|
// new_data_mc_agreement_2d();
|
610 |
buchmann |
1.1 |
|
611 |
|
|
|
612 |
buchmann |
1.2 |
delete zbcanvas;
|
613 |
buchmann |
1.1 |
}
|
614 |
buchmann |
1.7 |
|
615 |
|
|
|
616 |
|
|
|
617 |
|
|
|
618 |
|
|
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* DELETE EVERYTHING BELOW THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*//
|
619 |
|
|
|
620 |
|
|
|
621 |
|
|
const char* concatenate(string bla1, string bla2) {
|
622 |
|
|
stringstream bla;
|
623 |
|
|
bla << bla1 << bla2;
|
624 |
|
|
return bla.str().c_str();
|
625 |
|
|
}
|
626 |
|
|
|
627 |
|
|
void SpecialCutFlow(string identifier) {
|
628 |
|
|
stringstream MegaCut;
|
629 |
|
|
|
630 |
|
|
|
631 |
|
|
|
632 |
|
|
MegaCut << " 1*(" << (const char*) (ZplusBsel&&TCut(concatenate(identifier,"_pfJetGoodNumBtag>0"))) << ")";
|
633 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB) << ")";
|
634 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB) << ")";
|
635 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut) << ")";
|
636 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000")) << ")";
|
637 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb30_alpha<0.3")) << ")";
|
638 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb30_alpha<0.2")) << ")";
|
639 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb30_alpha<0.15")) << ")";
|
640 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb30_alpha<0.1")) << ")";
|
641 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb30_alpha<0.05")) << ")";
|
642 |
|
|
MegaCut << " ";
|
643 |
|
|
|
644 |
|
|
TCanvas *can = new TCanvas("can","can");
|
645 |
|
|
can->SetLogy(1);
|
646 |
|
|
TCut basecut("mll>6||mll<10");
|
647 |
|
|
|
648 |
|
|
|
649 |
|
|
|
650 |
|
|
TLegend *leg = allsamples.allbglegend();
|
651 |
|
|
|
652 |
|
|
|
653 |
|
|
TH1F *data = allsamples.Draw("data", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity);
|
654 |
|
|
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
|
655 |
|
|
|
656 |
|
|
float runningsum=0;
|
657 |
|
|
for(int i=data->GetNbinsX();i>0;i--) {
|
658 |
|
|
runningsum+=data->GetBinContent(i);
|
659 |
|
|
data->SetBinContent(i,runningsum);
|
660 |
|
|
}
|
661 |
|
|
|
662 |
|
|
float minimum=data->GetMaximum();
|
663 |
|
|
|
664 |
|
|
TH1F* h;
|
665 |
|
|
TIter nextOF(mcm.GetHists());
|
666 |
|
|
|
667 |
|
|
float mcsum=0;
|
668 |
|
|
float zb=0;
|
669 |
|
|
while ( h = (TH1F*)nextOF() ) {
|
670 |
|
|
float runningsum=0;
|
671 |
|
|
minimum=data->GetMaximum();//done deliberately at each step so get the minimum of the last (!) contribution
|
672 |
|
|
for(int i=h->GetNbinsX();i>0;i--) {
|
673 |
|
|
runningsum+=h->GetBinContent(i);
|
674 |
|
|
h->SetBinContent(i,runningsum);
|
675 |
|
|
if(runningsum<minimum&&runningsum>0) minimum=runningsum;
|
676 |
|
|
}
|
677 |
|
|
if(Contains(h->GetName(),"Z_b_")) {
|
678 |
|
|
zb=h->GetBinContent(h->GetNbinsX());
|
679 |
|
|
}
|
680 |
|
|
mcsum+=h->GetBinContent(h->GetNbinsX());
|
681 |
|
|
}
|
682 |
|
|
|
683 |
|
|
|
684 |
|
|
|
685 |
|
|
data->SetMinimum(0.05*minimum);
|
686 |
|
|
can->cd(1)->SetBottomMargin(0.25);
|
687 |
|
|
data->GetXaxis()->SetBinLabel(1,"Pre-selection");
|
688 |
|
|
data->GetXaxis()->SetBinLabel(2,"Contains b jet");
|
689 |
|
|
data->GetXaxis()->SetBinLabel(3,"Leading jet is b-jet");
|
690 |
|
|
data->GetXaxis()->SetBinLabel(4,"|#eta_{b}|<1.3 ");
|
691 |
|
|
data->GetXaxis()->SetBinLabel(5,"|#delta#phi(b,Z)|>2.7");
|
692 |
|
|
data->GetXaxis()->SetBinLabel(6,"10<p_{T}^{Z}<1000 GeV");
|
693 |
|
|
data->GetXaxis()->SetBinLabel(7,"#alpha < 0.3");
|
694 |
|
|
data->GetXaxis()->SetBinLabel(8,"#alpha < 0.2");
|
695 |
|
|
data->GetXaxis()->SetBinLabel(9,"#alpha < 0.15");
|
696 |
|
|
data->GetXaxis()->SetBinLabel(10,"#alpha < 0.1");
|
697 |
|
|
data->GetXaxis()->SetBinLabel(11,"#alpha < 0.05");
|
698 |
|
|
data->GetXaxis()->LabelsOption("v");
|
699 |
|
|
|
700 |
|
|
stringstream purityinfo;
|
701 |
|
|
purityinfo << "Purity: " << std::setprecision(3) << 100*zb/mcsum << " %";
|
702 |
|
|
stringstream neventsinfo;
|
703 |
|
|
neventsinfo << "Nevents: " << data->GetBinContent(data->GetNbinsX());
|
704 |
|
|
TH1F *crap = new TH1F("crap","",1,0,1);
|
705 |
|
|
crap->SetLineColor(kWhite);
|
706 |
|
|
leg->AddEntry(crap,purityinfo.str().c_str(),"l");
|
707 |
|
|
leg->AddEntry(crap,neventsinfo.str().c_str(),"l");
|
708 |
|
|
|
709 |
|
|
data->Draw("e1");
|
710 |
|
|
mcm.Draw("same");
|
711 |
|
|
data->Draw("same,e1,axis");
|
712 |
|
|
data->Draw("same,e1");
|
713 |
|
|
// data->Draw("same,TEXT");
|
714 |
|
|
|
715 |
|
|
leg->Draw();
|
716 |
|
|
|
717 |
|
|
DrawPrelim();
|
718 |
|
|
|
719 |
|
|
CompleteSave(can,"CutFlow___"+identifier);
|
720 |
|
|
|
721 |
|
|
delete crap;
|
722 |
|
|
delete data;
|
723 |
|
|
|
724 |
|
|
|
725 |
|
|
}
|