]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDSubDetector.cxx
Use static vars for volume names
[u/mrichter/AliRoot.git] / FMD / AliFMDSubDetector.cxx
CommitLineData
4347b38f 1/**************************************************************************
0d0e6995 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
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 AliFMD object owns the AliFMDSubDetector objects
25//
26// Latest changes by Christian Holm Christensen
27//
28//////////////////////////////////////////////////////////////////////////////
29
e802be3e 30#include "AliFMDSubDetector.h" // ALIFMDSUBDETECTOR_H
31#include "AliFMDRing.h" // ALIFMDRING_H
56b1929b 32#include <AliLog.h> // ALILOG_H
33#include <TVirtualMC.h> // ROOT_TVirtualMC
34#include <TList.h> // ROOT_TList
35#include <TString.h> // ROOT_TString
4347b38f 36
37ClassImp(AliFMDSubDetector);
38
39//____________________________________________________________________
40AliFMDSubDetector::AliFMDSubDetector(Int_t n)
41 : fId(n),
42 fInnerZ(0),
43 fOuterZ(0),
44 fInner(0),
45 fOuter(0)
46{}
47
48//____________________________________________________________________
49void
50AliFMDSubDetector::Draw(Option_t* /* opt */) const
51{
52 // DebugGuard guard("AliFMDSubDetector::Draw");
53 AliDebug(10, "AliFMDSubDetector::Draw");
54}
55
56//____________________________________________________________________
57Bool_t
58AliFMDSubDetector::CheckHit(Char_t ring, Int_t module, Double_t x, Double_t y)
59{
60 // Check if a hit (x,y) in module module of ring ring is within the
61 // actual shape.
62 Bool_t ret = kFALSE;
63 switch (ring) {
64 case 'i':
65 case 'I':
66 if (!fInner) break;
67 ret = fInner->IsWithin(module, x, y);
68 break;
69 case 'o':
70 case 'O':
71 if (!fOuter) break;
72 ret = fOuter->IsWithin(module, x, y);
73 break;
74 }
75 return ret;
76}
77
78//____________________________________________________________________
79void
80AliFMDSubDetector::SimpleGeometry(TList* nodes,
81 TNode* mother,
82 Int_t colour,
83 Double_t zMother)
84{
85 // Make a simplified geometry for event display
86 //
87 // Parameters
88 //
89 // nodes List of nodes to register all create nodes in
90 // mother Mother node to put the ring in.
91 // colour Colour of the nodes
92 // zMother Z position of the node in the mother volume
93 //
94 for (int i = 0; i < 2; i++) {
95 AliFMDRing* r = 0;
96 Double_t z = 0;
97 switch (i) {
98 case 0:
99 r = fInner;
100 z = fInnerZ;
101 break;
102 case 1:
103 r = fOuter;
104 z = fOuterZ;
105 break;
106 }
107 if (!r) continue;
108
109 // Make the coordinates relative to the mother volume. If we're
110 // on the positive side, then we need to flip the z-coordinate, as
111 // we'll rotate the whole sub-detector afterwards.
112 z -= zMother;
113 if (zMother > 0) z *= -1;
114
115 r->SimpleGeometry(nodes, mother, colour, z, fId);
116 }
117}
118
119
120//____________________________________________________________________
121void
122AliFMDSubDetector::SetupGeometry(Int_t airId, Int_t kaptionId)
123{
124 // Set up the geometry of this particular detector.
125 //
126 // In this class, it defines the support honey comp calls and
127 // nothing else.
128 //
129 // Parameters
130 // airId Medium of inactive virtual volumes
131 // kaptionId Medium of honeycomb
132 //
133 // DebugGuard guard("AliFMDSubDetector::SetupGeometry");
134 AliDebug(10, "AliFMDSubDetector::SetupGeometry");
135 TString name;
136 Double_t par[5];
137
138 for (int i = 0; i < 2; i++) {
139 AliFMDRing* r = 0;
140 char c = '\0';
141 switch (i) {
142 case 0:
143 r = fInner;
144 c = 'I';
145 par[0] = fInnerHoneyLowR;
146 par[1] = fInnerHoneyHighR;
147 break;
148 case 1:
149 r = fOuter;
150 c = 'O';
151 par[0] = fOuterHoneyLowR;
152 par[1] = fOuterHoneyHighR;
153 break;
154 }
155 if (!r) continue;
156 // Top of honeycomb, inner ring
157 par[2] = fHoneycombThickness / 2;
158 par[3] = 0;
159 par[4] = 180;
160 name = Form("HT%c%d", c, fId);
161 gMC->Gsvolu(name.Data(), "TUBS", kaptionId, par, 5);
162
163 // Bottom of honeycomb, inner ring
164 par[3] = 180;
165 par[4] = 360;
166 name = Form("HB%c%d", c, fId);
167 gMC->Gsvolu(name.Data(), "TUBS", kaptionId, par, 5);
168
169 // Air in top of honeycomb, inner ring
170 par[0] += fKaptionThickness;
171 par[1] -= fKaptionThickness;
172 par[2] -= fKaptionThickness;
173 par[3] = 0;
174 par[4] = 180;
175 name = Form("GT%c%d", c, fId);
176 gMC->Gsvolu(name.Data(), "TUBS", airId, par, 5);
177
178 // Air in bottom of honeycomb, inner ring
179 par[3] = 180;
180 par[4] = 360;
181 name = Form("GB%c%d", c, fId);
182 gMC->Gsvolu(name.Data(), "TUBS", airId, par, 5);
183 }
184}
185
186//____________________________________________________________________
187void
188AliFMDSubDetector::Geometry(const char* mother, Int_t pbRotId, Int_t idRotId,
189 Double_t zMother)
190{
191 // Place the volume inside mother volume.
192 //
193 // Parameters
194 //
195 // mother Volume to position this detector in
196 // pbRotId Print board rotation matrix,
197 // idRotId Identity rotation matrix
198 // zMother The Z passed in, is the position of the middle
199 // point of the mother volume.
200 //
201 // In this base class, it asks the contained rings to position
202 // themselves in the mother volume, and positions the honey comb
203 // support in the mother volume
204 //
205 // DebugGuard guard("AliFMDSubDetector::Geometry");
206 AliDebug(10, "AliFMDSubDetector::Geometry");
207
208 Double_t ringW;
209 Double_t z = 0;
210 // Double_t* b = 0;
211 TString name;
212 TString name2;
213
214 for (int i = 0; i < 2; i++) {
215 AliFMDRing* r = 0;
216 char c = '\0';
217 switch (i) {
218 case 0:
219 r = fInner;
220 c = 'I';
221 z = fInnerZ;
222 break;
223 case 1:
224 r = fOuter;
225 c = 'O';
226 z = fOuterZ;
227 break;
228 }
229 if (!r) continue;
230
231 // Make the coordinates relative to the mother volume. If we're
232 // on the positive side, then we need to flip the z-coordinate, as
233 // we'll rotate the whole sub-detector afterwards.
234 z -= zMother;
235 if (zMother > 0) z *= -1;
236
237 r->Geometry(mother, fId, z, pbRotId, idRotId);
238 ringW = r->GetRingDepth();
239 z -= ringW + fHoneycombThickness / 2;
240
241 // Top of honeycomb
242 name = Form("HT%c%d", c, fId);
243 gMC->Gspos(name.Data(), 1, mother, 0, 0, z, idRotId);
244
245 // Air in top of honeycomb
246 name2 = name;
247 name = Form("GT%c%d", c, fId);
248 gMC->Gspos(name.Data(), 1, name2.Data(),0,fKaptionThickness,0,idRotId);
249
250 // Bottom of honeycomb
251 name = Form("HB%c%d", c, fId);
252 gMC->Gspos(name.Data(), 1, mother, 0, 0, z, idRotId);
253
254 // Air in bottom of honeycomb
255 name2 = name;
256 name = Form("GB%c%d", c, fId);
257 gMC->Gspos(name.Data(),1,name2.Data(),0,-fKaptionThickness,0,idRotId);
258 }
259}
260
261//____________________________________________________________________
262void
263AliFMDSubDetector::Gsatt()
264{
265 // Set drawing attributes for the detector
266 //
267 // DebugGuard guard("AliFMDSubDetector::Gsatt");
268 AliDebug(10, "AliFMDSubDetector::Gsatt");
269 TString name(Form("FMD%d", fId));
270 gMC->Gsatt(name.Data(), "SEEN", 0);
271}
272
273
274//____________________________________________________________________
275//
276// EOF
277//