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.3 2000/11/01 15:37:44 jbarbosa
19 Removed verbose output.
21 Revision 1.2 2000/06/30 16:31:51 dibari
22 New drawing routine from Nico and Daniela.
24 Revision 1.1 2000/06/12 15:21:57 jbarbosa
29 #include "AliRICHEllipse.h"
32 #include "AliRICHPatRec.h"
36 ClassImp(AliRICHEllipse)
38 //________________________________________________________________________________
39 AliRICHEllipse::AliRICHEllipse()
42 // Default Constructor for a RICH ellipse
52 //________________________________________________________________________________
53 AliRICHEllipse::~AliRICHEllipse()
67 //________________________________________________________________________________
68 AliRICHEllipse::AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi, Float_t emiss)
71 // Constructor for a RICH ellipse
82 //________________________________________________________________________________
83 /*void AliRICHEllipse::CreatePoints(Int_t chamber)
86 // Create points along the ellipse equation
89 Float_t fiducial=fh*TMath::Tan(fOmega+fTheta), l=fh/TMath::Cos(fTheta), xtrial, y=0, c0, c1, c2;
90 //TRandom *random=new TRandom();
92 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
93 AliRICHChamber* iChamber;
95 iChamber = &(pRICH->Chamber(chamber));
96 //cout<<"fiducial="<<fiducial<<endl;
98 for(Float_t i=0;i<1000;i++)
104 while((c1*c1-4*c2*c0)<=0 && counter<1000)
106 //Choose which side to go...
107 if(i>250 && i<750) s1=1;
108 //if (gRandom->Rndm(1)>.5) s1=1;
110 //printf("s1:%d\n",s1);
112 y=s1*i*gRandom->Rndm(Int_t(fiducial/50));
113 //printf("Fiducial %f for omega:%f theta:%f phi:%f\n",fiducial,fOmega,fTheta,fPhi);
114 Float_t alfa1=fTheta;
116 Float_t omega1=fOmega;
118 //Solve the eq for a trial x
119 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);
120 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);
121 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);
122 //cout<<"Trial: y="<<y<<"c0="<<c0<<" c1="<<c1<<" c2="<<c2<<endl;
123 //printf("Result:%f\n\n",c1*c1-4*c2*c0);
131 //Choose which side to go...
132 //if(gRandom->Rndm(1)>.5) s=1;
135 //if (gRandom->Rndm(1)>.5) s2=1;
137 xtrial=fCx+(-c1+s2*TMath::Sqrt(c1*c1-4*c2*c0))/(2*c2);
138 //cout<<"x="<<xtrial<<" y="<<cy+y<<endl;
139 //printf("Coordinates: %f %f\n",xtrial,fCy+y);
141 Float_t vectorLoc[3]={xtrial,6.276,(fCy+y)};
142 Float_t vectorGlob[3];
143 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
144 SetPoint(i,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
145 //printf("Coordinates: %f %f %f\n",vectorGlob[0],vectorGlob[1],vectorGlob[2]);
150 void AliRICHEllipse::CerenkovRingDrawing(Int_t chamber,Int_t track)
153 //to draw Cherenkov ring by known Cherenkov angle
158 Float_t nfreonave, nquartzave;
161 Float_t e1, e2, f1, f2;
162 Float_t pointsOnCathode[3];
164 //printf("Drawing ring in chamber:%d\n",chamber);
167 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
168 AliRICHChamber* iChamber;
170 iChamber = &(pRICH->Chamber(chamber));
172 AliRICHPatRec *PatRec = new AliRICHPatRec;
173 PatRec->TrackParam(track,chamber,fTheta,fOmega);
175 //printf("Just created PateRec\n");
177 //parameters to calculate freon window refractive index vs. energy
182 //parameters to calculate quartz window refractive index vs. energy
195 /*Float_t nquartz = 1.585;
197 Float_t nfreon = 1.295;
205 for (Nphpad=0; Nphpad<nmaxdegrees;Nphpad++) {
207 phpad = (360./(Float_t)nmaxdegrees)*(Float_t)Nphpad;
209 aveEnerg = (energy[0]+energy[1])/2.;
213 nfreonave = a+b*aveEnerg;
214 nquartzave = sqrt(1+(f1/(TMath::Power(e1,2)-TMath::Power(aveEnerg,2)))+
215 (f2/(TMath::Power(e2,2)-TMath::Power(aveEnerg,2))));
218 //nquartzave = 1.585;
220 ///printf("Calling DistancefromMip %f %f \n",fEmissPoint,fOmega);
223 PatRec->DistanceFromMip(nfreonave, nquartzave,fEmissPoint,fOmega, phpad, pointsOnCathode,fTheta,fPhi);
227 //points = pointsOnCathode;
230 //printf(" values %f %f %f\n",points[0],points[1],points[2]);
232 Float_t vectorLoc[3]={pointsOnCathode[0],pointsOnCathode[2],pointsOnCathode[1]};
233 Float_t vectorGlob[3];
234 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
235 SetPoint(Nphpad,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
236 //fCoordEllipse[0][Nphpad] = pointsOnCathode[0];
237 //fCoordEllipse[1][Nphpad] = pointsOnCathode[1];
239 //printf(" values %f %f \n",pointsOnCathode[0],pointsOnCathode[1]);