]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliFieldMap.h
757c6ac7d3e0cfef3daf88c1aef0555f7fd4eec2
[u/mrichter/AliRoot.git] / STEER / AliFieldMap.h
1 #ifndef ALIFIELDMAP_H
2 #define ALIFIELDMAP_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6 /* $Id$ */
7
8 //
9 // Author: Andreas Morsch <andreas.morsch@cern.ch>
10 //
11 #include <TNamed.h>
12 #include <TVector.h>
13
14 class AliFieldMap : public TNamed
15 {
16   //Alice Magnetic Field with constant mesh
17
18 public:
19     AliFieldMap();
20     AliFieldMap(const char *name, const char *title);
21     AliFieldMap(const AliFieldMap &mag);
22     virtual ~AliFieldMap();
23     void Copy(AliFieldMap &map) const;
24     virtual AliFieldMap & operator=(const AliFieldMap &map);
25
26     virtual void Field(Float_t *x, Float_t *b);
27     Float_t Bx(const Int_t ix, const Int_t iy, const Int_t iz) {
28         return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz));
29     }
30     Float_t By(const Int_t ix, const Int_t iy, const Int_t iz) {
31         return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz)+1);
32     }
33     Float_t Bz(const Int_t ix, const Int_t iy, const Int_t iz) {
34         return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz)+2);
35     }
36
37     Bool_t Inside(Float_t x, Float_t y, Float_t z) 
38         { return (x > fXbeg && x <= fXend &&
39                   y > fYbeg && y <= fYend &&
40                   z > fZbeg && z <= fZend);
41         }
42     Float_t Xmin()  {return fXbeg;}
43     Float_t Xmax()  {return fXend;}
44     Float_t DelX()  {return fXdel;}
45     Float_t DeliX() {return fXdeli;}
46     
47     Float_t Ymin()  {return fYbeg;}
48     Float_t Ymax()  {return fYend;}
49     Float_t DelY()  {return fYdel;}
50     Float_t DeliY() {return fYdeli;}
51     
52     Float_t Zmin()  {return fZbeg;}
53     Float_t Zmax()  {return fZend;}
54     Float_t DelZ()  {return fZdel;}
55     Float_t DeliZ() {return fZdeli;}
56     void    SetLimits(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax,
57                       Float_t zmin, Float_t zmax)
58         {
59             fXbeg = xmin; fXend = xmax; fYbeg = ymin; fYend = ymax;
60             fZbeg = zmin; fZend = zmax;
61         }
62  private:
63     void    ReadField();
64  protected:
65
66     Float_t    fXbeg;     // Start of mesh in x
67     Float_t    fYbeg;     // Start of mesh in y
68     Float_t    fZbeg;     // Start of mesh in z
69     Float_t    fXend;     // End of mesh in x
70     Float_t    fYend;     // End of mesh in y
71     Float_t    fZend;     // End of mesh in z
72     Float_t    fXdel;     // Mesh step in x
73     Float_t    fYdel;     // Mesh step in y
74     Float_t    fZdel;     // Mesh step in z
75     Double_t   fXdeli;    // Inverse of Mesh step in x
76     Double_t   fYdeli;    // Inverse of Mesh step in y
77     Double_t   fZdeli;    // Inverse of Mesh step in z
78     Int_t      fXn;       // Number of mesh points in x
79     Int_t      fYn;       // Number of mesh points in y
80     Int_t      fZn;       // Number of mesh points in z
81     TVector*   fB;        //!Field map
82     
83     ClassDef(AliFieldMap,2)  //Class for Field Map
84 };
85
86 #endif