]>
Commit | Line | Data |
---|---|---|
4347b38f | 1 | /************************************************************************** |
c4bcfd14 | 2 | * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. * |
4347b38f | 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 | **************************************************************************/ | |
4347b38f | 15 | /* $Id$ */ |
c2fc1258 | 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 | */ | |
c4bcfd14 | 21 | //__________________________________________________________________ |
4347b38f | 22 | // |
23 | // Utility class to help implement collection of FMD modules into | |
6169f936 | 24 | // rings. This is used by AliFMDDetector and AliFMDGeometry. |
1a1fdef7 | 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. | |
4347b38f | 28 | // |
29 | // Latest changes by Christian Holm Christensen | |
30 | // | |
5edc364e | 31 | |
9edefa04 | 32 | #include <TMath.h> // ROOT_TMath |
33 | #include <TVector2.h> // ROOT_TVector2 | |
34 | ||
02a27b50 | 35 | // #include <AliLog.h> // ALILOG_H |
e802be3e | 36 | #include "AliFMDRing.h" // ALIFMDRING_H |
4347b38f | 37 | |
1a1fdef7 | 38 | //==================================================================== |
e6a0eb08 | 39 | ClassImp(AliFMDRing) |
1a1fdef7 | 40 | #if 0 |
41 | ; // This is here to keep Emacs for indenting the next line | |
42 | #endif | |
4347b38f | 43 | |
44 | //____________________________________________________________________ | |
1a1fdef7 | 45 | AliFMDRing::AliFMDRing(Char_t id) |
46 | : TNamed(Form("FMD%c", id), "Forward multiplicity ring"), | |
47 | fId(id), | |
b5ee4425 | 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), | |
1a1fdef7 | 66 | fVerticies(0) |
4347b38f | 67 | { |
088f8e79 | 68 | // CTOR |
1a1fdef7 | 69 | SetBondingWidth(); |
70 | SetWaferRadius(); | |
71 | SetSiThickness(); | |
72 | SetLegRadius(); | |
73 | SetLegLength(); | |
74 | SetLegOffset(); | |
75 | SetModuleSpacing(); | |
76 | SetPrintboardThickness(); | |
4ac75127 | 77 | SetCopperThickness(); |
78 | SetChipThickness(); | |
a1f80595 | 79 | SetSpacing(); |
4347b38f | 80 | |
1a1fdef7 | 81 | if (fId == 'I' || fId == 'i') { |
82 | SetLowR(4.3); | |
83 | SetHighR(17.2); | |
84 | SetTheta(36/2); | |
85 | SetNStrips(512); | |
86 | } | |
87 | else if (fId == 'O' || fId == 'o') { | |
88 | SetLowR(15.6); | |
89 | SetHighR(28.0); | |
90 | SetTheta(18/2); | |
91 | SetNStrips(256); | |
4347b38f | 92 | } |
4347b38f | 93 | } |
94 | ||
4347b38f | 95 | //____________________________________________________________________ |
96 | void | |
1a1fdef7 | 97 | AliFMDRing::Init() |
4347b38f | 98 | { |
088f8e79 | 99 | // Initialize |
1a1fdef7 | 100 | Double_t tanTheta = TMath::Tan(fTheta * TMath::Pi() / 180.); |
101 | Double_t tanTheta2 = TMath::Power(tanTheta,2); | |
102 | Double_t r2 = TMath::Power(fWaferRadius,2); | |
103 | Double_t yA = tanTheta * fLowR; | |
104 | Double_t lr2 = TMath::Power(fLowR, 2); | |
105 | Double_t hr2 = TMath::Power(fHighR,2); | |
106 | Double_t xD = fLowR + TMath::Sqrt(r2 - tanTheta2 * lr2); | |
107 | Double_t xD2 = TMath::Power(xD,2); | |
108 | Double_t yB = TMath::Sqrt(r2 - hr2 + 2 * fHighR * xD - xD2); | |
109 | Double_t xC = ((xD + TMath::Sqrt(-tanTheta2 * xD2 + r2 | |
110 | + r2 * tanTheta2)) | |
111 | / (1 + tanTheta2)); | |
112 | Double_t yC = tanTheta * xC; | |
4347b38f | 113 | |
1a1fdef7 | 114 | fVerticies.Expand(6); |
115 | fVerticies.AddAt(new TVector2(fLowR, -yA), 0); | |
116 | fVerticies.AddAt(new TVector2(xC, -yC), 1); | |
117 | fVerticies.AddAt(new TVector2(fHighR, -yB), 2); | |
118 | fVerticies.AddAt(new TVector2(fHighR, yB), 3); | |
119 | fVerticies.AddAt(new TVector2(xC, yC), 4); | |
120 | fVerticies.AddAt(new TVector2(fLowR, yA), 5); | |
121 | ||
54e415a8 | 122 | // A's length. Corresponds to distance from nominal beam line to the |
123 | // cornor of the active silicon element. | |
124 | fMinR = GetVertex(5)->Mod(); | |
125 | // A's length. Corresponds to distance from nominal beam line to the | |
126 | // cornor of the active silicon element. | |
127 | fMaxR = fHighR; | |
128 | ||
1a1fdef7 | 129 | fRingDepth = (fSiThickness + fPrintboardThickness |
4ac75127 | 130 | + fCopperThickness + fChipThickness |
131 | + fLegLength + fModuleSpacing + fSpacing); | |
4347b38f | 132 | } |
133 | ||
134 | //____________________________________________________________________ | |
1a1fdef7 | 135 | TVector2* |
136 | AliFMDRing::GetVertex(Int_t i) const | |
4347b38f | 137 | { |
088f8e79 | 138 | // Get the i'th vertex of polygon shape |
1a1fdef7 | 139 | return static_cast<TVector2*>(fVerticies.At(i)); |
4347b38f | 140 | } |
141 | ||
bf000c32 | 142 | //____________________________________________________________________ |
143 | Double_t | |
144 | AliFMDRing::GetStripRadius(UShort_t strip) const | |
145 | { | |
146 | // Return the nominal strip radius | |
147 | Double_t rmax = GetMaxR(); | |
148 | Double_t stripoff = GetMinR(); | |
149 | Double_t dstrip = (rmax - stripoff) / GetNStrips(); | |
150 | return (strip + .5) * dstrip + stripoff; // fLowR | |
151 | } | |
152 | ||
4347b38f | 153 | //____________________________________________________________________ |
1a1fdef7 | 154 | void |
155 | AliFMDRing::Detector2XYZ(UShort_t sector, | |
156 | UShort_t strip, | |
157 | Double_t& x, | |
158 | Double_t& y, | |
159 | Double_t& z) const | |
4347b38f | 160 | { |
088f8e79 | 161 | // Translate detector coordinates (this,sector,strip) to global |
162 | // coordinates (x,y,z) | |
1a1fdef7 | 163 | if (sector >= GetNSectors()) { |
164 | Error("Detector2XYZ", "Invalid sector number %d (>=%d) in ring %c", | |
165 | sector, GetNSectors(), fId); | |
166 | return; | |
4347b38f | 167 | } |
1a1fdef7 | 168 | if (strip >= GetNStrips()) { |
169 | Error("Detector2XYZ", "Invalid strip number %d (>=%d)", | |
170 | strip, GetNStrips(), fId); | |
171 | return; | |
4347b38f | 172 | } |
1a1fdef7 | 173 | Double_t phi = Float_t(sector + .5) / GetNSectors() * 2 * TMath::Pi(); |
174 | Double_t r = Float_t(strip + .5) / GetNStrips() * (fHighR - fLowR) + fLowR; | |
175 | x = r * TMath::Cos(phi); | |
176 | y = r * TMath::Sin(phi); | |
177 | if (((sector / 2) % 2) == 1) | |
178 | z += TMath::Sign(fModuleSpacing, z); | |
4347b38f | 179 | } |
180 | ||
54e415a8 | 181 | //____________________________________________________________________ |
182 | Bool_t | |
183 | AliFMDRing::XYZ2Detector(Double_t x, | |
184 | Double_t y, | |
185 | Double_t z, | |
186 | UShort_t& sector, | |
187 | UShort_t& strip) const | |
188 | { | |
088f8e79 | 189 | // Translate global coordinates (x,y,z) to detector coordinates |
190 | // (this,sector,strip) | |
54e415a8 | 191 | sector = strip = 0; |
192 | Double_t r = TMath::Sqrt(x * x + y * y); | |
193 | Int_t str = Int_t((r - fMinR) / GetPitch()); | |
194 | if (str < 0 || str >= GetNStrips()) return kFALSE; | |
195 | ||
196 | Double_t phi = TMath::ATan2(y, x) * 180. / TMath::Pi(); | |
197 | if (phi < 0) phi = 360. + phi; | |
198 | Int_t sec = Int_t(phi / fTheta); | |
199 | if (sec < 0 || sec >= GetNSectors()) return kFALSE; | |
200 | if ((sec / 2) % 2 == 1) { | |
201 | if (TMath::Abs(z - TMath::Sign(fModuleSpacing, z)) >= 0.01) | |
202 | return kFALSE; | |
203 | } | |
204 | else if (TMath::Abs(z) >= 0.01) return kFALSE; | |
205 | ||
206 | strip = str; | |
207 | sector = sec; | |
208 | return kTRUE; | |
209 | } | |
210 | ||
211 | ||
4347b38f | 212 | // |
213 | // EOF | |
214 | // |