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