]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDRing.cxx
Added the class AliFMDGeometryBuilder (and derived
[u/mrichter/AliRoot.git] / FMD / AliFMDRing.cxx
CommitLineData
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 **************************************************************************/
15
16/* $Id$ */
17
c4bcfd14 18//__________________________________________________________________
4347b38f 19//
20// Utility class to help implement collection of FMD modules into
1a1fdef7 21// rings. This is used by AliFMDDetector and AliFMDGeometry.
4347b38f 22//
1a1fdef7 23// The AliFMDGeometry object owns the AliFMDRing objects, and the
24// AliFMDDetector objects reference these. That is, the AliFMDRing
25// objects are share amoung the AliFMDDetector objects.
4347b38f 26//
27// Latest changes by Christian Holm Christensen
28//
5edc364e 29
56b1929b 30#include <AliLog.h> // ALILOG_H
e802be3e 31#include "AliFMDRing.h" // ALIFMDRING_H
56b1929b 32#include <TMath.h> // ROOT_TMath
56b1929b 33#include <TVector2.h> // ROOT_TVector2
4347b38f 34
1a1fdef7 35//====================================================================
e6a0eb08 36ClassImp(AliFMDRing)
1a1fdef7 37#if 0
38 ; // This is here to keep Emacs for indenting the next line
39#endif
4347b38f 40
41//____________________________________________________________________
1a1fdef7 42AliFMDRing::AliFMDRing(Char_t id)
43 : TNamed(Form("FMD%c", id), "Forward multiplicity ring"),
44 fId(id),
45 fVerticies(0)
4347b38f 46{
1a1fdef7 47 SetBondingWidth();
48 SetWaferRadius();
49 SetSiThickness();
50 SetLegRadius();
51 SetLegLength();
52 SetLegOffset();
53 SetModuleSpacing();
54 SetPrintboardThickness();
4ac75127 55 SetCopperThickness();
56 SetChipThickness();
4347b38f 57
1a1fdef7 58 if (fId == 'I' || fId == 'i') {
59 SetLowR(4.3);
60 SetHighR(17.2);
61 SetTheta(36/2);
62 SetNStrips(512);
63 }
64 else if (fId == 'O' || fId == 'o') {
65 SetLowR(15.6);
66 SetHighR(28.0);
67 SetTheta(18/2);
68 SetNStrips(256);
4347b38f 69 }
4347b38f 70}
71
4347b38f 72//____________________________________________________________________
73void
1a1fdef7 74AliFMDRing::Init()
4347b38f 75{
1a1fdef7 76 Double_t tanTheta = TMath::Tan(fTheta * TMath::Pi() / 180.);
77 Double_t tanTheta2 = TMath::Power(tanTheta,2);
78 Double_t r2 = TMath::Power(fWaferRadius,2);
79 Double_t yA = tanTheta * fLowR;
80 Double_t lr2 = TMath::Power(fLowR, 2);
81 Double_t hr2 = TMath::Power(fHighR,2);
82 Double_t xD = fLowR + TMath::Sqrt(r2 - tanTheta2 * lr2);
83 Double_t xD2 = TMath::Power(xD,2);
84 Double_t yB = TMath::Sqrt(r2 - hr2 + 2 * fHighR * xD - xD2);
85 Double_t xC = ((xD + TMath::Sqrt(-tanTheta2 * xD2 + r2
86 + r2 * tanTheta2))
87 / (1 + tanTheta2));
88 Double_t yC = tanTheta * xC;
4347b38f 89
1a1fdef7 90 fVerticies.Expand(6);
91 fVerticies.AddAt(new TVector2(fLowR, -yA), 0);
92 fVerticies.AddAt(new TVector2(xC, -yC), 1);
93 fVerticies.AddAt(new TVector2(fHighR, -yB), 2);
94 fVerticies.AddAt(new TVector2(fHighR, yB), 3);
95 fVerticies.AddAt(new TVector2(xC, yC), 4);
96 fVerticies.AddAt(new TVector2(fLowR, yA), 5);
97
54e415a8 98 // A's length. Corresponds to distance from nominal beam line to the
99 // cornor of the active silicon element.
100 fMinR = GetVertex(5)->Mod();
101 // A's length. Corresponds to distance from nominal beam line to the
102 // cornor of the active silicon element.
103 fMaxR = fHighR;
104
1a1fdef7 105 fRingDepth = (fSiThickness + fPrintboardThickness
4ac75127 106 + fCopperThickness + fChipThickness
107 + fLegLength + fModuleSpacing + fSpacing);
4347b38f 108}
109
110//____________________________________________________________________
1a1fdef7 111TVector2*
112AliFMDRing::GetVertex(Int_t i) const
4347b38f 113{
1a1fdef7 114 return static_cast<TVector2*>(fVerticies.At(i));
4347b38f 115}
116
117//____________________________________________________________________
1a1fdef7 118void
119AliFMDRing::Detector2XYZ(UShort_t sector,
120 UShort_t strip,
121 Double_t& x,
122 Double_t& y,
123 Double_t& z) const
4347b38f 124{
1a1fdef7 125 if (sector >= GetNSectors()) {
126 Error("Detector2XYZ", "Invalid sector number %d (>=%d) in ring %c",
127 sector, GetNSectors(), fId);
128 return;
4347b38f 129 }
1a1fdef7 130 if (strip >= GetNStrips()) {
131 Error("Detector2XYZ", "Invalid strip number %d (>=%d)",
132 strip, GetNStrips(), fId);
133 return;
4347b38f 134 }
1a1fdef7 135 Double_t phi = Float_t(sector + .5) / GetNSectors() * 2 * TMath::Pi();
136 Double_t r = Float_t(strip + .5) / GetNStrips() * (fHighR - fLowR) + fLowR;
137 x = r * TMath::Cos(phi);
138 y = r * TMath::Sin(phi);
139 if (((sector / 2) % 2) == 1)
140 z += TMath::Sign(fModuleSpacing, z);
4347b38f 141}
142
54e415a8 143//____________________________________________________________________
144Bool_t
145AliFMDRing::XYZ2Detector(Double_t x,
146 Double_t y,
147 Double_t z,
148 UShort_t& sector,
149 UShort_t& strip) const
150{
151 sector = strip = 0;
152 Double_t r = TMath::Sqrt(x * x + y * y);
153 Int_t str = Int_t((r - fMinR) / GetPitch());
154 if (str < 0 || str >= GetNStrips()) return kFALSE;
155
156 Double_t phi = TMath::ATan2(y, x) * 180. / TMath::Pi();
157 if (phi < 0) phi = 360. + phi;
158 Int_t sec = Int_t(phi / fTheta);
159 if (sec < 0 || sec >= GetNSectors()) return kFALSE;
160 if ((sec / 2) % 2 == 1) {
161 if (TMath::Abs(z - TMath::Sign(fModuleSpacing, z)) >= 0.01)
162 return kFALSE;
163 }
164 else if (TMath::Abs(z) >= 0.01) return kFALSE;
165
166 strip = str;
167 sector = sec;
168 return kTRUE;
169}
170
171
4347b38f 172//
173// EOF
174//