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.07);
0015 gStyle->SetTitleSize(0.046,"xy");
0016 gStyle->SetLabelSize(0.052,"xy");
0017
0018 gStyle->SetHistFillStyle(1001);
0019 gStyle->SetHistFillColor(0);
0020 gStyle->SetHistLineStyle(1);
0021 gStyle->SetHistLineWidth(2);
0022 gStyle->SetHistLineColor(2);
0023 gStyle->SetTitleXOffset(1.1);
0024 gStyle->SetTitleYOffset(1.15);
0025 gStyle->SetOptStat(1110);
0026 gStyle->SetOptStat(kFALSE);
0027 gStyle->SetOptFit(0111);
0028 gStyle->SetStatH(0.1);
0029
0030
0031 TCanvas *c1 = new TCanvas("c1","c1",129,17,926,703);
0032 c1->SetBorderSize(2);
0033 c1->SetFrameFillColor(0);
0034 c1->SetLogy(0);
0035 c1->SetGrid(1);
0036
0037 c1->cd();
0038
0039
0040
0041
0042
0043 TFile f0("ValidationMisalignedTracker_singlemu100_merged.root");
0044 TTree *MyTree=EffTracks;
0045
0046 TFile f1("../../SurveyLAS/singlemu/Misalignment_SurveyLASOnlyScenario_refitter_singlemu.root");
0047 TTree *MyTree2=Tracks;
0048
0049 TFile f2("Misalignment_SurveyLASOnlyScenario_refitter_zmumu_singlemuSurveyLASCosmics.root");
0050 TTree *MyTree3=Tracks;
0051
0052 TFile f3("../../singlemu_310607/Misalignment10.root");
0053 TTree *MyTree4=Tracks;
0054
0055 TFile f4("../../singlemu_310607/Misalignment100.root");
0056 TTree *MyTree5=Tracks;
0057
0058 TFile f5("../../singlemu_310607/Misalignment_scenario10_refitter_singlemu_noape.root");
0059 TTree *MyTree6=Tracks;
0060
0061
0062
0063
0064
0065
0066
0067 TH1F *etazero = new TH1F("etazero","eta zero",80,0.,2.5);
0068 TH1F *etauno = new TH1F("etauno","eta uno",80,0.,2.5);
0069
0070 MyTree->Project("etazero","abs(eta)");
0071 MyTree->Project("etauno","abs(eta)","eff==1");
0072 TH1F *Effeta = etazero->Clone("Efficiency vs #eta");
0073
0074 Effeta->Reset();
0075 Effeta->Divide(etauno,etazero,1,1);
0076 Effeta->Sumw2();
0077
0078 float MC_bin=0.,Eff_bin=0.,err=0.;
0079 for (int k=1; k<81; k++){
0080 MC_bin = etazero->GetBinContent(k);
0081 Eff_bin = Effeta->GetBinContent(k);
0082 if (MC_bin != 0.) {
0083 err=Eff_bin*(1.-Eff_bin)/MC_bin;
0084 if (err >0) {
0085 err=sqrt(err);
0086 }
0087 else {
0088 err=0.0001;
0089 }
0090 }
0091 Effeta->SetBinError(k,err);
0092 MC_bin=0.;
0093 Eff_bin=0.;
0094 err=0.;
0095 }
0096
0097 Effeta->SetMarkerStyle(20);
0098 Effeta->SetMarkerColor(2);
0099 Effeta->SetMarkerSize(0.9);
0100 Effeta->SetLineColor(1);
0101 Effeta->SetLineWidth(1);
0102 Effeta->Draw("P");
0103
0104 c1->Update();
0105 c1->WaitPrimitive();
0106
0107
0108
0109
0110
0111
0112
0113 TH1F *etazero_scen1 = new TH1F("etazero_scen1","eta zero",80,0.,2.5);
0114 TH1F *etauno_scen1 = new TH1F("etauno_scen1","eta uno",80,0.,2.5);
0115
0116 MyTree2->Project("etazero_scen1","abs(eta)");
0117 MyTree2->Project("etauno_scen1","abs(eta)","eff==1");
0118 TH1F *Effeta_scen1 = etazero_scen1->Clone("Efficiency vs #eta");
0119
0120 Effeta_scen1->Reset();
0121 Effeta_scen1->Divide(etauno_scen1,etazero_scen1,1,1);
0122 Effeta_scen1->Sumw2();
0123
0124 float MCeta_bin=0.,Eff_bin=0.,err=0.;
0125
0126 for (int k=1; k<81; k++){
0127 MC_bin = etazero_scen1->GetBinContent(k);
0128 Eff_bin = Effeta_scen1->GetBinContent(k);
0129 if (MC_bin != 0.) {
0130 err=Eff_bin*(1.-Eff_bin)/MC_bin;
0131 if (err >0) {
0132 err=sqrt(err);
0133 }
0134 else {
0135 err=0.0001;
0136 }
0137 }
0138 Effeta_scen1->SetBinError(k,err);
0139
0140 MC_bin=0.;
0141 Eff_bin=0.;
0142 err=0.;
0143 }
0144
0145 Effeta_scen1->SetMarkerStyle(21);
0146 Effeta_scen1->SetMarkerColor(3);
0147 Effeta_scen1->SetMarkerSize(0.9);
0148 Effeta_scen1->SetLineColor(1);
0149 Effeta_scen1->SetLineWidth(1);
0150 Effeta_scen1->Draw("P");
0151 c1->Update();
0152 c1->WaitPrimitive();
0153
0154
0155
0156
0157
0158
0159
0160 TH1F *etazero_scen2 = new TH1F("etazero_scen2","eta zero",80,0.,2.5);
0161 TH1F *etauno_scen2 = new TH1F("etauno_scen2","eta uno",80,0.,2.5);
0162
0163 MyTree3->Project("etazero_scen2","abs(eta)");
0164 MyTree3->Project("etauno_scen2","abs(eta)","eff==1");
0165 TH1F *Effeta_scen2 = etazero_scen2->Clone("Efficiency vs #eta");
0166
0167 Effeta_scen2->Reset();
0168 Effeta_scen2->Divide(etauno_scen2,etazero_scen2,1,1);
0169 Effeta_scen2->Sumw2();
0170
0171 float MC_bin=0.,Eff_bin=0.,err=0.;
0172 for (int k=1; k<81; k++){
0173 MC_bin = etazero_scen2->GetBinContent(k);
0174 Eff_bin = Effeta_scen2->GetBinContent(k);
0175 if (MC_bin != 0.) {
0176 err=Eff_bin*(1.-Eff_bin)/MC_bin;
0177 if (err >0) {
0178 err=sqrt(err);
0179 }
0180 else {
0181 err=0.0001;
0182 }
0183 }
0184 Effeta_scen2->SetBinError(k,err);
0185
0186 MC_bin=0.;
0187 Eff_bin=0.;
0188 err=0.;
0189 }
0190
0191 Effeta_scen2->SetMarkerStyle(22);
0192 Effeta_scen2->SetMarkerColor(4);
0193 Effeta_scen2->SetMarkerSize(0.9);
0194 Effeta_scen2->SetLineColor(1);
0195 Effeta_scen2->SetLineWidth(1);
0196 Effeta_scen2->Draw("P");
0197 c1->Update();
0198
0199
0200
0201
0202
0203
0204
0205
0206 TH1F *etazero_scen3 = new TH1F("etazero_scen3","eta zero",80,0.,2.5);
0207 TH1F *etauno_scen3 = new TH1F("etauno_scen3","eta uno",80,0.,2.5);
0208
0209 MyTree4->Project("etazero_scen3","abs(eta)");
0210 MyTree4->Project("etauno_scen3","abs(eta)","eff==1");
0211 TH1F *Effeta_scen3 = etazero_scen3->Clone("Efficiency vs #eta");
0212
0213 Effeta_scen3->Reset();
0214 Effeta_scen3->Divide(etauno_scen3,etazero_scen3,1,1);
0215 Effeta_scen3->Sumw2();
0216
0217 float MC_bin=0.,Eff_bin=0.,err=0.;
0218 for (int k=1; k<81; k++){
0219 MC_bin = etazero_scen3->GetBinContent(k);
0220 Eff_bin = Effeta_scen3->GetBinContent(k);
0221 if (MC_bin != 0.) {
0222 err=Eff_bin*(1.-Eff_bin)/MC_bin;
0223 if (err >0) {
0224 err=sqrt(err);
0225 }
0226 else {
0227 err=0.0001;
0228 }
0229 }
0230 Effeta_scen3->SetBinError(k,err);
0231
0232 MC_bin=0.;
0233 Eff_bin=0.;
0234 err=0.;
0235 }
0236
0237 Effeta_scen3->SetMarkerStyle(23);
0238 Effeta_scen3->SetMarkerColor(5);
0239 Effeta_scen3->SetMarkerSize(0.9);
0240 Effeta_scen3->SetLineColor(1);
0241 Effeta_scen3->SetLineWidth(1);
0242 Effeta_scen3->Draw("P");
0243 c1->Update();
0244
0245
0246
0247
0248
0249
0250
0251 TH1F *etazero_scen4 = new TH1F("etazero_scen4","eta zero",80,0.,2.5);
0252 TH1F *etauno_scen4 = new TH1F("etauno_scen4","eta uno",80,0.,2.5);
0253
0254 MyTree5->Project("etazero_scen4","abs(eta)");
0255 MyTree5->Project("etauno_scen4","abs(eta)","eff==1");
0256 TH1F *Effeta_scen4 = etazero_scen4->Clone("Efficiency vs #eta");
0257
0258 Effeta_scen4->Reset();
0259 Effeta_scen4->Divide(etauno_scen4,etazero_scen4,1,1);
0260 Effeta_scen4->Sumw2();
0261
0262 float MC_bin=0.,Eff_bin=0.,err=0.;
0263 for (int k=1; k<81; k++){
0264 MC_bin = etazero_scen4->GetBinContent(k);
0265 Eff_bin = Effeta_scen4->GetBinContent(k);
0266 if (MC_bin != 0.) {
0267 err=Eff_bin*(1.-Eff_bin)/MC_bin;
0268 if (err >0) {
0269 err=sqrt(err);
0270 }
0271 else {
0272 err=0.0001;
0273 }
0274 }
0275 Effeta_scen4->SetBinError(k,err);
0276
0277 MC_bin=0.;
0278 Eff_bin=0.;
0279 err=0.;
0280 }
0281
0282 Effeta_scen4->SetMarkerStyle(24);
0283 Effeta_scen4->SetMarkerColor(6);
0284 Effeta_scen4->SetMarkerSize(0.9);
0285 Effeta_scen4->SetLineColor(1);
0286 Effeta_scen4->SetLineWidth(1);
0287 Effeta_scen4->Draw("P");
0288 c1->Update();
0289
0290
0291
0292
0293
0294
0295
0296 TH1F *etazero_scen1_noErr = new TH1F("etazero_scen1_noErr","eta zero",80,0.,2.5);
0297 TH1F *etauno_scen1_noErr = new TH1F("etauno_scen1_noErr","eta uno",80,0.,2.5);
0298
0299 MyTree6->Project("etazero_scen1_noErr","abs(eta)");
0300 MyTree6->Project("etauno_scen1_noErr","abs(eta)","eff==1");
0301 TH1F *Effeta_scen1_noErr = etazero_scen1_noErr->Clone("Efficiency vs #eta");
0302
0303 Effeta_scen1_noErr->Reset();
0304 Effeta_scen1_noErr->Divide(etauno_scen1_noErr,etazero_scen1_noErr,1,1);
0305 Effeta_scen1_noErr->Sumw2();
0306
0307 float MC_bin=0.,Eff_bin=0.,err=0.;
0308 for (int k=1; k<81; k++){
0309 MC_bin = etazero_scen1_noErr->GetBinContent(k);
0310 Eff_bin = Effeta_scen1_noErr->GetBinContent(k);
0311 if (MC_bin != 0.) {
0312 err=Eff_bin*(1.-Eff_bin)/MC_bin;
0313 if (err >0) {
0314 err=sqrt(err);
0315 }
0316 else {
0317 err=0.0001;
0318 }
0319 }
0320 Effeta_scen1_noErr->SetBinError(k,err);
0321
0322 MC_bin=0.;
0323 Eff_bin=0.;
0324 err=0.;
0325 }
0326
0327 Effeta_scen1_noErr->SetMarkerStyle(26);
0328 Effeta_scen1_noErr->SetMarkerColor(7);
0329 Effeta_scen1_noErr->SetMarkerSize(0.9);
0330 Effeta_scen1_noErr->SetLineColor(1);
0331 Effeta_scen1_noErr->SetLineWidth(1);
0332 Effeta_scen1_noErr->Draw("P");
0333 c1->Update();
0334
0335
0336
0337
0338
0339
0340
0341 hframe = new TH2F("hframe","Global Efficiency vs #eta",80,0.,2.5,00,0,1.05);
0342 hframe->SetXTitle("#eta");
0343 hframe->SetYTitle("Global Efficiency");
0344 hframe->Draw();
0345 Effeta_scen1_noErr->Draw("same");
0346 Effeta->Draw("same");
0347 Effeta_scen1_noErr->SetTitle("Global Efficiency vs #eta");
0348 Effeta_scen1_noErr->SetXTitle("#eta");
0349 Effeta_scen1_noErr->SetYTitle("Global Efficiency");
0350 Effeta_scen1->Draw("same");
0351 Effeta_scen2->Draw("same");
0352 Effeta_scen3->Draw("same");
0353 Effeta_scen4->Draw("same");
0354
0355
0356
0357
0358
0359
0360
0361
0362
0363
0364
0365
0366 TLegend *leg1 = new TLegend(0.52,0.11,0.87,0.36);
0367 leg1->SetTextAlign(32);
0368 leg1->SetTextColor(1);
0369 leg1->SetTextSize(0.033);
0370 leg1->SetFillColor(0);
0371
0372 leg1->AddEntry(Effeta,"perfect ", "P");
0373 leg1->AddEntry(Effeta_scen1,"SurveyLAS ", "P");
0374 leg1->AddEntry(Effeta_scen2,"SurveyLASCosmics ", "P");
0375 leg1->AddEntry(Effeta_scen3,"10 pb^{-1} ", "P");
0376 leg1->AddEntry(Effeta_scen4,"100 pb^{-1} ", "P");
0377 leg1->AddEntry(Effeta_scen1_noErr,"10 pb^{-1}; APE not used", "P");
0378
0379 leg1->Draw();
0380
0381 c1->Update();
0382
0383
0384 c1->SaveAs("Eff_eta_nota.eps");
0385 c1->SaveAs("Eff_eta_nota.gif");
0386 c1->SaveAs("Eff_eta_nota.pdf");
0387
0388 gROOT->Reset();
0389 gROOT->Clear();
0390
0391 delete c1;
0392 }