ad583475ad2af02c1aaa8c94562000b5e240d5e9
[u/mrichter/AliRoot.git] / ITS / AliITSPlotTracksV1.C
1 #include <iostream.h>
2 #include <fstream.h>
3
4 void AliITSPlotTracksV1(){  
5   
6   ifstream in ("AliITSTra.out");
7   
8   TVector DataOut(10);
9   
10   ///////////////////////////////// Histograms definition ///////////////////////////////////////////
11
12   
13   TH1F *hp=new TH1F("hp","PHI resolution",50,-15.,15.); hp->SetFillColor(4);     
14   TH1F *hl=new TH1F("hl","LAMBDA resolution",50,-15.,15.); hl->SetFillColor(4);  
15   
16   // TH1F *hp=new TH1F("hp","PHI resolution",50,-5.,5.); hp->SetFillColor(4);     
17   //TH1F *hl=new TH1F("hl","LAMBDA resolution",50,-5.,5.); hl->SetFillColor(4); 
18       
19  // TH1F *hpt=new TH1F("hpt","Relative Pt resolution",50,-5.,5.);
20  TH1F *hpt=new TH1F("hpt","Relative Pt resolution",40,-10.,10.); 
21   hpt->SetFillColor(2); 
22   TH1F *hd=new TH1F("hd","Impact parameter distribution ",100,0,2000); 
23   hd->SetFillColor(6);
24   
25   TH1F *hdr=new TH1F("hdr","Dr ",50,-1000,1000);  
26   hdr->SetFillColor(kGreen);
27   TH1F *hdz=new TH1F("hdz","Dz ",50,-1000,1000);  
28   hdz->SetFillColor(kBlue);
29   
30   /*
31   TH1F *hdr=new TH1F("hdr","Dr ",50,-100,100);  
32   hdr->SetFillColor(kGreen);
33   TH1F *hdz=new TH1F("hdz","Dz ",50,-1000,1000);  
34   hdz->SetFillColor(kBlue);  
35   */ 
36
37   TH1F *hgood=new TH1F("hgood","Good tracks",10,0,2);
38   hgood->Sumw2();  // aggiunto il 15-01-01
39   TH1F *hfound=new TH1F("hfound","Found tracks",10,0,2);
40   hfound->Sumw2();  // aggiunto il 15-01-01
41   TH1F *hfake=new TH1F("hfake","Fake tracks",10,0,2);
42   hfake->Sumw2();    
43   TH1F *hg=new TH1F("hg","",10,0,2); //efficiency for good tracks  
44   hg->SetLineColor(4); hg->SetLineWidth(2);
45   TH1F *hf=new TH1F("hf","Efficiency for fake tracks",10,0,2);
46   /*hf->SetFillColor(1); hf->SetFillStyle(3013);*/ hf->SetLineColor(4); hf->SetLineWidth(2);
47
48   /////////////////////////////////////////////////////////////////////////////////////////////////// 
49
50  ifstream in1 ("AliITSTrag.out");
51
52   Double_t ptg; 
53   for(;;) {
54     in1 >> ptg; 
55     if( in1.eof() ) break;
56     hgood->Fill(ptg);
57   }
58   in1.close();
59    
60   Int_t neglabs=0;      
61   for (;;){    
62     for (int r=0; r<10; r++) in>>DataOut(r);
63     if( in.eof() ) break;
64
65     Double_t ptg=DataOut(0); Double_t labITS=DataOut(1); Double_t labTPC=DataOut(2); Double_t ptperc=DataOut(3);          
66     Double_t deltalam=DataOut(4); Double_t deltaphi=DataOut(5);
67     Double_t Dtot=DataOut(6); Double_t Dr=DataOut(7); Double_t Dz=DataOut(8);
68     Double_t signC=DataOut(9);
69     
70    // if(signC<0) continue;     
71
72      if(labITS<0) neglabs++;    
73       if(labITS>=0) hfound->Fill(ptg); else     {   hfake->Fill(ptg);}
74
75           if(labITS>=0 ) {        
76       hpt->Fill(ptperc);
77       hl->Fill(deltalam);
78       hp->Fill(deltaphi);
79       hd->Fill(Dtot);
80       hdr->Fill(Dr);
81       hdz->Fill(Dz);
82    }    
83   }
84   
85
86   in.close();
87   Stat_t ngood=hgood->GetEntries(); cerr<<"Good tracks "<<ngood<<endl;  
88   Stat_t nfound=hfound->GetEntries(); cerr<<"Found tracks "<<nfound<<endl;
89   Stat_t nfake=hfake->GetEntries(); cerr<<"Fake tracks "<<nfake<<endl;       
90   gStyle->SetOptStat(111110);
91   gStyle->SetOptFit(1);    
92   TCanvas *c1=new TCanvas("c1","",0,0,700,700);
93   TPad *p1=new TPad("p1","",0,0.5,0.5,1); p1->Draw(); hp->SetXTitle("(mrad)");
94   p1->cd(); hp->Draw();  hp->Fit("gaus"); c1->cd();
95   TPad *p2=new TPad("p2","",0.5,0.5,1,1); p2->Draw(); hl->SetXTitle("(mrad)");
96   p2->cd(); hl->Draw(); hl->Fit("gaus"); c1->cd();
97   TPad *p3=new TPad("p3","",0,0,0.5,0.5); p3->Draw(); hpt->SetXTitle("(%)");
98   p3->cd(); hpt->Draw(); hpt->Fit("gaus"); c1->cd();
99   TPad *p4=new TPad("p4","",0.5,0,1,0.5); p4->Draw(); hd->SetXTitle("(micron)");
100   p4->cd(); hd->Draw(); c1->cd();
101    
102   TCanvas *c3=new TCanvas("c3","",200,200,800,500);
103   hfound->Print("all");  // aggiunto il 16-01-01
104   hgood->Print("all");  // aggiunto il 16-01-01
105   TPad *p7=new TPad("p7","",0,0,0.333,1); p7->Draw(); p7->cd(); hfound->Draw(); c3->cd(); 
106   TPad *p8=new TPad("p8","",0.333,0,0.666,1); p8->Draw(); p8->cd(); hfake->Draw(); c3->cd();
107   TPad *p9=new TPad("p9","",0.666,0,1,1); p9->Draw(); p9->cd(); hgood->Draw(); c3->cd();
108      
109   TCanvas *c4=new TCanvas("c4","",300,300,800,500);
110   hg->Divide(hfound,hgood,1.,1.); //,"b");
111   hf->Divide(hfake,hgood,1.,1.); //,"b");
112   hg->SetMaximum(1.4);
113   hg->SetYTitle("Tracking efficiency");
114   hg->SetXTitle("Pt (GeV/c)");
115   hg->Print("all");  // aggiunto il 16-01-01
116   hg->Draw();  // to not plot the erro bars    hg->Draw("histo");
117   TLine *line1 = new TLine(0,1.0,2,1.0); line1->SetLineStyle(4);
118   line1->Draw("same");
119   TLine *line2 = new TLine(0,0.9,2,0.9); line2->SetLineStyle(4);
120   line2->Draw("histosame");
121   
122    
123   hf->SetFillColor(1);
124   hf->SetFillStyle(3013);
125   hf->SetLineColor(2);
126   hf->SetLineWidth(2);
127   hf->Draw("same");  // to not plot the error bars  hf->Draw("histosame");
128   
129   TText *text = new TText(0.461176,0.248448,"Fake tracks");
130   text->SetTextSize(0.05);
131   text->Draw();
132   text = new TText(0.453919,1.11408,"Good tracks");
133   text->SetTextSize(0.05);
134   text->Draw();
135          
136   TCanvas *c2=new TCanvas("c2","",100,100,700,400);
137   TPad *p5=new TPad("p5","",0,0,0.5,1); p5->Draw(); hdr->SetXTitle("(micron)");
138   p5->cd(); hdr->Draw();  hdr->Fit("gaus"); c2->cd();
139   TPad *p6=new TPad("p6","",0.5,0,1,1); p6->Draw(); hdz->SetXTitle("(micron)");
140   p6->cd(); hdz->Draw(); hdz->Fit("gaus"); c2->cd();
141   
142   cout<<"neglabs = "<<neglabs<<"\n";  // provvisoria
143 }