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