]> git.uio.no Git - u/mrichter/AliRoot.git/blob - RICH/RICHspecies.C
Updated a bit with:
[u/mrichter/AliRoot.git] / RICH / RICHspecies.C
1 #include "iostream.h"
2
3 void RICHspecies (Int_t pion=1,Int_t kaon=0, Int_t proton=0) 
4 {
5 /////////////////////////////////////////////////////////////////////////
6 //   This macro is a small example of a ROOT macro
7 //   illustrating how to read the output of GALICE
8 //   and do some analysis.
9 //   
10 /////////////////////////////////////////////////////////////////////////
11
12 //Create canvases and plot style
13
14   TCanvas *c1 = 0;
15   TCanvas *c2 = 0;
16   /*TCanvas *c3 = 0;
17   TCanvas *c4 = 0;
18    TCanvas *c5 = 0;
19    TCanvas *c6 = 0;
20    TCanvas *c7 = 0;
21    TCanvas *c8 = 0;
22    TCanvas *c9 = 0;
23    TCanvas *c10 = 0;
24    TCanvas *c11 = 0;
25    TCanvas *c12 = 0;
26    TCanvas *c13 = 0;*/
27
28    //TF1* expo = 0;
29    //TF1* gaus = 0;
30    
31   TStyle *mystyle=new TStyle("Plain","mystyle");
32   mystyle->SetPalette(1,0);
33   //mystyle->SetTitleYSize(0.2);
34    //mystyle->SetStatW(0.19);
35   //mystyle->SetStatH(0.1);
36   //mystyle->SetStatFontSize(0.01);
37    //mystyle->SetTitleYSize(0.3);
38   mystyle->SetFuncColor(2);
39   mystyle->SetOptStat(0000);
40   mystyle->SetDrawBorder(0);
41   mystyle->SetTitleBorderSize(0);
42   mystyle->SetOptFit(0000);
43   mystyle->cd();
44
45
46   //defining the histos
47
48   TH1F *piondata = new TH1F("ckovangle1","Produced Cerenkov angle per photon",100,.35,1);
49   TH1F *kaondata = new TH1F("ckovangle2","Produced Cerenkov angle per photon",100,.35,1);
50   TH1F *protondata = new TH1F("ckovangle3","Produced Cerenkov angle per photon",100,.35,1);
51
52   TH1F *pionrec = new TH1F("omega3D1","Reconstructed Cerenkov angle per photon",100,.35,1);
53   TH1F *kaonrec = new TH1F("omega3D2","Reconstructed Cerenkov angle per photon",100,.35,1);
54   TH1F *protonrec = new TH1F("omega3D3","Reconstructed Cerenkov angle per photon",100,.35,1);
55
56   TH2F *pionid = new TH2F("identification1","Particle Identification",100,1,5,100,0,.8);
57   TH2F *kaonid = new TH2F("identification2","Particle Identification",100,1,5,100,0,.8);
58   TH2F *protonid = new TH2F("identification3","Particle Identification",100,1,5,100,0,.8);
59
60 // Connect the Root Galice files containing Geometry, Kine and Hits
61
62   //pion data file
63
64   if(pion)
65     {
66       TFile *filepion = (TFile*)gROOT->GetListOfFiles()->FindObject("pion.root");
67       if (filepion) filepion->Close(); 
68       filepion = new TFile("pion.root","UPDATE");
69
70       
71       piondata = (TH1F*) filepion->Get("ckovangle");
72       if (piondata) printf("Pion data object found on filepion\n");
73       if (!piondata) printf("Pion data object not found on filepion\n");
74       //printf(" %f %f %f %d\n", data->GetMean(), data->GetMaximum(), data->GetRMS(),data->GetEntries() );
75       pionrec = (TH1F*) filepion->Get("omega");
76  
77       pionid = (TH2F*) filepion->Get("identification");
78     }
79
80
81   //kaon data file
82
83   if(kaon)
84     {
85       filekaon = (TFile*)gROOT->GetListOfFiles()->FindObject("kaon.root");
86       if (filekaon) filekaon->Close(); 
87       filekaon = new TFile("kaon.root","UPDATE");
88       
89
90       kaondata = (TH1F*) filekaon->Get("ckovangle");
91       if (kaondata) printf("Kaon data object found on filekaon\n");
92       if (!kaondata) printf("Kaon data object not found on filekaon\n");
93       //printf(" %f %f %f %d\n", data->GetMean(), data->GetMaximum(), data->GetRMS(),data->GetEntries() );
94       kaonrec = (TH1F*) filekaon->Get("omega");
95       
96       kaonid = (TH2F*) filekaon->Get("identification");
97     }
98
99
100
101   //proton data file
102   
103   if(proton)
104     {
105       TFile *fileproton = (TFile*)gROOT->GetListOfFiles()->FindObject("proton.root");
106       if (fileproton) fileproton->Close(); 
107       fileproton = new TFile("proton.root","UPDATE");
108       
109       
110       TH1F *protondata = (TH1F*) fileproton->Get("ckovangle");
111       if (protondata) printf("Proton data object found on fileproton\n");
112       if (!protondata) printf("Proton data object not found on fileproton\n");
113       //printf(" %f %f %f %d\n", data->GetMean(), data->GetMaximum(), data->GetRMS(),data->GetEntries() );
114       TH1F *protonrec = (TH1F*) fileproton->Get("omega");
115       
116       protonid = (TH2F*) fileproton->Get("identification");
117     }
118
119
120
121
122
123
124   c1 = new TCanvas("c1","Cerenkov angle",50,50,300,700);
125   c1->Divide(1,2);
126
127   c1->cd(1);
128   piondata->SetFillColor(5);
129   piondata->SetXTitle("(rad)");
130   piondata->Draw();
131
132   kaondata->SetFillColor(4);
133   kaondata->SetXTitle("(rad)");
134   kaondata->Draw("same");
135
136       
137   protondata->SetFillColor(3);
138   protondata->SetXTitle("(rad)");
139   protondata->Draw("same");
140
141
142   c1->cd(2);
143   pionrec->SetFillColor(5);
144   pionrec->SetXTitle("(rad)");
145   pionrec->Draw();
146
147   kaonrec->SetFillColor(4);
148   kaonrec->SetXTitle("(rad)");
149   kaonrec->Draw("same");
150
151       
152   protonrec->SetFillColor(3);
153   protonrec->SetXTitle("(rad)");
154   protonrec->Draw("same");
155
156   c1 = new TCanvas("c12","Cerenkov angle vs. Momentum",150,150,550,350);
157
158   
159   TF1 *pionplot = new TF1("pion","acos(sqrt((.139*.139+x*x)/(x*x*1.285*1.285)))",1,5);
160   TF1 *kaonplot = new TF1("kaon","acos(sqrt((.439*.439+x*x)/(x*x*1.285*1.285)))",1,5);
161   TF1 *protonplot = new TF1("proton","acos(sqrt((.938*.938+x*x)/(x*x*1.285*1.285)))",1,5);
162         
163
164   pionplot->SetLineColor(5);
165   pionplot->Draw("same");
166
167   kaonplot->SetLineColor(4);
168   kaonplot->Draw("same");
169   
170   protonplot->SetLineColor(3);
171   protonplot->Draw("same");
172
173   pionid->SetXTitle("Momentum (GeV/c)");
174   pionid->SetYTitle("Cherenkov angle (radians)");
175   
176   pionid->Draw("cont0");
177   
178   kaonid->Draw("cont0 same");
179   
180   protonid->Draw("cont0 same");
181
182
183   pionplot->SetLineColor(5);
184   pionplot->Draw("same");
185
186   kaonplot->SetLineColor(4);
187   kaonplot->Draw("same");
188   
189   protonplot->SetLineColor(3);
190   protonplot->Draw("same");
191
192
193   pionplot->SetLineColor(5);
194   pionplot->Draw("same");
195
196   kaonplot->SetLineColor(4);
197   kaonplot->Draw("same");
198   
199   protonplot->SetLineColor(3);
200   protonplot->Draw("same");
201            
202
203   //filepion->Close();
204   
205   //delete gAlice;
206   printf("\nEnd of Macro  *************************************\n");
207 }
208
209
210