1 /**************************************************************************
2 * Copyright(c) 2004, 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 **************************************************************************/
16 /** @file AliFMDRing.cxx
17 @author Christian Holm Christensen <cholm@nbi.dk>
18 @date Mon Mar 27 12:47:43 2006
19 @brief FMD ring geometry parameters
21 //__________________________________________________________________
23 // Utility class to help implement collection of FMD modules into
24 // rings. This is used by AliFMDDetector and AliFMDGeometry.
25 // The AliFMDGeometry object owns the AliFMDRing objects, and the
26 // AliFMDDetector objects reference these. That is, the AliFMDRing
27 // objects are share amoung the AliFMDDetector objects.
29 // Latest changes by Christian Holm Christensen
32 #include <TMath.h> // ROOT_TMath
33 #include <TVector2.h> // ROOT_TVector2
35 // #include <AliLog.h> // ALILOG_H
36 #include "AliFMDRing.h" // ALIFMDRING_H
38 //====================================================================
41 ; // This is here to keep Emacs for indenting the next line
44 //____________________________________________________________________
45 AliFMDRing::AliFMDRing(Char_t id)
46 : TNamed(Form("FMD%c", id), "Forward multiplicity ring"),
62 fPrintboardThickness(0),
66 fHoneycombThickness(0.),
76 // id Type of ring (either 'I' or 'O')
85 SetPrintboardThickness();
89 SetHoneycombThickness();
92 if (fId == 'I' || fId == 'i') {
97 Double_t base = 0; // 4.1915;
98 fFeetPositions.Add(new TVector2( 0.0551687, 8.0534-base));
99 fFeetPositions.Add(new TVector2( 2.9993, 12.9457-base));
100 fFeetPositions.Add(new TVector2(-2.9062, 12.9508-base));
102 fHybridVerticies.Add(new TVector2(0.0000, 4.1700));
103 fHybridVerticies.Add(new TVector2(1.0574, 4.1700));
104 fHybridVerticies.Add(new TVector2(4.6614, 15.2622));
105 fHybridVerticies.Add(new TVector2(0.9643, 17.4000));
106 fHybridVerticies.Add(new TVector2(0.0000, 17.4000));
108 fSensorVerticies.Add(new TVector2(0.0000, 4.1915));
109 fSensorVerticies.Add(new TVector2(1.5793, 4.1915));
110 fSensorVerticies.Add(new TVector2(5.2293, 15.4251));
111 fSensorVerticies.Add(new TVector2(1.9807, 17.3035));
112 fSensorVerticies.Add(new TVector2(0.0000, 17.3035));
114 fVerticies.Add(new TVector2(0.0000, 4.3000));
115 fVerticies.Add(new TVector2(1.3972, 4.3000));
116 fVerticies.Add(new TVector2(4.9895, 15.3560));
117 fVerticies.Add(new TVector2(1.8007, 17.2000));
118 fVerticies.Add(new TVector2(0.0000, 17.2000));
120 else if (fId == 'O' || fId == 'o') {
125 Double_t base = 0; // 14.9104;
126 fFeetPositions.Add(new TVector2(-1.72540000, 20.6267-base));
127 fFeetPositions.Add(new TVector2( 1.72900000, 20.6267-base));
128 fFeetPositions.Add(new TVector2( 0.00177616, 26.6007-base));
130 fHybridVerticies.Add(new TVector2(0.0000, 14.9104));
131 fHybridVerticies.Add(new TVector2(2.0783, 14.9104));
132 fHybridVerticies.Add(new TVector2(3.9202, 26.5395));
133 fHybridVerticies.Add(new TVector2(0.6784, 28.2500));
134 fHybridVerticies.Add(new TVector2(0.0000, 28.2500));
136 fSensorVerticies.Add(new TVector2(0.0000, 15.0104));
137 fSensorVerticies.Add(new TVector2(2.5799, 15.0104));
138 fSensorVerticies.Add(new TVector2(4.4439, 26.7766));
139 fSensorVerticies.Add(new TVector2(1.8350, 28.1500));
140 fSensorVerticies.Add(new TVector2(0.0000, 28.1500));
142 fVerticies.Add(new TVector2(0.0000, 15.2104));
143 fVerticies.Add(new TVector2(2.4091, 15.2104));
144 fVerticies.Add(new TVector2(4.2231, 26.6638));
145 fVerticies.Add(new TVector2(1.8357, 27.9500));
146 fVerticies.Add(new TVector2(0.0000, 27.9500));
150 //____________________________________________________________________
156 // All derived quantities are calculated here.
159 Double_t tanTheta = TMath::Tan(fTheta * TMath::Pi() / 180.);
160 Double_t tanTheta2 = TMath::Power(tanTheta,2);
161 Double_t r2 = TMath::Power(fWaferRadius,2);
162 Double_t yA = tanTheta * fLowR;
163 Double_t lr2 = TMath::Power(fLowR, 2);
164 Double_t hr2 = TMath::Power(fHighR,2);
165 Double_t xD = fLowR + TMath::Sqrt(r2 - tanTheta2 * lr2);
166 Double_t xD2 = TMath::Power(xD,2);
167 Double_t yB = TMath::Sqrt(r2 - hr2 + 2 * fHighR * xD - xD2);
168 Double_t xC = ((xD + TMath::Sqrt(-tanTheta2 * xD2 + r2
171 Double_t yC = tanTheta * xC;
173 fVerticies.Expand(6);
174 fVerticies.AddAt(new TVector2(fLowR, -yA), 0);
175 fVerticies.AddAt(new TVector2(xC, -yC), 1);
176 fVerticies.AddAt(new TVector2(fHighR, -yB), 2);
177 fVerticies.AddAt(new TVector2(fHighR, yB), 3);
178 fVerticies.AddAt(new TVector2(xC, yC), 4);
179 fVerticies.AddAt(new TVector2(fLowR, yA), 5);
182 // A's length. Corresponds to distance from nominal beam line to the
183 // cornor of the active silicon element.
184 fMinR = GetVertex(1)->Mod(); // GetVertex(5)->Mod();
185 // A's length. Corresponds to distance from nominal beam line to the
186 // cornor of the active silicon element.
189 fRingDepth = (fSiThickness + fPrintboardThickness
190 + fCopperThickness + fChipThickness
191 + fLegLength + fModuleSpacing + fSpacing);
194 //____________________________________________________________________
196 AliFMDRing::GetVertex(Int_t i) const
198 // Get the i'th vertex of polygon shape
200 // the polygon shape describes the shape of the rings' sensors
203 // i The vertex number to get (from 0 to 5)
204 return static_cast<TVector2*>(fVerticies.At(i));
207 //____________________________________________________________________
209 AliFMDRing::GetSensorVertex(Int_t i) const
211 // Get the i'th vertex of polygon shape
213 // the polygon shape describes the shape of the rings' sensors
216 // i The vertex number to get (from 0 to 5)
217 return static_cast<TVector2*>(fSensorVerticies.At(i));
220 //____________________________________________________________________
222 AliFMDRing::GetHybridVertex(Int_t i) const
224 // Get the i'th vertex of polygon shape
226 // the polygon shape describes the shape of the rings' hybrid cards
229 // i The vertex number to get (from 0 to 5)
230 return static_cast<TVector2*>(fHybridVerticies.At(i));
233 //____________________________________________________________________
235 AliFMDRing::GetFootPosition(Int_t i) const
237 // Get the i'th vertex of polygon shape
239 // The feet are attached to the hybrid cards
242 // i The foot number to get (from 0 to 2)
243 return static_cast<TVector2*>(fFeetPositions.At(i));
246 //____________________________________________________________________
248 AliFMDRing::GetStripRadius(UShort_t strip) const
250 // Return the nominal strip radius
253 // strip Strip number (0-511 for inners, 0-255 for outers)
254 Double_t rmax = GetMaxR();
255 Double_t stripoff = GetMinR();
256 Double_t dstrip = (rmax - stripoff) / GetNStrips();
257 return (strip + .5) * dstrip + stripoff; // fLowR
260 //____________________________________________________________________
262 AliFMDRing::GetModuleDepth() const
264 // Get the total depth of a module (sensor + hybrid card)
266 // The depth is the sum of
268 // The silicon thickness
269 // The thickness of spacers between the silicon and hybrid
270 // The thickness of the hybrid PCB
271 // The thickness of the copper layer in the PCB
272 // The thickness of the chip layer in the PCB
273 // The height of the legs
274 return (GetSiThickness()
276 + GetPrintboardThickness()
277 + GetCopperThickness()
283 //____________________________________________________________________
285 AliFMDRing::GetFullDepth() const
287 // Get the full depth of this ring, including the honeycomb,
288 // digitizer and card.
289 return (GetModuleDepth()
291 + GetHoneycombThickness()
292 + GetFMDDPrintboardThickness()
293 + GetFMDDCopperThickness()
294 + GetFMDDChipThickness()
298 //____________________________________________________________________
300 AliFMDRing::Detector2XYZ(UShort_t sector,
306 // Translate detector coordinates (this,sector,strip) to global
307 // coordinates (x,y,z)
310 // sector Sector number in this ring
311 // strip Strip number in this ring
312 // x On return, the global X coordinate
313 // y On return, the global Y coordinate
314 // z On return, the z coordinate in the ring plane
316 // The ring plane is the plane half way between the two sensor
318 if (sector >= GetNSectors()) {
319 Error("Detector2XYZ", "Invalid sector number %d (>=%d) in ring %c",
320 sector, GetNSectors(), fId);
323 if (strip >= GetNStrips()) {
324 Error("Detector2XYZ", "Invalid strip number %d (>=%d) for ring type '%c'",
325 strip, GetNStrips(), fId);
328 Double_t phi = Float_t(sector + .5) / GetNSectors() * 2 * TMath::Pi();
329 Double_t r = Float_t(strip + .5) / GetNStrips() * (fHighR - fLowR) + fLowR;
330 x = r * TMath::Cos(phi);
331 y = r * TMath::Sin(phi);
332 if (((sector / 2) % 2) == 1)
333 z += TMath::Sign(fModuleSpacing, z);
336 //____________________________________________________________________
338 AliFMDRing::XYZ2Detector(Double_t x,
342 UShort_t& strip) const
344 // Translate global coordinates (x,y,z) to detector coordinates
345 // (this,sector,strip)
348 // x Global x coordinate
349 // y Global y coordinate
350 // z Global y coordinate
351 // sector On return, the sector number in this ring
352 // strip On return, the strip number in this ring
355 Double_t r = TMath::Sqrt(x * x + y * y);
356 Int_t str = Int_t((r - fMinR) / GetPitch());
357 if (str < 0 || str >= GetNStrips()) return kFALSE;
359 Double_t phi = TMath::ATan2(y, x) * 180. / TMath::Pi();
360 if (phi < 0) phi = 360. + phi;
361 Int_t sec = Int_t(phi / fTheta);
362 if (sec < 0 || sec >= GetNSectors()) return kFALSE;
363 if ((sec / 2) % 2 == 1) {
364 if (TMath::Abs(z - TMath::Sign(fModuleSpacing, z)) >= 0.01)
367 else if (TMath::Abs(z) >= 0.01) return kFALSE;
373 //____________________________________________________________________
375 AliFMDRing::GetStripLength(UShort_t strip) const
377 // Get the length of a strip
380 // strip Strip number (0-511 for inners, 0-255 for outers)
382 if(strip >= GetNStrips())
383 Error("GetStripLength", "Invalid strip number %d (>=%d) for ring type %c",
384 strip, GetNStrips(), fId);
386 Float_t rad = GetMaxR()-GetMinR();
388 Float_t segment = rad / GetNStrips();
390 TVector2* corner1 = GetVertex(2);
391 TVector2* corner2 = GetVertex(3);
393 Float_t slope = ((corner1->Y() - corner2->Y()) /
394 (corner1->X() - corner2->X()));
395 Float_t constant = ((corner2->Y() * corner1->X() -
396 (corner2->X()*corner1->Y())) /
397 (corner1->X() - corner2->X()));
398 Float_t radius = GetMinR() + strip*segment;
400 Float_t d = (TMath::Power(TMath::Abs(radius*slope),2) +
401 TMath::Power(radius,2) - TMath::Power(constant,2));
403 Float_t arclength = GetBaseStripLength(strip);
405 Float_t x = ((-1 * TMath::Sqrt(d) -slope*constant) /
406 (1 + TMath::Power(slope,2)));
407 Float_t y = slope*x + constant;
408 Float_t theta = TMath::ATan2(x,y);
410 if(x < corner1->X() && y > corner1->Y()) {
411 //One sector since theta is by definition half-hybrid
412 arclength = radius*theta;
420 //____________________________________________________________________
422 AliFMDRing::GetBaseStripLength(UShort_t strip) const
424 // Get the basic strip length
427 // strip Strip number
428 Float_t rad = GetMaxR()-GetMinR();
429 Float_t segment = rad / GetNStrips();
430 Float_t basearc = 2*TMath::Pi() / (0.5*GetNSectors());
431 Float_t radius = GetMinR() + strip*segment;
432 Float_t basearclength = 0.5*basearc * radius;
434 return basearclength;