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 **************************************************************************/
18 //__________________________________________________________________
20 // Utility class to help implement collection of FMD modules into
21 // rings. This is used by AliFMDDetector and AliFMDGeometry.
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.
27 // Latest changes by Christian Holm Christensen
30 #include <AliLog.h> // ALILOG_H
31 #include "AliFMDRing.h" // ALIFMDRING_H
32 #include <TMath.h> // ROOT_TMath
33 #include <TVector2.h> // ROOT_TVector2
35 //====================================================================
38 ; // This is here to keep Emacs for indenting the next line
41 //____________________________________________________________________
42 AliFMDRing::AliFMDRing(Char_t id)
43 : TNamed(Form("FMD%c", id), "Forward multiplicity ring"),
54 SetPrintboardThickness();
59 if (fId == 'I' || fId == 'i') {
65 else if (fId == 'O' || fId == 'o') {
73 //____________________________________________________________________
77 Double_t tanTheta = TMath::Tan(fTheta * TMath::Pi() / 180.);
78 Double_t tanTheta2 = TMath::Power(tanTheta,2);
79 Double_t r2 = TMath::Power(fWaferRadius,2);
80 Double_t yA = tanTheta * fLowR;
81 Double_t lr2 = TMath::Power(fLowR, 2);
82 Double_t hr2 = TMath::Power(fHighR,2);
83 Double_t xD = fLowR + TMath::Sqrt(r2 - tanTheta2 * lr2);
84 Double_t xD2 = TMath::Power(xD,2);
85 Double_t yB = TMath::Sqrt(r2 - hr2 + 2 * fHighR * xD - xD2);
86 Double_t xC = ((xD + TMath::Sqrt(-tanTheta2 * xD2 + r2
89 Double_t yC = tanTheta * xC;
92 fVerticies.AddAt(new TVector2(fLowR, -yA), 0);
93 fVerticies.AddAt(new TVector2(xC, -yC), 1);
94 fVerticies.AddAt(new TVector2(fHighR, -yB), 2);
95 fVerticies.AddAt(new TVector2(fHighR, yB), 3);
96 fVerticies.AddAt(new TVector2(xC, yC), 4);
97 fVerticies.AddAt(new TVector2(fLowR, yA), 5);
99 // A's length. Corresponds to distance from nominal beam line to the
100 // cornor of the active silicon element.
101 fMinR = GetVertex(5)->Mod();
102 // A's length. Corresponds to distance from nominal beam line to the
103 // cornor of the active silicon element.
106 fRingDepth = (fSiThickness + fPrintboardThickness
107 + fCopperThickness + fChipThickness
108 + fLegLength + fModuleSpacing + fSpacing);
111 //____________________________________________________________________
113 AliFMDRing::GetVertex(Int_t i) const
115 return static_cast<TVector2*>(fVerticies.At(i));
118 //____________________________________________________________________
120 AliFMDRing::Detector2XYZ(UShort_t sector,
126 if (sector >= GetNSectors()) {
127 Error("Detector2XYZ", "Invalid sector number %d (>=%d) in ring %c",
128 sector, GetNSectors(), fId);
131 if (strip >= GetNStrips()) {
132 Error("Detector2XYZ", "Invalid strip number %d (>=%d)",
133 strip, GetNStrips(), fId);
136 Double_t phi = Float_t(sector + .5) / GetNSectors() * 2 * TMath::Pi();
137 Double_t r = Float_t(strip + .5) / GetNStrips() * (fHighR - fLowR) + fLowR;
138 x = r * TMath::Cos(phi);
139 y = r * TMath::Sin(phi);
140 if (((sector / 2) % 2) == 1)
141 z += TMath::Sign(fModuleSpacing, z);
144 //____________________________________________________________________
146 AliFMDRing::XYZ2Detector(Double_t x,
150 UShort_t& strip) const
153 Double_t r = TMath::Sqrt(x * x + y * y);
154 Int_t str = Int_t((r - fMinR) / GetPitch());
155 if (str < 0 || str >= GetNStrips()) return kFALSE;
157 Double_t phi = TMath::ATan2(y, x) * 180. / TMath::Pi();
158 if (phi < 0) phi = 360. + phi;
159 Int_t sec = Int_t(phi / fTheta);
160 if (sec < 0 || sec >= GetNSectors()) return kFALSE;
161 if ((sec / 2) % 2 == 1) {
162 if (TMath::Abs(z - TMath::Sign(fModuleSpacing, z)) >= 0.01)
165 else if (TMath::Abs(z) >= 0.01) return kFALSE;