]> git.uio.no Git - u/mrichter/AliRoot.git/blame - RICH/AliRICHEllipse.cxx
negative indexes allowed
[u/mrichter/AliRoot.git] / RICH / AliRICHEllipse.cxx
CommitLineData
237c933d 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
88cb7938 16/* $Id$ */
237c933d 17
39e3aaf7 18#include "TMath.h"
237c933d 19#include "AliRICHEllipse.h"
20#include "AliRICH.h"
21#include "AliRun.h"
4f17f810 22#include "AliRICHPatRec.h"
39e3aaf7 23#include "AliRICHGeometry.h"
237c933d 24
25#include <TRandom.h>
26
27ClassImp(AliRICHEllipse)
28
29//________________________________________________________________________________
30AliRICHEllipse::AliRICHEllipse()
31{
32
33// Default Constructor for a RICH ellipse
34
35 fCx = 0;
36 fCy = 0;
37 fOmega = 0;
38 fTheta = 0;
39 fPhi = 0;
40 fh= 0;
41}
42
43//________________________________________________________________________________
44AliRICHEllipse::~AliRICHEllipse()
45{
46
47// Destructor
48
49 fCx = 0;
50 fCy = 0;
51 fOmega = 0;
52 fTheta = 0;
53 fPhi = 0;
54 fh= 0;
55}
56
57
58//________________________________________________________________________________
4f17f810 59AliRICHEllipse::AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi, Float_t emiss)
237c933d 60{
61
62// Constructor for a RICH ellipse
63
64 fCx = cx;
65 fCy = cy;
66 fOmega = omega;
67 fTheta = theta;
68 fPhi = phi;
4f17f810 69 fEmissPoint = emiss;
74f08360 70 fh=9.25;
237c933d 71}
72
73//________________________________________________________________________________
39e3aaf7 74void AliRICHEllipse::CreatePoints(Int_t chamber)
237c933d 75{
76
77// Create points along the ellipse equation
39e3aaf7 78
79 Float_t x, y, rotx, roty, h, cx, cy, phi, omega, theta, omega1, theta1, phiinc;
80 Float_t a,b,c,r,e, offset;
81
82 Float_t kPi=TMath::Pi();
237c933d 83
84 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
85 AliRICHChamber* iChamber;
39e3aaf7 86 AliRICHGeometry* geometry;
237c933d 87
88 iChamber = &(pRICH->Chamber(chamber));
39e3aaf7 89 geometry=iChamber->GetGeometryModel();
237c933d 90
39e3aaf7 91 //h = 2.3 * geometry->GetRadiatorToPads();
92 h = geometry->GetRadiatorToPads();
93 //printf("h: %f",h);
94
95 cx = fCx;
96 cy = fCy;
97 theta = fTheta;
98 omega = fOmega;
99 phiinc = fPhi+kPi/2;
100
101 printf("Omega: %f, Theta: %f, Phi: %f\n", omega, theta, phiinc);
102
103
237c933d 104 for(Float_t i=0;i<1000;i++)
105 {
39e3aaf7 106 phi=((Float_t)(i)/1000)*2*kPi;
107 //printf("Phi: %f\n",phi);
108
109 //theta1=SnellAngle(theta1);
237c933d 110
39e3aaf7 111 //if(phi<=TMath::Pi())
112 omega1=SnellAngle(omega);
113 theta1=SnellAngle(theta);
114 //omega1=SnellAngle(omega+cos(phi)*theta);
115 //if(phi>TMath::Pi())
116 //omega1=SnellAngle(omega+(1-2*(2*TMath::Pi()-phi)/(TMath::Pi()))*theta);
117
118
119 //Omega1->Fill(omega1,(float) 1);
120
121 a = h*(tan(omega1+theta1)+tan(omega1-theta1))/2;
122 b = h*tan(omega1);
123 e = sqrt(1 - (b*b)/(a*a));
124 c = a*e;
125 r = (a*(1-e*e))/(1+e*cos(e));
126 offset = h*(tan(omega1+theta1)-tan(omega1-theta1))/2;
127
128 x = b* sin(phi);
129 y = a* cos(phi) + offset;
130
131 rotx = x*cos(phiinc)-y*sin(phiinc);
132 roty = x*sin(phiinc)+y*cos(phiinc);
133
134 //x = h * 1/(tan(omega1)) * sin(phi+phiinc);
135 //y = x * 1/(tan(phi+phiinc));
136
237c933d 137
39e3aaf7 138
139 //Rings->Fill(x,y,(float) 1);
140
141 rotx += cx;
142 roty += cy;
143
144 //printf("x:%f, y: %f\n",x,y);
145
146 Float_t vectorLoc[3]={rotx,6.276,roty};
237c933d 147 Float_t vectorGlob[3];
148 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
39e3aaf7 149 SetPoint((Int_t) i,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
237c933d 150 //printf("Coordinates: %f %f %f\n",vectorGlob[0],vectorGlob[1],vectorGlob[2]);
39e3aaf7 151
237c933d 152 }
4f17f810 153
39e3aaf7 154}
4f17f810 155
156void AliRICHEllipse::CerenkovRingDrawing(Int_t chamber,Int_t track)
157{
158
159//to draw Cherenkov ring by known Cherenkov angle
160
161 Int_t nmaxdegrees;
162 Int_t Nphpad;
163 Float_t phpad;
164 Float_t nfreonave, nquartzave;
165 Float_t aveEnerg;
166 Float_t energy[2];
167 Float_t e1, e2, f1, f2;
168 Float_t pointsOnCathode[3];
169
b1036a3b 170 //printf("Drawing ring in chamber:%d\n",chamber);
4f17f810 171
172
173 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
174 AliRICHChamber* iChamber;
175
176 iChamber = &(pRICH->Chamber(chamber));
177
178 AliRICHPatRec *PatRec = new AliRICHPatRec;
74f08360 179 PatRec->TrackParam(track,chamber,fTheta,fOmega);
4f17f810 180
b1036a3b 181 //printf("Just created PateRec\n");
4f17f810 182
183//parameters to calculate freon window refractive index vs. energy
184
185 Float_t a = 1.177;
186 Float_t b = 0.0172;
187
188//parameters to calculate quartz window refractive index vs. energy
189/*
190 Energ[0] = 5.6;
191 Energ[1] = 7.7;
192*/
193 energy[0] = 5.0;
194 energy[1] = 8.0;
195 e1 = 10.666;
196 e2 = 18.125;
197 f1 = 46.411;
198 f2 = 228.71;
199
237c933d 200
4f17f810 201 /*Float_t nquartz = 1.585;
202 Float_t ngas = 1.;
203 Float_t nfreon = 1.295;
204 Float_t value;
205 */
237c933d 206
207
208
4f17f810 209 nmaxdegrees = 360;
210
211 for (Nphpad=0; Nphpad<nmaxdegrees;Nphpad++) {
212
213 phpad = (360./(Float_t)nmaxdegrees)*(Float_t)Nphpad;
214
215 aveEnerg = (energy[0]+energy[1])/2.;
216 //aveEnerg = 6.5;
217
218
219 nfreonave = a+b*aveEnerg;
220 nquartzave = sqrt(1+(f1/(TMath::Power(e1,2)-TMath::Power(aveEnerg,2)))+
221 (f2/(TMath::Power(e2,2)-TMath::Power(aveEnerg,2))));
222
223 //nfreonave = 1.295;
224 //nquartzave = 1.585;
225
b1036a3b 226 ///printf("Calling DistancefromMip %f %f \n",fEmissPoint,fOmega);
4f17f810 227
228 //Float_t dummy =
74f08360 229 PatRec->DistanceFromMip(nfreonave, nquartzave,fEmissPoint,fOmega, phpad, pointsOnCathode,fTheta,fPhi);
4f17f810 230
231 //Float_t points[3];
232
233 //points = pointsOnCathode;
234
235
236 //printf(" values %f %f %f\n",points[0],points[1],points[2]);
237
238 Float_t vectorLoc[3]={pointsOnCathode[0],pointsOnCathode[2],pointsOnCathode[1]};
239 Float_t vectorGlob[3];
240 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
241 SetPoint(Nphpad,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
242 //fCoordEllipse[0][Nphpad] = pointsOnCathode[0];
243 //fCoordEllipse[1][Nphpad] = pointsOnCathode[1];
244
b1036a3b 245 //printf(" values %f %f \n",pointsOnCathode[0],pointsOnCathode[1]);
4f17f810 246
247 }
248
249}
250
251
237c933d 252
39e3aaf7 253Float_t AliRICHEllipse:: SnellAngle(Float_t iangle)
254{
255
256// Compute the Snell angle
257
258 Float_t nfreon = 1.295;
259 Float_t nquartz = 1.585;
260 Float_t ngas = 1;
261
262 Float_t sinrangle;
263 Float_t rangle;
264 Float_t a1, a2;
265
266 a1=nfreon/nquartz;
267 a2=nquartz/ngas;
268
269 sinrangle = a1*a2*sin(iangle);
237c933d 270
39e3aaf7 271 if(sinrangle>1.) {
272 rangle = 999.;
273 return rangle;
274 }
275
276 rangle = asin(sinrangle);
277 //printf("iangle %f, a1*a2, %f, sinranlge, %f, rangle, %f\n", iangle, a1*a2, sinrangle, rangle);
278 return rangle;
279
280}
237c933d 281
282
283
284
285
286
287
288