File indexing completed on 2024-04-06 11:57:13
0001 {
0002 gROOT->Reset();
0003 gROOT->Clear();
0004
0005 gStyle->SetNdivisions(5);
0006 gStyle->SetCanvasBorderMode(0);
0007 gStyle->SetPadBorderMode(1);
0008 gStyle->SetOptTitle(1);
0009 gStyle->SetStatFont(42);
0010 gStyle->SetCanvasColor(10);
0011 gStyle->SetPadColor(0);
0012 gStyle->SetTitleFont(62,"xy");
0013 gStyle->SetLabelFont(62,"xy");
0014 gStyle->SetTitleFontSize(0.045);
0015 gStyle->SetTitleSize(0.042,"xy");
0016 gStyle->SetLabelSize(0.05,"xy");
0017 gStyle->SetHistFillStyle(1001);
0018 gStyle->SetHistFillColor(0);
0019 gStyle->SetHistLineStyle(1);
0020 gStyle->SetHistLineWidth(1);
0021 gStyle->SetHistLineColor(1);
0022 gStyle->SetTitleXOffset(1.1);
0023 gStyle->SetTitleYOffset(1.15);
0024 gStyle->SetOptStat(1110);
0025 gStyle->SetOptStat(kFALSE);
0026 gStyle->SetOptFit(0111);
0027 gStyle->SetStatH(0.1);
0028
0029 TCanvas *c1 = new TCanvas("c1", "c1",129,17,926,703);
0030
0031
0032
0033 c1->SetGrid(1,1);
0034
0035
0036 TFile f0("/gpfs/defilippis/ValidationMisalignedTracker_ttbar.root");
0037 TTree *MyTree=FakeTracks;
0038
0039 TFile f1("/gpfs/defilippis/ValidationMisalignedTracker_ttbar_SurveyLAS.root");
0040 TTree *MyTree1=FakeTracks;
0041
0042 TFile f2("/gpfs/defilippis/ValidationMisalignedTracker_ttbar_SurveyLASCosmics.root");
0043 TTree *MyTree2=FakeTracks;
0044
0045 TFile f3("/gpfs/defilippis/ValidationMisalignedTracker_ttbar_10pb.root");
0046 TTree *MyTree3=FakeTracks;
0047
0048 TFile f4("/gpfs/defilippis/ValidationMisalignedTracker_ttbar_100pb.root");
0049 TTree *MyTree4=FakeTracks;
0050
0051 TFile f5("/gpfs/defilippis/ValidationMisalignedTracker_ttbar_10pb_NOAPE.root");
0052 TTree *MyTree5=FakeTracks;
0053
0054
0055
0056
0057
0058 TH1F *etazero = new TH1F("etazero","eta zero",20,0.,500.);
0059 TH1F *etauno = new TH1F("etauno","eta uno",20,0.,500.);
0060 TH1F *etadue = new TH1F("etadue","eta due",20,0.,500.);
0061 TH1F *etatre = new TH1F("etatre","eta tre",20,0.,500.);
0062
0063 MyTree->Project("etazero","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8");
0064 MyTree->Project("etauno","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8 && fake==1");
0065
0066 etadue->Add(etazero,etauno,1,-1);
0067
0068 etadue->Divide(etazero);
0069
0070
0071 float MC_bin=0.,Fake_bin=0.,err=0.;
0072 for (int k=1; k<21; k++){
0073 MC_bin = etazero->GetBinContent(k);
0074 Fake_bin =etadue->GetBinContent(k);
0075 if (MC_bin != 0.) {
0076 err=Fake_bin*(1.-Fake_bin)/MC_bin;
0077 if (err >0) {
0078 err=sqrt(err);
0079 }
0080 else {
0081 err=0.0001;
0082 }
0083 }
0084 etadue->SetBinError(k,err);
0085 MC_bin=0.;
0086 Fake_bin=0.;
0087 err=0.;
0088 }
0089
0090 etadue->SetTitle("Fake rate vs p_{T} for ttbar events");
0091 etadue->SetMarkerStyle(20);
0092 etadue->SetMarkerColor(2);
0093 etadue->SetMarkerSize(0.9);
0094 etadue->SetLineColor(1);
0095 etadue->SetLineWidth(1);
0096 etadue->Draw("P");
0097
0098 c1->Update();
0099 c1->WaitPrimitive();
0100
0101
0102
0103
0104
0105 TH1F *etazero_scen1 = new TH1F("etazero_scen1","eta zero",20,0.,500.);
0106 TH1F *etauno_scen1 = new TH1F("etauno_scen1","eta uno",20,0.,500.);
0107 TH1F *etadue_scen1 = new TH1F("etadue_scen1","eta due",20,0.,500.);
0108 TH1F *etatre_scen1 = new TH1F("etatre_scen1","eta tre",20,0.,500.);
0109
0110 MyTree1->Project("etazero_scen1","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8");
0111 MyTree1->Project("etauno_scen1","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8 && fake==1");
0112
0113 etadue_scen1->Add(etazero_scen1,etauno_scen1,1,-1);
0114
0115 etadue_scen1->Divide(etazero_scen1);
0116
0117
0118 float MC_bin=0.,Fake_bin=0.,err=0.;
0119 for (int k=1; k<21; k++){
0120 MC_bin = etazero_scen1->GetBinContent(k);
0121 Fake_bin =etadue_scen1->GetBinContent(k);
0122 if (MC_bin != 0.) {
0123 err=Fake_bin*(1.-Fake_bin)/MC_bin;
0124 if (err >0) {
0125 err=sqrt(err);
0126 }
0127 else {
0128 err=0.0001;
0129 }
0130 }
0131 etadue_scen1->SetBinError(k,err);
0132 MC_bin=0.;
0133 Fake_bin=0.;
0134 err=0.;
0135 }
0136
0137
0138 etadue_scen1->SetTitle("Fake rate vs p_{T} for ttbar events");
0139 etadue_scen1->SetMarkerStyle(21);
0140 etadue_scen1->SetMarkerColor(3);
0141 etadue_scen1->SetMarkerSize(0.9);
0142 etadue_scen1->SetLineColor(1);
0143 etadue_scen1->SetLineWidth(1);
0144 etadue_scen1->Draw("P");
0145
0146 c1->Update();
0147 c1->WaitPrimitive();
0148
0149
0150
0151
0152
0153
0154 TH1F *etazero_scen2 = new TH1F("etazero_scen2","eta zero",20,0.,500.);
0155 TH1F *etauno_scen2 = new TH1F("etauno_scen2","eta uno",20,0.,500.);
0156 TH1F *etadue_scen2 = new TH1F("etadue_scen2","eta due",20,0.,500.);
0157 TH1F *etatre_scen2 = new TH1F("etatre_scen2","eta tre",20,0.,500.);
0158
0159 MyTree2->Project("etazero_scen2","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8");
0160 MyTree2->Project("etauno_scen2","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8 && fake==1");
0161
0162 etadue_scen2->Add(etazero_scen2,etauno_scen2,1,-1);
0163
0164 etadue_scen2->Divide(etazero_scen2);
0165
0166
0167 float MC_bin=0.,Fake_bin=0.,err=0.;
0168 for (int k=1; k<21; k++){
0169 MC_bin = etazero_scen2->GetBinContent(k);
0170 Fake_bin =etadue_scen2->GetBinContent(k);
0171 if (MC_bin != 0.) {
0172 err=Fake_bin*(1.-Fake_bin)/MC_bin;
0173 if (err >0) {
0174 err=sqrt(err);
0175 }
0176 else {
0177 err=0.0001;
0178 }
0179 }
0180 etadue_scen2->SetBinError(k,err);
0181 MC_bin=0.;
0182 Fake_bin=0.;
0183 err=0.;
0184 }
0185
0186
0187 etadue_scen2->SetTitle("Fake rate vs p_{T} for ttbar events");
0188 etadue_scen2->SetMarkerStyle(22);
0189 etadue_scen2->SetMarkerColor(4);
0190 etadue_scen2->SetMarkerSize(0.9);
0191 etadue_scen2->SetLineColor(1);
0192 etadue_scen2->SetLineWidth(1);
0193 etadue_scen2->Draw("P");
0194
0195 c1->Update();
0196 c1->WaitPrimitive();
0197
0198
0199
0200
0201
0202 TH1F *etazero_scen3 = new TH1F("etazero_scen3","eta zero",20,0.,500.);
0203 TH1F *etauno_scen3 = new TH1F("etauno_scen3","eta uno",20,0.,500.);
0204 TH1F *etadue_scen3 = new TH1F("etadue_scen3","eta due",20,0.,500.);
0205 TH1F *etatre_scen3 = new TH1F("etatre_scen3","eta tre",20,0.,500.);
0206
0207 MyTree3->Project("etazero_scen3","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8");
0208 MyTree3->Project("etauno_scen3","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8 && fake==1");
0209
0210 etadue_scen3->Add(etazero_scen3,etauno_scen3,1,-1);
0211
0212 etadue_scen3->Divide(etazero_scen3);
0213
0214
0215 float MC_bin=0.,Fake_bin=0.,err=0.;
0216 for (int k=1; k<21; k++){
0217 MC_bin = etazero_scen3->GetBinContent(k);
0218 Fake_bin =etadue_scen3->GetBinContent(k);
0219 if (MC_bin != 0.) {
0220 err=Fake_bin*(1.-Fake_bin)/MC_bin;
0221 if (err >0) {
0222 err=sqrt(err);
0223 }
0224 else {
0225 err=0.0001;
0226 }
0227 }
0228 etadue_scen3->SetBinError(k,err);
0229 MC_bin=0.;
0230 Fake_bin=0.;
0231 err=0.;
0232 }
0233
0234
0235 etadue_scen3->SetTitle("Fake rate vs p_{T} for ttbar events");
0236 etadue_scen3->SetMarkerStyle(23);
0237 etadue_scen3->SetMarkerColor(5);
0238 etadue_scen3->SetMarkerSize(0.9);
0239 etadue_scen3->SetLineColor(1);
0240 etadue_scen3->SetLineWidth(1);
0241 etadue_scen3->Draw("P");
0242
0243 c1->Update();
0244 c1->WaitPrimitive();
0245
0246
0247
0248
0249
0250 TH1F *etazero_scen4 = new TH1F("etazero_scen4","eta zero",20,0.,500.);
0251 TH1F *etauno_scen4 = new TH1F("etauno_scen4","eta uno",20,0.,500.);
0252 TH1F *etadue_scen4 = new TH1F("etadue_scen4","eta due",20,0.,500.);
0253 TH1F *etatre_scen4 = new TH1F("etatre_scen4","eta tre",20,0.,500.);
0254
0255 MyTree4->Project("etazero_scen4","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8");
0256 MyTree4->Project("etauno_scen4","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8 && fake==1");
0257
0258 etadue_scen4->Add(etazero_scen4,etauno_scen4,1,-1);
0259
0260 etadue_scen4->Divide(etazero_scen4);
0261
0262
0263 float MC_bin=0.,Fake_bin=0.,err=0.;
0264 for (int k=1; k<21; k++){
0265 MC_bin = etazero_scen4->GetBinContent(k);
0266 Fake_bin =etadue_scen4->GetBinContent(k);
0267 if (MC_bin != 0.) {
0268 err=Fake_bin*(1.-Fake_bin)/MC_bin;
0269 if (err >0) {
0270 err=sqrt(err);
0271 }
0272 else {
0273 err=0.0001;
0274 }
0275 }
0276 etadue_scen4->SetBinError(k,err);
0277 MC_bin=0.;
0278 Fake_bin=0.;
0279 err=0.;
0280 }
0281
0282
0283 etadue_scen4->SetTitle("Fake rate vs p_{T} for ttbar events");
0284 etadue_scen4->SetMarkerStyle(24);
0285 etadue_scen4->SetMarkerColor(6);
0286 etadue_scen4->SetMarkerSize(0.9);
0287 etadue_scen4->SetLineColor(1);
0288 etadue_scen4->SetLineWidth(1);
0289 etadue_scen4->Draw("P");
0290
0291 c1->Update();
0292 c1->WaitPrimitive();
0293
0294
0295
0296
0297
0298
0299 TH1F *etazero_noErr = new TH1F("etazero_noErr","eta zero",20,0.,500.);
0300 TH1F *etauno_noErr = new TH1F("etauno_noErr","eta uno",20,0.,500.);
0301 TH1F *etadue_noErr = new TH1F("etadue_noErr","eta due",20,0.,500.);
0302 TH1F *etatre_noErr = new TH1F("etatre_noErr","eta tre",20,0.,500.);
0303
0304 MyTree5->Project("etazero_noErr","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8");
0305 MyTree5->Project("etauno_noErr","abs(fakerecpt)","fakerecpt<=500 && fakerecnhit>=8 && fake==1");
0306
0307 etadue_noErr->Add(etazero_noErr,etauno_noErr,1,-1);
0308
0309 etadue_noErr->Divide(etazero_noErr);
0310
0311
0312 float MC_bin=0.,Fake_bin=0.,err=0.;
0313 for (int k=1; k<21; k++){
0314 MC_bin = etazero_noErr->GetBinContent(k);
0315 Fake_bin =etadue_noErr->GetBinContent(k);
0316 if (MC_bin != 0.) {
0317 err=Fake_bin*(1.-Fake_bin)/MC_bin;
0318 if (err >0) {
0319 err=sqrt(err);
0320 }
0321 else {
0322 err=0.0001;
0323 }
0324 }
0325 etadue_noErr->SetBinError(k,err);
0326 MC_bin=0.;
0327 Fake_bin=0.;
0328 err=0.;
0329 }
0330
0331 etadue_noErr->SetTitle("Fake rate vs p_{T} noErr");
0332 etadue_noErr->SetMarkerStyle(25);
0333 etadue_noErr->SetMarkerColor(7);
0334 etadue_noErr->SetMarkerSize(0.9);
0335 etadue_noErr->SetLineColor(1);
0336 etadue_noErr->SetLineWidth(1);
0337 etadue_noErr->Draw("P");
0338
0339 c1->Update();
0340 c1->WaitPrimitive();
0341
0342
0343
0344
0345
0346 etadue->SetTitle("Fake rate vs p_{T} for ttbar events");
0347 etadue->SetXTitle("p_{T}(GeV/c)");
0348 etadue->SetYTitle("Fake Rate");
0349 etadue->SetAxisRange(-0.005,0.7,"Y");
0350 etadue->Draw();
0351 etadue_noErr->Draw("same");
0352 etadue_scen1->Draw("same");
0353 etadue_scen2->Draw("same");
0354 etadue_scen3->Draw("same");
0355 etadue_scen4->Draw("same");
0356
0357 TLegend *leg1 = new TLegend(0.1,0.81,0.82,0.925);
0358 leg1->SetTextAlign(32);
0359 leg1->SetTextColor(1);
0360 leg1->SetTextSize(0.03);
0361
0362 leg1->AddEntry(etadue,"perfect alignment", "P");
0363 leg1->AddEntry(etadue_scen1,"SurveyLAS alignment", "P");
0364 leg1->AddEntry(etadue_scen2,"SurveyLASCosmics alignment", "P");
0365 leg1->AddEntry(etadue_scen3,"10 pb-1 alignment", "P");
0366 leg1->AddEntry(etadue_scen4,"100 pb-1 alignment", "P");
0367 leg1->AddEntry(etadue_noErr,"10 pb-1 alignment; APE not used", "P");
0368
0369 leg1->Draw();
0370
0371 c1->Update();
0372 c1->SaveAs("Fake_pt_ttbar.eps");
0373 c1->WaitPrimitive();
0374
0375 gROOT->Reset();
0376 gROOT->Clear();
0377
0378 delete c1;
0379 }