]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliFieldMap.h
Update master to aliroot
[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 // Class to handle the field map of ALICE
10 // I/O and interpolation
11 // Author: Andreas Morsch <andreas.morsch@cern.ch>
12 //
13
14 #include <TNamed.h>
15 #include <TVector.h>
16
17 class AliFieldMap : public TNamed
18 {
19   //Alice Magnetic Field with constant mesh
20
21 public:
22     AliFieldMap();
23     AliFieldMap(const char *name, const char *title);
24     AliFieldMap(const AliFieldMap &mag);
25     virtual ~AliFieldMap();
26     void Copy(TObject &map) const;
27     virtual AliFieldMap & operator=(const AliFieldMap &map);
28     virtual void Field(float *x, float *b) const;
29     virtual void Field(double *x, double *b) const;
30     Float_t Bx(Int_t ix, Int_t iy, Int_t iz) const{
31         return (*fB)(3*((ix*fYn+iy)*fZn+iz));
32     }
33     Float_t By(Int_t ix, Int_t iy, Int_t iz) const{
34         return (*fB)(3*((ix*fYn+iy)*fZn+iz)+1);
35     }
36     Float_t Bz(Int_t ix, Int_t iy, Int_t iz) const{
37         return (*fB)(3*((ix*fYn+iy)*fZn+iz)+2);
38     }
39
40     Bool_t Inside(Float_t x, Float_t y, Float_t z) const
41         { return (x > fXbeg && x < fXend &&
42                   y > fYbeg && y < fYend &&
43                   z > fZbeg && z < fZend);
44         }
45     Float_t Xmin()  const {return fXbeg;}
46     Float_t Xmax()  const {return fXend;}
47     Float_t DelX()  const {return fXdel;}
48     Float_t DeliX() const {return fXdeli;}
49     
50     Float_t Ymin()  const {return fYbeg;}
51     Float_t Ymax()  const {return fYend;}
52     Float_t DelY()  const {return fYdel;}
53     Float_t DeliY() const {return fYdeli;}
54     
55     Float_t Zmin()  const {return fZbeg;}
56     Float_t Zmax()  const {return fZend;}
57     Float_t DelZ()  const {return fZdel;}
58     Float_t DeliZ() const {return fZdeli;}
59     void    SetLimits(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax,
60                       Float_t zmin, Float_t zmax)
61         {
62             fXbeg = xmin; fXend = xmax; fYbeg = ymin; fYend = ymax;
63             fZbeg = zmin; fZend = zmax;
64         }
65     void SetWriteEnable(Int_t flag = 1) {fWriteEnable = flag;}
66  protected:
67     
68     Float_t    fXbeg;         // Start of mesh in x
69     Float_t    fYbeg;         // Start of mesh in y
70     Float_t    fZbeg;         // Start of mesh in z
71     Float_t    fXend;         // End of mesh in x
72     Float_t    fYend;         // End of mesh in y
73     Float_t    fZend;         // End of mesh in z
74     Float_t    fXdel;         // Mesh step in x
75     Float_t    fYdel;         // Mesh step in y
76     Float_t    fZdel;         // Mesh step in z
77     Double_t   fXdeli;        // Inverse of Mesh step in x
78     Double_t   fYdeli;        // Inverse of Mesh step in y
79     Double_t   fZdeli;        // Inverse of Mesh step in z
80     Int_t      fXn;           // Number of mesh points in x
81     Int_t      fYn;           // Number of mesh points in y
82     Int_t      fZn;           // Number of mesh points in z
83     Int_t      fWriteEnable;  // Enable flag for writing of field data.
84     TVector*   fB;            // Field map
85     
86  private:
87     void    ReadField();
88
89     ClassDef(AliFieldMap,3)  //Class for Field Map
90 };
91
92 #endif