Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:30:48

0001 void QualityCutsPlots()
0002 {
0003     gROOT->SetStyle("Plain");
0004     TFile * file = new TFile("test.root");
0005 
0006 //=========Macro generated from canvas: c1/c1
0007 //=========  (Wed May 16 12:11:16 2007) by ROOT version5.14/00b
0008 
0009     TCanvas *c1 = new TCanvas("c1", "c1",547,72,698,498);
0010 
0011     c1->Divide(2,2);
0012 
0013     c1->cd(1);
0014 
0015     gPad->SetLogy();
0016 
0017     THStack * hs1 = new THStack("hs", "Signed decay length for all tracks.");
0018 
0019     //sdlsdl_fake_tracks->SetLineColor(kGreen);
0020     sdl_fake_tracks->SetFillColor(kGreen);
0021     processWithErrors(sdl_fake_tracks);
0022     hs1->Add(sdl_fake_tracks);
0023 
0024     //sdl_displaced_tracks->SetLineColor(kRed);
0025     sdl_displaced_tracks->SetFillColor(kRed);
0026     processWithErrors(sdl_displaced_tracks);
0027     hs1->Add(sdl_displaced_tracks);
0028 
0029     //sdl_bad_tracks->SetLineColor(kYellow);
0030     sdl_bad_tracks->SetFillColor(kCyan);
0031     processWithErrors(sdl_bad_tracks);
0032     hs1->Add(sdl_bad_tracks);
0033 
0034     // sdl_B_tracks->SetLineColor(kBlue);
0035     sdl_B_tracks->SetFillColor(kBlue);
0036     processWithErrors(sdl_B_tracks);
0037     hs1->Add(sdl_B_tracks);
0038 
0039     //sdl_nonB_tracks->SetLineColor(kBlack);
0040     sdl_nonB_tracks->SetFillColor(kBlack);
0041     processWithErrors(sdl_nonB_tracks);
0042     hs1->Add(sdl_nonB_tracks);
0043 
0044     hs1->Draw("nostack bar");
0045     hs1->GetXaxis()->SetTitle("Signed decay length [cm]");
0046     hs1->GetYaxis()->SetTitle("Relative frequency");
0047 
0048     TLegend *leg1 = new TLegend(0.62458,0.692819,0.885747,0.839096,NULL,"brNDC");
0049     leg1->SetBorderSize(1);
0050     leg1->SetLineColor(0);
0051     leg1->SetLineStyle(1);
0052     leg1->SetLineWidth(1);
0053     leg1->SetFillColor(0);
0054     leg1->SetFillStyle(1001);
0055     leg1->AddEntry(sdl_fake_tracks,"Fake", "f");
0056     leg1->AddEntry(sdl_bad_tracks,"Bad", "f");
0057     leg1->AddEntry(sdl_displaced_tracks,"Displaced", "f");
0058     leg1->AddEntry(sdl_B_tracks,"B", "f");
0059     leg1->AddEntry(sdl_nonB_tracks,"Non B", "f");
0060     leg1->Draw();
0061 
0062     c1->cd(2);
0063 
0064     gPad->SetLogy();
0065 
0066     THStack * hs2 = new THStack("hs", "Distance to jet for all tracks.");
0067 
0068     // dta_fake_tracks->SetLineColor(kBlack);
0069     dta_fake_tracks->SetFillColor(kGreen);
0070     processWithErrors(dta_fake_tracks);
0071     hs2->Add(dta_fake_tracks);
0072 
0073     // dta_displaced_tracks->SetLineColor(kWhite);
0074     dta_displaced_tracks->SetFillColor(kRed);
0075     processWithErrors(dta_displaced_tracks);
0076     hs2->Add(dta_displaced_tracks);
0077 
0078     //sdl_bad_tracks->SetLineColor(kYellow);
0079     dta_bad_tracks->SetFillColor(kCyan);
0080     processWithErrors(dta_bad_tracks);
0081     hs2->Add(dta_bad_tracks);
0082 
0083     // dta_B_tracks->SetLineColor(kWhite);
0084     dta_B_tracks->SetFillColor(kBlue);
0085     processWithErrors(dta_B_tracks);
0086     hs2->Add(dta_B_tracks);
0087 
0088     // dta_nonB_tracks->SetLineColor(kWhite);
0089     dta_nonB_tracks->SetFillColor(kBlack);
0090     processWithErrors(dta_nonB_tracks);
0091     hs2->Add(dta_nonB_tracks);
0092 
0093     hs2->Draw("nostack bar");
0094     hs2->GetXaxis()->SetTitle("Distance to jet [cm]");
0095     hs2->GetYaxis()->SetTitle("Relative frequency");
0096 
0097     TLegend *leg2 = new TLegend(0.62458,0.692819,0.885747,0.839096,NULL,"brNDC");
0098     leg2->SetBorderSize(1);
0099     leg2->SetLineColor(0);
0100     leg2->SetLineStyle(1);
0101     leg2->SetLineWidth(1);
0102     leg2->SetFillColor(0);
0103     leg2->SetFillStyle(1001);
0104     leg2->AddEntry(dta_fake_tracks,"Fake", "f");
0105     leg2->AddEntry(dta_bad_tracks,"Bad", "f");
0106     leg2->AddEntry(dta_displaced_tracks,"Displaced", "f");
0107     leg2->AddEntry(dta_B_tracks,"B", "f");
0108     leg2->AddEntry(dta_nonB_tracks,"Non B", "f");
0109     leg2->Draw();
0110 
0111     c1->cd(3);
0112 
0113     gPad->SetLogy();
0114 
0115     THStack * hs3 = new THStack("hs", "LIP for all tracks.");
0116 
0117     // lip_fake_tracks->SetLineColor(kBlack);
0118     lip_fake_tracks->SetFillColor(kGreen);
0119     processWithErrors(lip_fake_tracks);
0120     hs3->Add(lip_fake_tracks);
0121 
0122     // lip_displaced_tracks->SetLineColor(kWhite);
0123     lip_displaced_tracks->SetFillColor(kRed);
0124     processWithErrors(lip_displaced_tracks);
0125     hs3->Add(lip_displaced_tracks);
0126 
0127     //sdl_bad_tracks->SetLineColor(kYellow);
0128     lip_bad_tracks->SetFillColor(kCyan);
0129     processWithErrors(lip_bad_tracks);
0130     hs3->Add(lip_bad_tracks);
0131 
0132     // lip_B_tracks->SetLineColor(kWhite);
0133     lip_B_tracks->SetFillColor(kBlue);
0134     processWithErrors(lip_B_tracks);
0135     hs3->Add(lip_B_tracks);
0136 
0137     // lip_nonB_tracks->SetLineColor(kWhite);
0138     lip_nonB_tracks->SetFillColor(kBlack);
0139     processWithErrors(lip_nonB_tracks);
0140     hs3->Add(lip_nonB_tracks);
0141 
0142     hs3->Draw("nostack bar");
0143     hs3->GetXaxis()->SetTitle("Logitudinal impact parameter [cm]");
0144     hs3->GetYaxis()->SetTitle("Relative frequency");
0145 
0146     TLegend *leg3 = new TLegend(0.62458,0.692819,0.885747,0.839096,NULL,"brNDC");
0147     leg3->SetBorderSize(1);
0148     leg3->SetLineColor(0);
0149     leg3->SetLineStyle(1);
0150     leg3->SetLineWidth(1);
0151     leg3->SetFillColor(0);
0152     leg3->SetFillStyle(1001);
0153     leg3->AddEntry(lip_fake_tracks,"Fake", "f");
0154     leg3->AddEntry(lip_bad_tracks,"Bad", "f");
0155     leg3->AddEntry(lip_displaced_tracks,"Displaced", "f");
0156     leg3->AddEntry(lip_B_tracks,"B", "f");
0157     leg3->AddEntry(lip_nonB_tracks,"Non B", "f");
0158     leg3->Draw();
0159 
0160     c1->cd(4);
0161 
0162     gPad->SetLogy();
0163 
0164     THStack * hs4 = new THStack("hs", "TIP for all tracks.");
0165 
0166     // tip_fake_tracks->SetLineColor(kBlack);
0167     tip_fake_tracks->SetFillColor(kGreen);
0168     processWithErrors(tip_fake_tracks);
0169     hs4->Add(tip_fake_tracks);
0170 
0171     // tip_displaced_tracks->SetLineColor(kWhite);
0172     tip_displaced_tracks->SetFillColor(kRed);
0173     processWithErrors(tip_displaced_tracks);
0174     hs4->Add(tip_displaced_tracks);
0175 
0176     tip_bad_tracks->SetFillColor(kCyan);
0177     processWithErrors(tip_bad_tracks);
0178     hs4->Add(tip_bad_tracks);
0179 
0180     // tip_B_tracks->SetLineColor(kWhite);
0181     tip_B_tracks->SetFillColor(kBlue);
0182     processWithErrors(tip_B_tracks);
0183     hs4->Add(tip_B_tracks);
0184 
0185     // tip_nonB_tracks->SetLineColor(kWhite);
0186     tip_nonB_tracks->SetFillColor(kBlack);
0187     processWithErrors(tip_nonB_tracks);
0188     hs4->Add(tip_nonB_tracks);
0189 
0190     hs4->Draw("nostack bar");
0191     hs4->GetXaxis()->SetTitle("Transverse impact parameter [cm]");
0192     hs4->GetYaxis()->SetTitle("Relative frequency");
0193 
0194     TLegend *leg4 = new TLegend(0.62458,0.692819,0.885747,0.839096,NULL,"brNDC");
0195     leg4->SetBorderSize(1);
0196     leg4->SetLineColor(0);
0197     leg4->SetLineStyle(1);
0198     leg4->SetLineWidth(1);
0199     leg4->SetFillColor(0);
0200     leg4->SetFillStyle(1001);
0201     leg4->AddEntry(tip_fake_tracks,"Fake", "f");
0202     leg4->AddEntry(tip_bad_tracks,"Bad", "f");
0203     leg4->AddEntry(tip_displaced_tracks,"Displaced", "f");
0204     leg4->AddEntry(tip_B_tracks,"B", "f");
0205     leg4->AddEntry(tip_nonB_tracks,"Non B", "f");
0206     leg4->Draw();
0207 
0208     TCanvas *c2 = new TCanvas("c2", "c1",547,72,698,498);
0209 
0210     c2->Divide(2,2);
0211 
0212     c2->cd(1);
0213 
0214     gPad->SetLogy();
0215 
0216     THStack * hs5 = new THStack("hs", "Track pt for all tracks.");
0217 
0218     // pt_1Gev_fake_tracks->SetLineColor(kGreen);
0219     pt_1Gev_fake_tracks->SetFillColor(kGreen);
0220     processWithErrors(pt_1Gev_fake_tracks);
0221     hs5->Add(pt_1Gev_fake_tracks);
0222 
0223     pt_1Gev_bad_tracks->SetFillColor(kCyan);
0224     processWithErrors(pt_1Gev_bad_tracks);
0225     hs5->Add(pt_1Gev_bad_tracks);
0226 
0227     // pt_1Gev_displaced_tracks->SetLineColor(kRed);
0228     pt_1Gev_displaced_tracks->SetFillColor(kRed);
0229     processWithErrors(pt_1Gev_displaced_tracks);
0230     hs5->Add(pt_1Gev_displaced_tracks);
0231 
0232     // pt_1Gev_nonB_tracks->SetLineColor(kBlack);
0233     pt_1Gev_nonB_tracks->SetFillColor(kBlack);
0234     processWithErrors(pt_1Gev_nonB_tracks);
0235     hs5->Add(pt_1Gev_nonB_tracks);
0236 
0237     // pt_1Gev_B_tracks->SetLineColor(kBlue);
0238     pt_1Gev_B_tracks->SetFillColor(kBlue);
0239     processWithErrors(pt_1Gev_B_tracks);
0240     hs5->Add(pt_1Gev_B_tracks);
0241 
0242     hs5->Draw("nostack bar");
0243     hs5->GetXaxis()->SetTitle("pt [GeV]");
0244     hs5->GetYaxis()->SetTitle("Relative frequency");
0245 
0246     TLegend *leg5 = new TLegend(0.62458,0.692819,0.885747,0.839096,NULL,"brNDC");
0247     leg5->SetBorderSize(1);
0248     leg5->SetLineColor(0);
0249     leg5->SetLineStyle(1);
0250     leg5->SetLineWidth(1);
0251     leg5->SetFillColor(0);
0252     leg5->SetFillStyle(1001);
0253     leg5->AddEntry(pt_1Gev_fake_tracks,"Fake", "f");
0254     leg5->AddEntry(pt_1Gev_bad_tracks,"Bad", "f");
0255     leg5->AddEntry(pt_1Gev_displaced_tracks,"Displaced", "f");
0256     leg5->AddEntry(pt_1Gev_B_tracks,"B", "f");
0257     leg5->AddEntry(pt_1Gev_nonB_tracks,"Non B", "f");
0258     leg5->Draw();
0259 
0260     c2->cd(2);
0261 
0262     gPad->SetLogy();
0263 
0264     THStack * hs6 = new THStack("hs", "Track pt for all tracks.");
0265 
0266     //pt_B_tracks->SetLineColor(kBlue);
0267     pt_B_tracks->SetFillColor(kBlue);
0268     processWithErrors(pt_B_tracks);
0269     hs6->Add(pt_B_tracks);
0270 
0271     //pt_fake_tracks->SetLineColor(kGreen);
0272     pt_fake_tracks->SetFillColor(kGreen);
0273     processWithErrors(pt_fake_tracks);
0274     hs6->Add(pt_fake_tracks);
0275 
0276     pt_bad_tracks->SetFillColor(kCyan);
0277     processWithErrors(pt_bad_tracks);
0278     hs6->Add(pt_bad_tracks);
0279 
0280     //pt_nonB_tracks->SetLineColor(kBlack);
0281     pt_nonB_tracks->SetFillColor(kBlack);
0282     processWithErrors(pt_nonB_tracks);
0283     hs6->Add(pt_nonB_tracks);
0284 
0285     //pt_displaced_tracks->SetLineColor(kRed);
0286     pt_displaced_tracks->SetFillColor(kRed);
0287     processWithErrors(pt_displaced_tracks);
0288     hs6->Add(pt_displaced_tracks);
0289 
0290     hs6->Draw("nostack bar");
0291     hs6->GetXaxis()->SetTitle("pt [GeV]");
0292     hs6->GetYaxis()->SetTitle("Relative frequency");
0293 
0294     TLegend *leg6 = new TLegend(0.62458,0.692819,0.885747,0.839096,NULL,"brNDC");
0295     leg6->SetBorderSize(1);
0296     leg6->SetLineColor(0);
0297     leg6->SetLineStyle(1);
0298     leg6->SetLineWidth(1);
0299     leg6->SetFillColor(0);
0300     leg6->SetFillStyle(1001);
0301     leg6->AddEntry(pt_fake_tracks,"Fake", "f");
0302     leg6->AddEntry(pt_bad_tracks,"Bad", "f");
0303     leg6->AddEntry(pt_displaced_tracks,"Displaced", "f");
0304     leg6->AddEntry(pt_B_tracks,"B", "f");
0305     leg6->AddEntry(pt_nonB_tracks,"Non B", "f");
0306     leg6->Draw();
0307 
0308     c2->cd(3);
0309 
0310     gPad->SetLogy();
0311 
0312     THStack * hs7 = new THStack("hs", "Normilized Chi2 for all tracks.");
0313 
0314     //chi2_fake_tracks->SetLineColor(kGreen);
0315     chi2_fake_tracks->SetFillColor(kGreen);
0316     processWithErrors(chi2_fake_tracks);
0317     hs7->Add(chi2_fake_tracks);
0318 
0319     chi2_bad_tracks->SetFillColor(kCyan);
0320     processWithErrors(chi2_bad_tracks);
0321     hs7->Add(chi2_bad_tracks);
0322 
0323     //chi2_displaced_tracks->SetLineColor(kRed);
0324     chi2_displaced_tracks->SetFillColor(kRed);
0325     processWithErrors(chi2_displaced_tracks);
0326     hs7->Add(chi2_displaced_tracks);
0327 
0328     //chi2_B_tracks->SetLineColor(kBlue);
0329     chi2_B_tracks->SetFillColor(kBlue);
0330     processWithErrors(chi2_B_tracks);
0331     hs7->Add(chi2_B_tracks);
0332 
0333     //chi2_nonB_tracks->SetLineColor(kBlack);
0334     chi2_nonB_tracks->SetFillColor(kBlack);
0335     processWithErrors(chi2_nonB_tracks);
0336     hs7->Add(chi2_nonB_tracks);
0337 
0338     hs7->Draw("nostack bar");
0339     hs7->GetXaxis()->SetTitle("Normilized Chi2");
0340     hs7->GetYaxis()->SetTitle("Relative frequency");
0341 
0342     TLegend * leg7 = new TLegend(0.62458,0.692819,0.885747,0.839096,NULL,"brNDC");
0343     leg7->SetBorderSize(1);
0344     leg7->SetLineColor(0);
0345     leg7->SetLineStyle(1);
0346     leg7->SetLineWidth(1);
0347     leg7->SetFillColor(0);
0348     leg7->SetFillStyle(1001);
0349     leg7->AddEntry(chi2_fake_tracks,"Fake", "f");
0350     leg7->AddEntry(chi2_bad_tracks,"Bad", "f");
0351     leg7->AddEntry(chi2_displaced_tracks,"Displaced", "f");
0352     leg7->AddEntry(chi2_B_tracks,"B", "f");
0353     leg7->AddEntry(chi2_nonB_tracks,"Non B", "f");
0354     leg7->Draw();
0355 
0356     c2->cd(4);
0357 
0358     gPad->SetLogy();
0359 
0360     THStack * hs8 = new THStack("hs", "Hits for all tracks.");
0361 
0362     hits_fake_tracks->SetLineColor(kGreen);
0363     //hits_fake_tracks->SetFillColor(kGreen);
0364     processWithoutErrors(hits_fake_tracks);
0365     hs8->Add(hits_fake_tracks);
0366 
0367     hits_bad_tracks->SetLineColor(kCyan);
0368     processWithoutErrors(hits_bad_tracks);
0369     hs8->Add(hits_bad_tracks);
0370 
0371     hits_displaced_tracks->SetLineColor(kRed);
0372     //hits_displaced_tracks->SetFillColor(kRed);
0373     processWithoutErrors(hits_displaced_tracks);
0374     hs8->Add(hits_displaced_tracks);
0375 
0376     hits_B_tracks->SetLineColor(kBlue);
0377     //hits_B_tracks->SetFillColor(kBlue);
0378     processWithoutErrors(hits_B_tracks);
0379     hs8->Add(hits_B_tracks);
0380 
0381     hits_nonB_tracks->SetLineColor(kBlack);
0382     //hits_nonB_tracks->SetFillColor(kBlack);
0383     processWithoutErrors(hits_nonB_tracks);
0384     hs8->Add(hits_nonB_tracks);
0385 
0386     hs8->Draw("nostack");
0387     hs8->GetXaxis()->SetTitle("Hits");
0388     hs8->GetYaxis()->SetTitle("Relative frequency");
0389 
0390     TLegend *leg8 = new TLegend(0.62458,0.692819,0.885747,0.839096,NULL,"brNDC");
0391     leg8->SetBorderSize(1);
0392     leg8->SetLineColor(0);
0393     leg8->SetLineStyle(1);
0394     leg8->SetLineWidth(1);
0395     leg8->SetFillColor(0);
0396     leg8->SetFillStyle(1001);
0397     leg8->AddEntry(hits_fake_tracks,"Fake", "f");
0398     leg8->AddEntry(hits_bad_tracks,"Bad", "f");
0399     leg8->AddEntry(hits_displaced_tracks,"Displaced", "f");
0400     leg8->AddEntry(hits_B_tracks,"B", "f");
0401     leg8->AddEntry(hits_nonB_tracks,"Non B", "f");
0402     leg8->Draw();
0403 }
0404 
0405 void processWithErrors(TH1* histogram)
0406 {
0407     histogram->Scale(1./histogram->GetEntries());
0408     for (int i = 0; i < histogram->GetNbinsX(); i++)
0409         histogram->SetBinError(i,sqrt(histogram->GetBinContent(i)*(1-histogram->GetBinContent(i))/histogram->GetEntries()));
0410 }
0411 
0412 void processWithoutErrors(TH1* histogram)
0413 {
0414     histogram->Scale(1./histogram->GetEntries());
0415 }