X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;ds=sidebyside;f=STEER%2FAliMagFDM.cxx;h=e4cccc9b18f07c41629898c9d57ffbb4a4177db5;hb=d64e33997f24f0a9c155ee874a1b1c236d6310b2;hp=af924b0023d37562b08705464f9b67c499e582fb;hpb=8918e70084c0bd41164dfeb3795567b013b2693e;p=u%2Fmrichter%2FAliRoot.git diff --git a/STEER/AliMagFDM.cxx b/STEER/AliMagFDM.cxx index af924b0023d..e4cccc9b18f 100644 --- a/STEER/AliMagFDM.cxx +++ b/STEER/AliMagFDM.cxx @@ -13,104 +13,176 @@ * provided "as is" without express or implied warranty. * **************************************************************************/ -/* -$Log$ -Revision 1.1 2000/07/11 18:24:59 fca -Coding convention corrections + few minor bug fixes +/* $Id$ */ -*/ +//------------------------------------------------------------------------- +// Field with Magnetic Field map +// Used by AliRun class +// Author: +//------------------------------------------------------------------------- -#include +#include +#include +#include "AliLog.h" #include "AliMagFDM.h" -#include "TSystem.h" - ClassImp(AliMagFDM) -//________________________________________ -AliMagFDM::AliMagFDM(const char *name, const char *title, const Int_t integ, -const Int_t map, const Float_t factor, const Float_t fmax) - : AliMagF(name,title,integ,map,factor,fmax) - +//_______________________________________________________________________ +AliMagFDM::AliMagFDM(): + fSolenoid(0), + fInd(0), + fZmin(0), + fZmax(0), + fYmax(0), + fYmin(0), + fZpmx(0), + fZpmn(0), + fRmax(0), + fRmin(0), + fXdel(0), + fYdel(0), + fZdel(0), + fRdel(0), + fPhid(0), + fZpdl(0), + fCx1(0), + fCx2(0), + fAx1(0), + fAx2(0), + fXl(0), + fYl(0), + fZl(0), + fRn(0), + fPhin(0), + fZpl(0) { - fType = kDipoMap; + // + // Default constructor for the Dipole field + // +} - 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()); +//_______________________________________________________________________ +AliMagFDM::AliMagFDM(const char *name, const char *title, Int_t integ, + Float_t factor, Float_t fmax): + AliMagFC(name,title,integ,factor,fmax), + fSolenoid(0), + fInd(0), + fZmin(0), + fZmax(0), + fYmax(0), + fYmin(0), + fZpmx(0), + fZpmn(0), + fRmax(0), + fRmin(0), + fXdel(0), + fYdel(0), + fZdel(0), + fRdel(0), + fPhid(0), + fZpdl(0), + fCx1(0), + fCx2(0), + fAx1(0), + fAx2(0), + fXl(0), + fYl(0), + fZl(0), + fRn(0), + fPhin(0), + fZpl(0) +{ + // + // Standard constructor for the Dipole field + // + fType = kDipoMap; + fMap = 3; + SetSolenoidField(); + AliDebug(1, Form( + "Field Map for Muon Arm from IP till muon filter %s created: map= %d, integ= %d, factor= %f, file=%s", + fName.Data(), fMap ,integ,factor,fTitle.Data())); + } -//________________________________________ - -void AliMagFDM::Field(Float_t *xfi, Float_t *b) +//_______________________________________________________________________ +void AliMagFDM::Field(Float_t *xfi, Float_t *b) const { // // Main routine to compute the field in a point // - static const Double_t keps=0.1E-06; - static const Double_t kpi2=.6283185E+01; - static const Double_t kone=1; - - static const Int_t kiip=33; - static const Int_t kmiip=0; - static const Int_t kliip=0; - - static const Int_t kiic=0; - static const Int_t kmiic=0; - static const Int_t kliic=0; - - static const Double_t kfdZbg=502.92; // Start of Map using in z - static const Double_t kfdZL3=600; // Beginning of L3 door in z + const Double_t keps=0.1E-06; + const Double_t kPI2=2.*TMath::Pi(); + const Double_t kone=1; + + const Int_t kiip=33; + const Int_t kmiip=0; + const Int_t kliip=0; + + const Int_t kiic=0; + const Int_t kmiic=0; + const Int_t kliic=0; + + const Double_t kfZbg=502.92; // Start of Map using in z + const Double_t kfZL3=600; // Beginning of L3 door in z Double_t x[3]; Double_t xL3[3]; Double_t bint[3]; Double_t r0; - - Double_t bbj; Int_t iKvar,jb; Double_t zp1, zp2,xp1,xp2,yp1,yp2; Double_t zz1, zz2,yy1,yy2,x2,x1; // --- start the map fiel from z = 502.92 cm --- +// +// This map has been calculated in a coordinate system in which the muon spectrometer sits at z > 0 +// Transfor correspondingly. - x[0] = xfi[0]; - x[1] = xfi[1]; - x[2] = xfi[2]; + x[0] = - xfi[0]; + x[1] = xfi[1]; + x[2] = - xfi[2]; b[0]=b[1]=b[2]=0; +// // printf("x[0] %f,x[1] %f,x[2] %f\n",x[0],x[1],x[2]); Double_t rr=TMath::Sqrt(x[0]*x[0]+x[1]*x[1]); r0=rr/100; Double_t rPmax; - rPmax=fdRmax; - if ( (-700=rPmax*100) ) + || (kfZbgrPmax*100 && rr< 560)) ) { - b[2]=2; + b[0]=b[1]=0; + b[2]=fSolenoid; } xL3[0]=x[0]/100; xL3[1]=(x[1]+30)/100; xL3[2]=x[2]/100; + - Double_t xminn=xL3[2]*fdAx1+fdCx1; - Double_t xmaxx=xL3[2]*fdAx2+fdCx2; + if (TMath::Abs(xL3[0])<=0.1E-06) xL3[0]=TMath::Sign(0.1E-05,xL3[0]); + if (TMath::Abs(xL3[1])<=0.1E-06) xL3[1]=TMath::Sign(0.1E-05,xL3[1]); + + Double_t xminn=xL3[2]*fAx1+fCx1; + Double_t xmaxx=xL3[2]*fAx2+fCx2; Double_t zCmin,zCmax,yCmin,yCmax; - zCmin=fdZmin; - zCmax=fdZmax; - yCmin=fdYmin; - yCmax=fdYmax; - -if ((kfdZbg/100 kone) { + AliDebug(2,Form("xL3[0] %e, xL3[1] %e, xL3[2] %e, yyp %e, r0 %e, cphi %e",xL3[0],xL3[1],xL3[2],yyp,r0,cphi)); + cphi =kone; + kcphi=777; + } ph0=TMath::ACos(cphi); - if (xL3[0]< 0) {ph0=kpi2 - ph0;} - - fip=ph0; - FZ(&fip,fdPhi,&fdPhid ,&mpi,&mp0, &xp1,&xp2,&fdPhin); + if (xL3[0] < 0 && yyp > 0 ) {ph0=kPI2/2 - ph0;} + if (xL3[0] < 0 && yyp < 0 ) {ph0=kPI2/2 + ph0;} + if (xL3[0] > 0 && yyp < 0 ) {ph0=kPI2 - ph0;} + if (ph0 > kPI2) { ph0=ph0 - kPI2;} + if (kcphi==777) { + AliDebug(2,Form("xL3[0] %e, xL3[1] %e, xL3[2] %e, yyp %e, r0 %e, ph0 %e",xL3[0],xL3[1],xL3[2],yyp,r0,ph0)); + } + fip=ph0; + mp0=FZ(fip,fPhi,fPhid ,mpi,fPhin); + xp2=(fip-fPhi[mp0])/(fPhi[mp0+1]-fPhi[mp0]); + xp1=kone-xp2; Double_t rDel; - rDel=fdRdel; + rDel=fRdel; - if (r0<= fdRdel) + if (r0<= fRdel) { if(r0< keps) { - bint[0]=(zp1*fdBpx[kp0][0][0] + zp2*fdBpx[kp0+1][0][0])*10; - bint[1]=(zp1*fdBpy[kp0][0][0] + zp2*fdBpy[kp0+1][0][0])*10; - bint[2]=(zp1*fdBpz[kp0][0][0] + zp2*fdBpz[kp0+1][0][0])*10; + bint[0]=(zp1*fBpx[kp0][0][0] + zp2*fBpx[kp0+1][0][0])*10; + bint[1]=(zp1*fBpy[kp0][0][0] + zp2*fBpy[kp0+1][0][0])*10; + bint[2]=(zp1*fBpz[kp0][0][0] + zp2*fBpz[kp0+1][0][0])*10; - } + } else { - alp2= fdB[0][0][mp0]*yyp + fdB[0][1][mp0]*xL3[0]; - alp3= fdB[1][0][mp0]*yyp + fdB[1][1][mp0]*xL3[0]; + alp2= fB[0][0][mp0]*yyp + fB[0][1][mp0]*xL3[0]; + alp3= fB[1][0][mp0]*yyp + fB[1][1][mp0]*xL3[0]; alp1= kone - alp2 - alp3; for (jb=0; jb<3 ; jb++) - { - iKvar=jb; - FRfuncBi(&iKvar,&zp1,&zp2,&alp1,&alp2,&alp3, &kp0,&mp0, &bbj); - bint[jb] = bbj*10 ; - } + { + iKvar=jb; + bint[jb] = Ba(iKvar,zp1,zp2,alp1,alp2,alp3, kp0,mp0)*10 ; + } + } // end of keps <=r0 } else { rp=r0; - FZ(&rp,fdR ,&fdRdel,&lpi,&lp0,&yp1,&yp2,&fdRn); + lp0=FZ(rp,fR ,fRdel,lpi,fRn); + yp2=(rp-fR[lp0])/(fR[lp0+1]-fR[lp0]); + yp1=kone-yp2; for (jb=0; jb<3 ; jb++) { iKvar=jb; - FGfuncBi(&zp1,&zp2,&yp1,&yp2,&xp1,&xp2,&iKvar,&kp0,&lp0,&mp0,&bbj); - - bint[jb] = bbj*10 ; + bint[jb] = Bb(zp1,zp2,yp1,yp2,xp1,xp2,iKvar,kp0,lp0,mp0)*10 ; } } - b[0]=bint[0]; + b[0]=-bint[0]; b[1]=bint[1]; - b[2]=bint[2]; + b[2]=-bint[2]; -// fprintf(fitest,"------------- Freg2 run -------------\n"); - } else { @@ -197,25 +280,27 @@ if ((kfdZbg/100(xx1+(m0+1)*dx)) { m0=m0+1; - printf(" m0 %d, m0+1 %d\n",m0,m0+1); + AliDebug(2,Form(" m0 %d, m0+1 %d\n",m0,m0+1)); } x2=(xL3[0]-( xx1+m0*dx))/dx; @@ -224,76 +309,23 @@ if ((kfdZbg/100kD2BEG) { - -// Separator Dipole D2 - if(x[2]kD1BEG) { - -// Separator Dipole D1 - if(x[2]kZ4BEG) { - if(x[2] 3060 - b[0]=-kG1*x[1]; - b[1]=-kG1*x[0]; - } - } else if(x[2]>kZ3BEG) { - if(x[2] 2080 - b[0]=kG1*x[1]; - b[1]=kG1*x[0]; - } - } else if(x[2]>kZ2BEG) { - if(x[2] 1430 - b[0]=kG1*x[1]; - b[1]=kG1*x[0]; - } - } else if(x[2]>kZ1BEG) { - if(x[2] 630 - b[0]=-kG1*x[1]; - b[1]=-kG1*x[0]; - } - } else if(x[2]>kCORBEG) { - if(x[2]ExpandPathName(fTitle.Data()); magfile=fopen(fname,"r"); delete [] fname; - printf("Cartensian part\n"); + AliDebug(2,"Cartensian part"); if (magfile) { // Cartensian part - fscanf(magfile,"%d %d %d ",&fdYl, &fdXl, &fdZl); + fscanf(magfile,"%d %d %d ",&fYl, &fXl, &fZl); - printf("fdYl %d, fdXl %d, fdZl %d\n",fdYl, fdXl, fdZl); + AliDebug(3,Form("fYl %d, fXl %d, fZl %d",fYl, fXl, fZl)); - for (ik=0; ik