]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliFieldMap.h
Improved Makefile, by setting logging path, TOPDIR and LIBDIR.
[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 #include <TBuffer.h>
14
15 class AliFieldMap : public TNamed
16 {
17   //Alice Magnetic Field with constant mesh
18
19 public:
20     AliFieldMap();
21     AliFieldMap(const char *name, const char *title);
22     AliFieldMap(const AliFieldMap &mag);
23     virtual ~AliFieldMap();
24     void Copy(AliFieldMap &map) const;
25     virtual AliFieldMap & operator=(const AliFieldMap &map);
26
27     virtual void Field(Float_t *x, Float_t *b);
28     Float_t Bx(const Int_t ix, const Int_t iy, const Int_t iz) {
29         return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz));
30     }
31     Float_t By(const Int_t ix, const Int_t iy, const Int_t iz) {
32         return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz)+1);
33     }
34     Float_t Bz(const Int_t ix, const Int_t iy, const Int_t iz) {
35         return (*fB)(3*(ix*(fZn*fYn)+iy*fZn+iz)+2);
36     }
37
38     Bool_t Inside(Float_t x, Float_t y, Float_t z) 
39         { return (x > fXbeg && x <= fXend &&
40                   y > fYbeg && y <= fYend &&
41                   z > fZbeg && z <= fZend);
42         }
43     Float_t Xmin()  {return fXbeg;}
44     Float_t Xmax()  {return fXend;}
45     Float_t DelX()  {return fXdel;}
46     Float_t DeliX() {return fXdeli;}
47     
48     Float_t Ymin()  {return fYbeg;}
49     Float_t Ymax()  {return fYend;}
50     Float_t DelY()  {return fYdel;}
51     Float_t DeliY() {return fYdeli;}
52     
53     Float_t Zmin()  {return fZbeg;}
54     Float_t Zmax()  {return fZend;}
55     Float_t DelZ()  {return fZdel;}
56     Float_t DeliZ() {return fZdeli;}
57     void    SetLimits(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax,
58                       Float_t zmin, Float_t zmax)
59         {
60             fXbeg = xmin; fXend = xmax; fYbeg = ymin; fYend = ymax;
61             fZbeg = zmin; fZend = zmax;
62         }
63     void SetWriteEnable(Int_t flag = 1) {fWriteEnable = flag;}
64  private:
65     void    ReadField();
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     ClassDef(AliFieldMap,3)  //Class for Field Map
87 };
88
89 #endif