3 void RICHspecies (Int_t pion=1,Int_t kaon=0, Int_t proton=0)
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.
10 /////////////////////////////////////////////////////////////////////////
12 //Create canvases and plot style
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);
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);
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);
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);
60 // Connect the Root Galice files containing Geometry, Kine and Hits
66 TFile *filepion = (TFile*)gROOT->GetListOfFiles()->FindObject("pion.root");
67 if (filepion) filepion->Close();
68 filepion = new TFile("pion.root","UPDATE");
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");
77 pionid = (TH2F*) filepion->Get("identification");
85 filekaon = (TFile*)gROOT->GetListOfFiles()->FindObject("kaon.root");
86 if (filekaon) filekaon->Close();
87 filekaon = new TFile("kaon.root","UPDATE");
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");
96 kaonid = (TH2F*) filekaon->Get("identification");
105 TFile *fileproton = (TFile*)gROOT->GetListOfFiles()->FindObject("proton.root");
106 if (fileproton) fileproton->Close();
107 fileproton = new TFile("proton.root","UPDATE");
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");
116 protonid = (TH2F*) fileproton->Get("identification");
124 c1 = new TCanvas("c1","Cerenkov angle",50,50,300,700);
128 piondata->SetFillColor(5);
129 piondata->SetXTitle("(rad)");
132 kaondata->SetFillColor(4);
133 kaondata->SetXTitle("(rad)");
134 kaondata->Draw("same");
137 protondata->SetFillColor(3);
138 protondata->SetXTitle("(rad)");
139 protondata->Draw("same");
143 pionrec->SetFillColor(5);
144 pionrec->SetXTitle("(rad)");
147 kaonrec->SetFillColor(4);
148 kaonrec->SetXTitle("(rad)");
149 kaonrec->Draw("same");
152 protonrec->SetFillColor(3);
153 protonrec->SetXTitle("(rad)");
154 protonrec->Draw("same");
156 c1 = new TCanvas("c12","Cerenkov angle vs. Momentum",150,150,550,350);
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);
164 pionplot->SetLineColor(5);
165 pionplot->Draw("same");
167 kaonplot->SetLineColor(4);
168 kaonplot->Draw("same");
170 protonplot->SetLineColor(3);
171 protonplot->Draw("same");
173 pionid->SetXTitle("Momentum (GeV/c)");
174 pionid->SetYTitle("Cherenkov angle (radians)");
176 pionid->Draw("cont0");
178 kaonid->Draw("cont0 same");
180 protonid->Draw("cont0 same");
183 pionplot->SetLineColor(5);
184 pionplot->Draw("same");
186 kaonplot->SetLineColor(4);
187 kaonplot->Draw("same");
189 protonplot->SetLineColor(3);
190 protonplot->Draw("same");
193 pionplot->SetLineColor(5);
194 pionplot->Draw("same");
196 kaonplot->SetLineColor(4);
197 kaonplot->Draw("same");
199 protonplot->SetLineColor(3);
200 protonplot->Draw("same");
206 printf("\nEnd of Macro *************************************\n");