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