23 #include "GeoModelKernel/GeoNameTag.h"
24 #include "GeoModelKernel/GeoIdentifierTag.h"
25 #include "GeoModelKernel/GeoMaterial.h"
26 #include "GeoModelKernel/GeoTransform.h"
27 #include "GeoModelKernel/GeoAlignableTransform.h"
28 #include "GeoModelKernel/GeoTorus.h"
29 #include "GeoModelKernel/GeoTube.h"
30 #include "GeoModelKernel/GeoBox.h"
31 #include "GeoModelKernel/GeoPhysVol.h"
32 #include "GeoModelKernel/GeoFullPhysVol.h"
38 #include "GaudiKernel/SystemOfUnits.h"
61 m_athComps( athComps ),
62 m_materialMgr( nullptr ),
64 m_outputIdfr( false ) {
68 ATH_MSG_INFO(
"HGTD geometry from hard-coded definition - No Information being taken from Geometry Tag!" );
97 constexpr
float zMother = 3482.5;
104 world->add(
new GeoNameTag(
"HGTD_Pos"));
105 world->add(
new GeoIdentifierTag(9));
106 ATH_MSG_INFO(
"HGTD_Pos mother volume will be placed at z = " << zMother <<
" mm" );
107 world->add(
new GeoTransform(GeoTrf::TranslateZ3D(zMother)));
108 GeoVPhysVol* endcapPos =
build( positiveEndcapLogicalVolume,
true);
109 world->add( endcapPos );
113 world->add(
new GeoNameTag(
"HGTD_Neg"));
114 world->add(
new GeoIdentifierTag(-9));
115 ATH_MSG_INFO(
"HGTD_Neg mother volume will be placed at z = " << -zMother <<
" mm" );
116 world->add(
new GeoTransform(GeoTrf::TranslateZ3D(-zMother)));
118 GeoVPhysVol* endcapNeg =
build( negativeEndcapLogicalVolume,
false);
119 world->add( endcapNeg );
133 if (
sc != StatusCode::SUCCESS) {
134 ATH_MSG_ERROR(
"Cannot retrieve material manager from DetStore");
166 GeoMaterial* CFiberSupport =
new GeoMaterial(
"hgtd::CFiberSupport", 0.189*(
CLHEP::gram /
CLHEP::cm3));
178 GeoMaterial* BoratedPolyethelyne =
new GeoMaterial(
"hgtd::BoratedPolyethelyne", 0.99*(
CLHEP::gram /
CLHEP::cm3));
201 m_boxVolPars[
"HGTDModule0"] = {
"HGTDModule0", 11, 20, 1.75, 0,
"std::Air"};
202 m_boxVolPars[
"HGTDModule1"] = {
"HGTDModule1", 11, 20, 1.75, 0,
"std::Air"};
203 m_boxVolPars[
"HGTDModule2"] = {
"HGTDModule2", 11, 20, 1.75, 0,
"std::Air"};
204 m_boxVolPars[
"HGTDModule3"] = {
"HGTDModule3", 11, 20, 1.75, 0,
"std::Air"};
205 m_boxVolPars[
"HGTD::Hybrid"] = {
"HGTD::Hybrid", 10.25, 20, .175, 0,
"hgtd::CuKapton"};
206 m_boxVolPars[
"HGTD::GlueSensor"] = {
"HGTD::GlueSensor", 10.25, 20, .04, 0,
"hgtd::Epoxy"};
207 m_boxVolPars[
"HGTD::GlueAsic"] = {
"HGTD::GlueAsic", 11, 20, .04, 0,
"hgtd::Epoxy"};
208 m_boxVolPars[
"HGTDSiSensor0"] = {
"HGTDSiSensor0", 10.25, 20, .025, 0,
"std::Silicon"};
209 m_boxVolPars[
"HGTDSiSensor1"] = {
"HGTDSiSensor1", 10.25, 20, .025, 0,
"std::Silicon"};
210 m_boxVolPars[
"HGTDSiSensor2"] = {
"HGTDSiSensor2", 10.25, 20, .025, 0,
"std::Silicon"};
211 m_boxVolPars[
"HGTDSiSensor3"] = {
"HGTDSiSensor3", 10.25, 20, .025, 0,
"std::Silicon"};
212 m_boxVolPars[
"HGTD::LGADInactive"] = {
"HGTD::LGADInactive", 10.25, 20, .1, 0,
"std::Silicon"};
213 m_boxVolPars[
"HGTD::ASIC"] = {
"HGTD::ASIC", 11, 20, .15, 0,
"std::Silicon"};
217 double moduleSpaceHalfZ = 0.225;
218 m_boxVolPars[
"HGTD::ModuleSpace"] = {
"HGTD::ModuleSpace", 11, 20, moduleSpaceHalfZ, 0,
"std::Air"};
223 m_cylVolPars[
"HGTD_mother"] = {
"HGTD_mother", 100, 1100, 62.5, -3252,
"std::Air"};
224 m_cylVolPars[
"HGTD::FrontCover"] = {
"HGTD::FrontCover", 120, 1000, 7.5, 0,
"hgtd::CFiberSupport"};
225 m_cylVolPars[
"HGTD::FlexPackage"] = {
"HGTD::FlexPackage", 120, 660, 2, 0,
"std::Air"};
226 m_cylVolPars[
"HGTD::FlexTube"] = {
"HGTD::FlexTube", 120, 660, .175, 0,
"hgtd::CuKapton"};
227 m_cylVolPars[
"HGTD::ModuleLayer0"] = {
"HGTD::ModuleLayer0", 120, 660, 3.75, 0,
"std::Air"};
228 m_cylVolPars[
"HGTD::ModuleLayer1"] = {
"HGTD::ModuleLayer1", 120, 660, 3.75, 0,
"std::Air"};
229 m_cylVolPars[
"HGTD::ModuleLayer2"] = {
"HGTD::ModuleLayer2", 120, 660, 3.75, 0,
"std::Air"};
230 m_cylVolPars[
"HGTD::ModuleLayer3"] = {
"HGTD::ModuleLayer3", 120, 660, 3.75, 0,
"std::Air"};
231 m_cylVolPars[
"HGTD::CoolingPlate"] = {
"HGTD::CoolingPlate", 120, 920, 3, 0,
"std::Aluminium"};
232 m_cylVolPars[
"HGTD::SupportPlate"] = {
"HGTD::SupportPlate", 120, 660, .5, 0,
"std::Aluminium"};
233 m_cylVolPars[
"HGTD::ToleranceFront"] = {
"HGTD::ToleranceFront", 120, 660, 1, 0,
"std::Air"};
234 m_cylVolPars[
"HGTD::ToleranceBack"] = {
"HGTD::ToleranceBack", 120, 660, 1, 0,
"std::Air"};
235 m_cylVolPars[
"HGTD::ToleranceMid"] = {
"HGTD::ToleranceMid", 120, 660, 1, 0,
"std::Air"};
236 m_cylVolPars[
"HGTD::ModeratorIn"] = {
"HGTD::ModeratorIn", 120, 900, 15, 0,
"hgtd::BoratedPolyethelyne"};
237 m_cylVolPars[
"HGTD::ModeratorOut"] = {
"HGTD::ModeratorOut", 120, 1100, 10, 0,
"hgtd::BoratedPolyethelyne"};
238 m_cylVolPars[
"HGTD::BackCover"] = {
"HGTD::BackCover", 120, 1100, 4, 0,
"hgtd::CFiberSupport"};
239 m_cylVolPars[
"HGTD::PeriphElec"] = {
"HGTD::PeriphElec", 674, 900, 1, 2,
"hgtd::FEBoards"};
241 m_cylVolPars[
"HGTD::InnerRCover1"] = {
"HGTD::InnerRCover1", 110., 111., 105./2, -10.,
"hgtd::CFRP"};
245 GeoMaterial* innerRCoverBulkMaterial =
new GeoMaterial(
"hgtd::AerogelAndHoneycomb", 0.17*(
CLHEP::gram /
CLHEP::cm3));
249 m_cylVolPars[
"HGTD::InnerRCover2"] = {
"HGTD::InnerRCover2", 111., 119., 105./2, -10.,
"hgtd::AerogelAndHoneycomb"};
250 m_cylVolPars[
"HGTD::InnerRCover3"] = {
"HGTD::InnerRCover3", 119., 120., 105./2, -10.,
"hgtd::CFRP"};
251 m_cylVolPars[
"HGTD::OuterRCover"] = {
"HGTD::OuterRCover", 980., 1000., 82./2, -6.5,
"hgtd::Peek"};
252 m_cylVolPars[
"HGTD::PeripheralCoolingLines"] = {
"HGTD::PeripheralCoolingLines", 920., 980., 3./2, 31.,
"std::SSteel"};
255 m_cylVolPars[
"HGTD::CoolingTube"] = {
"HGTD::CoolingTubes", 0, 0, 2.0, 0,
"std::Titanium"};
257 GeoMaterial* coolantMaterial =
new GeoMaterial(
"hgtd::CO2CoolantMix", 0.55*(
CLHEP::gram /
CLHEP::cm3));
261 m_cylVolPars[
"HGTD::CoolingTubeFluid"] = {
"HGTD::CoolingTubeFluid", 0, 0, 1.5, 0,
"hgtd::CO2CoolantMix"};
289 std::string
name = isPositiveSide ?
"HGTD_PositiveEndcap" :
"HGTD_NegativeEndcap";
290 GeoLogVol* world_logical_hgtd =
new GeoLogVol(
name.c_str(), world_solid_hgtd,
293 return world_logical_hgtd;
299 ATH_MSG_INFO(
"**************************************************");
300 ATH_MSG_INFO(
" Building HGTD geometry , side = " << bPos <<
" ");
301 ATH_MSG_INFO(
"**************************************************" );
303 GeoFullPhysVol* HGTDparent =
new GeoFullPhysVol( logicalEnvelope );
306 double motherHalfZ = ((GeoTube*) HGTDparent->getLogVol()->getShape())->getZHalfLength();
307 double modulePackageHalfZtot = 3.5/2 + 4./2;
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");
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");
326 hgtdVolumes.push_back(
"HGTD::ToleranceMid");
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");
334 hgtdVolumes.push_back(
"HGTD::ToleranceFront");
335 hgtdVolumes.push_back(
"HGTD::FrontCover");
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");
355 std::vector<double> flexSheetInnerR;
356 double currentInnerR = 144.;
357 for (
int flexSheet = 0; flexSheet < 8; flexSheet++) {
358 flexSheetInnerR.push_back(currentInnerR);
360 currentInnerR +=
m_boxVolPars[
"HGTDModule0"].xHalf*2 * (2 + 2 * (flexSheet < 4 ? 0.2 : 0.8) );
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());
369 GeoTube* flexPackageSolid =
new GeoTube(packagePars.
rMin, packagePars.
rMax, packagePars.
zHalf);
371 flexPackagePhysical[flexVolume] =
new GeoPhysVol(flexPackageLogical);
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);
382 ATH_MSG_DEBUG(
"Flex layer (" << (flexSheet ?
"front" :
"back") <<
")" << flexSheet <<
", Rmin = " << std::setw(5)
383 << rInner[flexSheet] <<
" mm, flexZoffset = " << flexZoffset <<
" mm" );
393 std::vector<double> coolingTubeRadii;
394 double coolingTubeRadius = 130.;
395 coolingTubeRadii.push_back(coolingTubeRadius);
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);
404 for (
int i = 0;
i < 12;
i++) {
405 coolingTubeRadius += (658-418.)/14;
406 coolingTubeRadii.push_back(coolingTubeRadius);
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);
416 ATH_MSG_INFO(
"Will now calculate cooling-loop positions for the three-ring layout");
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);
425 coolingTubeRadius = 720;
426 coolingTubeRadii.push_back(coolingTubeRadius);
428 loopDistance = (900.-720.)/numberOfLoops;
429 for (
int i = 0;
i < numberOfLoops;
i++) {
430 coolingTubeRadius += loopDistance;
431 coolingTubeRadii.push_back(coolingTubeRadius);
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++) {
445 GeoTube* periphElec_solid =
new GeoTube(periphElPars.
rMin, periphElPars.
rMax, periphElPars.
zHalf);
447 GeoPhysVol* periphElec_phys =
new GeoPhysVol(periphElec_log);
449 std::array< GeoPhysVol*, 4 > moduleLayerPhysical = {};
456 double zModuleLayerF = 0.;
457 double zModuleLayerB = 0.;
458 for (
size_t vol = 0; vol < hgtdVolumes.size(); vol++) {
460 std::string
v = hgtdVolumes[vol];
469 if (
v.substr(9,8) !=
"erRCover" &&
v !=
"HGTD::PeripheralCoolingLines") {
470 std::string vPrev = hgtdVolumes[vol-1];
476 if (
v.substr(0,15) ==
"HGTD::Tolerance")
continue;
479 if (
v.substr(0,17) ==
"HGTD::ModuleLayer")
485 GeoPhysVol* hgtdSubVolumePhysical =
new GeoPhysVol(hgtdSubVolumeLogical);
488 if (
v ==
"HGTD::CoolingPlate") {
491 static constexpr std::array<int,2> signArr{1,-1};
494 HGTDparent->add(
new GeoTransform(GeoTrf::TranslateZ3D(
m_cylVolPars[
v].zOffsetLocal + signArr[
side]*zOffsetPeriphElec)));
495 HGTDparent->add(periphElec_phys);
499 for (
size_t i = 0;
i < coolingTubeRadii.size();
i++) {
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);
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);
518 if (
v.substr(0,17) ==
"HGTD::ModuleLayer") {
524 bool Lside =
layer % 2;
526 zFlex = -modulePackageHalfZtot +
m_cylVolPars[
"HGTD::FlexPackage"].zHalf;
527 zModuleLayerF = modulePackageHalfZtot - modulePackageHalfZ;
530 zFlex = modulePackageHalfZtot -
m_cylVolPars[
"HGTD::FlexPackage"].zHalf;
531 zModuleLayerB = -modulePackageHalfZtot + modulePackageHalfZ;
535 hgtdSubVolumePhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zFlex)));
536 hgtdSubVolumePhysical->add(flexPackagePhysical[(Lside ? 0 : 1)]);
540 HGTDparent->add(
new GeoTransform( GeoTrf::TranslateZ3D(
m_cylVolPars[
v].zOffsetLocal) *
544 HGTDparent->add( hgtdSubVolumePhysical );
545 moduleLayerPhysical[
layer] = hgtdSubVolumePhysical;
549 HGTDparent->add(
new GeoTransform(GeoTrf::TranslateZ3D(
m_cylVolPars[
v].zOffsetLocal)));
550 HGTDparent->add(hgtdSubVolumePhysical);
555 <<
" ), local z = " << std::setw(6) <<
m_cylVolPars[
v].zOffsetLocal
558 <<
" mm, DZ = " << std::setw(5) <<
m_cylVolPars[
v].zHalf <<
" mm" );
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");
576 int endcap = bPos ? +2 : -2;
577 double thickness = 2.*
m_boxVolPars[
"HGTDSiSensor0"].zHalf;
585 unsigned int maxRows = 21;
596 int Lside =
layer % 2;
598 std::vector<std::string> volumes = moduleVolumes;
599 if ( Lside != 0 )
reverse( volumes.begin(), volumes.end() );
608 double moduleHalfWidth =
m_boxVolPars[moduleName].xHalf;
609 double moduleHalfHeight =
m_boxVolPars[moduleName].yHalf;
615 for (
int q = 0;
q < 4;
q++) {
616 float quadrot =
q*90.;
618 for (
unsigned int row = 0;
row < maxRows;
row ++ ) {
619 std::vector< ModulePosition > ModsPerRow = tmpQuadrant[
row ];
622 if (
m_outputIdfr &&
q == 0 ) std::cout <<
" Row #"<<
row + 1 <<
" :: " << ModsPerRow.size() << std::endl;
624 for (
unsigned int mod = 0;
mod < ModsPerRow.size();
mod ++ ) {
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 );
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 ! " );
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 );
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 <<
")" );
645 if (volumes[
comp] ==
"SensorPlaceHolder") volumes[
comp] = sensorName;
647 std::string
c = volumes[
comp];
652 std::string cPrev = volumes[
comp-1];
657 if (volumes[
comp] ==
"HGTD::ModuleSpace")
continue;
663 double xOffsetLocal = moduleHalfWidth - comp_halfx;
666 GeoBox* sensorCompSolidVol =
new GeoBox(comp_halfx, comp_halfy,
m_boxVolPars[
c].zHalf);
670 GeoLogVol* sensorCompLogicalVol =
new GeoLogVol(
m_boxVolPars[
c].
name+attach, sensorCompSolidVol,
672 GeoFullPhysVol* sensorCompPhysicalVol =
new GeoFullPhysVol(sensorCompLogicalVol);
674 if (volumes[
comp] == sensorName) {
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 );
690 GeoAlignableTransform* xform =
new GeoAlignableTransform(sensorTransform);
692 modulePhysical->add( xform );
693 modulePhysical->add( sensorCompPhysicalVol );
698 modulePhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(
m_boxVolPars[
c].zOffsetLocal)*GeoTrf::TranslateX3D(xOffsetLocal)));
699 modulePhysical->add(sensorCompPhysicalVol);
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" );
711 double zModule = ( Lside == 0 ? zModuleLayerF : zModuleLayerB );
713 GeoTransform* moduleTransform =
new GeoTransform( GeoTrf::TranslateZ3D(zModule) *
714 GeoTrf::TranslateX3D(myx) *
715 GeoTrf::TranslateY3D(myy) *
717 moduleLayerPhysical[
layer]->add( moduleTransform );
718 moduleLayerPhysical[
layer]->add( modulePhysical );
727 ATH_MSG_INFO(
"**************************************************" );
728 ATH_MSG_INFO(
" Done building HGTD with " << totMod <<
" modules " );
729 ATH_MSG_INFO(
"**************************************************" );
738 std::array< PositionsInQuadrant, 4 > positions;
752 positions[ 0 ] = std::move(d0q0front);
753 positions[ 1 ] = std::move(d0q0back);
754 positions[ 2 ] = std::move(d1q0front);
755 positions[ 3 ] = std::move(d1q0back);
770 double& myx,
double& myy,
double& myrot,
int&
phi,
int&
eta ) {
772 std::string module_string =
"";
784 myrot =
module.phiRotation;
785 phi = quadrant*21 +
row + 1;
792 double rot =
module.flipped ? 90. : 0.;
794 double moduleRotation = 0;
798 if ( quadrant%2 == 0 && myrow <= 15) moduleRotation = 180.;
799 else if (quadrant%2 == 1 && myrow > 15) moduleRotation = 180.;
801 eta = ( quadrant*maxrows ) + myrow;
803 myrot = moduleRotation + rot;
807 return module_string;
814 bool isBackside = (
layer % 2);
817 for (
size_t row = 0;
row <= maxRow;
row++) {
818 if (
row == 13 )
continue;
820 rowsInQuad[
row > 13 ?
row - 1 :
row ] = std::move(rowModulePositions);
825 for (
size_t row = 0;
row < maxRow;
row++) {
827 rowsInQuad[
row ] = std::move(rowModulePositions);
835 for (
size_t row = 0;
row < inquad.size();
row ++ ) {
836 std::vector<ModulePosition> modulePositions = inquad[
row ];
837 for (
size_t mod = 0;
mod < modulePositions.size();
mod++ ) {
843 modulePositions[
mod] = mirror;
846 rowsInQuad[ inquad.size() -
row - 1 ] = std::move(modulePositions);
855 int index_XYcoord_change = 14;
858 float halfWidth = .5*40., halfHeight = .5*21.8;
859 float midR = 230., midR2 = 470.5, maxRcut = 660., maxOuterR = 670.;
861 if (
row == 21 and back==1) {
864 float readoutRowSpace = 1.0;
865 bool extrude = ( (
row == 6 ||
row == 18 ) && !back ) ||
866 ( (
row == 2 ||
row == 11 ||
row == 12 ||
row == 17 ) && back );
870 std::array< float, 22 > ModStarting = { 122., 122.7, 89.85, 123.5, 175.4, 257.4, 287.5, 298.4, 287.5, 304.5, 287.5, 304.5, 287.5, 0.0, 299.7,
871 130., 114.7, 131.45, 164.45, 216.35, 205.45, 257.35 };
873 std::array< float, 22 > ModStartBack = { 130., 114.7, 97.85, 131.5, 164.5, 246.5, 298.4, 287.5, 298.4, 287.5, 304.5, 287.5, 304.5, 0.0, 287.5,
874 122., 122.7, 123.45, 172.45, 205.45, 216.35, 246.45 };
879 if ( ( (
row == 1 ||
row == 5 ||
row == 15 ||
row == 19 ) && ! back ) ||
880 ( (
row == 0 ||
row == 8 ||
row == 16 ||
row == 18 ||
row == 21 ) && back )
882 if (
row == 17 ) useCorner = 2;
884 float backshift = 6.;
888 float tailModCorrection[ 22 ][ 19 ];
889 for (
int r = 0;
r < 22;
r ++ )
890 for (
int m = 0;
m < 19;
m ++ ) tailModCorrection[
r][
m] = 0.;
891 tailModCorrection[11][4] = tailModCorrection[12][2] = 10.;
894 float spaceSmallR = 3.7 , spaceMediumR = 6.6, spaceLargeR = 12.7;
896 float backsideSmallR = spaceSmallR;
897 float backsideMediumR = spaceMediumR;
898 float backsideLargeR = spaceLargeR;
900 float extendedWidth = readoutRowSpace + 2.*halfWidth;
902 float posRadius = 0.;
903 float posOfLastPlacedModule = 0.;
904 int moduleCounter = 0;
905 std::vector< ModulePosition > rowModulePositions;
907 float effectiveRow =
row;
909 if (
row == index_XYcoord_change ) effectiveRow = 13;
910 if (
row > index_XYcoord_change ) effectiveRow -= ( index_XYcoord_change + 1 );
913 float rowCentPos = 0.5*extendedWidth*( 2*effectiveRow + 1 );
915 if ( extrude ) maxRcut = maxOuterR;
916 while ( posRadius < maxRcut ) {
919 float modPos_row = -999.;
922 if ( moduleCounter == 0 ) {
923 modPos_row = ( back ? ModStartBack[
row] : ModStarting[
row] );
924 modPos_row += halfHeight;
928 float prevX = rowModulePositions[ moduleCounter - 1 ].x;
929 float prevY = rowModulePositions[ moduleCounter - 1 ].y;
930 float spacing = back ? backsideSmallR : spaceSmallR;
933 float ringCrossRcorner = std::sqrt( ( prevY + halfHeight)*( prevY + halfHeight) +
934 ( prevX + halfWidth )*( prevX + halfWidth ) );
935 float ringCrossRcenter = std::sqrt( prevY*prevY + prevX*prevX );
937 bool tuned_center = (
row == 3 && ( moduleCounter == 3 && !back ) ) ||
938 (
row == 20 && moduleCounter == 8 && !back ) ||
939 (
row == 21 && moduleCounter == 6 && back );
940 if ( useCorner == 2 ) {
941 if ( ( moduleCounter == 3 && ! back ) || ( ( moduleCounter == 3 || moduleCounter == 4 ) && back ) ) {
942 ringCrossRcenter -= backshift;
943 if ( ringCrossRcenter > midR && ringCrossRcenter <= midR2 ) spacing = back ? backsideMediumR : spaceMediumR;
944 if ( ringCrossRcenter > midR2 ) spacing = back ? backsideLargeR : spaceLargeR;
947 if ( ringCrossRcorner > midR && ringCrossRcorner <= midR2 ) spacing = back ? backsideMediumR : spaceMediumR;
948 if ( ringCrossRcorner > midR2 ) spacing = back ? backsideLargeR : spaceLargeR;
951 else if ( useCorner == 1 ) {
952 if ( ringCrossRcorner > midR && ringCrossRcorner <= midR2 ) spacing = back ? backsideMediumR : spaceMediumR;
953 if ( ringCrossRcorner > midR2 ) spacing = back ? backsideLargeR : spaceLargeR;
956 if ( tuned_center ) ringCrossRcenter -= backshift;
957 if ( ringCrossRcenter > midR && ringCrossRcenter <= midR2 ) spacing = back ? backsideMediumR : spaceMediumR;
958 if ( ringCrossRcenter > midR2 ) spacing = back ? backsideLargeR : spaceLargeR;
961 modPos_row = posOfLastPlacedModule + 2.*halfHeight + spacing;
963 if ( back && moduleCounter < 19) modPos_row -= tailModCorrection[
row ][ moduleCounter ];
968 posRadius = std::sqrt( ( rowCentPos + halfWidth )*( rowCentPos + halfWidth ) +
969 ( modPos_row + halfHeight)*( modPos_row + halfHeight ) );
970 if ( posRadius > maxRcut ) {
971 ATH_MSG_DEBUG(
" row " <<
row <<
" finished with " << moduleCounter <<
" modules ");
978 ModulePosition moduFlipped = { rowCentPos, modPos_row, 90.,
true,
row, moduleCounter };
981 if (
row > index_XYcoord_change ) rowModulePositions.push_back( modu );
982 else rowModulePositions.push_back( moduFlipped );
986 <<
" Module " << moduleCounter + 1 <<
" at (x,y) : "
987 << (
row > index_XYcoord_change ? rowModulePositions.back().x - halfHeight : rowModulePositions.back().x ) <<
", "
988 << (
row > index_XYcoord_change ? rowModulePositions.back().y : rowModulePositions.back().y - halfHeight ) );
990 posOfLastPlacedModule = modPos_row;
994 if (
m_outputIdfr ) std::cout <<
"Total #Module " << rowModulePositions.size() <<
" at original row " <<
row << std::endl;
996 return rowModulePositions;
1009 unsigned int numrow = quadrant->size();
1010 for (
unsigned int r = 0;
r < numrow;
r ++ ) {
1011 unsigned int idx =
r > 13 ? 13 + numrow -
r :
r;
1013 <<
" : "<< numrow );
1014 tmpQuadrant[
idx ] = quadrant->at(
r );
1015 if (
idx !=
r ) xchng++;
1018 for (
unsigned int r = 0;
r < numrow;
r++ )
1019 quadrant->at(
r ) = tmpQuadrant[ numrow - 1 -
r ];
1025 for (
auto&
layer : arr) {
1037 double phiPitch = 1.3;
1038 double etaPitch = 1.3;
1042 int circuitsPerColumn = 1;
1043 int circuitsPerRow = 2;
1046 int cellColumnsPerCircuit = 15;
1047 int cellRowsPerCircuit = 15;
1049 int diodeColumnsPerCircuit = cellColumnsPerCircuit;
1050 int diodeRowsPerCircuit = cellRowsPerCircuit;
1054 std::move(normalCell), diodeColumnsPerCircuit, 0);
1056 std::move(singleRow), 2*diodeRowsPerCircuit, 0);
1061 circuitsPerColumn, circuitsPerRow,
1062 cellColumnsPerCircuit, cellRowsPerCircuit,
1063 diodeColumnsPerCircuit, diodeRowsPerCircuit,
1064 std::move(fullMatrix),
1078 std::vector<ModulePosition> modulePositions;
1079 double posOfLastPlacedModule = 0.;
1087 int rowForInnerRadius =
row;
1088 if (
row == 17) rowForInnerRadius = 0;
1089 if (
row == 16) rowForInnerRadius = 1;
1092 double moduleWidth =
m_boxVolPars[
"HGTDModule0"].yHalf*2;
1093 double moduleHeight =
m_boxVolPars[
"HGTDModule0"].xHalf*2;
1094 double rInner =
m_cylVolPars[
"HGTD::ModuleLayer0"].rMin;
1100 double rowCenterPos = (moduleWidth + rowSpaceSide)*(rowForInnerRadius + 0.5);
1102 double modulePosAlongRow = -99.;
1104 if (modulePositions.empty()) {
1106 if (rowForInnerRadius < 3) {
1107 modulePosAlongRow = std::sqrt(
pow(rInner, 2) -
pow((moduleWidth + rowSpaceSide)*rowForInnerRadius, 2) )
1112 if (back && (rowCenterPos - moduleWidth/2 > rMid)) {
1115 modulePosAlongRow = 2*(moduleWidth + rowSpaceSide) + moduleHeight/2 + back*backSpacing;
1124 float innermostCornerR = std::sqrt(
pow(prev.
y - moduleHeight/2, 2) +
pow(prev.
x - moduleWidth/2, 2) ) + 1.;
1125 if (innermostCornerR > rMid) {
1130 double startOfSpaceAlongRow = std::sqrt(
pow(prev.
y + moduleHeight/2, 2) +
pow(prev.
x - moduleWidth/2, 2) ) - 2;
1131 if (startOfSpaceAlongRow > rMid) {
1136 if (!back && rowForInnerRadius < 8 &&
module < 3) {
1140 double maxRcut = rOuter+20;
1143 if(
row == 8 &&
module > 12) spacing -= 4;
1149 else if (
row == 12 && back) {
1154 if (!back &&
module > 6 ) spacing -= 8.5;
1155 else if (back &&
module > 5) spacing -= 2;
1161 else if (
row == 15) {
1165 modulePosAlongRow = posOfLastPlacedModule + moduleHeight + spacing;
1168 if ( std::sqrt(
pow(rowCenterPos + moduleWidth/2, 2) +
pow(modulePosAlongRow + moduleHeight/2, 2) ) > maxRcut) {
1173 modulePositions.push_back(
m);
1174 posOfLastPlacedModule = modulePosAlongRow;
1181 for (
size_t i=0;
i < modulePositions.size();
i++) {
1189 modulePositions[
i] = rotated;
1194 for(
size_t i=0;
i < modulePositions.size();
i++) {
1195 ATH_MSG_DEBUG(
"Module " <<
i <<
" at (x,y) = (" << modulePositions[
i].
x <<
"," << modulePositions[
i].
y <<
")" );
1198 return modulePositions;