18 #include <TGeoTorus.h>
19 #include <TGeoCompositeShape.h>
28 const char *detName = mDetName->Name().Data();
32 char flexName[128], aluStripName[128], flatRoofName[128], roofSideBeamName[128];
33 char waterPipeName[128], waterName[128], apexEnforcementBeamName[128];
34 char coldPlateName[128], sideWallName[128], baseEnforcementBeamName[128];
36 snprintf(flexName, 128-1,
"%sCellFlexLayer%02d", detName,
id);
37 snprintf(aluStripName, 128-1,
"%sAluStrips%02d", detName,
id);
38 snprintf(coldPlateName, 128-1,
"%sColdPlate%02d", detName,
id);
39 snprintf(mMimosaShellName, 128-1,
"%sMimosaShell%02d", detName,
id);
40 snprintf(mMimosaCoreName, 128-1,
"%sMimosaCore%02d", detName,
id);
41 snprintf(waterPipeName, 128-1,
"%sWaterPipe%02d", detName,
id);
42 snprintf(waterName, 128-1,
"%sWater%02d", detName,
id);
43 snprintf(apexEnforcementBeamName, 128-1,
"%sEnforcementBeamApex%02d", detName,
id);
44 snprintf(baseEnforcementBeamName, 128-1,
"%sEnforcementBeamBase%02d", detName,
id);
45 snprintf(sideWallName, 128-1,
"%sSideWall%02d", detName,
id);
46 snprintf(flatRoofName, 128-1,
"%sFlatRoof%02d", detName,
id);
47 snprintf(roofSideBeamName, 128-1,
"%sRoofSideBeam%02d", detName,
id);
48 snprintf(mCellAssemblyName, 128-1,
"%sChipAssembly%02d", detName,
id);
58 if (UseTriangularAssemblies()) {
60 TGeoTrd1 *trd1 =
new TGeoTrd1(mCellAssemblyName,
63 0.1 * mAssemblyLength/2,
64 0.1 * mAssemblyHeight/2);
69 char tmp1Name[128], tmp2Name[128];
71 snprintf(tmp1Name, 128-1,
"%sTmp1Volume%02d", detName,
id);
72 snprintf(tmp2Name, 128-1,
"%sTmp2Volume%02d", detName,
id);
80 TGeoTrd1 *
tmp1 =
new TGeoTrd1(tmp1Name,
83 0.1 * mAssemblyLength/2,
84 0.1 * mAssemblyHeight/2);
85 TGeoBBox *
tmp2 =
new TGeoBBox(tmp2Name,
88 0.1 * mAssemblyLength/2,
89 0.1 * mAssemblyHeight/2);
90 TGeoCompositeShape *cs =
new TGeoCompositeShape(mCellAssemblyName, TString(tmp1Name) +
"*" + TString(tmp2Name));
95 double aluThickness = 0.0, kaptonThickness = 0.0, carbonThickness = 0.0, waterThickness = 0.0;
98 double zOffset = -mAssemblyHeight/2;
112 TGeoBBox *flex =
new TGeoBBox(flexName,
114 0.1 * mAssemblyLength/2,
116 TGeoVolume *vflex =
new TGeoVolume(flexName, flex,
GetMedium(mKaptonMaterial));
131 TGeoBBox *alu =
new TGeoBBox(aluStripName,
133 0.1 * mAssemblyLength/2,
137 vcell->AddNode(valu, 0,
new TGeoCombiTrans(0.0, 0.0, 0.1 * (zOffset + mcell->
mFlexCableAluThickness/2), 0));
145 TGeoBBox *mimosa =
new TGeoBBox(mMimosaShellName,
151 mMimosaOffset = zOffset;
152 vcell->AddNode(vmimosa, 0,
new TGeoCombiTrans(0.0, 0.0, 0.1 * (zOffset + mcell->
mChipThickness/2), 0));
158 TGeoBBox *micore =
new TGeoBBox(mMimosaCoreName,
167 vmimosa->AddNode(vmicore, 0,
new TGeoCombiTrans(0.1 * (-mcell->
mChipDeadAreaWidth/2), 0.0, 0.0, 0));
176 TGeoBBox *cold =
new TGeoBBox(coldPlateName,
178 0.1 * mAssemblyLength/2,
180 TGeoVolume *vcold =
new TGeoVolume(coldPlateName, cold,
GetMedium(mCarbonFiberMaterial));
182 vcell->AddNode(vcold, 0,
new TGeoCombiTrans(0.0, 0.0, 0.1 * (zOffset + mcell->
mColdPlateThickness/2), 0));
195 double effectiveWaterThickness =
200 waterThickness += 2*effectiveWaterThickness;
202 double effectiveKaptonThickness =
203 (TMath::Pi()*(waterPipeOuterDiameter * waterPipeOuterDiameter)/4.)/
206 kaptonThickness += 2*(effectiveKaptonThickness - effectiveWaterThickness);
209 TGeoTube *wpipe =
new TGeoTube(waterPipeName,
211 0.1 * waterPipeOuterDiameter/2,
212 0.1 * mAssemblyLength/2);
213 TGeoVolume *vwpipe =
new TGeoVolume(waterPipeName, wpipe,
GetMedium(mKaptonMaterial));
216 TGeoTube *water =
new TGeoTube(waterName,
219 0.1 * mAssemblyLength/2);
222 TGeoRotation *
rw =
new TGeoRotation();
227 mWaterPipeZoffset = zOffset + waterPipeOuterDiameter/2;
229 for(
unsigned lr=0; lr<2; lr++) {
230 double xOffset = (lr ? -1.0 : 1.0)*mWaterPipeXoffset;
232 vcell->AddNode(vwpipe, lr,
new TGeoCombiTrans(0.1 * xOffset, 0.0, 0.1 * mWaterPipeZoffset, rw));
233 vcell->AddNode(vwater, lr,
new TGeoCombiTrans(0.1 * xOffset, 0.0, 0.1 * mWaterPipeZoffset, rw));
255 TGeoTube *abeam =
new TGeoTube(apexEnforcementBeamName,
258 0.1 * mAssemblyLength/2);
259 TGeoVolume *vabeam =
new TGeoVolume(apexEnforcementBeamName, abeam,
GetMedium(mCarbonFiberMaterial));
261 TGeoRotation *
rw =
new TGeoRotation();
265 double hOffset = zOffset +
267 vcell->AddNode(vabeam, 0,
new TGeoCombiTrans(0.0, 0.0, 0.1 * hOffset, rw));
272 double length = 0.1 * mAssemblyLength;
274 double vert[8][2] = {
286 TGeoArb8 *bbeam =
new TGeoArb8(baseEnforcementBeamName, 0.1 * baseBeamHeight/2, (
double*)vert);
287 TGeoVolume *vbbeam =
new TGeoVolume(baseEnforcementBeamName, bbeam,
GetMedium(mCarbonFiberMaterial));
289 double hOffset = zOffset + baseBeamHeight/2;
291 for(
unsigned lr=0; lr<2; lr++) {
294 TGeoRotation *rw =
new TGeoRotation();
295 if (lr) rw->RotateZ(180);
297 vcell->AddNode(vbbeam, lr,
new TGeoCombiTrans(0.1 * xOffset, 0.0, 0.1 * hOffset, rw));
312 double slotHeight = sideWallWidth;
314 double radSlope = atan(slotWidth/slotHeight);
315 double degSlope = radSlope*180./TMath::Pi();
317 double beamLength = sqrt(slotWidth*slotWidth + slotHeight*slotHeight) -
320 double fullThickness;
333 TGeoBBox *side =
new TGeoBBox(sideWallName,
334 0.1 * sideWallWidth/2,
335 0.1 * mAssemblyLength/2,
336 0.1 * fullThickness/2);
339 vside =
new TGeoVolume(sideWallName, side,
GetMedium(mCarbonFiberMaterial));
345 TGeoBBox *flat =
new TGeoBBox(flatRoofName,
346 0.1 * sideWallWidth/2,
347 0.1 * mAssemblyLength/2,
349 TGeoVolume *vflat =
new TGeoVolume(flatRoofName, flat,
GetMedium(mCarbonFiberMaterial));
357 TGeoBBox *
beam =
new TGeoBBox(roofSideBeamName,
361 TGeoVolume *vbeam =
new TGeoVolume(roofSideBeamName, beam,
GetMedium(mCarbonFiberMaterial));
363 for(
unsigned iq=0; iq<4; iq++) {
364 double qOffset = (mAssemblyLength/4)*(iq - 1.5);
366 TGeoRotation *
rw =
new TGeoRotation();
367 rw->RotateZ((iq%2 ? -1. : 1.)*degSlope);
369 vside->AddNode(vbeam, iq,
new TGeoCombiTrans(0.0, 0.1 * qOffset, -0.1 * mcell->
mSideWallThickness/2, rw));
376 double hOffset = zOffset + (fullThickness/2)*
cos(radangle) + (sideWallWidth/2)*sin(radangle);
378 for(
unsigned lr=0; lr<2; lr++) {
380 (fullThickness/2)*sin(radangle) -
381 (sideWallWidth/2)*
cos(radangle));
383 TGeoRotation *
rw =
new TGeoRotation();
389 vcell->AddNode(vside, lr,
new TGeoCombiTrans(0.1 *xOffset, 0.0, 0.1 * hOffset, rw));
403 double aluRadLen, kaptonRadLen, carbonRadLen, waterRadLen;
408 kaptonRadLen = 0.1 * kaptonThickness /
GetMedium(mKaptonMaterial)->GetMaterial()->GetRadLen();
409 carbonRadLen = 0.1 * carbonThickness /
GetMedium(mCarbonFiberMaterial)->GetMaterial()->GetRadLen();
410 waterRadLen = 0.1 * waterThickness /
GetMedium(
_WATER_)->GetMaterial()->GetRadLen();
414 double equivalentCarbonThickness = 10. * (aluRadLen + kaptonRadLen + carbonRadLen + waterRadLen)*
415 GetMedium(mCarbonFiberMaterial)->GetMaterial()->GetRadLen();
421 double offsetFromBottomSide = mMimosaOffset + mAssemblyHeight/2;
423 double equivalentFlexThickness =
424 equivalentCarbonThickness < offsetFromBottomSide ? equivalentCarbonThickness : offsetFromBottomSide;
426 TGeoBBox *flex =
new TGeoBBox(flexName,
428 0.1 * mAssemblyLength/2,
429 0.1 * equivalentFlexThickness/2);
430 TGeoVolume *vflex =
new TGeoVolume(flexName, flex,
GetMedium(mCarbonFiberMaterial));
432 vcell->AddNode(vflex, 0,
new TGeoCombiTrans(0.0, 0.0, 0.1 * (equivalentFlexThickness - mAssemblyHeight)/2, 0));
434 double equivalentColdThickness = equivalentCarbonThickness - equivalentFlexThickness;
436 if (equivalentColdThickness > 0.0) {
438 TGeoBBox *cold =
new TGeoBBox(coldPlateName,
440 0.1 * mAssemblyLength/2,
441 0.1 * equivalentColdThickness/2);
442 TGeoVolume *vcold =
new TGeoVolume(coldPlateName, cold,
GetMedium(mCarbonFiberMaterial));
446 vcell->AddNode(vcold, 0,
new TGeoCombiTrans(0.0, 0.0, 0.1 * (zOffset + equivalentColdThickness/2), 0));
459 const char *detName = mDetName->Name().Data();
461 TGeoVolume *vcell = ConstructMimosaCell(mcell,
id);
463 char staveName[128], waterPipeName[128], waterName[128];
464 char bracketName[128], waterTorusPipeName[128], waterTorusName[128];
466 snprintf(staveName, 128-1,
"%sStave%02d", detName,
id);
467 snprintf(bracketName, 128-1,
"%sStaveBracket%02d", detName,
id);
468 snprintf(waterTorusPipeName, 128-1,
"%sStaveWaterPipeTorus%02d", detName,
id);
469 snprintf(waterTorusName, 128-1,
"%sStaveWaterTorus%02d", detName,
id);
470 snprintf(waterPipeName, 128-1,
"%sStaveWaterPipe%02d", detName,
id);
471 snprintf(waterName, 128-1,
"%sStaveWater%02d", detName,
id);
485 stave->
mLength = GetExpectedStaveLength(chipNum, mcell);
487 if (UseTriangularAssemblies()) {
488 TGeoTrd1 *qstave =
new TGeoTrd1(staveName,
492 0.1 * mAssemblyHeight/2);
496 char tmp1Name[128], tmp2Name[128];
498 snprintf(tmp1Name, 128-1,
"%sTmp1Volume%02d", detName,
id);
499 snprintf(tmp2Name, 128-1,
"%sTmp2Volume%02d", detName,
id);
503 TGeoTrd1 *
tmp1 =
new TGeoTrd1(tmp1Name,
507 0.1 * mAssemblyHeight/2);
508 TGeoBBox *
tmp2 =
new TGeoBBox(tmp2Name,
512 0.1 * mAssemblyHeight/2);
513 TGeoCompositeShape *cs =
new TGeoCompositeShape(staveName, TString(tmp1Name) +
"*" + TString(tmp2Name));
519 for(
unsigned nn=0; nn<chipNum; nn++) {
520 double yOffset = (nn - 0.5*(chipNum-1))*mAssemblyLength;
522 stave->
mVolume->AddNode(vcell, nn,
new TGeoCombiTrans(0.0, 0.1 * yOffset, 0.0, 0));
526 if (WithEnforcementBrackets()) {
527 TGeoTrd1 *bracket =
new TGeoTrd1(bracketName,
530 0.1 * mEnforcementBracketThickness/2,
531 0.1 * mAssemblyHeight/2);
532 TGeoVolume *vbracket =
new TGeoVolume(bracketName, bracket,
GetMedium(mCarbonFiberMaterial));
534 for(
unsigned ud=0; ud<2; ud++) {
535 double yOffset = (ud ? -1.0 : 1.0)*(chipNum * mAssemblyLength + mEnforcementBracketThickness)/2;
537 stave->
mVolume->AddNode(vbracket, ud,
new TGeoCombiTrans(0.0, 0.1 * yOffset, 0.0, 0));
541 if (WithExternalPipes() &&
547 TGeoTube *wpipe =
new TGeoTube(waterPipeName,
549 0.1 * waterPipeOuterDiameter/2,
550 0.1 * mWaterPipeExtensionLength/2);
551 TGeoVolume *vwpipe =
new TGeoVolume(waterPipeName, wpipe,
GetMedium(mKaptonMaterial));
554 TGeoTube *water =
new TGeoTube(waterName,
557 0.1 * mWaterPipeExtensionLength/2);
560 TGeoRotation *
rw =
new TGeoRotation();
563 for(
unsigned lr=0; lr<2; lr++) {
564 double xOffset = (lr ? -1.0 : 1.0)*mWaterPipeXoffset;
565 double yOffset = (stave->
mLength - mWaterPipeExtensionLength)/2;
567 stave->
mVolume->AddNode(vwpipe, lr,
new TGeoCombiTrans(0.1 * xOffset, 0.1 * yOffset, 0.1 * mWaterPipeZoffset, rw));
568 stave->
mVolume->AddNode(vwater, lr,
new TGeoCombiTrans(0.1 * xOffset, 0.1 * yOffset, 0.1 * mWaterPipeZoffset, rw));
574 TGeoTorus *wtpipe =
new TGeoTorus(waterTorusPipeName,
575 0.1 * mWaterPipeXoffset,
577 0.1 * waterPipeOuterDiameter/2,
579 TGeoVolume *vwtpipe =
new TGeoVolume(waterTorusPipeName, wtpipe,
GetMedium(mKaptonMaterial));
583 TGeoTorus *twater =
new TGeoTorus(waterTorusName,
584 0.1 * mWaterPipeXoffset,
588 TGeoVolume *vtwater =
new TGeoVolume(waterTorusName, twater,
GetMedium(
_WATER_));
590 double qyOffset = chipNum * mAssemblyLength/2 + mEnforcementBracketThickness;
591 stave->
mVolume->AddNode(vwtpipe, 0,
new TGeoCombiTrans(0.0, -0.1 * qyOffset, 0.1 * mWaterPipeZoffset, 0));
592 stave->
mVolume->AddNode(vtwater, 0,
new TGeoCombiTrans(0.0, -0.1 * qyOffset, 0.1 * mWaterPipeZoffset, 0));
604 MapsStave *stave = ConstructStave(chipNum,
id, mcell);
622 for(
unsigned nn=0; nn<chipNum; nn++) {
623 UInt_t geant[4] = {0, 0, nn, 0}, logical[1] = {nn};
625 if (SetMappingTableEntry(fgmap, geant,
id, logical)) {
626 cout <<
"Failed to set mapping table entry!" << endl;