]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDGeometry.h
Coding conventions (Christian)
[u/mrichter/AliRoot.git] / FMD / AliFMDGeometry.h
1 #ifndef ALIFMDGEOMETRY_H
2 #define ALIFMDGEOMETRY_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights
4  * reserved. 
5  *
6  * Latest changes by Christian Holm Christensen <cholm@nbi.dk>
7  *
8  * See cxx source for full Copyright notice                               
9  */
10 /** @file    AliFMDGeometry.h
11     @author  Christian Holm Christensen <cholm@nbi.dk>
12     @date    Mon Mar 27 12:40:37 2006
13     @brief   Geometry mananger for the FMD
14 */
15 //____________________________________________________________________
16 //                                                                          
17 // Forward Multiplicity Detector based on Silicon wafers. 
18 //
19 // This class is a singleton that handles the geometry parameters of
20 // the FMD detectors.  
21 //                                                       
22 #ifndef ALIGEOMETRY_H
23 # include <AliGeometry.h>
24 #endif
25 #ifndef ROOT_TArrayI
26 # include <TArrayI.h>
27 #endif
28 #ifndef ROOT_TMatrixFfwd
29 # include <TMatrixFfwd.h>
30 #endif
31 class TVector3;
32 class TParticle;
33 class AliRecPoint;
34 class AliFMDRing;
35 class AliFMDDetector;
36 class AliFMD1;
37 class AliFMD2;
38 class AliFMD3;
39 class AliFMDGeometryBuilder;
40
41
42 //__________________________________________________________________
43 /** @brief Singleton object of FMD geometry descriptions and parameters.
44     This class is a singleton that handles the geometry parameters of
45     the FMD detectors.  
46                                                           
47     The actual code is done by various separate classes.   Below is
48     diagram showing the relationship between the various FMD classes
49     that handles the geometry 
50     @verbatim
51                                   +------------+ 
52                                +- | AliFMDRing |
53                            2   |  +------------+
54          +----------------+<>--+        |                               
55          | AliFMDGeometry |             ^                               
56          +----------------+<>--+        V 1..2                          
57                            3   | +----------------+             
58                                +-| AliFMDDetector |             
59                                  +----------------+             
60                                         ^
61                                         |
62                           +-------------+-------------+
63                           |             |             |       
64                      +---------+   +---------+   +---------+
65                      | AliFMD1 |   | AliFMD2 |   | AliFMD3 |
66                      +---------+   +---------+   +---------+
67          
68     @endverbatim
69     -  AliFMDRing 
70        This class contains all stuff needed to do with a ring.  It's
71        used by the AliFMDDetector objects to instantise inner and
72        outer rings.  The AliFMDRing objects are shared by the
73        AliFMDDetector objects, and owned by the AliFMDv1 object. 
74     -  AliFMD1, AliFMD2, and AliFMD3 
75        These are specialisation of AliFMDDetector, that contains the
76        particularities of each of the sub-detector system.  It is
77        envisioned that the classes should also define the support
78        volumes and material for each of the detectors.
79
80     @ingroup FMD_base
81  */
82 class AliFMDGeometry : public AliGeometry
83 {
84 public:
85   /** @return Singleton */
86   static AliFMDGeometry* Instance();
87   /** Initialize */
88   virtual void Init();
89   /** Initialize transforms */
90   virtual void InitTransformations();
91   /** @return Get inner description */
92   AliFMDRing*     GetInner() const { return fInner; }
93   /** @return Get outer description */
94   AliFMDRing*     GetOuter() const { return fOuter; }
95   /** @return Get FMD1 description */
96   AliFMD1*        GetFMD1()  const { return (fUseFMD1 ? fFMD1 : 0); }
97   /** @return Get FMD2 description */
98   AliFMD2*        GetFMD2()  const { return (fUseFMD2 ? fFMD2 : 0); }
99   /** @return Get FMD3 description */
100   AliFMD3*        GetFMD3()  const { return (fUseFMD3 ? fFMD3 : 0); }
101   /** Get description of a sub-detector
102       @param i Sub-detector #
103       @return Description of sub-detector, or 0 */
104   AliFMDDetector* GetDetector(Int_t i) const;
105   /** Get description of a ring
106       @param i Ring id
107       @return Description of ring, or 0 */
108   AliFMDRing*     GetRing(Char_t i) const;
109   /** @param i IF true, disable sub-detector @a i */
110   void            Disable(Int_t i);
111   /** @param i IF true, enable sub-detector @a i */
112   void            Enable(Int_t i);
113   /** @return Density @f$ \rho@f$ of silicon */
114   Double_t        GetSiDensity() const { return 2.33; }
115   /** Translate detector coordinates (detector, ring, sector, strip)
116       to spatial coordinates (x, y, z) in the master reference frame
117       of ALICE.  The member function uses the transformations
118       previously obtained from the TGeoManager.
119       @param detector Detector number
120       @param ring     Ring id
121       @param sector   Sector number
122       @param strip    Strip number
123       @param x        On return, X coordinate 
124       @param y        On return, Y coordinate 
125       @param z        On return, Z coordinate  */
126   void            Detector2XYZ(UShort_t detector, Char_t ring, 
127                                UShort_t sector, UShort_t strip, 
128                                Double_t& x, Double_t& y, Double_t& z) const;
129   /** Translate spatial coordinates (x,y,z) in the master reference
130       frame of ALICE to the detector coordinates (detector, ring,
131       sector, strip).  Note, that if this method is to be used in
132       reconstruction or the like, then the input z-coordinate should
133       be corrected for the events interactions points z-coordinate,
134       like  
135       @code 
136       geom->XYZ2Detector(x,y,z-ipz,d,r,s,t);
137       @endcode
138       @param x        X coordinate
139       @param y        Y coordinate
140       @param z        Z coordinate
141       @param detector On return, Detector number
142       @param ring     On return, Ring id                   
143       @param sector   On return, Sector number     
144       @param strip    On return, Strip number      
145       @return @c  false of (@a x, @a y, @a z) is not within this
146       detector.  */
147   Bool_t          XYZ2Detector(Double_t x, Double_t y, Double_t z, 
148                                UShort_t& detector, Char_t& ring, 
149                                UShort_t& sector, UShort_t& strip) const;
150   /** Make the geometry.  This delegates to AliFMDGeometryBuilder */
151   void   Build();
152   /** @return Get detector offset in paths */
153   Int_t  GetDetectorOff() const    { return fDetectorOff; }
154   /** @return Get sensor offset in paths */
155   Int_t  GetModuleOff() const      { return fModuleOff;   }
156   /** @return Get ring offset in paths */
157   Int_t  GetRingOff() const        { return fRingOff;     }
158   /** @return Get ring sector in paths */
159   Int_t  GetSectorOff() const      { return fSectorOff;   }
160   /** @param off Detector off-set set in geometry path */
161   void   SetDetectorOff(Int_t off) { fDetectorOff = off; }
162   /** @param off Module off-set set in geometry path */
163   void   SetModuleOff(Int_t off)   { fModuleOff   = off; }
164   /** @param off Ring off-set set in geometry path */
165   void   SetRingOff(Int_t off)     { fRingOff     = off; }
166   /** @param off Sectord off-set set in geometry path */
167   void   SetSectorOff(Int_t off)   { fSectorOff   = off; }
168   /** Check if volume @a vol is marked as active 
169       @param vol Volume ID
170       @return  @c true if @a vol is declared active */
171   Bool_t IsActive(Int_t vol) const;
172   /** Set active volumes 
173       @param active Active volume id array 
174       @param n elements of @a active */
175   void   SetActive(Int_t* active, Int_t n);
176   /** @param id Register volume @a id to be active */
177   void   AddActive(Int_t id);
178   /** Set an external geometry builder
179       @param b Geometry builder */
180   void   SetBuilder(AliFMDGeometryBuilder* b) { fBuilder = b; }
181   /** Extract informaton from TGeoManager */
182   void   ExtractGeomInfo();
183   /** Whether we are to use a detailed geometry or not
184       @param det if @c true, make a detailed geometry. */
185   void   SetDetailed(Bool_t det) { fDetailed = det; }
186   /** @return @c true if geometry is detailed */
187   Bool_t IsDetailed() const { return fDetailed; }
188   /** @param ass Whether to use assemblies or not */
189   void   UseAssembly(Bool_t ass)  { fUseAssembly = ass; }
190
191   // AliGeometry member functions 
192   /** Get global coordinates cooresponding to a rec point. 
193       @param p   Reconstructed point.
194       @param pos On return, the position
195       @param mat On return, the material at @a post */
196   virtual void GetGlobal(const AliRecPoint* p, TVector3& pos, 
197                          TMatrixF& mat) const;
198   /** Get global coordinates cooresponding to a rec point. 
199       @param p   Reconstructed point.
200       @param pos On return, the position */
201   virtual void GetGlobal(const AliRecPoint* p, TVector3& pos) const;
202   /** Check if particle will hit an active detector element.  Note
203       done yet. 
204       @param particle Track 
205       @return @c true if @a particle will hit this detector */
206   virtual Bool_t Impact(const TParticle* particle) const;
207 protected:
208   Bool_t        fIsInitialized; // Whether singleton is initalized
209   AliFMDRing*   fInner;         // Inner ring geometry information
210   AliFMDRing*   fOuter;         // Outer ring geometry information
211   AliFMD1*      fFMD1;          // FMD1 geometry information
212   AliFMD2*      fFMD2;          // FMD2 geometry information
213   AliFMD3*      fFMD3;          // FMD3 geometry information
214   Bool_t        fUseFMD1;       // Wheter to Use FMD1 or not
215   Bool_t        fUseFMD2;       // Wheter to Use FMD2 or not
216   Bool_t        fUseFMD3;       // Wheter to Use FMD3 or not
217   static AliFMDGeometry* fgInstance; // Singleton instance 
218   /** CTOR */
219   AliFMDGeometry();
220   /** Copy CTOR
221       @param other To copy from  */
222   AliFMDGeometry(const AliFMDGeometry& other);
223   /** Assignment operator 
224       @param other To assig from
225       @return reference to this.  */
226   AliFMDGeometry& operator=(const AliFMDGeometry& other);
227   virtual ~AliFMDGeometry() {}
228   
229   AliFMDGeometryBuilder* fBuilder; // Geometry builder 
230   Int_t fDetectorOff;              // Detector off-set 
231   Int_t fModuleOff;                // Module off-set 
232   Int_t fRingOff;                  // ring offset
233   Int_t fSectorOff;                // Sector offset    
234   TArrayI fActive;                 // Active volumes
235   Bool_t fDetailed;                // Whether to make detailed geom
236   Bool_t fUseAssembly;             // Whther to use assemblies 
237
238   ClassDef(AliFMDGeometry,1); // Geometry parameters and manager 
239 };
240
241
242 #endif
243 //____________________________________________________________________
244 //
245 // Local Variables:
246 //   mode: C++
247 // End:
248 //
249 // EOF
250 //