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.2 2000/06/30 16:31:51 dibari
19 New drawing routine from Nico and Daniela.
21 Revision 1.1 2000/06/12 15:21:57 jbarbosa
26 #include "AliRICHEllipse.h"
29 #include "AliRICHPatRec.h"
33 ClassImp(AliRICHEllipse)
35 //________________________________________________________________________________
36 AliRICHEllipse::AliRICHEllipse()
39 // Default Constructor for a RICH ellipse
49 //________________________________________________________________________________
50 AliRICHEllipse::~AliRICHEllipse()
64 //________________________________________________________________________________
65 AliRICHEllipse::AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi, Float_t emiss)
68 // Constructor for a RICH ellipse
79 //________________________________________________________________________________
80 /*void AliRICHEllipse::CreatePoints(Int_t chamber)
83 // Create points along the ellipse equation
86 Float_t fiducial=fh*TMath::Tan(fOmega+fTheta), l=fh/TMath::Cos(fTheta), xtrial, y=0, c0, c1, c2;
87 //TRandom *random=new TRandom();
89 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
90 AliRICHChamber* iChamber;
92 iChamber = &(pRICH->Chamber(chamber));
93 //cout<<"fiducial="<<fiducial<<endl;
95 for(Float_t i=0;i<1000;i++)
101 while((c1*c1-4*c2*c0)<=0 && counter<1000)
103 //Choose which side to go...
104 if(i>250 && i<750) s1=1;
105 //if (gRandom->Rndm(1)>.5) s1=1;
107 //printf("s1:%d\n",s1);
109 y=s1*i*gRandom->Rndm(Int_t(fiducial/50));
110 //printf("Fiducial %f for omega:%f theta:%f phi:%f\n",fiducial,fOmega,fTheta,fPhi);
111 Float_t alfa1=fTheta;
113 Float_t omega1=fOmega;
115 //Solve the eq for a trial x
116 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);
117 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);
118 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);
119 //cout<<"Trial: y="<<y<<"c0="<<c0<<" c1="<<c1<<" c2="<<c2<<endl;
120 //printf("Result:%f\n\n",c1*c1-4*c2*c0);
128 //Choose which side to go...
129 //if(gRandom->Rndm(1)>.5) s=1;
132 //if (gRandom->Rndm(1)>.5) s2=1;
134 xtrial=fCx+(-c1+s2*TMath::Sqrt(c1*c1-4*c2*c0))/(2*c2);
135 //cout<<"x="<<xtrial<<" y="<<cy+y<<endl;
136 //printf("Coordinates: %f %f\n",xtrial,fCy+y);
138 Float_t vectorLoc[3]={xtrial,6.276,(fCy+y)};
139 Float_t vectorGlob[3];
140 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
141 SetPoint(i,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
142 //printf("Coordinates: %f %f %f\n",vectorGlob[0],vectorGlob[1],vectorGlob[2]);
147 void AliRICHEllipse::CerenkovRingDrawing(Int_t chamber,Int_t track)
150 //to draw Cherenkov ring by known Cherenkov angle
155 Float_t nfreonave, nquartzave;
158 Float_t e1, e2, f1, f2;
159 Float_t pointsOnCathode[3];
161 //printf("Drawing ring in chamber:%d\n",chamber);
164 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
165 AliRICHChamber* iChamber;
167 iChamber = &(pRICH->Chamber(chamber));
169 AliRICHPatRec *PatRec = new AliRICHPatRec;
170 PatRec->TrackParam(track,chamber);
172 //printf("Just created PateRec\n");
174 //parameters to calculate freon window refractive index vs. energy
179 //parameters to calculate quartz window refractive index vs. energy
192 /*Float_t nquartz = 1.585;
194 Float_t nfreon = 1.295;
202 for (Nphpad=0; Nphpad<nmaxdegrees;Nphpad++) {
204 phpad = (360./(Float_t)nmaxdegrees)*(Float_t)Nphpad;
206 aveEnerg = (energy[0]+energy[1])/2.;
210 nfreonave = a+b*aveEnerg;
211 nquartzave = sqrt(1+(f1/(TMath::Power(e1,2)-TMath::Power(aveEnerg,2)))+
212 (f2/(TMath::Power(e2,2)-TMath::Power(aveEnerg,2))));
215 //nquartzave = 1.585;
217 ///printf("Calling DistancefromMip %f %f \n",fEmissPoint,fOmega);
220 PatRec->DistanceFromMip(nfreonave, nquartzave,fEmissPoint,fOmega, phpad, pointsOnCathode);
224 //points = pointsOnCathode;
227 //printf(" values %f %f %f\n",points[0],points[1],points[2]);
229 Float_t vectorLoc[3]={pointsOnCathode[0],pointsOnCathode[2],pointsOnCathode[1]};
230 Float_t vectorGlob[3];
231 iChamber->LocaltoGlobal(vectorLoc,vectorGlob);
232 SetPoint(Nphpad,vectorGlob[0],vectorGlob[1],vectorGlob[2]);
233 //fCoordEllipse[0][Nphpad] = pointsOnCathode[0];
234 //fCoordEllipse[1][Nphpad] = pointsOnCathode[1];
236 //printf(" values %f %f \n",pointsOnCathode[0],pointsOnCathode[1]);