Old style include needed on HP
[u/mrichter/AliRoot.git] / RICH / AliRICHEllipse.cxx
CommitLineData
237c933d 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/*
17 $Log$
74f08360 18 Revision 1.3 2000/11/01 15:37:44 jbarbosa
19 Removed verbose output.
20
b1036a3b 21 Revision 1.2 2000/06/30 16:31:51 dibari
22 New drawing routine from Nico and Daniela.
23
4f17f810 24 Revision 1.1 2000/06/12 15:21:57 jbarbosa
25 Cleaned up version.
26
237c933d 27*/
28
29#include "AliRICHEllipse.h"
30#include "AliRICH.h"
31#include "AliRun.h"
4f17f810 32#include "AliRICHPatRec.h"
237c933d 33
34#include <TRandom.h>
35
36ClassImp(AliRICHEllipse)
37
38//________________________________________________________________________________
39AliRICHEllipse::AliRICHEllipse()
40{
41
42// Default Constructor for a RICH ellipse
43
44 fCx = 0;
45 fCy = 0;
46 fOmega = 0;
47 fTheta = 0;
48 fPhi = 0;
49 fh= 0;
50}
51
52//________________________________________________________________________________
53AliRICHEllipse::~AliRICHEllipse()
54{
55
56// Destructor
57
58 fCx = 0;
59 fCy = 0;
60 fOmega = 0;
61 fTheta = 0;
62 fPhi = 0;
63 fh= 0;
64}
65
66
67//________________________________________________________________________________
4f17f810 68AliRICHEllipse::AliRICHEllipse(Float_t cx, Float_t cy, Float_t omega, Float_t theta, Float_t phi, Float_t emiss)
237c933d 69{
70
71// Constructor for a RICH ellipse
72
73 fCx = cx;
74 fCy = cy;
75 fOmega = omega;
76 fTheta = theta;
77 fPhi = phi;
4f17f810 78 fEmissPoint = emiss;
74f08360 79 fh=9.25;
237c933d 80}
81
82//________________________________________________________________________________
4f17f810 83/*void AliRICHEllipse::CreatePoints(Int_t chamber)
237c933d 84{
85
86// Create points along the ellipse equation
87
88 Int_t s1,s2;
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();
91
92 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
93 AliRICHChamber* iChamber;
94
95 iChamber = &(pRICH->Chamber(chamber));
96 //cout<<"fiducial="<<fiducial<<endl;
97
98 for(Float_t i=0;i<1000;i++)
99 {
100
101 Float_t counter=0;
102
103 c0=0;c1=0;c2=0;
104 while((c1*c1-4*c2*c0)<=0 && counter<1000)
105 {
106 //Choose which side to go...
107 if(i>250 && i<750) s1=1;
108 //if (gRandom->Rndm(1)>.5) s1=1;
109 else s1=-1;
110 //printf("s1:%d\n",s1);
111 //Trial a y
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;
115 Float_t theta1=fPhi;
116 Float_t omega1=fOmega;
117
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);
124 //i+=.01;
125 counter +=1;
126 }
127
128 if (counter>=1000)
129 y=0;
130
131 //Choose which side to go...
132 //if(gRandom->Rndm(1)>.5) s=1;
133 //else s=-1;
134 if(i>500) s2=1;
135 //if (gRandom->Rndm(1)>.5) s2=1;
136 else 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);
140
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]);
146 }
4f17f810 147 }*/
148
149
150void AliRICHEllipse::CerenkovRingDrawing(Int_t chamber,Int_t track)
151{
152
153//to draw Cherenkov ring by known Cherenkov angle
154
155 Int_t nmaxdegrees;
156 Int_t Nphpad;
157 Float_t phpad;
158 Float_t nfreonave, nquartzave;
159 Float_t aveEnerg;
160 Float_t energy[2];
161 Float_t e1, e2, f1, f2;
162 Float_t pointsOnCathode[3];
163
b1036a3b 164 //printf("Drawing ring in chamber:%d\n",chamber);
4f17f810 165
166
167 AliRICH *pRICH = (AliRICH*)gAlice->GetModule("RICH");
168 AliRICHChamber* iChamber;
169
170 iChamber = &(pRICH->Chamber(chamber));
171
172 AliRICHPatRec *PatRec = new AliRICHPatRec;
74f08360 173 PatRec->TrackParam(track,chamber,fTheta,fOmega);
4f17f810 174
b1036a3b 175 //printf("Just created PateRec\n");
4f17f810 176
177//parameters to calculate freon window refractive index vs. energy
178
179 Float_t a = 1.177;
180 Float_t b = 0.0172;
181
182//parameters to calculate quartz window refractive index vs. energy
183/*
184 Energ[0] = 5.6;
185 Energ[1] = 7.7;
186*/
187 energy[0] = 5.0;
188 energy[1] = 8.0;
189 e1 = 10.666;
190 e2 = 18.125;
191 f1 = 46.411;
192 f2 = 228.71;
193
237c933d 194
4f17f810 195 /*Float_t nquartz = 1.585;
196 Float_t ngas = 1.;
197 Float_t nfreon = 1.295;
198 Float_t value;
199 */
237c933d 200
201
202
4f17f810 203 nmaxdegrees = 360;
204
205 for (Nphpad=0; Nphpad<nmaxdegrees;Nphpad++) {
206
207 phpad = (360./(Float_t)nmaxdegrees)*(Float_t)Nphpad;
208
209 aveEnerg = (energy[0]+energy[1])/2.;
210 //aveEnerg = 6.5;
211
212
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))));
216
217 //nfreonave = 1.295;
218 //nquartzave = 1.585;
219
b1036a3b 220 ///printf("Calling DistancefromMip %f %f \n",fEmissPoint,fOmega);
4f17f810 221
222 //Float_t dummy =
74f08360 223 PatRec->DistanceFromMip(nfreonave, nquartzave,fEmissPoint,fOmega, phpad, pointsOnCathode,fTheta,fPhi);
4f17f810 224
225 //Float_t points[3];
226
227 //points = pointsOnCathode;
228
229
230 //printf(" values %f %f %f\n",points[0],points[1],points[2]);
231
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];
238
b1036a3b 239 //printf(" values %f %f \n",pointsOnCathode[0],pointsOnCathode[1]);
4f17f810 240
241 }
242
243}
244
245
237c933d 246
247
248
249
250
251
252
253
254
255