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.),
81 SetPrintboardThickness();
85 SetHoneycombThickness();
88 if (fId == 'I' || fId == 'i') {
93 Double_t base = 0; // 4.1915;
94 fFeetPositions.Add(new TVector2( 0.0551687, 8.0534-base));
95 fFeetPositions.Add(new TVector2( 2.9993, 12.9457-base));
96 fFeetPositions.Add(new TVector2(-2.9062, 12.9508-base));
98 fHybridVerticies.Add(new TVector2(0.0000, 4.1700));
99 fHybridVerticies.Add(new TVector2(1.0574, 4.1700));
100 fHybridVerticies.Add(new TVector2(4.6614, 15.2622));
101 fHybridVerticies.Add(new TVector2(0.9643, 17.4000));
102 fHybridVerticies.Add(new TVector2(0.0000, 17.4000));
104 fSensorVerticies.Add(new TVector2(0.0000, 4.1915));
105 fSensorVerticies.Add(new TVector2(1.5793, 4.1915));
106 fSensorVerticies.Add(new TVector2(5.2293, 15.4251));
107 fSensorVerticies.Add(new TVector2(1.9807, 17.3035));
108 fSensorVerticies.Add(new TVector2(0.0000, 17.3035));
110 fVerticies.Add(new TVector2(0.0000, 4.3000));
111 fVerticies.Add(new TVector2(1.3972, 4.3000));
112 fVerticies.Add(new TVector2(4.9895, 15.3560));
113 fVerticies.Add(new TVector2(1.8007, 17.2000));
114 fVerticies.Add(new TVector2(0.0000, 17.2000));
116 else if (fId == 'O' || fId == 'o') {
121 Double_t base = 0; // 14.9104;
122 fFeetPositions.Add(new TVector2(-1.72540000, 20.6267-base));
123 fFeetPositions.Add(new TVector2( 1.72900000, 20.6267-base));
124 fFeetPositions.Add(new TVector2( 0.00177616, 26.6007-base));
126 fHybridVerticies.Add(new TVector2(0.0000, 14.9104));
127 fHybridVerticies.Add(new TVector2(2.0783, 14.9104));
128 fHybridVerticies.Add(new TVector2(3.9202, 26.5395));
129 fHybridVerticies.Add(new TVector2(0.6784, 28.2500));
130 fHybridVerticies.Add(new TVector2(0.0000, 28.2500));
132 fSensorVerticies.Add(new TVector2(0.0000, 15.0104));
133 fSensorVerticies.Add(new TVector2(2.5799, 15.0104));
134 fSensorVerticies.Add(new TVector2(4.4439, 26.7766));
135 fSensorVerticies.Add(new TVector2(1.8350, 28.1500));
136 fSensorVerticies.Add(new TVector2(0.0000, 28.1500));
138 fVerticies.Add(new TVector2(0.0000, 15.2104));
139 fVerticies.Add(new TVector2(2.4091, 15.2104));
140 fVerticies.Add(new TVector2(4.2231, 26.6638));
141 fVerticies.Add(new TVector2(1.8357, 27.9500));
142 fVerticies.Add(new TVector2(0.0000, 27.9500));
146 //____________________________________________________________________
152 Double_t tanTheta = TMath::Tan(fTheta * TMath::Pi() / 180.);
153 Double_t tanTheta2 = TMath::Power(tanTheta,2);
154 Double_t r2 = TMath::Power(fWaferRadius,2);
155 Double_t yA = tanTheta * fLowR;
156 Double_t lr2 = TMath::Power(fLowR, 2);
157 Double_t hr2 = TMath::Power(fHighR,2);
158 Double_t xD = fLowR + TMath::Sqrt(r2 - tanTheta2 * lr2);
159 Double_t xD2 = TMath::Power(xD,2);
160 Double_t yB = TMath::Sqrt(r2 - hr2 + 2 * fHighR * xD - xD2);
161 Double_t xC = ((xD + TMath::Sqrt(-tanTheta2 * xD2 + r2
164 Double_t yC = tanTheta * xC;
166 fVerticies.Expand(6);
167 fVerticies.AddAt(new TVector2(fLowR, -yA), 0);
168 fVerticies.AddAt(new TVector2(xC, -yC), 1);
169 fVerticies.AddAt(new TVector2(fHighR, -yB), 2);
170 fVerticies.AddAt(new TVector2(fHighR, yB), 3);
171 fVerticies.AddAt(new TVector2(xC, yC), 4);
172 fVerticies.AddAt(new TVector2(fLowR, yA), 5);
175 // A's length. Corresponds to distance from nominal beam line to the
176 // cornor of the active silicon element.
177 fMinR = GetVertex(1)->Mod(); // GetVertex(5)->Mod();
178 // A's length. Corresponds to distance from nominal beam line to the
179 // cornor of the active silicon element.
182 fRingDepth = (fSiThickness + fPrintboardThickness
183 + fCopperThickness + fChipThickness
184 + fLegLength + fModuleSpacing + fSpacing);
187 //____________________________________________________________________
189 AliFMDRing::GetVertex(Int_t i) const
191 // Get the i'th vertex of polygon shape
192 return static_cast<TVector2*>(fVerticies.At(i));
195 //____________________________________________________________________
197 AliFMDRing::GetSensorVertex(Int_t i) const
199 // Get the i'th vertex of polygon shape
200 return static_cast<TVector2*>(fSensorVerticies.At(i));
203 //____________________________________________________________________
205 AliFMDRing::GetHybridVertex(Int_t i) const
207 // Get the i'th vertex of polygon shape
208 return static_cast<TVector2*>(fHybridVerticies.At(i));
211 //____________________________________________________________________
213 AliFMDRing::GetFootPosition(Int_t i) const
215 // Get the i'th vertex of polygon shape
216 return static_cast<TVector2*>(fFeetPositions.At(i));
219 //____________________________________________________________________
221 AliFMDRing::GetStripRadius(UShort_t strip) const
223 // Return the nominal strip radius
224 Double_t rmax = GetMaxR();
225 Double_t stripoff = GetMinR();
226 Double_t dstrip = (rmax - stripoff) / GetNStrips();
227 return (strip + .5) * dstrip + stripoff; // fLowR
230 //____________________________________________________________________
232 AliFMDRing::GetModuleDepth() const
234 return (GetSiThickness()
236 + GetPrintboardThickness()
237 + GetCopperThickness()
243 //____________________________________________________________________
245 AliFMDRing::GetFullDepth() const
247 return (GetModuleDepth()
249 + GetHoneycombThickness()
250 + GetFMDDPrintboardThickness()
251 + GetFMDDCopperThickness()
252 + GetFMDDChipThickness()
256 //____________________________________________________________________
258 AliFMDRing::Detector2XYZ(UShort_t sector,
264 // Translate detector coordinates (this,sector,strip) to global
265 // coordinates (x,y,z)
266 if (sector >= GetNSectors()) {
267 Error("Detector2XYZ", "Invalid sector number %d (>=%d) in ring %c",
268 sector, GetNSectors(), fId);
271 if (strip >= GetNStrips()) {
272 Error("Detector2XYZ", "Invalid strip number %d (>=%d)",
273 strip, GetNStrips(), fId);
276 Double_t phi = Float_t(sector + .5) / GetNSectors() * 2 * TMath::Pi();
277 Double_t r = Float_t(strip + .5) / GetNStrips() * (fHighR - fLowR) + fLowR;
278 x = r * TMath::Cos(phi);
279 y = r * TMath::Sin(phi);
280 if (((sector / 2) % 2) == 1)
281 z += TMath::Sign(fModuleSpacing, z);
284 //____________________________________________________________________
286 AliFMDRing::XYZ2Detector(Double_t x,
290 UShort_t& strip) const
292 // Translate global coordinates (x,y,z) to detector coordinates
293 // (this,sector,strip)
295 Double_t r = TMath::Sqrt(x * x + y * y);
296 Int_t str = Int_t((r - fMinR) / GetPitch());
297 if (str < 0 || str >= GetNStrips()) return kFALSE;
299 Double_t phi = TMath::ATan2(y, x) * 180. / TMath::Pi();
300 if (phi < 0) phi = 360. + phi;
301 Int_t sec = Int_t(phi / fTheta);
302 if (sec < 0 || sec >= GetNSectors()) return kFALSE;
303 if ((sec / 2) % 2 == 1) {
304 if (TMath::Abs(z - TMath::Sign(fModuleSpacing, z)) >= 0.01)
307 else if (TMath::Abs(z) >= 0.01) return kFALSE;
313 //____________________________________________________________________
315 AliFMDRing::GetStripLength(UShort_t strip) const
317 if(strip >= GetNStrips())
318 Error("GetStripLength", "Invalid strip number %d (>=%d)",
319 strip, GetNStrips(), fId);
321 Float_t rad = GetMaxR()-GetMinR();
323 Float_t segment = rad / GetNStrips();
325 TVector2* corner1 = GetVertex(2);
326 TVector2* corner2 = GetVertex(3);
328 Float_t slope = (corner1->Y() - corner2->Y()) / (corner1->X() - corner2->X());
329 Float_t constant = (corner2->Y()*corner1->X()-(corner2->X()*corner1->Y())) / (corner1->X() - corner2->X());
330 Float_t radius = GetMinR() + strip*segment;
332 Float_t d = TMath::Power(TMath::Abs(radius*slope),2) + TMath::Power(radius,2) - TMath::Power(constant,2);
334 Float_t arclength = GetBaseStripLength(strip);
337 Float_t x = (-1*TMath::Sqrt(d) -slope*constant) / (1+TMath::Power(slope,2));
338 Float_t y = slope*x + constant;
339 Float_t theta = TMath::ATan2(x,y);
341 if(x < corner1->X() && y > corner1->Y()) {
342 arclength = radius*theta; //One sector since theta is by definition half-hybrid
352 //____________________________________________________________________
354 AliFMDRing::GetBaseStripLength(UShort_t strip) const
356 Float_t rad = GetMaxR()-GetMinR();
357 Float_t segment = rad / GetNStrips();
358 Float_t basearc = 2*TMath::Pi() / (0.5*GetNSectors()); // One hybrid: 36 degrees inner, 18 outer
359 Float_t radius = GetMinR() + strip*segment;
360 Float_t basearclength = 0.5*basearc * radius; // One sector
362 return basearclength;