1 |
buchmann |
1.1 |
#include <iostream>
|
2 |
|
|
#include <vector>
|
3 |
|
|
#include <sys/stat.h>
|
4 |
|
|
|
5 |
|
|
#include <TCut.h>
|
6 |
|
|
#include <TROOT.h>
|
7 |
|
|
#include <TCanvas.h>
|
8 |
|
|
#include <TMath.h>
|
9 |
|
|
#include <TColor.h>
|
10 |
|
|
#include <TPaveText.h>
|
11 |
|
|
#include <TRandom.h>
|
12 |
|
|
#include <TH1.h>
|
13 |
|
|
#include <TH2.h>
|
14 |
|
|
#include <TF1.h>
|
15 |
|
|
#include <TSQLResult.h>
|
16 |
|
|
#include <TProfile.h>
|
17 |
|
|
#include <TLegendEntry.h>
|
18 |
|
|
|
19 |
|
|
using namespace std;
|
20 |
|
|
|
21 |
|
|
using namespace PlottingSetup;
|
22 |
|
|
|
23 |
|
|
namespace ZbData {
|
24 |
|
|
vector<float> data_over_mc;
|
25 |
|
|
|
26 |
buchmann |
1.10 |
TCut ZplusBsel("pt1>20&&pt2>20&&mll>60&&mll<120&&id1==id2");
|
27 |
buchmann |
1.9 |
TCut LeadingB("Zb3010_bTagProbCSVBP[0]>0.898");
|
28 |
|
|
TCut EtaB("abs(Zb3010_pfJetGoodEta[0])<1.3");
|
29 |
buchmann |
1.10 |
TCut PhiZcut("abs(Zb3010_pfJetDphiZ[0])>2.7");
|
30 |
buchmann |
1.1 |
|
31 |
|
|
}
|
32 |
|
|
|
33 |
buchmann |
1.15 |
class ZbPointResult {
|
34 |
|
|
public:
|
35 |
|
|
ZbPointResult(string var, float ptlow, float pthigh, float alphalow, float alphahigh, Value Data, Value MC);
|
36 |
|
|
float PtLow;
|
37 |
|
|
float PtHigh;
|
38 |
|
|
float AlphaLow;
|
39 |
|
|
float AlphaHigh;
|
40 |
|
|
string variable;
|
41 |
|
|
Value Data;
|
42 |
|
|
Value MC;
|
43 |
|
|
Value Ratio;
|
44 |
|
|
};
|
45 |
|
|
|
46 |
|
|
ZbPointResult::ZbPointResult(string var, float ptlow, float pthigh, float alphalow, float alphahigh, Value data, Value mc) :
|
47 |
|
|
variable(var), PtLow(ptlow), PtHigh(pthigh), AlphaLow(alphalow), AlphaHigh(alphahigh), Data(data), MC(mc) {
|
48 |
|
|
Ratio = data/mc;
|
49 |
|
|
}
|
50 |
|
|
|
51 |
|
|
std::ostream &operator<<(std::ostream &ostr, ZbPointResult &b)
|
52 |
|
|
{
|
53 |
|
|
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();
|
54 |
|
|
return ostr;
|
55 |
|
|
}
|
56 |
|
|
|
57 |
|
|
|
58 |
|
|
class ZbResultContainer {
|
59 |
|
|
public:
|
60 |
|
|
string name;
|
61 |
|
|
vector<ZbPointResult> MPF_Rabs_location;
|
62 |
|
|
Value MPF_Result_FaceValue;
|
63 |
|
|
Value Rabs_Result_FaceValue;
|
64 |
|
|
Value MPF_Result_Extrapolated;
|
65 |
|
|
Value Rabs_Result_Extrapolated;
|
66 |
|
|
|
67 |
|
|
ZbResultContainer(string name);
|
68 |
|
|
ZbResultContainer(const ZbResultContainer &old);
|
69 |
|
|
};
|
70 |
|
|
|
71 |
|
|
|
72 |
|
|
ZbResultContainer::ZbResultContainer(string _name) {
|
73 |
|
|
name=_name;
|
74 |
|
|
cout<< "Result Container for \"" << name << "\" has been initialized" << endl;
|
75 |
|
|
|
76 |
|
|
}
|
77 |
|
|
|
78 |
|
|
std::ostream &operator<<(std::ostream &ostr, ZbResultContainer &b)
|
79 |
|
|
{
|
80 |
|
|
ostr << "Results for " << b.name << endl;
|
81 |
|
|
ostr << " MPF and Rabs locations: " << endl;
|
82 |
|
|
for(int i=0;i<b.MPF_Rabs_location.size();i++) ostr << " " << b.MPF_Rabs_location[i] << endl;
|
83 |
|
|
ostr << " Results: " << endl;
|
84 |
|
|
ostr << " Face Value: " << endl;
|
85 |
|
|
ostr << " MPF " << b.MPF_Result_FaceValue << endl;
|
86 |
|
|
ostr << " Rabs " << b.Rabs_Result_FaceValue << endl;
|
87 |
|
|
ostr << " Extrapolated: " << endl;
|
88 |
|
|
ostr << " MPF " << b.MPF_Result_Extrapolated << endl;
|
89 |
|
|
ostr << " Rabs " << b.Rabs_Result_Extrapolated << endl;
|
90 |
|
|
|
91 |
|
|
return ostr;
|
92 |
|
|
}
|
93 |
|
|
|
94 |
|
|
|
95 |
|
|
|
96 |
buchmann |
1.1 |
using namespace ZbData;
|
97 |
|
|
|
98 |
buchmann |
1.7 |
|
99 |
|
|
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* DELETE EVERYTHING BETWEEN THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*//
|
100 |
|
|
void SpecialCutFlow(string identifier);
|
101 |
|
|
|
102 |
|
|
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* AND THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*//
|
103 |
|
|
|
104 |
|
|
|
105 |
buchmann |
1.1 |
void print_yield(TCut cut) {
|
106 |
|
|
TH1F *data = allsamples.Draw("data", "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,data,luminosity);
|
107 |
buchmann |
1.7 |
dout << " Yields for " << (const char*) cut << endl;
|
108 |
|
|
dout << " data: " << data->Integral() << endl;
|
109 |
buchmann |
1.9 |
THStack mcm = allsamples.DrawStack("mc", "mll",1,0,10000000, "m_{ll} [GeV]", "events", cut,mc,luminosity);
|
110 |
buchmann |
1.1 |
int nhists = mcm.GetHists()->GetEntries();
|
111 |
buchmann |
1.7 |
dout << "Going to loop over " << nhists << " histograms " << endl;
|
112 |
buchmann |
1.1 |
TFile *test = new TFile("test.root","RECREATE");
|
113 |
|
|
mcm.Write();
|
114 |
|
|
test->Close();
|
115 |
|
|
for (int i = 0; i < nhists; i++) {
|
116 |
|
|
TH1* hist = static_cast<TH1*>(mcm.GetHists()->At(i));
|
117 |
|
|
cout << " " << hist->GetName() << ": " << hist->Integral() << endl;
|
118 |
|
|
}
|
119 |
buchmann |
1.9 |
|
120 |
buchmann |
1.1 |
cout << endl << endl;
|
121 |
buchmann |
1.9 |
|
122 |
buchmann |
1.1 |
delete data;
|
123 |
|
|
}
|
124 |
|
|
|
125 |
buchmann |
1.2 |
void draw_kin_variable(string variable, TCut cut, int nbins, float min, float max, string xlabel, string saveas, bool dologscale, string speciallabel="") {
|
126 |
buchmann |
1.1 |
|
127 |
|
|
TCanvas *ckin = new TCanvas("ckin","kin variable canvas");
|
128 |
|
|
ckin->SetLogy(dologscale);
|
129 |
|
|
TH1F *datahisto = allsamples.Draw("datahisto",variable,nbins,min,max, xlabel, "events",cut,data,luminosity);
|
130 |
|
|
datahisto->SetMarkerSize(DataMarkerSize);
|
131 |
|
|
THStack mcstack = allsamples.DrawStack("mcstack",variable,nbins,min,max, xlabel, "events",cut,mc,luminosity);
|
132 |
buchmann |
1.2 |
if(dologscale) datahisto->SetMaximum(3*datahisto->GetMaximum());
|
133 |
|
|
else datahisto->SetMaximum(1.5*datahisto->GetMaximum());
|
134 |
|
|
TText *speciall;
|
135 |
|
|
if(speciallabel!="") {
|
136 |
|
|
speciall = new TText(0.2,0.8,speciallabel.c_str());
|
137 |
|
|
speciall->Draw();
|
138 |
|
|
}
|
139 |
buchmann |
1.1 |
datahisto->Draw("e1");
|
140 |
|
|
ckin->Update();
|
141 |
|
|
mcstack.Draw("same");
|
142 |
|
|
datahisto->Draw("same,e1");
|
143 |
|
|
TLegend *kinleg = allsamples.allbglegend();
|
144 |
|
|
kinleg->Draw();
|
145 |
|
|
|
146 |
|
|
TPad *kinpad = new TPad("kinpad","kinpad",0,0,1,1);
|
147 |
|
|
kinpad->cd();
|
148 |
|
|
kinpad->SetLogy(dologscale);
|
149 |
|
|
datahisto->Draw("e1");
|
150 |
|
|
mcstack.Draw("same");
|
151 |
|
|
datahisto->Draw("same,e1");
|
152 |
|
|
datahisto->Draw("same,axis");
|
153 |
|
|
kinleg->Draw();
|
154 |
|
|
DrawPrelim();
|
155 |
|
|
saveas="kin/"+saveas;
|
156 |
|
|
save_with_ratio(datahisto,mcstack,kinpad->cd(),saveas);
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
ZbData::data_over_mc.push_back(datahisto->Integral()/CollapseStack(mcstack)->Integral());
|
162 |
|
|
|
163 |
|
|
datahisto->Delete();
|
164 |
|
|
delete ckin;
|
165 |
|
|
}
|
166 |
|
|
|
167 |
|
|
void print_all_b_yields() {
|
168 |
|
|
cout << "Basic selection with a b jet" << endl;
|
169 |
buchmann |
1.9 |
print_yield(ZplusBsel&&"Zb3010_pfJetGoodNumBtag>0");
|
170 |
buchmann |
1.2 |
cout << "Leading jet is a b-jet " << endl;
|
171 |
buchmann |
1.1 |
print_yield(ZplusBsel&&LeadingB);
|
172 |
|
|
cout << "|#eta_{b}|<1.3 " << endl;
|
173 |
|
|
print_yield(ZplusBsel&&LeadingB&&EtaB);
|
174 |
|
|
cout << "|#delta#phi(b<Z)|>2.7" << endl;
|
175 |
|
|
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
|
176 |
buchmann |
1.2 |
cout << "10<ptZ<1000 GeV" << endl;
|
177 |
buchmann |
1.1 |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000");
|
178 |
buchmann |
1.13 |
cout << "#alpha < 0.35" << endl;
|
179 |
|
|
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.35");
|
180 |
buchmann |
1.1 |
cout << "#alpha < 0.3" << endl;
|
181 |
buchmann |
1.9 |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.3");
|
182 |
buchmann |
1.1 |
cout << "#alpha < 0.2" << endl;
|
183 |
buchmann |
1.9 |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.2");
|
184 |
buchmann |
1.1 |
cout << "#alpha < 0.15" << endl;
|
185 |
buchmann |
1.9 |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.15");
|
186 |
buchmann |
1.1 |
cout << "#alpha < 0.1" << endl;
|
187 |
buchmann |
1.9 |
print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.1");
|
188 |
|
|
// cout << "#alpha < 0.05" << endl;
|
189 |
|
|
// print_yield(ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"(Zb3010_alpha)<0.05");
|
190 |
buchmann |
1.1 |
}
|
191 |
|
|
|
192 |
buchmann |
1.15 |
void TEST_DrawEvilCutFlow() {
|
193 |
buchmann |
1.7 |
stringstream MegaCut;
|
194 |
|
|
|
195 |
buchmann |
1.9 |
MegaCut << " 1*(" << (const char*) (ZplusBsel&&TCut("Zb3010_pfJetGoodNumBtag>0")) << ")";
|
196 |
buchmann |
1.7 |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB) << ")";
|
197 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB) << ")";
|
198 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut) << ")";
|
199 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000")) << ")";
|
200 |
buchmann |
1.9 |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.3")) << ")";
|
201 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.2")) << ")";
|
202 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.15")) << ")";
|
203 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.1")) << ")";
|
204 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut("pt>10&&pt<1000&&Zb3010_alpha<0.05")) << ")";
|
205 |
buchmann |
1.7 |
MegaCut << " ";
|
206 |
|
|
|
207 |
|
|
TCanvas *can = new TCanvas("can","can");
|
208 |
|
|
can->SetLogy(1);
|
209 |
|
|
TCut basecut("mll>6||mll<10");
|
210 |
|
|
|
211 |
|
|
|
212 |
|
|
|
213 |
|
|
TLegend *leg = allsamples.allbglegend();
|
214 |
|
|
|
215 |
|
|
|
216 |
|
|
TH1F *data = allsamples.Draw("data", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity);
|
217 |
|
|
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
|
218 |
|
|
|
219 |
|
|
float runningsum=0;
|
220 |
|
|
for(int i=data->GetNbinsX();i>0;i--) {
|
221 |
|
|
runningsum+=data->GetBinContent(i);
|
222 |
|
|
data->SetBinContent(i,runningsum);
|
223 |
|
|
}
|
224 |
|
|
|
225 |
|
|
float minimum=data->GetMaximum();
|
226 |
|
|
|
227 |
|
|
TH1F* h;
|
228 |
|
|
TIter nextOF(mcm.GetHists());
|
229 |
|
|
while ( h = (TH1F*)nextOF() ) {
|
230 |
|
|
float runningsum=0;
|
231 |
|
|
minimum=data->GetMaximum();//done deliberately at each step so get the minimum of the last (!) contribution
|
232 |
|
|
for(int i=h->GetNbinsX();i>0;i--) {
|
233 |
|
|
runningsum+=h->GetBinContent(i);
|
234 |
|
|
h->SetBinContent(i,runningsum);
|
235 |
|
|
if(runningsum<minimum&&runningsum>0) minimum=runningsum;
|
236 |
|
|
}
|
237 |
|
|
}
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
|
241 |
|
|
data->SetMinimum(0.05*minimum);
|
242 |
|
|
can->cd(1)->SetBottomMargin(0.25);
|
243 |
|
|
data->GetXaxis()->SetBinLabel(1,"Pre-selection");
|
244 |
|
|
data->GetXaxis()->SetBinLabel(2,"Contains b jet");
|
245 |
|
|
data->GetXaxis()->SetBinLabel(3,"Leading jet is b-jet");
|
246 |
|
|
data->GetXaxis()->SetBinLabel(4,"|#eta_{b}|<1.3 ");
|
247 |
|
|
data->GetXaxis()->SetBinLabel(5,"|#delta#phi(b,Z)|>2.7");
|
248 |
|
|
data->GetXaxis()->SetBinLabel(6,"10<p_{T}^{Z}<1000 GeV");
|
249 |
|
|
data->GetXaxis()->SetBinLabel(7,"#alpha < 0.3");
|
250 |
|
|
data->GetXaxis()->SetBinLabel(8,"#alpha < 0.2");
|
251 |
|
|
data->GetXaxis()->SetBinLabel(9,"#alpha < 0.15");
|
252 |
|
|
data->GetXaxis()->SetBinLabel(10,"#alpha < 0.1");
|
253 |
|
|
data->GetXaxis()->SetBinLabel(11,"#alpha < 0.05");
|
254 |
|
|
data->GetXaxis()->LabelsOption("v");
|
255 |
|
|
|
256 |
|
|
data->Draw("e1");
|
257 |
|
|
mcm.Draw("same");
|
258 |
|
|
data->Draw("same,e1,axis");
|
259 |
|
|
data->Draw("same,e1");
|
260 |
|
|
// data->Draw("same,TEXT");
|
261 |
|
|
|
262 |
|
|
leg->Draw();
|
263 |
|
|
|
264 |
|
|
DrawPrelim();
|
265 |
|
|
|
266 |
|
|
CompleteSave(can,"CutFlow");
|
267 |
|
|
}
|
268 |
|
|
|
269 |
buchmann |
1.1 |
void draw_Zb_kin_vars() {
|
270 |
buchmann |
1.6 |
draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Z p_{T}","Official/Zpt",1);
|
271 |
buchmann |
1.9 |
draw_kin_variable("Zb3010_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Sub-Leading Jet Pt","Official/Jet2Pt",1);
|
272 |
|
|
draw_kin_variable("Zb3010_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",25,0,200,"Leading Jet Pt (B)","Official/LeadingJetPt",1);
|
273 |
|
|
draw_kin_variable("Zb3010_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/SubLeadingJetPt_Over_ZPt",1);
|
274 |
|
|
draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<50", 40,0,2,"#alpha","Official/alpha_pt_30_to_50",1);
|
275 |
|
|
draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>50&&pt<75", 40,0,2,"#alpha","Official/alpha_50_to_75",1);
|
276 |
|
|
draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>75&&pt<125", 40,0,2,"#alpha","Official/alpha_pt_75_to_125",1);
|
277 |
|
|
draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>125&&pt<1000",40,0,2,"#alpha","Official/alpha_pt_125_to_1000",1);
|
278 |
|
|
draw_kin_variable("Zb3010_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>30&&pt<1000",40,0,2,"#alpha","Official/alpha_pt_30_to_1000",1);
|
279 |
buchmann |
1.6 |
|
280 |
buchmann |
1.10 |
draw_kin_variable("Zb3010_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>10&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","DeltaPhiZBlead",0);
|
281 |
buchmann |
1.6 |
|
282 |
|
|
/*
|
283 |
|
|
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,200,"p_{T}^{l1}","Lep/pt1",1);
|
284 |
|
|
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==0",20,0,200,"p_{T}^{e1}","Lep/pt1_e",1);
|
285 |
|
|
draw_kin_variable("pt1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==1",20,0,200,"p_{T}^{#mu1}","Lep/pt1_m",1);
|
286 |
|
|
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,200,"p_{T}^{l2}","Lep/pt2",1);
|
287 |
|
|
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==0",20,0,200,"p_{T}^{e2}","Lep/pt2_e",1);
|
288 |
|
|
draw_kin_variable("pt2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==1",20,0,200,"p_{T}^{#mu2}","Lep/pt2_m",1);
|
289 |
|
|
draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta1",1);
|
290 |
|
|
draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==0",20,-3.1,3.1,"#eta^{e1}","Lep/eta1_e",1);
|
291 |
|
|
draw_kin_variable("eta1",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id1==1",20,-3.1,3.1,"#eta^{m1}","Lep/eta1_m",1);
|
292 |
|
|
draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,-3.1,3.1,"#eta^{l1}","Lep/eta2",1);
|
293 |
|
|
draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==0",20,-3.1,3.1,"#eta^{e2}","Lep/eta2_e",1);
|
294 |
|
|
draw_kin_variable("eta2",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000&&id2==1",20,-3.1,3.1,"#eta^{#mu2}","Lep/eta2_m",1);
|
295 |
|
|
draw_kin_variable("numVtx",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",30,0,30,"N(Vtx)","Lep/nVtx",1);
|
296 |
|
|
*/
|
297 |
buchmann |
1.1 |
}
|
298 |
|
|
|
299 |
|
|
void draw_mpf_vars() {
|
300 |
|
|
ZbData::data_over_mc.clear();
|
301 |
buchmann |
1.9 |
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.3",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
302 |
|
|
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.2",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
303 |
|
|
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.15",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
304 |
|
|
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.1",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
305 |
|
|
draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.05",20,0,2,"Z+b MPF","mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
306 |
|
|
|
307 |
|
|
draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.3",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p3",0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
308 |
|
|
draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.2",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p2",0,"#alpha<0.2, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
309 |
|
|
draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.15",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p15",0,"#alpha<0.15, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
310 |
|
|
draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.1",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz___alpha_smaller_0p1",0,"#alpha<0.1, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
311 |
|
|
draw_kin_variable("Zb3010_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000"&&"Zb3010_alpha<0.05",20,0,2,"p_{T} b-jet / p_{T} Z","ptb_over_ptz__mpf_alpha_smaller_0p05",0,"#alpha<0.05, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
312 |
buchmann |
1.1 |
}
|
313 |
|
|
|
314 |
buchmann |
1.12 |
/*double GetMedian(TH1F *histo) {
|
315 |
buchmann |
1.11 |
int numBins = histo->GetXaxis()->GetNbins();
|
316 |
buchmann |
1.12 |
Double_t x[numBins];
|
317 |
|
|
Double_t y[numBins];
|
318 |
buchmann |
1.11 |
for (int i = 1; i <= numBins; i++) {
|
319 |
|
|
x[i] = histo->GetBinCenter(i);
|
320 |
|
|
y[i] = histo->GetBinContent(i);
|
321 |
|
|
}
|
322 |
buchmann |
1.12 |
return TMath::Median(numBins, &x, &y);
|
323 |
|
|
}*/
|
324 |
buchmann |
1.11 |
|
325 |
buchmann |
1.16 |
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) {
|
326 |
buchmann |
1.2 |
// write_warning(__FUNCTION__,"Debugging this function, therefore always returning 3.1415+/-1.010101"); return Value(3.1415,1.010101);
|
327 |
buchmann |
1.12 |
TCanvas *cn = new TCanvas("cn","cn");
|
328 |
|
|
string varname="MPF";
|
329 |
|
|
if(Contains(variable,"pfJetGood")) varname="R_{abs}";
|
330 |
|
|
TH1F *hdata = allsamples.Draw("hdata",variable,1200,0,30, varname, "events", cut,data,luminosity);
|
331 |
|
|
TH1F *hmc = allsamples.Draw("hmc" , variable,1200,0,30, varname, "events", cut, mc, luminosity);
|
332 |
buchmann |
1.14 |
hmc->SetLineColor(kBlue);
|
333 |
|
|
|
334 |
buchmann |
1.10 |
float a=hdata->GetMean();
|
335 |
buchmann |
1.2 |
float b=hmc->GetMean();
|
336 |
|
|
float da=hdata->GetMeanError();
|
337 |
buchmann |
1.10 |
float db=hmc->GetMeanError();
|
338 |
buchmann |
1.2 |
float factor = a / b;
|
339 |
|
|
float error = TMath::Sqrt( (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db);
|
340 |
buchmann |
1.12 |
|
341 |
buchmann |
1.14 |
TF1 *gaus_data = new TF1("gaus_data","gaus",0.7,1.3);
|
342 |
|
|
gaus_data->SetParameter(0,hdata->GetMaximum());
|
343 |
|
|
gaus_data->SetParameter(2,hdata->GetMean());
|
344 |
|
|
gaus_data->SetParameter(1,hdata->GetRMS());
|
345 |
|
|
hdata->Fit(gaus_data);
|
346 |
|
|
TF1 *gaus_mc = new TF1("gaus_mc","gaus",0.7,1.3);
|
347 |
|
|
gaus_mc->SetParameter(0,hmc->GetMaximum());
|
348 |
|
|
gaus_mc->SetParameter(1,hmc->GetMean());
|
349 |
|
|
gaus_mc->SetParameter(2,hmc->GetRMS());
|
350 |
|
|
hmc->Fit(gaus_mc);
|
351 |
|
|
|
352 |
|
|
|
353 |
buchmann |
1.12 |
cn->cd();
|
354 |
|
|
hdata->GetYaxis()->SetTitle("events / 0.1");
|
355 |
buchmann |
1.14 |
hdata->SetMarkerColor(kRed);
|
356 |
|
|
/* hdata->Rebin(4);
|
357 |
buchmann |
1.12 |
hmc->Rebin(4);
|
358 |
buchmann |
1.14 |
|
359 |
|
|
gaus_mc->SetParameter(0,gaus_mc->GetParameter(0)*4);//rebinning
|
360 |
|
|
gaus_data->SetParameter(0,gaus_data->GetParameter(0)*4);//rebinning
|
361 |
|
|
*/
|
362 |
|
|
gaus_mc->SetLineColor(kBlue);
|
363 |
|
|
gaus_data->SetLineColor(kRed);
|
364 |
|
|
|
365 |
buchmann |
1.12 |
hdata->GetXaxis()->SetRangeUser(0,2);
|
366 |
buchmann |
1.16 |
hdata->GetYaxis()->SetTitleOffset(1.3);
|
367 |
buchmann |
1.12 |
hdata->Draw("e1");
|
368 |
|
|
hmc->Draw("histo,same");
|
369 |
|
|
hdata->Draw("e1,same");
|
370 |
buchmann |
1.14 |
gaus_data->Draw("same");
|
371 |
|
|
gaus_mc->Draw("same");
|
372 |
buchmann |
1.12 |
stringstream summary;
|
373 |
buchmann |
1.16 |
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 << "}{";
|
374 |
buchmann |
1.14 |
summary << "#splitline{mc: " << std::setprecision(4) << b << " #pm " << std::setprecision(4) << db << "}{#splitline{ratio: " << factor;
|
375 |
|
|
summary << " #pm " << error << "}{#splitline{}{#splitline{data fit: " << std::setprecision(4) << gaus_data->GetParameter(1) << "+/-";
|
376 |
|
|
summary << std::setprecision(4) << gaus_data->GetParError(1) << "}{#splitline{";
|
377 |
buchmann |
1.17 |
summary << "mc fit:" << std::setprecision(4) << gaus_mc->GetParameter(1) << "#pm" << std::setprecision(4) << gaus_mc->GetParError(1) << "}{ratio: ";
|
378 |
|
|
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)) ) << "}}}}}}}}";
|
379 |
buchmann |
1.16 |
|
380 |
buchmann |
1.12 |
TText *infobox = write_title(summary.str());
|
381 |
|
|
infobox->SetX(0.75);
|
382 |
|
|
infobox->SetTextSize(0.03);
|
383 |
|
|
infobox->SetY(0.75);
|
384 |
|
|
infobox->Draw();
|
385 |
|
|
|
386 |
|
|
|
387 |
|
|
DrawPrelim();
|
388 |
buchmann |
1.16 |
CompleteSave(cn,ContainerName+"/ResponsePlots/"+saveas);
|
389 |
buchmann |
1.12 |
|
390 |
buchmann |
1.15 |
res.MPF_Rabs_location.push_back(ZbPointResult(variable,pt1,pt2,a1,a2,Value(a,da),Value(b,db)));
|
391 |
buchmann |
1.12 |
cout << "Data;" << a << ";"<<da<<";MC"<<b<<";"<<db<<endl;
|
392 |
|
|
delete cn;
|
393 |
buchmann |
1.2 |
delete hdata;
|
394 |
|
|
delete hmc;
|
395 |
buchmann |
1.9 |
|
396 |
buchmann |
1.2 |
return Value(factor,error);
|
397 |
|
|
}
|
398 |
|
|
|
399 |
buchmann |
1.17 |
int nFakes=1;
|
400 |
|
|
ZbResultContainer Fake_new_data_mc_agreement_2d(string AlphaVariable, string ContainerName, TCut BTagCut, TCut BTagWgt) {
|
401 |
|
|
write_warning(__FUNCTION__,"You are using the fake way to extract the correction ... ");
|
402 |
|
|
nFakes++;
|
403 |
|
|
ZbResultContainer results(ContainerName);
|
404 |
|
|
|
405 |
|
|
|
406 |
|
|
results.MPF_Result_FaceValue=Value(1+nFakes*0.02,0.03);
|
407 |
|
|
results.Rabs_Result_FaceValue=Value(2,0.02);
|
408 |
|
|
results.MPF_Result_Extrapolated=Value(3,0.03);
|
409 |
|
|
results.Rabs_Result_Extrapolated=Value(4,0.04);
|
410 |
|
|
cout << "The fake result for " << ContainerName << " for the MPF face value is " << results.MPF_Result_FaceValue << endl;
|
411 |
|
|
|
412 |
|
|
return results;
|
413 |
|
|
}
|
414 |
|
|
|
415 |
|
|
|
416 |
buchmann |
1.15 |
ZbResultContainer new_data_mc_agreement_2d(string AlphaVariable, string ContainerName, TCut BTagCut, TCut BTagWgt) {
|
417 |
|
|
ZbResultContainer results(ContainerName);
|
418 |
buchmann |
1.2 |
|
419 |
buchmann |
1.15 |
cutWeight=TCut("(weight*(weight<1000)*(is_data+(!is_data)))")*BTagWgt;
|
420 |
|
|
LeadingB=BTagCut;
|
421 |
buchmann |
1.13 |
|
422 |
buchmann |
1.3 |
gStyle->SetOptFit(0);
|
423 |
buchmann |
1.2 |
TCut basecut(ZplusBsel&&LeadingB&&EtaB&&PhiZcut);
|
424 |
buchmann |
1.17 |
const int nalphacuts=6;
|
425 |
|
|
float alphacuts[nalphacuts] = {0.1,0.15,0.2,0.25,0.3,0.35};
|
426 |
buchmann |
1.15 |
|
427 |
buchmann |
1.17 |
const int nptcuts=5;
|
428 |
|
|
float ptcuts[nptcuts]={30,50,75,125,1000};
|
429 |
buchmann |
1.15 |
|
430 |
buchmann |
1.5 |
|
431 |
buchmann |
1.2 |
|
432 |
|
|
float MPF_Results[nalphacuts][nptcuts];
|
433 |
|
|
float MPF_Errors[nalphacuts][nptcuts];
|
434 |
|
|
float RABS_Results[nalphacuts][nptcuts];
|
435 |
|
|
float RABS_Errors[nalphacuts][nptcuts];
|
436 |
|
|
|
437 |
|
|
|
438 |
buchmann |
1.9 |
for(int ia=0;ia<nalphacuts;ia++) {
|
439 |
buchmann |
1.2 |
for(int ipt=0;ipt<nptcuts-1;ipt++) {
|
440 |
|
|
stringstream specialcut;
|
441 |
buchmann |
1.15 |
float alow,ahigh;
|
442 |
|
|
if(ia>0) {
|
443 |
|
|
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (" << AlphaVariable << "<" << alphacuts[ia] << " && " << AlphaVariable << ">" << alphacuts[ia-1] << "))";
|
444 |
|
|
alow=alphacuts[ia-1];
|
445 |
|
|
ahigh=alphacuts[ia];
|
446 |
|
|
} else {
|
447 |
|
|
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (" << AlphaVariable << "<" << alphacuts[ia] << "))";
|
448 |
|
|
alow=0;
|
449 |
|
|
ahigh=alphacuts[ia];
|
450 |
|
|
}
|
451 |
buchmann |
1.9 |
cout << specialcut.str() << endl;
|
452 |
buchmann |
1.16 |
Value MPF_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"mpf","",TCut(basecut && specialcut.str().c_str()),"MPF___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia]), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh);
|
453 |
|
|
Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"Zb3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__alpha_"+any2string(alphacuts[ia]), ptcuts[ipt], ptcuts[ipt+1],alow,ahigh);
|
454 |
buchmann |
1.2 |
|
455 |
|
|
MPF_Results[ia][ipt]=MPF_data_over_mc.getValue();
|
456 |
|
|
MPF_Errors[ia][ipt]=MPF_data_over_mc.getError();
|
457 |
|
|
|
458 |
|
|
RABS_Results[ia][ipt]=RABS_data_over_mc.getValue();
|
459 |
|
|
RABS_Errors[ia][ipt]=RABS_data_over_mc.getError();
|
460 |
|
|
|
461 |
buchmann |
1.9 |
cout << "alpha cut at " << alphacuts[ia+1] << " and pt range " << ptcuts[ipt] << " , " << ptcuts[ipt+1] << " \t : \t" << specialcut.str() << " \t \t --> " << MPF_data_over_mc << " (MPF) " << RABS_data_over_mc << " (RABS)" << endl;
|
462 |
buchmann |
1.2 |
}
|
463 |
|
|
}
|
464 |
|
|
|
465 |
|
|
float MPF_ExtraPolatedResults[nptcuts];
|
466 |
|
|
float RABS_ExtraPolatedResults[nptcuts];
|
467 |
|
|
|
468 |
|
|
TCanvas *can = new TCanvas("can");
|
469 |
buchmann |
1.14 |
can->cd(1)->SetLeftMargin(0.15);
|
470 |
buchmann |
1.2 |
|
471 |
|
|
TGraphErrors *MPF_FinalGraph = new TGraphErrors();
|
472 |
|
|
TGraphErrors *RABS_FinalGraph = new TGraphErrors();
|
473 |
buchmann |
1.13 |
TGraphErrors *MPF_FaceValueAtPoint3 = new TGraphErrors();
|
474 |
|
|
TGraphErrors *RABS_FaceValueAtPoint3 = new TGraphErrors();
|
475 |
buchmann |
1.2 |
|
476 |
|
|
for(int ipt=0;ipt<nptcuts-1;ipt++) {
|
477 |
|
|
|
478 |
|
|
stringstream filename;
|
479 |
|
|
filename << "Extrapolation/Zplusb_data_over_mc___" << ptcuts[ipt] << "_to_" << ptcuts[ipt+1];
|
480 |
|
|
cout << "Going to create histo for " << filename.str() << endl;
|
481 |
|
|
TGraphErrors *mpf_gr =new TGraphErrors();
|
482 |
|
|
TGraphErrors *rabs_gr =new TGraphErrors();
|
483 |
buchmann |
1.13 |
|
484 |
|
|
int rabs_counter=0;
|
485 |
|
|
int mpf_counter=0;
|
486 |
|
|
|
487 |
buchmann |
1.2 |
for(int ia=0;ia<nalphacuts;ia++) {
|
488 |
buchmann |
1.9 |
cout << "Setting a point for an alpha cut at " << alphacuts[ia] << " with value " << MPF_Results[ia][ipt] << " (MPF) and " << RABS_Results[ia][ipt] << " (RABS)" << endl;
|
489 |
buchmann |
1.13 |
if(MPF_Results[ia][ipt]==MPF_Results[ia][ipt] && MPF_Errors[ia][ipt]==MPF_Errors[ia][ipt]) { // remove nan's
|
490 |
|
|
mpf_gr->SetPoint(mpf_counter,alphacuts[ia],MPF_Results[ia][ipt]);
|
491 |
|
|
mpf_gr->SetPointError(mpf_counter,0,MPF_Errors[ia][ipt]);
|
492 |
|
|
mpf_counter++;
|
493 |
|
|
} else {
|
494 |
|
|
dout << "Detected BS for MPF method (bin ignored) : " << endl;
|
495 |
|
|
dout << " alpha: " << alphacuts[ia] << " , pt range: " << ptcuts[ipt] << " < pt < " << ptcuts[ipt+1] << endl;
|
496 |
|
|
cout << " value (MPF) : " << MPF_Results[ia][ipt] << " +/- " << MPF_Errors[ia][ipt] << endl;
|
497 |
|
|
}
|
498 |
|
|
if(RABS_Results[ia][ipt]==RABS_Results[ia][ipt] && RABS_Errors[ia][ipt]==RABS_Errors[ia][ipt]) {
|
499 |
|
|
rabs_gr->SetPoint(rabs_counter,alphacuts[ia],RABS_Results[ia][ipt]);
|
500 |
|
|
rabs_gr->SetPointError(rabs_counter,0,RABS_Errors[ia][ipt]);
|
501 |
|
|
rabs_counter++;
|
502 |
|
|
} else {
|
503 |
|
|
dout << "Detected BS for RABS method (bin ignored) : " << endl;
|
504 |
|
|
dout << " alpha: " << alphacuts[ia] << " , pt range: " << ptcuts[ipt] << " < pt < " << ptcuts[ipt+1] << endl;
|
505 |
|
|
cout << " value (RABS) : " << RABS_Results[ia][ipt] << " +/- " << RABS_Errors[ia][ipt] << endl;
|
506 |
|
|
}
|
507 |
|
|
}
|
508 |
|
|
|
509 |
|
|
stringstream specialcut;
|
510 |
buchmann |
1.15 |
specialcut << "((pt>" << ptcuts[ipt] << " && pt< " << ptcuts[ipt+1] << ") && (" << AlphaVariable << "<0.3))";
|
511 |
buchmann |
1.16 |
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_0.3",ptcuts[ipt],ptcuts[ipt+1],0,0.3);
|
512 |
|
|
Value RABS_data_over_mc = get_Zb_data_over_mc(ContainerName,results,"Zb3010_pfJetGoodPt[0]/pt","",TCut(basecut && specialcut.str().c_str()),"Rabs___pt_"+any2string(ptcuts[ipt])+"_"+any2string(ptcuts[ipt+1])+"__INCLUSIVEalpha_0.3",ptcuts[ipt],ptcuts[ipt+1],0,0.3);
|
513 |
buchmann |
1.14 |
cout << "About to add a point in pt (" << (ptcuts[ipt]+ptcuts[ipt+1])/2 << " ) to face value : " << MPF_data_over_mc << " (MPF) , " << RABS_data_over_mc << "(RABS)" << endl;
|
514 |
buchmann |
1.13 |
MPF_FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1])/2,MPF_data_over_mc.getValue());
|
515 |
|
|
MPF_FaceValueAtPoint3->SetPointError(ipt,0,MPF_data_over_mc.getError());
|
516 |
|
|
RABS_FaceValueAtPoint3->SetPoint(ipt,(ptcuts[ipt]+ptcuts[ipt+1])/2,RABS_data_over_mc.getValue());
|
517 |
|
|
RABS_FaceValueAtPoint3->SetPointError(ipt,0,RABS_data_over_mc.getError());
|
518 |
buchmann |
1.2 |
|
519 |
buchmann |
1.13 |
can->cd();
|
520 |
buchmann |
1.2 |
mpf_gr->SetMarkerStyle(21);
|
521 |
|
|
mpf_gr->SetMarkerColor(kBlue);
|
522 |
|
|
mpf_gr->Draw("AP");
|
523 |
buchmann |
1.13 |
mpf_gr->Fit("pol1","");
|
524 |
buchmann |
1.3 |
mpf_gr->GetXaxis()->SetTitle("#alpha");
|
525 |
|
|
mpf_gr->GetXaxis()->CenterTitle();
|
526 |
buchmann |
1.9 |
mpf_gr->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
|
527 |
buchmann |
1.3 |
mpf_gr->GetYaxis()->CenterTitle();
|
528 |
buchmann |
1.2 |
TF1 *mpf_pol=(TF1*)mpf_gr->GetFunction("pol1");
|
529 |
buchmann |
1.14 |
mpf_pol->SetLineWidth(0);
|
530 |
buchmann |
1.13 |
TF1 *mpf_pol_complete = new TF1("mpf_pol_complete","[0]+[1]*x");
|
531 |
|
|
mpf_pol_complete->SetParameters(mpf_pol->GetParameters());
|
532 |
|
|
mpf_pol_complete->SetLineWidth(1);
|
533 |
|
|
mpf_pol_complete->SetLineColor(kBlue);
|
534 |
|
|
float min,max;
|
535 |
|
|
FindMinMax(mpf_gr,min,max);
|
536 |
|
|
TH1F *histo = new TH1F("histo","histo",1,0,0.4);
|
537 |
buchmann |
1.14 |
histo->GetXaxis()->SetTitle("#alpha");
|
538 |
|
|
histo->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
|
539 |
|
|
histo->GetXaxis()->CenterTitle();
|
540 |
|
|
histo->GetYaxis()->CenterTitle();
|
541 |
buchmann |
1.16 |
histo->GetYaxis()->SetTitleOffset(1.3);
|
542 |
buchmann |
1.13 |
histo->SetStats(0);
|
543 |
|
|
histo->GetXaxis()->SetRangeUser(0,0.4);
|
544 |
|
|
histo->GetYaxis()->SetRangeUser(min,max);
|
545 |
|
|
mpf_gr->GetYaxis()->SetRangeUser(min,max);
|
546 |
|
|
|
547 |
|
|
TPolyLine *mpf_fit_uncert = GetFitUncertaintyShape(mpf_gr, "pol1", min, max,0.0,0.4);
|
548 |
|
|
mpf_pol->SetLineColor(TColor::GetColor("#0101DF"));
|
549 |
buchmann |
1.14 |
mpf_fit_uncert->SetFillColor(TColor::GetColor("#5353FC"));
|
550 |
|
|
histo->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
|
551 |
buchmann |
1.13 |
histo->Draw();
|
552 |
buchmann |
1.14 |
mpf_fit_uncert->Draw("F");
|
553 |
|
|
mpf_fit_uncert->Draw("");
|
554 |
buchmann |
1.13 |
mpf_gr->Draw("P");
|
555 |
|
|
mpf_pol_complete->Draw("same");
|
556 |
|
|
|
557 |
buchmann |
1.2 |
float mpf_a=mpf_pol->GetParameter(0);
|
558 |
|
|
float mpf_b=mpf_pol->GetParameter(1);
|
559 |
|
|
MPF_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),mpf_a);
|
560 |
|
|
MPF_FinalGraph->SetPointError(ipt,0,mpf_pol->GetParError(0));
|
561 |
|
|
|
562 |
|
|
MPF_ExtraPolatedResults[ipt]=mpf_a;
|
563 |
|
|
|
564 |
|
|
stringstream mpf_info;
|
565 |
buchmann |
1.14 |
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() << "}";
|
566 |
buchmann |
1.3 |
|
567 |
buchmann |
1.2 |
TText *mpf_mark = write_title(mpf_info.str());
|
568 |
|
|
mpf_mark->SetX(0.75);
|
569 |
|
|
mpf_mark->SetTextSize(0.03);
|
570 |
|
|
mpf_mark->SetY(0.75);
|
571 |
|
|
mpf_mark->Draw();
|
572 |
|
|
|
573 |
|
|
string filenamebkp=filename.str();
|
574 |
|
|
filename << "__MPF";
|
575 |
buchmann |
1.3 |
DrawPrelim();
|
576 |
buchmann |
1.15 |
CompleteSave(can,ContainerName+"/"+filename.str());
|
577 |
buchmann |
1.2 |
cout << "MPF : " << mpf_a << " + " << mpf_b << " * alpha " << endl;
|
578 |
|
|
|
579 |
|
|
filename.str("");
|
580 |
|
|
|
581 |
|
|
rabs_gr->SetMarkerStyle(21);
|
582 |
buchmann |
1.13 |
rabs_gr->SetMarkerColor(kRed);
|
583 |
buchmann |
1.2 |
rabs_gr->Draw("AP");
|
584 |
buchmann |
1.13 |
rabs_gr->Fit("pol1","");
|
585 |
buchmann |
1.3 |
rabs_gr->GetXaxis()->SetTitle("#alpha");
|
586 |
|
|
rabs_gr->GetXaxis()->CenterTitle();
|
587 |
buchmann |
1.14 |
rabs_gr->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}");
|
588 |
buchmann |
1.3 |
rabs_gr->GetYaxis()->CenterTitle();
|
589 |
buchmann |
1.13 |
TF1 *rabs_pol=(TF1*)rabs_gr->GetFunction("pol1");
|
590 |
buchmann |
1.14 |
rabs_pol->SetLineWidth(0);
|
591 |
buchmann |
1.13 |
TF1 *rabs_pol_complete = new TF1("rabs_pol_complete","[0]+[1]*x");
|
592 |
|
|
rabs_pol_complete->SetParameters(rabs_pol->GetParameters());
|
593 |
|
|
rabs_pol_complete->SetLineColor(kRed);
|
594 |
|
|
rabs_pol_complete->SetLineWidth(1);
|
595 |
|
|
FindMinMax(rabs_gr,min,max);
|
596 |
|
|
rabs_gr->GetYaxis()->SetRangeUser(min,max);
|
597 |
|
|
histo->GetYaxis()->SetRangeUser(min,max);
|
598 |
|
|
TPolyLine *rabs_fit_uncert = GetFitUncertaintyShape(rabs_gr, "pol1", min, max,0.0,0.4);
|
599 |
buchmann |
1.14 |
rabs_pol->SetLineColor(TColor::GetColor("#FA5858"));
|
600 |
|
|
rabs_pol->SetFillColor(TColor::GetColor("#FA5858"));
|
601 |
|
|
rabs_fit_uncert->SetLineColor(TColor::GetColor("#FA5858"));
|
602 |
|
|
rabs_fit_uncert->SetFillColor(TColor::GetColor("#FA5858"));
|
603 |
|
|
histo->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}");
|
604 |
buchmann |
1.13 |
histo->Draw();
|
605 |
buchmann |
1.14 |
rabs_fit_uncert->Draw("F");
|
606 |
|
|
rabs_fit_uncert->Draw("");
|
607 |
buchmann |
1.13 |
rabs_gr->Draw("P");
|
608 |
|
|
rabs_pol_complete->Draw("same");
|
609 |
|
|
|
610 |
buchmann |
1.3 |
|
611 |
buchmann |
1.2 |
float rabs_a=rabs_pol->GetParameter(0);
|
612 |
|
|
float rabs_b=rabs_pol->GetParameter(1);
|
613 |
|
|
RABS_FinalGraph->SetPoint(ipt,0.5*(ptcuts[ipt]+ptcuts[ipt+1]),rabs_a);
|
614 |
|
|
RABS_FinalGraph->SetPointError(ipt,0,rabs_pol->GetParError(0));
|
615 |
buchmann |
1.3 |
|
616 |
buchmann |
1.2 |
cout << "!+!+!+!+!+!+!+!+!+ Just added a point to the final plot : " << rabs_a << " +/- " << rabs_pol->GetParError(0) << endl;
|
617 |
|
|
|
618 |
|
|
stringstream rabs_info;
|
619 |
buchmann |
1.14 |
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() << "}";
|
620 |
buchmann |
1.2 |
TText *rabs_mark = write_title(rabs_info.str());
|
621 |
|
|
rabs_mark->SetX(0.75);
|
622 |
|
|
rabs_mark->SetTextSize(0.03);
|
623 |
|
|
rabs_mark->SetY(0.75);
|
624 |
|
|
rabs_mark->Draw();
|
625 |
buchmann |
1.3 |
|
626 |
|
|
|
627 |
buchmann |
1.2 |
RABS_ExtraPolatedResults[ipt]=rabs_a;
|
628 |
|
|
filename << filenamebkp << "__RABS";
|
629 |
buchmann |
1.3 |
DrawPrelim();
|
630 |
buchmann |
1.15 |
CompleteSave(can,ContainerName+"/"+filename.str());
|
631 |
buchmann |
1.2 |
cout << "RABS : " << rabs_a << " + " << rabs_b << " * alpha " << endl;
|
632 |
|
|
}
|
633 |
|
|
|
634 |
|
|
MPF_FinalGraph->SetMarkerStyle(21);
|
635 |
buchmann |
1.13 |
MPF_FinalGraph->SetMarkerColor(kBlue);
|
636 |
|
|
MPF_FinalGraph->Fit("pol0",""); // quiet, use minos
|
637 |
buchmann |
1.3 |
|
638 |
buchmann |
1.2 |
TF1 *mpf_pol0=(TF1*)MPF_FinalGraph->GetFunction("pol0");
|
639 |
buchmann |
1.13 |
TF1 *mpf_pol0_complete = new TF1("mpf_pol0_complete","[0]+[1]*x");
|
640 |
|
|
mpf_pol0_complete->SetLineWidth(1);
|
641 |
|
|
mpf_pol0_complete->SetLineColor(kBlue);
|
642 |
|
|
mpf_pol0->SetLineColor(kBlue);
|
643 |
buchmann |
1.2 |
MPF_FinalGraph->Draw("AP");
|
644 |
buchmann |
1.3 |
MPF_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}");
|
645 |
|
|
MPF_FinalGraph->GetXaxis()->CenterTitle();
|
646 |
buchmann |
1.9 |
MPF_FinalGraph->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
|
647 |
buchmann |
1.3 |
MPF_FinalGraph->GetYaxis()->CenterTitle();
|
648 |
|
|
MPF_FinalGraph->Draw("AP");
|
649 |
buchmann |
1.13 |
mpf_pol0_complete->Draw("same");
|
650 |
buchmann |
1.3 |
|
651 |
buchmann |
1.2 |
stringstream mpf_result;
|
652 |
buchmann |
1.3 |
mpf_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/mpf_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0)) << "}{ (MPF)}";
|
653 |
buchmann |
1.2 |
TText *rmpf_final_mark = write_title(mpf_result.str());
|
654 |
|
|
rmpf_final_mark->SetX(0.75);
|
655 |
|
|
rmpf_final_mark->SetY(0.75);
|
656 |
|
|
rmpf_final_mark->SetTextSize(0.03);
|
657 |
|
|
rmpf_final_mark->Draw();
|
658 |
buchmann |
1.3 |
DrawPrelim();
|
659 |
buchmann |
1.5 |
float MPFResult=1/mpf_pol0->GetParameter(0);
|
660 |
|
|
float MPFResultError=mpf_pol0->GetParError(0)/(mpf_pol0->GetParameter(0)*mpf_pol0->GetParameter(0));
|
661 |
buchmann |
1.2 |
|
662 |
|
|
stringstream filename2;
|
663 |
|
|
filename2 << "Extrapolation/FINAL_RESULT_MPF";
|
664 |
buchmann |
1.15 |
CompleteSave(can,ContainerName+"/"+filename2.str());
|
665 |
buchmann |
1.2 |
|
666 |
|
|
|
667 |
|
|
RABS_FinalGraph->SetMarkerStyle(21);
|
668 |
|
|
RABS_FinalGraph->SetMarkerStyle(21);
|
669 |
|
|
RABS_FinalGraph->SetMarkerColor(kRed);
|
670 |
buchmann |
1.3 |
RABS_FinalGraph->Fit("pol0","QE"); // quiet, use minos
|
671 |
|
|
RABS_FinalGraph->Draw("AP");
|
672 |
|
|
RABS_FinalGraph->GetXaxis()->SetTitle("p_{T}^{Z}");
|
673 |
|
|
RABS_FinalGraph->GetXaxis()->CenterTitle();
|
674 |
buchmann |
1.9 |
RABS_FinalGraph->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc}");
|
675 |
buchmann |
1.3 |
RABS_FinalGraph->GetYaxis()->CenterTitle();
|
676 |
buchmann |
1.2 |
RABS_FinalGraph->Draw("AP");
|
677 |
|
|
TF1 *rabs_pol0=(TF1*)RABS_FinalGraph->GetFunction("pol0");
|
678 |
|
|
stringstream rabs_result;
|
679 |
buchmann |
1.3 |
rabs_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/rabs_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << rabs_pol0->GetParError(0)/(rabs_pol0->GetParameter(0)*rabs_pol0->GetParameter(0)) << "}{ (R_{abs})}";;
|
680 |
buchmann |
1.2 |
TText *rabs_final_mark = write_title(rabs_result.str());
|
681 |
|
|
rabs_final_mark->SetX(0.75);
|
682 |
|
|
rabs_final_mark->SetY(0.75);
|
683 |
|
|
rabs_final_mark->SetTextSize(0.03);
|
684 |
|
|
rabs_final_mark->Draw();
|
685 |
buchmann |
1.3 |
DrawPrelim();
|
686 |
buchmann |
1.2 |
|
687 |
buchmann |
1.5 |
float RabsResult=1/rabs_pol0->GetParameter(0);
|
688 |
|
|
float RabsResultError=rabs_pol0->GetParError(0)/(rabs_pol0->GetParameter(0)*rabs_pol0->GetParameter(0));
|
689 |
|
|
|
690 |
|
|
filename2.str("");
|
691 |
|
|
filename2 << "Extrapolation/FINAL_RESULT_RABS";
|
692 |
buchmann |
1.15 |
CompleteSave(can,ContainerName+"/"+filename2.str());
|
693 |
buchmann |
1.5 |
|
694 |
buchmann |
1.9 |
can->cd();
|
695 |
buchmann |
1.13 |
MPF_FaceValueAtPoint3->SetMarkerStyle(21);
|
696 |
|
|
MPF_FaceValueAtPoint3->SetMarkerColor(kBlue);
|
697 |
|
|
MPF_FaceValueAtPoint3->Fit("pol0","QE"); // quiet, use minos
|
698 |
|
|
MPF_FaceValueAtPoint3->Draw("AP");
|
699 |
|
|
MPF_FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}");
|
700 |
|
|
MPF_FaceValueAtPoint3->GetXaxis()->CenterTitle();
|
701 |
|
|
MPF_FaceValueAtPoint3->GetYaxis()->SetTitle("<MPF>__{data}/<MPF>_{mc} for #alpha<0.3");
|
702 |
|
|
MPF_FaceValueAtPoint3->GetYaxis()->CenterTitle();
|
703 |
|
|
MPF_FaceValueAtPoint3->Draw("AP");
|
704 |
|
|
TF1 *faceval_pol0=(TF1*)MPF_FaceValueAtPoint3->GetFunction("pol0");
|
705 |
|
|
faceval_pol0->SetLineColor(kBlue);
|
706 |
|
|
faceval_pol0->SetLineWidth(1);
|
707 |
|
|
faceval_pol0->Draw("same");
|
708 |
|
|
TF1 *faceval_pol0_complete = new TF1("faceval_pol0_complete","[0]+[1]*x");
|
709 |
|
|
faceval_pol0_complete->SetParameters(faceval_pol0->GetParameters());
|
710 |
buchmann |
1.5 |
stringstream faceval_result;
|
711 |
|
|
faceval_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/faceval_pol0->GetParameter(0) << " #pm " << std::setprecision(2) << faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0)) << "}{ (MPF at #alpha<0.3)}";;
|
712 |
|
|
TText *faceval_final_mark = write_title(faceval_result.str());
|
713 |
|
|
faceval_final_mark->SetX(0.75);
|
714 |
|
|
faceval_final_mark->SetY(0.75);
|
715 |
|
|
faceval_final_mark->SetTextSize(0.03);
|
716 |
|
|
faceval_final_mark->Draw();
|
717 |
|
|
DrawPrelim();
|
718 |
|
|
|
719 |
|
|
float FaceValResult=1/faceval_pol0->GetParameter(0);
|
720 |
|
|
float FaceValResultError=faceval_pol0->GetParError(0)/(faceval_pol0->GetParameter(0)*faceval_pol0->GetParameter(0));
|
721 |
|
|
|
722 |
buchmann |
1.2 |
filename2.str("");
|
723 |
buchmann |
1.9 |
filename2 << "Extrapolation/FINAL_RESULT_MPF_FaceValp3";
|
724 |
buchmann |
1.15 |
CompleteSave(can,ContainerName+"/"+filename2.str());
|
725 |
buchmann |
1.2 |
|
726 |
buchmann |
1.13 |
can->cd();
|
727 |
|
|
RABS_FaceValueAtPoint3->SetMarkerStyle(21);
|
728 |
|
|
RABS_FaceValueAtPoint3->SetMarkerColor(kRed);
|
729 |
|
|
RABS_FaceValueAtPoint3->Fit("pol0","QE"); // quiet, use minos
|
730 |
|
|
RABS_FaceValueAtPoint3->Draw("AP");
|
731 |
|
|
RABS_FaceValueAtPoint3->GetXaxis()->SetTitle("p_{T}^{Z}");
|
732 |
|
|
RABS_FaceValueAtPoint3->GetXaxis()->CenterTitle();
|
733 |
|
|
RABS_FaceValueAtPoint3->GetYaxis()->SetTitle("<R_{abs}>_{data}/<R_{abs}>_{mc} for #alpha<0.3");
|
734 |
|
|
RABS_FaceValueAtPoint3->GetYaxis()->CenterTitle();
|
735 |
|
|
RABS_FaceValueAtPoint3->Draw("AP");
|
736 |
|
|
TF1 *faceval_pol0RABS=(TF1*)RABS_FaceValueAtPoint3->GetFunction("pol0");
|
737 |
|
|
TF1 *faceval_pol0RABS_complete = new TF1("faceval_pol0_complete","[0]+[1]*x");
|
738 |
|
|
faceval_pol0RABS_complete->SetParameters(faceval_pol0RABS->GetParameters());
|
739 |
|
|
faceval_pol0RABS->SetLineWidth(1);
|
740 |
|
|
faceval_pol0RABS->SetLineColor(kRed);
|
741 |
|
|
faceval_pol0RABS_complete->Draw("same");
|
742 |
|
|
stringstream RABSfaceval_result;
|
743 |
|
|
RABSfaceval_result << "#splitline{C_{abs}= " << std::setprecision(5) << 1/faceval_pol0RABS->GetParameter(0) << " #pm " << std::setprecision(2) << faceval_pol0RABS->GetParError(0)/(faceval_pol0RABS->GetParameter(0)*faceval_pol0RABS->GetParameter(0)) << "}{ (R_{abs} at #alpha<0.3)}";;
|
744 |
|
|
TText *RABSfaceval_final_mark = write_title(RABSfaceval_result.str());
|
745 |
|
|
RABSfaceval_final_mark->SetX(0.75);
|
746 |
|
|
RABSfaceval_final_mark->SetY(0.75);
|
747 |
|
|
RABSfaceval_final_mark->SetTextSize(0.03);
|
748 |
|
|
RABSfaceval_final_mark->Draw();
|
749 |
|
|
DrawPrelim();
|
750 |
|
|
|
751 |
|
|
float RABSFaceValResult=1/faceval_pol0RABS->GetParameter(0);
|
752 |
|
|
float RABSFaceValResultError=faceval_pol0RABS->GetParError(0)/(faceval_pol0RABS->GetParameter(0)*faceval_pol0RABS->GetParameter(0));
|
753 |
|
|
|
754 |
|
|
filename2.str("");
|
755 |
|
|
filename2 << "Extrapolation/FINAL_RESULT_RABS_FaceValp3";
|
756 |
buchmann |
1.15 |
CompleteSave(can,ContainerName+"/"+filename2.str());
|
757 |
buchmann |
1.13 |
|
758 |
buchmann |
1.5 |
cout << "FINAL RESULTS: " << endl;
|
759 |
|
|
cout << "MPF : " << MPFResult << " +/- " << MPFResultError << endl;
|
760 |
|
|
cout << "Rabs: " << RabsResult << " +/- " << RabsResultError << endl;
|
761 |
buchmann |
1.13 |
cout << "Face value at 0.3 :" << FaceValResult << " +/- " << FaceValResultError << " (MPF) " << endl;
|
762 |
|
|
cout << "Face value at 0.3 :" << RABSFaceValResult << " +/- " << RABSFaceValResultError << " (RABS) " << endl;
|
763 |
buchmann |
1.2 |
|
764 |
|
|
delete can;
|
765 |
|
|
|
766 |
buchmann |
1.15 |
results.MPF_Result_FaceValue=Value(FaceValResult,FaceValResultError);
|
767 |
|
|
results.Rabs_Result_FaceValue=Value(RABSFaceValResult,RABSFaceValResultError);
|
768 |
|
|
results.MPF_Result_Extrapolated=Value(MPFResult,MPFResultError);
|
769 |
|
|
results.Rabs_Result_Extrapolated=Value(RabsResult,RabsResultError);
|
770 |
|
|
cout << results << endl;
|
771 |
|
|
return results;
|
772 |
buchmann |
1.2 |
}
|
773 |
|
|
|
774 |
|
|
|
775 |
buchmann |
1.15 |
void TEST_DoPUStudy(string identifier) {
|
776 |
buchmann |
1.9 |
|
777 |
|
|
float numVtxcuts[7]={0,10,15,20};
|
778 |
|
|
|
779 |
|
|
TCanvas *can = new TCanvas("can","can");
|
780 |
|
|
TH1F *malpha[8];
|
781 |
|
|
TH1F *dalpha[8];
|
782 |
|
|
cout << identifier << ";";
|
783 |
|
|
cout << endl;
|
784 |
|
|
for(int i=1;i<5;i++) {
|
785 |
|
|
stringstream sSpecialCut;
|
786 |
|
|
if(i<4) {
|
787 |
|
|
sSpecialCut << "numVtx>" << numVtxcuts[i-1] << " && numVtx<" << numVtxcuts[i];
|
788 |
|
|
cout << numVtxcuts[i-1] << " < nVtx < " << numVtxcuts[i] << ";";
|
789 |
|
|
} else {
|
790 |
|
|
sSpecialCut << "numVtx>" << numVtxcuts[i-1];
|
791 |
|
|
cout << numVtxcuts[i-1] << ";";
|
792 |
|
|
}
|
793 |
|
|
|
794 |
|
|
TCut SpecialCut(sSpecialCut.str().c_str());
|
795 |
|
|
|
796 |
|
|
|
797 |
|
|
malpha[i] = allsamples.Draw("malpha"+any2string(i),"mpf",1000,0,10,"MPF","events",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&SpecialCut,mc,luminosity);
|
798 |
|
|
dalpha[i] = allsamples.Draw("dalpha"+any2string(i),"mpf",1000,0,10,"MPF","events",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&SpecialCut,data,luminosity);
|
799 |
|
|
|
800 |
|
|
|
801 |
|
|
float a=dalpha[i]->GetMean();
|
802 |
|
|
float b=malpha[i]->GetMean();
|
803 |
|
|
float da=dalpha[i]->GetMeanError();
|
804 |
|
|
float db=malpha[i]->GetMeanError();
|
805 |
|
|
float factor = a / b;
|
806 |
|
|
float error = TMath::Sqrt( (1/(b*b)) * (da*da) + ((a*a)/(b*b))*db*db);
|
807 |
|
|
|
808 |
|
|
cout << malpha[i]->GetMean() << ";" << malpha[i]->GetMeanError() << ";" << dalpha[i]->GetMean() << ";" << dalpha[i]->GetMeanError() << ";" << malpha[i]->Integral()<<";"<<dalpha[i]->Integral() << ";"<<factor << ";" << error << endl;
|
809 |
|
|
malpha[i]->SetLineColor(i+1);
|
810 |
|
|
if(i==0) malpha[i]->Draw("histo");
|
811 |
|
|
else malpha[i]->Draw("histo,same");
|
812 |
|
|
}
|
813 |
|
|
|
814 |
|
|
CompleteSave(can,"AlphaOverview_"+identifier);
|
815 |
|
|
delete can;
|
816 |
|
|
|
817 |
|
|
/* for(int i=1;i<8;i++) {
|
818 |
|
|
delete malpha[i];
|
819 |
|
|
delete dalpha[i];
|
820 |
|
|
}
|
821 |
|
|
*/
|
822 |
|
|
|
823 |
|
|
}
|
824 |
|
|
|
825 |
buchmann |
1.15 |
void TEST_ScenarioComparison() {
|
826 |
buchmann |
1.13 |
//very dumb way to do this.
|
827 |
buchmann |
1.9 |
TGraphAsymmErrors *gr[5];
|
828 |
|
|
TF1 *fit[5];
|
829 |
|
|
bool dofit=false;
|
830 |
|
|
|
831 |
|
|
TCanvas *can = new TCanvas("can","can",500,500);
|
832 |
|
|
|
833 |
|
|
TLegend *leg = new TLegend(0.2,0.2,0.5,0.45);
|
834 |
|
|
leg->SetBorderSize(0);
|
835 |
|
|
leg->SetFillColor(kWhite);
|
836 |
|
|
|
837 |
|
|
for(int i=0;i<5;i++) {
|
838 |
|
|
gr[i] = new TGraphAsymmErrors();
|
839 |
|
|
double x[4] = {5,12.5,17.5,20};
|
840 |
|
|
double dxl[4] = {5,2.5,2.5,2.5};
|
841 |
|
|
double dxh[4] = {5,2.5,2.5,10};
|
842 |
|
|
|
843 |
|
|
string name="";
|
844 |
|
|
string color="";
|
845 |
|
|
|
846 |
|
|
if(i==0) {
|
847 |
|
|
double y[4] = {1.008,1.013,1.003,1.007};
|
848 |
|
|
double dyl[4] = {0.011,0.009,0.013,0.020};
|
849 |
|
|
double dyh[4] = {0.011,0.009,0.013,0.020};
|
850 |
|
|
name="30/30";
|
851 |
|
|
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
|
852 |
|
|
color="#a01d99";
|
853 |
|
|
}
|
854 |
|
|
if(i==1) {
|
855 |
|
|
double y[4] = {1.008+0.001,1.013+0.001,1.003+0.001,1.007+0.001};
|
856 |
|
|
double dyl[4] = {0.011,0.009,0.013,0.020};
|
857 |
|
|
double dyh[4] = {0.011,0.009,0.013,0.020};
|
858 |
|
|
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
|
859 |
buchmann |
1.13 |
name="30/15";
|
860 |
buchmann |
1.9 |
color="#2464bc";
|
861 |
|
|
}
|
862 |
|
|
if(i==2) {
|
863 |
|
|
double y[4] = {1.014,1.026,1.014,1.059};
|
864 |
|
|
double dyl[4] = {0.011,0.010,0.014,0.023};
|
865 |
|
|
double dyh[4] = {0.011,0.010,0.014,0.023};
|
866 |
|
|
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
|
867 |
|
|
name="15/15";
|
868 |
|
|
color="#f49230";
|
869 |
|
|
}
|
870 |
|
|
if(i==3) {
|
871 |
|
|
double y[4] = {1.015,1.020,1.008,1.050};
|
872 |
|
|
double dyl[4] = {0.011,0.010,0.014,0.022};
|
873 |
|
|
double dyh[4] = {0.011,0.010,0.014,0.022};
|
874 |
|
|
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
|
875 |
|
|
name="20/15";
|
876 |
|
|
color="#c72f3c";
|
877 |
|
|
}
|
878 |
|
|
if(i==4) {
|
879 |
|
|
double y[4] = {1.015+0.001,1.020+0.001,1.008+0.001,1.050+0.001};
|
880 |
|
|
double dyl[4] = {0.011,0.010,0.014,0.022};
|
881 |
|
|
double dyh[4] = {0.011,0.010,0.014,0.022};
|
882 |
|
|
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
|
883 |
|
|
name="20/20";
|
884 |
|
|
color="#7cb433";
|
885 |
|
|
}
|
886 |
|
|
|
887 |
|
|
|
888 |
|
|
gr[i]->SetTitle();
|
889 |
|
|
gr[i]->GetXaxis()->SetTitle("N(Vtx)");
|
890 |
|
|
gr[i]->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
|
891 |
|
|
gr[i]->GetXaxis()->CenterTitle();
|
892 |
|
|
gr[i]->GetYaxis()->CenterTitle();
|
893 |
|
|
gr[i]->SetName(name.c_str());
|
894 |
|
|
gr[i]->SetMarkerSize(0.00001);
|
895 |
|
|
gr[i]->GetYaxis()->SetRangeUser(0.90,1.10);
|
896 |
|
|
gr[i]->SetLineColor(TColor::GetColor(color.c_str()));
|
897 |
|
|
gr[i]->SetMarkerColor(TColor::GetColor(color.c_str()));
|
898 |
|
|
if(dofit) {
|
899 |
|
|
gr[i]->Fit("pol1");
|
900 |
|
|
fit[i] = (TF1*)gr[i]->GetFunction("pol1");
|
901 |
|
|
fit[i]->SetLineColor(TColor::GetColor(color.c_str()));
|
902 |
|
|
}
|
903 |
|
|
leg->AddEntry(gr[i],name.c_str(),"l");
|
904 |
|
|
if(i==0) gr[i]->Draw("AP*");
|
905 |
|
|
else gr[i]->Draw("P");
|
906 |
|
|
}
|
907 |
|
|
leg->Draw();
|
908 |
|
|
DrawPrelim();
|
909 |
|
|
|
910 |
|
|
CompleteSave(can,"ScenarioComparison");
|
911 |
|
|
delete can;
|
912 |
|
|
|
913 |
|
|
}
|
914 |
|
|
|
915 |
buchmann |
1.15 |
void TEST_ScenarioComparisonInclusive() {
|
916 |
buchmann |
1.13 |
//dumbest way ever to do this. but ok we only need to do it once.
|
917 |
buchmann |
1.9 |
TGraphAsymmErrors *gr[5];
|
918 |
|
|
TF1 *fit[5];
|
919 |
|
|
bool dofit=true;
|
920 |
|
|
|
921 |
|
|
TCanvas *can = new TCanvas("can","can",500,500);
|
922 |
|
|
|
923 |
|
|
TLegend *leg = new TLegend(0.2,0.2,0.5,0.45);
|
924 |
|
|
leg->SetBorderSize(0);
|
925 |
|
|
leg->SetFillColor(kWhite);
|
926 |
|
|
|
927 |
|
|
for(int i=0;i<5;i++) {
|
928 |
|
|
gr[i] = new TGraphAsymmErrors();
|
929 |
|
|
double x[4] = {5,12.5,17.5,20};
|
930 |
|
|
double dxl[4] = {5,2.5,2.5,2.5};
|
931 |
|
|
double dxh[4] = {5,2.5,2.5,10};
|
932 |
|
|
|
933 |
|
|
string name="";
|
934 |
|
|
string color="";
|
935 |
|
|
|
936 |
|
|
if(i==0) {
|
937 |
|
|
double y[4] = {1.01103,1.01496,1.01486,1.02785};
|
938 |
|
|
double dyl[4] = {0.00235044,0.00225264,0.00313574,0.00541047};
|
939 |
|
|
double dyh[4] = {0.00235044,0.00225264,0.00313574,0.00541047};
|
940 |
|
|
name="30/30";
|
941 |
|
|
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
|
942 |
|
|
color="#a01d99";
|
943 |
|
|
}
|
944 |
|
|
if(i==1) {
|
945 |
|
|
double y[4] = {1.01103+0.001,1.01496+0.001,1.01486+0.001,1.02785+0.001};
|
946 |
|
|
double dyl[4] = {0.00235044,0.00225264,0.00313574,0.00541047};
|
947 |
|
|
double dyh[4] = {0.00235044,0.00225264,0.00313574,0.00541047};
|
948 |
|
|
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
|
949 |
buchmann |
1.13 |
name="30/15";
|
950 |
buchmann |
1.9 |
color="#2464bc";
|
951 |
|
|
}
|
952 |
|
|
if(i==2) {
|
953 |
|
|
double y[4] = {1.01575,1.02879,1.0325,1.05456};
|
954 |
|
|
double dyl[4] = {0.00288281,0.00278536,0.00367451,0.00590421};
|
955 |
|
|
double dyh[4] = {0.00288281,0.00278536,0.00367451,0.00590421};
|
956 |
|
|
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
|
957 |
|
|
name="15/15";
|
958 |
|
|
color="#f49230";
|
959 |
|
|
}
|
960 |
|
|
if(i==3) {
|
961 |
|
|
double y[4] = {1.01221,1.01922,1.02396,1.04677};
|
962 |
|
|
double dyl[4] = {0.00263821,0.00260853,0.00353673,0.00584728};
|
963 |
|
|
double dyh[4] = {0.00263821,0.00260853,0.00353673,0.00584728};
|
964 |
|
|
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
|
965 |
|
|
name="20/15";
|
966 |
|
|
color="#c72f3c";
|
967 |
|
|
}
|
968 |
|
|
if(i==4) {
|
969 |
|
|
double y[4] = {1.01221+0.001,1.01922+0.001,1.02396+0.001,1.04677+0.001};
|
970 |
|
|
double dyl[4] = {0.00263821,0.00260853,0.00353673,0.00584728};
|
971 |
|
|
double dyh[4] = {0.00263821,0.00260853,0.00353673,0.00584728};
|
972 |
|
|
gr[i] = new TGraphAsymmErrors(4,x,y,dxl,dxh,dyl,dyh);
|
973 |
|
|
name="20/20";
|
974 |
|
|
color="#7cb433";
|
975 |
|
|
}
|
976 |
|
|
|
977 |
|
|
|
978 |
|
|
gr[i]->SetTitle();
|
979 |
|
|
gr[i]->GetXaxis()->SetTitle("N(Vtx)");
|
980 |
|
|
gr[i]->GetYaxis()->SetTitle("<MPF>_{data}/<MPF>_{mc}");
|
981 |
|
|
gr[i]->GetXaxis()->CenterTitle();
|
982 |
|
|
gr[i]->GetYaxis()->CenterTitle();
|
983 |
|
|
gr[i]->SetName(name.c_str());
|
984 |
|
|
gr[i]->SetMarkerSize(0.00001);
|
985 |
|
|
gr[i]->GetYaxis()->SetRangeUser(0.90,1.10);
|
986 |
|
|
gr[i]->SetLineColor(TColor::GetColor(color.c_str()));
|
987 |
|
|
gr[i]->SetMarkerColor(TColor::GetColor(color.c_str()));
|
988 |
|
|
if(dofit) {
|
989 |
|
|
gr[i]->Fit("pol1");
|
990 |
|
|
fit[i] = (TF1*)gr[i]->GetFunction("pol1");
|
991 |
|
|
fit[i]->SetLineColor(TColor::GetColor(color.c_str()));
|
992 |
|
|
}
|
993 |
|
|
leg->AddEntry(gr[i],name.c_str(),"l");
|
994 |
|
|
if(i==0) gr[i]->Draw("AP*");
|
995 |
|
|
else gr[i]->Draw("P");
|
996 |
|
|
}
|
997 |
|
|
leg->Draw();
|
998 |
|
|
DrawPrelim();
|
999 |
|
|
|
1000 |
|
|
CompleteSave(can,"ScenarioComparisonInclusive");
|
1001 |
|
|
delete can;
|
1002 |
|
|
|
1003 |
|
|
}
|
1004 |
buchmann |
1.2 |
|
1005 |
buchmann |
1.15 |
void TEST_compare_selection(string identifier) {
|
1006 |
buchmann |
1.7 |
bool recognized_scenario=false;
|
1007 |
|
|
|
1008 |
|
|
cout << "Running with identifier " << identifier << endl;
|
1009 |
buchmann |
1.9 |
if(identifier=="Zb3010") {
|
1010 |
|
|
LeadingB=TCut ("Zb3010_bTagProbCSVBP[0]>0.898");
|
1011 |
|
|
EtaB=TCut("abs(Zb3010_pfJetGoodEta[0])<1.3");
|
1012 |
|
|
PhiZcut=TCut("abs(Zb3010_pfJetDphiZ[0])>2.7");
|
1013 |
|
|
recognized_scenario=true;
|
1014 |
|
|
}
|
1015 |
|
|
|
1016 |
|
|
if(identifier=="Zb3010") {
|
1017 |
|
|
LeadingB=TCut ("Zb3010_bTagProbCSVBP[0]>0.898");
|
1018 |
|
|
EtaB=TCut("abs(Zb3010_pfJetGoodEta[0])<1.3");
|
1019 |
|
|
PhiZcut=TCut("abs(Zb3010_pfJetDphiZ[0])>2.7");
|
1020 |
buchmann |
1.7 |
recognized_scenario=true;
|
1021 |
|
|
}
|
1022 |
|
|
|
1023 |
buchmann |
1.9 |
if(identifier=="Zb40") {
|
1024 |
|
|
LeadingB=TCut ("Zb40_bTagProbCSVBP[0]>0.898");
|
1025 |
|
|
EtaB=TCut("abs(Zb40_pfJetGoodEta[0])<1.3");
|
1026 |
|
|
PhiZcut=TCut("abs(Zb40_pfJetDphiZ[0])>2.7");
|
1027 |
|
|
recognized_scenario=true;
|
1028 |
|
|
}
|
1029 |
|
|
|
1030 |
|
|
if(identifier=="Zb301030") {
|
1031 |
|
|
LeadingB=TCut ("Zb301030_bTagProbCSVBP[0]>0.898");
|
1032 |
|
|
EtaB=TCut("abs(Zb301030_pfJetGoodEta[0])<1.3");
|
1033 |
|
|
PhiZcut=TCut("abs(Zb301030_pfJetDphiZ[0])>2.7");
|
1034 |
buchmann |
1.7 |
recognized_scenario=true;
|
1035 |
|
|
}
|
1036 |
|
|
|
1037 |
|
|
if(identifier=="Zb1530") {
|
1038 |
buchmann |
1.9 |
LeadingB=TCut ("Zb1530_bTagProbCSVBP[0]>0.898");
|
1039 |
buchmann |
1.7 |
EtaB=TCut("abs(Zb1530_pfJetGoodEta[0])<1.3");
|
1040 |
|
|
PhiZcut=TCut("abs(Zb1530_pfJetDphiZ[0])>2.7");
|
1041 |
|
|
recognized_scenario=true;
|
1042 |
|
|
}
|
1043 |
|
|
|
1044 |
buchmann |
1.9 |
if(identifier=="Zb301010") {
|
1045 |
|
|
LeadingB=TCut ("Zb301010_bTagProbCSVBP[0]>0.898");
|
1046 |
|
|
EtaB=TCut("abs(Zb301010_pfJetGoodEta[0])<1.3");
|
1047 |
|
|
PhiZcut=TCut("abs(Zb301010_pfJetDphiZ[0])>2.7");
|
1048 |
|
|
recognized_scenario=true;
|
1049 |
|
|
}
|
1050 |
|
|
|
1051 |
|
|
if(identifier=="Zb1510") {
|
1052 |
|
|
LeadingB=TCut ("Zb1510_bTagProbCSVBP[0]>0.898");
|
1053 |
|
|
EtaB=TCut("abs(Zb1510_pfJetGoodEta[0])<1.3");
|
1054 |
|
|
PhiZcut=TCut("abs(Zb1510_pfJetDphiZ[0])>2.7");
|
1055 |
|
|
recognized_scenario=true;
|
1056 |
|
|
}
|
1057 |
|
|
|
1058 |
|
|
if(identifier=="Zb301010") {
|
1059 |
|
|
LeadingB=TCut ("Zb301010_bTagProbCSVBP[0]>0.898");
|
1060 |
|
|
EtaB=TCut("abs(Zb301010_pfJetGoodEta[0])<1.3");
|
1061 |
|
|
PhiZcut=TCut("abs(Zb301010_pfJetDphiZ[0])>2.7");
|
1062 |
|
|
recognized_scenario=true;
|
1063 |
|
|
}
|
1064 |
|
|
|
1065 |
|
|
if(identifier=="ZbMikko") {
|
1066 |
|
|
LeadingB=TCut ("ZbMikko_bTagProbCSVBP[0]>0.898 && ZbMikko__IsClean");
|
1067 |
|
|
EtaB=TCut("abs(ZbMikko_pfJetGoodEta[0])<1.3 && ZbMikko__IsClean");
|
1068 |
|
|
PhiZcut=TCut("abs(ZbMikko_pfJetDphiZ[0])>2.7 && ZbMikko__IsClean");
|
1069 |
buchmann |
1.7 |
recognized_scenario=true;
|
1070 |
|
|
}
|
1071 |
|
|
|
1072 |
buchmann |
1.9 |
if(identifier=="Zb3010_SecEta3") {
|
1073 |
|
|
LeadingB=TCut ("Zb3010_SecEta3_bTagProbCSVBP[0]>0.898");
|
1074 |
|
|
EtaB=TCut("abs(Zb3010_SecEta3_pfJetGoodEta[0])<1.3");
|
1075 |
|
|
PhiZcut=TCut("abs(Zb3010_SecEta3_pfJetDphiZ[0])>2.7");
|
1076 |
buchmann |
1.7 |
recognized_scenario=true;
|
1077 |
|
|
}
|
1078 |
|
|
|
1079 |
buchmann |
1.9 |
if(identifier=="Zb3010_SecEta5") {
|
1080 |
|
|
LeadingB=TCut ("Zb3010_SecEta5_bTagProbCSVBP[0]>0.898");
|
1081 |
|
|
EtaB=TCut("abs(Zb3010_SecEta5_pfJetGoodEta[0])<1.3");
|
1082 |
|
|
PhiZcut=TCut("abs(Zb3010_SecEta5_pfJetDphiZ[0])>2.7");
|
1083 |
buchmann |
1.7 |
recognized_scenario=true;
|
1084 |
|
|
}
|
1085 |
|
|
|
1086 |
buchmann |
1.9 |
if(identifier=="Zb3010_p5Clean") {
|
1087 |
|
|
LeadingB=TCut ("Zb3010_p5Clean_bTagProbCSVBP[0]>0.898 && Zb3010_p5Clean_IsClean");
|
1088 |
|
|
EtaB=TCut("abs(Zb3010_p5Clean_pfJetGoodEta[0])<1.3 && Zb3010_p5Clean_IsClean");
|
1089 |
|
|
PhiZcut=TCut("abs(Zb3010_p5Clean_pfJetDphiZ[0])>2.7 && Zb3010_p5Clean_IsClean");
|
1090 |
buchmann |
1.7 |
recognized_scenario=true;
|
1091 |
|
|
}
|
1092 |
|
|
|
1093 |
buchmann |
1.9 |
if(identifier=="Zb3010CHS") {
|
1094 |
|
|
LeadingB=TCut ("Zb3010CHS_bTagProbCSVBP[0]>0.898");
|
1095 |
|
|
EtaB=TCut("abs(Zb3010CHS_pfJetGoodEta[0])<1.3");
|
1096 |
|
|
PhiZcut=TCut("abs(Zb3010CHS_pfJetDphiZ[0])>2.7");
|
1097 |
buchmann |
1.7 |
recognized_scenario=true;
|
1098 |
|
|
}
|
1099 |
|
|
|
1100 |
|
|
assert(recognized_scenario);
|
1101 |
|
|
|
1102 |
|
|
cout << "Cuts: " << endl;
|
1103 |
|
|
cout << " " << (const char*) LeadingB << endl;
|
1104 |
|
|
cout << " " << (const char*) EtaB << endl;
|
1105 |
|
|
cout << " " << (const char*) PhiZcut << endl;
|
1106 |
|
|
|
1107 |
|
|
cout << endl << endl;
|
1108 |
|
|
|
1109 |
buchmann |
1.9 |
// ScenarioComparison();
|
1110 |
|
|
// ScenarioComparisonInclusive();
|
1111 |
|
|
|
1112 |
|
|
|
1113 |
|
|
// DoPUStudy(identifier);
|
1114 |
|
|
|
1115 |
|
|
// SpecialCutFlow(identifier);
|
1116 |
|
|
// draw_kin_variable("pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",17000,30,200,"Z p_{T}","Official/"+identifier+"/Zpt__"+identifier,1);
|
1117 |
|
|
// draw_kin_variable(identifier+"_pfJetGoodPt[0]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",40,0,200,"Leading Jet Pt (B)","Official/"+identifier+"/LeadingJetPt__"+identifier,1);
|
1118 |
|
|
// draw_kin_variable(identifier+"_pfJetGoodPt[1]",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",40,0,200,"Sub-Leading Jet Pt [GeV]","Official/"+identifier+"/Jet2Pt__"+identifier,1);
|
1119 |
|
|
// draw_kin_variable(identifier+"_pfJetGoodPt[1]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&"pt>10&&pt<1000",20,0,2,"p_{T}^{J2} / p_{T}^{Z}","Official/"+identifier+"/SubLeadingJetPt_Over_ZPt__"+identifier,1);
|
1120 |
|
|
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);
|
1121 |
|
|
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);
|
1122 |
|
|
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);
|
1123 |
|
|
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);
|
1124 |
|
|
draw_kin_variable(identifier+"_alpha",ZplusBsel&&LeadingB&&EtaB&&PhiZcut,20,0,2,"#alpha","Official/"+identifier+"/alpha_full__"+identifier,1);
|
1125 |
|
|
// draw_kin_variable(identifier+"_pfBJetDphiZ[0]",ZplusBsel&&LeadingB&&"pt>10&&pt<1000&&pfBJetDphiZ[0]>0",30,0,3.2,"#delta#phi (Z,b lead)","Official/"+identifier+"/DeltaPhiZBlead__"+identifier,0);
|
1126 |
buchmann |
1.7 |
|
1127 |
buchmann |
1.9 |
// draw_kin_variable("mpf",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.3").c_str()),20,0,2,"Z+b MPF","Official/"+identifier+"/mpf_alpha_smaller_0p3___"+identifier,0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
1128 |
|
|
// draw_kin_variable(identifier+"_pfJetGoodPt[0]/pt",ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.3").c_str()),20,0,2,"p_{T} b-jet / p_{T} Z","Official/"+identifier+"/ptb_over_ptz___alpha_smaller_0p3______"+identifier,0,"#alpha<0.3, 10 GeV < p_{T}^{Z} < 1000 GeV");
|
1129 |
buchmann |
1.7 |
|
1130 |
|
|
|
1131 |
buchmann |
1.9 |
// */
|
1132 |
buchmann |
1.7 |
|
1133 |
|
|
}
|
1134 |
|
|
|
1135 |
buchmann |
1.14 |
void GetNumberEventsInsideOutsideAlphaWindow(TCut specialcut, string title) {
|
1136 |
buchmann |
1.13 |
|
1137 |
buchmann |
1.14 |
// TCut cut = ZplusBsel&&LeadingB&&PhiZcut&&specialcut&&TCut("Zb3010_alpha<0.3");
|
1138 |
|
|
TCut cut = specialcut;
|
1139 |
|
|
TCut in = EtaB;
|
1140 |
|
|
TCut out = TCut("abs(Zb3010_pfJetGoodEta[0])>1.3");
|
1141 |
buchmann |
1.13 |
|
1142 |
|
|
TH1F *data_IN = allsamples.Draw("data_IN", "mll",1,0,150, "nothing [GeV]", "events", cut&&in, data,luminosity);
|
1143 |
|
|
TH1F *data_OUT = allsamples.Draw("data_OUT", "mll",1,0,150, "nothing [GeV]", "events", cut&&out,data,luminosity);
|
1144 |
|
|
TH1F *mc_IN = allsamples.Draw("mc_IN", "mll",1,0,150, "nothing [GeV]", "events", cut&&in, mc ,luminosity);
|
1145 |
|
|
TH1F *mc_OUT = allsamples.Draw("mc_OUT", "mll",1,0,150, "nothing [GeV]", "events", cut&&out,mc ,luminosity);
|
1146 |
|
|
|
1147 |
buchmann |
1.14 |
dout << title << " : " << endl;
|
1148 |
buchmann |
1.13 |
dout << " Data: In " << data_IN->Integral() << " vs out " << data_OUT->Integral() << endl;
|
1149 |
|
|
dout << " MC : In " << mc_IN->Integral() << " vs out " << mc_OUT->Integral() << endl;
|
1150 |
buchmann |
1.14 |
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;
|
1151 |
|
|
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;
|
1152 |
|
|
|
1153 |
|
|
delete data_IN;
|
1154 |
|
|
delete data_OUT;
|
1155 |
|
|
delete mc_IN;
|
1156 |
|
|
delete mc_OUT;
|
1157 |
buchmann |
1.13 |
}
|
1158 |
|
|
|
1159 |
buchmann |
1.15 |
void TEST_GetNumberEventsInsideOutsideAlphaWindow() {
|
1160 |
buchmann |
1.14 |
TCanvas *ca = new TCanvas("ca","ca");
|
1161 |
|
|
// GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==0"), "ee");
|
1162 |
|
|
// GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==1"), "mm");
|
1163 |
|
|
// GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2"), "ee/mm");
|
1164 |
|
|
|
1165 |
|
|
cout << "BASE SELECTION" << endl;
|
1166 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==0"), "ee");
|
1167 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2&&id1==1"), "mm");
|
1168 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(TCut("id1==id2"), "ee/mm");
|
1169 |
|
|
|
1170 |
|
|
cout << "BASE SELECTION: Z+b" << endl;
|
1171 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2&&id1==0"), "ee");
|
1172 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2&&id1==1"), "mm");
|
1173 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(ZplusBsel&&TCut("id1==id2"), "ee/mm");
|
1174 |
|
|
|
1175 |
|
|
cout << "Leading B" << endl;
|
1176 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0"), "ee");
|
1177 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1"), "mm");
|
1178 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(LeadingB&&ZplusBsel&&TCut("id1==id2"), "ee/mm");
|
1179 |
|
|
|
1180 |
|
|
cout << "PhiZcut" << endl;
|
1181 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0"), "ee");
|
1182 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1"), "mm");
|
1183 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2"), "ee/mm");
|
1184 |
|
|
|
1185 |
|
|
cout << "alpha cut" << endl;
|
1186 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==0")&&TCut("Zb3010_alpha<0.3"), "ee");
|
1187 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2&&id1==1")&&TCut("Zb3010_alpha<0.3"), "mm");
|
1188 |
|
|
GetNumberEventsInsideOutsideAlphaWindow(PhiZcut&&LeadingB&&ZplusBsel&&TCut("id1==id2")&&TCut("Zb3010_alpha<0.3"), "ee/mm");
|
1189 |
|
|
|
1190 |
|
|
delete ca;
|
1191 |
|
|
|
1192 |
|
|
|
1193 |
|
|
}
|
1194 |
|
|
|
1195 |
|
|
|
1196 |
|
|
|
1197 |
buchmann |
1.13 |
|
1198 |
buchmann |
1.15 |
void do_basic_ZB_analysis(bool DoCompleteAnalysis) {
|
1199 |
buchmann |
1.12 |
|
1200 |
|
|
//https://twiki.cern.ch/twiki/bin/viewauth/CMS/BtagPOG#2011_Data_and_MC
|
1201 |
|
|
//https://twiki.cern.ch/twiki/pub/CMS/BtagPOG/SFb-ttbar_payload.txt
|
1202 |
buchmann |
1.9 |
|
1203 |
buchmann |
1.14 |
cout << "The lepton requirement is " << (const char*) leptoncut << endl;
|
1204 |
buchmann |
1.12 |
bool doquick=true;
|
1205 |
buchmann |
1.9 |
|
1206 |
buchmann |
1.2 |
TCanvas *zbcanvas = new TCanvas("zbcanvas","zbcanvas");
|
1207 |
buchmann |
1.1 |
|
1208 |
buchmann |
1.9 |
// compare_selection("Zb3010_p5Clean");
|
1209 |
|
|
// compare_selection("Zb3010CHS");
|
1210 |
|
|
// compare_selection("Zb3010");
|
1211 |
|
|
// compare_selection("Zb301030");
|
1212 |
|
|
// compare_selection("Zb1530");
|
1213 |
|
|
// compare_selection("Zb301010");
|
1214 |
|
|
// compare_selection("Zb3010_SecEta3");
|
1215 |
|
|
// compare_selection("Zb3010_SecEta5");
|
1216 |
|
|
// compare_selection("Zb1510");
|
1217 |
|
|
// compare_selection("Zb301010");
|
1218 |
|
|
// compare_selection("ZbMikko");
|
1219 |
|
|
// compare_selection("Zb3010");
|
1220 |
|
|
// compare_selection("Zb40");
|
1221 |
buchmann |
1.8 |
|
1222 |
buchmann |
1.11 |
if(!doquick) {
|
1223 |
|
|
print_all_b_yields();
|
1224 |
|
|
draw_mpf_vars();
|
1225 |
|
|
// DrawEvilCutFlow();
|
1226 |
|
|
|
1227 |
|
|
draw_Zb_kin_vars();
|
1228 |
|
|
|
1229 |
|
|
}
|
1230 |
buchmann |
1.7 |
|
1231 |
buchmann |
1.14 |
// GetNumberEventsInsideOutsideAlphaWindow();
|
1232 |
buchmann |
1.15 |
|
1233 |
|
|
dout <<"THIS IS WHERE IT GETS REALLY INTERESTING!!!!" << endl;
|
1234 |
|
|
if(DoCompleteAnalysis) {
|
1235 |
|
|
/* need to run the following scenarios:
|
1236 |
|
|
* - normal
|
1237 |
|
|
* - inclusive
|
1238 |
|
|
* - medium WP
|
1239 |
|
|
* - alpha up
|
1240 |
|
|
* - alpha down
|
1241 |
|
|
*/
|
1242 |
|
|
|
1243 |
|
|
ZbResultContainer inclusive = new_data_mc_agreement_2d("Zb3010_alpha","inclusive",TCut("Zb3010_bTagProbCSVBP[0]>-10000"),TCut("1.0"));
|
1244 |
buchmann |
1.16 |
ZbResultContainer Reference = new_data_mc_agreement_2d("Zb3010_alpha","reference",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"));
|
1245 |
|
|
ZbResultContainer effmistagUp = new_data_mc_agreement_2d("Zb3010_alpha","effmistagUp",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTUp"));
|
1246 |
|
|
ZbResultContainer effmistagDown = new_data_mc_agreement_2d("Zb3010_alpha","effmistagDown",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtTDown"));
|
1247 |
|
|
ZbResultContainer medium = new_data_mc_agreement_2d("Zb3010_alpha","medium",TCut("Zb3010_bTagProbCSVBP[0]>0.679"),TCut("ZbCHS3010_BTagWgtM"));
|
1248 |
|
|
ZbResultContainer loose = new_data_mc_agreement_2d("Zb3010_alpha","loose",TCut("Zb3010_bTagProbCSVBP[0]>0.244"),TCut("ZbCHS3010_BTagWgtL"));
|
1249 |
|
|
ZbResultContainer AlphaUp = new_data_mc_agreement_2d("Zb3010_alphaUp","AlphaUp",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"));
|
1250 |
|
|
ZbResultContainer AlphaDown = new_data_mc_agreement_2d("Zb3010_alphaDown","AlphaDown",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgtT"));
|
1251 |
|
|
|
1252 |
|
|
//and now let's compute some systematics!
|
1253 |
|
|
//1 alpha variation
|
1254 |
|
|
float SysMPF_Alpha_down = Reference.MPF_Result_FaceValue.getValue()-AlphaDown.MPF_Result_FaceValue.getValue();
|
1255 |
|
|
float SysMPF_Alpha_up = Reference.MPF_Result_FaceValue.getValue()-AlphaUp.MPF_Result_FaceValue.getValue();
|
1256 |
|
|
|
1257 |
|
|
//2 btagging efficiency/mistag correction
|
1258 |
|
|
float SysMPF_EFF_down = Reference.MPF_Result_FaceValue.getValue()-effmistagDown.MPF_Result_FaceValue.getValue();
|
1259 |
|
|
float SysMPF_EFF_up = Reference.MPF_Result_FaceValue.getValue()-effmistagUp.MPF_Result_FaceValue.getValue();
|
1260 |
|
|
|
1261 |
|
|
//3 purity
|
1262 |
|
|
zbcanvas->cd();
|
1263 |
buchmann |
1.17 |
gStyle->SetOptFit(0);
|
1264 |
buchmann |
1.16 |
write_info(__FUNCTION__,"Don't know the exact purity at the moment, still needs to be determined!");
|
1265 |
buchmann |
1.17 |
TH1F *purityhisto = new TH1F("purityhisto","purityhisto",1,0,1);
|
1266 |
|
|
purityhisto->GetXaxis()->SetTitle("Purity");
|
1267 |
|
|
purityhisto->GetYaxis()->SetTitle("C_{abs}");
|
1268 |
|
|
purityhisto->GetXaxis()->CenterTitle();
|
1269 |
|
|
purityhisto->GetYaxis()->CenterTitle();
|
1270 |
|
|
|
1271 |
buchmann |
1.16 |
TGraphErrors *gSysMPF_Purity = new TGraphErrors();
|
1272 |
|
|
gSysMPF_Purity->SetPoint(0,0.05,inclusive.MPF_Result_FaceValue.getValue());
|
1273 |
|
|
gSysMPF_Purity->SetPointError(0,0.0,inclusive.MPF_Result_FaceValue.getError());
|
1274 |
buchmann |
1.17 |
|
1275 |
|
|
gSysMPF_Purity->SetPoint(1,0.20,loose.MPF_Result_FaceValue.getValue());//x value?
|
1276 |
buchmann |
1.16 |
gSysMPF_Purity->SetPointError(1,0.0,loose.MPF_Result_FaceValue.getError());
|
1277 |
buchmann |
1.17 |
gSysMPF_Purity->SetPoint(2,0.54,medium.MPF_Result_FaceValue.getValue());//x value?
|
1278 |
buchmann |
1.16 |
gSysMPF_Purity->SetPointError(2,0.0,medium.MPF_Result_FaceValue.getError());
|
1279 |
buchmann |
1.17 |
gSysMPF_Purity->SetPoint(3,0.82,Reference.MPF_Result_FaceValue.getValue());//x value?
|
1280 |
buchmann |
1.16 |
gSysMPF_Purity->SetPointError(3,0.0,Reference.MPF_Result_FaceValue.getError());
|
1281 |
|
|
|
1282 |
buchmann |
1.17 |
|
1283 |
|
|
float min,max;
|
1284 |
|
|
FindMinMax(gSysMPF_Purity,min,max);
|
1285 |
|
|
purityhisto->SetStats(0);
|
1286 |
|
|
purityhisto->GetYaxis()->SetRangeUser(min,max);
|
1287 |
buchmann |
1.16 |
|
1288 |
|
|
gSysMPF_Purity->Fit("pol1");
|
1289 |
buchmann |
1.17 |
TPolyLine *purity_fit_uncert = GetFitUncertaintyShape(gSysMPF_Purity, "pol1", min, max,0.0,1.0);
|
1290 |
|
|
TF1* pufit = (TF1*)gSysMPF_Purity->GetFunction("pol1");
|
1291 |
|
|
|
1292 |
|
|
TF1* pufit_c = new TF1("pufit_c","[0]+[1]*x");
|
1293 |
|
|
pufit_c->SetParameters(pufit->GetParameters());
|
1294 |
|
|
pufit_c->SetLineColor(TColor::GetColor("#0101DF"));
|
1295 |
|
|
purity_fit_uncert->SetFillColor(TColor::GetColor("#5353FC"));
|
1296 |
|
|
pufit->SetLineColor(TColor::GetColor("#5353FC"));
|
1297 |
|
|
|
1298 |
|
|
purityhisto->Draw();
|
1299 |
|
|
purity_fit_uncert->Draw("f");
|
1300 |
|
|
gSysMPF_Purity->Draw("P*");
|
1301 |
|
|
pufit_c->Draw("same");
|
1302 |
|
|
DrawPrelim();
|
1303 |
|
|
|
1304 |
|
|
float ExtrapolatedResult=pufit->GetParameter(0)+1.0*pufit->GetParameter(1);
|
1305 |
|
|
float dExtrapolatedResult=sqrt(pufit->GetParError(0)*pufit->GetParError(0)+1.0*1.0*pufit->GetParError(1)*pufit->GetParError(1));
|
1306 |
|
|
|
1307 |
|
|
stringstream summary;
|
1308 |
|
|
summary << "#splitline{Reference: " << std::setprecision(4) << Reference.MPF_Result_FaceValue.getValue() << "+/-" << std::setprecision(4) << Reference.MPF_Result_FaceValue.getError() << "}{";
|
1309 |
|
|
summary << "Extrapolation: " << std::setprecision(4) << ExtrapolatedResult << " +/- " << std::setprecision(4) << dExtrapolatedResult << "}";
|
1310 |
|
|
|
1311 |
|
|
dout << "Have found an extrapolated result at 1.0 of " << ExtrapolatedResult << " ; will use the difference between this result and the face value as ";
|
1312 |
|
|
dout << "purity-related systematic uncertainty" << endl;
|
1313 |
|
|
|
1314 |
|
|
TText *infobox = write_title(summary.str());
|
1315 |
|
|
infobox->SetX(0.75);
|
1316 |
|
|
infobox->SetTextSize(0.03);
|
1317 |
|
|
infobox->SetY(0.75);
|
1318 |
|
|
infobox->Draw();
|
1319 |
|
|
|
1320 |
buchmann |
1.16 |
CompleteSave(zbcanvas,"Systematics/Purity");
|
1321 |
|
|
|
1322 |
|
|
|
1323 |
buchmann |
1.17 |
|
1324 |
buchmann |
1.16 |
float SysMPF_Purity = abs(ExtrapolatedResult-Reference.MPF_Result_FaceValue.getValue());
|
1325 |
|
|
|
1326 |
|
|
float sys_alpha = abs(SysMPF_Alpha_down)>abs(SysMPF_Alpha_up)?abs(SysMPF_Alpha_down):abs(SysMPF_Alpha_up);
|
1327 |
|
|
float sys_eff = abs(SysMPF_EFF_down)>abs(SysMPF_EFF_up)?abs(SysMPF_EFF_down):abs(SysMPF_EFF_up);
|
1328 |
|
|
float sys_purity = abs(SysMPF_Purity);
|
1329 |
|
|
float sys = sqrt(sys_alpha*sys_alpha+sys_eff*sys_eff+sys_purity*sys_purity);
|
1330 |
|
|
|
1331 |
|
|
dout << "MPF METHOD:" << endl;
|
1332 |
buchmann |
1.17 |
dout << " Systematics : down up (selected)" << endl;
|
1333 |
buchmann |
1.16 |
dout << " Alpha variation : " << SysMPF_Alpha_down << " , " << SysMPF_Alpha_up << " ( " << sys_alpha << ") " << endl;
|
1334 |
|
|
dout << " eff/mistag variation : " << SysMPF_EFF_down << " , " << SysMPF_EFF_up << " ( " << sys_eff << ") " << endl;
|
1335 |
|
|
dout << " purity : " << SysMPF_Purity << " ( " << sys_purity << " )" << endl;
|
1336 |
|
|
dout << " total : " << sys << endl;
|
1337 |
|
|
dout << endl << endl;
|
1338 |
buchmann |
1.17 |
dout << " FINAL RESULTS : " << endl;
|
1339 |
|
|
dout << " C_{abs}^{b} = " << Reference.MPF_Result_FaceValue << " (stat) +/- " << sys << " (sys) " << endl;
|
1340 |
|
|
dout << " C_{abs}^{inc} = " << inclusive.MPF_Result_FaceValue << " (stat) " << endl;
|
1341 |
|
|
|
1342 |
|
|
float sysfinal = Reference.MPF_Result_FaceValue.getValue()/inclusive.MPF_Result_FaceValue.getValue();
|
1343 |
|
|
sysfinal *= sqrt(sys*sys/(Reference.MPF_Result_FaceValue.getValue()*Reference.MPF_Result_FaceValue.getValue()));
|
1344 |
|
|
//yes, this could be simplified but it would look like a bug.
|
1345 |
|
|
|
1346 |
|
|
dout << " C_{corr} = " << Reference.MPF_Result_FaceValue/inclusive.MPF_Result_FaceValue << " (stat) +/- " << sysfinal << " (sys) " << endl;
|
1347 |
buchmann |
1.16 |
|
1348 |
buchmann |
1.15 |
LeadingB=TCut("Zb3010_bTagProbCSVBP[0]>0.898");
|
1349 |
buchmann |
1.16 |
|
1350 |
buchmann |
1.15 |
} else {
|
1351 |
|
|
ZbResultContainer Reference = new_data_mc_agreement_2d("Zb3010_alpha","reference",TCut("Zb3010_bTagProbCSVBP[0]>0.898"),TCut("ZbCHS3010_BTagWgt"));
|
1352 |
|
|
}
|
1353 |
|
|
|
1354 |
buchmann |
1.1 |
|
1355 |
buchmann |
1.2 |
delete zbcanvas;
|
1356 |
buchmann |
1.1 |
}
|
1357 |
buchmann |
1.7 |
|
1358 |
|
|
|
1359 |
|
|
|
1360 |
|
|
|
1361 |
|
|
//*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/* DELETE EVERYTHING BELOW THIS LINE /*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*/*//
|
1362 |
|
|
|
1363 |
|
|
|
1364 |
|
|
const char* concatenate(string bla1, string bla2) {
|
1365 |
|
|
stringstream bla;
|
1366 |
|
|
bla << bla1 << bla2;
|
1367 |
|
|
return bla.str().c_str();
|
1368 |
|
|
}
|
1369 |
|
|
|
1370 |
|
|
void SpecialCutFlow(string identifier) {
|
1371 |
|
|
stringstream MegaCut;
|
1372 |
|
|
|
1373 |
|
|
|
1374 |
|
|
|
1375 |
|
|
MegaCut << " 1*(" << (const char*) (ZplusBsel&&TCut(concatenate(identifier,"_pfJetGoodNumBtag>0"))) << ")";
|
1376 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB) << ")";
|
1377 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB) << ")";
|
1378 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut) << ")";
|
1379 |
buchmann |
1.9 |
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000").c_str())) << ")";
|
1380 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.3").c_str())) << ")";
|
1381 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.2").c_str())) << ")";
|
1382 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.15").c_str())) << ")";
|
1383 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.1").c_str())) << ")";
|
1384 |
|
|
MegaCut << " + 1*(" << (const char*) (ZplusBsel&&LeadingB&&EtaB&&PhiZcut&&TCut(((string)"pt>10&&pt<1000&&"+identifier+"_alpha<0.05").c_str())) << ")";
|
1385 |
buchmann |
1.7 |
MegaCut << " ";
|
1386 |
|
|
|
1387 |
|
|
TCanvas *can = new TCanvas("can","can");
|
1388 |
|
|
can->SetLogy(1);
|
1389 |
buchmann |
1.9 |
TCut basecut(ZplusBsel);
|
1390 |
buchmann |
1.7 |
|
1391 |
|
|
|
1392 |
|
|
|
1393 |
|
|
TLegend *leg = allsamples.allbglegend();
|
1394 |
|
|
|
1395 |
|
|
|
1396 |
|
|
TH1F *data = allsamples.Draw("data", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,data,luminosity);
|
1397 |
|
|
THStack mcm = allsamples.DrawStack("mc", MegaCut.str(),11,-0.5,10.5, "", "events", basecut,mc,luminosity);
|
1398 |
|
|
|
1399 |
|
|
float runningsum=0;
|
1400 |
|
|
for(int i=data->GetNbinsX();i>0;i--) {
|
1401 |
|
|
runningsum+=data->GetBinContent(i);
|
1402 |
|
|
data->SetBinContent(i,runningsum);
|
1403 |
|
|
}
|
1404 |
|
|
|
1405 |
|
|
float minimum=data->GetMaximum();
|
1406 |
|
|
|
1407 |
|
|
TH1F* h;
|
1408 |
|
|
TIter nextOF(mcm.GetHists());
|
1409 |
|
|
|
1410 |
|
|
float mcsum=0;
|
1411 |
|
|
float zb=0;
|
1412 |
|
|
while ( h = (TH1F*)nextOF() ) {
|
1413 |
|
|
float runningsum=0;
|
1414 |
|
|
minimum=data->GetMaximum();//done deliberately at each step so get the minimum of the last (!) contribution
|
1415 |
|
|
for(int i=h->GetNbinsX();i>0;i--) {
|
1416 |
|
|
runningsum+=h->GetBinContent(i);
|
1417 |
|
|
h->SetBinContent(i,runningsum);
|
1418 |
|
|
if(runningsum<minimum&&runningsum>0) minimum=runningsum;
|
1419 |
|
|
}
|
1420 |
|
|
if(Contains(h->GetName(),"Z_b_")) {
|
1421 |
|
|
zb=h->GetBinContent(h->GetNbinsX());
|
1422 |
|
|
}
|
1423 |
|
|
mcsum+=h->GetBinContent(h->GetNbinsX());
|
1424 |
|
|
}
|
1425 |
|
|
|
1426 |
|
|
|
1427 |
|
|
|
1428 |
|
|
data->SetMinimum(0.05*minimum);
|
1429 |
|
|
can->cd(1)->SetBottomMargin(0.25);
|
1430 |
|
|
data->GetXaxis()->SetBinLabel(1,"Pre-selection");
|
1431 |
|
|
data->GetXaxis()->SetBinLabel(2,"Contains b jet");
|
1432 |
|
|
data->GetXaxis()->SetBinLabel(3,"Leading jet is b-jet");
|
1433 |
|
|
data->GetXaxis()->SetBinLabel(4,"|#eta_{b}|<1.3 ");
|
1434 |
|
|
data->GetXaxis()->SetBinLabel(5,"|#delta#phi(b,Z)|>2.7");
|
1435 |
|
|
data->GetXaxis()->SetBinLabel(6,"10<p_{T}^{Z}<1000 GeV");
|
1436 |
|
|
data->GetXaxis()->SetBinLabel(7,"#alpha < 0.3");
|
1437 |
|
|
data->GetXaxis()->SetBinLabel(8,"#alpha < 0.2");
|
1438 |
|
|
data->GetXaxis()->SetBinLabel(9,"#alpha < 0.15");
|
1439 |
|
|
data->GetXaxis()->SetBinLabel(10,"#alpha < 0.1");
|
1440 |
|
|
data->GetXaxis()->SetBinLabel(11,"#alpha < 0.05");
|
1441 |
|
|
data->GetXaxis()->LabelsOption("v");
|
1442 |
|
|
|
1443 |
|
|
stringstream purityinfo;
|
1444 |
|
|
purityinfo << "Purity: " << std::setprecision(3) << 100*zb/mcsum << " %";
|
1445 |
|
|
stringstream neventsinfo;
|
1446 |
|
|
neventsinfo << "Nevents: " << data->GetBinContent(data->GetNbinsX());
|
1447 |
|
|
TH1F *crap = new TH1F("crap","",1,0,1);
|
1448 |
|
|
crap->SetLineColor(kWhite);
|
1449 |
|
|
leg->AddEntry(crap,purityinfo.str().c_str(),"l");
|
1450 |
|
|
leg->AddEntry(crap,neventsinfo.str().c_str(),"l");
|
1451 |
|
|
|
1452 |
|
|
data->Draw("e1");
|
1453 |
|
|
mcm.Draw("same");
|
1454 |
|
|
data->Draw("same,e1,axis");
|
1455 |
|
|
data->Draw("same,e1");
|
1456 |
|
|
// data->Draw("same,TEXT");
|
1457 |
|
|
|
1458 |
|
|
leg->Draw();
|
1459 |
|
|
|
1460 |
|
|
DrawPrelim();
|
1461 |
|
|
|
1462 |
|
|
CompleteSave(can,"CutFlow___"+identifier);
|
1463 |
|
|
|
1464 |
|
|
delete crap;
|
1465 |
|
|
delete data;
|
1466 |
|
|
|
1467 |
|
|
|
1468 |
|
|
}
|