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