]>
Commit | Line | Data |
---|---|---|
aee8290b | 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$ | |
454d82e0 | 18 | Revision 1.10 2001/01/18 13:21:30 morsch |
19 | Take pi from TMath. | |
20 | ||
11a3be04 | 21 | Revision 1.9 2001/01/17 20:02:20 morsch |
22 | In the AliMagFDM tree call-by-reference functions were changed to | |
23 | call-by-value, what is more adequate for our task. There were added | |
24 | a few comments and put protection to values of cos > 1.000 in | |
25 | AliMagFDM.cxx. (Galina Chabratova) | |
26 | ||
e678332c | 27 | Revision 1.8 2000/12/18 10:44:01 morsch |
28 | Possibility to set field map by passing pointer to objet of type AliMagF via | |
29 | SetField(). | |
30 | Example: | |
31 | gAlice->SetField(new AliMagFCM("Map2", "$(ALICE_ROOT)/data/field01.dat",2,1.,10.)); | |
32 | ||
d8408e76 | 33 | Revision 1.7 2000/12/01 11:20:27 alibrary |
34 | Corrector dipole removed from ZDC | |
35 | ||
006cb30c | 36 | Revision 1.6 2000/11/10 18:09:55 fca |
37 | New field map for the ZDC | |
38 | ||
d95ea23f | 39 | Revision 1.5 2000/10/27 14:17:04 morsch |
40 | - Bug causing segmentation violation during muon reconstruction corrected | |
41 | - Coding rule violations corrected. | |
42 | (Galina Chabratova) | |
43 | ||
803c9752 | 44 | Revision 1.4 2000/10/02 21:28:14 fca |
45 | Removal of useless dependecies via forward declarations | |
46 | ||
94de3818 | 47 | Revision 1.3 2000/07/13 16:19:09 fca |
48 | Mainly coding conventions + some small bug fixes | |
49 | ||
ef42d733 | 50 | Revision 1.2 2000/07/12 08:56:25 fca |
51 | Coding convention correction and warning removal | |
52 | ||
8918e700 | 53 | Revision 1.1 2000/07/11 18:24:59 fca |
54 | Coding convention corrections + few minor bug fixes | |
55 | ||
aee8290b | 56 | */ |
57 | ||
8918e700 | 58 | #include <stdlib.h> |
59 | ||
aee8290b | 60 | #include "AliMagFDM.h" |
61 | #include "TSystem.h" | |
62 | ||
63 | ||
64 | ClassImp(AliMagFDM) | |
65 | ||
66 | //________________________________________ | |
67 | AliMagFDM::AliMagFDM(const char *name, const char *title, const Int_t integ, | |
e678332c | 68 | const Float_t factor, const Float_t fmax) |
d8408e76 | 69 | : AliMagF(name,title,integ,factor,fmax) |
aee8290b | 70 | { |
ef42d733 | 71 | // |
72 | // Standard constructor for the Dipole field | |
73 | // | |
aee8290b | 74 | fType = kDipoMap; |
d8408e76 | 75 | fMap = 3; |
76 | ||
e678332c | 77 | printf("Field Map for Muon Arm from IP till muon filter %s created: map= %d, integ= %d, factor= %f, file=%s\n",fName.Data(), fMap ,integ,factor,fTitle.Data()); |
78 | ||
aee8290b | 79 | } |
80 | ||
81 | //________________________________________ | |
82 | ||
83 | void AliMagFDM::Field(Float_t *xfi, Float_t *b) | |
84 | { | |
85 | // | |
86 | // Main routine to compute the field in a point | |
87 | // | |
88 | static const Double_t keps=0.1E-06; | |
11a3be04 | 89 | static const Double_t PI2=2.*TMath::Pi(); |
aee8290b | 90 | static const Double_t kone=1; |
91 | ||
92 | static const Int_t kiip=33; | |
93 | static const Int_t kmiip=0; | |
94 | static const Int_t kliip=0; | |
95 | ||
96 | static const Int_t kiic=0; | |
97 | static const Int_t kmiic=0; | |
98 | static const Int_t kliic=0; | |
99 | ||
803c9752 | 100 | static const Double_t kfZbg=502.92; // Start of Map using in z |
101 | static const Double_t kfZL3=600; // Beginning of L3 door in z | |
aee8290b | 102 | |
103 | Double_t x[3]; | |
104 | Double_t xL3[3]; | |
105 | Double_t bint[3]; | |
106 | ||
107 | Double_t r0; | |
e678332c | 108 | Int_t iKvar,jb; |
aee8290b | 109 | |
110 | Double_t zp1, zp2,xp1,xp2,yp1,yp2; | |
111 | Double_t zz1, zz2,yy1,yy2,x2,x1; | |
112 | ||
113 | // --- start the map fiel from z = 502.92 cm --- | |
114 | ||
115 | x[0] = xfi[0]; | |
116 | x[1] = xfi[1]; | |
117 | x[2] = xfi[2]; | |
e678332c | 118 | b[0]=b[1]=b[2]=0; |
aee8290b | 119 | // printf("x[0] %f,x[1] %f,x[2] %f\n",x[0],x[1],x[2]); |
120 | ||
121 | Double_t rr=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]); | |
122 | r0=rr/100; | |
123 | Double_t rPmax; | |
803c9752 | 124 | rPmax=fRmax; |
125 | if ( (-700<x[2] && x[2]<=kfZbg && | |
aee8290b | 126 | (x[0]*x[0]+(x[1]+30)*(x[1]+30))< 560*560) |
803c9752 | 127 | || (kfZbg<x[2] && x[2]<=kfZL3 && (rr>rPmax*100 && rr< 560)) ) |
aee8290b | 128 | { |
803c9752 | 129 | b[0]=b[1]=0; |
aee8290b | 130 | b[2]=2; |
131 | } | |
132 | ||
133 | xL3[0]=x[0]/100; | |
134 | xL3[1]=(x[1]+30)/100; | |
135 | xL3[2]=x[2]/100; | |
803c9752 | 136 | |
aee8290b | 137 | |
803c9752 | 138 | if (TMath::Abs(xL3[0])<=0.1E-06) xL3[0]=TMath::Sign(0.1E-05,xL3[0]); |
139 | if (TMath::Abs(xL3[1])<=0.1E-06) xL3[1]=TMath::Sign(0.1E-05,xL3[1]); | |
140 | ||
141 | Double_t xminn=xL3[2]*fAx1+fCx1; | |
142 | Double_t xmaxx=xL3[2]*fAx2+fCx2; | |
aee8290b | 143 | Double_t zCmin,zCmax,yCmin,yCmax; |
144 | ||
803c9752 | 145 | zCmin=fZmin; |
146 | zCmax=fZmax; | |
147 | yCmin=fYmin; | |
148 | yCmax=fYmax; | |
803c9752 | 149 | if ((kfZbg/100<xL3[2] && xL3[2]<=zCmin && r0<=rPmax) || ((zCmin<xL3[2] && xL3[2] <= zCmax ) && (yCmin<xL3[1] && xL3[1]<= yCmax) && (xminn<xL3[0] && xL3[0] <= xmaxx))) |
aee8290b | 150 | { |
151 | if(fMap==3) | |
152 | { | |
803c9752 | 153 | if (kfZbg/100<xL3[2] && xL3[2]<=zCmin && r0<=rPmax) |
aee8290b | 154 | { |
155 | //--------------------- Polar part ---------------------- | |
156 | ||
157 | Double_t yyp,ph0; | |
158 | Int_t kp0, lp0, mp0; | |
159 | Int_t kpi,lpi,mpi; | |
160 | Double_t alp1,alp2,alp3; | |
161 | Double_t zpz,rp,fip,cphi; | |
162 | ||
163 | kpi=kiip; | |
164 | lpi=kliip; | |
165 | mpi=kmiip; | |
166 | ||
167 | zpz=xL3[2]; | |
e678332c | 168 | kp0=FZ(zpz, fZp ,fZpdl,kpi,fZpl) ; |
169 | zp2=(zpz-fZp[kp0])/(fZp[kp0+1]-fZp[kp0]); | |
170 | zp1= kone-zp2; | |
aee8290b | 171 | yyp=xL3[1]- 0.3; |
e678332c | 172 | cphi=TMath::Abs(yyp/r0); |
173 | Int_t kcphi=0; | |
174 | if (cphi > kone) { | |
175 | printf("xL3[0] %e, xL3[1] %e, xL3[2] %e, yyp %e, r0 %e, cphi %e\n",xL3[0],xL3[1],xL3[2],yyp,r0,cphi); | |
176 | cphi =kone; | |
177 | kcphi=777; | |
178 | } | |
aee8290b | 179 | ph0=TMath::ACos(cphi); |
e678332c | 180 | if (xL3[0] < 0 && yyp > 0 ) {ph0=PI2/2 - ph0;} |
181 | if (xL3[0] < 0 && yyp < 0 ) {ph0=PI2/2 + ph0;} | |
182 | if (xL3[0] > 0 && yyp < 0 ) {ph0=PI2 - ph0;} | |
183 | if (ph0 > PI2) { ph0=ph0 - PI2;} | |
184 | if (kcphi==777) { | |
185 | printf("xL3[0] %e, xL3[1] %e, xL3[2] %e, yyp %e, r0 %e, ph0 %e\n",xL3[0],xL3[1],xL3[2],yyp,r0,ph0); | |
186 | } | |
187 | fip=ph0; | |
188 | mp0=FZ(fip,fPhi,fPhid ,mpi,fPhin); | |
189 | xp2=(fip-fPhi[mp0])/(fPhi[mp0+1]-fPhi[mp0]); | |
190 | xp1=kone-xp2; | |
aee8290b | 191 | |
192 | Double_t rDel; | |
803c9752 | 193 | rDel=fRdel; |
aee8290b | 194 | |
803c9752 | 195 | if (r0<= fRdel) |
aee8290b | 196 | { |
197 | ||
198 | if(r0< keps) | |
199 | { | |
200 | ||
803c9752 | 201 | bint[0]=(zp1*fBpx[kp0][0][0] + zp2*fBpx[kp0+1][0][0])*10; |
202 | bint[1]=(zp1*fBpy[kp0][0][0] + zp2*fBpy[kp0+1][0][0])*10; | |
203 | bint[2]=(zp1*fBpz[kp0][0][0] + zp2*fBpz[kp0+1][0][0])*10; | |
aee8290b | 204 | |
803c9752 | 205 | } else { |
aee8290b | 206 | |
803c9752 | 207 | alp2= fB[0][0][mp0]*yyp + fB[0][1][mp0]*xL3[0]; |
208 | alp3= fB[1][0][mp0]*yyp + fB[1][1][mp0]*xL3[0]; | |
aee8290b | 209 | alp1= kone - alp2 - alp3; |
210 | ||
211 | for (jb=0; jb<3 ; jb++) | |
803c9752 | 212 | { |
213 | iKvar=jb; | |
e678332c | 214 | bint[jb] = Ba(iKvar,zp1,zp2,alp1,alp2,alp3, kp0,mp0)*10 ; |
803c9752 | 215 | } |
216 | } // end of keps <=r0 | |
aee8290b | 217 | } |
218 | else | |
219 | { | |
220 | rp=r0; | |
221 | ||
e678332c | 222 | lp0=FZ(rp,fR ,fRdel,lpi,fRn); |
223 | yp2=(rp-fR[lp0])/(fR[lp0+1]-fR[lp0]); | |
224 | yp1=kone-yp2; | |
aee8290b | 225 | |
226 | for (jb=0; jb<3 ; jb++) | |
227 | { | |
228 | iKvar=jb; | |
e678332c | 229 | bint[jb] = Bb(zp1,zp2,yp1,yp2,xp1,xp2,iKvar,kp0,lp0,mp0)*10 ; |
aee8290b | 230 | } |
231 | } | |
232 | ||
233 | b[0]=bint[0]; | |
234 | b[1]=bint[1]; | |
235 | b[2]=bint[2]; | |
236 | ||
aee8290b | 237 | } |
238 | else | |
239 | { | |
240 | //-------------- Cartensian part ------------------ | |
241 | ||
242 | Double_t zzc,yyc; | |
243 | Int_t k0, l0,m0; | |
244 | Double_t xx1, xx2,dx, xxx ,xXl; | |
245 | Int_t kci,mci,lci; | |
246 | ||
247 | kci=kiic; | |
248 | lci=kliic; | |
249 | mci=kmiic; | |
250 | ||
803c9752 | 251 | xx1 = fAx1*xL3[2] + fCx1; |
252 | xx2 = fAx2*xL3[2] + fCx2; | |
aee8290b | 253 | |
254 | zzc=xL3[2]; | |
e678332c | 255 | k0=FZ(zzc, fZc ,fZdel, kci, fZl); |
256 | zz2=(zzc-fZc[k0])/(fZc[k0+1]-fZc[k0]); | |
257 | zz1=kone - zz2;; | |
aee8290b | 258 | |
259 | yyc=xL3[1]; | |
e678332c | 260 | l0=FZ(yyc, fY , fYdel,lci,fYl); |
261 | yy2=(yyc-fY[l0])/(fY[l0+1]-fY[l0]);; | |
262 | yy1=kone - yy2; | |
803c9752 | 263 | xXl = fXl-kone; |
aee8290b | 264 | dx = (xx2-xx1)/xXl; |
265 | xxx= xL3[0]-xx1; | |
aee8290b | 266 | m0 = int(xxx/dx); |
267 | ||
268 | if(xL3[0]<(xx1+m0*dx) || xL3[0] >(xx1+(m0+1)*dx)) | |
269 | { | |
270 | m0=m0+1; | |
271 | printf(" m0 %d, m0+1 %d\n",m0,m0+1); | |
272 | } | |
273 | ||
274 | x2=(xL3[0]-( xx1+m0*dx))/dx; | |
275 | x1=kone-x2; | |
276 | m0=m0-1; | |
277 | for (jb=3; jb<6; jb++) | |
278 | { | |
279 | iKvar=jb; | |
e678332c | 280 | bint[jb-3] = Bb(zz1,zz2,yy1,yy2,x1,x2,iKvar,k0, l0, m0)*10 ; |
aee8290b | 281 | } |
282 | ||
283 | b[0]=bint[0]; | |
284 | b[1]=bint[1]; | |
285 | b[2]=bint[2]; | |
286 | ||
aee8290b | 287 | } |
e678332c | 288 | |
aee8290b | 289 | |
290 | } else { | |
291 | printf("Unknown map of Dipole region %d\n",fMap); | |
292 | } | |
293 | ||
294 | } else { | |
295 | ||
296 | //This is the ZDC part | |
d95ea23f | 297 | Float_t rad2=x[0]*x[0]+x[1]*x[1]; |
006cb30c | 298 | if(x[2]>kCORBEG2 && x[2]<kCOREND2){ |
d95ea23f | 299 | if(rad2<kCOR2RA2){ |
300 | b[0] = kFCORN2; | |
301 | } | |
302 | } | |
303 | else if(x[2]>kZ1BEG && x[2]<kZ1END){ | |
304 | if(rad2<kZ1RA2){ | |
305 | b[0] = -kG1*x[1]; | |
306 | b[1] = -kG1*x[0]; | |
307 | } | |
308 | } | |
309 | else if(x[2]>kZ2BEG && x[2]<kZ2END){ | |
310 | if(rad2<kZ2RA2){ | |
311 | b[0] = kG1*x[1]; | |
312 | b[1] = kG1*x[0]; | |
aee8290b | 313 | } |
314 | } | |
d95ea23f | 315 | else if(x[2]>kZ3BEG && x[2]<kZ3END){ |
316 | if(rad2<kZ3RA2){ | |
317 | b[0] = kG1*x[1]; | |
318 | b[1] = kG1*x[0]; | |
319 | } | |
320 | } | |
321 | else if(x[2]>kZ4BEG && x[2]<kZ4END){ | |
322 | if(rad2<kZ4RA2){ | |
323 | b[0] = -kG1*x[1]; | |
324 | b[1] = -kG1*x[0]; | |
325 | } | |
326 | } | |
327 | else if(x[2]>kD1BEG && x[2]<kD1END){ | |
328 | if(rad2<kD1RA2){ | |
329 | b[1] = -kFDIP; | |
330 | } | |
331 | } | |
332 | else if(x[2]>kD2BEG && x[2]<kD2END){ | |
333 | if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2 | |
334 | || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){ | |
335 | b[1] = kFDIP; | |
336 | } | |
337 | } | |
338 | } | |
339 | ||
aee8290b | 340 | |
341 | if(fFactor!=1) { | |
342 | b[0]*=fFactor; | |
343 | b[1]*=fFactor; | |
344 | b[2]*=fFactor; | |
345 | } | |
346 | } | |
347 | ||
e678332c | 348 | //_____________________ FZ ____________________ |
aee8290b | 349 | |
e678332c | 350 | Int_t AliMagFDM::FZ(Double_t temp, Float_t *Ar, Float_t delu,Int_t ik,Int_t nk) |
aee8290b | 351 | { |
352 | // | |
e678332c | 353 | // Quest of a point position at x,y,z (Cartensian) and R,Phi,z (Polar) axises |
aee8290b | 354 | // |
e678332c | 355 | Int_t l,ikj; |
356 | Double_t ddu,ar; | |
aee8290b | 357 | |
e678332c | 358 | Int_t ku,kf; |
359 | kf=0; | |
aee8290b | 360 | ar=Ar[ik]; |
361 | ddu=temp-ar; | |
362 | ||
363 | ku=int(ddu/delu); | |
e678332c | 364 | ikj=ik+ku+1; |
aee8290b | 365 | if (ddu<=0) ikj=0; |
366 | ||
367 | for(l=ikj; l<nk; l++) | |
368 | { | |
e678332c | 369 | |
803c9752 | 370 | if(temp <= Ar[l]) |
aee8290b | 371 | { |
803c9752 | 372 | |
e678332c | 373 | kf=l-1; |
374 | break; | |
aee8290b | 375 | } |
376 | } | |
e678332c | 377 | return kf; |
aee8290b | 378 | } |
379 | ||
e678332c | 380 | /*---------------------Ba------------------*/ |
aee8290b | 381 | |
e678332c | 382 | Double_t AliMagFDM::Ba(Int_t kaai,Double_t zaa1, Double_t zaa2, Double_t alf1, Double_t alf2, Double_t alf3, Int_t kaa, Int_t maa) |
aee8290b | 383 | { |
384 | // | |
e678332c | 385 | // Calculation of field componet for case (keps <r0<= fRdel) at a given axis |
aee8290b | 386 | // |
387 | Double_t fa11,fa12,fa13; | |
388 | Double_t fa21,fa22,fa23; | |
389 | Double_t faY1,faY2; | |
390 | Double_t bba; | |
e678332c | 391 | |
8918e700 | 392 | switch (kaai) { |
393 | case 0: | |
803c9752 | 394 | fa11 = fBpx[kaa][0][0]; |
395 | fa12 = fBpx[kaa][0][maa]; | |
396 | fa13 = fBpx[kaa][0][maa+1]; | |
397 | fa21 = fBpx[kaa+1][0][0]; | |
398 | fa22 = fBpx[kaa+1][0][maa]; | |
399 | fa23 = fBpx[kaa+1][0][maa+1]; | |
8918e700 | 400 | break; |
401 | case 1: | |
803c9752 | 402 | fa11 = fBpy[kaa][0][0]; |
403 | fa12 = fBpy[kaa][0][maa]; | |
404 | fa13 = fBpy[kaa][0][maa+1]; | |
405 | fa21 = fBpy[kaa+1][0][0]; | |
406 | fa22 = fBpy[kaa+1][0][maa]; | |
407 | fa23 = fBpy[kaa+1][0][maa+1]; | |
8918e700 | 408 | break; |
409 | case 2: | |
803c9752 | 410 | fa11 = fBpz[kaa][0][0]; |
411 | fa12 = fBpz[kaa][0][maa]; | |
412 | fa13 = fBpz[kaa][0][maa+1]; | |
413 | fa21 = fBpz[kaa+1][0][0]; | |
414 | fa22 = fBpz[kaa+1][0][maa]; | |
415 | fa23 = fBpz[kaa+1][0][maa+1]; | |
8918e700 | 416 | break; |
417 | default: | |
e678332c | 418 | Fatal("Ba","Invalid value of kaai %d\n",kaai); |
8918e700 | 419 | exit(1); |
aee8290b | 420 | } |
421 | faY1=alf1*fa11+alf2*fa12+alf3*fa13; | |
422 | faY2=alf1*fa21+alf2*fa22+alf3*fa23; | |
423 | bba = zaa1*faY1+zaa2*faY2; | |
e678332c | 424 | return bba; |
aee8290b | 425 | } |
426 | ||
427 | ||
e678332c | 428 | /*------------------------Bb--------------------------*/ |
aee8290b | 429 | |
e678332c | 430 | Double_t AliMagFDM::Bb(Double_t z1,Double_t z2, Double_t y1,Double_t y2, Double_t x1,Double_t x2, Int_t kv, Int_t k, Int_t l, Int_t m) |
aee8290b | 431 | { |
432 | // | |
e678332c | 433 | // Calculation of field componet at a given axis (general case) |
aee8290b | 434 | // |
435 | Double_t fy1, fy2, ffy; | |
436 | Double_t gy1,gy2,ggy; | |
aee8290b | 437 | Double_t bbi; |
aee8290b | 438 | Double_t bf11,bf12,bf21,bf22; |
439 | Double_t bg11,bg12,bg21,bg22; | |
e678332c | 440 | |
aee8290b | 441 | |
442 | /*-----------------Polar part ------------------*/ | |
443 | ||
8918e700 | 444 | switch (kv) { |
445 | case 0: | |
803c9752 | 446 | bf11=fBpx[k][l][m]; |
447 | bf12=fBpx[k+1][l][m]; | |
448 | bf21=fBpx[k+1][l+1][m]; | |
449 | bf22=fBpx[k][l+1][m]; | |
aee8290b | 450 | |
803c9752 | 451 | bg11=fBpx[k][l][m+1]; |
452 | bg12=fBpx[k+1][l][m+1]; | |
453 | bg21=fBpx[k+1][l+1][m+1]; | |
454 | bg22=fBpx[k][l+1][m+1]; | |
8918e700 | 455 | break; |
456 | ||
457 | case 1: | |
803c9752 | 458 | bf11=fBpy[k][l][m]; |
459 | bf12=fBpy[k+1][l][m]; | |
460 | bf21=fBpy[k+1][l+1][m]; | |
461 | bf22=fBpy[k][l+1][m]; | |
aee8290b | 462 | |
803c9752 | 463 | bg11=fBpy[k][l][m+1]; |
464 | bg12=fBpy[k+1][l][m+1]; | |
465 | bg21=fBpy[k+1][l+1][m+1]; | |
466 | bg22=fBpy[k][l+1][m+1]; | |
8918e700 | 467 | break; |
468 | ||
469 | case 2: | |
803c9752 | 470 | bf11=fBpz[k][l][m]; |
471 | bf12=fBpz[k+1][l][m]; | |
472 | bf21=fBpz[k+1][l+1][m]; | |
473 | bf22=fBpz[k][l+1][m]; | |
aee8290b | 474 | |
803c9752 | 475 | bg11=fBpz[k][l][m+1]; |
476 | bg12=fBpz[k+1][l][m+1]; | |
477 | bg21=fBpz[k+1][l+1][m+1]; | |
478 | bg22=fBpz[k][l+1][m+1]; | |
8918e700 | 479 | break; |
aee8290b | 480 | /*-----------------Cartensian part ---------------*/ |
481 | ||
8918e700 | 482 | case 3: |
803c9752 | 483 | bf11=fBcx[k][l][m]; |
484 | bf12=fBcx[k+1][l][m]; | |
485 | bf21=fBcx[k+1][l+1][m]; | |
486 | bf22=fBcx[k][l+1][m]; | |
aee8290b | 487 | |
803c9752 | 488 | bg11=fBcx[k][l][m+1]; |
489 | bg12=fBcx[k+1][l][m+1]; | |
490 | bg21=fBcx[k+1][l+1][m+1]; | |
491 | bg22=fBcx[k][l+1][m+1]; | |
8918e700 | 492 | break; |
493 | ||
494 | case 4: | |
803c9752 | 495 | bf11=fBcy[k][l][m]; |
496 | bf12=fBcy[k+1][l][m]; | |
497 | bf21=fBcy[k+1][l+1][m]; | |
498 | bf22=fBcy[k][l+1][m]; | |
aee8290b | 499 | |
803c9752 | 500 | bg11=fBcy[k][l][m+1]; |
501 | bg12=fBcy[k+1][l][m+1]; | |
502 | bg21=fBcy[k+1][l+1][m+1]; | |
503 | bg22=fBcy[k][l+1][m+1]; | |
8918e700 | 504 | break; |
505 | ||
506 | case 5: | |
803c9752 | 507 | bf11=fBcz[k][l][m]; |
508 | bf12=fBcz[k+1][l][m]; | |
509 | bf21=fBcz[k+1][l+1][m]; | |
510 | bf22=fBcz[k][l+1][m]; | |
aee8290b | 511 | |
803c9752 | 512 | bg11=fBcz[k][l][m+1]; |
513 | bg12=fBcz[k+1][l][m+1]; | |
514 | bg21=fBcz[k+1][l+1][m+1]; | |
515 | bg22=fBcz[k][l+1][m+1]; | |
8918e700 | 516 | break; |
517 | ||
518 | default: | |
e678332c | 519 | Fatal("Bb","Invalid value of kv %d\n",kv); |
8918e700 | 520 | exit(1); |
aee8290b | 521 | } |
522 | ||
523 | ||
524 | ||
525 | fy1=z1*bf11+z2*bf12; | |
526 | fy2=z2*bf21+z1* bf22; | |
527 | ffy=y1*fy1+ y2*fy2; | |
528 | ||
529 | ||
530 | gy1 = z1*bg11+z2*bg12; | |
531 | gy2 = z2*bg21+z1*bg22; | |
532 | ggy= y1*gy1 + y2*gy2; | |
533 | ||
534 | bbi = x1*ffy+x2*ggy; | |
e678332c | 535 | |
536 | return bbi; | |
aee8290b | 537 | |
538 | } | |
539 | //____________________________________________ | |
540 | ||
541 | void AliMagFDM::ReadField() | |
542 | { | |
543 | // | |
544 | // Method to read the magnetic field from file | |
545 | // | |
546 | FILE *magfile; | |
547 | ||
548 | Int_t ik, il, im; | |
549 | Float_t zzp, rr,phii; | |
550 | Float_t zz, yy, bx,by,bz,bb; | |
551 | ||
552 | char *fname; | |
553 | printf("Reading Magnetic Field %s from file %s\n",fName.Data(),fTitle.Data()); | |
554 | fname = gSystem->ExpandPathName(fTitle.Data()); | |
555 | magfile=fopen(fname,"r"); | |
556 | delete [] fname; | |
557 | ||
558 | printf("Cartensian part\n"); | |
559 | ||
560 | if (magfile) { | |
561 | ||
562 | // Cartensian part | |
563 | ||
803c9752 | 564 | fscanf(magfile,"%d %d %d ",&fYl, &fXl, &fZl); |
aee8290b | 565 | |
803c9752 | 566 | printf("fYl %d, fXl %d, fZl %d\n",fYl, fXl, fZl); |
aee8290b | 567 | |
803c9752 | 568 | for (ik=0; ik<fZl; ik++) |
aee8290b | 569 | { |
570 | ||
571 | fscanf(magfile, " %e ", &zz); | |
803c9752 | 572 | fZc[ik]=zz; |
aee8290b | 573 | |
574 | } | |
575 | ||
803c9752 | 576 | for (ik=0; ik<fYl; ik++) |
aee8290b | 577 | { |
578 | fscanf(magfile, " %e ", &yy); | |
803c9752 | 579 | fY[ik]=yy; |
aee8290b | 580 | |
581 | } | |
582 | for (ik=0; ik<81; ik++) | |
583 | { | |
803c9752 | 584 | printf("fZc %e,fY %e\n", fZc[ik],fY[ik]); |
aee8290b | 585 | } |
586 | ||
803c9752 | 587 | fscanf(magfile," %e %e %e %e %e %e %e %e %e %e %e ", &fYdel,&fXdel,&fZdel,&fZmax,&fZmin,&fYmax,&fYmin,&fAx1,&fCx1,&fAx2,&fCx2); |
aee8290b | 588 | |
803c9752 | 589 | printf("fYdel %e, fXdel %e, fZdel %e\n",fYdel,fXdel,fZdel); |
590 | printf("fZmax %e, fZmin %e, fYmax %e,fYmin %e\n",fZmax,fZmin,fYmax,fYmin); | |
591 | printf("fAx1 %e, fCx1 %e, fAx2 %e, fCx %e\n",fAx1,fCx1,fAx2,fCx2); | |
aee8290b | 592 | |
593 | for (il=0; il<44; il++) { | |
594 | for (im=0; im<81; im++) { | |
595 | for (ik=0; ik<81; ik++) { | |
596 | ||
597 | fscanf(magfile, " %e ", &by); | |
803c9752 | 598 | fBcy[ik][im][il]=by; |
aee8290b | 599 | } |
600 | } | |
601 | } | |
602 | ||
603 | for (il=0; il<44; il++) { | |
604 | for (im=0; im<81; im++) { | |
605 | for (ik=0; ik<81; ik++) { | |
606 | ||
607 | fscanf(magfile, " %e ", &bx); | |
803c9752 | 608 | fBcx[ik][im][il]=bx; |
aee8290b | 609 | } |
610 | } | |
611 | } | |
612 | ||
613 | for (il=0; il<44; il++) { | |
614 | for (im=0; im<81; im++) { | |
615 | for (ik=0; ik<81; ik++) { | |
616 | ||
617 | fscanf(magfile, " %e ", &bz); | |
803c9752 | 618 | fBcz[ik][im][il]=bz; |
aee8290b | 619 | } |
620 | } | |
621 | } | |
622 | //---------------------- Polar part --------------------------------- | |
623 | ||
624 | printf("Polar part\n"); | |
803c9752 | 625 | fscanf(magfile,"%d %d %d ", &fZpl, &fRn, &fPhin); |
626 | printf("fZpl %d, fRn %d, fPhin %d\n",fZpl,fRn,fPhin); | |
aee8290b | 627 | |
803c9752 | 628 | printf(" fZp array\n"); |
aee8290b | 629 | |
630 | for (ik=0; ik<51; ik++) | |
631 | { | |
632 | fscanf(magfile, " %e ", &zzp); | |
803c9752 | 633 | fZp[ik]=zzp; |
634 | printf(" %e\n",fZp[ik]); | |
aee8290b | 635 | } |
636 | ||
803c9752 | 637 | printf(" fR array\n"); |
aee8290b | 638 | |
639 | for (ik=0; ik<10; ik++) | |
640 | { | |
641 | fscanf(magfile, " %e ", &rr); | |
803c9752 | 642 | fR[ik]=rr; |
643 | printf(" %e\n",fR[ik]); | |
aee8290b | 644 | } |
645 | ||
803c9752 | 646 | // printf("fPhi array\n"); |
aee8290b | 647 | |
648 | for (il=0; il<33; il++) | |
649 | { | |
650 | fscanf(magfile, " %e ", &phii); | |
803c9752 | 651 | fPhi[il]=phii; |
652 | // printf(" %e\n",fPhi[il]); | |
aee8290b | 653 | } |
654 | ||
803c9752 | 655 | fscanf(magfile," %e %e %e %e %e %e %e ",&fZpdl,&fPhid,&fRdel,&fZpmx,&fZpmn,&fRmax, &fRmin); |
aee8290b | 656 | |
803c9752 | 657 | printf("fZpdl %e, fPhid %e, fRdel %e, fZpmx %e, fZpmn %e,fRmax %e,fRmin %e \n", fZpdl,fPhid, fRdel,fZpmx, fZpmn,fRmax, fRmin); |
aee8290b | 658 | |
659 | ||
660 | for (il=0; il<33; il++) { | |
661 | for (im=0; im<10; im++) { | |
662 | for (ik=0; ik<51; ik++) { | |
663 | fscanf(magfile, " %e ", &by); | |
803c9752 | 664 | fBpy[ik][im][il]=by; |
aee8290b | 665 | } |
666 | } | |
667 | } | |
668 | ||
669 | for (il=0; il<33; il++) { | |
670 | for (im=0; im<10; im++) { | |
671 | for (ik=0; ik<51; ik++) { | |
672 | fscanf(magfile, " %e ", &bx); | |
803c9752 | 673 | fBpx[ik][im][il]=bx; |
aee8290b | 674 | } |
675 | } | |
676 | } | |
677 | ||
678 | ||
679 | for (il=0; il<33; il++) { | |
680 | for (im=0; im<10; im++) { | |
681 | for (ik=0; ik<51; ik++) { | |
682 | fscanf(magfile, " %e ", &bz); | |
803c9752 | 683 | fBpz[ik][im][il]=bz; |
aee8290b | 684 | } |
685 | } | |
686 | } | |
687 | ||
688 | ||
689 | for (il=0; il<32; il++) { | |
690 | for (im=0; im<2; im++) { | |
691 | for (ik=0; ik<2; ik++) { | |
692 | fscanf(magfile, " %e ", &bb); | |
803c9752 | 693 | fB[ik][im][il]=bb; |
aee8290b | 694 | } |
695 | } | |
696 | } | |
697 | // | |
698 | } else { | |
699 | printf("File %s not found !\n",fTitle.Data()); | |
700 | exit(1); | |
701 | } | |
702 | } | |
703 | //________________________________ |