297 {
298
299 ATH_MSG_INFO(
"**************************************************");
300 ATH_MSG_INFO(
" Building HGTD geometry , side = " << bPos <<
" ");
301 ATH_MSG_INFO(
"**************************************************" );
302
303 GeoFullPhysVol* HGTDparent = new GeoFullPhysVol( logicalEnvelope );
304
305
306 double motherHalfZ = ((GeoTube*) HGTDparent->getLogVol()->getShape())->getZHalfLength();
307 double modulePackageHalfZtot = 3.5/2 + 4./2;
308
312
313
314 std::vector<std::string> hgtdVolumes;
315 hgtdVolumes.push_back("HGTD::ModeratorOut");
316 hgtdVolumes.push_back("HGTD::BackCover");
317 hgtdVolumes.push_back("HGTD::ToleranceBack");
318 hgtdVolumes.push_back("HGTD::ModeratorIn");
319
320 hgtdVolumes.push_back("HGTD::ModuleLayer3");
321 hgtdVolumes.push_back("HGTD::SupportPlate");
322 hgtdVolumes.push_back("HGTD::CoolingPlate");
323 hgtdVolumes.push_back("HGTD::SupportPlate");
324 hgtdVolumes.push_back("HGTD::ModuleLayer2");
325
326 hgtdVolumes.push_back("HGTD::ToleranceMid");
327
328 hgtdVolumes.push_back("HGTD::ModuleLayer1");
329 hgtdVolumes.push_back("HGTD::SupportPlate");
330 hgtdVolumes.push_back("HGTD::CoolingPlate");
331 hgtdVolumes.push_back("HGTD::SupportPlate");
332 hgtdVolumes.push_back("HGTD::ModuleLayer0");
333
334 hgtdVolumes.push_back("HGTD::ToleranceFront");
335 hgtdVolumes.push_back("HGTD::FrontCover");
336
337 hgtdVolumes.push_back("HGTD::InnerRCover1");
338 hgtdVolumes.push_back("HGTD::InnerRCover2");
339 hgtdVolumes.push_back("HGTD::InnerRCover3");
340 hgtdVolumes.push_back("HGTD::OuterRCover");
341 hgtdVolumes.push_back("HGTD::PeripheralCoolingLines");
342
343
344
345
347
349
350
351
352
353 GeoCylVolParams packagePars =
m_cylVolPars[
"HGTD::FlexPackage"];
354 GeoCylVolParams flexPars =
m_cylVolPars[
"HGTD::FlexTube"];
355 std::vector<double> flexSheetInnerR;
356 double currentInnerR = 144.;
357 for (int flexSheet = 0; flexSheet < 8; flexSheet++) {
358 flexSheetInnerR.push_back(currentInnerR);
359
360 currentInnerR +=
m_boxVolPars[
"HGTDModule0"].xHalf*2 * (2 + 2 * (flexSheet < 4 ? 0.2 : 0.8) );
361 }
362
363
364 GeoPhysVol* flexPackagePhysical[2] = {};
365 for (int flexVolume = 0; flexVolume < 2; flexVolume++) {
366 std::vector<double> rInner = flexSheetInnerR;
367 if (flexVolume)
reverse(rInner.begin(), rInner.end());
368
369 GeoTube* flexPackageSolid =
new GeoTube(packagePars.
rMin, packagePars.
rMax, packagePars.
zHalf);
370 GeoLogVol* flexPackageLogical =
new GeoLogVol(packagePars.
name, flexPackageSolid,
m_materialMgr->getMaterial(packagePars.
material));
371 flexPackagePhysical[flexVolume] = new GeoPhysVol(flexPackageLogical);
372
373 double flexZoffset = packagePars.
zHalf - flexPars.
zHalf;
374 for (int flexSheet = 0; flexSheet < 8; flexSheet++) {
375 GeoTube* hgtdFlexSolid =
new GeoTube(rInner[flexSheet], flexPars.
rMax, flexPars.
zHalf);
376 GeoLogVol* hgtdFlexLogical = new GeoLogVol("HGTD::FlexTube"+std::to_string(flexSheet),
378 GeoPhysVol* hgtdFlexPhysical = new GeoPhysVol(hgtdFlexLogical);
379 flexPackagePhysical[flexVolume]->add(new GeoTransform(GeoTrf::TranslateZ3D(flexZoffset)));
380 flexPackagePhysical[flexVolume]->add(hgtdFlexPhysical);
381
382 ATH_MSG_DEBUG(
"Flex layer (" << (flexSheet ?
"front" :
"back") <<
")" << flexSheet <<
", Rmin = " << std::setw(5)
383 << rInner[flexSheet] << " mm, flexZoffset = " << flexZoffset << " mm" );
384 flexZoffset = flexZoffset -
m_hgtdPars.flexSheetSpacing;
385 }
386 }
387
389
391
392
393 std::vector<double> coolingTubeRadii;
394 double coolingTubeRadius = 130.;
395 coolingTubeRadii.push_back(coolingTubeRadius);
396
397
399 ATH_MSG_INFO(
"Will now calculate cooling-loop positions for the two-ring layout");
400 for (
int i = 0;
i < 18;
i++) {
401 coolingTubeRadius += (418-130.)/18;
402 coolingTubeRadii.push_back(coolingTubeRadius);
403 }
404 for (
int i = 0;
i < 12;
i++) {
405 coolingTubeRadius += (658-418.)/14;
406 coolingTubeRadii.push_back(coolingTubeRadius);
407 }
408 coolingTubeRadius = 710.;
409 coolingTubeRadii.push_back(coolingTubeRadius);
410 for (
int i = 0;
i < 7;
i++) {
411 coolingTubeRadius += (890-710.)/6;
412 coolingTubeRadii.push_back(coolingTubeRadius);
413 }
414 }
416 ATH_MSG_INFO(
"Will now calculate cooling-loop positions for the three-ring layout");
417
418 int numberOfLoops = 34;
419 float loopDistance = (674.-130.)/numberOfLoops;
420 for (
int i = 0;
i < numberOfLoops;
i++) {
421 coolingTubeRadius += loopDistance;
422 coolingTubeRadii.push_back(coolingTubeRadius);
423 }
424
425 coolingTubeRadius = 720;
426 coolingTubeRadii.push_back(coolingTubeRadius);
427 numberOfLoops = 6;
428 loopDistance = (900.-720.)/numberOfLoops;
429 for (
int i = 0;
i < numberOfLoops;
i++) {
430 coolingTubeRadius += loopDistance;
431 coolingTubeRadii.push_back(coolingTubeRadius);
432 }
433 }
434 ATH_MSG_DEBUG(
"Cooling tubes will be created at the following radii (" << coolingTubeRadii.size() <<
" in total):");
435 for (
size_t i = 0;
i < coolingTubeRadii.size();
i++) {
437 }
438
440
442
443
444 GeoCylVolParams periphElPars =
m_cylVolPars[
"HGTD::PeriphElec"];
445 GeoTube* periphElec_solid =
new GeoTube(periphElPars.
rMin, periphElPars.
rMax, periphElPars.
zHalf);
446 GeoLogVol* periphElec_log =
new GeoLogVol(periphElPars.
name, periphElec_solid,
m_materialMgr->getMaterial(periphElPars.
material));
447 GeoPhysVol* periphElec_phys = new GeoPhysVol(periphElec_log);
448
449 std::array< GeoPhysVol*, 4 > moduleLayerPhysical = {};
450
452
454
455
456 double zModuleLayerF = 0.;
457 double zModuleLayerB = 0.;
458 for (size_t vol = 0; vol < hgtdVolumes.size(); vol++) {
459
460 std::string
v = hgtdVolumes[vol];
461
462
463 if (vol == 0)
465
466
467
468 else {
469 if (
v.substr(9,8) !=
"erRCover" && v !=
"HGTD::PeripheralCoolingLines") {
470 std::string vPrev = hgtdVolumes[vol-1];
472 }
473 }
474
475
476 if (
v.substr(0,15) ==
"HGTD::Tolerance")
continue;
477
478 float safety = 0.;
479 if (
v.substr(0,17) ==
"HGTD::ModuleLayer")
480 safety = 10.;
481
482
485 GeoPhysVol* hgtdSubVolumePhysical = new GeoPhysVol(hgtdSubVolumeLogical);
486
487
488 if (v == "HGTD::CoolingPlate") {
490
491 static constexpr std::array<int,2> signArr{1,-1};
492 for (
int side = 0;
side < 2;
side++) {
493
494 HGTDparent->add(
new GeoTransform(GeoTrf::TranslateZ3D(
m_cylVolPars[v].zOffsetLocal + signArr[side]*zOffsetPeriphElec)));
495 HGTDparent->add(periphElec_phys);
496 }
497
498
499 for (
size_t i = 0;
i < coolingTubeRadii.size();
i++) {
500
501 GeoTorus* coolingTubeSolid =
new GeoTorus(
m_cylVolPars[
"HGTD::CoolingTubeFluid"].zHalf,
m_cylVolPars[
"HGTD::CoolingTube"].zHalf,
502 coolingTubeRadii[i], 0, 2*
M_PI);
503 GeoLogVol* coolingTubeLogical = new GeoLogVol("HGTD::CoolingTube", coolingTubeSolid,
505 GeoPhysVol* coolingTubePhysical = new GeoPhysVol(coolingTubeLogical);
506 hgtdSubVolumePhysical->add(coolingTubePhysical);
507
508 GeoTorus* coolingFluidSolid =
new GeoTorus(0,
m_cylVolPars[
"HGTD::CoolingTubeFluid"].zHalf,
509 coolingTubeRadii[i], 0, 2*
M_PI);
510 GeoLogVol* coolingFluidLogical = new GeoLogVol("HGTD::CoolingFluid", coolingFluidSolid,
512 GeoPhysVol* coolingFluidPhysical = new GeoPhysVol(coolingFluidLogical);
513 hgtdSubVolumePhysical->add(coolingFluidPhysical);
514 }
515 }
516
517
518 if (
v.substr(0,17) ==
"HGTD::ModuleLayer") {
519
521
522
523 double zFlex = 0.;
524 bool Lside =
layer % 2;
525 if (Lside == 0) {
526 zFlex = -modulePackageHalfZtot +
m_cylVolPars[
"HGTD::FlexPackage"].zHalf;
527 zModuleLayerF = modulePackageHalfZtot - modulePackageHalfZ;
528 }
529 else {
530 zFlex = modulePackageHalfZtot -
m_cylVolPars[
"HGTD::FlexPackage"].zHalf;
531 zModuleLayerB = -modulePackageHalfZtot + modulePackageHalfZ;
532 }
533
534
535 hgtdSubVolumePhysical->add(new GeoTransform(GeoTrf::TranslateZ3D(zFlex)));
536 hgtdSubVolumePhysical->add(flexPackagePhysical[(Lside ? 0 : 1)]);
537
539
540 HGTDparent->add(
new GeoTransform( GeoTrf::TranslateZ3D(
m_cylVolPars[v].zOffsetLocal) *
541 GeoTrf::RotateZ3D(diskRotation*Gaudi::Units::deg)) );
542
543
544 HGTDparent->add( hgtdSubVolumePhysical );
545 moduleLayerPhysical[
layer] = hgtdSubVolumePhysical;
546
547 }
548 else {
549 HGTDparent->add(
new GeoTransform(GeoTrf::TranslateZ3D(
m_cylVolPars[v].zOffsetLocal)));
550 HGTDparent->add(hgtdSubVolumePhysical);
551 }
552
553
555 <<
" ), local z = " << std::setw(6) <<
m_cylVolPars[v].zOffsetLocal
556 <<
" mm, Rmin = " << std::setw(4) <<
m_cylVolPars[v].rMin
557 <<
" mm, Rmax = " << std::setw(4) <<
m_cylVolPars[v].rMax
558 <<
" mm, DZ = " << std::setw(5) <<
m_cylVolPars[v].zHalf <<
" mm" );
559
560 }
561
563
565
566
567 std::vector<std::string> moduleVolumes;
568 moduleVolumes.push_back("HGTD::GlueAsic");
569 moduleVolumes.push_back("HGTD::ASIC");
570 moduleVolumes.push_back("HGTD::LGADInactive");
571 moduleVolumes.push_back("SensorPlaceHolder");
572 moduleVolumes.push_back("HGTD::GlueSensor");
573 moduleVolumes.push_back("HGTD::Hybrid");
574 moduleVolumes.push_back("HGTD::ModuleSpace");
575
576 int endcap = bPos ? +2 : -2;
577 double thickness = 2.*
m_boxVolPars[
"HGTDSiSensor0"].zHalf;
579
580
581
582
583 int totMod = 0;
584
585 unsigned int maxRows = 21;
587
589
590
592
595
596 int Lside =
layer % 2;
597
598 std::vector<std::string> volumes = moduleVolumes;
599 if ( Lside != 0 )
reverse( volumes.begin(), volumes.end() );
600
601 std::string sensorName = std::string("HGTDSiSensor") + std::to_string(layer);
602 std::string moduleName = std::string("HGTDModule") + std::to_string(layer);
603
604
605
606
607
608 double moduleHalfWidth =
m_boxVolPars[moduleName].xHalf;
609 double moduleHalfHeight =
m_boxVolPars[moduleName].yHalf;
610
611
612
614
615 for (
int q = 0;
q < 4;
q++) {
616 float quadrot =
q*90.;
617
618 for (
unsigned int row = 0;
row < maxRows;
row ++ ) {
619 std::vector< ModulePosition > ModsPerRow = tmpQuadrant[
row ];
620
621
622 if (
m_outputIdfr && q == 0 ) std::cout <<
" Row #"<<
row + 1 <<
" :: " << ModsPerRow.size() << std::endl;
623
624 for (
unsigned int mod = 0;
mod < ModsPerRow.size();
mod ++ ) {
625 ModulePosition
module = ModsPerRow[
mod ];
626
627 double myx = -9999999.9 , myy = -9999999.9 , myrot = -9999999.9;
628 int myphi = -1 , myeta = - 1;
629 std::string module_string =
formModuleName( layer, q, maxRows, row, mod, module, myx, myy, myrot, myphi, myeta );
630
631 if ( module_string == "" || myrot == -9999999.9 || myeta == -1 )
632 ATH_MSG_WARNING (
" Please check the module at layer "<< layer <<
" quadrant " << q <<
" row "<< row <<
" mod " << mod <<
" not well retrieved ! " );
633
634
635 GeoBox* moduleSolid = new GeoBox( moduleHalfWidth, moduleHalfHeight, modulePackageHalfZ);
636 GeoLogVol* moduleLogical =
new GeoLogVol( moduleName + module_string, moduleSolid,
m_materialMgr->getMaterial(
"std::Air"));
637 GeoFullPhysVol* modulePhysical = new GeoFullPhysVol( moduleLogical );
638
639
640 if ( q == 0 && row == 0 && mod == 0 )
641 ATH_MSG_DEBUG(
"Will now build up an individual HGTD module of layer " << layer <<
" and quadrant " << q <<
" (" << module_string <<
")" );
642
643
644 for (
size_t comp = 0;
comp < volumes.size();
comp++) {
645 if (volumes[comp] ==
"SensorPlaceHolder") volumes[
comp] = sensorName;
646
647 std::string
c = volumes[
comp];
648
649 if (comp == 0)
651 else {
652 std::string cPrev = volumes[
comp-1];
654 }
655
656
657 if (volumes[comp] == "HGTD::ModuleSpace") continue;
658
661
662
663 double xOffsetLocal = moduleHalfWidth - comp_halfx;
664
665
666 GeoBox* sensorCompSolidVol =
new GeoBox(comp_halfx, comp_halfy,
m_boxVolPars[c].zHalf);
667
668 std::string attach = (volumes[
comp] == sensorName) ?
"" :
"_L" + std::
to_string(
layer ) + module_string;
669
670 GeoLogVol* sensorCompLogicalVol =
new GeoLogVol(
m_boxVolPars[c].name+attach, sensorCompSolidVol,
672 GeoFullPhysVol* sensorCompPhysicalVol = new GeoFullPhysVol(sensorCompLogicalVol);
673
674 if (volumes[comp] == sensorName) {
675 const HGTD_ID* hgtdId =
dynamic_cast<const HGTD_ID*
>(
m_athComps->getIdHelper() );
676 Identifier idwafer = hgtdId->
wafer_id( endcap, layer, myphi, myeta );
677
678
679 if ( q == 0 && ( mod == 0 || mod == ( ModsPerRow.size() - 1 ) ) && !
m_outputIdfr ) {
681 << " upon HGTD_ID => ec: " << endcap << ", layer: " << layer << ", quadrant: " << q
682 << ", row: " << myphi <<", module: "<< myeta );
683 ATH_MSG_DEBUG(
" HGTD Module: " <<
m_boxVolPars[c].name+module_string <<
", posX: " << myx <<
", posY: " << myy <<
", rot: " << quadrot + myrot );
684 }
685
686 InDetDD::HGTD_DetectorElement* detElement =
new InDetDD::HGTD_DetectorElement(idwafer, moduleDesign, sensorCompPhysicalVol,
m_commonItems.get());
688
689 GeoTrf::Transform3D sensorTransform = GeoTrf::TranslateZ3D(
m_boxVolPars[c].zOffsetLocal)*GeoTrf::TranslateX3D(xOffsetLocal);
690 GeoAlignableTransform* xform = new GeoAlignableTransform(sensorTransform);
691
692 modulePhysical->add( xform );
693 modulePhysical->add( sensorCompPhysicalVol );
694
695 totMod ++;
696 }
697 else {
698 modulePhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(
m_boxVolPars[c].zOffsetLocal)*GeoTrf::TranslateX3D(xOffsetLocal)));
699 modulePhysical->add(sensorCompPhysicalVol);
700 }
701
702
703 if ( mod == 0 && q == 0 && volumes[comp] != sensorName )
705 <<
" ), in-sensor-layer local z = " << std::setw(7) <<
m_boxVolPars[c].zOffsetLocal <<
" mm"
706 <<
", DX = " << std::setw(5) <<
m_boxVolPars[c].xHalf <<
" mm"
707 <<
", DY = " << std::setw(5) <<
m_boxVolPars[c].yHalf <<
" mm"
708 <<
", DZ = " << std::setw(5) <<
m_boxVolPars[c].zHalf <<
" mm" );
709 }
710
711 double zModule = ( Lside == 0 ? zModuleLayerF : zModuleLayerB );
712
713 GeoTransform* moduleTransform = new GeoTransform( GeoTrf::TranslateZ3D(zModule) *
714 GeoTrf::TranslateX3D(myx) *
715 GeoTrf::TranslateY3D(myy) *
716 GeoTrf::RotateZ3D( ( quadrot + myrot )*Gaudi::Units::deg) );
717 moduleLayerPhysical[
layer]->add( moduleTransform );
718 moduleLayerPhysical[
layer]->add( modulePhysical );
719 }
721 }
723 }
725 }
726
727 ATH_MSG_INFO(
"**************************************************" );
728 ATH_MSG_INFO(
" Done building HGTD with " << totMod <<
" modules " );
729 ATH_MSG_INFO(
"**************************************************" );
730
731 return HGTDparent;
732}
#define ATH_MSG_WARNING(x)
std::array< std::vector< ModulePosition >, 21 > PositionsInQuadrant
InDetDD::HGTD_ModuleDesign * createHgtdDesign(double thickness)
std::map< std::string, GeoBoxVolParams > m_boxVolPars
std::string formModuleName(int layer, int quadrant, unsigned int maxrows, int row, int mod, const ModulePosition &module, double &myx, double &myy, double &myrot, int &phi, int &eta)
std::map< std::string, GeoCylVolParams > m_cylVolPars
void mirrorPositionsAroundYaxis(std::array< PositionsInQuadrant, 4 > &arr)
std::array< PositionsInQuadrant, 4 > prepareLayersFromQuadrants(unsigned int)
Identifier wafer_id(int endcap, int layer, int phi_module, int eta_module) const
For a single crystal.
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
int atoi(std::string_view str)
Helper functions to unpack numbers decoded in string into integers and doubles The strings are requir...
row
Appending html table to final .html summary file.
void reverse(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of reverse for DataVector/List.