23 |
|
namespace ZbData { |
24 |
|
vector<float> data_over_mc; |
25 |
|
|
26 |
< |
TCut ZplusBsel("pt1>20&&pt2>20&&mll>60&&mll<120"); |
27 |
< |
TCut LeadingB("bTagProbCSVBP[0]>0.679"); |
28 |
< |
TCut EtaB("abs(pfJetGoodEta[0])<1.3"); |
29 |
< |
TCut PhiZcut("pfJetDphiZ[0]>2.7"); |
26 |
> |
TCut ZplusBsel("pt1>20&&pt2>20&&mll>60&&mll<120&&id1==id2"); |
27 |
> |
TCut LeadingB("Zb3010_bTagProbCSVBP[0]>0.898"); |
28 |
> |
TCut EtaB("abs(Zb3010_pfJetGoodEta[0])<1.3"); |
29 |
> |
TCut PhiZcut("abs(Zb3010_pfJetDphiZ[0])>2.7"); |
30 |
|
|
31 |
|
} |
32 |
|
|
33 |
|
using namespace ZbData; |
34 |
|
|
35 |
+ |
|
36 |
+ |
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* DELETE EVERYTHING BETWEEN THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*// |
37 |
+ |
void SpecialCutFlow(string identifier); |
38 |
+ |
|
39 |
+ |
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* AND THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*// |
40 |
+ |
|
41 |
+ |
|
42 |
|
void print_yield(TCut cut) { |
43 |
|
TH1F *data = allsamples.Draw("data", "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,data,luminosity); |
44 |
< |
cout << " Yields for " << (const char*) cut << endl; |
45 |
< |
cout << " data: " << data->Integral() << endl; |
44 |
> |
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 |
|
int nhists = mcm.GetHists()->GetEntries(); |
48 |
< |
cout << "Going to loop over " << nhists << " histograms " << endl; |
48 |
> |
dout << "Going to loop over " << nhists << " histograms " << endl; |
49 |
|
TFile *test = new TFile("test.root","RECREATE"); |
50 |
|
mcm.Write(); |
51 |
|
test->Close(); |
53 |
|
TH1* hist = static_cast<TH1*>(mcm.GetHists()->At(i)); |
54 |
|
cout << " " << hist->GetName() << ": " << hist->Integral() << endl; |
55 |
|
} |
56 |
+ |
|
57 |
|
cout << endl << endl; |
58 |
+ |
|
59 |
|
delete data; |
60 |
|
} |
61 |
|
|
109 |
|
return sum; |
110 |
|
} |
111 |
|
|
103 |
– |
|
104 |
– |
void data_mc_agreement_2d() { |
105 |
– |
|
106 |
– |
vector<int> emptyvector; |
107 |
– |
float binX[5]={10,50,100,200,1000}; |
108 |
– |
float binY[5]={0.0,0.1,0.15,0.2,0.3}; |
109 |
– |
vector<float>binningx; |
110 |
– |
vector<float>binningy; |
111 |
– |
binningx.assign(binX,binX+5); |
112 |
– |
binningy.assign(binY,binY+5); |
113 |
– |
|
114 |
– |
TCut cut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut); |
115 |
– |
|
116 |
– |
TCanvas *agrcan = new TCanvas("agrcan","agrcan"); |
117 |
– |
|
118 |
– |
cout << "Drawing 2d for data " << endl; |
119 |
– |
TH2F *alphazptplane_data = allsamples.Draw("alphazptplane_data","alpha:pt",binningx,binningy,"Z p_{T}","#alpha",cut,data,luminosity,emptyvector,false); |
120 |
– |
cout << "Drawing 2d for MC " << endl; |
121 |
– |
TH2F *alphazptplane_mc = allsamples.Draw("alphazptplane_mc", "alpha:pt",binningx,binningy,"Z p_{T}","#alpha",cut,mc, luminosity,emptyvector,false); |
122 |
– |
|
123 |
– |
|
124 |
– |
TFile *f = new TFile("test.root","RECREATE"); |
125 |
– |
alphazptplane_data->Write(); |
126 |
– |
f->Close(); |
127 |
– |
|
128 |
– |
for(int ix=1;ix<binningx.size();ix++) { |
129 |
– |
cout << "pt in " << binningx[ix-1] << " , " << binningx[ix] << endl; |
130 |
– |
TGraphErrors gr; |
131 |
– |
for(int iy=1;iy<binningy.size();iy++) { |
132 |
– |
Value mc = Value((getfrom2Dmap(alphazptplane_mc,ix,iy)).getValue(),0.0);// not taking MC statistics into account |
133 |
– |
Value data = getfrom2Dmap(alphazptplane_data,ix,iy); |
134 |
– |
cout << " For an alpha cut at " << binningy[iy] << " we get : mc (" << mc << ") , data (" << data << ") --> data/mc = " << data/mc << endl; |
135 |
– |
gr.SetPoint(iy-1,binningy[iy],(data/mc).getValue()); |
136 |
– |
gr.SetPointError(iy-1,0,(data/mc).getError()); |
137 |
– |
} |
138 |
– |
|
139 |
– |
gr.Draw("AP*"); |
140 |
– |
gr.GetYaxis()->SetTitle("data / mc"); |
141 |
– |
gr.GetYaxis()->CenterTitle(); |
142 |
– |
gr.GetXaxis()->SetTitle("#alpha"); |
143 |
– |
gr.GetXaxis()->CenterTitle(); |
144 |
– |
gr.GetXaxis()->SetRangeUser(0,0.4); |
145 |
– |
gr.GetYaxis()->SetRangeUser(0.5,1.5); |
146 |
– |
gr.Draw("AP*"); |
147 |
– |
DrawPrelim(); |
148 |
– |
stringstream ptbin; |
149 |
– |
ptbin << binningx[ix-1] << " < p_{T}^{Z} < " << binningx[ix] << " GeV"; |
150 |
– |
TText *ptt = write_title(ptbin.str()); |
151 |
– |
ptt->SetX(0.7); |
152 |
– |
ptt->SetY(0.7); |
153 |
– |
ptt->SetTextSize(0.03); |
154 |
– |
ptt->Draw(); |
155 |
– |
TLine *l = new TLine(0.0,1.0,0.4,1.0); |
156 |
– |
l->SetLineStyle(2); |
157 |
– |
l->SetLineColor(kBlue); |
158 |
– |
l->Draw(); |
159 |
– |
|
160 |
– |
stringstream saveas; |
161 |
– |
saveas << "Zplusb_data_over_mc___" << binningx[ix-1] << "to" << binningx[ix]; |
162 |
– |
DrawPrelim(); |
163 |
– |
CompleteSave(agrcan,saveas.str()); |
164 |
– |
// agrcan->SaveAs("tester.png"); |
165 |
– |
} |
166 |
– |
|
167 |
– |
delete agrcan; |
168 |
– |
|
169 |
– |
} |
170 |
– |
|
112 |
|
void print_all_b_yields() { |
113 |
|
cout << "Basic selection with a b jet" << endl; |
114 |
< |
print_yield(ZplusBsel&&"pfJetGoodNumBtag>0"); |
114 |
> |
print_yield(ZplusBsel&&"Zb3010_pfJetGoodNumBtag>0"); |
115 |
|
cout << "Leading jet is a b-jet " << endl; |
116 |
|
print_yield(ZplusBsel&&LeadingB); |
117 |
|
cout << "|#eta_{b}|<1.3 " << endl; |
120 |
|
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut); |
121 |
|
cout << "10<ptZ<1000 GeV" << endl; |
122 |
|
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"); |
123 |
+ |
cout << "#alpha < 0.35" << endl; |
124 |
+ |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.35"); |
125 |
|
cout << "#alpha < 0.3" << endl; |
126 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.3"); |
126 |
> |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.3"); |
127 |
|
cout << "#alpha < 0.2" << endl; |
128 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.2"); |
128 |
> |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.2"); |
129 |
|
cout << "#alpha < 0.15" << endl; |
130 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.15"); |
130 |
> |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.15"); |
131 |
|
cout << "#alpha < 0.1" << endl; |
132 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.1"); |
133 |
< |
cout << "#alpha < 0.05" << endl; |
134 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.05"); |
132 |
> |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.1"); |
133 |
> |
// cout << "#alpha < 0.05" << endl; |
134 |
> |
// print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.05"); |
135 |
|
} |
136 |
|
|
137 |
+ |
void DrawEvilCutFlow() { |
138 |
+ |
stringstream MegaCut; |
139 |
+ |
|
140 |
+ |
MegaCut << " 1*(" << (const char*) (ZplusBsel&&TCut("Zb3010_pfJetGoodNumBtag>0")) << ")"; |
141 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB) << ")"; |
142 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB) << ")"; |
143 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut) << ")"; |
144 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000")) << ")"; |
145 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.3")) << ")"; |
146 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.2")) << ")"; |
147 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.15")) << ")"; |
148 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.1")) << ")"; |
149 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.05")) << ")"; |
150 |
+ |
MegaCut << " "; |
151 |
+ |
|
152 |
+ |
TCanvas *can = new TCanvas("can","can"); |
153 |
+ |
can->SetLogy(1); |
154 |
+ |
TCut basecut("mll>6||mll<10"); |
155 |
+ |
|
156 |
+ |
|
157 |
+ |
|
158 |
+ |
TLegend *leg = allsamples.allbglegend(); |
159 |
+ |
|
160 |
+ |
|
161 |
+ |
TH1F *data = allsamples.Draw("data", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity); |
162 |
+ |
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity); |
163 |
+ |
|
164 |
+ |
float runningsum=0; |
165 |
+ |
for(int i=data->GetNbinsX();i>0;i--) { |
166 |
+ |
runningsum+=data->GetBinContent(i); |
167 |
+ |
data->SetBinContent(i,runningsum); |
168 |
+ |
} |
169 |
+ |
|
170 |
+ |
float minimum=data->GetMaximum(); |
171 |
+ |
|
172 |
+ |
TH1F* h; |
173 |
+ |
TIter nextOF(mcm.GetHists()); |
174 |
+ |
while ( h = (TH1F*)nextOF() ) { |
175 |
+ |
float runningsum=0; |
176 |
+ |
minimum=data->GetMaximum();//done deliberately at each step so get the minimum of the last (!) contribution |
177 |
+ |
for(int i=h->GetNbinsX();i>0;i--) { |
178 |
+ |
runningsum+=h->GetBinContent(i); |
179 |
+ |
h->SetBinContent(i,runningsum); |
180 |
+ |
if(runningsum<minimum&&runningsum>0) minimum=runningsum; |
181 |
+ |
} |
182 |
+ |
} |
183 |
+ |
|
184 |
+ |
|
185 |
+ |
|
186 |
+ |
data->SetMinimum(0.05*minimum); |
187 |
+ |
can->cd(1)->SetBottomMargin(0.25); |
188 |
+ |
data->GetXaxis()->SetBinLabel(1,"Pre-selection"); |
189 |
+ |
data->GetXaxis()->SetBinLabel(2,"Contains b jet"); |
190 |
+ |
data->GetXaxis()->SetBinLabel(3,"Leading jet is b-jet"); |
191 |
+ |
data->GetXaxis()->SetBinLabel(4,"|#eta_{b}|<1.3 "); |
192 |
+ |
data->GetXaxis()->SetBinLabel(5,"|#delta#phi(b,Z)|>2.7"); |
193 |
+ |
data->GetXaxis()->SetBinLabel(6,"10<p_{T}^{Z}<1000 GeV"); |
194 |
+ |
data->GetXaxis()->SetBinLabel(7,"#alpha < 0.3"); |
195 |
+ |
data->GetXaxis()->SetBinLabel(8,"#alpha < 0.2"); |
196 |
+ |
data->GetXaxis()->SetBinLabel(9,"#alpha < 0.15"); |
197 |
+ |
data->GetXaxis()->SetBinLabel(10,"#alpha < 0.1"); |
198 |
+ |
data->GetXaxis()->SetBinLabel(11,"#alpha < 0.05"); |
199 |
+ |
data->GetXaxis()->LabelsOption("v"); |
200 |
+ |
|
201 |
+ |
data->Draw("e1"); |
202 |
+ |
mcm.Draw("same"); |
203 |
+ |
data->Draw("same,e1,axis"); |
204 |
+ |
data->Draw("same,e1"); |
205 |
+ |
// data->Draw("same,TEXT"); |
206 |
+ |
|
207 |
+ |
leg->Draw(); |
208 |
+ |
|
209 |
+ |
DrawPrelim(); |
210 |
+ |
|
211 |
+ |
CompleteSave(can,"CutFlow"); |
212 |
+ |
} |
213 |
+ |
|
214 |
|
void draw_Zb_kin_vars() { |
215 |
< |
draw_kin_variable("pfBJetDphiZ",ZplusBsel&&LeadingB,100,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",1); |
216 |
< |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Z p_{T}","Zpt",1); |
217 |
< |
draw_kin_variable("pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Sub-Leading Jet Pt","Jet2Pt",1); |
218 |
< |
draw_kin_variable("pfJetGoodPtlBtag[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Leading Jet Pt (B)","LeadingJetPt",1); |
219 |
< |
draw_kin_variable("alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,2,"#alpha","alpha",1); |
215 |
> |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Z p_{T}","Official/Zpt",1); |
216 |
> |
draw_kin_variable("Zb3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt",1); |
217 |
> |
draw_kin_variable("Zb3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt",1); |
218 |
> |
draw_kin_variable("Zb3010_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); |
219 |
> |
draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<50", 40,0,2,"#alpha","Official/alpha_pt_30_to_50",1); |
220 |
> |
draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>50&&pt<75", 40,0,2,"#alpha","Official/alpha_50_to_75",1); |
221 |
> |
draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>75&&pt<125", 40,0,2,"#alpha","Official/alpha_pt_75_to_125",1); |
222 |
> |
draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>125&&pt<1000",40,0,2,"#alpha","Official/alpha_pt_125_to_1000",1); |
223 |
> |
draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",40,0,2,"#alpha","Official/alpha_pt_30_to_1000",1); |
224 |
> |
|
225 |
> |
draw_kin_variable("Zb3010_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>10&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",0); |
226 |
> |
|
227 |
> |
/* |
228 |
> |
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,200,"p_{T}^{l1}","Lep/pt1",1); |
229 |
> |
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==0",20,0,200,"p_{T}^{e1}","Lep/pt1_e",1); |
230 |
> |
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==1",20,0,200,"p_{T}^{#mu1}","Lep/pt1_m",1); |
231 |
> |
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,200,"p_{T}^{l2}","Lep/pt2",1); |
232 |
> |
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==0",20,0,200,"p_{T}^{e2}","Lep/pt2_e",1); |
233 |
> |
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==1",20,0,200,"p_{T}^{#mu2}","Lep/pt2_m",1); |
234 |
> |
draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta1",1); |
235 |
> |
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); |
236 |
> |
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); |
237 |
> |
draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta2",1); |
238 |
> |
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); |
239 |
> |
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); |
240 |
> |
draw_kin_variable("numVtx",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",30,0,30,"N(Vtx)","Lep/nVtx",1); |
241 |
> |
*/ |
242 |
|
} |
243 |
|
|
244 |
|
void draw_mpf_vars() { |
245 |
|
ZbData::data_over_mc.clear(); |
246 |
< |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.3",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
247 |
< |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.2",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
248 |
< |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.15",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
249 |
< |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.1",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
250 |
< |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"alpha<0.05",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
251 |
< |
|
252 |
< |
draw_kin_variable("pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"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"); |
253 |
< |
draw_kin_variable("pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"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"); |
254 |
< |
draw_kin_variable("pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"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"); |
255 |
< |
draw_kin_variable("pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"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"); |
256 |
< |
draw_kin_variable("pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"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"); |
246 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.3",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
247 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.2",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
248 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.15",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
249 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.1",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
250 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.05",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
251 |
> |
|
252 |
> |
draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_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"); |
253 |
> |
draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_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"); |
254 |
> |
draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_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"); |
255 |
> |
draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_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"); |
256 |
> |
draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_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"); |
257 |
|
} |
258 |
|
|
259 |
< |
Value get_Zb_data_over_mc(string variable, TCut cut) { |
259 |
> |
/*double GetMedian(TH1F *histo) { |
260 |
> |
int numBins = histo->GetXaxis()->GetNbins(); |
261 |
> |
Double_t x[numBins]; |
262 |
> |
Double_t y[numBins]; |
263 |
> |
for (int i = 1; i <= numBins; i++) { |
264 |
> |
x[i] = histo->GetBinCenter(i); |
265 |
> |
y[i] = histo->GetBinContent(i); |
266 |
> |
} |
267 |
> |
return TMath::Median(numBins, &x, &y); |
268 |
> |
}*/ |
269 |
> |
|
270 |
> |
Value get_Zb_data_over_mc(string variable, string variable2, TCut cut, string saveas) { |
271 |
|
// write_warning(__FUNCTION__,"Debugging this function, therefore always returning 3.1415+/-1.010101"); return Value(3.1415,1.010101); |
272 |
< |
TH1F *hdata = allsamples.Draw("hdata",variable,1000,0,30, "#alpha [GeV]", "events", cut,data,luminosity); |
273 |
< |
TH1F *hmc = allsamples.Draw("hmc" , variable,1000,0,30, "#alpha [GeV]", "events", cut,mc, luminosity); |
272 |
> |
TCanvas *cn = new TCanvas("cn","cn"); |
273 |
> |
string varname="MPF"; |
274 |
> |
if(Contains(variable,"pfJetGood")) varname="R_{abs}"; |
275 |
> |
TH1F *hdata = allsamples.Draw("hdata",variable,1200,0,30, varname, "events", cut,data,luminosity); |
276 |
> |
TH1F *hmc = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc, luminosity); |
277 |
> |
hmc->SetLineColor(kBlue); |
278 |
> |
|
279 |
> |
|
280 |
> |
|
281 |
|
|
282 |
|
float a=hdata->GetMean(); |
283 |
|
float b=hmc->GetMean(); |
285 |
|
float db=hmc->GetMeanError(); |
286 |
|
float factor = a / b; |
287 |
|
float error = TMath::Sqrt( (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db); |
288 |
+ |
|
289 |
+ |
TF1 *gaus_data = new TF1("gaus_data","gaus",0.7,1.3); |
290 |
+ |
gaus_data->SetParameter(0,hdata->GetMaximum()); |
291 |
+ |
gaus_data->SetParameter(2,hdata->GetMean()); |
292 |
+ |
gaus_data->SetParameter(1,hdata->GetRMS()); |
293 |
+ |
hdata->Fit(gaus_data); |
294 |
+ |
TF1 *gaus_mc = new TF1("gaus_mc","gaus",0.7,1.3); |
295 |
+ |
gaus_mc->SetParameter(0,hmc->GetMaximum()); |
296 |
+ |
gaus_mc->SetParameter(1,hmc->GetMean()); |
297 |
+ |
gaus_mc->SetParameter(2,hmc->GetRMS()); |
298 |
+ |
hmc->Fit(gaus_mc); |
299 |
+ |
|
300 |
+ |
|
301 |
+ |
cn->cd(); |
302 |
+ |
hdata->GetYaxis()->SetTitle("events / 0.1"); |
303 |
+ |
hdata->SetMarkerColor(kRed); |
304 |
+ |
/* hdata->Rebin(4); |
305 |
+ |
hmc->Rebin(4); |
306 |
+ |
|
307 |
+ |
gaus_mc->SetParameter(0,gaus_mc->GetParameter(0)*4);//rebinning |
308 |
+ |
gaus_data->SetParameter(0,gaus_data->GetParameter(0)*4);//rebinning |
309 |
+ |
*/ |
310 |
+ |
gaus_mc->SetLineColor(kBlue); |
311 |
+ |
gaus_data->SetLineColor(kRed); |
312 |
+ |
|
313 |
+ |
hdata->GetXaxis()->SetRangeUser(0,2); |
314 |
+ |
hdata->Draw("e1"); |
315 |
+ |
hmc->Draw("histo,same"); |
316 |
+ |
hdata->Draw("e1,same"); |
317 |
+ |
gaus_data->Draw("same"); |
318 |
+ |
gaus_mc->Draw("same"); |
319 |
+ |
stringstream summary; |
320 |
+ |
summary << "#splitline{" << varname << "}{#splitline{data: " << std::setprecision(4) << a << " #pm " << std::setprecision(4) << da << "}{"; |
321 |
+ |
summary << "#splitline{mc: " << std::setprecision(4) << b << " #pm " << std::setprecision(4) << db << "}{#splitline{ratio: " << factor; |
322 |
+ |
summary << " #pm " << error << "}{#splitline{}{#splitline{data fit: " << std::setprecision(4) << gaus_data->GetParameter(1) << "+/-"; |
323 |
+ |
summary << std::setprecision(4) << gaus_data->GetParError(1) << "}{#splitline{"; |
324 |
+ |
summary << "mc fit:" << std::setprecision(4) << gaus_mc->GetParameter(1) << "+/-" << std::setprecision(4) << gaus_mc->GetParError(1) << "}{ratio: "; |
325 |
+ |
summary << gaus_data->GetParameter(1)/gaus_mc->GetParameter(1) << "+/-" << gaus_data->GetParameter(1)/gaus_mc->GetParameter(1) * sqrt((gaus_data->GetParError(1) * gaus_data->GetParError(1))/(gaus_data->GetParameter(1)*gaus_data->GetParameter(1)) + (gaus_mc->GetParError(1) * gaus_mc->GetParError(1))/(gaus_mc->GetParameter(1)*gaus_mc->GetParameter(1)) ) << "}}}}}}}"; |
326 |
+ |
TText *infobox = write_title(summary.str()); |
327 |
+ |
infobox->SetX(0.75); |
328 |
+ |
infobox->SetTextSize(0.03); |
329 |
+ |
infobox->SetY(0.75); |
330 |
+ |
infobox->Draw(); |
331 |
+ |
|
332 |
+ |
|
333 |
+ |
DrawPrelim(); |
334 |
+ |
CompleteSave(cn,"ResponsePlots/"+saveas); |
335 |
+ |
|
336 |
+ |
cout << "Data;" << a << ";"<<da<<";MC"<<b<<";"<<db<<endl; |
337 |
+ |
delete cn; |
338 |
|
delete hdata; |
339 |
|
delete hmc; |
340 |
+ |
|
341 |
+ |
// cout << a << "+/-" << da << " " << b << "=/-" << db << endl; |
342 |
+ |
|
343 |
|
return Value(factor,error); |
344 |
|
} |
345 |
|
|
346 |
|
|
347 |
|
|
348 |
|
void new_data_mc_agreement_2d() { |
349 |
+ |
|
350 |
|
gStyle->SetOptFit(0); |
351 |
|
TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut); |
352 |
+ |
const int nalphacuts=6; |
353 |
+ |
float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3,0.35}; |
354 |
|
|
239 |
– |
const int nalphacuts=5; |
240 |
– |
float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3}; |
355 |
|
const int nptcuts=5; |
356 |
< |
float ptcuts[nptcuts]={10,50,100,200,1000}; |
356 |
> |
float ptcuts[nptcuts]={30,50,75,125,1000}; |
357 |
|
|
358 |
|
float MPF_Results[nalphacuts][nptcuts]; |
359 |
|
float MPF_Errors[nalphacuts][nptcuts]; |
364 |
|
for(int ia=0;ia<nalphacuts;ia++) { |
365 |
|
for(int ipt=0;ipt<nptcuts-1;ipt++) { |
366 |
|
stringstream specialcut; |
367 |
< |
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (alpha<" << alphacuts[ia] << "))"; |
368 |
< |
Value MPF_data_over_mc = get_Zb_data_over_mc("mpf",TCut(basecut && specialcut.str().c_str())); |
369 |
< |
Value RABS_data_over_mc = get_Zb_data_over_mc("pfJetGoodPt[0]/pt",TCut(basecut && specialcut.str().c_str())); |
367 |
> |
if(ia>0) specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (Zb3010_alpha<" << alphacuts[ia] << " && Zb3010_alpha>" << alphacuts[ia-1] << "))"; |
368 |
> |
else specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (Zb3010_alpha<" << alphacuts[ia] << "))"; |
369 |
> |
cout << specialcut.str() << endl; |
370 |
> |
Value MPF_data_over_mc = get_Zb_data_over_mc("mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia])); |
371 |
> |
Value RABS_data_over_mc = get_Zb_data_over_mc("Zb3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia])); |
372 |
|
|
373 |
|
MPF_Results[ia][ipt]=MPF_data_over_mc.getValue(); |
374 |
|
MPF_Errors[ia][ipt]=MPF_data_over_mc.getError(); |
376 |
|
RABS_Results[ia][ipt]=RABS_data_over_mc.getValue(); |
377 |
|
RABS_Errors[ia][ipt]=RABS_data_over_mc.getError(); |
378 |
|
|
379 |
< |
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; |
379 |
> |
cout << "alpha cut at " << alphacuts[ia+1] << " 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; |
380 |
|
} |
381 |
|
} |
382 |
|
|
384 |
|
float RABS_ExtraPolatedResults[nptcuts]; |
385 |
|
|
386 |
|
TCanvas *can = new TCanvas("can"); |
387 |
+ |
can->cd(1)->SetLeftMargin(0.15); |
388 |
|
|
389 |
|
TGraphErrors *MPF_FinalGraph = new TGraphErrors(); |
390 |
|
TGraphErrors *RABS_FinalGraph = new TGraphErrors(); |
391 |
+ |
TGraphErrors *MPF_FaceValueAtPoint3 = new TGraphErrors(); |
392 |
+ |
TGraphErrors *RABS_FaceValueAtPoint3 = new TGraphErrors(); |
393 |
|
|
394 |
|
for(int ipt=0;ipt<nptcuts-1;ipt++) { |
395 |
|
|
398 |
|
cout << "Going to create histo for " << filename.str() << endl; |
399 |
|
TGraphErrors *mpf_gr =new TGraphErrors(); |
400 |
|
TGraphErrors *rabs_gr =new TGraphErrors(); |
401 |
+ |
|
402 |
+ |
int rabs_counter=0; |
403 |
+ |
int mpf_counter=0; |
404 |
+ |
|
405 |
|
for(int ia=0;ia<nalphacuts;ia++) { |
406 |
< |
mpf_gr->SetPoint(ia,alphacuts[ia],MPF_Results[ia][ipt]); |
407 |
< |
mpf_gr->SetPointError(ia,0,MPF_Errors[ia][ipt]); |
408 |
< |
rabs_gr->SetPoint(ia,alphacuts[ia],RABS_Results[ia][ipt]); |
409 |
< |
rabs_gr->SetPointError(ia,0,RABS_Errors[ia][ipt]); |
406 |
> |
cout << "Setting a point for an alpha cut at " << alphacuts[ia] << " with value " << MPF_Results[ia][ipt] << " (MPF) and " << RABS_Results[ia][ipt] << " (RABS)" << endl; |
407 |
> |
if(MPF_Results[ia][ipt]==MPF_Results[ia][ipt] && MPF_Errors[ia][ipt]==MPF_Errors[ia][ipt]) { // remove nan's |
408 |
> |
mpf_gr->SetPoint(mpf_counter,alphacuts[ia],MPF_Results[ia][ipt]); |
409 |
> |
mpf_gr->SetPointError(mpf_counter,0,MPF_Errors[ia][ipt]); |
410 |
> |
mpf_counter++; |
411 |
> |
} else { |
412 |
> |
dout << "Detected BS for MPF method (bin ignored) : " << endl; |
413 |
> |
dout << " alpha: " << alphacuts[ia] << " , pt range: " << ptcuts[ipt] << " < pt < " << ptcuts[ipt+1] << endl; |
414 |
> |
cout << " value (MPF) : " << MPF_Results[ia][ipt] << " +/- " << MPF_Errors[ia][ipt] << endl; |
415 |
> |
} |
416 |
> |
if(RABS_Results[ia][ipt]==RABS_Results[ia][ipt] && RABS_Errors[ia][ipt]==RABS_Errors[ia][ipt]) { |
417 |
> |
rabs_gr->SetPoint(rabs_counter,alphacuts[ia],RABS_Results[ia][ipt]); |
418 |
> |
rabs_gr->SetPointError(rabs_counter,0,RABS_Errors[ia][ipt]); |
419 |
> |
rabs_counter++; |
420 |
> |
} else { |
421 |
> |
dout << "Detected BS for RABS method (bin ignored) : " << endl; |
422 |
> |
dout << " alpha: " << alphacuts[ia] << " , pt range: " << ptcuts[ipt] << " < pt < " << ptcuts[ipt+1] << endl; |
423 |
> |
cout << " value (RABS) : " << RABS_Results[ia][ipt] << " +/- " << RABS_Errors[ia][ipt] << endl; |
424 |
> |
} |
425 |
|
} |
426 |
|
|
427 |
+ |
stringstream specialcut; |
428 |
+ |
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (Zb3010_alpha<0.3))"; |
429 |
+ |
Value MPF_data_over_mc = get_Zb_data_over_mc("mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__INCLUSIVEalpha_0.3"); |
430 |
+ |
Value RABS_data_over_mc = get_Zb_data_over_mc("Zb3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__INCLUSIVEalpha_0.3"); |
431 |
+ |
cout << "About to add a point in pt (" << (ptcuts[ipt]+ptcuts[ipt+1])/2 << " ) to face value : " << MPF_data_over_mc << " (MPF) , " << RABS_data_over_mc << "(RABS)" << endl; |
432 |
+ |
MPF_FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1])/2,MPF_data_over_mc.getValue()); |
433 |
+ |
MPF_FaceValueAtPoint3->SetPointError(ipt,0,MPF_data_over_mc.getError()); |
434 |
+ |
RABS_FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1])/2,RABS_data_over_mc.getValue()); |
435 |
+ |
RABS_FaceValueAtPoint3->SetPointError(ipt,0,RABS_data_over_mc.getError()); |
436 |
+ |
|
437 |
+ |
can->cd(); |
438 |
|
mpf_gr->SetMarkerStyle(21); |
439 |
|
mpf_gr->SetMarkerColor(kBlue); |
440 |
|
mpf_gr->Draw("AP"); |
441 |
< |
mpf_gr->Fit("pol1","QE"); // quiet, use minos |
441 |
> |
mpf_gr->Fit("pol1",""); |
442 |
|
mpf_gr->GetXaxis()->SetTitle("#alpha"); |
443 |
|
mpf_gr->GetXaxis()->CenterTitle(); |
444 |
< |
mpf_gr->GetYaxis()->SetTitle("data/mc"); |
444 |
> |
mpf_gr->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
445 |
|
mpf_gr->GetYaxis()->CenterTitle(); |
446 |
|
TF1 *mpf_pol=(TF1*)mpf_gr->GetFunction("pol1"); |
447 |
+ |
mpf_pol->SetLineWidth(0); |
448 |
+ |
TF1 *mpf_pol_complete = new TF1("mpf_pol_complete","[0]+[1]*x"); |
449 |
+ |
mpf_pol_complete->SetParameters(mpf_pol->GetParameters()); |
450 |
+ |
mpf_pol_complete->SetLineWidth(1); |
451 |
+ |
mpf_pol_complete->SetLineColor(kBlue); |
452 |
+ |
float min,max; |
453 |
+ |
FindMinMax(mpf_gr,min,max); |
454 |
+ |
TH1F *histo = new TH1F("histo","histo",1,0,0.4); |
455 |
+ |
histo->GetXaxis()->SetTitle("#alpha"); |
456 |
+ |
histo->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
457 |
+ |
histo->GetXaxis()->CenterTitle(); |
458 |
+ |
histo->GetYaxis()->CenterTitle(); |
459 |
+ |
histo->SetStats(0); |
460 |
+ |
histo->GetXaxis()->SetRangeUser(0,0.4); |
461 |
+ |
histo->GetYaxis()->SetRangeUser(min,max); |
462 |
+ |
mpf_gr->GetYaxis()->SetRangeUser(min,max); |
463 |
+ |
|
464 |
+ |
TPolyLine *mpf_fit_uncert = GetFitUncertaintyShape(mpf_gr, "pol1", min, max,0.0,0.4); |
465 |
+ |
mpf_pol->SetLineColor(TColor::GetColor("#0101DF")); |
466 |
+ |
mpf_fit_uncert->SetFillColor(TColor::GetColor("#5353FC")); |
467 |
+ |
histo->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
468 |
+ |
histo->Draw(); |
469 |
+ |
mpf_fit_uncert->Draw("F"); |
470 |
+ |
mpf_fit_uncert->Draw(""); |
471 |
+ |
mpf_gr->Draw("P"); |
472 |
+ |
mpf_pol_complete->Draw("same"); |
473 |
+ |
|
474 |
|
float mpf_a=mpf_pol->GetParameter(0); |
475 |
|
float mpf_b=mpf_pol->GetParameter(1); |
476 |
|
MPF_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),mpf_a); |
479 |
|
MPF_ExtraPolatedResults[ipt]=mpf_a; |
480 |
|
|
481 |
|
stringstream mpf_info; |
482 |
< |
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() << "}"; |
482 |
> |
mpf_info << "#splitline{#splitline{#splitline{" << ptcuts[ipt] << " GeV < p_{T}^{Z} < " << ptcuts[ipt+1] << " GeV }{ (MPF) }}{Extrapolated value: " << std::setprecision(4) << mpf_a << "}}{#chi^{2}/NDF : " << mpf_pol->GetChisquare() << " / " << mpf_pol->GetNDF() << "}"; |
483 |
|
|
484 |
|
TText *mpf_mark = write_title(mpf_info.str()); |
485 |
|
mpf_mark->SetX(0.75); |
496 |
|
filename.str(""); |
497 |
|
|
498 |
|
rabs_gr->SetMarkerStyle(21); |
499 |
< |
rabs_gr->SetMarkerColor(kBlue); |
324 |
< |
rabs_gr->Fit("pol1","QE"); // quiet, use minos |
499 |
> |
rabs_gr->SetMarkerColor(kRed); |
500 |
|
rabs_gr->Draw("AP"); |
501 |
+ |
rabs_gr->Fit("pol1",""); |
502 |
|
rabs_gr->GetXaxis()->SetTitle("#alpha"); |
503 |
|
rabs_gr->GetXaxis()->CenterTitle(); |
504 |
< |
rabs_gr->GetYaxis()->SetTitle("data/mc"); |
504 |
> |
rabs_gr->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}"); |
505 |
|
rabs_gr->GetYaxis()->CenterTitle(); |
330 |
– |
|
506 |
|
TF1 *rabs_pol=(TF1*)rabs_gr->GetFunction("pol1"); |
507 |
+ |
rabs_pol->SetLineWidth(0); |
508 |
+ |
TF1 *rabs_pol_complete = new TF1("rabs_pol_complete","[0]+[1]*x"); |
509 |
+ |
rabs_pol_complete->SetParameters(rabs_pol->GetParameters()); |
510 |
+ |
rabs_pol_complete->SetLineColor(kRed); |
511 |
+ |
rabs_pol_complete->SetLineWidth(1); |
512 |
+ |
FindMinMax(rabs_gr,min,max); |
513 |
+ |
rabs_gr->GetYaxis()->SetRangeUser(min,max); |
514 |
+ |
histo->GetYaxis()->SetRangeUser(min,max); |
515 |
+ |
TPolyLine *rabs_fit_uncert = GetFitUncertaintyShape(rabs_gr, "pol1", min, max,0.0,0.4); |
516 |
+ |
rabs_pol->SetLineColor(TColor::GetColor("#FA5858")); |
517 |
+ |
rabs_pol->SetFillColor(TColor::GetColor("#FA5858")); |
518 |
+ |
rabs_fit_uncert->SetLineColor(TColor::GetColor("#FA5858")); |
519 |
+ |
rabs_fit_uncert->SetFillColor(TColor::GetColor("#FA5858")); |
520 |
+ |
histo->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}"); |
521 |
+ |
histo->Draw(); |
522 |
+ |
rabs_fit_uncert->Draw("F"); |
523 |
+ |
rabs_fit_uncert->Draw(""); |
524 |
+ |
rabs_gr->Draw("P"); |
525 |
+ |
rabs_pol_complete->Draw("same"); |
526 |
+ |
|
527 |
+ |
|
528 |
|
float rabs_a=rabs_pol->GetParameter(0); |
529 |
|
float rabs_b=rabs_pol->GetParameter(1); |
530 |
|
RABS_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),rabs_a); |
532 |
|
|
533 |
|
cout << "!+!+!+!+!+!+!+!+!+ Just added a point to the final plot : " << rabs_a << " +/- " << rabs_pol->GetParError(0) << endl; |
534 |
|
|
339 |
– |
|
535 |
|
stringstream rabs_info; |
536 |
< |
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() << "}"; |
536 |
> |
rabs_info << "#splitline{#splitline{#splitline{" << ptcuts[ipt] << " GeV < p_{T}^{Z} < " << ptcuts[ipt+1] << " GeV }{ (R_{abs}) }}{Extrapolated value: " << std::setprecision(4) << rabs_a << "}}{#chi^{2}/NDF : " << rabs_pol->GetChisquare() << " / " << rabs_pol->GetNDF() << "}"; |
537 |
|
TText *rabs_mark = write_title(rabs_info.str()); |
538 |
|
rabs_mark->SetX(0.75); |
539 |
|
rabs_mark->SetTextSize(0.03); |
541 |
|
rabs_mark->Draw(); |
542 |
|
|
543 |
|
|
349 |
– |
|
544 |
|
RABS_ExtraPolatedResults[ipt]=rabs_a; |
545 |
|
filename << filenamebkp << "__RABS"; |
546 |
|
DrawPrelim(); |
549 |
|
} |
550 |
|
|
551 |
|
MPF_FinalGraph->SetMarkerStyle(21); |
552 |
< |
MPF_FinalGraph->SetMarkerColor(kRed); |
553 |
< |
MPF_FinalGraph->Fit("pol0","QE"); // quiet, use minos |
552 |
> |
MPF_FinalGraph->SetMarkerColor(kBlue); |
553 |
> |
MPF_FinalGraph->Fit("pol0",""); // quiet, use minos |
554 |
|
|
555 |
|
TF1 *mpf_pol0=(TF1*)MPF_FinalGraph->GetFunction("pol0"); |
556 |
+ |
TF1 *mpf_pol0_complete = new TF1("mpf_pol0_complete","[0]+[1]*x"); |
557 |
+ |
mpf_pol0_complete->SetLineWidth(1); |
558 |
+ |
mpf_pol0_complete->SetLineColor(kBlue); |
559 |
+ |
mpf_pol0->SetLineColor(kBlue); |
560 |
|
MPF_FinalGraph->Draw("AP"); |
561 |
|
MPF_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}"); |
562 |
|
MPF_FinalGraph->GetXaxis()->CenterTitle(); |
563 |
< |
MPF_FinalGraph->GetYaxis()->SetTitle("data/mc"); |
563 |
> |
MPF_FinalGraph->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
564 |
|
MPF_FinalGraph->GetYaxis()->CenterTitle(); |
565 |
|
MPF_FinalGraph->Draw("AP"); |
566 |
+ |
mpf_pol0_complete->Draw("same"); |
567 |
|
|
568 |
|
stringstream mpf_result; |
569 |
|
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)}"; |
573 |
|
rmpf_final_mark->SetTextSize(0.03); |
574 |
|
rmpf_final_mark->Draw(); |
575 |
|
DrawPrelim(); |
576 |
+ |
float MPFResult=1/mpf_pol0->GetParameter(0); |
577 |
+ |
float MPFResultError=mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0)); |
578 |
|
|
579 |
|
stringstream filename2; |
580 |
|
filename2 << "Extrapolation/FINAL_RESULT_MPF"; |
588 |
|
RABS_FinalGraph->Draw("AP"); |
589 |
|
RABS_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}"); |
590 |
|
RABS_FinalGraph->GetXaxis()->CenterTitle(); |
591 |
< |
RABS_FinalGraph->GetYaxis()->SetTitle("data/mc"); |
591 |
> |
RABS_FinalGraph->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}"); |
592 |
|
RABS_FinalGraph->GetYaxis()->CenterTitle(); |
593 |
|
RABS_FinalGraph->Draw("AP"); |
594 |
|
TF1 *rabs_pol0=(TF1*)RABS_FinalGraph->GetFunction("pol0"); |
601 |
|
rabs_final_mark->Draw(); |
602 |
|
DrawPrelim(); |
603 |
|
|
604 |
+ |
float RabsResult=1/rabs_pol0->GetParameter(0); |
605 |
+ |
float RabsResultError=rabs_pol0->GetParError(0)/(rabs_pol0->GetParameter(0)*rabs_pol0->GetParameter(0)); |
606 |
+ |
|
607 |
|
filename2.str(""); |
608 |
|
filename2 << "Extrapolation/FINAL_RESULT_RABS"; |
609 |
|
CompleteSave(can,filename2.str()); |
610 |
|
|
611 |
+ |
can->cd(); |
612 |
+ |
MPF_FaceValueAtPoint3->SetMarkerStyle(21); |
613 |
+ |
MPF_FaceValueAtPoint3->SetMarkerColor(kBlue); |
614 |
+ |
MPF_FaceValueAtPoint3->Fit("pol0","QE"); // quiet, use minos |
615 |
+ |
MPF_FaceValueAtPoint3->Draw("AP"); |
616 |
+ |
MPF_FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}"); |
617 |
+ |
MPF_FaceValueAtPoint3->GetXaxis()->CenterTitle(); |
618 |
+ |
MPF_FaceValueAtPoint3->GetYaxis()->SetTitle("<MPF>__{data}/<MPF>_{mc} for #alpha<0.3"); |
619 |
+ |
MPF_FaceValueAtPoint3->GetYaxis()->CenterTitle(); |
620 |
+ |
MPF_FaceValueAtPoint3->Draw("AP"); |
621 |
+ |
TF1 *faceval_pol0=(TF1*)MPF_FaceValueAtPoint3->GetFunction("pol0"); |
622 |
+ |
faceval_pol0->SetLineColor(kBlue); |
623 |
+ |
faceval_pol0->SetLineWidth(1); |
624 |
+ |
faceval_pol0->Draw("same"); |
625 |
+ |
TF1 *faceval_pol0_complete = new TF1("faceval_pol0_complete","[0]+[1]*x"); |
626 |
+ |
faceval_pol0_complete->SetParameters(faceval_pol0->GetParameters()); |
627 |
+ |
stringstream faceval_result; |
628 |
+ |
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)}";; |
629 |
+ |
TText *faceval_final_mark = write_title(faceval_result.str()); |
630 |
+ |
faceval_final_mark->SetX(0.75); |
631 |
+ |
faceval_final_mark->SetY(0.75); |
632 |
+ |
faceval_final_mark->SetTextSize(0.03); |
633 |
+ |
faceval_final_mark->Draw(); |
634 |
+ |
DrawPrelim(); |
635 |
+ |
|
636 |
+ |
float FaceValResult=1/faceval_pol0->GetParameter(0); |
637 |
+ |
float FaceValResultError=faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0)); |
638 |
+ |
|
639 |
+ |
filename2.str(""); |
640 |
+ |
filename2 << "Extrapolation/FINAL_RESULT_MPF_FaceValp3"; |
641 |
+ |
CompleteSave(can,filename2.str()); |
642 |
+ |
|
643 |
+ |
can->cd(); |
644 |
+ |
RABS_FaceValueAtPoint3->SetMarkerStyle(21); |
645 |
+ |
RABS_FaceValueAtPoint3->SetMarkerColor(kRed); |
646 |
+ |
RABS_FaceValueAtPoint3->Fit("pol0","QE"); // quiet, use minos |
647 |
+ |
RABS_FaceValueAtPoint3->Draw("AP"); |
648 |
+ |
RABS_FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}"); |
649 |
+ |
RABS_FaceValueAtPoint3->GetXaxis()->CenterTitle(); |
650 |
+ |
RABS_FaceValueAtPoint3->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc} for #alpha<0.3"); |
651 |
+ |
RABS_FaceValueAtPoint3->GetYaxis()->CenterTitle(); |
652 |
+ |
RABS_FaceValueAtPoint3->Draw("AP"); |
653 |
+ |
TF1 *faceval_pol0RABS=(TF1*)RABS_FaceValueAtPoint3->GetFunction("pol0"); |
654 |
+ |
TF1 *faceval_pol0RABS_complete = new TF1("faceval_pol0_complete","[0]+[1]*x"); |
655 |
+ |
faceval_pol0RABS_complete->SetParameters(faceval_pol0RABS->GetParameters()); |
656 |
+ |
faceval_pol0RABS->SetLineWidth(1); |
657 |
+ |
faceval_pol0RABS->SetLineColor(kRed); |
658 |
+ |
faceval_pol0RABS_complete->Draw("same"); |
659 |
+ |
stringstream RABSfaceval_result; |
660 |
+ |
RABSfaceval_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/faceval_pol0RABS->GetParameter(0) << " #pm " << std::setprecision(2) << faceval_pol0RABS->GetParError(0)/(faceval_pol0RABS->GetParameter(0)*faceval_pol0RABS->GetParameter(0)) << "}{ (R_{abs} at #alpha<0.3)}";; |
661 |
+ |
TText *RABSfaceval_final_mark = write_title(RABSfaceval_result.str()); |
662 |
+ |
RABSfaceval_final_mark->SetX(0.75); |
663 |
+ |
RABSfaceval_final_mark->SetY(0.75); |
664 |
+ |
RABSfaceval_final_mark->SetTextSize(0.03); |
665 |
+ |
RABSfaceval_final_mark->Draw(); |
666 |
+ |
DrawPrelim(); |
667 |
+ |
|
668 |
+ |
float RABSFaceValResult=1/faceval_pol0RABS->GetParameter(0); |
669 |
+ |
float RABSFaceValResultError=faceval_pol0RABS->GetParError(0)/(faceval_pol0RABS->GetParameter(0)*faceval_pol0RABS->GetParameter(0)); |
670 |
+ |
|
671 |
+ |
filename2.str(""); |
672 |
+ |
filename2 << "Extrapolation/FINAL_RESULT_RABS_FaceValp3"; |
673 |
+ |
CompleteSave(can,filename2.str()); |
674 |
+ |
|
675 |
+ |
cout << "FINAL RESULTS: " << endl; |
676 |
+ |
cout << "MPF : " << MPFResult << " +/- " << MPFResultError << endl; |
677 |
+ |
cout << "Rabs: " << RabsResult << " +/- " << RabsResultError << endl; |
678 |
+ |
cout << "Face value at 0.3 :" << FaceValResult << " +/- " << FaceValResultError << " (MPF) " << endl; |
679 |
+ |
cout << "Face value at 0.3 :" << RABSFaceValResult << " +/- " << RABSFaceValResultError << " (RABS) " << endl; |
680 |
+ |
|
681 |
+ |
delete can; |
682 |
+ |
|
683 |
+ |
|
684 |
+ |
} |
685 |
+ |
|
686 |
+ |
|
687 |
+ |
void DoPUStudy(string identifier) { |
688 |
+ |
|
689 |
+ |
float numVtxcuts[7]={0,10,15,20}; |
690 |
+ |
|
691 |
+ |
TCanvas *can = new TCanvas("can","can"); |
692 |
+ |
TH1F *malpha[8]; |
693 |
+ |
TH1F *dalpha[8]; |
694 |
+ |
cout << identifier << ";"; |
695 |
+ |
cout << endl; |
696 |
+ |
for(int i=1;i<5;i++) { |
697 |
+ |
stringstream sSpecialCut; |
698 |
+ |
if(i<4) { |
699 |
+ |
sSpecialCut << "numVtx>" << numVtxcuts[i-1] << " && numVtx<" << numVtxcuts[i]; |
700 |
+ |
cout << numVtxcuts[i-1] << " < nVtx < " << numVtxcuts[i] << ";"; |
701 |
+ |
} else { |
702 |
+ |
sSpecialCut << "numVtx>" << numVtxcuts[i-1]; |
703 |
+ |
cout << numVtxcuts[i-1] << ";"; |
704 |
+ |
} |
705 |
+ |
|
706 |
+ |
TCut SpecialCut(sSpecialCut.str().c_str()); |
707 |
+ |
|
708 |
+ |
|
709 |
+ |
malpha[i] = allsamples.Draw("malpha"+any2string(i),"mpf",1000,0,10,"MPF","events",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&SpecialCut,mc,luminosity); |
710 |
+ |
dalpha[i] = allsamples.Draw("dalpha"+any2string(i),"mpf",1000,0,10,"MPF","events",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&SpecialCut,data,luminosity); |
711 |
+ |
|
712 |
+ |
|
713 |
+ |
float a=dalpha[i]->GetMean(); |
714 |
+ |
float b=malpha[i]->GetMean(); |
715 |
+ |
float da=dalpha[i]->GetMeanError(); |
716 |
+ |
float db=malpha[i]->GetMeanError(); |
717 |
+ |
float factor = a / b; |
718 |
+ |
float error = TMath::Sqrt( (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db); |
719 |
+ |
|
720 |
+ |
cout << malpha[i]->GetMean() << ";" << malpha[i]->GetMeanError() << ";" << dalpha[i]->GetMean() << ";" << dalpha[i]->GetMeanError() << ";" << malpha[i]->Integral()<<";"<<dalpha[i]->Integral() << ";"<<factor << ";" << error << endl; |
721 |
+ |
malpha[i]->SetLineColor(i+1); |
722 |
+ |
if(i==0) malpha[i]->Draw("histo"); |
723 |
+ |
else malpha[i]->Draw("histo,same"); |
724 |
+ |
} |
725 |
+ |
|
726 |
+ |
CompleteSave(can,"AlphaOverview_"+identifier); |
727 |
+ |
delete can; |
728 |
+ |
|
729 |
+ |
/* for(int i=1;i<8;i++) { |
730 |
+ |
delete malpha[i]; |
731 |
+ |
delete dalpha[i]; |
732 |
+ |
} |
733 |
+ |
*/ |
734 |
+ |
|
735 |
+ |
} |
736 |
+ |
|
737 |
+ |
void ScenarioComparison() { |
738 |
+ |
//very dumb way to do this. |
739 |
+ |
TGraphAsymmErrors *gr[5]; |
740 |
+ |
TF1 *fit[5]; |
741 |
+ |
bool dofit=false; |
742 |
+ |
|
743 |
+ |
TCanvas *can = new TCanvas("can","can",500,500); |
744 |
+ |
|
745 |
+ |
TLegend *leg = new TLegend(0.2,0.2,0.5,0.45); |
746 |
+ |
leg->SetBorderSize(0); |
747 |
+ |
leg->SetFillColor(kWhite); |
748 |
+ |
|
749 |
+ |
for(int i=0;i<5;i++) { |
750 |
+ |
gr[i] = new TGraphAsymmErrors(); |
751 |
+ |
double x[4] = {5,12.5,17.5,20}; |
752 |
+ |
double dxl[4] = {5,2.5,2.5,2.5}; |
753 |
+ |
double dxh[4] = {5,2.5,2.5,10}; |
754 |
+ |
|
755 |
+ |
string name=""; |
756 |
+ |
string color=""; |
757 |
+ |
|
758 |
+ |
if(i==0) { |
759 |
+ |
double y[4] = {1.008,1.013,1.003,1.007}; |
760 |
+ |
double dyl[4] = {0.011,0.009,0.013,0.020}; |
761 |
+ |
double dyh[4] = {0.011,0.009,0.013,0.020}; |
762 |
+ |
name="30/30"; |
763 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
764 |
+ |
color="#a01d99"; |
765 |
+ |
} |
766 |
+ |
if(i==1) { |
767 |
+ |
double y[4] = {1.008+0.001,1.013+0.001,1.003+0.001,1.007+0.001}; |
768 |
+ |
double dyl[4] = {0.011,0.009,0.013,0.020}; |
769 |
+ |
double dyh[4] = {0.011,0.009,0.013,0.020}; |
770 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
771 |
+ |
name="30/15"; |
772 |
+ |
color="#2464bc"; |
773 |
+ |
} |
774 |
+ |
if(i==2) { |
775 |
+ |
double y[4] = {1.014,1.026,1.014,1.059}; |
776 |
+ |
double dyl[4] = {0.011,0.010,0.014,0.023}; |
777 |
+ |
double dyh[4] = {0.011,0.010,0.014,0.023}; |
778 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
779 |
+ |
name="15/15"; |
780 |
+ |
color="#f49230"; |
781 |
+ |
} |
782 |
+ |
if(i==3) { |
783 |
+ |
double y[4] = {1.015,1.020,1.008,1.050}; |
784 |
+ |
double dyl[4] = {0.011,0.010,0.014,0.022}; |
785 |
+ |
double dyh[4] = {0.011,0.010,0.014,0.022}; |
786 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
787 |
+ |
name="20/15"; |
788 |
+ |
color="#c72f3c"; |
789 |
+ |
} |
790 |
+ |
if(i==4) { |
791 |
+ |
double y[4] = {1.015+0.001,1.020+0.001,1.008+0.001,1.050+0.001}; |
792 |
+ |
double dyl[4] = {0.011,0.010,0.014,0.022}; |
793 |
+ |
double dyh[4] = {0.011,0.010,0.014,0.022}; |
794 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
795 |
+ |
name="20/20"; |
796 |
+ |
color="#7cb433"; |
797 |
+ |
} |
798 |
+ |
|
799 |
+ |
|
800 |
+ |
gr[i]->SetTitle(); |
801 |
+ |
gr[i]->GetXaxis()->SetTitle("N(Vtx)"); |
802 |
+ |
gr[i]->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
803 |
+ |
gr[i]->GetXaxis()->CenterTitle(); |
804 |
+ |
gr[i]->GetYaxis()->CenterTitle(); |
805 |
+ |
gr[i]->SetName(name.c_str()); |
806 |
+ |
gr[i]->SetMarkerSize(0.00001); |
807 |
+ |
gr[i]->GetYaxis()->SetRangeUser(0.90,1.10); |
808 |
+ |
gr[i]->SetLineColor(TColor::GetColor(color.c_str())); |
809 |
+ |
gr[i]->SetMarkerColor(TColor::GetColor(color.c_str())); |
810 |
+ |
if(dofit) { |
811 |
+ |
gr[i]->Fit("pol1"); |
812 |
+ |
fit[i] = (TF1*)gr[i]->GetFunction("pol1"); |
813 |
+ |
fit[i]->SetLineColor(TColor::GetColor(color.c_str())); |
814 |
+ |
} |
815 |
+ |
leg->AddEntry(gr[i],name.c_str(),"l"); |
816 |
+ |
if(i==0) gr[i]->Draw("AP*"); |
817 |
+ |
else gr[i]->Draw("P"); |
818 |
+ |
} |
819 |
+ |
leg->Draw(); |
820 |
+ |
DrawPrelim(); |
821 |
+ |
|
822 |
+ |
CompleteSave(can,"ScenarioComparison"); |
823 |
+ |
delete can; |
824 |
+ |
|
825 |
+ |
} |
826 |
+ |
|
827 |
+ |
void ScenarioComparisonInclusive() { |
828 |
+ |
//dumbest way ever to do this. but ok we only need to do it once. |
829 |
+ |
TGraphAsymmErrors *gr[5]; |
830 |
+ |
TF1 *fit[5]; |
831 |
+ |
bool dofit=true; |
832 |
+ |
|
833 |
+ |
TCanvas *can = new TCanvas("can","can",500,500); |
834 |
+ |
|
835 |
+ |
TLegend *leg = new TLegend(0.2,0.2,0.5,0.45); |
836 |
+ |
leg->SetBorderSize(0); |
837 |
+ |
leg->SetFillColor(kWhite); |
838 |
+ |
|
839 |
+ |
for(int i=0;i<5;i++) { |
840 |
+ |
gr[i] = new TGraphAsymmErrors(); |
841 |
+ |
double x[4] = {5,12.5,17.5,20}; |
842 |
+ |
double dxl[4] = {5,2.5,2.5,2.5}; |
843 |
+ |
double dxh[4] = {5,2.5,2.5,10}; |
844 |
+ |
|
845 |
+ |
string name=""; |
846 |
+ |
string color=""; |
847 |
+ |
|
848 |
+ |
if(i==0) { |
849 |
+ |
double y[4] = {1.01103,1.01496,1.01486,1.02785}; |
850 |
+ |
double dyl[4] = {0.00235044,0.00225264,0.00313574,0.00541047}; |
851 |
+ |
double dyh[4] = {0.00235044,0.00225264,0.00313574,0.00541047}; |
852 |
+ |
name="30/30"; |
853 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
854 |
+ |
color="#a01d99"; |
855 |
+ |
} |
856 |
+ |
if(i==1) { |
857 |
+ |
double y[4] = {1.01103+0.001,1.01496+0.001,1.01486+0.001,1.02785+0.001}; |
858 |
+ |
double dyl[4] = {0.00235044,0.00225264,0.00313574,0.00541047}; |
859 |
+ |
double dyh[4] = {0.00235044,0.00225264,0.00313574,0.00541047}; |
860 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
861 |
+ |
name="30/15"; |
862 |
+ |
color="#2464bc"; |
863 |
+ |
} |
864 |
+ |
if(i==2) { |
865 |
+ |
double y[4] = {1.01575,1.02879,1.0325,1.05456}; |
866 |
+ |
double dyl[4] = {0.00288281,0.00278536,0.00367451,0.00590421}; |
867 |
+ |
double dyh[4] = {0.00288281,0.00278536,0.00367451,0.00590421}; |
868 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
869 |
+ |
name="15/15"; |
870 |
+ |
color="#f49230"; |
871 |
+ |
} |
872 |
+ |
if(i==3) { |
873 |
+ |
double y[4] = {1.01221,1.01922,1.02396,1.04677}; |
874 |
+ |
double dyl[4] = {0.00263821,0.00260853,0.00353673,0.00584728}; |
875 |
+ |
double dyh[4] = {0.00263821,0.00260853,0.00353673,0.00584728}; |
876 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
877 |
+ |
name="20/15"; |
878 |
+ |
color="#c72f3c"; |
879 |
+ |
} |
880 |
+ |
if(i==4) { |
881 |
+ |
double y[4] = {1.01221+0.001,1.01922+0.001,1.02396+0.001,1.04677+0.001}; |
882 |
+ |
double dyl[4] = {0.00263821,0.00260853,0.00353673,0.00584728}; |
883 |
+ |
double dyh[4] = {0.00263821,0.00260853,0.00353673,0.00584728}; |
884 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
885 |
+ |
name="20/20"; |
886 |
+ |
color="#7cb433"; |
887 |
+ |
} |
888 |
+ |
|
889 |
+ |
|
890 |
+ |
gr[i]->SetTitle(); |
891 |
+ |
gr[i]->GetXaxis()->SetTitle("N(Vtx)"); |
892 |
+ |
gr[i]->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
893 |
+ |
gr[i]->GetXaxis()->CenterTitle(); |
894 |
+ |
gr[i]->GetYaxis()->CenterTitle(); |
895 |
+ |
gr[i]->SetName(name.c_str()); |
896 |
+ |
gr[i]->SetMarkerSize(0.00001); |
897 |
+ |
gr[i]->GetYaxis()->SetRangeUser(0.90,1.10); |
898 |
+ |
gr[i]->SetLineColor(TColor::GetColor(color.c_str())); |
899 |
+ |
gr[i]->SetMarkerColor(TColor::GetColor(color.c_str())); |
900 |
+ |
if(dofit) { |
901 |
+ |
gr[i]->Fit("pol1"); |
902 |
+ |
fit[i] = (TF1*)gr[i]->GetFunction("pol1"); |
903 |
+ |
fit[i]->SetLineColor(TColor::GetColor(color.c_str())); |
904 |
+ |
} |
905 |
+ |
leg->AddEntry(gr[i],name.c_str(),"l"); |
906 |
+ |
if(i==0) gr[i]->Draw("AP*"); |
907 |
+ |
else gr[i]->Draw("P"); |
908 |
+ |
} |
909 |
+ |
leg->Draw(); |
910 |
+ |
DrawPrelim(); |
911 |
|
|
912 |
+ |
CompleteSave(can,"ScenarioComparisonInclusive"); |
913 |
|
delete can; |
914 |
|
|
915 |
+ |
} |
916 |
+ |
|
917 |
+ |
void compare_selection(string identifier) { |
918 |
+ |
bool recognized_scenario=false; |
919 |
+ |
|
920 |
+ |
cout << "Running with identifier " << identifier << endl; |
921 |
+ |
if(identifier=="Zb3010") { |
922 |
+ |
LeadingB=TCut ("Zb3010_bTagProbCSVBP[0]>0.898"); |
923 |
+ |
EtaB=TCut("abs(Zb3010_pfJetGoodEta[0])<1.3"); |
924 |
+ |
PhiZcut=TCut("abs(Zb3010_pfJetDphiZ[0])>2.7"); |
925 |
+ |
recognized_scenario=true; |
926 |
+ |
} |
927 |
+ |
|
928 |
+ |
if(identifier=="Zb3010") { |
929 |
+ |
LeadingB=TCut ("Zb3010_bTagProbCSVBP[0]>0.898"); |
930 |
+ |
EtaB=TCut("abs(Zb3010_pfJetGoodEta[0])<1.3"); |
931 |
+ |
PhiZcut=TCut("abs(Zb3010_pfJetDphiZ[0])>2.7"); |
932 |
+ |
recognized_scenario=true; |
933 |
+ |
} |
934 |
+ |
|
935 |
+ |
if(identifier=="Zb40") { |
936 |
+ |
LeadingB=TCut ("Zb40_bTagProbCSVBP[0]>0.898"); |
937 |
+ |
EtaB=TCut("abs(Zb40_pfJetGoodEta[0])<1.3"); |
938 |
+ |
PhiZcut=TCut("abs(Zb40_pfJetDphiZ[0])>2.7"); |
939 |
+ |
recognized_scenario=true; |
940 |
+ |
} |
941 |
+ |
|
942 |
+ |
if(identifier=="Zb301030") { |
943 |
+ |
LeadingB=TCut ("Zb301030_bTagProbCSVBP[0]>0.898"); |
944 |
+ |
EtaB=TCut("abs(Zb301030_pfJetGoodEta[0])<1.3"); |
945 |
+ |
PhiZcut=TCut("abs(Zb301030_pfJetDphiZ[0])>2.7"); |
946 |
+ |
recognized_scenario=true; |
947 |
+ |
} |
948 |
+ |
|
949 |
+ |
if(identifier=="Zb1530") { |
950 |
+ |
LeadingB=TCut ("Zb1530_bTagProbCSVBP[0]>0.898"); |
951 |
+ |
EtaB=TCut("abs(Zb1530_pfJetGoodEta[0])<1.3"); |
952 |
+ |
PhiZcut=TCut("abs(Zb1530_pfJetDphiZ[0])>2.7"); |
953 |
+ |
recognized_scenario=true; |
954 |
+ |
} |
955 |
+ |
|
956 |
+ |
if(identifier=="Zb301010") { |
957 |
+ |
LeadingB=TCut ("Zb301010_bTagProbCSVBP[0]>0.898"); |
958 |
+ |
EtaB=TCut("abs(Zb301010_pfJetGoodEta[0])<1.3"); |
959 |
+ |
PhiZcut=TCut("abs(Zb301010_pfJetDphiZ[0])>2.7"); |
960 |
+ |
recognized_scenario=true; |
961 |
+ |
} |
962 |
+ |
|
963 |
+ |
if(identifier=="Zb1510") { |
964 |
+ |
LeadingB=TCut ("Zb1510_bTagProbCSVBP[0]>0.898"); |
965 |
+ |
EtaB=TCut("abs(Zb1510_pfJetGoodEta[0])<1.3"); |
966 |
+ |
PhiZcut=TCut("abs(Zb1510_pfJetDphiZ[0])>2.7"); |
967 |
+ |
recognized_scenario=true; |
968 |
+ |
} |
969 |
+ |
|
970 |
+ |
if(identifier=="Zb301010") { |
971 |
+ |
LeadingB=TCut ("Zb301010_bTagProbCSVBP[0]>0.898"); |
972 |
+ |
EtaB=TCut("abs(Zb301010_pfJetGoodEta[0])<1.3"); |
973 |
+ |
PhiZcut=TCut("abs(Zb301010_pfJetDphiZ[0])>2.7"); |
974 |
+ |
recognized_scenario=true; |
975 |
+ |
} |
976 |
+ |
|
977 |
+ |
if(identifier=="ZbMikko") { |
978 |
+ |
LeadingB=TCut ("ZbMikko_bTagProbCSVBP[0]>0.898 && ZbMikko__IsClean"); |
979 |
+ |
EtaB=TCut("abs(ZbMikko_pfJetGoodEta[0])<1.3 && ZbMikko__IsClean"); |
980 |
+ |
PhiZcut=TCut("abs(ZbMikko_pfJetDphiZ[0])>2.7 && ZbMikko__IsClean"); |
981 |
+ |
recognized_scenario=true; |
982 |
+ |
} |
983 |
+ |
|
984 |
+ |
if(identifier=="Zb3010_SecEta3") { |
985 |
+ |
LeadingB=TCut ("Zb3010_SecEta3_bTagProbCSVBP[0]>0.898"); |
986 |
+ |
EtaB=TCut("abs(Zb3010_SecEta3_pfJetGoodEta[0])<1.3"); |
987 |
+ |
PhiZcut=TCut("abs(Zb3010_SecEta3_pfJetDphiZ[0])>2.7"); |
988 |
+ |
recognized_scenario=true; |
989 |
+ |
} |
990 |
+ |
|
991 |
+ |
if(identifier=="Zb3010_SecEta5") { |
992 |
+ |
LeadingB=TCut ("Zb3010_SecEta5_bTagProbCSVBP[0]>0.898"); |
993 |
+ |
EtaB=TCut("abs(Zb3010_SecEta5_pfJetGoodEta[0])<1.3"); |
994 |
+ |
PhiZcut=TCut("abs(Zb3010_SecEta5_pfJetDphiZ[0])>2.7"); |
995 |
+ |
recognized_scenario=true; |
996 |
+ |
} |
997 |
+ |
|
998 |
+ |
if(identifier=="Zb3010_p5Clean") { |
999 |
+ |
LeadingB=TCut ("Zb3010_p5Clean_bTagProbCSVBP[0]>0.898 && Zb3010_p5Clean_IsClean"); |
1000 |
+ |
EtaB=TCut("abs(Zb3010_p5Clean_pfJetGoodEta[0])<1.3 && Zb3010_p5Clean_IsClean"); |
1001 |
+ |
PhiZcut=TCut("abs(Zb3010_p5Clean_pfJetDphiZ[0])>2.7 && Zb3010_p5Clean_IsClean"); |
1002 |
+ |
recognized_scenario=true; |
1003 |
+ |
} |
1004 |
+ |
|
1005 |
+ |
if(identifier=="Zb3010CHS") { |
1006 |
+ |
LeadingB=TCut ("Zb3010CHS_bTagProbCSVBP[0]>0.898"); |
1007 |
+ |
EtaB=TCut("abs(Zb3010CHS_pfJetGoodEta[0])<1.3"); |
1008 |
+ |
PhiZcut=TCut("abs(Zb3010CHS_pfJetDphiZ[0])>2.7"); |
1009 |
+ |
recognized_scenario=true; |
1010 |
+ |
} |
1011 |
+ |
|
1012 |
+ |
assert(recognized_scenario); |
1013 |
+ |
|
1014 |
+ |
cout << "Cuts: " << endl; |
1015 |
+ |
cout << " " << (const char*) LeadingB << endl; |
1016 |
+ |
cout << " " << (const char*) EtaB << endl; |
1017 |
+ |
cout << " " << (const char*) PhiZcut << endl; |
1018 |
+ |
|
1019 |
+ |
cout << endl << endl; |
1020 |
+ |
|
1021 |
+ |
// ScenarioComparison(); |
1022 |
+ |
// ScenarioComparisonInclusive(); |
1023 |
+ |
|
1024 |
+ |
|
1025 |
+ |
// DoPUStudy(identifier); |
1026 |
+ |
|
1027 |
+ |
// SpecialCutFlow(identifier); |
1028 |
+ |
// draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",17000,30,200,"Z p_{T}","Official/"+identifier+"/Zpt__"+identifier,1); |
1029 |
+ |
// draw_kin_variable(identifier+"_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",40,0,200,"Leading Jet Pt (B)","Official/"+identifier+"/LeadingJetPt__"+identifier,1); |
1030 |
+ |
// draw_kin_variable(identifier+"_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",40,0,200,"Sub-Leading Jet Pt [GeV]","Official/"+identifier+"/Jet2Pt__"+identifier,1); |
1031 |
+ |
// 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/"+identifier+"/SubLeadingJetPt_Over_ZPt__"+identifier,1); |
1032 |
+ |
draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<50"),20,0,2,"#alpha","Official/"+identifier+"/alpha_pt_30_to_50__"+identifier,1); |
1033 |
+ |
draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>50&&pt<75"),20,0,2,"#alpha","Official/"+identifier+"/alpha_50_to_75__"+identifier,1); |
1034 |
+ |
draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>75&&pt<125"),20,0,2,"#alpha","Official/"+identifier+"/alpha_pt_75_to_125__"+identifier,1); |
1035 |
+ |
draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>125&&pt<1000"),20,0,2,"#alpha","Official/"+identifier+"/alpha_pt_125_to_1000__"+identifier,1); |
1036 |
+ |
draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut,20,0,2,"#alpha","Official/"+identifier+"/alpha_full__"+identifier,1); |
1037 |
+ |
// draw_kin_variable(identifier+"_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>10&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","Official/"+identifier+"/DeltaPhiZBlead__"+identifier,0); |
1038 |
+ |
|
1039 |
+ |
// 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","Official/"+identifier+"/mpf_alpha_smaller_0p3___"+identifier,0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
1040 |
+ |
// 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","Official/"+identifier+"/ptb_over_ptz___alpha_smaller_0p3______"+identifier,0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV"); |
1041 |
+ |
|
1042 |
+ |
|
1043 |
+ |
// */ |
1044 |
|
|
1045 |
|
} |
1046 |
|
|
1047 |
+ |
void GetNumberEventsInsideOutsideAlphaWindow(TCut specialcut, string title) { |
1048 |
+ |
|
1049 |
+ |
// TCut cut = ZplusBsel&&LeadingB&&PhiZcut&&specialcut&&TCut("Zb3010_alpha<0.3"); |
1050 |
+ |
TCut cut = specialcut; |
1051 |
+ |
TCut in = EtaB; |
1052 |
+ |
TCut out = TCut("abs(Zb3010_pfJetGoodEta[0])>1.3"); |
1053 |
+ |
|
1054 |
+ |
TH1F *data_IN = allsamples.Draw("data_IN", "mll",1,0,150, "nothing [GeV]", "events", cut&&in, data,luminosity); |
1055 |
+ |
TH1F *data_OUT = allsamples.Draw("data_OUT", "mll",1,0,150, "nothing [GeV]", "events", cut&&out,data,luminosity); |
1056 |
+ |
TH1F *mc_IN = allsamples.Draw("mc_IN", "mll",1,0,150, "nothing [GeV]", "events", cut&&in, mc ,luminosity); |
1057 |
+ |
TH1F *mc_OUT = allsamples.Draw("mc_OUT", "mll",1,0,150, "nothing [GeV]", "events", cut&&out,mc ,luminosity); |
1058 |
+ |
|
1059 |
+ |
dout << title << " : " << endl; |
1060 |
+ |
dout << " Data: In " << data_IN->Integral() << " vs out " << data_OUT->Integral() << endl; |
1061 |
+ |
dout << " MC : In " << mc_IN->Integral() << " vs out " << mc_OUT->Integral() << endl; |
1062 |
+ |
dout << " ratio in : " << data_IN->Integral()/mc_IN->Integral() << " +/- " << (data_IN->Integral()/mc_IN->Integral()) * sqrt(1.0/mc_IN->Integral()+ 1.0/data_IN->Integral()) << endl; |
1063 |
+ |
dout << " ratio out : " << data_OUT->Integral()/mc_OUT->Integral() << " +/- " << (data_OUT->Integral()/mc_OUT->Integral()) * sqrt(1.0/mc_OUT->Integral()+ 1.0/data_OUT->Integral()) << endl; |
1064 |
+ |
|
1065 |
+ |
delete data_IN; |
1066 |
+ |
delete data_OUT; |
1067 |
+ |
delete mc_IN; |
1068 |
+ |
delete mc_OUT; |
1069 |
+ |
} |
1070 |
+ |
|
1071 |
+ |
void GetNumberEventsInsideOutsideAlphaWindow() { |
1072 |
+ |
TCanvas *ca = new TCanvas("ca","ca"); |
1073 |
+ |
// GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==0"), "ee"); |
1074 |
+ |
// GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==1"), "mm"); |
1075 |
+ |
// GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2"), "ee/mm"); |
1076 |
+ |
|
1077 |
+ |
cout << "BASE SELECTION" << endl; |
1078 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==0"), "ee"); |
1079 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==1"), "mm"); |
1080 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2"), "ee/mm"); |
1081 |
+ |
|
1082 |
+ |
cout << "BASE SELECTION: Z+b" << endl; |
1083 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2&&id1==0"), "ee"); |
1084 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2&&id1==1"), "mm"); |
1085 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2"), "ee/mm"); |
1086 |
+ |
|
1087 |
+ |
cout << "Leading B" << endl; |
1088 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0"), "ee"); |
1089 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1"), "mm"); |
1090 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2"), "ee/mm"); |
1091 |
+ |
|
1092 |
+ |
cout << "PhiZcut" << endl; |
1093 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0"), "ee"); |
1094 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1"), "mm"); |
1095 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2"), "ee/mm"); |
1096 |
+ |
|
1097 |
+ |
cout << "alpha cut" << endl; |
1098 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0")&&TCut("Zb3010_alpha<0.3"), "ee"); |
1099 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1")&&TCut("Zb3010_alpha<0.3"), "mm"); |
1100 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2")&&TCut("Zb3010_alpha<0.3"), "ee/mm"); |
1101 |
+ |
|
1102 |
+ |
delete ca; |
1103 |
+ |
|
1104 |
+ |
|
1105 |
+ |
} |
1106 |
+ |
|
1107 |
|
|
1108 |
|
|
1109 |
< |
void do_basic_ZB_analysis() { |
1109 |
> |
|
1110 |
> |
void do_basic_ZB_analysis(int do_inclusive) { |
1111 |
> |
|
1112 |
> |
//https://twiki.cern.ch/twiki/bin/viewauth/CMS/BtagPOG#2011_Data_and_MC |
1113 |
> |
//https://twiki.cern.ch/twiki/pub/CMS/BtagPOG/SFb-ttbar_payload.txt |
1114 |
> |
|
1115 |
> |
cout << "The lepton requirement is " << (const char*) leptoncut << endl; |
1116 |
> |
if(do_inclusive) { |
1117 |
> |
LeadingB=TCut("Zb3010_bTagProbCSVBP[0]>=-10000"); |
1118 |
> |
cutWeight=TCut("(weight*(weight<1000)*(is_data+(!is_data)))"); |
1119 |
> |
write_info(__FUNCTION__,"Inclusive selection - no btag requirement, no btag efficiency/mistag correction (weight)"); |
1120 |
> |
} else { |
1121 |
> |
LeadingB=TCut("Zb3010_bTagProbCSVBP[0]>0.898"); |
1122 |
> |
cutWeight=TCut("(weight*(weight<1000)*(is_data+(!is_data)*((id1==id2&&id1==0)*0.95+(id1==id2&&id1==1)*0.88+(id1!=id2)*0.92)*Zb3010_BTagWgt))"); |
1123 |
> |
write_info(__FUNCTION__,"Exclusive selection - switched on btag requirement and btag efficiency/mistag correction (weight)"); |
1124 |
> |
} |
1125 |
> |
|
1126 |
> |
bool doquick=true; |
1127 |
> |
|
1128 |
|
TCanvas *zbcanvas = new TCanvas("zbcanvas","zbcanvas"); |
417 |
– |
write_warning(__FUNCTION__,"TESTING NEW DATA MC AGREEMENT"); |
1129 |
|
|
1130 |
< |
/* |
1131 |
< |
write_warning(__FUNCTION__,"Not doing b yields (already implemented)"); |
1132 |
< |
// print_all_b_yields(); |
1133 |
< |
write_warning(__FUNCTION__,"Not drawing mpf variables (already implemented)"); |
1134 |
< |
// draw_mpf_vars(); |
1135 |
< |
write_warning(__FUNCTION__,"Not drawing mpf variables (already implemented)"); |
1136 |
< |
draw_Zb_kin_vars(); |
1130 |
> |
// compare_selection("Zb3010_p5Clean"); |
1131 |
> |
// compare_selection("Zb3010CHS"); |
1132 |
> |
// compare_selection("Zb3010"); |
1133 |
> |
// compare_selection("Zb301030"); |
1134 |
> |
// compare_selection("Zb1530"); |
1135 |
> |
// compare_selection("Zb301010"); |
1136 |
> |
// compare_selection("Zb3010_SecEta3"); |
1137 |
> |
// compare_selection("Zb3010_SecEta5"); |
1138 |
> |
// compare_selection("Zb1510"); |
1139 |
> |
// compare_selection("Zb301010"); |
1140 |
> |
// compare_selection("ZbMikko"); |
1141 |
> |
// compare_selection("Zb3010"); |
1142 |
> |
// compare_selection("Zb40"); |
1143 |
> |
|
1144 |
> |
if(!doquick) { |
1145 |
> |
print_all_b_yields(); |
1146 |
> |
draw_mpf_vars(); |
1147 |
> |
// DrawEvilCutFlow(); |
1148 |
> |
|
1149 |
> |
draw_Zb_kin_vars(); |
1150 |
> |
|
1151 |
> |
} |
1152 |
|
|
1153 |
< |
data_mc_agreement_2d(); |
428 |
< |
*/ |
1153 |
> |
// GetNumberEventsInsideOutsideAlphaWindow(); |
1154 |
|
new_data_mc_agreement_2d(); |
1155 |
|
|
1156 |
|
delete zbcanvas; |
1157 |
|
} |
1158 |
+ |
|
1159 |
+ |
|
1160 |
+ |
|
1161 |
+ |
|
1162 |
+ |
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* DELETE EVERYTHING BELOW THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*// |
1163 |
+ |
|
1164 |
+ |
|
1165 |
+ |
const char* concatenate(string bla1, string bla2) { |
1166 |
+ |
stringstream bla; |
1167 |
+ |
bla << bla1 << bla2; |
1168 |
+ |
return bla.str().c_str(); |
1169 |
+ |
} |
1170 |
+ |
|
1171 |
+ |
void SpecialCutFlow(string identifier) { |
1172 |
+ |
stringstream MegaCut; |
1173 |
+ |
|
1174 |
+ |
|
1175 |
+ |
|
1176 |
+ |
MegaCut << " 1*(" << (const char*) (ZplusBsel&&TCut(concatenate(identifier,"_pfJetGoodNumBtag>0"))) << ")"; |
1177 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB) << ")"; |
1178 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB) << ")"; |
1179 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut) << ")"; |
1180 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000").c_str())) << ")"; |
1181 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.3").c_str())) << ")"; |
1182 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.2").c_str())) << ")"; |
1183 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.15").c_str())) << ")"; |
1184 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.1").c_str())) << ")"; |
1185 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.05").c_str())) << ")"; |
1186 |
+ |
MegaCut << " "; |
1187 |
+ |
|
1188 |
+ |
TCanvas *can = new TCanvas("can","can"); |
1189 |
+ |
can->SetLogy(1); |
1190 |
+ |
TCut basecut(ZplusBsel); |
1191 |
+ |
|
1192 |
+ |
|
1193 |
+ |
|
1194 |
+ |
TLegend *leg = allsamples.allbglegend(); |
1195 |
+ |
|
1196 |
+ |
|
1197 |
+ |
TH1F *data = allsamples.Draw("data", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity); |
1198 |
+ |
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity); |
1199 |
+ |
|
1200 |
+ |
float runningsum=0; |
1201 |
+ |
for(int i=data->GetNbinsX();i>0;i--) { |
1202 |
+ |
runningsum+=data->GetBinContent(i); |
1203 |
+ |
data->SetBinContent(i,runningsum); |
1204 |
+ |
} |
1205 |
+ |
|
1206 |
+ |
float minimum=data->GetMaximum(); |
1207 |
+ |
|
1208 |
+ |
TH1F* h; |
1209 |
+ |
TIter nextOF(mcm.GetHists()); |
1210 |
+ |
|
1211 |
+ |
float mcsum=0; |
1212 |
+ |
float zb=0; |
1213 |
+ |
while ( h = (TH1F*)nextOF() ) { |
1214 |
+ |
float runningsum=0; |
1215 |
+ |
minimum=data->GetMaximum();//done deliberately at each step so get the minimum of the last (!) contribution |
1216 |
+ |
for(int i=h->GetNbinsX();i>0;i--) { |
1217 |
+ |
runningsum+=h->GetBinContent(i); |
1218 |
+ |
h->SetBinContent(i,runningsum); |
1219 |
+ |
if(runningsum<minimum&&runningsum>0) minimum=runningsum; |
1220 |
+ |
} |
1221 |
+ |
if(Contains(h->GetName(),"Z_b_")) { |
1222 |
+ |
zb=h->GetBinContent(h->GetNbinsX()); |
1223 |
+ |
} |
1224 |
+ |
mcsum+=h->GetBinContent(h->GetNbinsX()); |
1225 |
+ |
} |
1226 |
+ |
|
1227 |
+ |
|
1228 |
+ |
|
1229 |
+ |
data->SetMinimum(0.05*minimum); |
1230 |
+ |
can->cd(1)->SetBottomMargin(0.25); |
1231 |
+ |
data->GetXaxis()->SetBinLabel(1,"Pre-selection"); |
1232 |
+ |
data->GetXaxis()->SetBinLabel(2,"Contains b jet"); |
1233 |
+ |
data->GetXaxis()->SetBinLabel(3,"Leading jet is b-jet"); |
1234 |
+ |
data->GetXaxis()->SetBinLabel(4,"|#eta_{b}|<1.3 "); |
1235 |
+ |
data->GetXaxis()->SetBinLabel(5,"|#delta#phi(b,Z)|>2.7"); |
1236 |
+ |
data->GetXaxis()->SetBinLabel(6,"10<p_{T}^{Z}<1000 GeV"); |
1237 |
+ |
data->GetXaxis()->SetBinLabel(7,"#alpha < 0.3"); |
1238 |
+ |
data->GetXaxis()->SetBinLabel(8,"#alpha < 0.2"); |
1239 |
+ |
data->GetXaxis()->SetBinLabel(9,"#alpha < 0.15"); |
1240 |
+ |
data->GetXaxis()->SetBinLabel(10,"#alpha < 0.1"); |
1241 |
+ |
data->GetXaxis()->SetBinLabel(11,"#alpha < 0.05"); |
1242 |
+ |
data->GetXaxis()->LabelsOption("v"); |
1243 |
+ |
|
1244 |
+ |
stringstream purityinfo; |
1245 |
+ |
purityinfo << "Purity: " << std::setprecision(3) << 100*zb/mcsum << " %"; |
1246 |
+ |
stringstream neventsinfo; |
1247 |
+ |
neventsinfo << "Nevents: " << data->GetBinContent(data->GetNbinsX()); |
1248 |
+ |
TH1F *crap = new TH1F("crap","",1,0,1); |
1249 |
+ |
crap->SetLineColor(kWhite); |
1250 |
+ |
leg->AddEntry(crap,purityinfo.str().c_str(),"l"); |
1251 |
+ |
leg->AddEntry(crap,neventsinfo.str().c_str(),"l"); |
1252 |
+ |
|
1253 |
+ |
data->Draw("e1"); |
1254 |
+ |
mcm.Draw("same"); |
1255 |
+ |
data->Draw("same,e1,axis"); |
1256 |
+ |
data->Draw("same,e1"); |
1257 |
+ |
// data->Draw("same,TEXT"); |
1258 |
+ |
|
1259 |
+ |
leg->Draw(); |
1260 |
+ |
|
1261 |
+ |
DrawPrelim(); |
1262 |
+ |
|
1263 |
+ |
CompleteSave(can,"CutFlow___"+identifier); |
1264 |
+ |
|
1265 |
+ |
delete crap; |
1266 |
+ |
delete data; |
1267 |
+ |
|
1268 |
+ |
|
1269 |
+ |
} |