131 if (
sc != StatusCode::SUCCESS) {
132 ATH_MSG_ERROR(
"Cannot retrieve material manager from DetStore");
137 GeoMaterial* CFRP =
new GeoMaterial(
"hgtd::CFRP", 1.78*(CLHEP::gram / CLHEP::cm3));
143 GeoMaterial* Honeycomb =
new GeoMaterial(
"hgtd::Honeycomb", 0.042*(CLHEP::gram / CLHEP::cm3));
148 GeoMaterial* Peek =
new GeoMaterial(
"hgtd::Peek", 1.3*(CLHEP::gram / CLHEP::cm3));
154 GeoMaterial* CO2_Liquid =
new GeoMaterial(
"hgtd::CO2_Liquid", 1.032*(CLHEP::gram / CLHEP::cm3));
159 GeoMaterial* CO2 =
new GeoMaterial(
"hgtd::CO2", 0.001842*(CLHEP::gram / CLHEP::cm3));
164 GeoMaterial* CFiberSupport =
new GeoMaterial(
"hgtd::CFiberSupport", 0.189*(CLHEP::gram / CLHEP::cm3));
165 CFiberSupport->add(
m_materialMgr->getElement(
"Carbon"), 1.0);
168 GeoMaterial* CuKapton =
new GeoMaterial(
"hgtd::CuKapton", 2.94*(CLHEP::gram / CLHEP::cm3));
176 GeoMaterial* BoratedPolyethelyne =
new GeoMaterial(
"hgtd::BoratedPolyethelyne", 0.99*(CLHEP::gram / CLHEP::cm3));
177 BoratedPolyethelyne->add(
m_materialMgr->getElement(
"Hydrogen"), 0.13);
178 BoratedPolyethelyne->add(
m_materialMgr->getElement(
"Carbon"), 0.81);
179 BoratedPolyethelyne->add(
m_materialMgr->getElement(
"Boron"), 0.05);
182 GeoMaterial* FEBoards =
new GeoMaterial(
"hgtd::FEBoards", 0.99*(CLHEP::gram / CLHEP::cm3));
190 GeoMaterial* Epoxy =
new GeoMaterial(
"hgtd::Epoxy", 1*(CLHEP::gram / CLHEP::cm3));
199 m_boxVolPars[
"HGTDModule0"] = {
"HGTDModule0", 11, 20, 1.75, 0,
"std::Air"};
200 m_boxVolPars[
"HGTDModule1"] = {
"HGTDModule1", 11, 20, 1.75, 0,
"std::Air"};
201 m_boxVolPars[
"HGTDModule2"] = {
"HGTDModule2", 11, 20, 1.75, 0,
"std::Air"};
202 m_boxVolPars[
"HGTDModule3"] = {
"HGTDModule3", 11, 20, 1.75, 0,
"std::Air"};
203 m_boxVolPars[
"HGTD::Hybrid"] = {
"HGTD::Hybrid", 10.25, 20, .175, 0,
"hgtd::CuKapton"};
204 m_boxVolPars[
"HGTD::GlueSensor"] = {
"HGTD::GlueSensor", 10.25, 20, .04, 0,
"hgtd::Epoxy"};
205 m_boxVolPars[
"HGTD::GlueAsic"] = {
"HGTD::GlueAsic", 11, 20, .04, 0,
"hgtd::Epoxy"};
206 m_boxVolPars[
"HGTDSiSensor0"] = {
"HGTDSiSensor0", 10.25, 20, .025, 0,
"std::Silicon"};
207 m_boxVolPars[
"HGTDSiSensor1"] = {
"HGTDSiSensor1", 10.25, 20, .025, 0,
"std::Silicon"};
208 m_boxVolPars[
"HGTDSiSensor2"] = {
"HGTDSiSensor2", 10.25, 20, .025, 0,
"std::Silicon"};
209 m_boxVolPars[
"HGTDSiSensor3"] = {
"HGTDSiSensor3", 10.25, 20, .025, 0,
"std::Silicon"};
210 m_boxVolPars[
"HGTD::LGADInactive"] = {
"HGTD::LGADInactive", 10.25, 20, .1, 0,
"std::Silicon"};
211 m_boxVolPars[
"HGTD::ASIC"] = {
"HGTD::ASIC", 11, 20, .15, 0,
"std::Silicon"};
215 double moduleSpaceHalfZ = 0.225;
216 m_boxVolPars[
"HGTD::ModuleSpace"] = {
"HGTD::ModuleSpace", 11, 20, moduleSpaceHalfZ, 0,
"std::Air"};
221 m_cylVolPars[
"HGTD_mother"] = {
"HGTD_mother", 100, 1100, 62.5, -3252,
"std::Air"};
222 m_cylVolPars[
"HGTD::FrontCover"] = {
"HGTD::FrontCover", 120, 1000, 7.5, 0,
"hgtd::CFiberSupport"};
223 m_cylVolPars[
"HGTD::FlexPackage"] = {
"HGTD::FlexPackage", 120, 660, 2, 0,
"std::Air"};
224 m_cylVolPars[
"HGTD::FlexTube"] = {
"HGTD::FlexTube", 120, 660, .175, 0,
"hgtd::CuKapton"};
225 m_cylVolPars[
"HGTD::ModuleLayer0"] = {
"HGTD::ModuleLayer0", 120, 660, 3.75, 0,
"std::Air"};
226 m_cylVolPars[
"HGTD::ModuleLayer1"] = {
"HGTD::ModuleLayer1", 120, 660, 3.75, 0,
"std::Air"};
227 m_cylVolPars[
"HGTD::ModuleLayer2"] = {
"HGTD::ModuleLayer2", 120, 660, 3.75, 0,
"std::Air"};
228 m_cylVolPars[
"HGTD::ModuleLayer3"] = {
"HGTD::ModuleLayer3", 120, 660, 3.75, 0,
"std::Air"};
229 m_cylVolPars[
"HGTD::CoolingPlate"] = {
"HGTD::CoolingPlate", 120, 920, 3, 0,
"std::Aluminium"};
230 m_cylVolPars[
"HGTD::SupportPlate"] = {
"HGTD::SupportPlate", 120, 660, .5, 0,
"std::Aluminium"};
231 m_cylVolPars[
"HGTD::ToleranceFront"] = {
"HGTD::ToleranceFront", 120, 660, 1, 0,
"std::Air"};
232 m_cylVolPars[
"HGTD::ToleranceBack"] = {
"HGTD::ToleranceBack", 120, 660, 1, 0,
"std::Air"};
233 m_cylVolPars[
"HGTD::ToleranceMid"] = {
"HGTD::ToleranceMid", 120, 660, 1, 0,
"std::Air"};
234 m_cylVolPars[
"HGTD::ModeratorIn"] = {
"HGTD::ModeratorIn", 120, 900, 15, 0,
"hgtd::BoratedPolyethelyne"};
235 m_cylVolPars[
"HGTD::ModeratorOut"] = {
"HGTD::ModeratorOut", 120, 1100, 10, 0,
"hgtd::BoratedPolyethelyne"};
236 m_cylVolPars[
"HGTD::BackCover"] = {
"HGTD::BackCover", 120, 1100, 4, 0,
"hgtd::CFiberSupport"};
237 m_cylVolPars[
"HGTD::PeriphElec"] = {
"HGTD::PeriphElec", 674, 900, 1, 2,
"hgtd::FEBoards"};
239 m_cylVolPars[
"HGTD::InnerRCover1"] = {
"HGTD::InnerRCover1", 110., 111., 105./2, -10.,
"hgtd::CFRP"};
243 GeoMaterial* innerRCoverBulkMaterial =
new GeoMaterial(
"hgtd::AerogelAndHoneycomb", 0.17*(CLHEP::gram / CLHEP::cm3));
244 innerRCoverBulkMaterial->add(
m_materialMgr->getMaterial(
"std::Aerogel"), 0.5);
245 innerRCoverBulkMaterial->add(
m_materialMgr->getMaterial(
"hgtd::Honeycomb"), 0.5);
247 m_cylVolPars[
"HGTD::InnerRCover2"] = {
"HGTD::InnerRCover2", 111., 119., 105./2, -10.,
"hgtd::AerogelAndHoneycomb"};
248 m_cylVolPars[
"HGTD::InnerRCover3"] = {
"HGTD::InnerRCover3", 119., 120., 105./2, -10.,
"hgtd::CFRP"};
249 m_cylVolPars[
"HGTD::OuterRCover"] = {
"HGTD::OuterRCover", 980., 1000., 82./2, -6.5,
"hgtd::Peek"};
250 m_cylVolPars[
"HGTD::PeripheralCoolingLines"] = {
"HGTD::PeripheralCoolingLines", 920., 980., 3./2, 31.,
"std::SSteel"};
253 m_cylVolPars[
"HGTD::CoolingTube"] = {
"HGTD::CoolingTubes", 0, 0, 2.0, 0,
"std::Titanium"};
255 GeoMaterial* coolantMaterial =
new GeoMaterial(
"hgtd::CO2CoolantMix", 0.55*(CLHEP::gram / CLHEP::cm3));
256 coolantMaterial->add(
m_materialMgr->getMaterial(
"hgtd::CO2_Liquid"), 0.5);
257 coolantMaterial->add(
m_materialMgr->getMaterial(
"hgtd::CO2"), 0.5);
259 m_cylVolPars[
"HGTD::CoolingTubeFluid"] = {
"HGTD::CoolingTubeFluid", 0, 0, 1.5, 0,
"hgtd::CO2CoolantMix"};
297 ATH_MSG_INFO(
"**************************************************");
298 ATH_MSG_INFO(
" Building HGTD geometry , side = " << bPos <<
" ");
299 ATH_MSG_INFO(
"**************************************************" );
301 GeoFullPhysVol* HGTDparent =
new GeoFullPhysVol( logicalEnvelope );
304 double motherHalfZ = ((GeoTube*) HGTDparent->getLogVol()->getShape())->getZHalfLength();
305 double modulePackageHalfZtot = 3.5/2 + 4./2;
312 std::vector<std::string> hgtdVolumes;
313 hgtdVolumes.push_back(
"HGTD::ModeratorOut");
314 hgtdVolumes.push_back(
"HGTD::BackCover");
315 hgtdVolumes.push_back(
"HGTD::ToleranceBack");
316 hgtdVolumes.push_back(
"HGTD::ModeratorIn");
318 hgtdVolumes.push_back(
"HGTD::ModuleLayer3");
319 hgtdVolumes.push_back(
"HGTD::SupportPlate");
320 hgtdVolumes.push_back(
"HGTD::CoolingPlate");
321 hgtdVolumes.push_back(
"HGTD::SupportPlate");
322 hgtdVolumes.push_back(
"HGTD::ModuleLayer2");
324 hgtdVolumes.push_back(
"HGTD::ToleranceMid");
326 hgtdVolumes.push_back(
"HGTD::ModuleLayer1");
327 hgtdVolumes.push_back(
"HGTD::SupportPlate");
328 hgtdVolumes.push_back(
"HGTD::CoolingPlate");
329 hgtdVolumes.push_back(
"HGTD::SupportPlate");
330 hgtdVolumes.push_back(
"HGTD::ModuleLayer0");
332 hgtdVolumes.push_back(
"HGTD::ToleranceFront");
333 hgtdVolumes.push_back(
"HGTD::FrontCover");
335 hgtdVolumes.push_back(
"HGTD::InnerRCover1");
336 hgtdVolumes.push_back(
"HGTD::InnerRCover2");
337 hgtdVolumes.push_back(
"HGTD::InnerRCover3");
338 hgtdVolumes.push_back(
"HGTD::OuterRCover");
339 hgtdVolumes.push_back(
"HGTD::PeripheralCoolingLines");
353 std::vector<double> flexSheetInnerR;
354 double currentInnerR = 144.;
355 for (
int flexSheet = 0; flexSheet < 8; flexSheet++) {
356 flexSheetInnerR.push_back(currentInnerR);
358 currentInnerR +=
m_boxVolPars[
"HGTDModule0"].xHalf*2 * (2 + 2 * (flexSheet < 4 ? 0.2 : 0.8) );
362 GeoPhysVol* flexPackagePhysical[2] = {};
363 for (
int flexVolume = 0; flexVolume < 2; flexVolume++) {
364 std::vector<double> rInner = flexSheetInnerR;
365 if (flexVolume)
reverse(rInner.begin(), rInner.end());
367 GeoTube* flexPackageSolid =
new GeoTube(packagePars.
rMin, packagePars.
rMax, packagePars.
zHalf);
368 GeoLogVol* flexPackageLogical =
new GeoLogVol(packagePars.
name, flexPackageSolid,
m_materialMgr->getMaterial(packagePars.
material));
369 flexPackagePhysical[flexVolume] =
new GeoPhysVol(flexPackageLogical);
371 double flexZoffset = packagePars.
zHalf - flexPars.
zHalf;
372 for (
int flexSheet = 0; flexSheet < 8; flexSheet++) {
373 GeoTube* hgtdFlexSolid =
new GeoTube(rInner[flexSheet], flexPars.
rMax, flexPars.
zHalf);
374 GeoLogVol* hgtdFlexLogical =
new GeoLogVol(
"HGTD::FlexTube"+std::to_string(flexSheet),
376 GeoPhysVol* hgtdFlexPhysical =
new GeoPhysVol(hgtdFlexLogical);
377 flexPackagePhysical[flexVolume]->add(
new GeoTransform(GeoTrf::TranslateZ3D(flexZoffset)));
378 flexPackagePhysical[flexVolume]->add(hgtdFlexPhysical);
380 ATH_MSG_DEBUG(
"Flex layer (" << (flexSheet ?
"front" :
"back") <<
")" << flexSheet <<
", Rmin = " << std::setw(5)
381 << rInner[flexSheet] <<
" mm, flexZoffset = " << flexZoffset <<
" mm" );
382 flexZoffset = flexZoffset -
m_hgtdPars.flexSheetSpacing;
391 std::vector<double> coolingTubeRadii;
392 double coolingTubeRadius = 130.;
393 coolingTubeRadii.push_back(coolingTubeRadius);
397 ATH_MSG_INFO(
"Will now calculate cooling-loop positions for the two-ring layout");
398 for (
int i = 0; i < 18; i++) {
399 coolingTubeRadius += (418-130.)/18;
400 coolingTubeRadii.push_back(coolingTubeRadius);
402 for (
int i = 0; i < 12; i++) {
403 coolingTubeRadius += (658-418.)/14;
404 coolingTubeRadii.push_back(coolingTubeRadius);
406 coolingTubeRadius = 710.;
407 coolingTubeRadii.push_back(coolingTubeRadius);
408 for (
int i = 0; i < 7; i++) {
409 coolingTubeRadius += (890-710.)/6;
410 coolingTubeRadii.push_back(coolingTubeRadius);
414 ATH_MSG_INFO(
"Will now calculate cooling-loop positions for the three-ring layout");
416 int numberOfLoops = 34;
417 float loopDistance = (674.-130.)/numberOfLoops;
418 for (
int i = 0; i < numberOfLoops; i++) {
419 coolingTubeRadius += loopDistance;
420 coolingTubeRadii.push_back(coolingTubeRadius);
423 coolingTubeRadius = 720;
424 coolingTubeRadii.push_back(coolingTubeRadius);
426 loopDistance = (900.-720.)/numberOfLoops;
427 for (
int i = 0; i < numberOfLoops; i++) {
428 coolingTubeRadius += loopDistance;
429 coolingTubeRadii.push_back(coolingTubeRadius);
432 ATH_MSG_DEBUG(
"Cooling tubes will be created at the following radii (" << coolingTubeRadii.size() <<
" in total):");
433 for (
size_t i = 0; i < coolingTubeRadii.size(); i++) {
443 GeoTube* periphElec_solid =
new GeoTube(periphElPars.
rMin, periphElPars.
rMax, periphElPars.
zHalf);
444 GeoLogVol* periphElec_log =
new GeoLogVol(periphElPars.
name, periphElec_solid,
m_materialMgr->getMaterial(periphElPars.
material));
445 GeoPhysVol* periphElec_phys =
new GeoPhysVol(periphElec_log);
447 std::array< GeoPhysVol*, 4 > moduleLayerPhysical = {};
454 double zModuleLayerF = 0.;
455 double zModuleLayerB = 0.;
456 for (
size_t vol = 0; vol < hgtdVolumes.size(); vol++) {
458 std::string v = hgtdVolumes[vol];
467 if (v.substr(9,8) !=
"erRCover" && v !=
"HGTD::PeripheralCoolingLines") {
468 std::string vPrev = hgtdVolumes[vol-1];
474 if (v.substr(0,15) ==
"HGTD::Tolerance")
continue;
477 if (v.substr(0,17) ==
"HGTD::ModuleLayer")
483 GeoPhysVol* hgtdSubVolumePhysical =
new GeoPhysVol(hgtdSubVolumeLogical);
486 if (v ==
"HGTD::CoolingPlate") {
489 static constexpr std::array<int,2> signArr{1,-1};
490 for (
int side = 0; side < 2; side++) {
492 HGTDparent->add(
new GeoTransform(GeoTrf::TranslateZ3D(
m_cylVolPars[v].zOffsetLocal + signArr[side]*zOffsetPeriphElec)));
493 HGTDparent->add(periphElec_phys);
497 for (
size_t i = 0; i < coolingTubeRadii.size(); i++) {
499 GeoTorus* coolingTubeSolid =
new GeoTorus(
m_cylVolPars[
"HGTD::CoolingTubeFluid"].zHalf,
m_cylVolPars[
"HGTD::CoolingTube"].zHalf,
500 coolingTubeRadii[i], 0, 2*
M_PI);
501 GeoLogVol* coolingTubeLogical =
new GeoLogVol(
"HGTD::CoolingTube", coolingTubeSolid,
503 GeoPhysVol* coolingTubePhysical =
new GeoPhysVol(coolingTubeLogical);
504 hgtdSubVolumePhysical->add(coolingTubePhysical);
506 GeoTorus* coolingFluidSolid =
new GeoTorus(0,
m_cylVolPars[
"HGTD::CoolingTubeFluid"].zHalf,
507 coolingTubeRadii[i], 0, 2*
M_PI);
508 GeoLogVol* coolingFluidLogical =
new GeoLogVol(
"HGTD::CoolingFluid", coolingFluidSolid,
510 GeoPhysVol* coolingFluidPhysical =
new GeoPhysVol(coolingFluidLogical);
511 hgtdSubVolumePhysical->add(coolingFluidPhysical);
516 if (v.substr(0,17) ==
"HGTD::ModuleLayer") {
518 int layer = atoi(v.substr(17,1).c_str());
522 bool Lside = layer % 2;
524 zFlex = -modulePackageHalfZtot +
m_cylVolPars[
"HGTD::FlexPackage"].zHalf;
525 zModuleLayerF = modulePackageHalfZtot - modulePackageHalfZ;
528 zFlex = modulePackageHalfZtot -
m_cylVolPars[
"HGTD::FlexPackage"].zHalf;
529 zModuleLayerB = -modulePackageHalfZtot + modulePackageHalfZ;
533 hgtdSubVolumePhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(zFlex)));
534 hgtdSubVolumePhysical->add(flexPackagePhysical[(Lside ? 0 : 1)]);
538 HGTDparent->add(
new GeoTransform( GeoTrf::TranslateZ3D(
m_cylVolPars[v].zOffsetLocal) *
539 GeoTrf::RotateZ3D(diskRotation*Gaudi::Units::deg)) );
542 HGTDparent->add( hgtdSubVolumePhysical );
543 moduleLayerPhysical[layer] = hgtdSubVolumePhysical;
547 HGTDparent->add(
new GeoTransform(GeoTrf::TranslateZ3D(
m_cylVolPars[v].zOffsetLocal)));
548 HGTDparent->add(hgtdSubVolumePhysical);
553 <<
" ), local z = " << std::setw(6) <<
m_cylVolPars[v].zOffsetLocal
554 <<
" mm, Rmin = " << std::setw(4) <<
m_cylVolPars[v].rMin
555 <<
" mm, Rmax = " << std::setw(4) <<
m_cylVolPars[v].rMax
556 <<
" mm, DZ = " << std::setw(5) <<
m_cylVolPars[v].zHalf <<
" mm" );
565 std::vector<std::string> moduleVolumes;
566 moduleVolumes.push_back(
"HGTD::GlueAsic");
567 moduleVolumes.push_back(
"HGTD::ASIC");
568 moduleVolumes.push_back(
"HGTD::LGADInactive");
569 moduleVolumes.push_back(
"SensorPlaceHolder");
570 moduleVolumes.push_back(
"HGTD::GlueSensor");
571 moduleVolumes.push_back(
"HGTD::Hybrid");
572 moduleVolumes.push_back(
"HGTD::ModuleSpace");
574 int endcap = bPos ? +2 : -2;
575 double thickness = 2.*
m_boxVolPars[
"HGTDSiSensor0"].zHalf;
583 unsigned int maxRows = 21;
591 for (
int layer = 0; layer < 4; layer++) {
592 if (
m_outputIdfr) cout <<
"Layer #" << layer << std::endl;
594 int Lside = layer % 2;
596 std::vector<std::string> volumes = moduleVolumes;
597 if ( Lside != 0 )
reverse( volumes.begin(), volumes.end() );
599 std::string sensorName = std::string(
"HGTDSiSensor") + std::to_string(layer);
600 std::string moduleName = std::string(
"HGTDModule") + std::to_string(layer);
606 double moduleHalfWidth =
m_boxVolPars[moduleName].xHalf;
607 double moduleHalfHeight =
m_boxVolPars[moduleName].yHalf;
613 for (
int q = 0; q < 4; q++) {
614 float quadrot = q*90.;
616 for (
unsigned int row = 0; row < maxRows; row ++ ) {
617 std::vector< ModulePosition > ModsPerRow = tmpQuadrant[ row ];
620 if (
m_outputIdfr && q == 0 ) std::cout <<
" Row #"<< row + 1 <<
" :: " << ModsPerRow.size() << std::endl;
622 for (
unsigned int mod = 0; mod < ModsPerRow.size(); mod ++ ) {
625 double myx = -9999999.9 , myy = -9999999.9 , myrot = -9999999.9;
626 int myphi = -1 , myeta = - 1;
627 std::string module_string =
formModuleName( layer, q, maxRows, row, mod, module, myx, myy, myrot, myphi, myeta );
629 if ( module_string ==
"" || myrot == -9999999.9 || myeta == -1 )
630 ATH_MSG_WARNING (
" Please check the module at layer "<< layer <<
" quadrant " << q <<
" row "<< row <<
" mod " << mod <<
" not well retrieved ! " );
633 GeoBox* moduleSolid =
new GeoBox( moduleHalfWidth, moduleHalfHeight, modulePackageHalfZ);
634 GeoLogVol* moduleLogical =
new GeoLogVol( moduleName + module_string, moduleSolid,
m_materialMgr->getMaterial(
"std::Air"));
635 GeoFullPhysVol* modulePhysical =
new GeoFullPhysVol( moduleLogical );
638 if ( q == 0 && row == 0 && mod == 0 )
639 ATH_MSG_DEBUG(
"Will now build up an individual HGTD module of layer " << layer <<
" and quadrant " << q <<
" (" << module_string <<
")" );
642 for (
size_t comp = 0; comp < volumes.size(); comp++) {
643 if (volumes[comp] ==
"SensorPlaceHolder") volumes[comp] = sensorName;
645 std::string c = volumes[comp];
650 std::string cPrev = volumes[comp-1];
655 if (volumes[comp] ==
"HGTD::ModuleSpace")
continue;
661 double xOffsetLocal = moduleHalfWidth - comp_halfx;
664 GeoBox* sensorCompSolidVol =
new GeoBox(comp_halfx, comp_halfy,
m_boxVolPars[c].zHalf);
666 std::string attach = (volumes[comp] == sensorName) ?
"" :
"_L" + std::to_string( layer ) + module_string;
668 GeoLogVol* sensorCompLogicalVol =
new GeoLogVol(
m_boxVolPars[c].name+attach, sensorCompSolidVol,
670 GeoFullPhysVol* sensorCompPhysicalVol =
new GeoFullPhysVol(sensorCompLogicalVol);
672 if (volumes[comp] == sensorName) {
677 if ( q == 0 && ( mod == 0 || mod == ( ModsPerRow.size() - 1 ) ) && !
m_outputIdfr ) {
679 <<
" upon HGTD_ID => ec: " << endcap <<
", layer: " << layer <<
", quadrant: " << q
680 <<
", row: " << myphi <<
", module: "<< myeta );
681 ATH_MSG_DEBUG(
" HGTD Module: " <<
m_boxVolPars[c].name+module_string <<
", posX: " << myx <<
", posY: " << myy <<
", rot: " << quadrot + myrot );
687 GeoTrf::Transform3D sensorTransform = GeoTrf::TranslateZ3D(
m_boxVolPars[c].zOffsetLocal)*GeoTrf::TranslateX3D(xOffsetLocal);
688 GeoAlignableTransform* xform =
new GeoAlignableTransform(sensorTransform);
690 modulePhysical->add( xform );
691 modulePhysical->add( sensorCompPhysicalVol );
696 modulePhysical->add(
new GeoTransform(GeoTrf::TranslateZ3D(
m_boxVolPars[c].zOffsetLocal)*GeoTrf::TranslateX3D(xOffsetLocal)));
697 modulePhysical->add(sensorCompPhysicalVol);
701 if ( mod == 0 && q == 0 && volumes[comp] != sensorName )
703 <<
" ), in-sensor-layer local z = " << std::setw(7) <<
m_boxVolPars[c].zOffsetLocal <<
" mm"
704 <<
", DX = " << std::setw(5) <<
m_boxVolPars[c].xHalf <<
" mm"
705 <<
", DY = " << std::setw(5) <<
m_boxVolPars[c].yHalf <<
" mm"
706 <<
", DZ = " << std::setw(5) <<
m_boxVolPars[c].zHalf <<
" mm" );
709 double zModule = ( Lside == 0 ? zModuleLayerF : zModuleLayerB );
711 GeoTransform* moduleTransform =
new GeoTransform( GeoTrf::TranslateZ3D(zModule) *
712 GeoTrf::TranslateX3D(myx) *
713 GeoTrf::TranslateY3D(myy) *
714 GeoTrf::RotateZ3D( ( quadrot + myrot )*Gaudi::Units::deg) );
715 moduleLayerPhysical[layer]->add( moduleTransform );
716 moduleLayerPhysical[layer]->add( modulePhysical );
725 ATH_MSG_INFO(
"**************************************************" );
726 ATH_MSG_INFO(
" Done building HGTD with " << totMod <<
" modules " );
727 ATH_MSG_INFO(
"**************************************************" );
853 int index_XYcoord_change = 14;
856 float halfWidth = .5*40., halfHeight = .5*21.8;
857 float midR = 230., midR2 = 470.5, maxRcut = 660., maxOuterR = 670.;
859 if (row == 21 and back==1) {
862 float readoutRowSpace = 1.0;
863 bool extrude = ( ( row == 6 || row == 18 ) && !back ) ||
864 ( ( row == 2 || row == 11 || row == 12 || row == 17 ) && back );
868 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,
869 130., 114.7, 131.45, 164.45, 216.35, 205.45, 257.35 };
871 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,
872 122., 122.7, 123.45, 172.45, 205.45, 216.35, 246.45 };
877 if ( ( ( row == 1 || row == 5 || row == 15 || row == 19 ) && ! back ) ||
878 ( ( row == 0 || row == 8 || row == 16 || row == 18 || row == 21 ) && back )
880 if ( row == 17 ) useCorner = 2;
882 float backshift = 6.;
886 float tailModCorrection[ 22 ][ 19 ];
887 for (
int r = 0;
r < 22;
r ++ )
888 for (
int m = 0; m < 19; m ++ ) tailModCorrection[
r][m] = 0.;
889 tailModCorrection[11][4] = tailModCorrection[12][2] = 10.;
892 float spaceSmallR = 3.7 , spaceMediumR = 6.6, spaceLargeR = 12.7;
894 float backsideSmallR = spaceSmallR;
895 float backsideMediumR = spaceMediumR;
896 float backsideLargeR = spaceLargeR;
898 float extendedWidth = readoutRowSpace + 2.*halfWidth;
900 float posRadius = 0.;
901 float posOfLastPlacedModule = 0.;
902 int moduleCounter = 0;
903 std::vector< ModulePosition > rowModulePositions;
905 float effectiveRow = row;
907 if ( row == index_XYcoord_change ) effectiveRow = 13;
908 if ( row > index_XYcoord_change ) effectiveRow -= ( index_XYcoord_change + 1 );
911 float rowCentPos = 0.5*extendedWidth*( 2*effectiveRow + 1 );
913 if ( extrude ) maxRcut = maxOuterR;
914 while ( posRadius < maxRcut ) {
917 float modPos_row = -999.;
920 if ( moduleCounter == 0 ) {
921 modPos_row = ( back ? ModStartBack[row] : ModStarting[row] );
922 modPos_row += halfHeight;
926 float prevX = rowModulePositions[ moduleCounter - 1 ].x;
927 float prevY = rowModulePositions[ moduleCounter - 1 ].y;
928 float spacing = back ? backsideSmallR : spaceSmallR;
931 float ringCrossRcorner = std::sqrt( ( prevY + halfHeight)*( prevY + halfHeight) +
932 ( prevX + halfWidth )*( prevX + halfWidth ) );
933 float ringCrossRcenter = std::sqrt( prevY*prevY + prevX*prevX );
935 bool tuned_center = ( row == 3 && ( moduleCounter == 3 && !back ) ) ||
936 ( row == 20 && moduleCounter == 8 && !back ) ||
937 ( row == 21 && moduleCounter == 6 && back );
938 if ( useCorner == 2 ) {
939 if ( ( moduleCounter == 3 && ! back ) || ( ( moduleCounter == 3 || moduleCounter == 4 ) && back ) ) {
940 ringCrossRcenter -= backshift;
941 if ( ringCrossRcenter > midR && ringCrossRcenter <= midR2 ) spacing = back ? backsideMediumR : spaceMediumR;
942 if ( ringCrossRcenter > midR2 ) spacing = back ? backsideLargeR : spaceLargeR;
945 if ( ringCrossRcorner > midR && ringCrossRcorner <= midR2 ) spacing = back ? backsideMediumR : spaceMediumR;
946 if ( ringCrossRcorner > midR2 ) spacing = back ? backsideLargeR : spaceLargeR;
949 else if ( useCorner == 1 ) {
950 if ( ringCrossRcorner > midR && ringCrossRcorner <= midR2 ) spacing = back ? backsideMediumR : spaceMediumR;
951 if ( ringCrossRcorner > midR2 ) spacing = back ? backsideLargeR : spaceLargeR;
954 if ( tuned_center ) ringCrossRcenter -= backshift;
955 if ( ringCrossRcenter > midR && ringCrossRcenter <= midR2 ) spacing = back ? backsideMediumR : spaceMediumR;
956 if ( ringCrossRcenter > midR2 ) spacing = back ? backsideLargeR : spaceLargeR;
959 modPos_row = posOfLastPlacedModule + 2.*halfHeight + spacing;
961 if ( back && moduleCounter < 19) modPos_row -= tailModCorrection[ row ][ moduleCounter ];
966 posRadius = std::sqrt( ( rowCentPos + halfWidth )*( rowCentPos + halfWidth ) +
967 ( modPos_row + halfHeight)*( modPos_row + halfHeight ) );
968 if ( posRadius > maxRcut ) {
969 ATH_MSG_DEBUG(
" row " << row <<
" finished with " << moduleCounter <<
" modules ");
975 ModulePosition modu = { modPos_row, rowCentPos, 0.,
false, row, moduleCounter };
976 ModulePosition moduFlipped = { rowCentPos, modPos_row, 90.,
true, row, moduleCounter };
979 if ( row > index_XYcoord_change ) rowModulePositions.push_back( modu );
980 else rowModulePositions.push_back( moduFlipped );
984 <<
" Module " << moduleCounter + 1 <<
" at (x,y) : "
985 << ( row > index_XYcoord_change ? rowModulePositions.back().x - halfHeight : rowModulePositions.back().x ) <<
", "
986 << ( row > index_XYcoord_change ? rowModulePositions.back().y : rowModulePositions.back().y - halfHeight ) );
988 posOfLastPlacedModule = modPos_row;
992 if (
m_outputIdfr ) std::cout <<
"Total #Module " << rowModulePositions.size() <<
" at original row " << row << std::endl;
994 return rowModulePositions;
1075 unsigned int module = 0;
1076 std::vector<ModulePosition> modulePositions;
1077 double posOfLastPlacedModule = 0.;
1085 int rowForInnerRadius = row;
1086 if (row == 17) rowForInnerRadius = 0;
1087 if (row == 16) rowForInnerRadius = 1;
1090 double moduleWidth =
m_boxVolPars[
"HGTDModule0"].yHalf*2;
1091 double moduleHeight =
m_boxVolPars[
"HGTDModule0"].xHalf*2;
1092 double rInner =
m_cylVolPars[
"HGTD::ModuleLayer0"].rMin;
1095 double rowSpaceSide =
m_hgtdPars.rowSpaceSide;
1098 double rowCenterPos = (moduleWidth + rowSpaceSide)*(rowForInnerRadius + 0.5);
1100 double modulePosAlongRow = -99.;
1102 if (modulePositions.empty()) {
1104 if (rowForInnerRadius < 3) {
1105 modulePosAlongRow = std::sqrt(
pow(rInner, 2) -
pow((moduleWidth + rowSpaceSide)*rowForInnerRadius, 2) )
1106 + back*
m_hgtdPars.rowBacksideInnerShift + moduleHeight/2;
1109 double backSpacing =
m_hgtdPars.rowBacksideInnerShift;
1110 if (back && (rowCenterPos - moduleWidth/2 > rMid)) {
1111 backSpacing =
m_hgtdPars.rowBacksideOuterShift;
1113 modulePosAlongRow = 2*(moduleWidth + rowSpaceSide) + moduleHeight/2 + back*backSpacing;
1119 double spacing =
m_hgtdPars.moduleSpaceInner;
1122 float innermostCornerR = std::sqrt(
pow(prev.
y - moduleHeight/2, 2) +
pow(prev.
x - moduleWidth/2, 2) ) + 1.;
1123 if (innermostCornerR > rMid) {
1128 double startOfSpaceAlongRow = std::sqrt(
pow(prev.
y + moduleHeight/2, 2) +
pow(prev.
x - moduleWidth/2, 2) ) - 2;
1129 if (startOfSpaceAlongRow > rMid) {
1134 if (!back && rowForInnerRadius < 8 && module < 3) {
1138 double maxRcut = rOuter+20;
1139 if(row == 8 || row == 9 || row == 10) {
1141 if(row == 8 && module > 12) spacing -= 4;
1143 else if ( row == 11 && module > 9) {
1147 else if (row == 12 && back) {
1150 else if(row == 13 && module > 5) {
1152 if (!back && module > 6 ) spacing -= 8.5;
1153 else if (back && module > 5) spacing -= 2;
1155 else if (row == 14 && module > 3) {
1159 else if (row == 15) {
1163 modulePosAlongRow = posOfLastPlacedModule + moduleHeight + spacing;
1166 if ( std::sqrt(
pow(rowCenterPos + moduleWidth/2, 2) +
pow(modulePosAlongRow + moduleHeight/2, 2) ) > maxRcut) {
1170 ModulePosition m = {rowCenterPos, modulePosAlongRow, 0,
true, row, (int)module};
1171 modulePositions.push_back(m);
1172 posOfLastPlacedModule = modulePosAlongRow;
1179 for (
size_t i=0; i < modulePositions.size(); i++) {
1184 rotated.
flipped = !old.flipped;
1185 rotated.
row = old.row;
1187 modulePositions[i] = rotated;
1192 for(
size_t i=0; i < modulePositions.size(); i++) {
1193 ATH_MSG_DEBUG(
"Module " << i <<
" at (x,y) = (" << modulePositions[i].
x <<
"," << modulePositions[i].
y <<
")" );
1196 return modulePositions;