Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 11:57:13

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