1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
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
21 //____________________________________________________________________
23 // Builder of FMD geometry.
25 // This class takes care of actually building the geometry using the
26 // TGeo classes. Various parameters are fecthed from the
27 // AliFMDGeometry manager.
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.
35 #include <TArrayD.h> // ROOT_TArrayD
36 #include <TGeoManager.h> // ROOT_TGeoManager
37 #include <TGeoMatrix.h> // ROOT_TGeoMatrix
38 #include <TGeoTube.h> // ROOT_TGeoTube
39 #include <TGeoTrd1.h> // ROOT_TGeoTrd1
40 #include <TGeoCone.h> // ROOT_TGeoTrd1
41 #include <TGeoVolume.h> // ROOT_TGeoVolume
42 #include <TGeoXtru.h> // ROOT_TGeoXtru
43 #include <TGeoCompositeShape.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
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
58 // #include "AliFMD.h" // ALIFMD_H
59 #include "AliFMDDebug.h" // ALILOG_H
61 //====================================================================
62 ClassImp(AliFMDGeometryBuilder)
64 ; // This is here to keep Emacs for indenting the next line
67 //____________________________________________________________________
68 const Char_t* AliFMDGeometryBuilder::fgkActiveName = "F%cAC";
69 const Char_t* AliFMDGeometryBuilder::fgkSectorName = "F%cSC";
70 const Char_t* AliFMDGeometryBuilder::fgkStripName = "F%cST";
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";
75 const Char_t* AliFMDGeometryBuilder::fgkLongLegName = "F%cLL";
76 const Char_t* AliFMDGeometryBuilder::fgkShortLegName = "F%cSL";
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";
83 const Char_t* AliFMDGeometryBuilder::fgkNoseName = "F3SN";
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";
92 const Char_t* AliFMDGeometryBuilder::fgkFMDName = "F%dM%c";
94 //____________________________________________________________________
95 AliFMDGeometryBuilder::AliFMDGeometryBuilder()
96 : TTask("FMD", "Geomtry builder"),
114 // Default constructor
118 //____________________________________________________________________
119 AliFMDGeometryBuilder::AliFMDGeometryBuilder(Bool_t detailed)
120 : TTask("FMD", "Geometry builder"),
138 // Normal constructor
142 // fmd Pointer to AliFMD object
143 // detailed Whether to make a detailed simulation or not
149 //____________________________________________________________________
151 AliFMDGeometryBuilder::RingGeometry(AliFMDRing* r)
153 // Setup the geometry of a ring. The defined TGeoVolume is
154 // returned, and should be used when setting up the rest of the
160 // r Pointer to ring geometry object
163 // pointer to ring volume
166 AliError("Didn't get a ring object");
169 Char_t id = r->GetId();
170 Double_t siThick = r->GetSiThickness();
171 const Int_t knv = r->GetNVerticies();
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();
181 Double_t cuThick = r->GetCopperThickness();
182 Double_t chipThick= r->GetChipThickness();
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();
193 for (Int_t i = 0; i < knv; i++) {
195 TVector2* vv = r->GetVertex(knv - 1 - i);
197 AliError(Form("Failed to get vertex # %d", knv - 1 - i));
204 // Shape of actual sensor
205 TGeoXtru* sensorShape = new TGeoXtru(2);
206 sensorShape->DefinePolygon(knv, xs.fArray, ys.fArray);
207 sensorShape->DefineSection(0, - siThick/2);
208 sensorShape->DefineSection(1, siThick/2);
209 TGeoVolume* sensorVolume = new TGeoVolume(Form(fgkSensorName, id),
211 sensorVolume->VisibleDaughters(kFALSE);
212 Int_t sid = sensorVolume->GetNumber();
222 // Virtual volume shape to divide - This volume is only defined if
223 // the geometry is set to be detailed.
224 TGeoTubeSeg* activeShape = new TGeoTubeSeg(rmin, rmax, siThick/2,
226 TGeoVolume* activeVolume = new TGeoVolume(Form(fgkActiveName, id),
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,
233 sid = stripVolume->GetNumber();
234 sensorVolume->AddNodeOverlap(activeVolume, 0);
238 case 'i': case 'I': fActiveId[0] = sid; break;
239 case 'o': case 'O': fActiveId[1] = sid; break;
242 // Shape of Printed circuit Board
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;
245 TGeoXtru* pcbShape = new TGeoXtru(2);
246 pcbShape->DefinePolygon(knv, xs.fArray, ys.fArray);
247 pcbShape->DefineSection(0, - pcbThick/2);
248 pcbShape->DefineSection(1, pcbThick/2);
249 TGeoVolume* pcbVolume = new TGeoVolume(Form(fgkPCBName, id),
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);
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),
268 TGeoTube* shortLegShape = new TGeoTube(0, legr, legl / 2);
269 TGeoVolume* shortLegVolume = new TGeoVolume(Form(fgkShortLegName, id),
270 shortLegShape, fCopper);
273 TGeoTube* longLegShape = new TGeoTube(0, legr, (legl + modSpace) / 2);
274 TGeoVolume* longLegVolume = new TGeoVolume(Form(fgkLongLegName, id),
275 longLegShape, fCopper);
278 // Back container volume
279 TGeoVolume* backVolume = new TGeoVolumeAssembly(Form(fgkBackVName, id));
282 Double_t z = siThick / 2;
283 backVolume->AddNode(sensorVolume, 0, new TGeoTranslation(x, y, z));
284 z += siThick / 2 + space + pcbThick / 2;
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));
290 x = a->X() + legoff + legr;
292 z += pcbThick / 2 + legl / 2;
293 backVolume->AddNode(shortLegVolume, 0, new TGeoTranslation(x,y,z));
295 y = c->Y() - legoff - legr - off;
296 backVolume->AddNode(shortLegVolume, 1, new TGeoTranslation(x,y,z));
298 backVolume->AddNode(shortLegVolume, 2, new TGeoTranslation(x,y,z));
300 // Front container volume
301 TGeoVolume* frontVolume = new TGeoVolumeAssembly(Form(fgkFrontVName, id));
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));
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));
312 x = a->X() + legoff + legr;
314 z += pcbThick / 2 + (legl + modSpace)/ 2;
315 frontVolume->AddNode(longLegVolume, 0, new TGeoTranslation(x,y,z));
317 y = c->Y() - legoff - legr - off;
318 frontVolume->AddNode(longLegVolume, 1, new TGeoTranslation(x,y,z));
320 frontVolume->AddNode(longLegVolume, 2, new TGeoTranslation(x,y,z));
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;
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());
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",
351 trans->RegisterYourself();
352 fmddPcbShape = new TGeoCompositeShape(pcbName.Data(),
353 Form("%s_inner*%s_clip:%s_trans",
357 fmddCuShape = new TGeoCompositeShape(cuName.Data(),
358 Form("%s_inner*%s_clip:%s_trans",
362 fmddChipShape = new TGeoCompositeShape(chipName.Data(),
363 Form("%s_inner*%s_clip:%s_trans",
369 TGeoVolume* fmddPcbVolume = new TGeoVolume(Form(fgkFMDDPCBName, id),
371 TGeoVolume* fmddCuVolume = new TGeoVolume(Form(fgkFMDDCuName, id),
372 fmddCuShape, fCopper);
373 TGeoVolume* fmddChipVolume= new TGeoVolume(Form(fgkFMDDChipName, id),
374 fmddChipShape, fChip);
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;
380 // Adding modules to half-rings
381 Int_t nmod = r->GetNModules();
382 AliFMDDebug(10, ("making %d modules in ring %c", nmod, id));
383 for (Int_t i = 0; i < nmod; i++) {
384 if (i == nmod / 2) halfRing = ringBotVolume;
385 Bool_t front = (i % 2 == 0);
386 TGeoVolume* vol = (front ? frontVolume : backVolume);
387 // vol->AddNode(sensorVolume, i, new TGeoTranslation(0,0,siThick/2));
388 Double_t z1 = (i % 2) * modSpace;
389 Double_t th = (2 * i + 1) * theta;
390 TGeoMatrix* mat1 = new TGeoCombiTrans(0,0,z1,0);
392 halfRing->AddNode(vol, i, mat1);
394 Double_t z2 = z1 + siThick / 2 + space;
395 Double_t th = (2 * i + 1) * theta;
396 AliFMDDebug(20, ("Placing copy %d of %s and %s in %s at z=%f and %f, "
397 "and theta=%f", i, sensorVolume->GetName(),
398 vol->GetName(), halfRing->GetName(), z1, z2, th));
399 TGeoMatrix* mat1 = new TGeoCombiTrans(0,0,z1,0);
401 halfRing->AddNode(sensorVolume, i, mat1);
402 TGeoMatrix* mat2 = new TGeoCombiTrans(0,0,z2,0);
404 halfRing->AddNode(vol, i, mat2);
409 Double_t zi = r->GetFullDepth() - ddt;
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));
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));
428 //____________________________________________________________________
430 AliFMDGeometryBuilder::DetectorGeometry(AliFMDDetector* d,
431 TGeoVolume* topMother,
432 TGeoVolume* botMother,
434 TGeoVolume* innerTop,
435 TGeoVolume* innerBot,
436 TGeoVolume* outerTop,
437 TGeoVolume* outerBot)
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.
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
451 // Pointer to mother (detector volume)
454 // Loop over the defined rings
455 for (int i = 0; i < 2; i++) {
460 TGeoVolume* tvol = 0;
461 TGeoVolume* bvol = 0;
465 lowr = d->GetInnerHoneyLowR();
466 highr = d->GetInnerHoneyHighR();
473 lowr = d->GetOuterHoneyLowR();
474 highr = d->GetOuterHoneyHighR();
481 Char_t c = r->GetId();
482 Int_t id = d->GetId();
483 Double_t hcThick = r->GetHoneycombThickness();
484 Double_t alThick = r->GetAlThickness();
485 Double_t z = TMath::Abs(rz - zMother);
487 // Place ring in mother volume
488 // TGeoMatrix*matrix=new TGeoTranslation(Form("FMD%d%c trans",id,c),0,0,0);
489 AliFMDDebug(1, ("Placing volumes %s and %s in %s and %s at z=%f",
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));
496 TGeoTubeSeg* hcSha = new TGeoTubeSeg(lowr, highr, hcThick/2, 0, 180);
497 TGeoVolume* hcVol = new TGeoVolume(Form(fgkHCName,id,c),hcSha,fAl);
498 // Air in top of honeycomb
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);
506 z += (r->GetSiThickness() +
508 r->GetPrintboardThickness() +
509 r->GetCopperThickness() +
510 r->GetChipThickness() +
511 r->GetModuleSpacing() +
513 r->GetHoneycombThickness() +
514 r->GetFMDDPrintboardThickness() -
517 AliFMDDebug(15, ("Placing a copy of %s in %s and %s at z=%f",
518 hcVol->GetName(), topMother->GetName(),
519 botMother->GetName(), z));
521 topMother->AddNode(hcVol, 0, new TGeoTranslation(0, 0, z));
524 TGeoMatrix* bhcMatrix = new TGeoCombiTrans(0,0,z,0);
525 bhcMatrix->RotateZ(180);
526 botMother->AddNode(hcVol, 1, bhcMatrix);
531 //____________________________________________________________________
533 AliFMDGeometryBuilder::FMD1Geometry(AliFMD1* fmd1,
534 TGeoVolume* innerTop,
535 TGeoVolume* innerBot)
537 // Setup the FMD1 geometry. The FMD1 only has one ring, and no
538 // special support as it is at the momement.
540 // See also AliFMDGeometryBuilder::DetectorGeometry
542 if (!fmd1 || !innerTop || !innerBot) return 0;
543 AliFMDRing* r = fmd1->GetInner();
544 Double_t z = fmd1->GetInnerZ();
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;
554 TGeoVolume* fmd1TopVolume = new TGeoVolumeAssembly(Form(fgkFMDName,
555 fmd1->GetId(), 'T'));
556 TGeoVolume* fmd1BotVolume = new TGeoVolumeAssembly(Form(fgkFMDName,
557 fmd1->GetId(), 'B'));
559 // Basic detector geometry
560 DetectorGeometry(fmd1, fmd1TopVolume, fmd1BotVolume, z,
561 innerTop, innerBot, 0, 0);
565 TGeoTubeSeg* backShape = new TGeoTubeSeg(backlr, backhr, backth / 2, 0, 180);
566 TGeoTubeSeg* wallbShape = new TGeoTubeSeg(backlr, backlr + backth,
568 TGeoTubeSeg* topShape = new TGeoTubeSeg(toplr, tophr, backth / 2, 0, 180);
569 TGeoTubeSeg* walltShape = new TGeoTubeSeg(tophr, tophr + backth,
571 TGeoVolume* backVolume = new TGeoVolume(Form(fgkBackName, fmd1->GetId()),
573 TGeoVolume* wallbVolume= new TGeoVolume(Form(fgkFlangeName, fmd1->GetId()),
575 TGeoVolume* topVolume = new TGeoVolume(Form(fgkTopName, fmd1->GetId()),
577 TGeoVolume* walltVolume= new TGeoVolume(Form(fgkBeamName, fmd1->GetId()),
579 backVolume->SetFillColor(kGray);
580 topVolume->SetFillColor(kGray);
581 wallbVolume->SetFillColor(kGray);
582 walltVolume->SetFillColor(kGray);
585 Double_t zb = TMath::Abs(fmd1->GetInnerZ() - z);
590 zi -= disce / 2 + backth / 2;
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",
598 TGeoMatrix* matrix = new TGeoCombiTrans(Form("FMD1 top wall trans %d",
601 mother->AddNode(topVolume, i, matrix);
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",
611 TGeoMatrix* matrix = new TGeoCombiTrans(Form("FMD1 outer wall trans %d",
614 mother->AddNode(walltVolume, i, matrix);
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));
623 TGeoMatrix* matrix = new TGeoCombiTrans(Form("FMD1 back trans %d", i),
625 mother->AddNode(backVolume, i, matrix);
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",
635 TGeoMatrix* matrix = new TGeoCombiTrans(Form("FMD1 inner wall trans %d",
638 mother->AddNode(wallbVolume, i, matrix);
642 // Must add this after filling the assembly.
643 TGeoVolume* top = gGeoManager->GetVolume("ALIC");
644 // TGeoMatrix* matrix = new TGeoTranslation("FMD1 trans", 0, 0, z);
645 TGeoRotation* rot = new TGeoRotation("FMD1 rotatation");
647 TGeoMatrix* matrix = new TGeoCombiTrans("FMD1 trans", 0, 0, z, rot);
648 AliFMDDebug(5, ("Placing volumes %s and %s in ALIC at z=%f",
649 fmd1TopVolume->GetName(), fmd1BotVolume->GetName(), z));
650 top->AddNode(fmd1TopVolume, fmd1->GetId(), matrix);
651 top->AddNode(fmd1BotVolume, fmd1->GetId(), matrix);
656 //____________________________________________________________________
658 AliFMDGeometryBuilder::FMD2Geometry(AliFMD2* fmd2,
659 TGeoVolume* innerTop,
660 TGeoVolume* innerBot,
661 TGeoVolume* outerTop,
662 TGeoVolume* outerBot)
664 // Setup the FMD2 geometry. The FMD2 has no
665 // special support as it is at the momement.
667 // See also AliFMDGeometryBuilder::DetectorGeometry
669 if (!fmd2 || !innerTop || !innerBot || !outerTop || !outerBot) return 0;
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;
680 TGeoVolume* fmd2TopVolume = new TGeoVolumeAssembly(Form(fgkFMDName,
681 fmd2->GetId(), 'T'));
682 TGeoVolume* fmd2BotVolume = new TGeoVolumeAssembly(Form(fgkFMDName,
683 fmd2->GetId(), 'B'));
685 DetectorGeometry(fmd2, fmd2TopVolume, fmd2BotVolume, z,
686 innerTop, innerBot, outerTop, outerBot);
688 TGeoShape* cylinderShape = new TGeoTubeSeg(framelr,framehr,framel/2,0,180);
689 TGeoVolume* cylinderVolume = new TGeoVolume(Form(fgkBackName, fmd2->GetId()),
691 TGeoShape* coverShape = new TGeoTubeSeg(coverlr,framehr,backth/2,0,180);
692 TGeoVolume* coverVolume = new TGeoVolume(Form(fgkTopName, fmd2->GetId()),
694 cylinderVolume->SetTransparency(63);
695 coverVolume->SetTransparency(63);
697 for (Int_t i = 0; i < 2; i++) {
698 TGeoVolume* mother = (i == 0 ? fmd2TopVolume : fmd2BotVolume);
700 Double_t phi = 360. / 2 * i;
701 TGeoRotation* rot = new TGeoRotation(Form("FMD2 support rot %d",i));
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,
712 mother->AddNode(coverVolume, 2*i+1, matrix);
720 TGeoBBox* flange1Shape = new TGeoBBox(f1l/2, f1w/2, f1d/2);
721 TGeoVolume* flange1Volume = new TGeoVolume(Form(fgkFlangeName, fmd2->GetId()),
723 TGeoBBox* flange2Shape = new TGeoBBox(f1w/2, f1d/2, (framel+backth)/2);
724 TGeoVolume* flange2Volume = new TGeoVolume(Form("F%dSG", fmd2->GetId()),
726 flange1Volume->SetTransparency(42);
727 for (Int_t i = 0; i < 4; i++) {
728 TGeoVolume* mother = (i < 2 ? fmd2TopVolume : fmd2BotVolume);
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));
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,
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);
757 // Must be done after filling the assemblies
758 TGeoVolume* top = gGeoManager->GetVolume("ALIC");
759 TGeoMatrix* matrix = new TGeoTranslation("FMD2 trans", 0, 0, z);
760 AliFMDDebug(5, ("Placing volumes %s and %s in ALIC at z=%f",
761 fmd2TopVolume->GetName(), fmd2BotVolume->GetName(), z));
762 top->AddNode(fmd2TopVolume, fmd2->GetId(), matrix);
763 top->AddNode(fmd2BotVolume, fmd2->GetId(), matrix);
769 //____________________________________________________________________
771 AliFMDGeometryBuilder::FMD3Geometry(AliFMD3* fmd3,
772 TGeoVolume* innerTop,
773 TGeoVolume* innerBot,
774 TGeoVolume* outerTop,
775 TGeoVolume* outerBot)
777 // Setup the FMD3 geometry. The FMD2 has a rather elaborate support
778 // structure, as the support will also support the vacuum
781 // See also AliFMDGeometryBuilder::DetectorGeometry
783 if (!fmd3 || !innerTop || !innerBot || !outerTop || !outerBot) return 0;
784 Double_t nlen = fmd3->GetNoseLength();
785 Double_t nz = fmd3->GetNoseZ();
786 Double_t noser1 = fmd3->GetNoseLowR();
787 Double_t noser2 = fmd3->GetNoseHighR();
788 Double_t conet = fmd3->GetBeamThickness();
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();
797 Double_t flanger = fmd3->GetFlangeR();
798 Double_t z = fmd3->GetInnerZ(); // fmd3->GetZ();
801 TGeoVolume* fmd3TopVolume = new TGeoVolumeAssembly(Form(fgkFMDName,
802 fmd3->GetId(), 'T'));
803 TGeoVolume* fmd3BotVolume = new TGeoVolumeAssembly(Form(fgkFMDName,
804 fmd3->GetId(), 'B'));
807 DetectorGeometry(fmd3, fmd3TopVolume, fmd3BotVolume, z,
808 innerTop, innerBot, outerTop, outerBot);
811 TGeoVolumeAssembly* support = new TGeoVolumeAssembly("F3SU");
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));
819 TGeoTube* boltShape = new TGeoTube("F3SB", 0, 0.3, conet / 2);
820 TGeoVolume* boltVolume = new TGeoVolume("F3SB", boltShape, fSteel);
822 Double_t x1 = (fmd3->ConeR(nz+z1));
823 TGeoRotation* r1 = new TGeoRotation();
825 TGeoCombiTrans* t = new TGeoCombiTrans("F3SB1",x1,0,-z1,r1);
826 support->AddNode(boltVolume, 1, t);
828 x1 = (fmd3->ConeR(nz+z1));
829 t = new TGeoCombiTrans("F3SB2",x1,0,-z1,r1);
830 support->AddNode(boltVolume, 2, t);
833 TGeoTrd1* plateShape = new TGeoTrd1(2, 8, 0.1, (conel-2-2)/2-.1);
834 TGeoVolume* plateVolume = new TGeoVolume("F3CO", plateShape, fAl);
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) +
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);
849 // Build-up the composite shape for the cone, and add cooling plates
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));
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);
868 coneExp.Append("F3SB:F3SB1+F3SB:F3SB2)");
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));
876 TGeoBBox* flangeShape = new TGeoBBox((flanger - backr2) / 2,
877 fmd3->GetBeamWidth() / 2,
879 TGeoVolume* flangeVolume = new TGeoVolume(Form(fgkFlangeName, fmd3->GetId()),
881 Int_t n = fmd3->GetNFlange();
882 Double_t r = backr2 + (flanger - backr2) / 2;
883 for (Int_t i = 0; i < n/2; i++) {
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);
887 TGeoRotation* rot = new TGeoRotation;
889 TGeoMatrix* matrix = new TGeoCombiTrans(x, y, nlen+conel-backl/2, rot);
890 support->AddNode(flangeVolume, i, matrix);
893 // Place support volumes in half-detector volumes
894 z = fmd3->GetInnerZ();
896 fmd3TopVolume->AddNode(support, 1, new TGeoTranslation(0,0,z1));
897 r1 = new TGeoRotation();
899 t = new TGeoCombiTrans(0,0,z1,r1);
900 fmd3BotVolume->AddNode(support, 2, t);
902 TGeoRotation* rot = new TGeoRotation("FMD3 rotatation");
904 TGeoVolume* top = gGeoManager->GetVolume("ALIC");
905 TGeoMatrix* mmatrix = new TGeoCombiTrans("FMD3 trans", 0, 0, z, rot);
906 AliFMDDebug(5, ("Placing volumes %s and %s in ALIC at z=%f",
907 fmd3TopVolume->GetName(), fmd3BotVolume->GetName(), z));
908 top->AddNode(fmd3TopVolume, fmd3->GetId(), mmatrix);
909 top->AddNode(fmd3BotVolume, fmd3->GetId(), mmatrix);
914 //____________________________________________________________________
916 AliFMDGeometryBuilder::Exec(Option_t*)
918 // Setup up the FMD geometry.
919 AliFMDDebug(1, ("\tGeometry options: %s",
920 (fDetailed ? "divided into strips" : "one volume")));
922 AliFatal("No TGeoManager defined");
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$");
934 fSteel = gGeoManager->GetMedium("FMD_Steel$");
936 if (!fSi||!fC||!fAl||!fChip||!fAir||!fPCB||!fPlastic||!fCopper||!fSteel) {
937 AliError("Failed to get some or all tracking mediums");
940 AliFMDGeometry* fmd = AliFMDGeometry::Instance();
941 AliFMDRing* inner = fmd->GetInner();
942 AliFMDRing* outer = fmd->GetOuter();
945 TGeoVolume* innerTop = gGeoManager->GetVolume(Form(fgkRingTopName,
947 TGeoVolume* innerBot = gGeoManager->GetVolume(Form(fgkRingBotName,
949 TGeoVolume* outerTop = gGeoManager->GetVolume(Form(fgkRingTopName,
951 TGeoVolume* outerBot = gGeoManager->GetVolume(Form(fgkRingBotName,
954 FMD1Geometry(fmd->GetFMD1(), innerTop, innerBot);
955 FMD2Geometry(fmd->GetFMD2(), innerTop, innerBot, outerTop, outerBot);
956 FMD3Geometry(fmd->GetFMD3(), innerTop, innerBot, outerTop, outerBot);
958 fmd->SetSectorOff(fSectorOff);
959 fmd->SetModuleOff(fModuleOff);
960 fmd->SetRingOff(fRingOff);
961 fmd->SetDetectorOff(fDetectorOff);
962 fmd->SetActive(fActiveId.fArray, fActiveId.fN);
964 // fmd->ExtractGeomInfo();
969 //____________________________________________________________________