]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - FMD/AliFMDRing.cxx
for current DA
[u/mrichter/AliRoot.git] / FMD / AliFMDRing.cxx
... / ...
CommitLineData
1/**************************************************************************
2 * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15/* $Id$ */
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
20*/
21//__________________________________________________________________
22//
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.
28//
29// Latest changes by Christian Holm Christensen
30//
31
32#include <TMath.h> // ROOT_TMath
33#include <TVector2.h> // ROOT_TVector2
34
35// #include <AliLog.h> // ALILOG_H
36#include "AliFMDRing.h" // ALIFMDRING_H
37
38//====================================================================
39ClassImp(AliFMDRing)
40#if 0
41 ; // This is here to keep Emacs for indenting the next line
42#endif
43
44//____________________________________________________________________
45AliFMDRing::AliFMDRing(Char_t id)
46 : TNamed(Form("FMD%c", id), "Forward multiplicity ring"),
47 fId(id),
48 fBondingWidth(0),
49 fWaferRadius(0),
50 fSiThickness(0),
51 fLowR(0),
52 fHighR(0),
53 fMinR(0),
54 fMaxR(0),
55 fTheta(0),
56 fNStrips(0),
57 fRingDepth(0),
58 fLegRadius(0),
59 fLegLength(0),
60 fLegOffset(0),
61 fModuleSpacing(0),
62 fPrintboardThickness(0),
63 fCopperThickness(0),
64 fChipThickness(0),
65 fSpacing(0),
66 fHoneycombThickness(0.),
67 fAlThickness(0.),
68 fVerticies(0)
69{
70 // CTOR
71 SetBondingWidth();
72 SetWaferRadius();
73 SetSiThickness();
74 SetLegRadius();
75 SetLegLength();
76 SetLegOffset();
77 SetModuleSpacing();
78 SetPrintboardThickness();
79 SetCopperThickness();
80 SetChipThickness();
81 SetSpacing();
82 SetHoneycombThickness();
83 SetAlThickness();
84
85 if (fId == 'I' || fId == 'i') {
86 SetLowR(4.3);
87 SetHighR(17.2);
88 SetTheta(36/2);
89 SetNStrips(512);
90 }
91 else if (fId == 'O' || fId == 'o') {
92 SetLowR(15.6);
93 SetHighR(28.0);
94 SetTheta(18/2);
95 SetNStrips(256);
96 }
97}
98
99//____________________________________________________________________
100void
101AliFMDRing::Init()
102{
103 // Initialize
104 Double_t tanTheta = TMath::Tan(fTheta * TMath::Pi() / 180.);
105 Double_t tanTheta2 = TMath::Power(tanTheta,2);
106 Double_t r2 = TMath::Power(fWaferRadius,2);
107 Double_t yA = tanTheta * fLowR;
108 Double_t lr2 = TMath::Power(fLowR, 2);
109 Double_t hr2 = TMath::Power(fHighR,2);
110 Double_t xD = fLowR + TMath::Sqrt(r2 - tanTheta2 * lr2);
111 Double_t xD2 = TMath::Power(xD,2);
112 Double_t yB = TMath::Sqrt(r2 - hr2 + 2 * fHighR * xD - xD2);
113 Double_t xC = ((xD + TMath::Sqrt(-tanTheta2 * xD2 + r2
114 + r2 * tanTheta2))
115 / (1 + tanTheta2));
116 Double_t yC = tanTheta * xC;
117
118 fVerticies.Expand(6);
119 fVerticies.AddAt(new TVector2(fLowR, -yA), 0);
120 fVerticies.AddAt(new TVector2(xC, -yC), 1);
121 fVerticies.AddAt(new TVector2(fHighR, -yB), 2);
122 fVerticies.AddAt(new TVector2(fHighR, yB), 3);
123 fVerticies.AddAt(new TVector2(xC, yC), 4);
124 fVerticies.AddAt(new TVector2(fLowR, yA), 5);
125
126 // A's length. Corresponds to distance from nominal beam line to the
127 // cornor of the active silicon element.
128 fMinR = GetVertex(5)->Mod();
129 // A's length. Corresponds to distance from nominal beam line to the
130 // cornor of the active silicon element.
131 fMaxR = fHighR;
132
133 fRingDepth = (fSiThickness + fPrintboardThickness
134 + fCopperThickness + fChipThickness
135 + fLegLength + fModuleSpacing + fSpacing);
136}
137
138//____________________________________________________________________
139TVector2*
140AliFMDRing::GetVertex(Int_t i) const
141{
142 // Get the i'th vertex of polygon shape
143 return static_cast<TVector2*>(fVerticies.At(i));
144}
145
146//____________________________________________________________________
147Double_t
148AliFMDRing::GetStripRadius(UShort_t strip) const
149{
150 // Return the nominal strip radius
151 Double_t rmax = GetMaxR();
152 Double_t stripoff = GetMinR();
153 Double_t dstrip = (rmax - stripoff) / GetNStrips();
154 return (strip + .5) * dstrip + stripoff; // fLowR
155}
156
157//____________________________________________________________________
158Double_t
159AliFMDRing::GetFullDepth() const
160{
161 return (GetSiThickness() +
162 GetSpacing() +
163 GetPrintboardThickness() +
164 GetCopperThickness() +
165 GetChipThickness() +
166 GetModuleSpacing() +
167 GetLegLength() +
168 GetHoneycombThickness() +
169 GetFMDDPrintboardThickness() +
170 GetFMDDCopperThickness() +
171 GetFMDDChipThickness()
172 + 0.5);
173}
174
175//____________________________________________________________________
176void
177AliFMDRing::Detector2XYZ(UShort_t sector,
178 UShort_t strip,
179 Double_t& x,
180 Double_t& y,
181 Double_t& z) const
182{
183 // Translate detector coordinates (this,sector,strip) to global
184 // coordinates (x,y,z)
185 if (sector >= GetNSectors()) {
186 Error("Detector2XYZ", "Invalid sector number %d (>=%d) in ring %c",
187 sector, GetNSectors(), fId);
188 return;
189 }
190 if (strip >= GetNStrips()) {
191 Error("Detector2XYZ", "Invalid strip number %d (>=%d)",
192 strip, GetNStrips(), fId);
193 return;
194 }
195 Double_t phi = Float_t(sector + .5) / GetNSectors() * 2 * TMath::Pi();
196 Double_t r = Float_t(strip + .5) / GetNStrips() * (fHighR - fLowR) + fLowR;
197 x = r * TMath::Cos(phi);
198 y = r * TMath::Sin(phi);
199 if (((sector / 2) % 2) == 1)
200 z += TMath::Sign(fModuleSpacing, z);
201}
202
203//____________________________________________________________________
204Bool_t
205AliFMDRing::XYZ2Detector(Double_t x,
206 Double_t y,
207 Double_t z,
208 UShort_t& sector,
209 UShort_t& strip) const
210{
211 // Translate global coordinates (x,y,z) to detector coordinates
212 // (this,sector,strip)
213 sector = strip = 0;
214 Double_t r = TMath::Sqrt(x * x + y * y);
215 Int_t str = Int_t((r - fMinR) / GetPitch());
216 if (str < 0 || str >= GetNStrips()) return kFALSE;
217
218 Double_t phi = TMath::ATan2(y, x) * 180. / TMath::Pi();
219 if (phi < 0) phi = 360. + phi;
220 Int_t sec = Int_t(phi / fTheta);
221 if (sec < 0 || sec >= GetNSectors()) return kFALSE;
222 if ((sec / 2) % 2 == 1) {
223 if (TMath::Abs(z - TMath::Sign(fModuleSpacing, z)) >= 0.01)
224 return kFALSE;
225 }
226 else if (TMath::Abs(z) >= 0.01) return kFALSE;
227
228 strip = str;
229 sector = sec;
230 return kTRUE;
231}
232
233
234//
235// EOF
236//