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