1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //____________________________________________________________________
20 // Forward Multiplicity Detector based on Silicon wafers.
22 // This class is a singleton that handles the geometry parameters of
25 // The actual code is done by various separate classes. Below is
26 // diagram showing the relationship between the various FMD classes
27 // that handles the geometry
32 // +----------------+<>--+ |
33 // | AliFMDGeometry | ^
34 // +----------------+<>--+ V 1..2
35 // 3 | +----------------+
36 // +-| AliFMDDetector |
40 // +-------------+-------------+
42 // +---------+ +---------+ +---------+
43 // | AliFMD1 | | AliFMD2 | | AliFMD3 |
44 // +---------+ +---------+ +---------+
48 // This class contains all stuff needed to do with a ring. It's
49 // used by the AliFMDDetector objects to instantise inner and
50 // outer rings. The AliFMDRing objects are shared by the
51 // AliFMDDetector objects, and owned by the AliFMDv1 object.
53 // * AliFMD1, AliFMD2, and AliFMD3
54 // These are specialisation of AliFMDDetector, that contains the
55 // particularities of each of the sub-detector system. It is
56 // envisioned that the classes should also define the support
57 // volumes and material for each of the detectors.
60 #include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H
61 #include "AliFMDRing.h" // ALIFMDRING_H
62 #include "AliFMD1.h" // ALIFMD1_H
63 #include "AliFMD2.h" // ALIFMD2_H
64 #include "AliFMD3.h" // ALIFMD2_H
65 #include "AliRecPoint.h" // ALIRECPOINT_H
66 #include "AliLog.h" // ALIRECPOINT_H
67 #include <TVector3.h> // ROOT_TVector3
68 #include <TMatrix.h> // ROOT_TMatrix
69 #include <TParticle.h> // ROOT_TParticle
70 #include <Riostream.h>
72 //====================================================================
73 ClassImp(AliFMDGeometry)
75 ; // This is here to keep Emacs for indenting the next line
78 //____________________________________________________________________
79 AliFMDGeometry* AliFMDGeometry::fgInstance = 0;
81 //____________________________________________________________________
83 AliFMDGeometry::Instance()
85 // Return (newly created) singleton instance
86 if (!fgInstance) fgInstance = new AliFMDGeometry;
90 //____________________________________________________________________
91 AliFMDGeometry::AliFMDGeometry()
92 : AliGeometry("FMD", "Forward multiplicity")
95 // Default constructor
99 fInner = new AliFMDRing('I');
100 fOuter = new AliFMDRing('O');
101 fFMD1 = new AliFMD1(fInner);
102 fFMD2 = new AliFMD2(fInner, fOuter);
103 fFMD3 = new AliFMD3(fInner, fOuter);
104 fIsInitialized = kFALSE;
107 //____________________________________________________________________
108 AliFMDGeometry::AliFMDGeometry(const AliFMDGeometry& other)
109 : AliGeometry(other),
110 fIsInitialized(other.fIsInitialized),
111 fInner(other.fInner),
112 fOuter(other.fOuter),
116 fUseFMD1(other.fUseFMD1),
117 fUseFMD2(other.fUseFMD2),
118 fUseFMD3(other.fUseFMD3)
126 //____________________________________________________________________
128 AliFMDGeometry::operator=(const AliFMDGeometry& other)
131 // Assignment operator
132 fUseFMD1 = other.fUseFMD1;
133 fUseFMD2 = other.fUseFMD2;
134 fUseFMD3 = other.fUseFMD3;
138 fInner = other.fInner;
139 fOuter = other.fOuter;
140 fIsInitialized = other.fIsInitialized;
144 //____________________________________________________________________
146 AliFMDGeometry::Init()
148 // Initialize the the singleton if not done so already
149 if (fIsInitialized) return;
157 //____________________________________________________________________
159 AliFMDGeometry::GetDetector(Int_t i) const
161 // Get the ith detector. i should be one of 1, 2, or 3. If an
162 // invalid value is passed, 0 (NULL) is returned.
164 case 1: return fUseFMD1 ? static_cast<AliFMDDetector*>(fFMD1) : 0;
165 case 2: return fUseFMD2 ? static_cast<AliFMDDetector*>(fFMD2) : 0;
166 case 3: return fUseFMD3 ? static_cast<AliFMDDetector*>(fFMD3) : 0;
171 //____________________________________________________________________
173 AliFMDGeometry::GetRing(Char_t i) const
175 // Get the ith ring. i should be one of 'I' or 'O' (case
176 // insensitive). If an invalid parameter is passed, 0 (NULL) is
180 case 'i': return fInner;
182 case 'o': return fOuter;
187 //____________________________________________________________________
189 AliFMDGeometry::Enable(Int_t i)
191 // Enable the ith detector. i should be one of 1, 2, or 3
193 case 1: fUseFMD1 = kTRUE; break;
194 case 2: fUseFMD2 = kTRUE; break;
195 case 3: fUseFMD3 = kTRUE; break;
199 //____________________________________________________________________
201 AliFMDGeometry::Disable(Int_t i)
203 // Disable the ith detector. i should be one of 1, 2, or 3
205 case 1: fUseFMD1 = kFALSE; break;
206 case 2: fUseFMD2 = kFALSE; break;
207 case 3: fUseFMD3 = kFALSE; break;
211 //____________________________________________________________________
213 AliFMDGeometry::Detector2XYZ(UShort_t detector,
221 // Translate detector coordinates (detector, ring, sector, strip) to
222 // spatial coordinates (x, y, z) in the master reference frame of
224 AliFMDDetector* det = GetDetector(detector);
226 det->Detector2XYZ(ring, sector, strip, x, y, z);
230 //____________________________________________________________________
232 AliFMDGeometry::GetGlobal(const AliRecPoint* p,
234 TMatrix& /* mat */) const
236 // Get the global coordinates cooresponding to the reconstructed
237 // point p. The coordiates is returned in the 3-vector pos passed
238 // to this member function. The matrix mat is used for rotations.
242 //____________________________________________________________________
244 AliFMDGeometry::GetGlobal(const AliRecPoint* p, TVector3& pos) const
246 // Get the global coordinates cooresponding to the reconstructed
247 // point p. The coordiates is returned in the 3-vector pos passed
248 // to this member function. Note, as AliRecPoint only has places for
249 // 3 indicies, it is assumed that the ring hit is an inner ring -
250 // which obviously needn't be the case. This makes the member
251 // function pretty darn useless.
252 // FIXME: Implement this function to work with outer rings too.
255 p->GetLocalPosition(local);
256 UShort_t detector = UShort_t(local.X());
257 UShort_t sector = UShort_t(local.Y());
258 UShort_t strip = UShort_t(local.Z());
259 Detector2XYZ(detector, 'I', sector, strip, x, y, z);
263 //____________________________________________________________________
265 AliFMDGeometry::Impact(const TParticle* /* particle */) const
267 // Return true, if the particle will hit the active detector
268 // elements, and false if not. Should be used for fast
269 // simulations. Note, that the function currently return false
271 // FIXME: Implement this function.
275 //____________________________________________________________________