+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * *
+ * Author: The ALICE Off-line Project. *
+ * Contributors are mentioned in the code where appropriate. *
+ * *
+ * Permission to use, copy, modify and distribute this software and its *
+ * documentation strictly for non-commercial purposes is hereby granted *
+ * without fee, provided that the above copyright notice appears in all *
+ * copies and that both the copyright notice and this permission notice *
+ * appear in the supporting documentation. The authors make no claims *
+ * about the suitability of this software for any purpose. It is *
+ * provided "as is" without express or implied warranty. *
+ **************************************************************************/
-#include "AliMagF.h"
-#include "TSystem.h"
-#include <stdlib.h>
-#include <stdio.h>
-
-//ZDC part -------------------------------------------------------------------
- static const Float_t G1=20.03;
- static const Float_t FDIP=-37.34;
- static const Float_t FDIMU=6.;
- static const Float_t FCORN=11.72;
-//
-// ZBEG Beginning of the inner triplet
-// D1BEG Beginning of separator dipole 1
-// D2BEG Beginning of separator dipole 2
-// CORBEG Corrector dipole beginning (because of dimuon arm)
-//
- static const Float_t CORBEG=1920,COREND=CORBEG+190, CORRA2=4.5*4.5;
-//
- static const Float_t ZBEG=2300;
- static const Float_t Z1BEG=ZBEG+ 0,Z1END=Z1BEG+630,Z1RA2=3.5*3.5;
- static const Float_t Z2BEG=ZBEG+ 880,Z2END=Z2BEG+550,Z2RA2=3.5*3.5;
- static const Float_t Z3BEG=ZBEG+1530,Z3END=Z3BEG+550,Z3RA2=3.5*3.5;
- static const Float_t Z4BEG=ZBEG+2430,Z4END=Z4BEG+630,Z4RA2=3.5*3.5;
- static const Float_t D1BEG=5843.5 ,D1END=D1BEG+945,D1RA2=4.5*4.5;
- static const Float_t D2BEG=12113.2 ,D2END=D2BEG+945,D2RA2=4.5*.5;
+#include <TClass.h>
+#include <TFile.h>
+#include <TSystem.h>
-//ZDC part -------------------------------------------------------------------
+#include "AliMagF.h"
+#include "AliMagWrapCheb.h"
+#include "AliLog.h"
ClassImp(AliMagF)
-//________________________________________
-AliMagF::AliMagF(const char *name, const char *title, const Int_t integ, const Int_t map,
- const Float_t factor, const Float_t fmax)
- : TNamed(name,title)
+const Double_t AliMagF::fgkSol2DipZ = -700.;
+
+//_______________________________________________________________________
+AliMagF::AliMagF():
+ TVirtualMagField(),
+ fMeasuredMap(0),
+ fMapType(k5kG),
+ fSolenoid(0),
+ fBeamType(kNoBeamField),
+ fBeamEnergy(0),
+ //
+ fInteg(0),
+ fPrecInteg(0),
+ fFactorSol(1.),
+ fFactorDip(1.),
+ fMax(15),
+ fDipoleOFF(kFALSE),
+ //
+ fQuadGradient(0),
+ fDipoleField(0),
+ fCCorrField(0),
+ fACorr1Field(0),
+ fACorr2Field(0),
+ fParNames("","")
{
- fMap = map;
- fType = Undef;
- fInteg = integ;
- fFactor = factor;
- fMax = fmax;
+ // Default constructor
+ //
}
-//________________________________________
-void AliMagF::Field(Float_t*, Float_t *b)
+//_______________________________________________________________________
+AliMagF::AliMagF(const char *name, const char* title, Int_t integ,
+ Double_t factorSol, Double_t factorDip,
+ Double_t fmax, BMap_t maptype, const char* path,
+ BeamType_t bt, Double_t be):
+ TVirtualMagField(name),
+ fMeasuredMap(0),
+ fMapType(maptype),
+ fSolenoid(0),
+ fBeamType(bt),
+ fBeamEnergy(be),
+ //
+ fInteg(integ),
+ fPrecInteg(1),
+ fFactorSol(1.),
+ fFactorDip(1.),
+ fMax(fmax),
+ fDipoleOFF(factorDip==0.),
+ //
+ fQuadGradient(0),
+ fDipoleField(0),
+ fCCorrField(0),
+ fACorr1Field(0),
+ fACorr2Field(0),
+ fParNames("","")
{
- printf("Undefined MagF Field called, returning 0\n");
- b[0]=b[1]=b[2]=0;
+ // Initialize the field with Geant integration option "integ" and max field "fmax,
+ // Impose scaling of parameterized L3 field by factorSol and of dipole by factorDip.
+ // The "be" is the energy of the beam in GeV/nucleon
+ //
+ SetTitle(title);
+ if(integ<0 || integ > 2) {
+ AliWarning(Form("Invalid magnetic field flag: %5d; Helix tracking chosen instead",integ));
+ fInteg = 2;
+ }
+ if (fInteg == 0) fPrecInteg = 0;
+ //
+ const char* parname = 0;
+ //
+ if (fMapType == k2kG) {
+ fSolenoid = 2.;
+ parname = fDipoleOFF ? "Sol12_Dip0_Hole":"Sol12_Dip6_Hole";
+ } else if (fMapType == k5kG) {
+ fSolenoid = 5.;
+ parname = fDipoleOFF ? "Sol30_Dip0_Hole":"Sol30_Dip6_Hole";
+ } else if (fMapType == k5kGUniform) {
+ fSolenoid = 5.;
+ parname = "Sol30_Dip6_Uniform";
+ } else {
+ AliFatal(Form("Unknown field identifier %d is requested\n",fMapType));
+ }
+ //
+ SetDataFileName(path);
+ SetParamName(parname);
+ //
+ SetFactorSol(factorSol);
+ SetFactorDip(factorDip);
+ LoadParameterization();
+ InitMachineField(fBeamType,fBeamEnergy);
}
-
-ClassImp(AliMagFC)
-//________________________________________
-AliMagFC::AliMagFC(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)
+//_______________________________________________________________________
+AliMagF::AliMagF(const AliMagF &src):
+ TVirtualMagField(src),
+ fMeasuredMap(0),
+ fMapType(src.fMapType),
+ fSolenoid(src.fSolenoid),
+ fBeamType(src.fBeamType),
+ fBeamEnergy(src.fBeamEnergy),
+ fInteg(src.fInteg),
+ fPrecInteg(src.fPrecInteg),
+ fFactorSol(src.fFactorSol),
+ fFactorDip(src.fFactorDip),
+ fMax(src.fMax),
+ fDipoleOFF(src.fDipoleOFF),
+ fQuadGradient(src.fQuadGradient),
+ fDipoleField(src.fDipoleField),
+ fCCorrField(src.fCCorrField),
+ fACorr1Field(src.fACorr1Field),
+ fACorr2Field(src.fACorr2Field),
+ fParNames(src.fParNames)
{
- printf("Constant Field %s created: map= %d, factor= %f\n",fName.Data(),map,factor);
- fType = Const;
+ if (src.fMeasuredMap) fMeasuredMap = new AliMagWrapCheb(*src.fMeasuredMap);
}
-//________________________________________
-void AliMagFC::Field(Float_t *x, Float_t *b)
+//_______________________________________________________________________
+AliMagF::~AliMagF()
{
- b[0]=b[1]=b[2]=0;
- if(fMap==1) {
- if(TMath::Abs(x[2])<700 && x[0]*x[0]+(x[1]+30)*(x[1]+30) < 560*560) {
- b[2]=2;
- } else {
- if ( 725 <= x[2] && x[2] <= 1225 ) {
- Float_t dz = TMath::Abs(975-x[2])*0.01;
- b[0]=(1-0.1*dz*dz)*7;
- }
- else {
-//This is the ZDC part
- Float_t rad2=x[0]*x[0]+x[1]*x[1];
- if(rad2<D2RA2) {
- if(x[2]>D2BEG) {
-
-// Separator Dipole D2
- if(x[2]<D2END) b[1]=FDIP;
- } else if(x[2]>D1BEG) {
-
-// Separator Dipole D1
- if(x[2]<D1END) b[1]=-FDIP;
- }
- if(rad2<CORRA2) {
+ delete fMeasuredMap;
+}
-// First quadrupole of inner triplet de-focussing in x-direction
-// Inner triplet
- if(x[2]>Z4BEG) {
- if(x[2]<Z4END) {
-
-// 2430 <-> 3060
- b[0]=-G1*x[1];
- b[1]=-G1*x[0];
- }
- } else if(x[2]>Z3BEG) {
- if(x[2]<Z3END) {
+//_______________________________________________________________________
+Bool_t AliMagF::LoadParameterization()
+{
+ if (fMeasuredMap) {
+ AliError(Form("Field data %s are already loaded from %s\n",GetParamName(),GetDataFileName()));
+ return kTRUE;
+ }
+ //
+ char* fname = gSystem->ExpandPathName(GetDataFileName());
+ TFile* file = TFile::Open(fname);
+ if (!file) {
+ AliError(Form("Failed to open magnetic field data file %s\n",fname));
+ return kFALSE;
+ }
+ //
+ fMeasuredMap = dynamic_cast<AliMagWrapCheb*>(file->Get(GetParamName()));
+ if (!fMeasuredMap) {
+ AliError(Form("Did not find field %s in %s\n",GetParamName(),fname));
+ return kFALSE;
+ }
+ file->Close();
+ delete file;
+ return kTRUE;
+}
-// 1530 <-> 2080
- b[0]=G1*x[1];
- b[1]=G1*x[0];
- }
- } else if(x[2]>Z2BEG) {
- if(x[2]<Z2END) {
-
-// 890 <-> 1430
- b[0]=G1*x[1];
- b[1]=G1*x[0];
- }
- } else if(x[2]>Z1BEG) {
- if(x[2]<Z1END) {
-// 0 <-> 630
- b[0]=-G1*x[1];
- b[1]=-G1*x[0];
- }
- } else if(x[2]>CORBEG) {
- if(x[2]<COREND) {
-// Corrector dipole (because of dimuon arm)
- b[0]=FCORN;
- }
- }
- }
- }
- }
- }
- } else {
- printf("Invalid field map for constant field %d\n",fMap);
- exit(1);
+//_______________________________________________________________________
+void AliMagF::Field(const Double_t *xyz, Double_t *b)
+{
+ // Method to calculate the field at point xyz
+ //
+ // b[0]=b[1]=b[2]=0.0;
+ if (fMeasuredMap && xyz[2]>fMeasuredMap->GetMinZ() && xyz[2]<fMeasuredMap->GetMaxZ()) {
+ fMeasuredMap->Field(xyz,b);
+ if (xyz[2]>fgkSol2DipZ || fDipoleOFF) for (int i=3;i--;) b[i] *= fFactorSol;
+ else for (int i=3;i--;) b[i] *= fFactorDip;
}
+ else MachineField(xyz, b);
+ //
}
-
-ClassImp(AliMagFCM)
-//________________________________________
-AliMagFCM::AliMagFCM(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)
+//_______________________________________________________________________
+Double_t AliMagF::GetBz(const Double_t *xyz) const
{
- fType = ConMesh;
- printf("Constant Mesh Field %s created: map= %d, factor= %f, file= %s\n",fName.Data(),map,factor,fTitle.Data());
+ // Method to calculate the field at point xyz
+ //
+ if (fMeasuredMap && xyz[2]>fMeasuredMap->GetMinZ() && xyz[2]<fMeasuredMap->GetMaxZ()) {
+ double bz = fMeasuredMap->GetBz(xyz);
+ return (xyz[2]>fgkSol2DipZ || fDipoleOFF) ? bz*fFactorSol : bz*fFactorDip;
+ }
+ else return 0.;
}
-//________________________________________
-void AliMagFCM::Field(Float_t *x, Float_t *b)
+//_______________________________________________________________________
+AliMagF& AliMagF::operator=(const AliMagF& src)
{
- Double_t ratx, raty, ratz, hix, hiy, hiz, ratx1, raty1, ratz1,
- bhyhz, bhylz, blyhz, blylz, bhz, blz, xl[3];
- const Double_t one=1;
- Int_t ix, iy, iz;
-
- // --- find the position in the grid ---
-
- b[0]=b[1]=b[2]=0;
- if(-700<x[2] && x[2]<fZbeg && x[0]*x[0]+(x[1]+30)*(x[1]+30) < 560*560) {
- b[2]=2;
- } else {
- Bool_t infield=(fZbeg<=x[2] && x[2]<fZbeg+fZdel*(fZn-1)
- && ( fXbeg <= TMath::Abs(x[0]) && TMath::Abs(x[0]) < fXbeg+fXdel*(fXn-1) )
- && ( fYbeg <= TMath::Abs(x[1]) && TMath::Abs(x[1]) < fYbeg+fYdel*(fYn-1) ));
- if(infield) {
- xl[0]=TMath::Abs(x[0])-fXbeg;
- xl[1]=TMath::Abs(x[1])-fYbeg;
- xl[2]=x[2]-fZbeg;
-
- // --- start with x
-
- hix=xl[0]*fXdeli;
- ratx=hix-int(hix);
- ix=int(hix);
-
- hiy=xl[1]*fYdeli;
- raty=hiy-int(hiy);
- iy=int(hiy);
-
- hiz=xl[2]*fZdeli;
- ratz=hiz-int(hiz);
- iz=int(hiz);
-
- if(fMap==2) {
- // ... simple interpolation
- ratx1=one-ratx;
- raty1=one-raty;
- ratz1=one-ratz;
- bhyhz = Bx(ix ,iy+1,iz+1)*ratx1+Bx(ix+1,iy+1,iz+1)*ratx;
- bhylz = Bx(ix ,iy+1,iz )*ratx1+Bx(ix+1,iy+1,iz )*ratx;
- blyhz = Bx(ix ,iy ,iz+1)*ratx1+Bx(ix+1,iy ,iz+1)*ratx;
- blylz = Bx(ix ,iy ,iz )*ratx1+Bx(ix+1,iy ,iz )*ratx;
- bhz = blyhz *raty1+bhyhz *raty;
- blz = blylz *raty1+bhylz *raty;
- b[0] = blz *ratz1+bhz *ratz;
- //
- bhyhz = By(ix ,iy+1,iz+1)*ratx1+By(ix+1,iy+1,iz+1)*ratx;
- bhylz = By(ix ,iy+1,iz )*ratx1+By(ix+1,iy+1,iz )*ratx;
- blyhz = By(ix ,iy ,iz+1)*ratx1+By(ix+1,iy ,iz+1)*ratx;
- blylz = By(ix ,iy ,iz )*ratx1+By(ix+1,iy ,iz )*ratx;
- bhz = blyhz *raty1+bhyhz *raty;
- blz = blylz *raty1+bhylz *raty;
- b[1] = blz *ratz1+bhz *ratz;
- //
- bhyhz = Bz(ix ,iy+1,iz+1)*ratx1+Bz(ix+1,iy+1,iz+1)*ratx;
- bhylz = Bz(ix ,iy+1,iz )*ratx1+Bz(ix+1,iy+1,iz )*ratx;
- blyhz = Bz(ix ,iy ,iz+1)*ratx1+Bz(ix+1,iy ,iz+1)*ratx;
- blylz = Bz(ix ,iy ,iz )*ratx1+Bz(ix+1,iy ,iz )*ratx;
- bhz = blyhz *raty1+bhyhz *raty;
- blz = blylz *raty1+bhylz *raty;
- b[2] = blz *ratz1+bhz *ratz;
- //printf("ratx,raty,ratz,b[0],b[1],b[2] %f %f %f %f %f %f\n",
- //ratx,raty,ratz,b[0],b[1],b[2]);
- //
- // ... use the dipole symmetry
- if (x[0]*x[1] < 0) b[1]=-b[1];
- if (x[0]<0) b[2]=-b[2];
- } else {
- printf("Invalid field map for constant mesh %d\n",fMap);
- }
- } else {
-//This is the ZDC part
- Float_t rad2=x[0]*x[0]+x[1]*x[1];
- if(rad2<D2RA2) {
- if(x[2]>D2BEG) {
-
-// Separator Dipole D2
- if(x[2]<D2END) b[1]=FDIP;
- } else if(x[2]>D1BEG) {
-
-// Separator Dipole D1
- if(x[2]<D1END) b[1]=-FDIP;
- }
- if(rad2<CORRA2) {
-
-// First quadrupole of inner triplet de-focussing in x-direction
-// Inner triplet
- if(x[2]>Z4BEG) {
- if(x[2]<Z4END) {
-
-// 2430 <-> 3060
- b[0]=-G1*x[1];
- b[1]=-G1*x[0];
- }
- } else if(x[2]>Z3BEG) {
- if(x[2]<Z3END) {
-
-// 1530 <-> 2080
- b[0]=G1*x[1];
- b[1]=G1*x[0];
- }
- } else if(x[2]>Z2BEG) {
- if(x[2]<Z2END) {
-
-// 890 <-> 1430
- b[0]=G1*x[1];
- b[1]=G1*x[0];
- }
- } else if(x[2]>Z1BEG) {
- if(x[2]<Z1END) {
+ if (this != &src && src.fMeasuredMap) {
+ if (fMeasuredMap) delete fMeasuredMap;
+ fMeasuredMap = new AliMagWrapCheb(*src.fMeasuredMap);
+ SetName(src.GetName());
+ fSolenoid = src.fSolenoid;
+ fBeamType = src.fBeamType;
+ fBeamEnergy = src.fBeamEnergy;
+ fInteg = src.fInteg;
+ fPrecInteg = src.fPrecInteg;
+ fFactorSol = src.fFactorSol;
+ fFactorDip = src.fFactorDip;
+ fMax = src.fMax;
+ fDipoleOFF = src.fDipoleOFF;
+ fParNames = src.fParNames;
+ }
+ return *this;
+}
-// 0 <-> 630
- b[0]=-G1*x[1];
- b[1]=-G1*x[0];
- }
- } else if(x[2]>CORBEG) {
- if(x[2]<COREND) {
-// Corrector dipole (because of dimuon arm)
- b[0]=FCORN;
- }
- }
- }
- }
- }
+//_______________________________________________________________________
+void AliMagF::InitMachineField(BeamType_t btype, Double_t benergy)
+{
+ if (btype==kNoBeamField || benergy<1.) {
+ fQuadGradient = fDipoleField = fCCorrField = fACorr1Field = fACorr2Field = 0.;
+ return;
}
+ //
+ double rigScale = benergy/7000.; // scale according to ratio of E/Enominal
+ // for ions assume PbPb (with energy provided per nucleon) and account for A/Z
+ if (btype == kBeamTypeAA) rigScale *= 208./82.;
+ //
+ fQuadGradient = 22.0002*rigScale;
+ fDipoleField = 37.8781*rigScale;
+ //
+ // SIDE C
+ fCCorrField = -9.6980;
+ // SIDE A
+ fACorr1Field = -13.2247;
+ fACorr2Field = 11.7905;
+ //
}
-//________________________________________
-void AliMagFCM::ReadField()
+//_______________________________________________________________________
+void AliMagF::MachineField(const Double_t *x, Double_t *b) const
{
- FILE *magfile;
- Int_t ix, iy, iz, ipx, ipy, ipz;
- Float_t bx, by, bz;
- char *fname;
- printf("Reading Magnetic Field %s from file %s\n",fName.Data(),fTitle.Data());
- fname = gSystem->ExpandPathName(fTitle.Data());
- magfile=fopen(fname,"r");
- delete [] fname;
- if (magfile) {
- fscanf(magfile,"%d %d %d %f %f %f %f %f %f",
- &fXn, &fYn, &fZn, &fXdel, &fYdel, &fZdel, &fXbeg, &fYbeg, &fZbeg);
- printf("fXn %d, fYn %d, fZn %d, fXdel %f, fYdel %f, fZdel %f, fXbeg %f, fYbeg %f, fZbeg %f\n",
- fXn, fYn, fZn, fXdel, fYdel, fZdel, fXbeg, fYbeg, fZbeg);
- fXdeli=1./fXdel;
- fYdeli=1./fYdel;
- fZdeli=1./fZdel;
- fB = new TVector(3*fXn*fYn*fZn);
- for (iz=0; iz<fZn; iz++) {
- ipz=iz*3*(fXn*fYn);
- for (iy=0; iy<fYn; iy++) {
- ipy=ipz+iy*3*fXn;
- for (ix=0; ix<fXn; ix++) {
- ipx=ipy+ix*3;
- fscanf(magfile,"%f %f %f",&bz,&by,&bx);
- (*fB)(ipx+2)=bz;
- (*fB)(ipx+1)=by;
- (*fB)(ipx )=bx;
- }
+ // ---- This is the ZDC part
+ // Compansators for Alice Muon Arm Dipole
+ const Double_t kBComp1CZ = 1075., kBComp1hDZ = 260./2., kBComp1SqR = 4.0*4.0;
+ const Double_t kBComp2CZ = 2049., kBComp2hDZ = 153./2., kBComp2SqR = 4.5*4.5;
+ //
+ const Double_t kTripQ1CZ = 2615., kTripQ1hDZ = 637./2., kTripQ1SqR = 3.5*3.5;
+ const Double_t kTripQ2CZ = 3480., kTripQ2hDZ = 550./2., kTripQ2SqR = 3.5*3.5;
+ const Double_t kTripQ3CZ = 4130., kTripQ3hDZ = 550./2., kTripQ3SqR = 3.5*3.5;
+ const Double_t kTripQ4CZ = 5015., kTripQ4hDZ = 637./2., kTripQ4SqR = 3.5*3.5;
+ //
+ const Double_t kDip1CZ = 6310.8, kDip1hDZ = 945./2., kDip1SqRC = 4.5*4.5, kDip1SqRA = 3.375*3.375;
+ const Double_t kDip2CZ = 12640.3, kDip2hDZ = 945./2., kDip2SqRC = 4.5*4.5, kDip2SqRA = 3.75*3.75;
+ const Double_t kDip2DXC = 9.7, kDip2DXA = 9.4;
+ //
+ double rad2 = x[0] * x[0] + x[1] * x[1];
+ //
+ b[0] = b[1] = b[2] = 0;
+ //
+ // SIDE C **************************************************
+ if(x[2]<0.){
+ if(TMath::Abs(x[2]+kBComp2CZ)<kBComp2hDZ && rad2 < kBComp2SqR){
+ b[0] = fCCorrField*fFactorDip;
+ }
+ else if(TMath::Abs(x[2]+kTripQ1CZ)<kTripQ1hDZ && rad2 < kTripQ1SqR){
+ b[0] = fQuadGradient*x[1];
+ b[1] = fQuadGradient*x[0];
+ }
+ else if(TMath::Abs(x[2]+kTripQ2CZ)<kTripQ2hDZ && rad2 < kTripQ2SqR){
+ b[0] = -fQuadGradient*x[1];
+ b[1] = -fQuadGradient*x[0];
+ }
+ else if(TMath::Abs(x[2]+kTripQ3CZ)<kTripQ3hDZ && rad2 < kTripQ3SqR){
+ b[0] = -fQuadGradient*x[1];
+ b[1] = -fQuadGradient*x[0];
+ }
+ else if(TMath::Abs(x[2]+kTripQ4CZ)<kTripQ4hDZ && rad2 < kTripQ4SqR){
+ b[0] = fQuadGradient*x[1];
+ b[1] = fQuadGradient*x[0];
+ }
+ else if(TMath::Abs(x[2]+kDip1CZ)<kDip1hDZ && rad2 < kDip1SqRC){
+ b[1] = fDipoleField;
+ }
+ else if(TMath::Abs(x[2]+kDip2CZ)<kDip2hDZ && rad2 < kDip2SqRC) {
+ double dxabs = TMath::Abs(x[0])-kDip2DXC;
+ if ( (dxabs*dxabs + x[1]*x[1])<kDip2SqRC) {
+ b[1] = -fDipoleField;
}
}
- } else {
- printf("File %s not found !\n",fTitle.Data());
- exit(1);
}
+ //
+ // SIDE A **************************************************
+ else{
+ if(TMath::Abs(x[2]-kBComp1CZ)<kBComp1hDZ && rad2 < kBComp1SqR) {
+ // Compensator magnet at z = 1075 m
+ b[0] = fACorr1Field*fFactorDip;
+ }
+ //
+ if(TMath::Abs(x[2]-kBComp2CZ)<kBComp2hDZ && rad2 < kBComp2SqR){
+ b[0] = fACorr2Field*fFactorDip;
+ }
+ else if(TMath::Abs(x[2]-kTripQ1CZ)<kTripQ1hDZ && rad2 < kTripQ1SqR){
+ b[0] = -fQuadGradient*x[1];
+ b[1] = -fQuadGradient*x[0];
+ }
+ else if(TMath::Abs(x[2]-kTripQ2CZ)<kTripQ2hDZ && rad2 < kTripQ2SqR){
+ b[0] = fQuadGradient*x[1];
+ b[1] = fQuadGradient*x[0];
+ }
+ else if(TMath::Abs(x[2]-kTripQ3CZ)<kTripQ3hDZ && rad2 < kTripQ3SqR){
+ b[0] = fQuadGradient*x[1];
+ b[1] = fQuadGradient*x[0];
+ }
+ else if(TMath::Abs(x[2]-kTripQ4CZ)<kTripQ4hDZ && rad2 < kTripQ4SqR){
+ b[0] = -fQuadGradient*x[1];
+ b[1] = -fQuadGradient*x[0];
+ }
+ else if(TMath::Abs(x[2]-kDip1CZ)<kDip1hDZ && rad2 < kDip1SqRA){
+ b[1] = -fDipoleField;
+ }
+ else if(TMath::Abs(x[2]-kDip2CZ)<kDip2hDZ && rad2 < kDip2SqRA) {
+ double dxabs = TMath::Abs(x[0])-kDip2DXA;
+ if ( (dxabs*dxabs + x[1]*x[1])<kDip2SqRA) {
+ b[1] = fDipoleField;
+ }
+ }
+ }
+ //
}
-
+//_______________________________________________________________________
+void AliMagF::GetTPCInt(const Double_t *xyz, Double_t *b) const
+{
+ // Method to calculate the integral of magnetic integral from xyz to nearest cathode plane
+ b[0]=b[1]=b[2]=0.0;
+ if (fMeasuredMap) {
+ fMeasuredMap->GetTPCInt(xyz,b);
+ for (int i=3;i--;) b[i] *= fFactorSol;
+ }
+}
+//_______________________________________________________________________
+void AliMagF::GetTPCIntCyl(const Double_t *rphiz, Double_t *b) const
+{
+ // Method to calculate the integral of magnetic integral from point to nearest cathode plane
+ // in cylindrical coordiates ( -pi<phi<pi convention )
+ b[0]=b[1]=b[2]=0.0;
+ if (fMeasuredMap) {
+ fMeasuredMap->GetTPCIntCyl(rphiz,b);
+ for (int i=3;i--;) b[i] *= fFactorSol;
+ }
+}