]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliFieldMap.h
Protection against non-pdg particles (for example optical photons).
[u/mrichter/AliRoot.git] / STEER / AliFieldMap.h
index 0f6cac2eb18ad418d74865e54d61600d1695e3a5..832a4ec14a583942ab0e4f46db9db1f6a8d7b78c 100644 (file)
@@ -9,7 +9,7 @@
 // Author: Andreas Morsch <andreas.morsch@cern.ch>
 //
 #include <TNamed.h>
-#include <TVector.h>
+class TVector;
 
 class AliFieldMap : public TNamed
 {
@@ -24,57 +24,66 @@ public:
     virtual AliFieldMap & operator=(const AliFieldMap &map);
 
     virtual void Field(Float_t *x, Float_t *b);
-    Float_t Bx(const Int_t ix, const Int_t iy, const Int_t iz) {
-       return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz));
+    Float_t Bx(const Int_t ix, const Int_t iy, const Int_t iz) const{
+       return (*fB)(3*((ix*fYn+iy)*fZn+iz));
     }
-    Float_t By(const Int_t ix, const Int_t iy, const Int_t iz) {
-       return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz)+1);
+    Float_t By(const Int_t ix, const Int_t iy, const Int_t iz) const{
+       return (*fB)(3*((ix*fYn+iy)*fZn+iz)+1);
     }
-    Float_t Bz(const Int_t ix, const Int_t iy, const Int_t iz) {
-       return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz)+2);
+    Float_t Bz(const Int_t ix, const Int_t iy, const Int_t iz) const{
+       return (*fB)(3*((ix*fYn+iy)*fZn+iz)+2);
     }
 
-    Bool_t Inside(Float_t x, Float_t y, Float_t z) 
+    Bool_t Inside(Float_t x, Float_t y, Float_t z) const
        { return (x > fXbeg && x <= fXend &&
                  y > fYbeg && y <= fYend &&
                  z > fZbeg && z <= fZend);
        }
-    Float_t Xmin()  {return fXbeg;}
-    Float_t Xmax()  {return fXend;}
-    Float_t DelX()  {return fXdel;}
-    Float_t DeliX() {return fXdeli;}
+    Float_t Xmin()  const {return fXbeg;}
+    Float_t Xmax()  const {return fXend;}
+    Float_t DelX()  const {return fXdel;}
+    Float_t DeliX() const {return fXdeli;}
     
-    Float_t Ymin()  {return fYbeg;}
-    Float_t Ymax()  {return fYend;}
-    Float_t DelY()  {return fYdel;}
-    Float_t DeliY() {return fYdeli;}
+    Float_t Ymin()  const {return fYbeg;}
+    Float_t Ymax()  const {return fYend;}
+    Float_t DelY()  const {return fYdel;}
+    Float_t DeliY() const {return fYdeli;}
+    
+    Float_t Zmin()  const {return fZbeg;}
+    Float_t Zmax()  const {return fZend;}
+    Float_t DelZ()  const {return fZdel;}
+    Float_t DeliZ() const {return fZdeli;}
+    void    SetLimits(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax,
+                     Float_t zmin, Float_t zmax)
+       {
+           fXbeg = xmin; fXend = xmax; fYbeg = ymin; fYend = ymax;
+           fZbeg = zmin; fZend = zmax;
+       }
+    void SetWriteEnable(Int_t flag = 1) {fWriteEnable = flag;}
+ protected:
+    
+    Float_t    fXbeg;         // Start of mesh in x
+    Float_t    fYbeg;         // Start of mesh in y
+    Float_t    fZbeg;         // Start of mesh in z
+    Float_t    fXend;         // End of mesh in x
+    Float_t    fYend;         // End of mesh in y
+    Float_t    fZend;         // End of mesh in z
+    Float_t    fXdel;         // Mesh step in x
+    Float_t    fYdel;         // Mesh step in y
+    Float_t    fZdel;         // Mesh step in z
+    Double_t   fXdeli;        // Inverse of Mesh step in x
+    Double_t   fYdeli;        // Inverse of Mesh step in y
+    Double_t   fZdeli;        // Inverse of Mesh step in z
+    Int_t      fXn;           // Number of mesh points in x
+    Int_t      fYn;           // Number of mesh points in y
+    Int_t      fZn;           // Number of mesh points in z
+    Int_t      fWriteEnable;  // Enable flag for writing of field data.
+    TVector*   fB;            // Field map
     
-    Float_t Zmin()  {return fZbeg;}
-    Float_t Zmax()  {return fZend;}
-    Float_t DelZ()  {return fZdel;}
-    Float_t DeliZ() {return fZdeli;}
  private:
     void    ReadField();
- protected:
 
-    Float_t    fXbeg;     // Start of mesh in x
-    Float_t    fYbeg;     // Start of mesh in y
-    Float_t    fZbeg;     // Start of mesh in z
-    Float_t    fXend;     // End of mesh in x
-    Float_t    fYend;     // End of mesh in y
-    Float_t    fZend;     // End of mesh in z
-    Float_t    fXdel;     // Mesh step in x
-    Float_t    fYdel;     // Mesh step in y
-    Float_t    fZdel;     // Mesh step in z
-    Double_t   fXdeli;    // Inverse of Mesh step in x
-    Double_t   fYdeli;    // Inverse of Mesh step in y
-    Double_t   fZdeli;    // Inverse of Mesh step in z
-    Int_t      fXn;       // Number of mesh points in x
-    Int_t      fYn;       // Number of mesh points in y
-    Int_t      fZn;       // Number of mesh points in z
-    TVector*   fB;        // Field map
-    
-    ClassDef(AliFieldMap,1)  //Class for Field Map
+    ClassDef(AliFieldMap,3)  //Class for Field Map
 };
 
 #endif