26 |
|
TCut ZplusBsel("pt1>20&&pt2>20&&mll>60&&mll<120"); |
27 |
|
TCut LeadingB("Zb30_bTagProbCSVBP[0]>0.679"); |
28 |
|
TCut EtaB("abs(Zb30_pfJetGoodEta[0])<1.3"); |
29 |
< |
TCut PhiZcut("Zb30_pfJetDphiZ[0]>2.7"); |
29 |
> |
TCut PhiZcut("abs(pfJetDphiZ[0])>2.7"); |
30 |
|
|
31 |
|
} |
32 |
|
|
47 |
|
cout << " " << hist->GetName() << ": " << hist->Integral() << endl; |
48 |
|
} |
49 |
|
cout << endl << endl; |
50 |
+ |
|
51 |
|
delete data; |
52 |
|
} |
53 |
|
|
101 |
|
return sum; |
102 |
|
} |
103 |
|
|
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 |
– |
|
104 |
|
void print_all_b_yields() { |
105 |
|
cout << "Basic selection with a b jet" << endl; |
106 |
|
print_yield(ZplusBsel&&"Zb30_pfJetGoodNumBtag>0"); |
113 |
|
cout << "10<ptZ<1000 GeV" << endl; |
114 |
|
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"); |
115 |
|
cout << "#alpha < 0.3" << endl; |
116 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.3"); |
116 |
> |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb30_pfJetGoodPt[1]/pt)<0.3"); |
117 |
|
cout << "#alpha < 0.2" << endl; |
118 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.2"); |
118 |
> |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb30_pfJetGoodPt[1]/pt)<0.2"); |
119 |
|
cout << "#alpha < 0.15" << endl; |
120 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.15"); |
120 |
> |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb30_pfJetGoodPt[1]/pt)<0.15"); |
121 |
|
cout << "#alpha < 0.1" << endl; |
122 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.1"); |
122 |
> |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb30_pfJetGoodPt[1]/pt)<0.1"); |
123 |
|
cout << "#alpha < 0.05" << endl; |
124 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.05"); |
124 |
> |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb30_pfJetGoodPt[1]/pt)<0.05"); |
125 |
|
} |
126 |
|
|
127 |
|
void draw_Zb_kin_vars() { |
128 |
< |
draw_kin_variable("Zb30_pfBJetDphiZ",ZplusBsel&&LeadingB,100,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",1); |
129 |
< |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Z p_{T}","Zpt",1); |
130 |
< |
draw_kin_variable("Zb30_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Sub-Leading Jet Pt","Jet2Pt",1); |
131 |
< |
draw_kin_variable("Zb30_pfJetGoodPtlBtag[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Leading Jet Pt (B)","LeadingJetPt",1); |
132 |
< |
draw_kin_variable("Zb30_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,2,"#alpha","alpha",1); |
128 |
> |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Z p_{T}","Official/Zpt",1); |
129 |
> |
|
130 |
> |
draw_kin_variable("Zb30_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt",1); |
131 |
> |
draw_kin_variable("Zb30_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt",1); |
132 |
> |
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); |
133 |
> |
draw_kin_variable("Zb30_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<50",20,0,2,"#alpha","Official/alpha_pt_10_to_50",1); |
134 |
> |
draw_kin_variable("Zb30_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>50&&pt<100",20,0,2,"#alpha","Official/alpha_50_to_100",1); |
135 |
> |
draw_kin_variable("Zb30_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>100&&pt<200",20,0,2,"#alpha","Official/alpha_pt_100_to_200",1); |
136 |
> |
draw_kin_variable("Zb30_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>200&&pt<1000",20,0,2,"#alpha","Official/alpha_pt_200_to_1000",1); |
137 |
> |
|
138 |
> |
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); |
139 |
> |
|
140 |
> |
/* |
141 |
> |
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,200,"p_{T}^{l1}","Lep/pt1",1); |
142 |
> |
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==0",20,0,200,"p_{T}^{e1}","Lep/pt1_e",1); |
143 |
> |
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==1",20,0,200,"p_{T}^{#mu1}","Lep/pt1_m",1); |
144 |
> |
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,200,"p_{T}^{l2}","Lep/pt2",1); |
145 |
> |
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==0",20,0,200,"p_{T}^{e2}","Lep/pt2_e",1); |
146 |
> |
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==1",20,0,200,"p_{T}^{#mu2}","Lep/pt2_m",1); |
147 |
> |
draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta1",1); |
148 |
> |
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); |
149 |
> |
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); |
150 |
> |
draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta2",1); |
151 |
> |
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); |
152 |
> |
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); |
153 |
> |
draw_kin_variable("numVtx",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",30,0,30,"N(Vtx)","Lep/nVtx",1); |
154 |
> |
*/ |
155 |
|
} |
156 |
|
|
157 |
|
void draw_mpf_vars() { |
190 |
|
void new_data_mc_agreement_2d() { |
191 |
|
gStyle->SetOptFit(0); |
192 |
|
TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut); |
193 |
< |
|
194 |
< |
const int nalphacuts=5; |
240 |
< |
float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3}; |
193 |
> |
const int nalphacuts=6; |
194 |
> |
float alphacuts[nalphacuts] = {0.0,0.1,0.15,0.2,0.25,0.3}; |
195 |
|
int PointThree=-1; |
196 |
|
for(int i=0;i<nalphacuts;i++) { |
197 |
|
if((alphacuts[i]-0.3)<0.01) PointThree=i; |
210 |
|
float RABS_Errors[nalphacuts][nptcuts]; |
211 |
|
|
212 |
|
|
213 |
< |
for(int ia=0;ia<nalphacuts;ia++) { |
213 |
> |
for(int ia=0;ia<nalphacuts-1;ia++) { |
214 |
|
for(int ipt=0;ipt<nptcuts-1;ipt++) { |
215 |
|
stringstream specialcut; |
216 |
< |
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (alpha<" << alphacuts[ia] << "))"; |
216 |
> |
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (Zb30_alpha<" << alphacuts[ia+1] << "&&Zb30_alpha>" << alphacuts[ia] << "))"; |
217 |
|
Value MPF_data_over_mc = get_Zb_data_over_mc("mpf",TCut(basecut && specialcut.str().c_str())); |
218 |
|
Value RABS_data_over_mc = get_Zb_data_over_mc("Zb30_pfJetGoodPt[0]/pt",TCut(basecut && specialcut.str().c_str())); |
219 |
|
|
417 |
|
|
418 |
|
void do_basic_ZB_analysis() { |
419 |
|
TCanvas *zbcanvas = new TCanvas("zbcanvas","zbcanvas"); |
466 |
– |
write_warning(__FUNCTION__,"TESTING NEW DATA MC AGREEMENT"); |
420 |
|
|
468 |
– |
/* |
421 |
|
// print_all_b_yields(); |
422 |
|
// draw_mpf_vars(); |
423 |
|
draw_Zb_kin_vars(); |
424 |
|
|
473 |
– |
data_mc_agreement_2d(); |
474 |
– |
*/ |
425 |
|
new_data_mc_agreement_2d(); |
426 |
|
|
427 |
|
delete zbcanvas; |