]>
Commit | Line | Data |
---|---|---|
1a1fdef7 | 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 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //____________________________________________________________________ | |
19 | // | |
20 | // Utility class to help implement the FMD geometry. This provides | |
21 | // the interface for the concrete geometry implementations of the FMD | |
22 | // sub-detectors. | |
23 | // | |
24 | // The AliFMDGeometry object owns the AliFMDDetector objects | |
25 | // | |
26 | // Latest changes by Christian Holm Christensen | |
27 | // | |
28 | #include "AliFMDDetector.h" // ALIFMDSUBDETECTOR_H | |
29 | #include "AliFMDRing.h" // ALIFMDRING_H | |
30 | #include <AliLog.h> // ALILOG_H | |
31 | ||
32 | //==================================================================== | |
33 | ClassImp(AliFMDDetector) | |
34 | #if 0 | |
35 | ; // This is here to keep Emacs for indenting the next line | |
36 | #endif | |
37 | ||
38 | //____________________________________________________________________ | |
39 | AliFMDDetector::AliFMDDetector(Int_t id, AliFMDRing* inner, AliFMDRing* outer) | |
40 | : TNamed(Form("FMD%d", id), "Forward multiplicity ring"), | |
41 | fId(id), | |
42 | fInner(inner), | |
43 | fOuter(outer) | |
44 | { | |
45 | SetHoneycombThickness(); | |
46 | SetAlThickness(); | |
47 | SetInnerHoneyLowR(0); | |
48 | SetInnerHoneyHighR(0); | |
49 | SetInnerZ(0); | |
50 | SetOuterZ(0); | |
51 | SetOuterHoneyLowR(0); | |
52 | SetOuterHoneyHighR(0); | |
53 | } | |
54 | ||
55 | //____________________________________________________________________ | |
56 | void | |
57 | AliFMDDetector::Init() | |
58 | { | |
59 | if (fInner) { | |
60 | SetInnerHoneyLowR(fInner->GetLowR() + 1.); | |
61 | SetInnerHoneyHighR(fInner->GetHighR() + 1.); | |
62 | } | |
63 | if (fOuter) { | |
64 | SetOuterHoneyLowR(fOuter->GetLowR() + 1.); | |
65 | SetOuterHoneyHighR(fOuter->GetHighR() + 1.); | |
66 | } | |
67 | ||
68 | } | |
69 | ||
70 | //____________________________________________________________________ | |
71 | AliFMDRing* | |
72 | AliFMDDetector::GetRing(Char_t id) const | |
73 | { | |
74 | switch (id) { | |
75 | case 'i': | |
76 | case 'I': return GetInner(); | |
77 | case 'o': | |
78 | case 'O': return GetOuter(); | |
79 | } | |
80 | return 0; | |
81 | } | |
82 | ||
83 | //____________________________________________________________________ | |
84 | Double_t | |
85 | AliFMDDetector::GetRingZ(Char_t id) const | |
86 | { | |
87 | switch (id) { | |
88 | case 'i': | |
89 | case 'I': return GetInnerZ(); | |
90 | case 'o': | |
91 | case 'O': return GetOuterZ(); | |
92 | } | |
93 | return 0; | |
94 | } | |
95 | //____________________________________________________________________ | |
96 | void | |
97 | AliFMDDetector::Detector2XYZ(Char_t ring, | |
98 | UShort_t sector, | |
99 | UShort_t strip, | |
100 | Double_t& x, | |
101 | Double_t& y, | |
102 | Double_t& z) const | |
103 | { | |
104 | AliFMDRing* r = GetRing(ring); | |
105 | if (!r) return; | |
106 | z = GetRingZ(ring); | |
107 | r->Detector2XYZ(sector, strip, x, y, z); | |
108 | } | |
109 | ||
54e415a8 | 110 | //____________________________________________________________________ |
111 | Bool_t | |
112 | AliFMDDetector::XYZ2Detector(Double_t x, | |
113 | Double_t y, | |
114 | Double_t z, | |
115 | Char_t& ring, | |
116 | UShort_t& sector, | |
117 | UShort_t& strip) const | |
118 | { | |
119 | AliFMDRing* rng = 0; | |
120 | ring = -1; | |
121 | for (int j = 0; j < 2; j++) { | |
122 | rng = GetRing(j == 0 ? 'I' : 'O'); | |
123 | if (!rng) continue; | |
124 | Double_t ringZ = GetRingZ(j == 0 ? 'I' : 'O'); | |
125 | Double_t modSpace = TMath::Sign(rng->GetModuleSpacing(), ringZ); | |
126 | if (TMath::Abs(z - ringZ) < 0.01 || | |
127 | TMath::Abs(z - ringZ + modSpace) < 0.01) break; | |
128 | rng = 0; | |
129 | } | |
130 | if (rng && rng->XYZ2Detector(x, y, z - GetRingZ(rng->GetId()), | |
131 | sector, strip)) { | |
132 | ring = rng->GetId(); | |
133 | return kTRUE; | |
134 | } | |
135 | return kFALSE; | |
136 | } | |
137 | ||
138 | ||
139 | ||
1a1fdef7 | 140 | //____________________________________________________________________ |
141 | // | |
142 | // EOF | |
143 | // |