]>
Commit | Line | Data |
---|---|---|
54e415a8 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, 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 | **************************************************************************/ | |
54e415a8 | 15 | /* $Id$ */ |
c2fc1258 | 16 | /** @file AliFMDGeometryBuilder.cxx |
17 | @author Christian Holm Christensen <cholm@nbi.dk> | |
18 | @date Mon Mar 27 12:41:17 2006 | |
19 | @brief Class to build the FMD geometry | |
20 | */ | |
54e415a8 | 21 | //____________________________________________________________________ |
22 | // | |
02a27b50 | 23 | // Builder of FMD geometry. |
6169f936 | 24 | // |
02a27b50 | 25 | // This class takes care of actually building the geometry using the |
26 | // TGeo classes. Various parameters are fecthed from the | |
27 | // AliFMDGeometry manager. | |
54e415a8 | 28 | // Forward Multiplicity Detector based on Silicon wafers. This class |
29 | // contains the base procedures for the Forward Multiplicity detector | |
30 | // Detector consists of 3 sub-detectors FMD1, FMD2, and FMD3, each of | |
31 | // which has 1 or 2 rings of silicon sensors. | |
32 | // | |
54e415a8 | 33 | // |
9edefa04 | 34 | |
35 | #include <TArrayD.h> // ROOT_TArrayD | |
36 | #include <TGeoManager.h> // ROOT_TGeoManager | |
268f57b1 | 37 | #include <TGeoMatrix.h> // ROOT_TGeoMatrix |
9edefa04 | 38 | #include <TGeoTube.h> // ROOT_TGeoTube |
d98fbfa5 | 39 | #include <TGeoTrd1.h> // ROOT_TGeoTrd1 |
40 | #include <TGeoCone.h> // ROOT_TGeoTrd1 | |
9edefa04 | 41 | #include <TGeoVolume.h> // ROOT_TGeoVolume |
42 | #include <TGeoXtru.h> // ROOT_TGeoXtru | |
d98fbfa5 | 43 | #include <TGeoCompositeShape.h> |
9edefa04 | 44 | #include <TMath.h> |
45 | #include <TVector2.h> // ROOT_TVector2 | |
46 | //#include <TGeoMaterial.h> // ROOT_TGeoMaterial | |
47 | //#include <TGeoMedium.h> // ROOT_TGeoMedium | |
48 | //#include <TGeoPcon.h> // ROOT_TGeoPcon | |
49 | //#include <TGeoPolygon.h> // ROOT_TGeoPolygon | |
50 | ||
54e415a8 | 51 | #include "AliFMDGeometryBuilder.h" // ALIFMDGEOSIMULATOR_H |
52 | #include "AliFMDGeometry.h" // ALIFMDGEOMETRY_H | |
53 | #include "AliFMDDetector.h" // ALIFMDDETECTOR_H | |
54 | #include "AliFMDRing.h" // ALIFMDRING_H | |
55 | #include "AliFMD1.h" // ALIFMD1_H | |
56 | #include "AliFMD2.h" // ALIFMD2_H | |
57 | #include "AliFMD3.h" // ALIFMD3_H | |
6169f936 | 58 | // #include "AliFMD.h" // ALIFMD_H |
f95a63c4 | 59 | #include "AliFMDDebug.h" // ALILOG_H |
54e415a8 | 60 | |
61 | //==================================================================== | |
62 | ClassImp(AliFMDGeometryBuilder) | |
63 | #if 0 | |
64 | ; // This is here to keep Emacs for indenting the next line | |
65 | #endif | |
66 | ||
67 | //____________________________________________________________________ | |
68 | const Char_t* AliFMDGeometryBuilder::fgkActiveName = "F%cAC"; | |
bf000c32 | 69 | const Char_t* AliFMDGeometryBuilder::fgkSectorName = "F%cSC"; |
54e415a8 | 70 | const Char_t* AliFMDGeometryBuilder::fgkStripName = "F%cST"; |
bf000c32 | 71 | const Char_t* AliFMDGeometryBuilder::fgkSensorName = "F%cSE"; |
72 | const Char_t* AliFMDGeometryBuilder::fgkPCBName = "F%cPB"; | |
73 | const Char_t* AliFMDGeometryBuilder::fgkCuName = "F%cCU"; | |
74 | const Char_t* AliFMDGeometryBuilder::fgkChipName = "F%cCH"; | |
54e415a8 | 75 | const Char_t* AliFMDGeometryBuilder::fgkLongLegName = "F%cLL"; |
76 | const Char_t* AliFMDGeometryBuilder::fgkShortLegName = "F%cSL"; | |
bf000c32 | 77 | const Char_t* AliFMDGeometryBuilder::fgkFrontVName = "F%cFH"; |
78 | const Char_t* AliFMDGeometryBuilder::fgkBackVName = "F%cBH"; | |
79 | const Char_t* AliFMDGeometryBuilder::fgkRingTopName = "F%cTV"; | |
80 | const Char_t* AliFMDGeometryBuilder::fgkRingBotName = "F%cBV"; | |
81 | const Char_t* AliFMDGeometryBuilder::fgkHCName = "F%dH%c"; | |
82 | const Char_t* AliFMDGeometryBuilder::fgkIHCName = "F%dI%c"; | |
54e415a8 | 83 | const Char_t* AliFMDGeometryBuilder::fgkNoseName = "F3SN"; |
d98fbfa5 | 84 | const Char_t* AliFMDGeometryBuilder::fgkBackName = "F%dSB"; |
85 | const Char_t* AliFMDGeometryBuilder::fgkTopName = "F%dSU"; | |
86 | const Char_t* AliFMDGeometryBuilder::fgkBeamName = "F%dSL"; | |
87 | const Char_t* AliFMDGeometryBuilder::fgkFlangeName = "F%dSF"; | |
88 | const Char_t* AliFMDGeometryBuilder::fgkFMDDCuName = "F%cDC"; | |
89 | const Char_t* AliFMDGeometryBuilder::fgkFMDDPCBName = "F%cDP"; | |
90 | const Char_t* AliFMDGeometryBuilder::fgkFMDDChipName = "F%cDI"; | |
91 | const Char_t* AliFMDGeometryBuilder::fgkFMDDName = "F%cDD"; | |
bf000c32 | 92 | const Char_t* AliFMDGeometryBuilder::fgkFMDName = "F%dM%c"; |
54e415a8 | 93 | |
94 | //____________________________________________________________________ | |
95 | AliFMDGeometryBuilder::AliFMDGeometryBuilder() | |
b5ee4425 | 96 | : TTask("FMD", "Geomtry builder"), |
97 | fActiveId(0), | |
98 | fDetailed(kTRUE), | |
54e415a8 | 99 | fUseAssembly(kTRUE), |
b5ee4425 | 100 | fSectorOff(0), |
101 | fModuleOff(0), | |
102 | fRingOff(0), | |
103 | fDetectorOff(0), | |
54e415a8 | 104 | fSi(0), |
105 | fC(0), | |
106 | fAl(0), | |
107 | fPCB(0), | |
108 | fChip(0), | |
b5ee4425 | 109 | fAir(0), |
110 | fPlastic(0), | |
d98fbfa5 | 111 | fCopper(0), |
112 | fSteel(0) | |
54e415a8 | 113 | { |
114 | // Default constructor | |
088f8e79 | 115 | fActiveId.Set(2); |
54e415a8 | 116 | } |
117 | ||
118 | //____________________________________________________________________ | |
119 | AliFMDGeometryBuilder::AliFMDGeometryBuilder(Bool_t detailed) | |
120 | : TTask("FMD", "Geometry builder"), | |
b5ee4425 | 121 | fActiveId(0), |
54e415a8 | 122 | fDetailed(detailed), |
123 | fUseAssembly(kTRUE), | |
b5ee4425 | 124 | fSectorOff(0), |
125 | fModuleOff(0), | |
126 | fRingOff(0), | |
127 | fDetectorOff(0), | |
54e415a8 | 128 | fSi(0), |
129 | fC(0), | |
130 | fAl(0), | |
131 | fPCB(0), | |
132 | fChip(0), | |
b5ee4425 | 133 | fAir(0), |
134 | fPlastic(0), | |
d98fbfa5 | 135 | fCopper(0), |
136 | fSteel(0) | |
54e415a8 | 137 | { |
138 | // Normal constructor | |
139 | // | |
140 | // Parameters: | |
141 | // | |
142 | // fmd Pointer to AliFMD object | |
143 | // detailed Whether to make a detailed simulation or not | |
144 | // | |
088f8e79 | 145 | fActiveId.Set(2); |
54e415a8 | 146 | } |
147 | ||
148 | ||
149 | //____________________________________________________________________ | |
150 | TGeoVolume* | |
151 | AliFMDGeometryBuilder::RingGeometry(AliFMDRing* r) | |
152 | { | |
153 | // Setup the geometry of a ring. The defined TGeoVolume is | |
154 | // returned, and should be used when setting up the rest of the | |
155 | // volumes. | |
156 | // | |
157 | // | |
158 | // Parameters: | |
159 | // | |
160 | // r Pointer to ring geometry object | |
161 | // | |
162 | // Returns: | |
163 | // pointer to ring volume | |
164 | // | |
165 | if (!r) { | |
166 | AliError("Didn't get a ring object"); | |
167 | return 0; | |
168 | } | |
169 | Char_t id = r->GetId(); | |
170 | Double_t siThick = r->GetSiThickness(); | |
02a27b50 | 171 | const Int_t knv = r->GetNVerticies(); |
54e415a8 | 172 | TVector2* a = r->GetVertex(5); |
173 | TVector2* b = r->GetVertex(3); | |
174 | TVector2* c = r->GetVertex(4); | |
175 | Double_t theta = r->GetTheta(); | |
176 | Double_t off = (TMath::Tan(TMath::Pi() * theta / 180) | |
177 | * r->GetBondingWidth()); | |
178 | Double_t rmax = b->Mod(); | |
179 | Double_t rmin = r->GetLowR(); | |
180 | Double_t pcbThick = r->GetPrintboardThickness(); | |
bf000c32 | 181 | Double_t cuThick = r->GetCopperThickness(); |
182 | Double_t chipThick= r->GetChipThickness(); | |
54e415a8 | 183 | Double_t modSpace = r->GetModuleSpacing(); |
184 | Double_t legr = r->GetLegRadius(); | |
185 | Double_t legl = r->GetLegLength(); | |
186 | Double_t legoff = r->GetLegOffset(); | |
187 | Int_t ns = r->GetNStrips(); | |
188 | Double_t stripoff = a->Mod(); | |
189 | Double_t dstrip = (rmax - stripoff) / ns; | |
190 | Double_t space = r->GetSpacing(); | |
02a27b50 | 191 | TArrayD xs(knv); |
192 | TArrayD ys(knv); | |
193 | for (Int_t i = 0; i < knv; i++) { | |
54e415a8 | 194 | // Reverse the order |
02a27b50 | 195 | TVector2* vv = r->GetVertex(knv - 1 - i); |
54e415a8 | 196 | if (!vv) { |
02a27b50 | 197 | AliError(Form("Failed to get vertex # %d", knv - 1 - i)); |
54e415a8 | 198 | continue; |
199 | } | |
200 | xs[i] = vv->X(); | |
201 | ys[i] = vv->Y(); | |
202 | } | |
203 | ||
204 | // Shape of actual sensor | |
bf000c32 | 205 | TGeoXtru* sensorShape = new TGeoXtru(2); |
02a27b50 | 206 | sensorShape->DefinePolygon(knv, xs.fArray, ys.fArray); |
bf000c32 | 207 | sensorShape->DefineSection(0, - siThick/2); |
208 | sensorShape->DefineSection(1, siThick/2); | |
209 | TGeoVolume* sensorVolume = new TGeoVolume(Form(fgkSensorName, id), | |
210 | sensorShape, fSi); | |
211 | sensorVolume->VisibleDaughters(kFALSE); | |
212 | Int_t sid = sensorVolume->GetNumber(); | |
54e415a8 | 213 | fSectorOff = -1; |
214 | fModuleOff = 1; | |
215 | fRingOff = 2; | |
216 | fDetectorOff = 3; | |
217 | if (fDetailed) { | |
218 | fSectorOff = 1; | |
d98fbfa5 | 219 | fModuleOff = 4; |
220 | fRingOff = 5; | |
221 | fDetectorOff = 6; | |
54e415a8 | 222 | // Virtual volume shape to divide - This volume is only defined if |
223 | // the geometry is set to be detailed. | |
bf000c32 | 224 | TGeoTubeSeg* activeShape = new TGeoTubeSeg(rmin, rmax, siThick/2, |
225 | - theta, theta); | |
54e415a8 | 226 | TGeoVolume* activeVolume = new TGeoVolume(Form(fgkActiveName, id), |
227 | activeShape,fSi); | |
228 | TGeoVolume* sectorVolume = activeVolume->Divide(Form(fgkSectorName,id), | |
229 | 2, 2, -theta,0,0,"N"); | |
230 | TGeoVolume* stripVolume = sectorVolume->Divide(Form(fgkStripName, id), | |
231 | 1, ns, stripoff, dstrip, | |
232 | 0, "SX"); | |
233 | sid = stripVolume->GetNumber(); | |
bf000c32 | 234 | sensorVolume->AddNodeOverlap(activeVolume, 0); |
54e415a8 | 235 | } |
236 | ||
237 | switch (id) { | |
bf000c32 | 238 | case 'i': case 'I': fActiveId[0] = sid; break; |
239 | case 'o': case 'O': fActiveId[1] = sid; break; | |
54e415a8 | 240 | } |
241 | ||
242 | // Shape of Printed circuit Board | |
02a27b50 | 243 | for (Int_t i = 0; i < knv / 2; i++) ys[i] -= off; |
244 | for (Int_t i = knv / 2; i < knv; i++) ys[i] += off; | |
bf000c32 | 245 | TGeoXtru* pcbShape = new TGeoXtru(2); |
02a27b50 | 246 | pcbShape->DefinePolygon(knv, xs.fArray, ys.fArray); |
54e415a8 | 247 | pcbShape->DefineSection(0, - pcbThick/2); |
248 | pcbShape->DefineSection(1, pcbThick/2); | |
bf000c32 | 249 | TGeoVolume* pcbVolume = new TGeoVolume(Form(fgkPCBName, id), |
250 | pcbShape, fPCB); | |
251 | ||
252 | // Copper layer | |
253 | TGeoXtru* cuShape = new TGeoXtru(2); | |
254 | cuShape->DefinePolygon(6, xs.fArray, ys.fArray); | |
255 | cuShape->DefineSection(0, - cuThick/2); | |
256 | cuShape->DefineSection(1, cuThick/2); | |
257 | TGeoVolume* cuVolume = new TGeoVolume(Form(fgkCuName,id),cuShape,fCopper); | |
258 | ||
259 | // Chip layer | |
260 | TGeoXtru* chipShape = new TGeoXtru(2); | |
261 | chipShape->DefinePolygon(6, xs.fArray, ys.fArray); | |
262 | chipShape->DefineSection(0, - chipThick/2); | |
263 | chipShape->DefineSection(1, chipThick/2); | |
264 | TGeoVolume* chipVolume = new TGeoVolume(Form(fgkChipName,id), | |
265 | chipShape,fChip); | |
54e415a8 | 266 | |
267 | // Short leg shape | |
268 | TGeoTube* shortLegShape = new TGeoTube(0, legr, legl / 2); | |
269 | TGeoVolume* shortLegVolume = new TGeoVolume(Form(fgkShortLegName, id), | |
d98fbfa5 | 270 | shortLegShape, fCopper); |
54e415a8 | 271 | |
272 | // Long leg shape | |
273 | TGeoTube* longLegShape = new TGeoTube(0, legr, (legl + modSpace) / 2); | |
274 | TGeoVolume* longLegVolume = new TGeoVolume(Form(fgkLongLegName, id), | |
d98fbfa5 | 275 | longLegShape, fCopper); |
54e415a8 | 276 | |
bf000c32 | 277 | |
54e415a8 | 278 | // Back container volume |
bf000c32 | 279 | TGeoVolume* backVolume = new TGeoVolumeAssembly(Form(fgkBackVName, id)); |
54e415a8 | 280 | Double_t x = 0; |
281 | Double_t y = 0; | |
65af05bc | 282 | Double_t z = siThick / 2; |
283 | backVolume->AddNode(sensorVolume, 0, new TGeoTranslation(x, y, z)); | |
284 | z += siThick / 2 + space + pcbThick / 2; | |
bf000c32 | 285 | backVolume->AddNode(pcbVolume, 0, new TGeoTranslation(x,y,z)); |
286 | z += (pcbThick + cuThick) / 2; | |
287 | backVolume->AddNode(cuVolume, 0, new TGeoTranslation(0, 0, z)); | |
288 | z += (cuThick + chipThick) / 2; | |
289 | backVolume->AddNode(chipVolume, 0, new TGeoTranslation(0, 0, z)); | |
54e415a8 | 290 | x = a->X() + legoff + legr; |
291 | y = 0; | |
292 | z += pcbThick / 2 + legl / 2; | |
bf000c32 | 293 | backVolume->AddNode(shortLegVolume, 0, new TGeoTranslation(x,y,z)); |
54e415a8 | 294 | x = c->X(); |
295 | y = c->Y() - legoff - legr - off; | |
bf000c32 | 296 | backVolume->AddNode(shortLegVolume, 1, new TGeoTranslation(x,y,z)); |
54e415a8 | 297 | y = -y; |
bf000c32 | 298 | backVolume->AddNode(shortLegVolume, 2, new TGeoTranslation(x,y,z)); |
54e415a8 | 299 | |
300 | // Front container volume | |
bf000c32 | 301 | TGeoVolume* frontVolume = new TGeoVolumeAssembly(Form(fgkFrontVName, id)); |
54e415a8 | 302 | x = 0; |
303 | y = 0; | |
65af05bc | 304 | z = siThick / 2; |
305 | frontVolume->AddNode(sensorVolume, 0, new TGeoTranslation(x, y, z)); | |
306 | z += siThick / 2 + space + pcbThick / 2; | |
307 | frontVolume->AddNode(pcbVolume, 0, new TGeoTranslation(x,y,z)); | |
bf000c32 | 308 | z += (pcbThick + cuThick) / 2; |
309 | frontVolume->AddNode(cuVolume, 0, new TGeoTranslation(0, 0, z)); | |
310 | z += (cuThick + chipThick) / 2; | |
311 | frontVolume->AddNode(chipVolume, 0, new TGeoTranslation(0, 0, z)); | |
54e415a8 | 312 | x = a->X() + legoff + legr; |
313 | y = 0; | |
314 | z += pcbThick / 2 + (legl + modSpace)/ 2; | |
bf000c32 | 315 | frontVolume->AddNode(longLegVolume, 0, new TGeoTranslation(x,y,z)); |
54e415a8 | 316 | x = c->X(); |
317 | y = c->Y() - legoff - legr - off; | |
bf000c32 | 318 | frontVolume->AddNode(longLegVolume, 1, new TGeoTranslation(x,y,z)); |
54e415a8 | 319 | y = -y; |
bf000c32 | 320 | frontVolume->AddNode(longLegVolume, 2, new TGeoTranslation(x,y,z)); |
d98fbfa5 | 321 | |
322 | ||
323 | // FMDD | |
324 | Double_t ddlr = r->GetFMDDLowR(); | |
325 | Double_t ddhr = r->GetFMDDHighR(); | |
326 | Double_t ddpt = r->GetFMDDPrintboardThickness(); | |
327 | Double_t ddct = r->GetFMDDCopperThickness(); | |
328 | Double_t ddit = r->GetFMDDChipThickness(); | |
329 | Double_t ddt = ddpt + ddct + ddit; | |
54e415a8 | 330 | |
d98fbfa5 | 331 | TGeoShape* fmddPcbShape = new TGeoTubeSeg(ddlr, ddhr, ddpt/2,0,180); |
332 | TGeoShape* fmddCuShape = new TGeoTubeSeg(ddlr, ddhr, ddct/2,0,180); | |
333 | TGeoShape* fmddChipShape = new TGeoTubeSeg(ddlr, ddhr, ddit/2,0,180); | |
334 | fmddPcbShape->SetName(Form(fgkFMDDPCBName, id)); | |
335 | fmddCuShape->SetName(Form(fgkFMDDCuName, id)); | |
336 | fmddChipShape->SetName(Form(fgkFMDDChipName, id)); | |
337 | if (id == 'O' || id == 'o') { | |
338 | TString pcbName(fmddPcbShape->GetName()); | |
339 | TString cuName(fmddCuShape->GetName()); | |
340 | TString chipName(fmddChipShape->GetName()); | |
341 | ||
342 | fmddPcbShape->SetName(Form("%s_inner", pcbName.Data())); | |
343 | fmddCuShape->SetName(Form("%s_inner", cuName.Data())); | |
344 | fmddChipShape->SetName(Form("%s_inner", chipName.Data())); | |
345 | new TGeoBBox(Form("%s_clip", pcbName.Data()), ddlr+3, ddhr/2, ddpt); | |
346 | new TGeoBBox(Form("%s_clip", cuName.Data()), ddlr+3, ddhr/2, ddpt); | |
347 | new TGeoBBox(Form("%s_clip", chipName.Data()),ddlr+3, ddhr/2, ddpt); | |
348 | TGeoTranslation* trans = new TGeoTranslation(Form("%s_trans", | |
349 | pcbName.Data()), | |
350 | 0, ddhr/2, 0); | |
351 | trans->RegisterYourself(); | |
352 | fmddPcbShape = new TGeoCompositeShape(pcbName.Data(), | |
353 | Form("%s_inner*%s_clip:%s_trans", | |
354 | pcbName.Data(), | |
355 | pcbName.Data(), | |
356 | pcbName.Data())); | |
357 | fmddCuShape = new TGeoCompositeShape(cuName.Data(), | |
358 | Form("%s_inner*%s_clip:%s_trans", | |
359 | cuName.Data(), | |
360 | cuName.Data(), | |
361 | pcbName.Data())); | |
362 | fmddChipShape = new TGeoCompositeShape(chipName.Data(), | |
363 | Form("%s_inner*%s_clip:%s_trans", | |
364 | chipName.Data(), | |
365 | chipName.Data(), | |
366 | pcbName.Data())); | |
367 | } | |
368 | ||
369 | TGeoVolume* fmddPcbVolume = new TGeoVolume(Form(fgkFMDDPCBName, id), | |
370 | fmddPcbShape, fPCB); | |
371 | TGeoVolume* fmddCuVolume = new TGeoVolume(Form(fgkFMDDCuName, id), | |
372 | fmddCuShape, fCopper); | |
373 | TGeoVolume* fmddChipVolume= new TGeoVolume(Form(fgkFMDDChipName, id), | |
374 | fmddChipShape, fChip); | |
bf000c32 | 375 | // Half ring mother volumes. |
376 | TGeoVolume* ringTopVolume = new TGeoVolumeAssembly(Form(fgkRingTopName,id)); | |
377 | TGeoVolume* ringBotVolume = new TGeoVolumeAssembly(Form(fgkRingBotName,id)); | |
378 | TGeoVolume* halfRing = ringTopVolume; | |
54e415a8 | 379 | |
bf000c32 | 380 | // Adding modules to half-rings |
381 | Int_t nmod = r->GetNModules(); | |
f95a63c4 | 382 | AliFMDDebug(10, ("making %d modules in ring %c", nmod, id)); |
54e415a8 | 383 | for (Int_t i = 0; i < nmod; i++) { |
bf000c32 | 384 | if (i == nmod / 2) halfRing = ringBotVolume; |
385 | Bool_t front = (i % 2 == 0); | |
d98fbfa5 | 386 | TGeoVolume* vol = (front ? frontVolume : backVolume); |
65af05bc | 387 | // vol->AddNode(sensorVolume, i, new TGeoTranslation(0,0,siThick/2)); |
d98fbfa5 | 388 | Double_t z1 = (i % 2) * modSpace; |
389 | Double_t th = (2 * i + 1) * theta; | |
390 | TGeoMatrix* mat1 = new TGeoCombiTrans(0,0,z1,0); | |
391 | mat1->RotateZ(th); | |
392 | halfRing->AddNode(vol, i, mat1); | |
393 | #if 0 | |
bf000c32 | 394 | Double_t z2 = z1 + siThick / 2 + space; |
395 | Double_t th = (2 * i + 1) * theta; | |
f95a63c4 | 396 | AliFMDDebug(20, ("Placing copy %d of %s and %s in %s at z=%f and %f, " |
bf000c32 | 397 | "and theta=%f", i, sensorVolume->GetName(), |
398 | vol->GetName(), halfRing->GetName(), z1, z2, th)); | |
399 | TGeoMatrix* mat1 = new TGeoCombiTrans(0,0,z1,0); | |
400 | mat1->RotateZ(th); | |
401 | halfRing->AddNode(sensorVolume, i, mat1); | |
402 | TGeoMatrix* mat2 = new TGeoCombiTrans(0,0,z2,0); | |
403 | mat2->RotateZ(th); | |
404 | halfRing->AddNode(vol, i, mat2); | |
d98fbfa5 | 405 | #endif |
406 | } | |
407 | ||
408 | // Add the FMDD | |
409 | Double_t zi = r->GetFullDepth() - ddt; | |
410 | Int_t n = 2; | |
411 | for (Int_t i = 0; i < n; i++) { | |
412 | TGeoVolume* halfRing = (i == 0 ? ringTopVolume : ringBotVolume); | |
413 | Double_t phi = 360. / n * i; | |
414 | TGeoRotation* rot = new TGeoRotation(Form("FMDD%c rotation %d", id, i)); | |
415 | rot->RotateZ(phi); | |
416 | z = zi + ddpt / 2; | |
417 | halfRing->AddNode(fmddPcbVolume, i, new TGeoCombiTrans(0,0,z,rot)); | |
418 | z += (ddpt + ddct) / 2; | |
419 | halfRing->AddNode(fmddCuVolume, i, new TGeoCombiTrans(0,0,z,rot)); | |
420 | z += (ddct + ddit) / 2; | |
421 | halfRing->AddNode(fmddChipVolume, i, new TGeoCombiTrans(0,0,z,rot)); | |
54e415a8 | 422 | } |
d98fbfa5 | 423 | |
54e415a8 | 424 | |
bf000c32 | 425 | return 0; |
54e415a8 | 426 | } |
427 | ||
428 | //____________________________________________________________________ | |
429 | TGeoVolume* | |
430 | AliFMDGeometryBuilder::DetectorGeometry(AliFMDDetector* d, | |
bf000c32 | 431 | TGeoVolume* topMother, |
432 | TGeoVolume* botMother, | |
433 | Double_t zMother, | |
434 | TGeoVolume* innerTop, | |
435 | TGeoVolume* innerBot, | |
436 | TGeoVolume* outerTop, | |
437 | TGeoVolume* outerBot) | |
54e415a8 | 438 | { |
439 | // Common stuff for setting up the FMD1, FMD2, and FMD3 geometries. | |
440 | // This includes putting the Honeycomb support plates and the rings | |
441 | // into the mother volumes. | |
442 | // | |
443 | // Parameeters: | |
444 | // d The detector geometry to use | |
445 | // mother The mother volume of the detector | |
446 | // zmother The midpoint in global coordinates of detector vol. | |
447 | // inner Pointer to inner ring volume | |
448 | // outer Pointer to outer ring volume | |
449 | // | |
450 | // Returns: | |
451 | // Pointer to mother (detector volume) | |
452 | // | |
453 | if (!d) return 0; | |
454 | // Loop over the defined rings | |
455 | for (int i = 0; i < 2; i++) { | |
456 | AliFMDRing* r = 0; | |
457 | Double_t lowr = 0; | |
458 | Double_t highr = 0; | |
459 | Double_t rz = 0; | |
bf000c32 | 460 | TGeoVolume* tvol = 0; |
461 | TGeoVolume* bvol = 0; | |
54e415a8 | 462 | switch (i) { |
463 | case 0: | |
464 | r = d->GetInner(); | |
465 | lowr = d->GetInnerHoneyLowR(); | |
466 | highr = d->GetInnerHoneyHighR(); | |
467 | rz = d->GetInnerZ(); | |
bf000c32 | 468 | tvol = innerTop; |
469 | bvol = innerBot; | |
54e415a8 | 470 | break; |
471 | case 1: | |
472 | r = d->GetOuter(); | |
473 | lowr = d->GetOuterHoneyLowR(); | |
474 | highr = d->GetOuterHoneyHighR(); | |
475 | rz = d->GetOuterZ(); | |
bf000c32 | 476 | tvol = outerTop; |
477 | bvol = outerBot; | |
54e415a8 | 478 | break; |
479 | } | |
480 | if (!r) continue; | |
481 | Char_t c = r->GetId(); | |
482 | Int_t id = d->GetId(); | |
d98fbfa5 | 483 | Double_t hcThick = r->GetHoneycombThickness(); |
484 | Double_t alThick = r->GetAlThickness(); | |
bf000c32 | 485 | Double_t z = TMath::Abs(rz - zMother); |
486 | ||
54e415a8 | 487 | // Place ring in mother volume |
bf000c32 | 488 | // TGeoMatrix*matrix=new TGeoTranslation(Form("FMD%d%c trans",id,c),0,0,0); |
d98fbfa5 | 489 | AliFMDDebug(1, ("Placing volumes %s and %s in %s and %s at z=%f", |
bf000c32 | 490 | tvol->GetName(), bvol->GetName(), |
491 | topMother->GetName(), botMother->GetName(), z)); | |
492 | topMother->AddNode(tvol, Int_t(c), new TGeoTranslation(0,0,z)); | |
493 | botMother->AddNode(bvol, Int_t(c), new TGeoTranslation(0,0,z)); | |
54e415a8 | 494 | |
54e415a8 | 495 | // Top of Honeycomb |
bf000c32 | 496 | TGeoTubeSeg* hcSha = new TGeoTubeSeg(lowr, highr, hcThick/2, 0, 180); |
497 | TGeoVolume* hcVol = new TGeoVolume(Form(fgkHCName,id,c),hcSha,fAl); | |
54e415a8 | 498 | // Air in top of honeycomb |
bf000c32 | 499 | TGeoTubeSeg* ihcSha = new TGeoTubeSeg(lowr+alThick, highr - alThick, |
500 | (hcThick-alThick)/2, 0, 180); | |
501 | TGeoVolume* ihcVol = new TGeoVolume(Form(fgkIHCName,id,c),ihcSha,fAir); | |
502 | hcVol->AddNode(ihcVol, 0); | |
503 | hcVol->VisibleDaughters(kFALSE); | |
504 | hcVol->SetVisibility(kTRUE); | |
d98fbfa5 | 505 | |
bf000c32 | 506 | z += (r->GetSiThickness() + |
507 | r->GetSpacing() + | |
508 | r->GetPrintboardThickness() + | |
509 | r->GetCopperThickness() + | |
510 | r->GetChipThickness() + | |
511 | r->GetModuleSpacing() + | |
512 | r->GetLegLength() + | |
d98fbfa5 | 513 | r->GetHoneycombThickness() + |
514 | r->GetFMDDPrintboardThickness() - | |
bf000c32 | 515 | hcThick / 2); |
516 | ||
f95a63c4 | 517 | AliFMDDebug(15, ("Placing a copy of %s in %s and %s at z=%f", |
bf000c32 | 518 | hcVol->GetName(), topMother->GetName(), |
519 | botMother->GetName(), z)); | |
520 | // Add to top | |
521 | topMother->AddNode(hcVol, 0, new TGeoTranslation(0, 0, z)); | |
522 | ||
523 | // Add to bottom | |
524 | TGeoMatrix* bhcMatrix = new TGeoCombiTrans(0,0,z,0); | |
525 | bhcMatrix->RotateZ(180); | |
526 | botMother->AddNode(hcVol, 1, bhcMatrix); | |
54e415a8 | 527 | } |
bf000c32 | 528 | return 0; |
54e415a8 | 529 | } |
530 | ||
531 | //____________________________________________________________________ | |
532 | TGeoVolume* | |
bf000c32 | 533 | AliFMDGeometryBuilder::FMD1Geometry(AliFMD1* fmd1, |
534 | TGeoVolume* innerTop, | |
535 | TGeoVolume* innerBot) | |
54e415a8 | 536 | { |
537 | // Setup the FMD1 geometry. The FMD1 only has one ring, and no | |
538 | // special support as it is at the momement. | |
539 | // | |
540 | // See also AliFMDGeometryBuilder::DetectorGeometry | |
541 | // | |
bf000c32 | 542 | if (!fmd1 || !innerTop || !innerBot) return 0; |
d98fbfa5 | 543 | AliFMDRing* r = fmd1->GetInner(); |
bf000c32 | 544 | Double_t z = fmd1->GetInnerZ(); |
d98fbfa5 | 545 | Double_t disce = 2; |
546 | Double_t backlr = fmd1->GetInnerHoneyHighR(); | |
547 | Double_t backhr = fmd1->GetInnerHoneyHighR()+5; | |
548 | Double_t backth = 0.2; | |
549 | Double_t toplr = r->GetLowR(); | |
550 | Double_t tophr = fmd1->GetInnerHoneyHighR()+disce; | |
551 | Double_t wallbh = (r->GetFullDepth() + disce); | |
552 | Double_t wallth = wallbh+0.1; | |
553 | ||
bf000c32 | 554 | TGeoVolume* fmd1TopVolume = new TGeoVolumeAssembly(Form(fgkFMDName, |
555 | fmd1->GetId(), 'T')); | |
556 | TGeoVolume* fmd1BotVolume = new TGeoVolumeAssembly(Form(fgkFMDName, | |
557 | fmd1->GetId(), 'B')); | |
54e415a8 | 558 | |
bf000c32 | 559 | // Basic detector geometry |
560 | DetectorGeometry(fmd1, fmd1TopVolume, fmd1BotVolume, z, | |
561 | innerTop, innerBot, 0, 0); | |
562 | ||
d98fbfa5 | 563 | |
564 | // Back | |
565 | TGeoTubeSeg* backShape = new TGeoTubeSeg(backlr, backhr, backth / 2, 0, 180); | |
566 | TGeoTubeSeg* wallbShape = new TGeoTubeSeg(backlr, backlr + backth, | |
567 | wallbh/2, 0, 180); | |
568 | TGeoTubeSeg* topShape = new TGeoTubeSeg(toplr, tophr, backth / 2, 0, 180); | |
569 | TGeoTubeSeg* walltShape = new TGeoTubeSeg(tophr, tophr + backth, | |
570 | wallth/2, 0, 180); | |
571 | TGeoVolume* backVolume = new TGeoVolume(Form(fgkBackName, fmd1->GetId()), | |
572 | backShape, fC); | |
573 | TGeoVolume* wallbVolume= new TGeoVolume(Form(fgkFlangeName, fmd1->GetId()), | |
574 | wallbShape, fC); | |
575 | TGeoVolume* topVolume = new TGeoVolume(Form(fgkTopName, fmd1->GetId()), | |
576 | topShape, fC); | |
577 | TGeoVolume* walltVolume= new TGeoVolume(Form(fgkBeamName, fmd1->GetId()), | |
578 | walltShape, fC); | |
579 | backVolume->SetFillColor(kGray); | |
580 | topVolume->SetFillColor(kGray); | |
581 | wallbVolume->SetFillColor(kGray); | |
582 | walltVolume->SetFillColor(kGray); | |
583 | ||
584 | // Place volumes | |
585 | Double_t zb = TMath::Abs(fmd1->GetInnerZ() - z); | |
586 | Double_t zi = zb; | |
587 | Int_t n = 2; | |
588 | ||
589 | // Place top cover | |
590 | zi -= disce / 2 + backth / 2; | |
591 | zb = zi; | |
592 | for (Int_t i = 0; i < 2; i++) { | |
593 | TGeoVolume* mother = (i == 0 ? fmd1TopVolume : fmd1BotVolume); | |
594 | Double_t phi = 360. / n * i; | |
595 | TGeoRotation* rot = new TGeoRotation(Form("FMD1 top rotation %d", | |
596 | i)); | |
597 | rot->RotateZ(phi); | |
598 | TGeoMatrix* matrix = new TGeoCombiTrans(Form("FMD1 top wall trans %d", | |
599 | i), | |
600 | 0, 0, zi, rot); | |
601 | mother->AddNode(topVolume, i, matrix); | |
602 | } | |
603 | // Place outer wall | |
604 | zi += wallth / 2 + backth / 2; | |
605 | for (Int_t i = 0; i < 2; i++) { | |
606 | TGeoVolume* mother = (i == 0 ? fmd1TopVolume : fmd1BotVolume); | |
607 | Double_t phi = 360. / n * i; | |
608 | TGeoRotation* rot = new TGeoRotation(Form("FMD1 outer wall rotation %d", | |
609 | i)); | |
610 | rot->RotateZ(phi); | |
611 | TGeoMatrix* matrix = new TGeoCombiTrans(Form("FMD1 outer wall trans %d", | |
612 | i), | |
613 | 0, 0, zi, rot); | |
614 | mother->AddNode(walltVolume, i, matrix); | |
615 | } | |
616 | // Place back | |
617 | zi += wallth / 2 + backth / 2; // + disce / 2; | |
618 | for (Int_t i = 0; i < 2; i++) { | |
619 | TGeoVolume* mother = (i == 0 ? fmd1TopVolume : fmd1BotVolume); | |
620 | Double_t phi = 360. / n * i; | |
621 | TGeoRotation* rot = new TGeoRotation(Form("FMD1 back rotation %d", i)); | |
622 | rot->RotateZ(phi); | |
623 | TGeoMatrix* matrix = new TGeoCombiTrans(Form("FMD1 back trans %d", i), | |
624 | 0, 0, zi, rot); | |
625 | mother->AddNode(backVolume, i, matrix); | |
626 | } | |
627 | // Place inner wall | |
628 | zi -= wallbh / 2 + backth / 2; // + disce / 2; | |
629 | for (Int_t i = 0; i < 2; i++) { | |
630 | TGeoVolume* mother = (i == 0 ? fmd1TopVolume : fmd1BotVolume); | |
631 | Double_t phi = 360. / n * i; | |
632 | TGeoRotation* rot = new TGeoRotation(Form("FMD1 inner wall rotation %d", | |
633 | i)); | |
634 | rot->RotateZ(phi); | |
635 | TGeoMatrix* matrix = new TGeoCombiTrans(Form("FMD1 inner wall trans %d", | |
636 | i), | |
637 | 0, 0, zi, rot); | |
638 | mother->AddNode(wallbVolume, i, matrix); | |
639 | } | |
640 | ||
641 | ||
bf000c32 | 642 | // Must add this after filling the assembly. |
643 | TGeoVolume* top = gGeoManager->GetVolume("ALIC"); | |
c1b9c050 | 644 | // TGeoMatrix* matrix = new TGeoTranslation("FMD1 trans", 0, 0, z); |
645 | TGeoRotation* rot = new TGeoRotation("FMD1 rotatation"); | |
0b1b84c9 | 646 | rot->RotateZ(-90); |
c1b9c050 | 647 | TGeoMatrix* matrix = new TGeoCombiTrans("FMD1 trans", 0, 0, z, rot); |
f95a63c4 | 648 | AliFMDDebug(5, ("Placing volumes %s and %s in ALIC at z=%f", |
bf000c32 | 649 | fmd1TopVolume->GetName(), fmd1BotVolume->GetName(), z)); |
650 | top->AddNode(fmd1TopVolume, fmd1->GetId(), matrix); | |
651 | top->AddNode(fmd1BotVolume, fmd1->GetId(), matrix); | |
652 | ||
653 | return 0; | |
54e415a8 | 654 | } |
655 | ||
656 | //____________________________________________________________________ | |
657 | TGeoVolume* | |
658 | AliFMDGeometryBuilder::FMD2Geometry(AliFMD2* fmd2, | |
bf000c32 | 659 | TGeoVolume* innerTop, |
660 | TGeoVolume* innerBot, | |
661 | TGeoVolume* outerTop, | |
662 | TGeoVolume* outerBot) | |
54e415a8 | 663 | { |
664 | // Setup the FMD2 geometry. The FMD2 has no | |
665 | // special support as it is at the momement. | |
666 | // | |
667 | // See also AliFMDGeometryBuilder::DetectorGeometry | |
668 | // | |
bf000c32 | 669 | if (!fmd2 || !innerTop || !innerBot || !outerTop || !outerBot) return 0; |
d98fbfa5 | 670 | AliFMDRing* r = fmd2->GetOuter(); |
671 | Double_t z = fmd2->GetOuterZ(); | |
672 | Double_t framelr = fmd2->GetOuterHoneyHighR()+0.5; | |
673 | Double_t framehr = fmd2->GetOuterHoneyHighR()+1.8; | |
674 | Double_t framelz = -1; | |
675 | Double_t framehz = (fmd2->GetInnerZ()-z) + r->GetFullDepth() + 1; | |
676 | Double_t framel = framehz - framelz; | |
677 | Double_t coverlr = fmd2->GetInner()->GetLowR()+1; | |
678 | Double_t backth = 0.05; | |
679 | ||
bf000c32 | 680 | TGeoVolume* fmd2TopVolume = new TGeoVolumeAssembly(Form(fgkFMDName, |
681 | fmd2->GetId(), 'T')); | |
682 | TGeoVolume* fmd2BotVolume = new TGeoVolumeAssembly(Form(fgkFMDName, | |
683 | fmd2->GetId(), 'B')); | |
54e415a8 | 684 | |
bf000c32 | 685 | DetectorGeometry(fmd2, fmd2TopVolume, fmd2BotVolume, z, |
686 | innerTop, innerBot, outerTop, outerBot); | |
687 | ||
d98fbfa5 | 688 | TGeoShape* cylinderShape = new TGeoTubeSeg(framelr,framehr,framel/2,0,180); |
689 | TGeoVolume* cylinderVolume = new TGeoVolume(Form(fgkBackName, fmd2->GetId()), | |
690 | cylinderShape, fC); | |
691 | TGeoShape* coverShape = new TGeoTubeSeg(coverlr,framehr,backth/2,0,180); | |
692 | TGeoVolume* coverVolume = new TGeoVolume(Form(fgkTopName, fmd2->GetId()), | |
693 | coverShape, fC); | |
694 | cylinderVolume->SetTransparency(63); | |
695 | coverVolume->SetTransparency(63); | |
696 | ||
697 | for (Int_t i = 0; i < 2; i++) { | |
698 | TGeoVolume* mother = (i == 0 ? fmd2TopVolume : fmd2BotVolume); | |
699 | ||
700 | Double_t phi = 360. / 2 * i; | |
701 | TGeoRotation* rot = new TGeoRotation(Form("FMD2 support rot %d",i)); | |
702 | rot->RotateZ(phi); | |
703 | TGeoMatrix* matrix = new TGeoCombiTrans(Form("FMD2 cyl trans %d", i), | |
704 | 0, 0, framelz+framel/2, rot); | |
705 | mother->AddNode(cylinderVolume, i, matrix); | |
706 | matrix = new TGeoCombiTrans(Form("FMD2 fcov trans %d", i), | |
707 | 0, 0, framelz-backth/2, rot); | |
708 | mother->AddNode(coverVolume, 2*i+0, matrix); | |
709 | matrix = new TGeoCombiTrans(Form("FMD2 bcov trans %d", i), | |
710 | 0, 0, framelz+framel+backth/2, | |
711 | rot); | |
712 | mother->AddNode(coverVolume, 2*i+1, matrix); | |
713 | } | |
714 | ||
715 | ||
716 | Double_t f1l = 10; | |
717 | Double_t f1w = 6; | |
718 | Double_t f1d = 1.2; | |
719 | ||
720 | TGeoBBox* flange1Shape = new TGeoBBox(f1l/2, f1w/2, f1d/2); | |
721 | TGeoVolume* flange1Volume = new TGeoVolume(Form(fgkFlangeName, fmd2->GetId()), | |
722 | flange1Shape, fAl); | |
723 | TGeoBBox* flange2Shape = new TGeoBBox(f1w/2, f1d/2, (framel+backth)/2); | |
724 | TGeoVolume* flange2Volume = new TGeoVolume(Form("F%dSG", fmd2->GetId()), | |
725 | flange2Shape, fAl); | |
726 | flange1Volume->SetTransparency(42); | |
727 | for (Int_t i = 0; i < 4; i++) { | |
728 | TGeoVolume* mother = (i < 2 ? fmd2TopVolume : fmd2BotVolume); | |
729 | ||
730 | Double_t phi = 360. / 4 * i - 45; | |
731 | Double_t rphi = TMath::Pi()*phi/180; | |
732 | Double_t x = (framelr + f1l/2) * TMath::Sin(rphi); | |
733 | Double_t y = (framelr + f1l/2) * TMath::Cos(rphi); | |
734 | TGeoRotation* rot = new TGeoRotation(Form("FMD2 support rot %d",i)); | |
735 | rot->RotateZ(phi); | |
736 | TGeoMatrix* matrix = new TGeoCombiTrans(Form("FMD2 flange 1 trans %d", i), | |
737 | x,y, framelz-backth-f1d/2, rot); | |
738 | mother->AddNode(flange1Volume, 2*i+0, matrix); | |
739 | matrix = new TGeoCombiTrans(Form("FMD2 flange 2 trans %d", i), | |
740 | x,y,framelz+framel+backth+f1d/2, | |
741 | rot); | |
742 | mother->AddNode(flange1Volume, 2*i+1, matrix); | |
743 | Double_t x1 = x - (f1w-f1d) / 2 * TMath::Cos(rphi); | |
744 | Double_t y1 = y + (f1w-f1d) / 2 * TMath::Sin(rphi); | |
745 | matrix = new TGeoCombiTrans(Form("FMD2 flange 3 trans %d", i), | |
746 | x1,y1,framelz+framel/2, rot); | |
747 | mother->AddNode(flange2Volume, 2*i+0, matrix); | |
748 | Double_t x2 = x + (f1w-f1d) / 2 * TMath::Cos(rphi); | |
749 | Double_t y2 = y - (f1w-f1d) / 2 * TMath::Sin(rphi); | |
750 | matrix = new TGeoCombiTrans(Form("FMD2 flange 4 trans %d", i), | |
751 | x2,y2,framelz+framel/2, rot); | |
752 | mother->AddNode(flange2Volume, 2*i+1, matrix); | |
753 | } | |
754 | ||
755 | ||
756 | ||
bf000c32 | 757 | // Must be done after filling the assemblies |
54e415a8 | 758 | TGeoVolume* top = gGeoManager->GetVolume("ALIC"); |
bf000c32 | 759 | TGeoMatrix* matrix = new TGeoTranslation("FMD2 trans", 0, 0, z); |
f95a63c4 | 760 | AliFMDDebug(5, ("Placing volumes %s and %s in ALIC at z=%f", |
bf000c32 | 761 | fmd2TopVolume->GetName(), fmd2BotVolume->GetName(), z)); |
762 | top->AddNode(fmd2TopVolume, fmd2->GetId(), matrix); | |
763 | top->AddNode(fmd2BotVolume, fmd2->GetId(), matrix); | |
54e415a8 | 764 | |
d98fbfa5 | 765 | |
bf000c32 | 766 | return 0; |
54e415a8 | 767 | } |
768 | ||
769 | //____________________________________________________________________ | |
770 | TGeoVolume* | |
771 | AliFMDGeometryBuilder::FMD3Geometry(AliFMD3* fmd3, | |
bf000c32 | 772 | TGeoVolume* innerTop, |
773 | TGeoVolume* innerBot, | |
774 | TGeoVolume* outerTop, | |
775 | TGeoVolume* outerBot) | |
54e415a8 | 776 | { |
777 | // Setup the FMD3 geometry. The FMD2 has a rather elaborate support | |
778 | // structure, as the support will also support the vacuum | |
779 | // beam-pipe. | |
780 | // | |
781 | // See also AliFMDGeometryBuilder::DetectorGeometry | |
782 | // | |
bf000c32 | 783 | if (!fmd3 || !innerTop || !innerBot || !outerTop || !outerBot) return 0; |
54e415a8 | 784 | Double_t nlen = fmd3->GetNoseLength(); |
785 | Double_t nz = fmd3->GetNoseZ(); | |
786 | Double_t noser1 = fmd3->GetNoseLowR(); | |
787 | Double_t noser2 = fmd3->GetNoseHighR(); | |
d98fbfa5 | 788 | Double_t conet = fmd3->GetBeamThickness(); |
54e415a8 | 789 | Double_t conel = fmd3->GetConeLength(); |
790 | Double_t backl = fmd3->GetBackLength(); | |
791 | Double_t backr1 = fmd3->GetBackLowR(); | |
792 | Double_t backr2 = fmd3->GetBackHighR(); | |
793 | Double_t zdist = conel - backl - nlen; | |
794 | Double_t tdist = backr2 - noser2; | |
795 | Double_t beaml = TMath::Sqrt(zdist * zdist + tdist * tdist); | |
796 | Double_t theta = -180. * TMath::ATan2(tdist, zdist) / TMath::Pi(); | |
54e415a8 | 797 | Double_t flanger = fmd3->GetFlangeR(); |
bf000c32 | 798 | Double_t z = fmd3->GetInnerZ(); // fmd3->GetZ(); |
54e415a8 | 799 | Double_t zi; |
800 | ||
bf000c32 | 801 | TGeoVolume* fmd3TopVolume = new TGeoVolumeAssembly(Form(fgkFMDName, |
802 | fmd3->GetId(), 'T')); | |
803 | TGeoVolume* fmd3BotVolume = new TGeoVolumeAssembly(Form(fgkFMDName, | |
804 | fmd3->GetId(), 'B')); | |
805 | ||
54e415a8 | 806 | |
bf000c32 | 807 | DetectorGeometry(fmd3, fmd3TopVolume, fmd3BotVolume, z, |
808 | innerTop, innerBot, outerTop, outerBot); | |
809 | ||
54e415a8 | 810 | |
d98fbfa5 | 811 | TGeoVolumeAssembly* support = new TGeoVolumeAssembly("F3SU"); |
bf000c32 | 812 | |
d98fbfa5 | 813 | // Nose volume |
814 | TGeoTubeSeg* noseShape = new TGeoTubeSeg(noser1, noser2, nlen / 2, 0, 180); | |
815 | TGeoVolume* noseVolume = new TGeoVolume(fgkNoseName, noseShape, fC); | |
816 | support->AddNode(noseVolume, 0, new TGeoTranslation(0, 0, nlen/2)); | |
817 | ||
818 | // Steel bolts | |
819 | TGeoTube* boltShape = new TGeoTube("F3SB", 0, 0.3, conet / 2); | |
820 | TGeoVolume* boltVolume = new TGeoVolume("F3SB", boltShape, fSteel); | |
821 | Double_t z1 = -10; | |
822 | Double_t x1 = (fmd3->ConeR(nz+z1)); | |
823 | TGeoRotation* r1 = new TGeoRotation(); | |
824 | r1->RotateY(theta); | |
825 | TGeoCombiTrans* t = new TGeoCombiTrans("F3SB1",x1,0,-z1,r1); | |
826 | support->AddNode(boltVolume, 1, t); | |
827 | z1 = -20; | |
828 | x1 = (fmd3->ConeR(nz+z1)); | |
829 | t = new TGeoCombiTrans("F3SB2",x1,0,-z1,r1); | |
830 | support->AddNode(boltVolume, 2, t); | |
831 | ||
832 | // Cooling plates | |
833 | TGeoTrd1* plateShape = new TGeoTrd1(2, 8, 0.1, (conel-2-2)/2-.1); | |
834 | TGeoVolume* plateVolume = new TGeoVolume("F3CO", plateShape, fAl); | |
835 | ||
836 | // Shape for carbon half-cone | |
837 | new TGeoConeSeg("F3SC_inner", conel/2,noser2-conet, noser2, | |
838 | backr2-conet, backr2, 0., 180.); | |
839 | new TGeoTrd1("F3SC_hole",2,8,conet*3,(conel-2-2)/2); | |
840 | Double_t holeAng = TMath::ATan2(backr2 - noser2, conel); | |
841 | Double_t holeX = ((conel-2) / 2 * TMath::Sin(holeAng) + | |
842 | conet * TMath::Cos(holeAng) + | |
843 | noser2); | |
844 | TGeoRotation* holeRot = new TGeoRotation(); | |
845 | holeRot->RotateZ(90); | |
846 | holeRot->RotateY(holeAng*180./TMath::Pi()); | |
847 | TGeoCombiTrans* holeTrans = new TGeoCombiTrans(holeX, 0, -2, holeRot); | |
848 | ||
849 | // Build-up the composite shape for the cone, and add cooling plates | |
850 | // at the same time. | |
851 | TString coneExp("F3SC_inner-("); | |
852 | for (int i = 0; i < 4; i++) { | |
853 | Double_t thisAng = 360. / 8 * (i + .5); | |
854 | TGeoCombiTrans* thisTrans = new TGeoCombiTrans(*holeTrans); | |
855 | thisTrans->RotateZ(thisAng); | |
856 | thisTrans->SetName(Form("F3SC_rot%d", i)); | |
857 | thisTrans->RegisterYourself(); | |
858 | coneExp.Append(Form("F3SC_hole:F3SC_rot%d+", i)); | |
859 | ||
860 | const Double_t* tt = thisTrans->GetTranslation(); | |
861 | Double_t x = tt[0]+1*TMath::Cos(thisAng*TMath::Pi()/180); | |
862 | Double_t y = tt[1]+1*TMath::Sin(thisAng*TMath::Pi()/180); | |
863 | TGeoCombiTrans* plateTrans = new TGeoCombiTrans(x,y,tt[2]-1+nlen+conel/2, | |
864 | thisTrans->GetRotation()); | |
865 | support->AddNode(plateVolume, i, plateTrans); | |
866 | } | |
867 | // Remove bolt holes | |
868 | coneExp.Append("F3SB:F3SB1+F3SB:F3SB2)"); | |
869 | ||
870 | // Finalize the half-cone shape and add volume | |
871 | TGeoCompositeShape* coneShape = new TGeoCompositeShape(coneExp.Data()); | |
872 | TGeoVolume* coneVolume = new TGeoVolume("F3SC", coneShape, fC); | |
873 | support->AddNode(coneVolume,1,new TGeoTranslation(0,0,nlen+conel/2)); | |
54e415a8 | 874 | |
54e415a8 | 875 | // The flanges |
d98fbfa5 | 876 | TGeoBBox* flangeShape = new TGeoBBox((flanger - backr2) / 2, |
877 | fmd3->GetBeamWidth() / 2, | |
878 | backl / 2); | |
879 | TGeoVolume* flangeVolume = new TGeoVolume(Form(fgkFlangeName, fmd3->GetId()), | |
880 | flangeShape, fC); | |
881 | Int_t n = fmd3->GetNFlange(); | |
882 | Double_t r = backr2 + (flanger - backr2) / 2; | |
883 | for (Int_t i = 0; i < n/2; i++) { | |
bf000c32 | 884 | Double_t phi = 360. / n * i + 180. / n; |
885 | Double_t x = r * TMath::Cos(TMath::Pi() / 180 * phi); | |
886 | Double_t y = r * TMath::Sin(TMath::Pi() / 180 * phi); | |
d98fbfa5 | 887 | TGeoRotation* rot = new TGeoRotation; |
54e415a8 | 888 | rot->RotateZ(phi); |
d98fbfa5 | 889 | TGeoMatrix* matrix = new TGeoCombiTrans(x, y, nlen+conel-backl/2, rot); |
890 | support->AddNode(flangeVolume, i, matrix); | |
54e415a8 | 891 | } |
892 | ||
d98fbfa5 | 893 | // Place support volumes in half-detector volumes |
894 | z = fmd3->GetInnerZ(); | |
895 | z1 = z-nz; | |
896 | fmd3TopVolume->AddNode(support, 1, new TGeoTranslation(0,0,z1)); | |
897 | r1 = new TGeoRotation(); | |
898 | r1->RotateZ(180); | |
899 | t = new TGeoCombiTrans(0,0,z1,r1); | |
900 | fmd3BotVolume->AddNode(support, 2, t); | |
901 | ||
902 | TGeoRotation* rot = new TGeoRotation("FMD3 rotatation"); | |
bf000c32 | 903 | rot->RotateY(180); |
d98fbfa5 | 904 | TGeoVolume* top = gGeoManager->GetVolume("ALIC"); |
905 | TGeoMatrix* mmatrix = new TGeoCombiTrans("FMD3 trans", 0, 0, z, rot); | |
f95a63c4 | 906 | AliFMDDebug(5, ("Placing volumes %s and %s in ALIC at z=%f", |
bf000c32 | 907 | fmd3TopVolume->GetName(), fmd3BotVolume->GetName(), z)); |
908 | top->AddNode(fmd3TopVolume, fmd3->GetId(), mmatrix); | |
909 | top->AddNode(fmd3BotVolume, fmd3->GetId(), mmatrix); | |
910 | ||
911 | return 0; | |
54e415a8 | 912 | } |
913 | ||
914 | //____________________________________________________________________ | |
915 | void | |
916 | AliFMDGeometryBuilder::Exec(Option_t*) | |
917 | { | |
918 | // Setup up the FMD geometry. | |
f95a63c4 | 919 | AliFMDDebug(1, ("\tGeometry options: %s", |
bf000c32 | 920 | (fDetailed ? "divided into strips" : "one volume"))); |
54e415a8 | 921 | if (!gGeoManager) { |
922 | AliFatal("No TGeoManager defined"); | |
923 | return; | |
924 | } | |
925 | ||
926 | fSi = gGeoManager->GetMedium("FMD_Si$"); | |
927 | fC = gGeoManager->GetMedium("FMD_Carbon$"); | |
928 | fAl = gGeoManager->GetMedium("FMD_Aluminum$"); | |
929 | fChip = gGeoManager->GetMedium("FMD_Si Chip$"); | |
930 | fAir = gGeoManager->GetMedium("FMD_Air$"); | |
931 | fPCB = gGeoManager->GetMedium("FMD_PCB$"); | |
932 | fPlastic = gGeoManager->GetMedium("FMD_Plastic$"); | |
933 | fCopper = gGeoManager->GetMedium("FMD_Copper$"); | |
d98fbfa5 | 934 | fSteel = gGeoManager->GetMedium("FMD_Steel$"); |
54e415a8 | 935 | |
d98fbfa5 | 936 | if (!fSi||!fC||!fAl||!fChip||!fAir||!fPCB||!fPlastic||!fCopper||!fSteel) { |
54e415a8 | 937 | AliError("Failed to get some or all tracking mediums"); |
938 | return; | |
939 | } | |
940 | AliFMDGeometry* fmd = AliFMDGeometry::Instance(); | |
bf000c32 | 941 | AliFMDRing* inner = fmd->GetInner(); |
942 | AliFMDRing* outer = fmd->GetOuter(); | |
943 | RingGeometry(inner); | |
944 | RingGeometry(outer); | |
945 | TGeoVolume* innerTop = gGeoManager->GetVolume(Form(fgkRingTopName, | |
946 | inner->GetId())); | |
947 | TGeoVolume* innerBot = gGeoManager->GetVolume(Form(fgkRingBotName, | |
948 | inner->GetId())); | |
949 | TGeoVolume* outerTop = gGeoManager->GetVolume(Form(fgkRingTopName, | |
950 | outer->GetId())); | |
951 | TGeoVolume* outerBot = gGeoManager->GetVolume(Form(fgkRingBotName, | |
952 | outer->GetId())); | |
953 | ||
954 | FMD1Geometry(fmd->GetFMD1(), innerTop, innerBot); | |
955 | FMD2Geometry(fmd->GetFMD2(), innerTop, innerBot, outerTop, outerBot); | |
956 | FMD3Geometry(fmd->GetFMD3(), innerTop, innerBot, outerTop, outerBot); | |
54e415a8 | 957 | #ifndef USE_PRE_MOVE |
958 | fmd->SetSectorOff(fSectorOff); | |
959 | fmd->SetModuleOff(fModuleOff); | |
960 | fmd->SetRingOff(fRingOff); | |
961 | fmd->SetDetectorOff(fDetectorOff); | |
962 | fmd->SetActive(fActiveId.fArray, fActiveId.fN); | |
963 | #endif | |
964 | // fmd->ExtractGeomInfo(); | |
965 | ||
966 | } | |
967 | ||
968 | ||
969 | //____________________________________________________________________ | |
970 | // | |
971 | // EOF | |
972 | // |