* provided "as is" without express or implied warranty. *
**************************************************************************/
-/*
-$Log$
-Revision 1.5 2002/10/14 14:57:32 hristov
-Merging the VirtualMC branch to the main development branch (HEAD)
-
-Revision 1.3.6.1 2002/07/24 10:08:13 alibrary
-Updating VirtualMC
-
-Revision 1.4 2002/07/10 15:06:22 morsch
-Initialize TVector* save.
-
-Revision 1.3 2002/02/26 16:13:07 morsch
-Correction in streamer.
-
-Revision 1.2 2002/02/22 14:00:20 morsch
-Protection against replication of fieldmap data in gAlice.
-
-Revision 1.1 2002/02/14 11:41:28 morsch
-Magnetic field map for ALICE for L3+muon spectrometer stored in 3 seperate
-root files.
-
-*/
+/* $Id$ */
+//-----------------------------------------------------------------------
//
+// Class to handle the field
+// I/O and interpolation
+// of the field map to return the value
+// of the magnetic field in an arbitrary position
// Author: Andreas Morsch <andreas.morsch@cern.ch>
//
+//-----------------------------------------------------------------------
-#include <TVector.h>
+#include <cstdlib>
+#include <TClass.h>
+#include <TSystem.h>
+
+#include "AliLog.h"
#include "AliFieldMap.h"
-#include "TSystem.h"
ClassImp(AliFieldMap)
Int_t ix, iy, iz, ipx, ipy, ipz;
Float_t bx, by, bz;
char *fname = 0;
- printf("%s: Reading Magnetic Field Map %s from file %s\n",
- ClassName(),fName.Data(),fTitle.Data());
+ AliInfo(Form("Reading Magnetic Field Map %s from file %s",
+ fName.Data(),fTitle.Data()));
fname = gSystem->ExpandPathName(fTitle.Data());
magfile = fopen(fname,"r");
}
//_______________________________________________________________________
-void AliFieldMap::Field(Float_t *x, Float_t *b)
+void AliFieldMap::Field(Float_t *x, Float_t *b) const
{
//
// Use simple interpolation to obtain field at point x
b[0]=b[1]=b[2]=0;
//
- xl[0]=TMath::Abs(x[0])-fXbeg;
- xl[1]=TMath::Abs(x[1])-fYbeg;
- xl[2]=x[2]-fZbeg;
+ xl[0] = x[0] - fXbeg;
+ xl[1] = x[1] - fYbeg;
+ xl[2] = x[2] - fZbeg;
- hix=xl[0]*fXdeli;
+ hix=TMath::Max(0.,TMath::Min(xl[0]*fXdeli,fXn-1.0001));
ratx=hix-int(hix);
ix=int(hix);
- hiy=xl[1]*fYdeli;
+ hiy=TMath::Max(0.,TMath::Min(xl[1]*fYdeli,fYn-1.0001));
raty=hiy-int(hiy);
iy=int(hiy);
- hiz=xl[2]*fZdeli;
+ hiz=TMath::Max(0.,TMath::Min(xl[2]*fZdeli,fZn-1.0001));
ratz=hiz-int(hiz);
iz=int(hiz);
raty1=kone-raty;
ratz1=kone-ratz;
+ if (!fB) return;
+
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;
}
//_______________________________________________________________________
-void AliFieldMap::Copy(AliFieldMap & /* magf */) const
+void AliFieldMap::Copy(TObject & /* magf */) const
{
//
// Copy *this onto magf -- Not implemented
//
- Fatal("Copy","Not implemented!\n");
+ AliFatal("Not implemented!");
}
//_______________________________________________________________________