Tracking V1 ported to the HEAD
[u/mrichter/AliRoot.git] / ITS / AliITSPlotTracksV1.C
CommitLineData
af8e1c2d 1#include <iostream.h>
2#include <fstream.h>
3
9040b789 4void AliITSPlotTracksV1()
5{
6 TFile *file = new TFile("AliITSComparisonV1.root");
7 TTree *tree = (TTree*)file->Get("Eval");
8
9 if (!tree) {
10 cerr << "Evaluation tree not found!" << endl;
11 return;
12 }
13
14 // histogram definition - I (efficiency)
15 TH1D *hFindables = new TH1D("hFindables", "Findable tracks", 10, 0, 2);
16 TH1D *hGood = new TH1D("hGood", "Good found tracks", 10, 0, 2);
17 TH1D *hFake = new TH1D("hFake", "Fake found tracks", 10, 0, 2);
18 TH1D *hRatioG = new TH1D("hRatioG", "", 10, 0, 2);
19 TH1D *hRatioF = new TH1D("hRatioF", "", 10, 0, 2);
20 hGood->Sumw2();
21 hFake->Sumw2();
22 hFindables->Sumw2();
23 hRatioG->SetLineColor(kBlue);
24 hRatioG->SetLineWidth(2);
25 hRatioF->SetLineColor(kRed);
26 hRatioF->SetLineWidth(2);
27
28 // histograms definition - II (resolution)
29 TH1D *hPhi = new TH1D("hPhi", "#Phi resolution", 50, -15., 15.);
30 TH1D *hLambda = new TH1D("hLambda", "#lambda resolution", 50, -15., 15.);
31 TH1D *hPt = new TH1D("hPt", "Relative Pt resolution", 40, -10., 10.);
32 TH1D *hDtot = new TH1D("hDtot", "Total impact parameter distribution", 100, 0., 2000.);
33 TH1D *hDr = new TH1D("hDr", "Transv. impact parameter distribution", 50, -1000., 1000.);
34 TH1D *hDz = new TH1D("hDz", "Long. impact parameter distribution", 50, -1000., 1000.);
35 hPhi->SetFillColor(4);
36 hLambda->SetFillColor(4);
37 hPt->SetFillColor(2);
38 hDtot->SetFillColor(6);
39 hDr->SetFillColor(kGreen);
40 hDz->SetFillColor(kBlue);
41
42 // Evaluation tree settings
43 Int_t labITS, labTPC, signC;
44 Int_t i, j, tot = (Int_t)tree->GetEntries();
45 Double_t difpt, diflambda, difphi, Dz, Dr, Dtot, ptg;
46 tree->SetBranchAddress("labITS" , &labITS );
47 tree->SetBranchAddress("labTPC" , &labTPC );
48 tree->SetBranchAddress("difpt" , &difpt );
49 tree->SetBranchAddress("diflambda", &diflambda);
50 tree->SetBranchAddress("difphi" , &difphi );
51 tree->SetBranchAddress("Dz" , &Dz );
52 tree->SetBranchAddress("Dr" , &Dr );
53 tree->SetBranchAddress("Dtot" , &Dtot );
54 tree->SetBranchAddress("ptg" , &ptg );
55 tree->SetBranchAddress("signC" , &signC );
56
57 // Filling the histogram of findable tracks (w.r. to momentum)
58 for(i = 0; i < tot; i++) {
59 tree->GetEntry(i);
60 hFindables->Fill(ptg);
61 }
62
63 // Filling the evaluation histograms
64 Int_t neglabs = 0;
65 for(i = 0; i < tot; i++) {
66 tree->GetEntry(i);
67// if(signC<0) continue;
68 if (labITS < 0) neglabs++;
69 if (labITS >= 0) {
70 hGood->Fill(ptg);
71 hPt->Fill(difpt);
72 hLambda->Fill(diflambda);
73 hPhi->Fill(difphi);
74 hDtot->Fill(Dtot);
75 hDr->Fill(Dr);
76 hDz->Fill(Dz);
77 }
78 else {
79 hFake->Fill(ptg);
80 neglabs++;
81 }
82 }
af8e1c2d 83
9040b789 84 // Drawing
85 cerr << "Findable tracks : " << hFindables->GetEntries() << endl;
86 cerr << "Good found tracks : " << hGood->GetEntries() << endl;
87 cerr << "Fake found tracks : " << hFake->GetEntries() << endl;
88
89 gStyle->SetOptStat(111110);
90 gStyle->SetOptFit(1);
91
92 TCanvas *c1 = new TCanvas("c1","Parameter resolutions",0,0,700,700);
93 c1->Divide(2, 2, 0.001, 0.001);
94 c1->cd(1); hPhi->SetXTitle("(mrad)"); hPhi->Draw(); hPhi->Fit("gaus", "Q");
95 c1->cd(2); hLambda->SetXTitle("(mrad)"); hLambda->Draw(); hLambda->Fit("gaus", "Q");
96 c1->cd(3); hPt->SetXTitle("(%)"); hPt->Draw(); hPt->Fit("gaus", "Q");
97 c1->cd(4); hDtot->SetXTitle("(micron)"); hDtot->Draw();
98 c1->Update();
99
100 TCanvas *c2 = new TCanvas("c2","Impact parameters resolution",100,100,700,400);
101 c2->Divide(2, 1, 0.001, 0.001);
102 c2->cd(1); hDr->SetXTitle("(micron)"); hDr->Draw(); hDr->Fit("gaus", "Q");
103 c2->cd(2); hDz->SetXTitle("(micron)"); hDz->Draw(); hDz->Fit("gaus", "Q");
104 c2->Update();
105
106 TCanvas *c3 = new TCanvas("c3","Momentum distributions",200,200,800,500);
107 c3->Divide(3, 1, 0.001, 0.001);
108 c3->cd(1); hGood->Draw();
109 c3->cd(2); hFake->Draw();
110 c3->cd(3); hFindables->Draw();
111 c3->Update();
112
113 TCanvas *c4 = new TCanvas("c4","Tracking efficiency",300,300,800,500);
114 hRatioG->Divide(hGood, hFindables, 1., 1.);
115 hRatioF->Divide(hFake, hFindables, 1., 1.);
116 hRatioG->SetMaximum(1.4);
117 hRatioG->SetYTitle("Tracking efficiency");
118 hRatioG->SetXTitle("Pt (GeV/c)");
119 hRatioG->Draw(); // to not plot the erro bars hg->Draw("histo");
120 hRatioF->SetFillColor(1);
121 hRatioF->SetFillStyle(3013);
122 hRatioF->SetLineColor(2);
123 hRatioF->SetLineWidth(2);
124 hRatioF->Draw("same"); // to not plot the error bars hRatioF->Draw("histosame");
125 // a line to mark the best efficiency
126 TLine *line1 = new TLine(0,1.0,2,1.0); line1->SetLineStyle(4);
127 line1->Draw("same");
128 TLine *line2 = new TLine(0,0.9,2,0.9); line2->SetLineStyle(4);
129 line2->Draw("histosame");
130 // a text explanation
131 TText *text = new TText(0.461176,0.248448,"Fake tracks");
132 text->SetTextSize(0.05);
133 text->Draw();
134 text = new TText(0.453919,1.11408,"Good tracks");
135 text->SetTextSize(0.05);
136 text->Draw();
137 c4->Update();
138
139 cout << "neglabs = " << neglabs << endl; // provvisoria
af8e1c2d 140}