1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.4 2001/05/10 12:34:43 jbarbosa
19 Changed drwaing routines.
21 Revision 1.3 2000/11/01 15:37:44 jbarbosa
22 Removed verbose output.
24 Revision 1.2 2000/06/30 16:31:51 dibari
25 New drawing routine from Nico and Daniela.
27 Revision 1.1 2000/06/12 15:21:57 jbarbosa
33 #include "AliRICHEllipse.h"
36 #include "AliRICHPatRec.h"
37 #include "AliRICHGeometry.h"
41 ClassImp(AliRICHEllipse)
43 //________________________________________________________________________________
44 AliRICHEllipse::AliRICHEllipse()
47 // Default Constructor for a RICH ellipse
57 //________________________________________________________________________________
58 AliRICHEllipse::~AliRICHEllipse()
72 //________________________________________________________________________________
73 AliRICHEllipse::AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi, Float_t emiss)
76 // Constructor for a RICH ellipse
87 //________________________________________________________________________________
88 void AliRICHEllipse::CreatePoints(Int_t chamber)
91 // Create points along the ellipse equation
93 Float_t x, y, rotx, roty, h, cx, cy, phi, omega, theta, omega1, theta1, phiinc;
94 Float_t a,b,c,r,e, offset;
96 Float_t kPi=TMath::Pi();
98 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
99 AliRICHChamber* iChamber;
100 AliRICHGeometry* geometry;
102 iChamber = &(pRICH->Chamber(chamber));
103 geometry=iChamber->GetGeometryModel();
105 //h = 2.3 * geometry->GetRadiatorToPads();
106 h = geometry->GetRadiatorToPads();
115 printf("Omega: %f, Theta: %f, Phi: %f\n", omega, theta, phiinc);
118 for(Float_t i=0;i<1000;i++)
120 phi=((Float_t)(i)/1000)*2*kPi;
121 //printf("Phi: %f\n",phi);
123 //theta1=SnellAngle(theta1);
125 //if(phi<=TMath::Pi())
126 omega1=SnellAngle(omega);
127 theta1=SnellAngle(theta);
128 //omega1=SnellAngle(omega+cos(phi)*theta);
129 //if(phi>TMath::Pi())
130 //omega1=SnellAngle(omega+(1-2*(2*TMath::Pi()-phi)/(TMath::Pi()))*theta);
133 //Omega1->Fill(omega1,(float) 1);
135 a = h*(tan(omega1+theta1)+tan(omega1-theta1))/2;
137 e = sqrt(1 - (b*b)/(a*a));
139 r = (a*(1-e*e))/(1+e*cos(e));
140 offset = h*(tan(omega1+theta1)-tan(omega1-theta1))/2;
143 y = a* cos(phi) + offset;
145 rotx = x*cos(phiinc)-y*sin(phiinc);
146 roty = x*sin(phiinc)+y*cos(phiinc);
148 //x = h * 1/(tan(omega1)) * sin(phi+phiinc);
149 //y = x * 1/(tan(phi+phiinc));
153 //Rings->Fill(x,y,(float) 1);
158 //printf("x:%f, y: %f\n",x,y);
160 Float_t vectorLoc[3]={rotx,6.276,roty};
161 Float_t vectorGlob[3];
162 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
163 SetPoint((Int_t) i,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
164 //printf("Coordinates: %f %f %f\n",vectorGlob[0],vectorGlob[1],vectorGlob[2]);
170 void AliRICHEllipse::CerenkovRingDrawing(Int_t chamber,Int_t track)
173 //to draw Cherenkov ring by known Cherenkov angle
178 Float_t nfreonave, nquartzave;
181 Float_t e1, e2, f1, f2;
182 Float_t pointsOnCathode[3];
184 //printf("Drawing ring in chamber:%d\n",chamber);
187 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
188 AliRICHChamber* iChamber;
190 iChamber = &(pRICH->Chamber(chamber));
192 AliRICHPatRec *PatRec = new AliRICHPatRec;
193 PatRec->TrackParam(track,chamber,fTheta,fOmega);
195 //printf("Just created PateRec\n");
197 //parameters to calculate freon window refractive index vs. energy
202 //parameters to calculate quartz window refractive index vs. energy
215 /*Float_t nquartz = 1.585;
217 Float_t nfreon = 1.295;
225 for (Nphpad=0; Nphpad<nmaxdegrees;Nphpad++) {
227 phpad = (360./(Float_t)nmaxdegrees)*(Float_t)Nphpad;
229 aveEnerg = (energy[0]+energy[1])/2.;
233 nfreonave = a+b*aveEnerg;
234 nquartzave = sqrt(1+(f1/(TMath::Power(e1,2)-TMath::Power(aveEnerg,2)))+
235 (f2/(TMath::Power(e2,2)-TMath::Power(aveEnerg,2))));
238 //nquartzave = 1.585;
240 ///printf("Calling DistancefromMip %f %f \n",fEmissPoint,fOmega);
243 PatRec->DistanceFromMip(nfreonave, nquartzave,fEmissPoint,fOmega, phpad, pointsOnCathode,fTheta,fPhi);
247 //points = pointsOnCathode;
250 //printf(" values %f %f %f\n",points[0],points[1],points[2]);
252 Float_t vectorLoc[3]={pointsOnCathode[0],pointsOnCathode[2],pointsOnCathode[1]};
253 Float_t vectorGlob[3];
254 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
255 SetPoint(Nphpad,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
256 //fCoordEllipse[0][Nphpad] = pointsOnCathode[0];
257 //fCoordEllipse[1][Nphpad] = pointsOnCathode[1];
259 //printf(" values %f %f \n",pointsOnCathode[0],pointsOnCathode[1]);
267 Float_t AliRICHEllipse:: SnellAngle(Float_t iangle)
270 // Compute the Snell angle
272 Float_t nfreon = 1.295;
273 Float_t nquartz = 1.585;
283 sinrangle = a1*a2*sin(iangle);
290 rangle = asin(sinrangle);
291 //printf("iangle %f, a1*a2, %f, sinranlge, %f, rangle, %f\n", iangle, a1*a2, sinrangle, rangle);