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.1 2000/06/12 15:21:57 jbarbosa
23 #include "AliRICHEllipse.h"
26 #include "AliRICHPatRec.h"
30 ClassImp(AliRICHEllipse)
32 //________________________________________________________________________________
33 AliRICHEllipse::AliRICHEllipse()
36 // Default Constructor for a RICH ellipse
46 //________________________________________________________________________________
47 AliRICHEllipse::~AliRICHEllipse()
61 //________________________________________________________________________________
62 AliRICHEllipse::AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi, Float_t emiss)
65 // Constructor for a RICH ellipse
76 //________________________________________________________________________________
77 /*void AliRICHEllipse::CreatePoints(Int_t chamber)
80 // Create points along the ellipse equation
83 Float_t fiducial=fh*TMath::Tan(fOmega+fTheta), l=fh/TMath::Cos(fTheta), xtrial, y=0, c0, c1, c2;
84 //TRandom *random=new TRandom();
86 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
87 AliRICHChamber* iChamber;
89 iChamber = &(pRICH->Chamber(chamber));
90 //cout<<"fiducial="<<fiducial<<endl;
92 for(Float_t i=0;i<1000;i++)
98 while((c1*c1-4*c2*c0)<=0 && counter<1000)
100 //Choose which side to go...
101 if(i>250 && i<750) s1=1;
102 //if (gRandom->Rndm(1)>.5) s1=1;
104 //printf("s1:%d\n",s1);
106 y=s1*i*gRandom->Rndm(Int_t(fiducial/50));
107 //printf("Fiducial %f for omega:%f theta:%f phi:%f\n",fiducial,fOmega,fTheta,fPhi);
108 Float_t alfa1=fTheta;
110 Float_t omega1=fOmega;
112 //Solve the eq for a trial x
113 c0=-TMath::Power(y*TMath::Cos(alfa1)*TMath::Cos(theta1),2)-TMath::Power(y*TMath::Sin(alfa1),2)+TMath::Power(l*TMath::Tan(omega1),2)+2*l*y*TMath::Cos(alfa1)*TMath::Sin(theta1)*TMath::Power(TMath::Tan(omega1),2)+TMath::Power(y*TMath::Cos(alfa1)*TMath::Sin(theta1)*TMath::Tan(omega1),2);
114 c1=2*y*TMath::Cos(alfa1)*TMath::Sin(alfa1)-2*y*TMath::Cos(alfa1)*TMath::Power(TMath::Cos(theta1),2)*TMath::Sin(alfa1)+2*l*TMath::Sin(alfa1)*TMath::Sin(theta1)*TMath::Power(TMath::Tan(omega1),2)+2*y*TMath::Cos(alfa1)*TMath::Sin(alfa1)*TMath::Power(TMath::Sin(theta1),2)*TMath::Power(TMath::Tan(omega1),2);
115 c2=-TMath::Power(TMath::Cos(alfa1),2)-TMath::Power(TMath::Cos(theta1)*TMath::Sin(alfa1),2)+TMath::Power(TMath::Sin(alfa1)*TMath::Sin(theta1)*TMath::Tan(omega1),2);
116 //cout<<"Trial: y="<<y<<"c0="<<c0<<" c1="<<c1<<" c2="<<c2<<endl;
117 //printf("Result:%f\n\n",c1*c1-4*c2*c0);
125 //Choose which side to go...
126 //if(gRandom->Rndm(1)>.5) s=1;
129 //if (gRandom->Rndm(1)>.5) s2=1;
131 xtrial=fCx+(-c1+s2*TMath::Sqrt(c1*c1-4*c2*c0))/(2*c2);
132 //cout<<"x="<<xtrial<<" y="<<cy+y<<endl;
133 //printf("Coordinates: %f %f\n",xtrial,fCy+y);
135 Float_t vectorLoc[3]={xtrial,6.276,(fCy+y)};
136 Float_t vectorGlob[3];
137 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
138 SetPoint(i,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
139 //printf("Coordinates: %f %f %f\n",vectorGlob[0],vectorGlob[1],vectorGlob[2]);
144 void AliRICHEllipse::CerenkovRingDrawing(Int_t chamber,Int_t track)
147 //to draw Cherenkov ring by known Cherenkov angle
152 Float_t nfreonave, nquartzave;
155 Float_t e1, e2, f1, f2;
156 Float_t pointsOnCathode[3];
158 printf("Drawing ring in chamber:%d\n",chamber);
161 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
162 AliRICHChamber* iChamber;
164 iChamber = &(pRICH->Chamber(chamber));
166 AliRICHPatRec *PatRec = new AliRICHPatRec;
167 PatRec->TrackParam(track,chamber);
169 printf("Just created PateRec\n");
171 //parameters to calculate freon window refractive index vs. energy
176 //parameters to calculate quartz window refractive index vs. energy
189 /*Float_t nquartz = 1.585;
191 Float_t nfreon = 1.295;
199 for (Nphpad=0; Nphpad<nmaxdegrees;Nphpad++) {
201 phpad = (360./(Float_t)nmaxdegrees)*(Float_t)Nphpad;
203 aveEnerg = (energy[0]+energy[1])/2.;
207 nfreonave = a+b*aveEnerg;
208 nquartzave = sqrt(1+(f1/(TMath::Power(e1,2)-TMath::Power(aveEnerg,2)))+
209 (f2/(TMath::Power(e2,2)-TMath::Power(aveEnerg,2))));
212 //nquartzave = 1.585;
214 printf("Calling DistancefromMip %f %f \n",fEmissPoint,fOmega);
217 PatRec->DistanceFromMip(nfreonave, nquartzave,fEmissPoint,fOmega, phpad, pointsOnCathode);
221 //points = pointsOnCathode;
224 //printf(" values %f %f %f\n",points[0],points[1],points[2]);
226 Float_t vectorLoc[3]={pointsOnCathode[0],pointsOnCathode[2],pointsOnCathode[1]};
227 Float_t vectorGlob[3];
228 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
229 SetPoint(Nphpad,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
230 //fCoordEllipse[0][Nphpad] = pointsOnCathode[0];
231 //fCoordEllipse[1][Nphpad] = pointsOnCathode[1];
233 printf(" values %f %f \n",pointsOnCathode[0],pointsOnCathode[1]);