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 **************************************************************************/
19 #include "AliRICHEllipse.h"
22 #include "AliRICHPatRec.h"
23 #include "AliRICHGeometry.h"
27 ClassImp(AliRICHEllipse)
29 //________________________________________________________________________________
30 AliRICHEllipse::AliRICHEllipse()
33 // Default Constructor for a RICH ellipse
43 //________________________________________________________________________________
44 AliRICHEllipse::~AliRICHEllipse()
58 //________________________________________________________________________________
59 AliRICHEllipse::AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi, Float_t emiss)
62 // Constructor for a RICH ellipse
73 //________________________________________________________________________________
74 void AliRICHEllipse::CreatePoints(Int_t chamber)
77 // Create points along the ellipse equation
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;
82 Float_t kPi=TMath::Pi();
84 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
85 AliRICHChamber* iChamber;
86 AliRICHGeometry* geometry;
88 iChamber = &(pRICH->Chamber(chamber));
89 geometry=iChamber->GetGeometryModel();
91 //h = 2.3 * geometry->GetRadiatorToPads();
92 h = geometry->GetRadiatorToPads();
101 printf("Omega: %f, Theta: %f, Phi: %f\n", omega, theta, phiinc);
104 for(Float_t i=0;i<1000;i++)
106 phi=((Float_t)(i)/1000)*2*kPi;
107 //printf("Phi: %f\n",phi);
109 //theta1=SnellAngle(theta1);
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);
119 //Omega1->Fill(omega1,(float) 1);
121 a = h*(tan(omega1+theta1)+tan(omega1-theta1))/2;
123 e = sqrt(1 - (b*b)/(a*a));
125 r = (a*(1-e*e))/(1+e*cos(e));
126 offset = h*(tan(omega1+theta1)-tan(omega1-theta1))/2;
129 y = a* cos(phi) + offset;
131 rotx = x*cos(phiinc)-y*sin(phiinc);
132 roty = x*sin(phiinc)+y*cos(phiinc);
134 //x = h * 1/(tan(omega1)) * sin(phi+phiinc);
135 //y = x * 1/(tan(phi+phiinc));
139 //Rings->Fill(x,y,(float) 1);
144 //printf("x:%f, y: %f\n",x,y);
146 Float_t vectorLoc[3]={rotx,6.276,roty};
147 Float_t vectorGlob[3];
148 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
149 SetPoint((Int_t) i,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
150 //printf("Coordinates: %f %f %f\n",vectorGlob[0],vectorGlob[1],vectorGlob[2]);
156 void AliRICHEllipse::CerenkovRingDrawing(Int_t chamber,Int_t track)
159 //to draw Cherenkov ring by known Cherenkov angle
164 Float_t nfreonave, nquartzave;
167 Float_t e1, e2, f1, f2;
168 Float_t pointsOnCathode[3];
170 //printf("Drawing ring in chamber:%d\n",chamber);
173 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
174 AliRICHChamber* iChamber;
176 iChamber = &(pRICH->Chamber(chamber));
178 AliRICHPatRec *PatRec = new AliRICHPatRec;
179 PatRec->TrackParam(track,chamber,fTheta,fOmega);
181 //printf("Just created PateRec\n");
183 //parameters to calculate freon window refractive index vs. energy
188 //parameters to calculate quartz window refractive index vs. energy
201 /*Float_t nquartz = 1.585;
203 Float_t nfreon = 1.295;
211 for (Nphpad=0; Nphpad<nmaxdegrees;Nphpad++) {
213 phpad = (360./(Float_t)nmaxdegrees)*(Float_t)Nphpad;
215 aveEnerg = (energy[0]+energy[1])/2.;
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))));
224 //nquartzave = 1.585;
226 ///printf("Calling DistancefromMip %f %f \n",fEmissPoint,fOmega);
229 PatRec->DistanceFromMip(nfreonave, nquartzave,fEmissPoint,fOmega, phpad, pointsOnCathode,fTheta,fPhi);
233 //points = pointsOnCathode;
236 //printf(" values %f %f %f\n",points[0],points[1],points[2]);
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];
245 //printf(" values %f %f \n",pointsOnCathode[0],pointsOnCathode[1]);
253 Float_t AliRICHEllipse:: SnellAngle(Float_t iangle)
256 // Compute the Snell angle
258 Float_t nfreon = 1.295;
259 Float_t nquartz = 1.585;
269 sinrangle = a1*a2*sin(iangle);
276 rangle = asin(sinrangle);
277 //printf("iangle %f, a1*a2, %f, sinranlge, %f, rangle, %f\n", iangle, a1*a2, sinrangle, rangle);