]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliMagFDM.cxx
replaces AliPHOSAliEnFile: references to AliEn removed
[u/mrichter/AliRoot.git] / STEER / AliMagFDM.cxx
index 50264c8fb865433534839bf68bf570e825f6ec5a..5604727cbac68f08273663e47b5fecbd32fec476 100644 (file)
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-/*
-$Log$
-Revision 1.12  2001/05/28 14:10:35  morsch
-SetSolenoidField method to set the L3 field strength. 2 kG is default.
+/* $Id$ */
 
-Revision 1.11  2001/02/08 13:18:00  hristov
-Print removed (J.Gosset)
-
-Revision 1.10  2001/01/18 13:21:30  morsch
-Take pi from TMath.
-
-Revision 1.9  2001/01/17 20:02:20  morsch
-In the AliMagFDM tree  call-by-reference functions were changed to
-call-by-value, what is more adequate for our task. There were added
-a few comments and put protection to values of cos > 1.000 in
-AliMagFDM.cxx. (Galina Chabratova)
-
-Revision 1.8  2000/12/18 10:44:01  morsch
-Possibility to set field map by passing pointer to objet of type AliMagF via
-SetField().
-Example:
-gAlice->SetField(new AliMagFCM("Map2", "$(ALICE_ROOT)/data/field01.dat",2,1.,10.));
-
-Revision 1.7  2000/12/01 11:20:27  alibrary
-Corrector dipole removed from ZDC
-
-Revision 1.6  2000/11/10 18:09:55  fca
-New field map for the ZDC
-
-Revision 1.5  2000/10/27 14:17:04  morsch
-- Bug causing segmentation violation during muon reconstruction corrected
-- Coding rule violations corrected.
-(Galina Chabratova)
-
-Revision 1.4  2000/10/02 21:28:14  fca
-Removal of useless dependecies via forward declarations
-
-Revision 1.3  2000/07/13 16:19:09  fca
-Mainly coding conventions + some small bug fixes
-
-Revision 1.2  2000/07/12 08:56:25  fca
-Coding convention correction and warning removal
-
-Revision 1.1  2000/07/11 18:24:59  fca
-Coding convention corrections + few minor bug fixes
-
-*/
+//-------------------------------------------------------------------------
+//   Field with Magnetic Field map
+//   Used by AliRun class
+//   Author:
+//-------------------------------------------------------------------------
 
 #include <stdlib.h>
 
 #include "TSystem.h"
 
 #include "AliMagFDM.h"
-    
 
 ClassImp(AliMagFDM)
 
@@ -105,9 +64,9 @@ AliMagFDM::AliMagFDM():
 }
 
 //_______________________________________________________________________
-AliMagFDM::AliMagFDM(const char *name, const char *title, const Int_t integ,
-                     const Float_t factor, const Float_t fmax):
-  AliMagF(name,title,integ,factor,fmax),
+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),
@@ -155,7 +114,7 @@ void AliMagFDM::Field(Float_t *xfi, Float_t *b)
   // Main routine to compute the field in a point
   //
   const Double_t keps=0.1E-06;
-  const Double_t PI2=2.*TMath::Pi();
+  const Double_t kPI2=2.*TMath::Pi();
   const Double_t kone=1;
   
   const    Int_t  kiip=33; 
@@ -180,11 +139,15 @@ void AliMagFDM::Field(Float_t *xfi, Float_t *b)
   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]);
@@ -246,10 +209,10 @@ if ((kfZbg/100<xL3[2] && xL3[2]<=zCmin && r0<=rPmax) || ((zCmin<xL3[2] && xL3[2]
         kcphi=777;
        } 
        ph0=TMath::ACos(cphi);
-       if (xL3[0] < 0 && yyp > 0 ) {ph0=PI2/2 - ph0;}  
-       if (xL3[0] < 0 && yyp < 0 ) {ph0=PI2/2 + ph0;} 
-       if (xL3[0] > 0 && yyp < 0 ) {ph0=PI2 - ph0;}  
-       if (ph0 > PI2) {       ph0=ph0 - PI2;}
+       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) {
         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);
        }  
@@ -299,9 +262,9 @@ if ((kfZbg/100<xL3[2] && xL3[2]<=zCmin && r0<=rPmax) || ((zCmin<xL3[2] && xL3[2]
         }
        }
 
-       b[0]=bint[0];
+       b[0]=-bint[0];
        b[1]=bint[1];
-       b[2]=bint[2];
+       b[2]=-bint[2];
 
    }  
    else 
@@ -349,9 +312,9 @@ if ((kfZbg/100<xL3[2] && xL3[2]<=zCmin && r0<=rPmax) || ((zCmin<xL3[2] && xL3[2]
        bint[jb-3] = Bb(zz1,zz2,yy1,yy2,x1,x2,iKvar,k0, l0, m0)*10 ; 
      }    
  
-   b[0]=bint[0];
+   b[0]=-bint[0];
    b[1]=bint[1];
-   b[2]=bint[2]; 
+   b[2]=-bint[2]; 
 
    } 
 
@@ -361,51 +324,9 @@ if ((kfZbg/100<xL3[2] && xL3[2]<=zCmin && r0<=rPmax) || ((zCmin<xL3[2] && xL3[2]
  }
            
 } else {
+    ZDCField(xfi,b);
 
-//This is the ZDC part
-    Float_t rad2=x[0]*x[0]+x[1]*x[1];
-    if(x[2]>kCORBEG2 && x[2]<kCOREND2){
-      if(rad2<kCOR2RA2){
-        b[0] = kFCORN2;
-      }
     }
-    else if(x[2]>kZ1BEG && x[2]<kZ1END){  
-      if(rad2<kZ1RA2){
-        b[0] = -kG1*x[1];
-        b[1] = -kG1*x[0];
-      }
-    }
-    else if(x[2]>kZ2BEG && x[2]<kZ2END){  
-      if(rad2<kZ2RA2){
-        b[0] = kG1*x[1];
-        b[1] = kG1*x[0];
-      }
-    }
-    else if(x[2]>kZ3BEG && x[2]<kZ3END){  
-      if(rad2<kZ3RA2){
-        b[0] = kG1*x[1];
-        b[1] = kG1*x[0];
-      }
-    }
-    else if(x[2]>kZ4BEG && x[2]<kZ4END){  
-      if(rad2<kZ4RA2){
-        b[0] = -kG1*x[1];
-        b[1] = -kG1*x[0];
-      }
-    }
-    else if(x[2]>kD1BEG && x[2]<kD1END){ 
-      if(rad2<kD1RA2){
-        b[1] = -kFDIP;
-      }
-    }
-    else if(x[2]>kD2BEG && x[2]<kD2END){
-      if(((x[0]-kXCEN1D2)*(x[0]-kXCEN1D2)+(x[1]-kYCEN1D2)*(x[1]-kYCEN1D2))<kD2RA2
-        || ((x[0]-kXCEN2D2)*(x[0]-kXCEN2D2)+(x[1]-kYCEN2D2)*(x[1]-kYCEN2D2))<kD2RA2){
-       b[1] = kFDIP;
-      }
-    }
-      }
-    
 
   if(fFactor!=1) {
     b[0]*=fFactor;
@@ -416,7 +337,7 @@ if ((kfZbg/100<xL3[2] && xL3[2]<=zCmin && r0<=rPmax) || ((zCmin<xL3[2] && xL3[2]
 
 //_______________________________________________________________________
 Int_t AliMagFDM::FZ(Double_t temp, Float_t *Ar, 
-                    Float_t delu, Int_t ik,Int_t nk)
+                    Float_t delu, Int_t ik,Int_t nk) const
 {
   //
   // Quest of a point position at x,y,z (Cartensian) and R,Phi,z (Polar) axises