1 |
|
#include <iostream> |
2 |
|
#include <vector> |
3 |
|
#include <sys/stat.h> |
4 |
+ |
#include <math.h> |
5 |
|
|
6 |
|
#include <TCut.h> |
7 |
|
#include <TROOT.h> |
17 |
|
#include <TProfile.h> |
18 |
|
#include <TLegendEntry.h> |
19 |
|
|
20 |
+ |
#include <RooRealVar.h> |
21 |
+ |
#include <RooArgSet.h> |
22 |
+ |
#include <RooDataSet.h> |
23 |
+ |
#include <RooDataHist.h> |
24 |
+ |
#include <RooMCStudy.h> |
25 |
+ |
#include <RooCategory.h> |
26 |
+ |
|
27 |
+ |
#include <RooPlot.h> |
28 |
+ |
#include <RooSimultaneous.h> |
29 |
+ |
#include <RooAddPdf.h> |
30 |
+ |
#include <RooFitResult.h> |
31 |
+ |
#include <RooVoigtian.h> |
32 |
+ |
#include <RooChebychev.h> |
33 |
+ |
#include <RooMsgService.h> |
34 |
+ |
|
35 |
+ |
#include <RooStats/ModelConfig.h> |
36 |
+ |
#include "RooStats/ProfileLikelihoodCalculator.h" |
37 |
+ |
#include "RooStats/LikelihoodInterval.h" |
38 |
+ |
#include "RooStats/HypoTestResult.h" |
39 |
+ |
#include "RooStats/SimpleLikelihoodRatioTestStat.h" |
40 |
+ |
#include "RooStats/ProfileLikelihoodTestStat.h" |
41 |
+ |
#include "RooStats/HybridCalculatorOriginal.h" |
42 |
+ |
#include "RooStats/HypoTestInverterOriginal.h" |
43 |
+ |
|
44 |
+ |
|
45 |
+ |
|
46 |
|
using namespace std; |
47 |
|
|
48 |
|
using namespace PlottingSetup; |
49 |
|
|
50 |
|
namespace ZbData { |
51 |
< |
vector<float> data_over_mc; |
51 |
> |
TCut ZplusBsel("pt1>20&&pt2>20&&mll>60&&mll<120&&id1==id2"); |
52 |
> |
TCut LeadingB("ZbCHS3010_bTagProbCSVBP[0]>0.898"); |
53 |
> |
TCut EtaB("abs(ZbCHS3010_pfJetGoodEta[0])<1.3"); |
54 |
> |
TCut PhiZcut("abs(ZbCHS3010_pfJetDphiZ[0])>2.7"); |
55 |
> |
float LowerHistoBoundary=0.5; // where to cut on MPF (or Rabs) |
56 |
> |
float UpperHistoBoundary=1.5; // where to cut on MPF (or Rabs) |
57 |
|
|
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"); |
30 |
– |
|
58 |
|
} |
59 |
|
|
60 |
+ |
TCut STDWEIGHT; |
61 |
+ |
|
62 |
+ |
class ZbPointResult { |
63 |
+ |
public: |
64 |
+ |
ZbPointResult(string var, float ptlow, float pthigh, float alphalow, float alphahigh, Value Data, Value MC); |
65 |
+ |
float PtLow; |
66 |
+ |
float PtHigh; |
67 |
+ |
float AlphaLow; |
68 |
+ |
float AlphaHigh; |
69 |
+ |
string variable; |
70 |
+ |
Value Data; |
71 |
+ |
Value MC; |
72 |
+ |
Value Ratio; |
73 |
+ |
}; |
74 |
+ |
|
75 |
+ |
ZbPointResult::ZbPointResult(string var, float ptlow, float pthigh, float alphalow, float alphahigh, Value data, Value mc) : |
76 |
+ |
variable(var), PtLow(ptlow), PtHigh(pthigh), AlphaLow(alphalow), AlphaHigh(alphahigh), Data(data), MC(mc) { |
77 |
+ |
Ratio = data/mc; |
78 |
+ |
} |
79 |
+ |
|
80 |
+ |
std::ostream &operator<<(std::ostream &ostr, ZbPointResult &b) |
81 |
+ |
{ |
82 |
+ |
ostr << b.PtLow << ";" << b.PtHigh << ";" << b.AlphaLow << ";" << b.AlphaHigh << ";" << b.Data.getValue() << ";" << b.Data.getError() << ";" << b.MC.getValue() << ";" << b.MC.getError() << ";" << b.Ratio.getValue() << ";" << b.Ratio.getError(); |
83 |
+ |
return ostr; |
84 |
+ |
} |
85 |
+ |
|
86 |
+ |
|
87 |
+ |
class ZbResultContainer { |
88 |
+ |
public: |
89 |
+ |
string name; |
90 |
+ |
vector<ZbPointResult> MPF_Rabs_location; |
91 |
+ |
Value MPF_Result_FaceValue; |
92 |
+ |
Value Rabs_Result_FaceValue; |
93 |
+ |
Value MPF_Result_Extrapolated; |
94 |
+ |
Value Rabs_Result_Extrapolated; |
95 |
+ |
void Print(); |
96 |
+ |
|
97 |
+ |
ZbResultContainer(string name); |
98 |
+ |
}; |
99 |
+ |
|
100 |
+ |
|
101 |
+ |
ZbResultContainer::ZbResultContainer(string _name) { |
102 |
+ |
name=_name; |
103 |
+ |
dout<< "Result Container for \"" << name << "\" has been initialized" << endl; |
104 |
+ |
|
105 |
+ |
} |
106 |
+ |
|
107 |
+ |
void ZbResultContainer::Print() |
108 |
+ |
{ |
109 |
+ |
dout << "Results for " << this->name << endl; |
110 |
+ |
dout << " MPF and Rabs locations: " << endl; |
111 |
+ |
for(int i=0;i<this->MPF_Rabs_location.size();i++) dout << " " << this->MPF_Rabs_location[i] << endl; |
112 |
+ |
dout << " Results: " << endl; |
113 |
+ |
dout << " Face Value: " << endl; |
114 |
+ |
dout << " MPF " << this->MPF_Result_FaceValue << endl; |
115 |
+ |
dout << " Rabs " << this->Rabs_Result_FaceValue << endl; |
116 |
+ |
dout << " Extrapolated: " << endl; |
117 |
+ |
dout << " MPF " << this->MPF_Result_Extrapolated << endl; |
118 |
+ |
dout << " Rabs " << this->Rabs_Result_Extrapolated << endl; |
119 |
+ |
} |
120 |
+ |
|
121 |
+ |
|
122 |
|
using namespace ZbData; |
123 |
|
|
124 |
< |
void print_yield(TCut cut) { |
124 |
> |
|
125 |
> |
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* DELETE EVERYTHING BETWEEN THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*// |
126 |
> |
void SpecialCutFlow(string identifier); |
127 |
> |
|
128 |
> |
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* AND THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*// |
129 |
> |
|
130 |
> |
|
131 |
> |
class CutYields{ |
132 |
> |
public: |
133 |
> |
float data; |
134 |
> |
float Zb; |
135 |
> |
float Zc; |
136 |
> |
float Zl; |
137 |
> |
float tt; |
138 |
> |
float SiTo; |
139 |
> |
float Dibosons; |
140 |
> |
float WJets; |
141 |
> |
float Other; |
142 |
> |
|
143 |
> |
CutYields(); |
144 |
> |
}; |
145 |
> |
|
146 |
> |
CutYields::CutYields() { |
147 |
> |
this->data=0; |
148 |
> |
this->Zb=0; |
149 |
> |
this->Zc=0; |
150 |
> |
this->Zl=0; |
151 |
> |
this->tt=0; |
152 |
> |
this->SiTo=0; |
153 |
> |
this->Dibosons=0; |
154 |
> |
this->WJets=0; |
155 |
> |
this->Other=0; |
156 |
> |
} |
157 |
> |
|
158 |
> |
std::ostream &operator<<(std::ostream &ostr, CutYields y) |
159 |
> |
{ |
160 |
> |
return ostr << y.data << ";" << y.Zb << ";" << y.Zc << ";" << y.Zl << ";" << y.tt << ";" << y.SiTo << ";" << y.Dibosons << ";" << y.WJets << ";" << endl; |
161 |
> |
} |
162 |
> |
|
163 |
> |
|
164 |
> |
CutYields print_yield(TCut cut) { |
165 |
> |
|
166 |
> |
CutYields Yield; |
167 |
|
TH1F *data = allsamples.Draw("data", "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,data,luminosity); |
168 |
< |
cout << " Yields for " << (const char*) cut << endl; |
169 |
< |
cout << " data: " << data->Integral() << endl; |
168 |
> |
dout << " Yields for " << (const char*) cut << endl; |
169 |
> |
// dout << " data: " << data->Integral() << endl; |
170 |
> |
|
171 |
> |
Yield.data=data->Integral(); |
172 |
|
THStack mcm = allsamples.DrawStack("mc", "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,mc,luminosity); |
173 |
|
int nhists = mcm.GetHists()->GetEntries(); |
41 |
– |
cout << "Going to loop over " << nhists << " histograms " << endl; |
174 |
|
TFile *test = new TFile("test.root","RECREATE"); |
175 |
|
mcm.Write(); |
176 |
|
test->Close(); |
177 |
|
for (int i = 0; i < nhists; i++) { |
178 |
|
TH1* hist = static_cast<TH1*>(mcm.GetHists()->At(i)); |
179 |
< |
cout << " " << hist->GetName() << ": " << hist->Integral() << endl; |
179 |
> |
string name=hist->GetName(); |
180 |
> |
if(Contains(name,"t_bar_t")) Yield.tt+=hist->Integral(); |
181 |
> |
if(Contains(name,"W_Jets")) Yield.WJets+=hist->Integral(); |
182 |
> |
if(Contains(name,"Single_top")) Yield.SiTo+=hist->Integral(); |
183 |
> |
if(Contains(name,"Dibosons")) Yield.Dibosons+=hist->Integral(); |
184 |
> |
if(Contains(name,"Z_l_")) Yield.Zl+=hist->Integral(); |
185 |
> |
if(Contains(name,"Z_c_")) Yield.Zc+=hist->Integral(); |
186 |
> |
if(Contains(name,"Z_b_")) Yield.Zb+=hist->Integral(); |
187 |
|
} |
188 |
< |
cout << endl << endl; |
188 |
> |
|
189 |
> |
dout << Yield << endl; |
190 |
> |
dout << endl << endl; |
191 |
> |
|
192 |
|
delete data; |
193 |
+ |
CleanLegends(); |
194 |
+ |
DeleteStack(mcm); |
195 |
+ |
|
196 |
+ |
return Yield; |
197 |
|
} |
198 |
|
|
199 |
|
void draw_kin_variable(string variable, TCut cut, int nbins, float min, float max, string xlabel, string saveas, bool dologscale, string speciallabel="") { |
54 |
– |
|
200 |
|
TCanvas *ckin = new TCanvas("ckin","kin variable canvas"); |
201 |
< |
ckin->SetLogy(dologscale); |
201 |
> |
if(dologscale) ckin->SetLogy(1); |
202 |
|
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity); |
203 |
|
datahisto->SetMarkerSize(DataMarkerSize); |
204 |
|
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity); |
205 |
|
if(dologscale) datahisto->SetMaximum(3*datahisto->GetMaximum()); |
206 |
|
else datahisto->SetMaximum(1.5*datahisto->GetMaximum()); |
207 |
< |
TText *speciall; |
208 |
< |
if(speciallabel!="") { |
209 |
< |
speciall = new TText(0.2,0.8,speciallabel.c_str()); |
210 |
< |
speciall->Draw(); |
207 |
> |
|
208 |
> |
float SumMC=0.0; |
209 |
> |
TIter nextH(mcstack.GetHists()); |
210 |
> |
TH1F* h; |
211 |
> |
while ( h = (TH1F*)nextH() ) { |
212 |
> |
SumMC += h->Integral(); |
213 |
|
} |
214 |
+ |
float scale = datahisto->Integral()/SumMC; |
215 |
+ |
|
216 |
+ |
// Re-scale stack to data integral |
217 |
+ |
nextH = TIter(mcstack.GetHists()); |
218 |
+ |
|
219 |
+ |
while ( h = (TH1F*)nextH() ) { |
220 |
+ |
h->Scale(scale); |
221 |
+ |
} |
222 |
+ |
|
223 |
+ |
TText *speciall; |
224 |
|
datahisto->Draw("e1"); |
225 |
|
ckin->Update(); |
226 |
< |
mcstack.Draw("same"); |
226 |
> |
mcstack.Draw("histo,same"); |
227 |
|
datahisto->Draw("same,e1"); |
228 |
|
TLegend *kinleg = allsamples.allbglegend(); |
229 |
+ |
|
230 |
|
kinleg->Draw(); |
231 |
|
|
232 |
|
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1); |
233 |
|
kinpad->cd(); |
234 |
< |
kinpad->SetLogy(dologscale); |
234 |
> |
if(dologscale) kinpad->SetLogy(1); |
235 |
|
datahisto->Draw("e1"); |
236 |
< |
mcstack.Draw("same"); |
236 |
> |
mcstack.Draw("histo,same"); |
237 |
|
datahisto->Draw("same,e1"); |
238 |
|
datahisto->Draw("same,axis"); |
239 |
|
kinleg->Draw(); |
240 |
|
DrawPrelim(); |
241 |
|
saveas="kin/"+saveas; |
242 |
< |
save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas); |
85 |
< |
|
86 |
< |
|
242 |
> |
kinpad->cd(); |
243 |
|
|
244 |
+ |
if(speciallabel!="") { |
245 |
+ |
speciall = write_title(speciallabel); |
246 |
+ |
speciall->SetX(0.18); |
247 |
+ |
speciall->SetTextAlign(11); |
248 |
+ |
speciall->SetTextSize(0.03); |
249 |
+ |
speciall->SetY(0.85); |
250 |
+ |
speciall->Draw(); |
251 |
+ |
} |
252 |
|
|
253 |
< |
ZbData::data_over_mc.push_back(datahisto->Integral()/CollapseStack(mcstack)->Integral()); |
253 |
> |
Save_With_Ratio(datahisto,mcstack,kinpad->cd(),saveas); |
254 |
|
|
255 |
|
datahisto->Delete(); |
256 |
+ |
delete kinleg; |
257 |
|
delete ckin; |
258 |
+ |
CleanLegends(); |
259 |
+ |
DeleteStack(mcstack); |
260 |
|
} |
261 |
+ |
|
262 |
+ |
void print_all_b_yields() { |
263 |
+ |
vector<CutYields> yields; |
264 |
+ |
dout << "Basic selection with a b jet" << endl; |
265 |
+ |
yields.push_back(print_yield(ZplusBsel&&"ZbCHS3010_pfJetGoodNumBtag>0")); |
266 |
+ |
dout << "Leading jet is a b-jet " << endl; |
267 |
+ |
yields.push_back(print_yield(ZplusBsel&&LeadingB)); |
268 |
+ |
dout << "|#eta_{b}|<1.3 " << endl; |
269 |
+ |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB)); |
270 |
+ |
dout << "|#delta#phi(b<Z)|>2.7" << endl; |
271 |
+ |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut)); |
272 |
+ |
dout << "30<ptZ<1000 GeV" << endl; |
273 |
+ |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000")); |
274 |
+ |
dout << "#alpha < 0.35" << endl; |
275 |
+ |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.35")); |
276 |
+ |
dout << "#alpha < 0.3" << endl; |
277 |
+ |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.3")); |
278 |
+ |
/* dout << "#alpha < 0.2" << endl; |
279 |
+ |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.2")); |
280 |
+ |
dout << "#alpha < 0.15" << endl; |
281 |
+ |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.15")); |
282 |
+ |
dout << "#alpha < 0.1" << endl; |
283 |
+ |
yields.push_back(print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000"&&"(ZbCHS3010_alpha)<0.1"));*/ |
284 |
+ |
|
285 |
+ |
for(int iy=0;iy<yields.size();iy++) { |
286 |
+ |
dout << yields[iy] << endl; |
287 |
+ |
} |
288 |
+ |
} |
289 |
+ |
|
290 |
+ |
void DrawEvilCutFlow() { |
291 |
+ |
stringstream MegaCut; |
292 |
|
|
293 |
< |
Value getfrom2Dmap(TH2F *map, int ixbin, int iybin) { |
294 |
< |
Value sum(0,0); |
295 |
< |
for(int iy=1;iy<=iybin;iy++) { |
296 |
< |
sum=sum+Value(map->GetBinContent(ixbin,iy),map->GetBinError(ixbin,iy)); |
297 |
< |
} |
298 |
< |
return sum; |
299 |
< |
} |
293 |
> |
MegaCut << " 1*(" << (const char*) (ZplusBsel&&TCut("ZbCHS3010_pfJetGoodNumBtag>0")) << ")"; |
294 |
> |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB) << ")"; |
295 |
> |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB) << ")"; |
296 |
> |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut) << ")"; |
297 |
> |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000")) << ")"; |
298 |
> |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.3")) << ")"; |
299 |
> |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.2")) << ")"; |
300 |
> |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.15")) << ")"; |
301 |
> |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.1")) << ")"; |
302 |
> |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.05")) << ")"; |
303 |
> |
MegaCut << " "; |
304 |
|
|
305 |
+ |
TCanvas *can = new TCanvas("can","can"); |
306 |
+ |
can->SetLogy(1); |
307 |
+ |
TCut basecut("mll>6||mll<10"); |
308 |
|
|
309 |
< |
void data_mc_agreement_2d() { |
310 |
< |
|
311 |
< |
vector<int> emptyvector; |
312 |
< |
float binX[5]={10,50,100,200,1000}; |
313 |
< |
float binY[5]={0.0,0.1,0.15,0.2,0.3}; |
314 |
< |
vector<float>binningx; |
315 |
< |
vector<float>binningy; |
316 |
< |
binningx.assign(binX,binX+5); |
317 |
< |
binningy.assign(binY,binY+5); |
318 |
< |
|
319 |
< |
TCut cut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut); |
320 |
< |
|
321 |
< |
TCanvas *agrcan = new TCanvas("agrcan","agrcan"); |
322 |
< |
|
323 |
< |
cout << "Drawing 2d for data " << endl; |
324 |
< |
TH2F *alphazptplane_data = allsamples.Draw("alphazptplane_data","alpha:pt",binningx,binningy,"Z p_{T}","#alpha",cut,data,luminosity,emptyvector,false); |
325 |
< |
cout << "Drawing 2d for MC " << endl; |
326 |
< |
TH2F *alphazptplane_mc = allsamples.Draw("alphazptplane_mc", "alpha:pt",binningx,binningy,"Z p_{T}","#alpha",cut,mc, luminosity,emptyvector,false); |
327 |
< |
|
328 |
< |
|
329 |
< |
TFile *f = new TFile("test.root","RECREATE"); |
330 |
< |
alphazptplane_data->Write(); |
331 |
< |
f->Close(); |
332 |
< |
|
333 |
< |
for(int ix=1;ix<binningx.size();ix++) { |
334 |
< |
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"); |
309 |
> |
|
310 |
> |
|
311 |
> |
TLegend *leg = allsamples.allbglegend(); |
312 |
> |
|
313 |
> |
|
314 |
> |
TH1F *data = allsamples.Draw("data", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity); |
315 |
> |
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity); |
316 |
> |
|
317 |
> |
float runningsum=0; |
318 |
> |
for(int i=data->GetNbinsX();i>0;i--) { |
319 |
> |
runningsum+=data->GetBinContent(i); |
320 |
> |
data->SetBinContent(i,runningsum); |
321 |
> |
} |
322 |
> |
|
323 |
> |
float minimum=data->GetMaximum(); |
324 |
> |
|
325 |
> |
TH1F* h; |
326 |
> |
TIter nextOF(mcm.GetHists()); |
327 |
> |
while ( h = (TH1F*)nextOF() ) { |
328 |
> |
float runningsum=0; |
329 |
> |
minimum=data->GetMaximum();//done deliberately at each step so get the minimum of the last (!) contribution |
330 |
> |
for(int i=h->GetNbinsX();i>0;i--) { |
331 |
> |
runningsum+=h->GetBinContent(i); |
332 |
> |
h->SetBinContent(i,runningsum); |
333 |
> |
if(runningsum<minimum&&runningsum>0) minimum=runningsum; |
334 |
> |
} |
335 |
|
} |
336 |
|
|
167 |
– |
delete agrcan; |
337 |
|
|
169 |
– |
} |
338 |
|
|
339 |
< |
void print_all_b_yields() { |
340 |
< |
cout << "Basic selection with a b jet" << endl; |
341 |
< |
print_yield(ZplusBsel&&"Zb30_pfJetGoodNumBtag>0"); |
342 |
< |
cout << "Leading jet is a b-jet " << endl; |
343 |
< |
print_yield(ZplusBsel&&LeadingB); |
344 |
< |
cout << "|#eta_{b}|<1.3 " << endl; |
345 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB); |
346 |
< |
cout << "|#delta#phi(b<Z)|>2.7" << endl; |
347 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut); |
348 |
< |
cout << "10<ptZ<1000 GeV" << endl; |
349 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"); |
350 |
< |
cout << "#alpha < 0.3" << endl; |
351 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.3"); |
352 |
< |
cout << "#alpha < 0.2" << endl; |
353 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.2"); |
354 |
< |
cout << "#alpha < 0.15" << endl; |
355 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.15"); |
356 |
< |
cout << "#alpha < 0.1" << endl; |
357 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.1"); |
358 |
< |
cout << "#alpha < 0.05" << endl; |
359 |
< |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb30_alpha<0.05"); |
360 |
< |
} |
339 |
> |
data->SetMinimum(0.05*minimum); |
340 |
> |
can->cd(1)->SetBottomMargin(0.25); |
341 |
> |
data->GetXaxis()->SetBinLabel(1,"Pre-selection"); |
342 |
> |
data->GetXaxis()->SetBinLabel(2,"Contains b jet"); |
343 |
> |
data->GetXaxis()->SetBinLabel(3,"Leading jet is b-jet"); |
344 |
> |
data->GetXaxis()->SetBinLabel(4,"|#eta_{b}|<1.3 "); |
345 |
> |
data->GetXaxis()->SetBinLabel(5,"|#delta#phi(b,Z)|>2.7"); |
346 |
> |
data->GetXaxis()->SetBinLabel(6,"30<p_{T}^{Z}<1000 GeV"); |
347 |
> |
data->GetXaxis()->SetBinLabel(7,"#alpha < 0.3"); |
348 |
> |
data->GetXaxis()->SetBinLabel(8,"#alpha < 0.2"); |
349 |
> |
data->GetXaxis()->SetBinLabel(9,"#alpha < 0.15"); |
350 |
> |
data->GetXaxis()->SetBinLabel(10,"#alpha < 0.1"); |
351 |
> |
data->GetXaxis()->SetBinLabel(11,"#alpha < 0.05"); |
352 |
> |
data->GetXaxis()->LabelsOption("v"); |
353 |
> |
|
354 |
> |
data->Draw("e1"); |
355 |
> |
mcm.Draw("histo,same"); |
356 |
> |
data->Draw("same,e1,axis"); |
357 |
> |
data->Draw("same,e1"); |
358 |
> |
// data->Draw("same,TEXT"); |
359 |
> |
|
360 |
> |
leg->Draw(); |
361 |
> |
|
362 |
> |
DrawPrelim(); |
363 |
> |
|
364 |
> |
CompleteSave(can,"CutFlow"); |
365 |
> |
CleanLegends(); |
366 |
> |
DeleteStack(mcm); |
367 |
> |
|
368 |
> |
} |
369 |
|
|
370 |
|
void draw_Zb_kin_vars() { |
371 |
< |
draw_kin_variable("Zb30_pfBJetDphiZ",ZplusBsel&&LeadingB,100,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",1); |
372 |
< |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Z p_{T}","Zpt",1); |
373 |
< |
draw_kin_variable("Zb30_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Sub-Leading Jet Pt","Jet2Pt",1); |
374 |
< |
draw_kin_variable("Zb30_pfJetGoodPtlBtag[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",50,0,200,"Leading Jet Pt (B)","LeadingJetPt",1); |
375 |
< |
draw_kin_variable("Zb30_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,2,"#alpha","alpha",1); |
371 |
> |
|
372 |
> |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Z p_{T}","Official/Zpt",0); |
373 |
> |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Z p_{T}","Official/Zpt_ee",1); |
374 |
> |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Z p_{T}","Official/Zpt_mm",1); |
375 |
> |
draw_kin_variable("pt",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Z p_{T}","Official/Zpt__nonBtagged",1); |
376 |
> |
draw_kin_variable("pt",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Z p_{T}","Official/Zpt__nonBtagged_ee",1); |
377 |
> |
draw_kin_variable("pt",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Z p_{T}","Official/Zpt__nonBtagged_mm",1); |
378 |
> |
|
379 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt",1); |
380 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt_ee",1); |
381 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt_mm",1); |
382 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt__nonBtagged",1); |
383 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt__nonBtagged_ee",1); |
384 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt__nonBtagged_mm",1); |
385 |
> |
|
386 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt",1); |
387 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt_ee",1); |
388 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt_mm",1); |
389 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt__nonBtagged",1); |
390 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==0"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt__nonBtagged_ee",1); |
391 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]",ZplusBsel&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&id1==1"),25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt__nonBtagged_mm",1); |
392 |
> |
|
393 |
> |
|
394 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/SubLeadingJetPt_Over_ZPt",1); |
395 |
> |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<50"), 40,0,2,"#alpha","Official/alpha_pt_30_to_50",1); |
396 |
> |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>50&&pt<75"), 40,0,2,"#alpha","Official/alpha_50_to_75",1); |
397 |
> |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>75&&pt<125"), 40,0,2,"#alpha","Official/alpha_pt_75_to_125",1); |
398 |
> |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>125&&pt<1000"),40,0,2,"#alpha","Official/alpha_pt_125_to_1000",1); |
399 |
> |
draw_kin_variable("ZbCHS3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000"),40,0,2,"#alpha","Official/alpha_pt_30_to_1000",1); |
400 |
> |
|
401 |
> |
draw_kin_variable("ZbCHS3010_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&TCut("pt>30&&pt<1000&&pfBJetDphiZ[0]>0"),30,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",0); |
402 |
|
} |
403 |
|
|
404 |
|
void draw_mpf_vars() { |
405 |
< |
ZbData::data_over_mc.clear(); |
406 |
< |
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"); |
407 |
< |
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"); |
408 |
< |
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"); |
409 |
< |
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"); |
410 |
< |
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"); |
411 |
< |
|
412 |
< |
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"); |
413 |
< |
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"); |
414 |
< |
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"); |
415 |
< |
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"); |
214 |
< |
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"); |
405 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.3"), 20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
406 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.2"), 20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
407 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.15"),20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
408 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.1"), 20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
409 |
> |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.05"),20,0.0,2.0,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
410 |
> |
|
411 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.3"), 20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p3", 0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
412 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.2"), 20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p2", 0,"#alpha<0.2, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
413 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.15"),20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p15", 0,"#alpha<0.15, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
414 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.1"), 20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p1", 0,"#alpha<0.1, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
415 |
> |
draw_kin_variable("ZbCHS3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>30&&pt<1000&&ZbCHS3010_alpha<0.05"),20,0.0,2.0,"p_{T} b-jet / p_{T} Z","ptb_over_ptz__mpf_alpha_smaller_0p05",0,"#alpha<0.05, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
416 |
|
} |
417 |
|
|
418 |
< |
Value get_Zb_data_over_mc(string variable, TCut cut) { |
418 |
> |
void make_RooFit(string ContainerName, TH1F *h, float &peak, float &error_peak, string saveas) { |
419 |
> |
TCanvas *fcan = new TCanvas("fcan","fcan"); |
420 |
> |
RooRealVar mpf("mpf","mpf", -5, 5, ""); |
421 |
> |
RooDataHist AllData("AllData", "CMS Real Dataset", mpf , h); |
422 |
> |
|
423 |
> |
RooRealVar fraction("fraction", "fraction", 0.8, 0, 1); |
424 |
> |
RooRealVar mean("mean", "mean", 1, 0, 3); |
425 |
> |
RooRealVar sigma("sigma", "sigma", 1, 0, 5); |
426 |
> |
RooRealVar width("width", "width", 2.4, 0, 5); |
427 |
> |
RooRealVar chevvar1("chevvar1", "chevvar1", 0.2,-1.0, 1.0); |
428 |
> |
RooRealVar chevvar2("chevvar2", "chevvar2", 0.2,-1.0, 1.0); |
429 |
> |
|
430 |
> |
RooVoigtian signal("signal", "signal", mpf, mean, width, sigma); |
431 |
> |
RooChebychev background("background_", "background", mpf, RooArgList(chevvar1, chevvar2)); |
432 |
> |
|
433 |
> |
RooAddPdf pdf("pdf", "pdf", RooArgList(signal, background), fraction); |
434 |
> |
|
435 |
> |
RooFitResult *result = pdf.fitTo(AllData, RooFit::Save()); |
436 |
> |
RooPlot* frame = mpf.frame(RooFit::Bins(30), RooFit::Title("MPF")) ; |
437 |
> |
AllData.plotOn(frame); |
438 |
> |
pdf.plotOn(frame, RooFit::LineColor(kBlue)) ; |
439 |
> |
pdf.plotOn(frame, RooFit::Components(RooArgSet(background)), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)) ; |
440 |
> |
pdf.plotOn(frame, RooFit::Components(RooArgSet(signal)), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)) ; |
441 |
> |
|
442 |
> |
RooRealVar* thePeak = (RooRealVar*) result->floatParsFinal().find("mean"); |
443 |
> |
peak = thePeak->getVal(); |
444 |
> |
error_peak = thePeak->getError(); |
445 |
> |
|
446 |
> |
///******************* just making it beautiful .... |
447 |
> |
RooPlot* frame2 = mpf.frame(RooFit::Bins(30), RooFit::Title("MPF")) ; |
448 |
> |
TH1F *hcopy = (TH1F*)h->Clone("hcopy"); |
449 |
> |
hcopy->Rebin(40); |
450 |
> |
RooDataHist AllRData("AllRData", "CMS Dataset", mpf , hcopy); |
451 |
> |
|
452 |
> |
AllRData.plotOn(frame2); |
453 |
> |
pdf.plotOn(frame2, RooFit::LineColor(kBlue)) ; |
454 |
> |
pdf.plotOn(frame2, RooFit::Components(RooArgSet(background)), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)) ; |
455 |
> |
pdf.plotOn(frame2, RooFit::Components(RooArgSet(signal)), RooFit::LineStyle(kDashed), RooFit::LineColor(kGreen)) ; |
456 |
> |
|
457 |
> |
string saveasFinal = saveas + "_Fit"; |
458 |
> |
fcan->cd() ; gPad->SetLeftMargin(0.15) ; frame->GetYaxis()->SetTitleOffset(1.4) ; frame2->Draw(); |
459 |
> |
|
460 |
> |
if(h->GetName()=="hdata") DrawPrelim(); |
461 |
> |
else DrawMCPrelim(); |
462 |
> |
|
463 |
> |
CompleteSave(fcan, ContainerName+"/Fit/"+saveasFinal); |
464 |
> |
|
465 |
> |
delete hcopy; |
466 |
> |
delete fcan; |
467 |
> |
delete frame; |
468 |
> |
delete thePeak; |
469 |
> |
} |
470 |
> |
|
471 |
> |
Value get_Zb_data_over_mc(string ContainerName, ZbResultContainer &res, string variable, string variable2, TCut cut, string saveas, float pt1, float pt2, float a1, float a2) { |
472 |
|
// write_warning(__FUNCTION__,"Debugging this function, therefore always returning 3.1415+/-1.010101"); return Value(3.1415,1.010101); |
473 |
< |
TH1F *hdata = allsamples.Draw("hdata",variable,1000,0,30, "#alpha [GeV]", "events", cut,data,luminosity); |
474 |
< |
TH1F *hmc = allsamples.Draw("hmc" , variable,1000,0,30, "#alpha [GeV]", "events", cut,mc, luminosity); |
473 |
> |
TCanvas *cn = new TCanvas("cn","cn"); |
474 |
> |
string varname="MPF"; |
475 |
> |
|
476 |
> |
bool DoFit=false; |
477 |
> |
bool UseFit=false; |
478 |
> |
bool DoRooFit=false; |
479 |
> |
|
480 |
> |
|
481 |
> |
if(Contains(variable,"pfJetGood")) varname="R_{abs}"; |
482 |
> |
// TH1F *hdata = allsamples.Draw("hdata",variable,1200,0,30, varname, "events", cut,data,luminosity); |
483 |
> |
// TH1F *hmc = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc, luminosity); |
484 |
> |
TH1F *hdata, hmc; |
485 |
> |
if(!DoRooFit) { |
486 |
> |
hdata = allsamples.Draw("hdata",variable,1200,ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary, varname, "events", cut,data,luminosity); // making it more precise |
487 |
> |
hmc = allsamples.Draw("hmc" , variable,1200,ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary, varname, "events", cut, mc, luminosity); // making it more precise |
488 |
> |
} |
489 |
> |
|
490 |
> |
hmc->SetLineColor(kBlue); |
491 |
|
|
492 |
|
float a=hdata->GetMean(); |
493 |
|
float b=hmc->GetMean(); |
495 |
|
float db=hmc->GetMeanError(); |
496 |
|
float factor = a / b; |
497 |
|
float error = TMath::Sqrt( (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db); |
498 |
+ |
|
499 |
+ |
TF1 *gaus_data = new TF1("gaus_data","gaus",0.7,1.3); |
500 |
+ |
TF1 *gaus_mc = new TF1("gaus_mc","gaus",0.7,1.3); |
501 |
+ |
if(DoFit) { |
502 |
+ |
gaus_data->SetParameter(0,hdata->GetMaximum()); |
503 |
+ |
gaus_data->SetParameter(2,hdata->GetMean()); |
504 |
+ |
gaus_data->SetParameter(1,hdata->GetRMS()); |
505 |
+ |
hdata->Fit(gaus_data); |
506 |
+ |
|
507 |
+ |
gaus_mc->SetParameter(0,hmc->GetMaximum()); |
508 |
+ |
gaus_mc->SetParameter(1,hmc->GetMean()); |
509 |
+ |
gaus_mc->SetParameter(2,hmc->GetRMS()); |
510 |
+ |
hmc->Fit(gaus_mc); |
511 |
+ |
} |
512 |
+ |
if(DoRooFit) { |
513 |
+ |
hdata = allsamples.Draw("hdata",variable,7200,0.0,6.0, varname, "events", cut,data,luminosity); // making it more precise |
514 |
+ |
hmc = allsamples.Draw("hmc" , variable,7200,0.0,6.0, varname, "events", cut, mc, luminosity); // making it more precise |
515 |
+ |
if(hdata->Integral()>10) { |
516 |
+ |
make_RooFit(ContainerName, hdata, a, da, saveas+"_data"); |
517 |
+ |
make_RooFit(ContainerName, hmc, b, db, saveas+"_mc"); |
518 |
+ |
factor = a / b; |
519 |
+ |
error = TMath::Sqrt( (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db); |
520 |
+ |
} else { |
521 |
+ |
factor=NAN;//set to nan |
522 |
+ |
error=NAN;//set to nan |
523 |
+ |
} |
524 |
+ |
} |
525 |
+ |
|
526 |
+ |
cn->cd(); |
527 |
+ |
hdata->Rebin(int(0.05*1200/(ZbData::UpperHistoBoundary-ZbData::LowerHistoBoundary))); |
528 |
+ |
hmc->Rebin(int(0.05*1200/(ZbData::UpperHistoBoundary-ZbData::LowerHistoBoundary))); |
529 |
+ |
hdata->GetYaxis()->SetTitle("events / 0.05"); |
530 |
+ |
hdata->SetMarkerColor(kRed); |
531 |
+ |
if(DoFit) { |
532 |
+ |
gaus_mc->SetLineColor(kBlue); |
533 |
+ |
gaus_data->SetLineColor(kRed); |
534 |
+ |
} |
535 |
+ |
|
536 |
+ |
hdata->GetXaxis()->SetRangeUser(0,2); |
537 |
+ |
hdata->GetYaxis()->SetTitleOffset(1.3); |
538 |
+ |
hdata->Draw("e1"); |
539 |
+ |
|
540 |
+ |
hmc->Scale(hdata->Integral()/hmc->Integral()); |
541 |
+ |
if(hmc->GetMaximum()>hdata->GetMaximum()) hdata->SetMaximum((hmc->GetMaximum()+sqrt((double)hmc->GetMaximum()))*1.2); |
542 |
+ |
|
543 |
+ |
hmc->Draw("histo,same"); |
544 |
+ |
hdata->Draw("e1,same"); |
545 |
+ |
if(DoFit) { |
546 |
+ |
gaus_data->Draw("same"); |
547 |
+ |
gaus_mc->Draw("same"); |
548 |
+ |
} |
549 |
+ |
|
550 |
+ |
stringstream summary; |
551 |
+ |
summary << "#splitline{#bf{" << varname << "}}{#splitline{" << pt1 << " < p_{T}^{Z} < " << pt2 << ", " << a1 << " #leq #alpha < " << a2 << "}{#splitline{data: " << std::setprecision(4) << a << " #pm " << std::setprecision(4) << da << "}{"; |
552 |
+ |
summary << "#splitline{mc: " << std::setprecision(4) << b << " #pm " << std::setprecision(4) << db << "}{#splitline{ratio: " << factor; |
553 |
+ |
summary << " #pm " << error; |
554 |
+ |
if(DoFit) { |
555 |
+ |
summary << "}{#splitline{}{#splitline{data fit: " << std::setprecision(4) << gaus_data->GetParameter(1) << "+/-"; |
556 |
+ |
summary << std::setprecision(4) << gaus_data->GetParError(1) << "}{#splitline{"; |
557 |
+ |
summary << "mc fit:" << std::setprecision(4) << gaus_mc->GetParameter(1) << "#pm" << std::setprecision(4) << gaus_mc->GetParError(1) << "}{ratio: "; |
558 |
+ |
summary << gaus_data->GetParameter(1)/gaus_mc->GetParameter(1) << "#pm" << 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)) ) << "}}}}"; |
559 |
+ |
summary << "}}}}"; |
560 |
+ |
} else { |
561 |
+ |
summary << "}{}}}}}"; |
562 |
+ |
} |
563 |
+ |
|
564 |
+ |
if(UseFit) { |
565 |
+ |
write_error(__FUNCTION__,"Requested using fit result for final result - not implemented yet!"); |
566 |
+ |
assert(0); |
567 |
+ |
} |
568 |
+ |
|
569 |
+ |
|
570 |
+ |
TText *infobox = write_title(summary.str()); |
571 |
+ |
infobox->SetX(0.75); |
572 |
+ |
infobox->SetTextSize(0.03); |
573 |
+ |
infobox->SetY(0.75); |
574 |
+ |
infobox->Draw(); |
575 |
+ |
|
576 |
+ |
|
577 |
+ |
DrawPrelim(); |
578 |
+ |
CompleteSave(cn,ContainerName+"/ResponsePlots/"+saveas); |
579 |
+ |
|
580 |
+ |
res.MPF_Rabs_location.push_back(ZbPointResult(variable,pt1,pt2,a1,a2,Value(a,da),Value(b,db))); |
581 |
+ |
dout << "Data;" << a << ";"<<da<<";MC;"<<b<<";"<<db<<endl; |
582 |
+ |
delete cn; |
583 |
|
delete hdata; |
584 |
|
delete hmc; |
585 |
+ |
|
586 |
|
return Value(factor,error); |
587 |
|
} |
588 |
|
|
589 |
+ |
int nFakes=1; |
590 |
+ |
|
591 |
+ |
float PurityInclusive=0.05; |
592 |
+ |
float PurityLoose=0.20; |
593 |
+ |
float PurityMedium=0.54; |
594 |
+ |
float PurityTight=0.82; |
595 |
+ |
|
596 |
+ |
|
597 |
+ |
void GetPtPointPosition(float AvPos[], const int nptcuts,string AlphaVariable, TCut basecut, float FaceValueToBeTakenAt, float ptcuts[]) { |
598 |
+ |
for(int i=0;i<nptcuts-1;i++) { |
599 |
+ |
stringstream specialcut; |
600 |
+ |
specialcut << "((pt>30&& pt< 1000) && (" << AlphaVariable << "<" << FaceValueToBeTakenAt << "))"; |
601 |
+ |
TH1F *hdata = allsamples.Draw("hada", "pt",100,ptcuts[i],ptcuts[i+1], "MPF", "events", TCut(basecut && specialcut.str().c_str()), data, luminosity); |
602 |
+ |
AvPos[i]=hdata->GetMean(); |
603 |
+ |
dout << AvPos[i] << " : "; |
604 |
+ |
delete hdata; |
605 |
+ |
} |
606 |
+ |
dout << endl; |
607 |
+ |
} |
608 |
+ |
|
609 |
+ |
|
610 |
+ |
void DeterminePurity(TCut basecut, int nptcuts, float ptcuts[], string AlphaVariable, string ContainerName, float FaceValueToBeTakenAt) { |
611 |
+ |
|
612 |
+ |
bool ComputePurity=false; |
613 |
+ |
|
614 |
+ |
if(ContainerName=="inclusive") ComputePurity=true; |
615 |
+ |
if(ContainerName=="loose") ComputePurity=true; |
616 |
+ |
if(ContainerName=="medium") ComputePurity=true; |
617 |
+ |
if(ContainerName=="reference") ComputePurity=true; |
618 |
+ |
|
619 |
+ |
if(!ComputePurity) return; |
620 |
+ |
|
621 |
+ |
stringstream specialcut; |
622 |
+ |
specialcut << "((pt>30&& pt< 1000) && (" << AlphaVariable << "<" << FaceValueToBeTakenAt << "))"; |
623 |
+ |
|
624 |
+ |
THStack mcm = allsamples.DrawStack("mcm" , "mpf",1200,0,30, "MPF", "events", TCut(basecut && specialcut.str().c_str()), mc, luminosity); |
625 |
+ |
int nhists = mcm.GetHists()->GetEntries(); |
626 |
+ |
|
627 |
+ |
float total=0; |
628 |
+ |
float Zb=0; |
629 |
+ |
|
630 |
+ |
for (int i = 0; i < nhists; i++) { |
631 |
+ |
TH1* hist = static_cast<TH1*>(mcm.GetHists()->At(i)); |
632 |
+ |
string name=hist->GetName(); |
633 |
+ |
if(Contains(name,"t_bar_t")) total+=hist->Integral(); |
634 |
+ |
if(Contains(name,"W_Jets")) total+=hist->Integral(); |
635 |
+ |
if(Contains(name,"Single_top")) total+=hist->Integral(); |
636 |
+ |
if(Contains(name,"Dibosons")) total+=hist->Integral(); |
637 |
+ |
if(Contains(name,"Z_l_")) total+=hist->Integral(); |
638 |
+ |
if(Contains(name,"Z_c_")) total+=hist->Integral(); |
639 |
+ |
if(Contains(name,"Z_b_")) { |
640 |
+ |
total+=hist->Integral(); |
641 |
+ |
Zb+=hist->Integral(); |
642 |
+ |
} |
643 |
+ |
} |
644 |
+ |
|
645 |
+ |
float purity=Zb/total; |
646 |
+ |
dout << "Determined a purity of " << 100*purity << " % for the container \"" << ContainerName << "\"" << endl; |
647 |
+ |
|
648 |
+ |
if(ContainerName=="inclusive") PurityInclusive=purity; |
649 |
+ |
if(ContainerName=="loose") PurityLoose=purity; |
650 |
+ |
if(ContainerName=="medium") PurityMedium=purity; |
651 |
+ |
if(ContainerName=="reference") PurityTight=purity; |
652 |
|
|
653 |
+ |
DeleteStack(mcm); |
654 |
+ |
} |
655 |
+ |
|
656 |
+ |
string NiceAlphaPrint(float alpha) { |
657 |
+ |
//get in : 0.3, return 0p3 ... |
658 |
+ |
stringstream res; |
659 |
+ |
res << int(alpha) << "p" << int(100*alpha); |
660 |
+ |
return res.str(); |
661 |
+ |
} |
662 |
|
|
663 |
< |
void new_data_mc_agreement_2d() { |
663 |
> |
ZbResultContainer new_data_mc_agreement_2d(bool gofast, string AlphaVariable, string ContainerName, TCut BTagCut, TCut BTagWgt, float FaceValueToBeTakenAt) { |
664 |
> |
|
665 |
> |
if(gofast) write_info(__FUNCTION__,"Fast mode activated for "+ContainerName); |
666 |
> |
ZbResultContainer results(ContainerName); |
667 |
> |
|
668 |
> |
cutWeight=STDWEIGHT*BTagWgt; |
669 |
> |
LeadingB=BTagCut; |
670 |
> |
|
671 |
> |
|
672 |
|
gStyle->SetOptFit(0); |
673 |
|
TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut); |
674 |
+ |
const int nalphacuts=6; |
675 |
+ |
float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3,0.35}; |
676 |
+ |
|
677 |
|
|
239 |
– |
const int nalphacuts=5; |
240 |
– |
float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3}; |
678 |
|
const int nptcuts=5; |
679 |
< |
float ptcuts[nptcuts]={10,50,100,200,1000}; |
679 |
> |
float ptcuts[nptcuts]={30,50,75,125,1000}; |
680 |
> |
float ptPointPosition[nptcuts]; |
681 |
> |
GetPtPointPosition(ptPointPosition,nptcuts,AlphaVariable,basecut,FaceValueToBeTakenAt,ptcuts); |
682 |
> |
|
683 |
> |
|
684 |
> |
DeterminePurity(basecut, nptcuts,ptcuts, AlphaVariable, ContainerName, FaceValueToBeTakenAt); |
685 |
|
|
686 |
|
float MPF_Results[nalphacuts][nptcuts]; |
687 |
|
float MPF_Errors[nalphacuts][nptcuts]; |
689 |
|
float RABS_Errors[nalphacuts][nptcuts]; |
690 |
|
|
691 |
|
|
692 |
< |
for(int ia=0;ia<nalphacuts;ia++) { |
692 |
> |
for(int ia=0;ia<nalphacuts && !gofast;ia++) { |
693 |
|
for(int ipt=0;ipt<nptcuts-1;ipt++) { |
694 |
|
stringstream specialcut; |
695 |
< |
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (alpha<" << alphacuts[ia] << "))"; |
696 |
< |
Value MPF_data_over_mc = get_Zb_data_over_mc("mpf",TCut(basecut && specialcut.str().c_str())); |
697 |
< |
Value RABS_data_over_mc = get_Zb_data_over_mc("Zb30_pfJetGoodPt[0]/pt",TCut(basecut && specialcut.str().c_str())); |
695 |
> |
float alow,ahigh; |
696 |
> |
if(ia>0) { |
697 |
> |
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (" << AlphaVariable << "<" << alphacuts[ia] << " && " << AlphaVariable << ">" << alphacuts[ia-1] << "))"; |
698 |
> |
alow=alphacuts[ia-1]; |
699 |
> |
ahigh=alphacuts[ia]; |
700 |
> |
} else { |
701 |
> |
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (" << AlphaVariable << "<" << alphacuts[ia] << "))"; |
702 |
> |
alow=0; |
703 |
> |
ahigh=alphacuts[ia]; |
704 |
> |
} |
705 |
> |
dout << specialcut.str() << endl; |
706 |
> |
Value MPF_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(NiceAlphaPrint(alphacuts[ia])), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh); |
707 |
> |
Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"ZbCHS3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(NiceAlphaPrint(alphacuts[ia])), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh); |
708 |
|
|
709 |
|
MPF_Results[ia][ipt]=MPF_data_over_mc.getValue(); |
710 |
|
MPF_Errors[ia][ipt]=MPF_data_over_mc.getError(); |
712 |
|
RABS_Results[ia][ipt]=RABS_data_over_mc.getValue(); |
713 |
|
RABS_Errors[ia][ipt]=RABS_data_over_mc.getError(); |
714 |
|
|
715 |
< |
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; |
715 |
> |
dout << "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; |
716 |
|
} |
717 |
|
} |
718 |
|
|
720 |
|
float RABS_ExtraPolatedResults[nptcuts]; |
721 |
|
|
722 |
|
TCanvas *can = new TCanvas("can"); |
723 |
+ |
can->cd(1)->SetLeftMargin(0.15); |
724 |
|
|
725 |
|
TGraphErrors *MPF_FinalGraph = new TGraphErrors(); |
726 |
|
TGraphErrors *RABS_FinalGraph = new TGraphErrors(); |
727 |
+ |
TGraphErrors *MPF_FaceValueAtPoint3 = new TGraphErrors(); |
728 |
+ |
TGraphErrors *RABS_FaceValueAtPoint3 = new TGraphErrors(); |
729 |
|
|
730 |
|
for(int ipt=0;ipt<nptcuts-1;ipt++) { |
731 |
|
|
732 |
|
stringstream filename; |
733 |
|
filename << "Extrapolation/Zplusb_data_over_mc___" << ptcuts[ipt] << "_to_" << ptcuts[ipt+1]; |
734 |
< |
cout << "Going to create histo for " << filename.str() << endl; |
734 |
> |
dout << "Going to create histo for " << filename.str() << endl; |
735 |
|
TGraphErrors *mpf_gr =new TGraphErrors(); |
736 |
|
TGraphErrors *rabs_gr =new TGraphErrors(); |
282 |
– |
for(int ia=0;ia<nalphacuts;ia++) { |
283 |
– |
mpf_gr->SetPoint(ia,alphacuts[ia],MPF_Results[ia][ipt]); |
284 |
– |
mpf_gr->SetPointError(ia,0,MPF_Errors[ia][ipt]); |
285 |
– |
rabs_gr->SetPoint(ia,alphacuts[ia],RABS_Results[ia][ipt]); |
286 |
– |
rabs_gr->SetPointError(ia,0,RABS_Errors[ia][ipt]); |
287 |
– |
} |
288 |
– |
|
289 |
– |
mpf_gr->SetMarkerStyle(21); |
290 |
– |
mpf_gr->SetMarkerColor(kBlue); |
291 |
– |
mpf_gr->Draw("AP"); |
292 |
– |
mpf_gr->Fit("pol1","QE"); // quiet, use minos |
293 |
– |
mpf_gr->GetXaxis()->SetTitle("#alpha"); |
294 |
– |
mpf_gr->GetXaxis()->CenterTitle(); |
295 |
– |
mpf_gr->GetYaxis()->SetTitle("data/mc"); |
296 |
– |
mpf_gr->GetYaxis()->CenterTitle(); |
297 |
– |
TF1 *mpf_pol=(TF1*)mpf_gr->GetFunction("pol1"); |
298 |
– |
float mpf_a=mpf_pol->GetParameter(0); |
299 |
– |
float mpf_b=mpf_pol->GetParameter(1); |
300 |
– |
MPF_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),mpf_a); |
301 |
– |
MPF_FinalGraph->SetPointError(ipt,0,mpf_pol->GetParError(0)); |
302 |
– |
|
303 |
– |
MPF_ExtraPolatedResults[ipt]=mpf_a; |
304 |
– |
|
305 |
– |
stringstream mpf_info; |
306 |
– |
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() << "}"; |
307 |
– |
|
308 |
– |
TText *mpf_mark = write_title(mpf_info.str()); |
309 |
– |
mpf_mark->SetX(0.75); |
310 |
– |
mpf_mark->SetTextSize(0.03); |
311 |
– |
mpf_mark->SetY(0.75); |
312 |
– |
mpf_mark->Draw(); |
737 |
|
|
738 |
< |
string filenamebkp=filename.str(); |
739 |
< |
filename << "__MPF"; |
740 |
< |
DrawPrelim(); |
741 |
< |
CompleteSave(can,filename.str()); |
742 |
< |
cout << "MPF : " << mpf_a << " + " << mpf_b << " * alpha " << endl; |
738 |
> |
int rabs_counter=0; |
739 |
> |
int mpf_counter=0; |
740 |
> |
|
741 |
> |
for(int ia=0;ia<nalphacuts && !gofast;ia++) { |
742 |
> |
dout << "Setting a point for an alpha cut at " << alphacuts[ia] << " with value " << MPF_Results[ia][ipt] << " (MPF) and " << RABS_Results[ia][ipt] << " (RABS)" << endl; |
743 |
> |
if(MPF_Results[ia][ipt]==MPF_Results[ia][ipt] && MPF_Errors[ia][ipt]==MPF_Errors[ia][ipt]) { // remove nan's |
744 |
> |
mpf_gr->SetPoint(mpf_counter,alphacuts[ia],MPF_Results[ia][ipt]); |
745 |
> |
mpf_gr->SetPointError(mpf_counter,0,MPF_Errors[ia][ipt]); |
746 |
> |
mpf_counter++; |
747 |
> |
} else { |
748 |
> |
dout << "Detected BS for MPF method (bin ignored) : " << endl; |
749 |
> |
dout << " alpha: " << alphacuts[ia] << " , pt range: " << ptcuts[ipt] << " < pt < " << ptcuts[ipt+1] << endl; |
750 |
> |
dout << " value (MPF) : " << MPF_Results[ia][ipt] << " +/- " << MPF_Errors[ia][ipt] << endl; |
751 |
> |
} |
752 |
> |
if(RABS_Results[ia][ipt]==RABS_Results[ia][ipt] && RABS_Errors[ia][ipt]==RABS_Errors[ia][ipt]) { |
753 |
> |
rabs_gr->SetPoint(rabs_counter,alphacuts[ia],RABS_Results[ia][ipt]); |
754 |
> |
rabs_gr->SetPointError(rabs_counter,0,RABS_Errors[ia][ipt]); |
755 |
> |
rabs_counter++; |
756 |
> |
} else { |
757 |
> |
dout << "Detected BS for RABS method (bin ignored) : " << endl; |
758 |
> |
dout << " alpha: " << alphacuts[ia] << " , pt range: " << ptcuts[ipt] << " < pt < " << ptcuts[ipt+1] << endl; |
759 |
> |
dout << " value (RABS) : " << RABS_Results[ia][ipt] << " +/- " << RABS_Errors[ia][ipt] << endl; |
760 |
> |
} |
761 |
> |
} |
762 |
|
|
763 |
< |
filename.str(""); |
763 |
> |
stringstream specialcut; |
764 |
> |
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (" << AlphaVariable << "<" << FaceValueToBeTakenAt << "))"; |
765 |
> |
Value MPF_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__INCLUSIVEalpha_"+any2string(FaceValueToBeTakenAt),ptcuts[ipt],ptcuts[ipt+1],0,FaceValueToBeTakenAt); |
766 |
> |
Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"ZbCHS3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__INCLUSIVEalpha_"+any2string(FaceValueToBeTakenAt),ptcuts[ipt],ptcuts[ipt+1],0,FaceValueToBeTakenAt); |
767 |
> |
dout << "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; |
768 |
> |
MPF_FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1])/2,MPF_data_over_mc.getValue()); |
769 |
> |
MPF_FaceValueAtPoint3->SetPointError(ipt,0,MPF_data_over_mc.getError()); |
770 |
> |
RABS_FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1])/2,RABS_data_over_mc.getValue()); |
771 |
> |
RABS_FaceValueAtPoint3->SetPointError(ipt,0,RABS_data_over_mc.getError()); |
772 |
|
|
322 |
– |
rabs_gr->SetMarkerStyle(21); |
323 |
– |
rabs_gr->SetMarkerColor(kBlue); |
324 |
– |
rabs_gr->Fit("pol1","QE"); // quiet, use minos |
325 |
– |
rabs_gr->Draw("AP"); |
326 |
– |
rabs_gr->GetXaxis()->SetTitle("#alpha"); |
327 |
– |
rabs_gr->GetXaxis()->CenterTitle(); |
328 |
– |
rabs_gr->GetYaxis()->SetTitle("data/mc"); |
329 |
– |
rabs_gr->GetYaxis()->CenterTitle(); |
773 |
|
|
774 |
< |
TF1 *rabs_pol=(TF1*)rabs_gr->GetFunction("pol1"); |
332 |
< |
float rabs_a=rabs_pol->GetParameter(0); |
333 |
< |
float rabs_b=rabs_pol->GetParameter(1); |
334 |
< |
RABS_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),rabs_a); |
335 |
< |
RABS_FinalGraph->SetPointError(ipt,0,rabs_pol->GetParError(0)); |
774 |
> |
TH1D *mpf_band, *rabs_band; |
775 |
|
|
776 |
< |
cout << "!+!+!+!+!+!+!+!+!+ Just added a point to the final plot : " << rabs_a << " +/- " << rabs_pol->GetParError(0) << endl; |
776 |
> |
if(!gofast) { |
777 |
> |
can->cd(); |
778 |
> |
mpf_gr->SetMarkerStyle(21); |
779 |
> |
mpf_gr->SetMarkerColor(kBlue); |
780 |
> |
mpf_gr->Draw("AP"); |
781 |
> |
|
782 |
> |
TF1 *mpf_pol = new TF1("mpf_pol","[0]+[1]*x",ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary); |
783 |
> |
|
784 |
> |
mpf_gr->Fit(mpf_pol,"E"); // better error estimation using MINOS (E), quiet (Q) and using loglikelihood method |
785 |
> |
mpf_gr->GetXaxis()->SetTitle("#alpha"); |
786 |
> |
mpf_gr->GetXaxis()->CenterTitle(); |
787 |
> |
mpf_gr->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
788 |
> |
mpf_gr->GetYaxis()->CenterTitle(); |
789 |
> |
//TF1 *mpf_pol=(TF1*)mpf_gr->GetFunction("pol1"); |
790 |
> |
mpf_band = getBand(mpf_pol,"MPF_band"); |
791 |
> |
mpf_pol->SetLineWidth(0); |
792 |
> |
TF1 *mpf_pol_complete = new TF1("mpf_pol_complete","[0]+[1]*x"); |
793 |
> |
mpf_pol_complete->SetParameters(mpf_pol->GetParameters()); |
794 |
> |
mpf_pol_complete->SetLineWidth(1); |
795 |
> |
mpf_pol_complete->SetLineColor(kBlue); |
796 |
> |
|
797 |
> |
float min,max; |
798 |
> |
FindMinMax(mpf_gr,min,max); |
799 |
> |
TH1F *histo = new TH1F("histo","histo",1,0,0.4); |
800 |
> |
histo->GetXaxis()->SetTitle("#alpha"); |
801 |
> |
histo->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
802 |
> |
histo->GetXaxis()->CenterTitle(); |
803 |
> |
histo->GetYaxis()->CenterTitle(); |
804 |
> |
histo->GetYaxis()->SetTitleOffset(1.3); |
805 |
> |
histo->SetStats(0); |
806 |
> |
histo->GetXaxis()->SetRangeUser(0,0.4); |
807 |
> |
histo->GetYaxis()->SetRangeUser(min,max); |
808 |
> |
mpf_gr->GetYaxis()->SetRangeUser(min,max); |
809 |
> |
|
810 |
> |
//TPolyLine *mpf_fit_uncert = GetFitUncertaintyShape(mpf_gr, "pol1", min, max,0.0,0.4); |
811 |
> |
|
812 |
> |
mpf_pol->SetLineColor(TColor::GetColor("#0101DF")); |
813 |
> |
//mpf_fit_uncert->SetFillColor(TColor::GetColor("#A2A2FA")); |
814 |
> |
mpf_band->SetFillColor(TColor::GetColor("#A2A2FA")); |
815 |
> |
histo->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
816 |
> |
histo->Draw(); |
817 |
> |
//mpf_fit_uncert->Draw("F"); |
818 |
> |
//mpf_fit_uncert->Draw(""); |
819 |
> |
mpf_gr->Draw("P"); |
820 |
> |
mpf_band->Draw("C E3 SAME"); |
821 |
> |
mpf_gr->Draw("P"); |
822 |
> |
mpf_pol_complete->Draw("same"); |
823 |
> |
|
824 |
> |
float mpf_a=mpf_pol->GetParameter(0); |
825 |
> |
float mpf_b=mpf_pol->GetParameter(1); |
826 |
> |
MPF_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),mpf_a); |
827 |
> |
MPF_FinalGraph->SetPointError(ipt,0,mpf_pol->GetParError(0)); |
828 |
> |
|
829 |
> |
MPF_ExtraPolatedResults[ipt]=mpf_a; |
830 |
> |
|
831 |
> |
stringstream mpf_info; |
832 |
> |
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() << "}"; |
833 |
> |
|
834 |
> |
TText *mpf_mark = write_title(mpf_info.str()); |
835 |
> |
mpf_mark->SetX(0.75); |
836 |
> |
mpf_mark->SetTextSize(0.03); |
837 |
> |
mpf_mark->SetY(0.75); |
838 |
> |
mpf_mark->Draw(); |
839 |
> |
|
840 |
> |
string filenamebkp=filename.str(); |
841 |
> |
filename << "__MPF"; |
842 |
> |
DrawPrelim(); |
843 |
> |
CompleteSave(can,ContainerName+"/"+filename.str()); |
844 |
> |
dout << "MPF : " << mpf_a << " + " << mpf_b << " * alpha " << endl; |
845 |
> |
|
846 |
> |
filename.str(""); |
847 |
> |
|
848 |
> |
TF1 *rabs_pol = new TF1("rabs_pol","[0]+[1]*x",ZbData::LowerHistoBoundary,ZbData::UpperHistoBoundary); |
849 |
> |
rabs_gr->SetMarkerStyle(21); |
850 |
> |
rabs_gr->SetMarkerColor(kRed); |
851 |
> |
rabs_gr->Draw("AP"); |
852 |
> |
//rabs_gr->Fit("pol1","E"); |
853 |
> |
rabs_gr->Fit(rabs_pol,"E"); |
854 |
> |
rabs_band = getBand(rabs_pol,"Rabs_band"); |
855 |
> |
|
856 |
> |
|
857 |
> |
rabs_gr->GetXaxis()->SetTitle("#alpha"); |
858 |
> |
rabs_gr->GetXaxis()->CenterTitle(); |
859 |
> |
rabs_gr->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}"); |
860 |
> |
rabs_gr->GetYaxis()->CenterTitle(); |
861 |
> |
//TF1 *rabs_pol=(TF1*)rabs_gr->GetFunction("pol1"); |
862 |
> |
rabs_pol->SetLineWidth(0); |
863 |
> |
TF1 *rabs_pol_complete = new TF1("rabs_pol_complete","[0]+[1]*x"); |
864 |
> |
rabs_pol_complete->SetParameters(rabs_pol->GetParameters()); |
865 |
> |
rabs_pol_complete->SetLineColor(kRed); |
866 |
> |
rabs_pol_complete->SetLineWidth(1); |
867 |
> |
FindMinMax(rabs_gr,min,max); |
868 |
> |
rabs_gr->GetYaxis()->SetRangeUser(min,max); |
869 |
> |
histo->GetYaxis()->SetRangeUser(min,max); |
870 |
> |
//TPolyLine *rabs_fit_uncert = GetFitUncertaintyShape(rabs_gr, "pol1", min, max,0.0,0.4); |
871 |
> |
rabs_pol->SetLineColor(TColor::GetColor("#F99C9C")); |
872 |
> |
rabs_pol->SetFillColor(TColor::GetColor("#F99C9C")); |
873 |
> |
rabs_band->SetLineColor(TColor::GetColor("#F99C9C")); |
874 |
> |
rabs_band->SetFillColor(TColor::GetColor("#F99C9C")); |
875 |
> |
//rabs_fit_uncert->SetLineColor(TColor::GetColor("#F99C9C")); |
876 |
> |
//rabs_fit_uncert->SetFillColor(TColor::GetColor("#F99C9C")); |
877 |
> |
histo->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}"); |
878 |
> |
histo->Draw(); |
879 |
> |
rabs_band->Draw("C E3 SAME"); |
880 |
> |
//rabs_fit_uncert->Draw("F"); |
881 |
> |
//rabs_fit_uncert->Draw(""); |
882 |
> |
rabs_gr->Draw("P"); |
883 |
> |
rabs_pol_complete->Draw("same"); |
884 |
> |
|
885 |
> |
float rabs_a=rabs_pol->GetParameter(0); |
886 |
> |
float rabs_b=rabs_pol->GetParameter(1); |
887 |
> |
RABS_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),rabs_a); |
888 |
> |
RABS_FinalGraph->SetPointError(ipt,0,rabs_pol->GetParError(0)); |
889 |
> |
|
890 |
> |
dout << "!+!+!+!+!+!+!+!+!+ Just added a point to the final plot : " << rabs_a << " +/- " << rabs_pol->GetParError(0) << endl; |
891 |
> |
|
892 |
> |
stringstream rabs_info; |
893 |
> |
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() << "}"; |
894 |
> |
TText *rabs_mark = write_title(rabs_info.str()); |
895 |
> |
rabs_mark->SetX(0.75); |
896 |
> |
rabs_mark->SetTextSize(0.03); |
897 |
> |
rabs_mark->SetY(0.75); |
898 |
> |
rabs_mark->Draw(); |
899 |
> |
|
900 |
> |
RABS_ExtraPolatedResults[ipt]=rabs_a; |
901 |
> |
filename << filenamebkp << "__RABS"; |
902 |
> |
DrawPrelim(); |
903 |
> |
CompleteSave(can,ContainerName+"/"+filename.str()); |
904 |
> |
dout << "RABS : " << rabs_a << " + " << rabs_b << " * alpha " << endl; |
905 |
> |
} |
906 |
> |
} |
907 |
> |
|
908 |
> |
float MPFResult; |
909 |
> |
float MPFResultError; |
910 |
> |
|
911 |
> |
float RabsResult; |
912 |
> |
float RabsResultError; |
913 |
> |
|
914 |
> |
if(!gofast) { |
915 |
> |
MPF_FinalGraph->SetMarkerStyle(21); |
916 |
> |
MPF_FinalGraph->SetMarkerColor(kBlue); |
917 |
> |
MPF_FinalGraph->Fit("pol0",""); // quiet, use minos |
918 |
|
|
919 |
+ |
TF1 *mpf_pol0=(TF1*)MPF_FinalGraph->GetFunction("pol0"); |
920 |
+ |
TF1 *mpf_pol0_complete = new TF1("mpf_pol0_complete","[0]+[1]*x"); |
921 |
+ |
mpf_pol0_complete->SetLineWidth(1); |
922 |
+ |
mpf_pol0_complete->SetLineColor(kBlue); |
923 |
+ |
mpf_pol0->SetLineColor(kBlue); |
924 |
+ |
MPF_FinalGraph->Draw("AP"); |
925 |
+ |
MPF_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}"); |
926 |
+ |
MPF_FinalGraph->GetXaxis()->CenterTitle(); |
927 |
+ |
MPF_FinalGraph->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
928 |
+ |
MPF_FinalGraph->GetYaxis()->CenterTitle(); |
929 |
+ |
MPF_FinalGraph->Draw("AP"); |
930 |
+ |
mpf_pol0_complete->Draw("same"); |
931 |
|
|
932 |
< |
stringstream rabs_info; |
933 |
< |
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() << "}"; |
934 |
< |
TText *rabs_mark = write_title(rabs_info.str()); |
935 |
< |
rabs_mark->SetX(0.75); |
936 |
< |
rabs_mark->SetTextSize(0.03); |
937 |
< |
rabs_mark->SetY(0.75); |
938 |
< |
rabs_mark->Draw(); |
932 |
> |
stringstream mpf_result; |
933 |
> |
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)}"; |
934 |
> |
TText *rmpf_final_mark = write_title(mpf_result.str()); |
935 |
> |
rmpf_final_mark->SetX(0.75); |
936 |
> |
rmpf_final_mark->SetY(0.75); |
937 |
> |
rmpf_final_mark->SetTextSize(0.03); |
938 |
> |
rmpf_final_mark->Draw(); |
939 |
> |
DrawPrelim(); |
940 |
> |
MPFResult=1/mpf_pol0->GetParameter(0); |
941 |
> |
MPFResultError=mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0)); |
942 |
|
|
943 |
+ |
stringstream filename2; |
944 |
+ |
filename2 << "Extrapolation/FINAL_RESULT_MPF"; |
945 |
+ |
CompleteSave(can,ContainerName+"/"+filename2.str()); |
946 |
|
|
947 |
< |
|
948 |
< |
RABS_ExtraPolatedResults[ipt]=rabs_a; |
949 |
< |
filename << filenamebkp << "__RABS"; |
947 |
> |
RABS_FinalGraph->SetMarkerStyle(21); |
948 |
> |
RABS_FinalGraph->SetMarkerStyle(21); |
949 |
> |
RABS_FinalGraph->SetMarkerColor(kRed); |
950 |
> |
RABS_FinalGraph->Fit("pol0","QE"); // quiet, use minos |
951 |
> |
RABS_FinalGraph->Draw("AP"); |
952 |
> |
RABS_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}"); |
953 |
> |
RABS_FinalGraph->GetXaxis()->CenterTitle(); |
954 |
> |
RABS_FinalGraph->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}"); |
955 |
> |
RABS_FinalGraph->GetYaxis()->CenterTitle(); |
956 |
> |
RABS_FinalGraph->Draw("AP"); |
957 |
> |
TF1 *rabs_pol0=(TF1*)RABS_FinalGraph->GetFunction("pol0"); |
958 |
> |
stringstream rabs_result; |
959 |
> |
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})}";; |
960 |
> |
TText *rabs_final_mark = write_title(rabs_result.str()); |
961 |
> |
rabs_final_mark->SetX(0.75); |
962 |
> |
rabs_final_mark->SetY(0.75); |
963 |
> |
rabs_final_mark->SetTextSize(0.03); |
964 |
> |
rabs_final_mark->Draw(); |
965 |
|
DrawPrelim(); |
966 |
< |
CompleteSave(can,filename.str()); |
967 |
< |
cout << "RABS : " << rabs_a << " + " << rabs_b << " * alpha " << endl; |
966 |
> |
|
967 |
> |
RabsResult=1/rabs_pol0->GetParameter(0); |
968 |
> |
RabsResultError=rabs_pol0->GetParError(0)/(rabs_pol0->GetParameter(0)*rabs_pol0->GetParameter(0)); |
969 |
> |
|
970 |
> |
filename2.str(""); |
971 |
> |
filename2 << "Extrapolation/FINAL_RESULT_RABS"; |
972 |
> |
CompleteSave(can,ContainerName+"/"+filename2.str()); |
973 |
|
} |
974 |
< |
|
975 |
< |
MPF_FinalGraph->SetMarkerStyle(21); |
976 |
< |
MPF_FinalGraph->SetMarkerColor(kRed); |
977 |
< |
MPF_FinalGraph->Fit("pol0","QE"); // quiet, use minos |
978 |
< |
|
979 |
< |
TF1 *mpf_pol0=(TF1*)MPF_FinalGraph->GetFunction("pol0"); |
980 |
< |
MPF_FinalGraph->Draw("AP"); |
981 |
< |
MPF_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}"); |
982 |
< |
MPF_FinalGraph->GetXaxis()->CenterTitle(); |
983 |
< |
MPF_FinalGraph->GetYaxis()->SetTitle("data/mc"); |
984 |
< |
MPF_FinalGraph->GetYaxis()->CenterTitle(); |
985 |
< |
MPF_FinalGraph->Draw("AP"); |
986 |
< |
|
987 |
< |
stringstream mpf_result; |
988 |
< |
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)}"; |
989 |
< |
TText *rmpf_final_mark = write_title(mpf_result.str()); |
990 |
< |
rmpf_final_mark->SetX(0.75); |
991 |
< |
rmpf_final_mark->SetY(0.75); |
992 |
< |
rmpf_final_mark->SetTextSize(0.03); |
993 |
< |
rmpf_final_mark->Draw(); |
974 |
> |
|
975 |
> |
can->cd(); |
976 |
> |
MPF_FaceValueAtPoint3->SetMarkerStyle(21); |
977 |
> |
MPF_FaceValueAtPoint3->SetMarkerColor(kBlue); |
978 |
> |
MPF_FaceValueAtPoint3->Fit("pol0","QE"); // quiet, use minos |
979 |
> |
MPF_FaceValueAtPoint3->Draw("AP"); |
980 |
> |
MPF_FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}"); |
981 |
> |
MPF_FaceValueAtPoint3->GetXaxis()->CenterTitle(); |
982 |
> |
MPF_FaceValueAtPoint3->GetYaxis()->SetTitle(((string)"<MPF>__{data}/<MPF>_{mc} for #alpha<"+any2string(FaceValueToBeTakenAt)).c_str()); |
983 |
> |
MPF_FaceValueAtPoint3->GetYaxis()->CenterTitle(); |
984 |
> |
MPF_FaceValueAtPoint3->Draw("AP"); |
985 |
> |
TF1 *faceval_pol0=(TF1*)MPF_FaceValueAtPoint3->GetFunction("pol0"); |
986 |
> |
faceval_pol0->SetLineColor(kBlue); |
987 |
> |
faceval_pol0->SetLineWidth(1); |
988 |
> |
faceval_pol0->Draw("same"); |
989 |
> |
TF1 *faceval_pol0_complete = new TF1("faceval_pol0_complete","[0]+[1]*x"); |
990 |
> |
faceval_pol0_complete->SetParameters(faceval_pol0->GetParameters()); |
991 |
> |
stringstream faceval_result; |
992 |
> |
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<" << FaceValueToBeTakenAt << ")}";; |
993 |
> |
TText *faceval_final_mark = write_title(faceval_result.str()); |
994 |
> |
faceval_final_mark->SetX(0.75); |
995 |
> |
faceval_final_mark->SetY(0.75); |
996 |
> |
faceval_final_mark->SetTextSize(0.03); |
997 |
> |
faceval_final_mark->Draw(); |
998 |
|
DrawPrelim(); |
999 |
|
|
1000 |
< |
stringstream filename2; |
1001 |
< |
filename2 << "Extrapolation/FINAL_RESULT_MPF"; |
380 |
< |
CompleteSave(can,filename2.str()); |
1000 |
> |
float FaceValResult=1/faceval_pol0->GetParameter(0); |
1001 |
> |
float FaceValResultError=faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0)); |
1002 |
|
|
1003 |
+ |
stringstream filename2; |
1004 |
+ |
filename2.str(""); |
1005 |
+ |
filename2 << "Extrapolation/FINAL_RESULT_MPF_FaceValp3"; |
1006 |
+ |
CompleteSave(can,ContainerName+"/"+filename2.str()); |
1007 |
|
|
1008 |
< |
RABS_FinalGraph->SetMarkerStyle(21); |
1009 |
< |
RABS_FinalGraph->SetMarkerStyle(21); |
1010 |
< |
RABS_FinalGraph->SetMarkerColor(kRed); |
1011 |
< |
RABS_FinalGraph->Fit("pol0","QE"); // quiet, use minos |
1012 |
< |
RABS_FinalGraph->Draw("AP"); |
1013 |
< |
RABS_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}"); |
1014 |
< |
RABS_FinalGraph->GetXaxis()->CenterTitle(); |
1015 |
< |
RABS_FinalGraph->GetYaxis()->SetTitle("data/mc"); |
1016 |
< |
RABS_FinalGraph->GetYaxis()->CenterTitle(); |
1017 |
< |
RABS_FinalGraph->Draw("AP"); |
1018 |
< |
TF1 *rabs_pol0=(TF1*)RABS_FinalGraph->GetFunction("pol0"); |
1019 |
< |
stringstream rabs_result; |
1020 |
< |
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})}";; |
1021 |
< |
TText *rabs_final_mark = write_title(rabs_result.str()); |
1022 |
< |
rabs_final_mark->SetX(0.75); |
1023 |
< |
rabs_final_mark->SetY(0.75); |
1024 |
< |
rabs_final_mark->SetTextSize(0.03); |
1025 |
< |
rabs_final_mark->Draw(); |
1008 |
> |
can->cd(); |
1009 |
> |
RABS_FaceValueAtPoint3->SetMarkerStyle(21); |
1010 |
> |
RABS_FaceValueAtPoint3->SetMarkerColor(kRed); |
1011 |
> |
RABS_FaceValueAtPoint3->Fit("pol0","QE"); // quiet, use minos |
1012 |
> |
RABS_FaceValueAtPoint3->Draw("AP"); |
1013 |
> |
RABS_FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}"); |
1014 |
> |
RABS_FaceValueAtPoint3->GetXaxis()->CenterTitle(); |
1015 |
> |
RABS_FaceValueAtPoint3->GetYaxis()->SetTitle(((string)"<R_{abs}>_{data}/<R_{abs}>_{mc} for #alpha<"+any2string(FaceValueToBeTakenAt)).c_str()); |
1016 |
> |
RABS_FaceValueAtPoint3->GetYaxis()->CenterTitle(); |
1017 |
> |
RABS_FaceValueAtPoint3->Draw("AP"); |
1018 |
> |
TF1 *faceval_pol0RABS=(TF1*)RABS_FaceValueAtPoint3->GetFunction("pol0"); |
1019 |
> |
TF1 *faceval_pol0RABS_complete = new TF1("faceval_pol0_complete","[0]+[1]*x"); |
1020 |
> |
faceval_pol0RABS_complete->SetParameters(faceval_pol0RABS->GetParameters()); |
1021 |
> |
faceval_pol0RABS->SetLineWidth(1); |
1022 |
> |
faceval_pol0RABS->SetLineColor(kRed); |
1023 |
> |
faceval_pol0RABS_complete->Draw("same"); |
1024 |
> |
stringstream RABSfaceval_result; |
1025 |
> |
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<" << FaceValueToBeTakenAt << ")}";; |
1026 |
> |
TText *RABSfaceval_final_mark = write_title(RABSfaceval_result.str()); |
1027 |
> |
RABSfaceval_final_mark->SetX(0.75); |
1028 |
> |
RABSfaceval_final_mark->SetY(0.75); |
1029 |
> |
RABSfaceval_final_mark->SetTextSize(0.03); |
1030 |
> |
RABSfaceval_final_mark->Draw(); |
1031 |
|
DrawPrelim(); |
1032 |
|
|
1033 |
+ |
float RABSFaceValResult=1/faceval_pol0RABS->GetParameter(0); |
1034 |
+ |
float RABSFaceValResultError=faceval_pol0RABS->GetParError(0)/(faceval_pol0RABS->GetParameter(0)*faceval_pol0RABS->GetParameter(0)); |
1035 |
+ |
|
1036 |
|
filename2.str(""); |
1037 |
< |
filename2 << "Extrapolation/FINAL_RESULT_RABS"; |
1038 |
< |
CompleteSave(can,filename2.str()); |
1037 |
> |
filename2 << "Extrapolation/FINAL_RESULT_RABS_FaceValp3"; |
1038 |
> |
CompleteSave(can,ContainerName+"/"+filename2.str()); |
1039 |
> |
|
1040 |
> |
dout << "FINAL RESULTS: " << endl; |
1041 |
> |
if(!gofast) dout << "MPF : " << MPFResult << " +/- " << MPFResultError << endl; |
1042 |
> |
if(!gofast) dout << "Rabs: " << RabsResult << " +/- " << RabsResultError << endl; |
1043 |
> |
dout << "Face value at " << FaceValueToBeTakenAt << " :" << FaceValResult << " +/- " << FaceValResultError << " (MPF) " << endl; |
1044 |
> |
dout << "Face value at " << FaceValueToBeTakenAt << " :" << RABSFaceValResult << " +/- " << RABSFaceValResultError << " (RABS) " << endl; |
1045 |
> |
|
1046 |
> |
delete can; |
1047 |
|
|
1048 |
+ |
results.MPF_Result_FaceValue=Value(FaceValResult,FaceValResultError); |
1049 |
+ |
results.Rabs_Result_FaceValue=Value(RABSFaceValResult,RABSFaceValResultError); |
1050 |
+ |
if(!gofast) results.MPF_Result_Extrapolated=Value(MPFResult,MPFResultError); |
1051 |
+ |
if(!gofast) results.Rabs_Result_Extrapolated=Value(RabsResult,RabsResultError); |
1052 |
+ |
results.Print(); |
1053 |
+ |
return results; |
1054 |
+ |
} |
1055 |
+ |
|
1056 |
+ |
|
1057 |
+ |
void DoPUStudy(string identifier) { |
1058 |
+ |
|
1059 |
+ |
float numVtxcuts[7]={0,10,15,20}; |
1060 |
+ |
|
1061 |
+ |
TCanvas *can = new TCanvas("can","can"); |
1062 |
+ |
TH1F *malpha[8]; |
1063 |
+ |
TH1F *dalpha[8]; |
1064 |
+ |
dout << identifier << ";"; |
1065 |
+ |
dout << endl; |
1066 |
+ |
for(int i=1;i<5;i++) { |
1067 |
+ |
stringstream sSpecialCut; |
1068 |
+ |
if(i<4) { |
1069 |
+ |
sSpecialCut << "numVtx>" << numVtxcuts[i-1] << " && numVtx<" << numVtxcuts[i]; |
1070 |
+ |
dout << numVtxcuts[i-1] << " < nVtx < " << numVtxcuts[i] << ";"; |
1071 |
+ |
} else { |
1072 |
+ |
sSpecialCut << "numVtx>" << numVtxcuts[i-1]; |
1073 |
+ |
dout << numVtxcuts[i-1] << ";"; |
1074 |
+ |
} |
1075 |
+ |
|
1076 |
+ |
sSpecialCut << " && " << identifier << "_alpha<0.3"; |
1077 |
+ |
TCut SpecialCut(sSpecialCut.str().c_str()); |
1078 |
+ |
|
1079 |
+ |
|
1080 |
+ |
malpha[i] = allsamples.Draw("malpha"+any2string(i),"mpf",1000,0,2,"MPF","events",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&SpecialCut,mc,luminosity); |
1081 |
+ |
dalpha[i] = allsamples.Draw("dalpha"+any2string(i),"mpf",1000,0,2,"MPF","events",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&SpecialCut,data,luminosity); |
1082 |
+ |
|
1083 |
+ |
|
1084 |
+ |
float a=dalpha[i]->GetMean(); |
1085 |
+ |
float b=malpha[i]->GetMean(); |
1086 |
+ |
float da=dalpha[i]->GetMeanError(); |
1087 |
+ |
float db=malpha[i]->GetMeanError(); |
1088 |
+ |
float factor = a / b; |
1089 |
+ |
float error = TMath::Sqrt( (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db); |
1090 |
+ |
|
1091 |
+ |
dout << malpha[i]->GetMean() << ";" << malpha[i]->GetMeanError() << ";" << dalpha[i]->GetMean() << ";" << dalpha[i]->GetMeanError() << ";" << malpha[i]->Integral()<<";"<<dalpha[i]->Integral() << ";"<<factor << ";" << error << endl; |
1092 |
+ |
delete malpha[i]; |
1093 |
+ |
delete dalpha[i]; |
1094 |
+ |
} |
1095 |
|
|
1096 |
|
delete can; |
1097 |
|
|
1098 |
+ |
} |
1099 |
+ |
|
1100 |
+ |
void ScenarioComparison() { |
1101 |
+ |
//very dumb way to do this. |
1102 |
+ |
|
1103 |
+ |
TGraphAsymmErrors *gr[5]; |
1104 |
+ |
TF1 *fit[5]; |
1105 |
+ |
bool dofit=true; |
1106 |
+ |
|
1107 |
+ |
TCanvas *can = new TCanvas("can","can",500,500); |
1108 |
+ |
|
1109 |
+ |
TLegend *leg = new TLegend(0.2,0.2,0.5,0.45); |
1110 |
+ |
leg->SetBorderSize(0); |
1111 |
+ |
leg->SetFillColor(kWhite); |
1112 |
+ |
|
1113 |
+ |
for(int i=0;i<6;i++) { |
1114 |
+ |
gr[i] = new TGraphAsymmErrors(); |
1115 |
+ |
double x[4] = {5,12.5,17.5,25}; |
1116 |
+ |
double dxl[4] = {5,2.5,2.5,5}; |
1117 |
+ |
double dxh[4] = {5,2.5,2.5,10}; |
1118 |
+ |
|
1119 |
+ |
string name=""; |
1120 |
+ |
string color=""; |
1121 |
+ |
|
1122 |
+ |
if(i==0) { |
1123 |
+ |
double y[4] = {1.01935,1.01558,0.996438,1.01901}; |
1124 |
+ |
double dyl[4] = {0.0132973,0.0131661,0.017629,0.0319767}; |
1125 |
+ |
double dyh[4] = {0.0132973,0.0131661,0.017629,0.0319767}; |
1126 |
+ |
name="30/30"; |
1127 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1128 |
+ |
color="#a01d99"; |
1129 |
+ |
} |
1130 |
+ |
if(i==1) { |
1131 |
+ |
double y[4] = {1.00577,1.00706,0.991029,0.954098}; |
1132 |
+ |
double dyl[4] = {0.0135575,0.0136548,0.0170778,0.0263919}; |
1133 |
+ |
double dyh[4] = {0.0135575,0.0136548,0.0170778,0.0263919}; |
1134 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1135 |
+ |
name="30/15"; |
1136 |
+ |
color="#2464bc"; |
1137 |
+ |
} |
1138 |
+ |
if(i==2) { |
1139 |
+ |
double y[4] = {1.023,1.00648,1.02217,1.03181}; |
1140 |
+ |
double dyl[4] = {0.0157372,0.0187778,0.0261512,0.0422295}; |
1141 |
+ |
double dyh[4] = {0.0157372,0.0187778,0.0261512,0.0422295}; |
1142 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1143 |
+ |
name="15/15"; |
1144 |
+ |
color="#f49230"; |
1145 |
+ |
} |
1146 |
+ |
if(i==3) { |
1147 |
+ |
double y[4] = {1.02029,1.01338,0.999769,1.00357}; |
1148 |
+ |
double dyl[4] = {0.0129509,0.0120127,0.0160537,0.0268972}; |
1149 |
+ |
double dyh[4] = {0.0129509,0.0120127,0.0160537,0.0268972}; |
1150 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1151 |
+ |
name="CHS 30/30"; |
1152 |
+ |
color="#c72f3c"; |
1153 |
+ |
} |
1154 |
+ |
if(i==4) { |
1155 |
+ |
double y[4] = {1.00274,1.01056,0.993214,0.997963}; |
1156 |
+ |
double dyl[4] = {0.0127179,0.0140344,0.0162814,0.0278914}; |
1157 |
+ |
double dyh[4] = {0.0127179,0.0140344,0.0162814,0.0278914}; |
1158 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1159 |
+ |
name="CHS 30/15"; |
1160 |
+ |
color="#7cb433"; |
1161 |
+ |
} |
1162 |
+ |
if(i==5) { |
1163 |
+ |
double y[4] = {1.04103,1.03726,1.04649,1.05383}; |
1164 |
+ |
double dyl[4] = {0.0156465,0.0168194,0.0231982,0.0376114}; |
1165 |
+ |
double dyh[4] = {0.0156465,0.0168194,0.0231982,0.0376114}; |
1166 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1167 |
+ |
name="CHS 15/15"; |
1168 |
+ |
color="#DF013A"; |
1169 |
+ |
} |
1170 |
+ |
|
1171 |
+ |
|
1172 |
+ |
gStyle->SetOptFit(0); |
1173 |
+ |
gr[i]->SetTitle(); |
1174 |
+ |
gr[i]->GetXaxis()->SetTitle("N(Vtx)"); |
1175 |
+ |
gr[i]->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
1176 |
+ |
gr[i]->GetXaxis()->CenterTitle(); |
1177 |
+ |
gr[i]->GetYaxis()->CenterTitle(); |
1178 |
+ |
gr[i]->SetName(name.c_str()); |
1179 |
+ |
gr[i]->SetMarkerSize(0.00001); |
1180 |
+ |
gr[i]->GetYaxis()->SetRangeUser(0.90,1.10); |
1181 |
+ |
gr[i]->SetLineColor(TColor::GetColor(color.c_str())); |
1182 |
+ |
gr[i]->SetMarkerColor(TColor::GetColor(color.c_str())); |
1183 |
+ |
if(dofit) { |
1184 |
+ |
gr[i]->Fit("pol1"); |
1185 |
+ |
fit[i] = (TF1*)gr[i]->GetFunction("pol1"); |
1186 |
+ |
fit[i]->SetLineColor(TColor::GetColor(color.c_str())); |
1187 |
+ |
} |
1188 |
+ |
leg->AddEntry(gr[i],name.c_str(),"l"); |
1189 |
+ |
if(i==0) gr[i]->Draw("AP*"); |
1190 |
+ |
else gr[i]->Draw("P"); |
1191 |
+ |
} |
1192 |
+ |
leg->Draw(); |
1193 |
+ |
DrawPrelim(); |
1194 |
+ |
|
1195 |
+ |
CompleteSave(can,"ScenarioComparison"); |
1196 |
+ |
delete can; |
1197 |
|
|
1198 |
|
} |
1199 |
|
|
1200 |
+ |
void ScenarioComparisonInclusive() { |
1201 |
+ |
//dumbest way ever to do this. but ok we only need to do it once. |
1202 |
+ |
TGraphAsymmErrors *gr[5]; |
1203 |
+ |
TF1 *fit[5]; |
1204 |
+ |
bool dofit=true; |
1205 |
+ |
|
1206 |
+ |
TCanvas *can = new TCanvas("can","can",500,500); |
1207 |
+ |
|
1208 |
+ |
TLegend *leg = new TLegend(0.2,0.2,0.65,0.45); |
1209 |
+ |
leg->SetBorderSize(0); |
1210 |
+ |
leg->SetFillColor(kWhite); |
1211 |
+ |
|
1212 |
+ |
for(int i=0;i<6;i++) { |
1213 |
+ |
gr[i] = new TGraphAsymmErrors(); |
1214 |
+ |
double x[4] = {5,12.5,17.5,25}; |
1215 |
+ |
double dxl[4] = {5,2.5,2.5,5}; |
1216 |
+ |
double dxh[4] = {5,2.5,2.5,5}; |
1217 |
+ |
|
1218 |
+ |
string name=""; |
1219 |
+ |
string color=""; |
1220 |
+ |
|
1221 |
+ |
if(i==0) { |
1222 |
+ |
double y[4] = {1.01093,1.01379,1.0147,1.02766}; |
1223 |
+ |
double dyl[4] = {0.00243596,0.00242534,0.00341941,0.00600663}; |
1224 |
+ |
double dyh[4] = {0.00243596,0.00242534,0.00341941,0.00600663}; |
1225 |
+ |
name="30/30"; |
1226 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1227 |
+ |
color="#a01d99"; |
1228 |
+ |
} |
1229 |
+ |
if(i==1) { |
1230 |
+ |
double y[4] = {1.0068,1.00779,0.999692,0.994484}; |
1231 |
+ |
double dyl[4] = {0.00249233,0.00257169,0.00371399,0.00631138}; |
1232 |
+ |
double dyh[4] = {0.00249233,0.00257169,0.00371399,0.00631138}; |
1233 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1234 |
+ |
name="30/15"; |
1235 |
+ |
color="#2464bc"; |
1236 |
+ |
} |
1237 |
+ |
if(i==2) { |
1238 |
+ |
double y[4] = {1.01208,1.01991,1.02185,1.03479}; |
1239 |
+ |
double dyl[4] = {0.00366745,0.00400001,0.00584054,0.0104661}; |
1240 |
+ |
double dyh[4] = {0.00366745,0.00400001,0.00584054,0.0104661}; |
1241 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1242 |
+ |
name="15/15"; |
1243 |
+ |
color="#f49230"; |
1244 |
+ |
} |
1245 |
+ |
if(i==3) { |
1246 |
+ |
double y[4] = {1.01177,1.01568,1.01616,1.03211}; |
1247 |
+ |
double dyl[4] = {0.00217317,0.00203014,0.00276838,0.00465643}; |
1248 |
+ |
double dyh[4] = {0.00217317,0.00203014,0.00276838,0.00465643}; |
1249 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1250 |
+ |
name="CHS 30/30"; |
1251 |
+ |
color="#c72f3c"; |
1252 |
+ |
} |
1253 |
+ |
if(i==4) { |
1254 |
+ |
double y[4] = {1.00751,1.00964,1.00804,1.01073}; |
1255 |
+ |
double dyl[4] = {0.00224851,0.00215563,0.0029592,0.00499805}; |
1256 |
+ |
double dyh[4] = {0.00224851,0.00215563,0.0029592,0.00499805}; |
1257 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1258 |
+ |
name="CHS 30/15"; |
1259 |
+ |
color="#7cb433"; |
1260 |
+ |
} |
1261 |
+ |
if(i==5) { |
1262 |
+ |
double y[4] = {1.01557,1.0318,1.03535,1.06331}; |
1263 |
+ |
double dyl[4] = {0.00300783,0.00302486,0.00421064,0.00739416}; |
1264 |
+ |
double dyh[4] = {0.00300783,0.00302486,0.00421064,0.00739416}; |
1265 |
+ |
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh); |
1266 |
+ |
name="CHS 15/15"; |
1267 |
+ |
color="#DF013A"; |
1268 |
+ |
} |
1269 |
+ |
|
1270 |
+ |
gStyle->SetOptFit(0); |
1271 |
+ |
gr[i]->SetTitle(); |
1272 |
+ |
gr[i]->GetXaxis()->SetTitle("N(Vtx)"); |
1273 |
+ |
gr[i]->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}"); |
1274 |
+ |
gr[i]->GetXaxis()->CenterTitle(); |
1275 |
+ |
gr[i]->GetYaxis()->CenterTitle(); |
1276 |
+ |
gr[i]->SetName(name.c_str()); |
1277 |
+ |
gr[i]->SetMarkerSize(0.00001); |
1278 |
+ |
gr[i]->GetYaxis()->SetRangeUser(0.90,1.10); |
1279 |
+ |
gr[i]->SetLineColor(TColor::GetColor(color.c_str())); |
1280 |
+ |
gr[i]->SetMarkerColor(TColor::GetColor(color.c_str())); |
1281 |
+ |
if(dofit) { |
1282 |
+ |
gr[i]->Fit("pol1"); |
1283 |
+ |
fit[i] = (TF1*)gr[i]->GetFunction("pol1"); |
1284 |
+ |
fit[i]->SetLineColor(TColor::GetColor(color.c_str())); |
1285 |
+ |
} |
1286 |
+ |
|
1287 |
+ |
stringstream nameplus; |
1288 |
+ |
nameplus << name << " (slope: " << std::setprecision(3) << fit[i]->GetParameter(1) << ")"; |
1289 |
+ |
|
1290 |
+ |
leg->AddEntry(gr[i],nameplus.str().c_str(),"l"); |
1291 |
+ |
if(i==0) gr[i]->Draw("AP*"); |
1292 |
+ |
else gr[i]->Draw("P"); |
1293 |
+ |
} |
1294 |
+ |
leg->Draw(); |
1295 |
+ |
DrawPrelim(); |
1296 |
+ |
|
1297 |
+ |
CompleteSave(can,"ScenarioComparisonInclusive"); |
1298 |
+ |
delete can; |
1299 |
+ |
|
1300 |
+ |
} |
1301 |
|
|
1302 |
+ |
void compare_selection(string identifier) { |
1303 |
+ |
bool recognized_scenario=false; |
1304 |
+ |
|
1305 |
+ |
dout << "Running with identifier " << identifier << endl; |
1306 |
+ |
if(identifier=="Zb30") { |
1307 |
+ |
LeadingB=TCut ("Zb30_bTagProbCSVBP[0]>0.898"); |
1308 |
+ |
EtaB=TCut("abs(Zb30_pfJetGoodEta[0])<1.3"); |
1309 |
+ |
PhiZcut=TCut("abs(Zb30_pfJetDphiZ[0])>2.7"); |
1310 |
+ |
recognized_scenario=true; |
1311 |
+ |
} |
1312 |
+ |
if(identifier=="Zb3010") { |
1313 |
+ |
LeadingB=TCut ("Zb3010_bTagProbCSVBP[0]>0.898"); |
1314 |
+ |
EtaB=TCut("abs(Zb3010_pfJetGoodEta[0])<1.3"); |
1315 |
+ |
PhiZcut=TCut("abs(Zb3010_pfJetDphiZ[0])>2.7"); |
1316 |
+ |
recognized_scenario=true; |
1317 |
+ |
} |
1318 |
+ |
|
1319 |
+ |
if(identifier=="ZbCHS3010") { |
1320 |
+ |
LeadingB=TCut ("ZbCHS1510_bTagProbCSVBP[0]>0.898"); |
1321 |
+ |
EtaB=TCut("abs(ZbCHS1510_pfJetGoodEta[0])<1.3"); |
1322 |
+ |
PhiZcut=TCut("abs(ZbCHS1510_pfJetDphiZ[0])>2.7"); |
1323 |
+ |
recognized_scenario=true; |
1324 |
+ |
} |
1325 |
+ |
|
1326 |
+ |
if(identifier=="Zb40") { |
1327 |
+ |
LeadingB=TCut ("Zb40_bTagProbCSVBP[0]>0.898"); |
1328 |
+ |
EtaB=TCut("abs(Zb40_pfJetGoodEta[0])<1.3"); |
1329 |
+ |
PhiZcut=TCut("abs(Zb40_pfJetDphiZ[0])>2.7"); |
1330 |
+ |
recognized_scenario=true; |
1331 |
+ |
} |
1332 |
+ |
|
1333 |
+ |
if(identifier=="ZbCHS301030") { |
1334 |
+ |
LeadingB=TCut ("ZbCHS301030_bTagProbCSVBP[0]>0.898"); |
1335 |
+ |
EtaB=TCut("abs(ZbCHS301030_pfJetGoodEta[0])<1.3"); |
1336 |
+ |
PhiZcut=TCut("abs(ZbCHS301030_pfJetDphiZ[0])>2.7"); |
1337 |
+ |
recognized_scenario=true; |
1338 |
+ |
} |
1339 |
+ |
|
1340 |
+ |
if(identifier=="Zb1530") { |
1341 |
+ |
LeadingB=TCut ("Zb1530_bTagProbCSVBP[0]>0.898"); |
1342 |
+ |
EtaB=TCut("abs(Zb1530_pfJetGoodEta[0])<1.3"); |
1343 |
+ |
PhiZcut=TCut("abs(Zb1530_pfJetDphiZ[0])>2.7"); |
1344 |
+ |
recognized_scenario=true; |
1345 |
+ |
} |
1346 |
+ |
|
1347 |
+ |
if(identifier=="ZbCHS301010") { |
1348 |
+ |
LeadingB=TCut ("ZbCHS301010_bTagProbCSVBP[0]>0.898"); |
1349 |
+ |
EtaB=TCut("abs(ZbCHS301010_pfJetGoodEta[0])<1.3"); |
1350 |
+ |
PhiZcut=TCut("abs(ZbCHS301010_pfJetDphiZ[0])>2.7"); |
1351 |
+ |
recognized_scenario=true; |
1352 |
+ |
} |
1353 |
+ |
|
1354 |
+ |
if(identifier=="Zb1510") { |
1355 |
+ |
LeadingB=TCut ("Zb1510_bTagProbCSVBP[0]>0.898"); |
1356 |
+ |
EtaB=TCut("abs(Zb1510_pfJetGoodEta[0])<1.3"); |
1357 |
+ |
PhiZcut=TCut("abs(Zb1510_pfJetDphiZ[0])>2.7"); |
1358 |
+ |
recognized_scenario=true; |
1359 |
+ |
} |
1360 |
+ |
|
1361 |
+ |
if(identifier=="ZbCHS301010") { |
1362 |
+ |
LeadingB=TCut ("ZbCHS301010_bTagProbCSVBP[0]>0.898"); |
1363 |
+ |
EtaB=TCut("abs(ZbCHS301010_pfJetGoodEta[0])<1.3"); |
1364 |
+ |
PhiZcut=TCut("abs(ZbCHS301010_pfJetDphiZ[0])>2.7"); |
1365 |
+ |
recognized_scenario=true; |
1366 |
+ |
} |
1367 |
+ |
|
1368 |
+ |
if(identifier=="ZbMikko") { |
1369 |
+ |
LeadingB=TCut ("ZbMikko_bTagProbCSVBP[0]>0.898 && ZbMikko__IsClean"); |
1370 |
+ |
EtaB=TCut("abs(ZbMikko_pfJetGoodEta[0])<1.3 && ZbMikko__IsClean"); |
1371 |
+ |
PhiZcut=TCut("abs(ZbMikko_pfJetDphiZ[0])>2.7 && ZbMikko__IsClean"); |
1372 |
+ |
recognized_scenario=true; |
1373 |
+ |
} |
1374 |
+ |
|
1375 |
+ |
if(identifier=="ZbCHS3010_SecEta3") { |
1376 |
+ |
LeadingB=TCut ("ZbCHS3010_SecEta3_bTagProbCSVBP[0]>0.898"); |
1377 |
+ |
EtaB=TCut("abs(ZbCHS3010_SecEta3_pfJetGoodEta[0])<1.3"); |
1378 |
+ |
PhiZcut=TCut("abs(ZbCHS3010_SecEta3_pfJetDphiZ[0])>2.7"); |
1379 |
+ |
recognized_scenario=true; |
1380 |
+ |
} |
1381 |
+ |
|
1382 |
+ |
if(identifier=="ZbCHS3010_SecEta5") { |
1383 |
+ |
LeadingB=TCut ("ZbCHS3010_SecEta5_bTagProbCSVBP[0]>0.898"); |
1384 |
+ |
EtaB=TCut("abs(ZbCHS3010_SecEta5_pfJetGoodEta[0])<1.3"); |
1385 |
+ |
PhiZcut=TCut("abs(ZbCHS3010_SecEta5_pfJetDphiZ[0])>2.7"); |
1386 |
+ |
recognized_scenario=true; |
1387 |
+ |
} |
1388 |
+ |
|
1389 |
+ |
if(identifier=="ZbCHS3010_p5Clean") { |
1390 |
+ |
LeadingB=TCut ("ZbCHS3010_p5Clean_bTagProbCSVBP[0]>0.898 && ZbCHS3010_p5Clean_IsClean"); |
1391 |
+ |
EtaB=TCut("abs(ZbCHS3010_p5Clean_pfJetGoodEta[0])<1.3 && ZbCHS3010_p5Clean_IsClean"); |
1392 |
+ |
PhiZcut=TCut("abs(ZbCHS3010_p5Clean_pfJetDphiZ[0])>2.7 && ZbCHS3010_p5Clean_IsClean"); |
1393 |
+ |
recognized_scenario=true; |
1394 |
+ |
} |
1395 |
+ |
|
1396 |
+ |
if(identifier=="ZbCHS3010") { |
1397 |
+ |
LeadingB=TCut ("ZbCHS3010_bTagProbCSVBP[0]>0.898"); |
1398 |
+ |
EtaB=TCut("abs(ZbCHS3010_pfJetGoodEta[0])<1.3"); |
1399 |
+ |
PhiZcut=TCut("abs(ZbCHS3010_pfJetDphiZ[0])>2.7"); |
1400 |
+ |
recognized_scenario=true; |
1401 |
+ |
} |
1402 |
+ |
if(identifier=="ZbCHS3010") { |
1403 |
+ |
LeadingB=TCut ("ZbCHS3010_bTagProbCSVBP[0]>0.898"); |
1404 |
+ |
EtaB=TCut("abs(ZbCHS3010_pfJetGoodEta[0])<1.3"); |
1405 |
+ |
PhiZcut=TCut("abs(ZbCHS3010_pfJetDphiZ[0])>2.7"); |
1406 |
+ |
recognized_scenario=true; |
1407 |
+ |
} |
1408 |
+ |
if(identifier=="ZbCHS30") { |
1409 |
+ |
LeadingB=TCut ("ZbCHS30_bTagProbCSVBP[0]>0.898"); |
1410 |
+ |
EtaB=TCut("abs(ZbCHS30_pfJetGoodEta[0])<1.3"); |
1411 |
+ |
PhiZcut=TCut("abs(ZbCHS30_pfJetDphiZ[0])>2.7"); |
1412 |
+ |
recognized_scenario=true; |
1413 |
+ |
} |
1414 |
+ |
|
1415 |
+ |
assert(recognized_scenario); |
1416 |
+ |
|
1417 |
+ |
dout << "Cuts: " << endl; |
1418 |
+ |
dout << " " << (const char*) LeadingB << endl; |
1419 |
+ |
dout << " " << (const char*) EtaB << endl; |
1420 |
+ |
dout << " " << (const char*) PhiZcut << endl; |
1421 |
+ |
|
1422 |
+ |
dout << endl << endl; |
1423 |
+ |
|
1424 |
+ |
// ScenarioComparison(); |
1425 |
+ |
// ScenarioComparisonInclusive(); |
1426 |
+ |
|
1427 |
+ |
// DoPUStudy(identifier); |
1428 |
+ |
// SpecialCutFlow(identifier); |
1429 |
+ |
|
1430 |
+ |
// draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",17000,30,200,"Z p_{T}","Official/"+identifier+"/Zpt__"+identifier,1); |
1431 |
+ |
// draw_kin_variable(identifier+"_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",40,0,200,"Leading Jet Pt (B)","Official/"+identifier+"/LeadingJetPt__"+identifier,1); |
1432 |
+ |
// draw_kin_variable(identifier+"_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",40,0,200,"Sub-Leading Jet Pt [GeV]","Official/"+identifier+"/Jet2Pt__"+identifier,1); |
1433 |
+ |
// draw_kin_variable(identifier+"_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/"+identifier+"/SubLeadingJetPt_Over_ZPt__"+identifier,1); |
1434 |
+ |
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); |
1435 |
+ |
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); |
1436 |
+ |
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); |
1437 |
+ |
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); |
1438 |
+ |
draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut,20,0,2,"#alpha","Official/"+identifier+"/alpha_full__"+identifier,1); |
1439 |
+ |
draw_kin_variable(identifier+"_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>30&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","Official/"+identifier+"/DeltaPhiZBlead__"+identifier,0); |
1440 |
+ |
|
1441 |
+ |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&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, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
1442 |
+ |
draw_kin_variable(identifier+"_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&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, 30 GeV < p_{T}^{Z} < 1000 GeV"); |
1443 |
+ |
draw_kin_variable(identifier+"_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<50&&"+identifier+"_alpha<0.3").c_str()),20,0,2,"p_{T} b-jet / p_{T} Z","Official/"+identifier+"/ptb_over_ptz___alpha_smaller_0p3___pt3050___"+identifier,0,"#alpha<0.3, 30 GeV < p_{T}^{Z} < 1000 GeV}{30<p_{T}^{Z}<50 GeV}"); |
1444 |
+ |
|
1445 |
+ |
} |
1446 |
+ |
|
1447 |
+ |
void GetNumberEventsInsideOutsideAlphaWindow(TCut specialcut, string title) { |
1448 |
+ |
|
1449 |
+ |
// TCut cut = ZplusBsel&&LeadingB&&PhiZcut&&specialcut&&TCut("ZbCHS3010_alpha<0.3"); |
1450 |
+ |
TCut cut = specialcut; |
1451 |
+ |
TCut in = EtaB; |
1452 |
+ |
TCut out = TCut("abs(ZbCHS3010_pfJetGoodEta[0])>1.3"); |
1453 |
+ |
|
1454 |
+ |
TH1F *data_IN = allsamples.Draw("data_IN", "mll",1,0,150, "nothing [GeV]", "events", cut&&in, data,luminosity); |
1455 |
+ |
TH1F *data_OUT = allsamples.Draw("data_OUT", "mll",1,0,150, "nothing [GeV]", "events", cut&&out,data,luminosity); |
1456 |
+ |
TH1F *mc_IN = allsamples.Draw("mc_IN", "mll",1,0,150, "nothing [GeV]", "events", cut&&in, mc ,luminosity); |
1457 |
+ |
TH1F *mc_OUT = allsamples.Draw("mc_OUT", "mll",1,0,150, "nothing [GeV]", "events", cut&&out,mc ,luminosity); |
1458 |
+ |
|
1459 |
+ |
dout << title << " : " << endl; |
1460 |
+ |
dout << " Data: In " << data_IN->Integral() << " vs out " << data_OUT->Integral() << endl; |
1461 |
+ |
dout << " MC : In " << mc_IN->Integral() << " vs out " << mc_OUT->Integral() << endl; |
1462 |
+ |
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; |
1463 |
+ |
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; |
1464 |
+ |
|
1465 |
+ |
delete data_IN; |
1466 |
+ |
delete data_OUT; |
1467 |
+ |
delete mc_IN; |
1468 |
+ |
delete mc_OUT; |
1469 |
+ |
} |
1470 |
+ |
|
1471 |
+ |
void TEST_GetNumberEventsInsideOutsideAlphaWindow() { |
1472 |
+ |
TCanvas *ca = new TCanvas("ca","ca"); |
1473 |
+ |
// GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==0"), "ee"); |
1474 |
+ |
// GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==1"), "mm"); |
1475 |
+ |
// GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2"), "ee/mm"); |
1476 |
+ |
|
1477 |
+ |
dout << "BASE SELECTION" << endl; |
1478 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==0"), "ee"); |
1479 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==1"), "mm"); |
1480 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2"), "ee/mm"); |
1481 |
+ |
|
1482 |
+ |
dout << "BASE SELECTION: Z+b" << endl; |
1483 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2&&id1==0"), "ee"); |
1484 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2&&id1==1"), "mm"); |
1485 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2"), "ee/mm"); |
1486 |
+ |
|
1487 |
+ |
dout << "Leading B" << endl; |
1488 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0"), "ee"); |
1489 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1"), "mm"); |
1490 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2"), "ee/mm"); |
1491 |
+ |
|
1492 |
+ |
dout << "PhiZcut" << endl; |
1493 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0"), "ee"); |
1494 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1"), "mm"); |
1495 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2"), "ee/mm"); |
1496 |
+ |
|
1497 |
+ |
dout << "alpha cut" << endl; |
1498 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0")&&TCut("ZbCHS3010_alpha<0.3"), "ee"); |
1499 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1")&&TCut("ZbCHS3010_alpha<0.3"), "mm"); |
1500 |
+ |
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2")&&TCut("ZbCHS3010_alpha<0.3"), "ee/mm"); |
1501 |
+ |
|
1502 |
+ |
delete ca; |
1503 |
+ |
|
1504 |
+ |
|
1505 |
+ |
} |
1506 |
+ |
|
1507 |
|
|
1508 |
< |
void do_basic_ZB_analysis() { |
1509 |
< |
TCanvas *zbcanvas = new TCanvas("zbcanvas","zbcanvas"); |
1510 |
< |
write_warning(__FUNCTION__,"TESTING NEW DATA MC AGREEMENT"); |
1511 |
< |
|
1512 |
< |
/* |
1513 |
< |
// print_all_b_yields(); |
1514 |
< |
// draw_mpf_vars(); |
1515 |
< |
draw_Zb_kin_vars(); |
1516 |
< |
|
1517 |
< |
data_mc_agreement_2d(); |
1518 |
< |
*/ |
1519 |
< |
new_data_mc_agreement_2d(); |
1508 |
> |
void MetSpectrumDepletionIllustration(int isdata) { |
1509 |
> |
|
1510 |
> |
TCanvas *can = new TCanvas("can","can"); |
1511 |
> |
TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut); |
1512 |
> |
|
1513 |
> |
cutWeight=STDWEIGHT*TCut("ZbCHS3010_BTagWgtTUp*(1.0)*(ZbCHS3010_bTagProbCSVBP[0]>0.898)"); |
1514 |
> |
TH1F *standard = allsamples.Draw("standard","met[1]",80,0,400, "MET [GeV]", "events", basecut,isdata,luminosity); |
1515 |
> |
|
1516 |
> |
cutWeight=STDWEIGHT*TCut("ZbCHS3010_BTagWgtTUp*(1.0*softMuon)*(ZbCHS3010_bTagProbCSVBP[0]>0.898)"); |
1517 |
> |
TH1F *Neutrinos = allsamples.Draw("Neutrinos","met[1]",80,0,400, "MET [GeV]", "events", basecut,isdata,luminosity); |
1518 |
> |
|
1519 |
> |
cutWeight=STDWEIGHT*TCut("ZbCHS3010_BTagWgtTUp*(1.0*(1.0-softMuon))*(ZbCHS3010_bTagProbCSVBP[0]>0.898)"); |
1520 |
> |
TH1F *NoNeutrinos = allsamples.Draw("NoNeutrinos","met[1]",80,0,400, "MET [GeV]", "events", basecut,isdata,luminosity); |
1521 |
> |
|
1522 |
> |
standard->Scale(1.0/standard->Integral()); |
1523 |
> |
Neutrinos->Scale(1.0/Neutrinos->Integral()); |
1524 |
> |
NoNeutrinos->Scale(1.0/NoNeutrinos->Integral()); |
1525 |
> |
|
1526 |
> |
Neutrinos->SetLineColor(kGreen); |
1527 |
> |
NoNeutrinos->SetLineColor(kRed); |
1528 |
> |
|
1529 |
> |
can->SetLogy(1); |
1530 |
> |
TLegend *leg = make_legend(); |
1531 |
> |
leg->AddEntry(standard,"Standard sample","ep"); |
1532 |
> |
leg->AddEntry(Neutrinos,"#nu enriched sample","l"); |
1533 |
> |
leg->AddEntry(NoNeutrinos,"#nu depleted sample","l"); |
1534 |
> |
leg->SetX1(0.9*leg->GetX1()); |
1535 |
> |
standard->Draw("e1"); |
1536 |
> |
Neutrinos->Draw("histo,same"); |
1537 |
> |
NoNeutrinos->Draw("histo,same"); |
1538 |
> |
if(isdata==data) leg->SetHeader("Data:"); |
1539 |
> |
else leg->SetHeader("MC:"); |
1540 |
> |
leg->Draw(); |
1541 |
> |
DrawPrelim(); |
1542 |
> |
|
1543 |
> |
if(isdata==data) CompleteSave(can,"NeutrinoMetSpectrum__Data"); |
1544 |
> |
else CompleteSave(can,"NeutrinoMetSpectrum__MC"); |
1545 |
> |
delete standard; |
1546 |
> |
delete Neutrinos; |
1547 |
> |
delete NoNeutrinos; |
1548 |
> |
delete can; |
1549 |
> |
CleanLegends(); |
1550 |
> |
} |
1551 |
> |
|
1552 |
> |
void do_basic_ZB_analysis(bool DoCompleteAnalysis) { |
1553 |
> |
STDWEIGHT=TCut(cutWeight); |
1554 |
> |
cutWeight=TCut(STDWEIGHT*TCut("ZbCHS3010_BTagWgtT")); |
1555 |
> |
dout << "The lepton requirement is " << (const char*) leptoncut << endl; |
1556 |
> |
bool doquick=false; |
1557 |
> |
|
1558 |
> |
TCanvas *zbcanvas = new TCanvas("zbcanvas","zbcanvas"); |
1559 |
> |
|
1560 |
> |
|
1561 |
> |
// MetSpectrumDepletionIllustration(data); |
1562 |
> |
// MetSpectrumDepletionIllustration(mc); |
1563 |
> |
|
1564 |
> |
// compare_selection("ZbCHS3010_p5Clean"); |
1565 |
> |
// compare_selection("ZbCHS3010"); |
1566 |
> |
// compare_selection("Zb30"); |
1567 |
> |
// compare_selection("Zb3010"); |
1568 |
> |
// compare_selection("Zb1510"); |
1569 |
> |
// compare_selection("ZbCHS30"); |
1570 |
> |
// compare_selection("ZbCHS3010"); |
1571 |
> |
// compare_selection("ZbCHS3010"); |
1572 |
> |
// compare_selection("ZbCHS301010"); |
1573 |
> |
// compare_selection("ZbCHS3010_SecEta3"); |
1574 |
> |
// compare_selection("ZbCHS3010_SecEta5"); |
1575 |
> |
// compare_selection("Zb1510"); |
1576 |
> |
// compare_selection("ZbCHS301010"); |
1577 |
> |
// compare_selection("ZbMikko"); |
1578 |
> |
// compare_selection("ZbCHS3010"); |
1579 |
> |
// compare_selection("Zb40"); |
1580 |
> |
|
1581 |
> |
if(!doquick) { |
1582 |
> |
// draw_kin_variable("mll","",28,60.0,200.0,"m_{ll}","mll",1,"");//nice and quick test to see if the normalization is ok (i.e. all data is processed etc.) |
1583 |
> |
// print_all_b_yields(); |
1584 |
> |
// draw_mpf_vars(); |
1585 |
> |
// DrawEvilCutFlow(); |
1586 |
> |
|
1587 |
> |
// draw_Zb_kin_vars(); |
1588 |
> |
|
1589 |
> |
} |
1590 |
> |
|
1591 |
> |
// GetNumberEventsInsideOutsideAlphaWindow(); |
1592 |
> |
|
1593 |
> |
if(DoCompleteAnalysis) { |
1594 |
> |
/* need to run the following scenarios: |
1595 |
> |
* - normal |
1596 |
> |
* - inclusive |
1597 |
> |
* - medium WP |
1598 |
> |
* - alpha up |
1599 |
> |
* - alpha down |
1600 |
> |
*/ |
1601 |
> |
|
1602 |
> |
bool fast=true;bool slow=false;//don't change these |
1603 |
> |
|
1604 |
> |
ZbResultContainer inclusive = new_data_mc_agreement_2d(slow,"ZbCHS3010_alpha","inclusive",TCut("mll>0"),TCut("1.0"),0.3); |
1605 |
> |
ZbResultContainer Reference = new_data_mc_agreement_2d(slow,"ZbCHS3010_alpha","reference",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3); |
1606 |
> |
|
1607 |
> |
|
1608 |
> |
ZbResultContainer NeutrinoQ = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","NeutrinoQ",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp*(1.0*softMuon)"),0.3); |
1609 |
> |
ZbResultContainer ANeutrinoQ = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","ANeutrinoQ",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp*(1.0*(1.0-softMuon))"),0.3); |
1610 |
> |
|
1611 |
> |
ZbResultContainer effmistagUp = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","effmistagUp",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp"),0.3); |
1612 |
> |
ZbResultContainer effmistagDown = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","effmistagDown",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTDown"),0.3); |
1613 |
> |
ZbResultContainer medium = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","medium",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.679"),TCut("ZbCHS3010_BTagWgtM"),0.3); |
1614 |
> |
ZbResultContainer loose = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","loose",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.244"),TCut("ZbCHS3010_BTagWgtL"),0.3); |
1615 |
> |
ZbResultContainer AlphaUp = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaUp","AlphaUp",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3); |
1616 |
> |
ZbResultContainer AlphaDown = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaDown","AlphaDown",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3); |
1617 |
> |
|
1618 |
> |
ZbResultContainer L5inclusive = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaL5","L5inclusive",TCut("mll>0"),TCut("1.0"),0.3); |
1619 |
> |
ZbResultContainer L5Reference = new_data_mc_agreement_2d(fast,"ZbCHS3010_alphaL5","L5reference",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3); |
1620 |
> |
|
1621 |
> |
ZbResultContainer AlphaThresholdVariationDown10 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown10", TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"), TCut("ZbCHS3010_BTagWgtT"),0.3-0.1*0.3); |
1622 |
> |
ZbResultContainer AlphaThresholdVariationUp10 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp10", TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"), TCut("ZbCHS3010_BTagWgtT"),0.3+0.1*0.3); |
1623 |
> |
ZbResultContainer AlphaThresholdVariationDown30 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown30", TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"), TCut("ZbCHS3010_BTagWgtT"),0.3-0.3*0.3); |
1624 |
> |
ZbResultContainer AlphaThresholdVariationUp30 = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp30", TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"), TCut("ZbCHS3010_BTagWgtT"),0.3+0.3*0.3); |
1625 |
> |
ZbResultContainer AlphaThresholdVariationDown10inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown10inc",TCut("mll>0"), TCut("1.0"),0.3-0.1*0.3); |
1626 |
> |
ZbResultContainer AlphaThresholdVariationUp10inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp10inc", TCut("mll>0"), TCut("1.0"),0.3+0.1*0.3); |
1627 |
> |
ZbResultContainer AlphaThresholdVariationDown30inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationDown30inc",TCut("mll>0"), TCut("1.0"),0.3-0.3*0.3); |
1628 |
> |
ZbResultContainer AlphaThresholdVariationUp30inc = new_data_mc_agreement_2d(fast,"ZbCHS3010_alpha","AlphaThresholdVariationUp30inc", TCut("mll>0"), TCut("1.0"),0.3+0.3*0.3); |
1629 |
> |
|
1630 |
> |
//and now let's compute some systematics! |
1631 |
> |
//1 alpha variation |
1632 |
> |
float SysMPF_Alpha_down = Reference.MPF_Result_FaceValue.getValue()-AlphaDown.MPF_Result_FaceValue.getValue(); |
1633 |
> |
float SysMPF_Alpha_up = Reference.MPF_Result_FaceValue.getValue()-AlphaUp.MPF_Result_FaceValue.getValue(); |
1634 |
> |
|
1635 |
> |
//2 btagging efficiency/mistag correction |
1636 |
> |
float SysMPF_EFF_down = Reference.MPF_Result_FaceValue.getValue()-effmistagDown.MPF_Result_FaceValue.getValue(); |
1637 |
> |
float SysMPF_EFF_up = Reference.MPF_Result_FaceValue.getValue()-effmistagUp.MPF_Result_FaceValue.getValue(); |
1638 |
> |
|
1639 |
> |
//3 Presence of soft muons (->neutrino question) |
1640 |
> |
float SysMPF_Neutrino_up = Reference.MPF_Result_FaceValue.getValue()-NeutrinoQ.MPF_Result_FaceValue.getValue(); |
1641 |
> |
float SysMPF_Neutrino_down = Reference.MPF_Result_FaceValue.getValue()-ANeutrinoQ.MPF_Result_FaceValue.getValue(); |
1642 |
> |
|
1643 |
> |
//4 purity |
1644 |
> |
zbcanvas->cd(); |
1645 |
> |
gStyle->SetOptFit(0); |
1646 |
> |
write_info(__FUNCTION__,"Don't know the exact purity at the moment, still needs to be determined!"); |
1647 |
> |
TH1F *purityhisto = new TH1F("purityhisto","purityhisto",1,0,1); |
1648 |
> |
purityhisto->GetXaxis()->SetTitle("Purity"); |
1649 |
> |
purityhisto->GetYaxis()->SetTitle("C_{abs}"); |
1650 |
> |
purityhisto->GetXaxis()->CenterTitle(); |
1651 |
> |
purityhisto->GetYaxis()->CenterTitle(); |
1652 |
> |
|
1653 |
> |
TGraphErrors *gSysMPF_Purity = new TGraphErrors(); |
1654 |
> |
|
1655 |
> |
gSysMPF_Purity->SetPoint(0,PurityInclusive,inclusive.MPF_Result_FaceValue.getValue()); |
1656 |
> |
gSysMPF_Purity->SetPointError(0,0.0,inclusive.MPF_Result_FaceValue.getError()); |
1657 |
> |
|
1658 |
> |
gSysMPF_Purity->SetPoint(1,PurityLoose,loose.MPF_Result_FaceValue.getValue());//x value? |
1659 |
> |
gSysMPF_Purity->SetPointError(1,0.0,loose.MPF_Result_FaceValue.getError()); |
1660 |
> |
gSysMPF_Purity->SetPoint(2,PurityMedium,medium.MPF_Result_FaceValue.getValue());//x value? |
1661 |
> |
gSysMPF_Purity->SetPointError(2,0.0,medium.MPF_Result_FaceValue.getError()); |
1662 |
> |
gSysMPF_Purity->SetPoint(3,PurityTight,Reference.MPF_Result_FaceValue.getValue());//x value? |
1663 |
> |
gSysMPF_Purity->SetPointError(3,0.0,Reference.MPF_Result_FaceValue.getError()); |
1664 |
> |
|
1665 |
> |
|
1666 |
> |
float min,max; |
1667 |
> |
FindMinMax(gSysMPF_Purity,min,max); |
1668 |
> |
purityhisto->SetStats(0); |
1669 |
> |
purityhisto->GetYaxis()->SetRangeUser(min,max); |
1670 |
> |
|
1671 |
> |
gSysMPF_Purity->Fit("pol1"); |
1672 |
> |
TPolyLine *purity_fit_uncert = GetFitUncertaintyShape(gSysMPF_Purity, "pol1", min, max,0.0,1.0); |
1673 |
> |
TF1* pufit = (TF1*)gSysMPF_Purity->GetFunction("pol1"); |
1674 |
> |
|
1675 |
> |
TF1* pufit_c = new TF1("pufit_c","[0]+[1]*x"); |
1676 |
> |
pufit_c->SetParameters(pufit->GetParameters()); |
1677 |
> |
pufit_c->SetLineColor(TColor::GetColor("#0101DF")); |
1678 |
> |
purity_fit_uncert->SetFillColor(TColor::GetColor("#5353FC")); |
1679 |
> |
pufit->SetLineColor(TColor::GetColor("#5353FC")); |
1680 |
> |
|
1681 |
> |
purityhisto->Draw(); |
1682 |
> |
purity_fit_uncert->Draw("f"); |
1683 |
> |
gSysMPF_Purity->Draw("P*"); |
1684 |
> |
pufit_c->Draw("same"); |
1685 |
> |
DrawPrelim(); |
1686 |
> |
|
1687 |
> |
float ExtrapolatedResult=pufit->GetParameter(0)+1.0*pufit->GetParameter(1); |
1688 |
> |
float dExtrapolatedResult=sqrt(pufit->GetParError(0)*pufit->GetParError(0)+1.0*1.0*pufit->GetParError(1)*pufit->GetParError(1)); |
1689 |
> |
|
1690 |
> |
stringstream summary; |
1691 |
> |
summary << "#splitline{Reference: " << std::setprecision(4) << Reference.MPF_Result_FaceValue.getValue() << "+/-" << std::setprecision(4) << Reference.MPF_Result_FaceValue.getError() << "}{"; |
1692 |
> |
summary << "Extrapolation: " << std::setprecision(4) << ExtrapolatedResult << " +/- " << std::setprecision(4) << dExtrapolatedResult << "}"; |
1693 |
> |
|
1694 |
> |
dout << "Have found an extrapolated result at 1.0 of " << ExtrapolatedResult << " ; will use the difference between this result and the face value as "; |
1695 |
> |
dout << "purity-related systematic uncertainty" << endl; |
1696 |
> |
|
1697 |
> |
TText *infobox = write_title(summary.str()); |
1698 |
> |
infobox->SetX(0.75); |
1699 |
> |
infobox->SetTextSize(0.03); |
1700 |
> |
infobox->SetY(0.75); |
1701 |
> |
infobox->Draw(); |
1702 |
> |
|
1703 |
> |
CompleteSave(zbcanvas,"Systematics/Purity"); |
1704 |
> |
|
1705 |
> |
|
1706 |
> |
|
1707 |
> |
float SysMPF_Purity = abs(ExtrapolatedResult-Reference.MPF_Result_FaceValue.getValue()); |
1708 |
> |
|
1709 |
> |
float sys_alpha = abs(SysMPF_Alpha_down)>abs(SysMPF_Alpha_up)?abs(SysMPF_Alpha_down):abs(SysMPF_Alpha_up); |
1710 |
> |
float sys_eff = abs(SysMPF_EFF_down)>abs(SysMPF_EFF_up)?abs(SysMPF_EFF_down):abs(SysMPF_EFF_up); |
1711 |
> |
float sys_purity = abs(SysMPF_Purity); |
1712 |
> |
float sys_neutrino = abs(SysMPF_Neutrino_down)>abs(SysMPF_Neutrino_up)?abs(SysMPF_Neutrino_down):abs(SysMPF_Neutrino_up); |
1713 |
> |
float sys = sqrt(sys_alpha*sys_alpha+sys_eff*sys_eff+sys_purity*sys_purity+sys_neutrino*sys_neutrino); |
1714 |
> |
|
1715 |
> |
dout << "MPF METHOD:" << endl; |
1716 |
> |
dout << " Systematics : down up (selected)" << endl; |
1717 |
> |
dout << " Oversmearing : " << SysMPF_Alpha_down << " , " << SysMPF_Alpha_up << " ( " << sys_alpha << ") " << endl; |
1718 |
> |
dout << " eff/mistag variation : " << SysMPF_EFF_down << " , " << SysMPF_EFF_up << " ( " << sys_eff << ") " << endl; |
1719 |
> |
dout << " purity : " << SysMPF_Purity << " ( " << sys_purity << " )" << endl; |
1720 |
> |
dout << " neutrino : " << SysMPF_Neutrino_down << " , " << SysMPF_Neutrino_up << " ( " << sys_neutrino << ") " << endl; |
1721 |
> |
dout << " total : " << sys << " (note that this is the sys on C_{abs}^{b}, not yet on C_{corr} - there will also be an additional source!)" << endl; |
1722 |
> |
dout << endl << endl; |
1723 |
> |
dout << " FINAL RESULTS : " << endl; |
1724 |
> |
dout << " C_{abs}^{b} = " << Reference.MPF_Result_FaceValue << " (stat) +/- " << sys << " (sys) " << endl; |
1725 |
> |
dout << " C_{abs}^{inc} = " << inclusive.MPF_Result_FaceValue << " (stat) " << endl; |
1726 |
> |
|
1727 |
> |
float sysfinal = Reference.MPF_Result_FaceValue.getValue()/inclusive.MPF_Result_FaceValue.getValue(); |
1728 |
> |
sysfinal *= sqrt(sys*sys/(Reference.MPF_Result_FaceValue.getValue()*Reference.MPF_Result_FaceValue.getValue())); |
1729 |
> |
//yes, this could be simplified but it would look like a bug. |
1730 |
> |
|
1731 |
> |
|
1732 |
> |
|
1733 |
> |
|
1734 |
> |
dout << "Note: Varying the alpha cut (->face value) we get the following results: " << endl; |
1735 |
> |
dout << "-30%: " << AlphaThresholdVariationDown30.MPF_Result_FaceValue/AlphaThresholdVariationDown30inc.MPF_Result_FaceValue << " (stat)" << endl; |
1736 |
> |
dout << "-10%: " << AlphaThresholdVariationDown10.MPF_Result_FaceValue/AlphaThresholdVariationDown10inc.MPF_Result_FaceValue << " (stat)" << endl; |
1737 |
> |
dout << " 0%: " << Reference.MPF_Result_FaceValue/inclusive.MPF_Result_FaceValue << " (stat) +/- " << endl; |
1738 |
> |
dout << "+10%: " << AlphaThresholdVariationUp10.MPF_Result_FaceValue/AlphaThresholdVariationUp10inc.MPF_Result_FaceValue << " (stat)" << endl; |
1739 |
> |
dout << "+30%: " << AlphaThresholdVariationUp30.MPF_Result_FaceValue/AlphaThresholdVariationUp30inc.MPF_Result_FaceValue << " (stat)" << endl; |
1740 |
> |
|
1741 |
> |
dout << " XCheck for Rabs, varying the alpha cut (->face value) we get the following results: " << endl; |
1742 |
> |
dout << " -30%: " << AlphaThresholdVariationDown30.Rabs_Result_FaceValue/AlphaThresholdVariationDown30inc.Rabs_Result_FaceValue << " (stat)" << endl; |
1743 |
> |
dout << " -10%: " << AlphaThresholdVariationDown10.Rabs_Result_FaceValue/AlphaThresholdVariationDown10inc.Rabs_Result_FaceValue << " (stat)" << endl; |
1744 |
> |
dout << " 0%: " << Reference.Rabs_Result_FaceValue/inclusive.Rabs_Result_FaceValue << " (stat) +/- " << endl; |
1745 |
> |
dout << " +10%: " << AlphaThresholdVariationUp10.Rabs_Result_FaceValue/AlphaThresholdVariationUp10inc.Rabs_Result_FaceValue << " (stat)" << endl; |
1746 |
> |
dout << " +30%: " << AlphaThresholdVariationUp30.Rabs_Result_FaceValue/AlphaThresholdVariationUp30inc.Rabs_Result_FaceValue << " (stat)" << endl; |
1747 |
> |
|
1748 |
> |
|
1749 |
> |
float sys_alphavar_up = abs(AlphaThresholdVariationUp30.MPF_Result_FaceValue.getValue()/AlphaThresholdVariationUp30inc.MPF_Result_FaceValue.getValue() - Reference.MPF_Result_FaceValue.getValue()/inclusive.MPF_Result_FaceValue.getValue()); |
1750 |
> |
float sys_alphavar_down = abs(AlphaThresholdVariationDown30.MPF_Result_FaceValue.getValue()/AlphaThresholdVariationDown30inc.MPF_Result_FaceValue.getValue() - Reference.MPF_Result_FaceValue.getValue()/inclusive.MPF_Result_FaceValue.getValue()); |
1751 |
> |
float sys_alphavar = sys_alphavar_up>sys_alphavar_down?sys_alphavar_up:sys_alphavar_down; |
1752 |
> |
|
1753 |
> |
dout << " -> Additional systematic (from 30%) : " << sys_alphavar << endl; |
1754 |
> |
sysfinal=sqrt(sysfinal*sysfinal+sys_alphavar*sys_alphavar); |
1755 |
> |
dout << "Final systematic is : " << sysfinal << endl; |
1756 |
> |
|
1757 |
> |
dout << " ******************************************** < FINAL RESULT > ******************************************** " << endl; |
1758 |
> |
dout << " C_{corr} = " << Reference.MPF_Result_FaceValue/inclusive.MPF_Result_FaceValue << " (stat) +/- " << sysfinal << " (sys) " << endl; |
1759 |
> |
dout << " ******************************************** < /FINAL RESULT > ******************************************** " << endl; |
1760 |
> |
|
1761 |
> |
dout << "Note that if L5 corrections are applied, we get " << L5Reference.MPF_Result_FaceValue/L5inclusive.MPF_Result_FaceValue << " (stat) " << endl; |
1762 |
> |
|
1763 |
> |
LeadingB=TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"); |
1764 |
> |
|
1765 |
> |
} else { |
1766 |
> |
ZbResultContainer Reference = new_data_mc_agreement_2d(false,"ZbCHS3010_alpha","reference",TCut("ZbCHS3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"),0.3); |
1767 |
> |
} |
1768 |
> |
|
1769 |
|
|
1770 |
|
delete zbcanvas; |
1771 |
|
} |
1772 |
+ |
|
1773 |
+ |
|
1774 |
+ |
|
1775 |
+ |
|
1776 |
+ |
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* DELETE EVERYTHING BELOW THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*// |
1777 |
+ |
|
1778 |
+ |
|
1779 |
+ |
const char* concatenate(string bla1, string bla2) { |
1780 |
+ |
stringstream bla; |
1781 |
+ |
bla << bla1 << bla2; |
1782 |
+ |
return bla.str().c_str(); |
1783 |
+ |
} |
1784 |
+ |
|
1785 |
+ |
void SpecialCutFlow(string identifier) { |
1786 |
+ |
stringstream MegaCut; |
1787 |
+ |
|
1788 |
+ |
|
1789 |
+ |
|
1790 |
+ |
MegaCut << " 1*(" << (const char*) (ZplusBsel&&TCut(concatenate(identifier,"_pfJetGoodNumBtag>0"))) << ")"; |
1791 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB) << ")"; |
1792 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB) << ")"; |
1793 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut) << ")"; |
1794 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000").c_str())) << ")"; |
1795 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.3").c_str())) << ")"; |
1796 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.2").c_str())) << ")"; |
1797 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.15").c_str())) << ")"; |
1798 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.1").c_str())) << ")"; |
1799 |
+ |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>30&&pt<1000&&"+identifier+"_alpha<0.05").c_str())) << ")"; |
1800 |
+ |
MegaCut << " "; |
1801 |
+ |
|
1802 |
+ |
TCanvas *can = new TCanvas("can","can"); |
1803 |
+ |
can->SetLogy(1); |
1804 |
+ |
TCut basecut(ZplusBsel); |
1805 |
+ |
|
1806 |
+ |
|
1807 |
+ |
|
1808 |
+ |
TLegend *leg = allsamples.allbglegend(); |
1809 |
+ |
|
1810 |
+ |
|
1811 |
+ |
TH1F *data = allsamples.Draw("data", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity); |
1812 |
+ |
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity); |
1813 |
+ |
|
1814 |
+ |
float runningsum=0; |
1815 |
+ |
for(int i=data->GetNbinsX();i>0;i--) { |
1816 |
+ |
runningsum+=data->GetBinContent(i); |
1817 |
+ |
data->SetBinContent(i,runningsum); |
1818 |
+ |
} |
1819 |
+ |
|
1820 |
+ |
float minimum=data->GetMaximum(); |
1821 |
+ |
|
1822 |
+ |
TH1F* h; |
1823 |
+ |
TIter nextOF(mcm.GetHists()); |
1824 |
+ |
|
1825 |
+ |
float mcsum=0; |
1826 |
+ |
float zb=0; |
1827 |
+ |
while ( h = (TH1F*)nextOF() ) { |
1828 |
+ |
float runningsum=0; |
1829 |
+ |
minimum=data->GetMaximum();//done deliberately at each step so get the minimum of the last (!) contribution |
1830 |
+ |
for(int i=h->GetNbinsX();i>0;i--) { |
1831 |
+ |
runningsum+=h->GetBinContent(i); |
1832 |
+ |
h->SetBinContent(i,runningsum); |
1833 |
+ |
if(runningsum<minimum&&runningsum>0) minimum=runningsum; |
1834 |
+ |
} |
1835 |
+ |
if(Contains(h->GetName(),"Z_b_")) { |
1836 |
+ |
zb=h->GetBinContent(h->GetNbinsX()); |
1837 |
+ |
} |
1838 |
+ |
mcsum+=h->GetBinContent(h->GetNbinsX()); |
1839 |
+ |
} |
1840 |
+ |
|
1841 |
+ |
|
1842 |
+ |
|
1843 |
+ |
data->SetMinimum(0.05*minimum); |
1844 |
+ |
can->cd(1)->SetBottomMargin(0.25); |
1845 |
+ |
data->GetXaxis()->SetBinLabel(1,"Pre-selection"); |
1846 |
+ |
data->GetXaxis()->SetBinLabel(2,"Contains b jet"); |
1847 |
+ |
data->GetXaxis()->SetBinLabel(3,"Leading jet is b-jet"); |
1848 |
+ |
data->GetXaxis()->SetBinLabel(4,"|#eta_{b}|<1.3 "); |
1849 |
+ |
data->GetXaxis()->SetBinLabel(5,"|#delta#phi(b,Z)|>2.7"); |
1850 |
+ |
data->GetXaxis()->SetBinLabel(6,"30<p_{T}^{Z}<1000 GeV"); |
1851 |
+ |
data->GetXaxis()->SetBinLabel(7,"#alpha < 0.3"); |
1852 |
+ |
data->GetXaxis()->SetBinLabel(8,"#alpha < 0.2"); |
1853 |
+ |
data->GetXaxis()->SetBinLabel(9,"#alpha < 0.15"); |
1854 |
+ |
data->GetXaxis()->SetBinLabel(10,"#alpha < 0.1"); |
1855 |
+ |
data->GetXaxis()->SetBinLabel(11,"#alpha < 0.05"); |
1856 |
+ |
data->GetXaxis()->LabelsOption("v"); |
1857 |
+ |
|
1858 |
+ |
stringstream purityinfo; |
1859 |
+ |
purityinfo << "Purity: " << std::setprecision(3) << 100*zb/mcsum << " %"; |
1860 |
+ |
stringstream neventsinfo; |
1861 |
+ |
neventsinfo << "Nevents: " << data->GetBinContent(data->GetNbinsX()); |
1862 |
+ |
TH1F *crap = new TH1F("crap","",1,0,1); |
1863 |
+ |
crap->SetLineColor(kWhite); |
1864 |
+ |
leg->AddEntry(crap,purityinfo.str().c_str(),"l"); |
1865 |
+ |
leg->AddEntry(crap,neventsinfo.str().c_str(),"l"); |
1866 |
+ |
|
1867 |
+ |
data->Draw("e1"); |
1868 |
+ |
mcm.Draw("histo,same"); |
1869 |
+ |
data->Draw("same,e1,axis"); |
1870 |
+ |
data->Draw("same,e1"); |
1871 |
+ |
// data->Draw("same,TEXT"); |
1872 |
+ |
|
1873 |
+ |
leg->Draw(); |
1874 |
+ |
|
1875 |
+ |
DrawPrelim(); |
1876 |
+ |
|
1877 |
+ |
CompleteSave(can,"CutFlow___"+identifier); |
1878 |
+ |
|
1879 |
+ |
delete crap; |
1880 |
+ |
delete data; |
1881 |
+ |
CleanLegends(); |
1882 |
+ |
DeleteStack(mcm); |
1883 |
+ |
|
1884 |
+ |
|
1885 |
+ |
} |