26 #include "GeoModelKernel/GeoTube.h"
27 #include "GeoModelKernel/GeoTrd.h"
28 #include "GeoModelKernel/GeoLogVol.h"
29 #include "GeoModelKernel/GeoNameTag.h"
30 #include "GeoModelKernel/GeoPhysVol.h"
31 #include "GeoModelKernel/GeoFullPhysVol.h"
32 #include "GeoModelKernel/GeoTransform.h"
33 #include "GeoModelKernel/GeoAlignableTransform.h"
34 #include "GeoModelKernel/GeoSerialDenominator.h"
35 #include "GeoModelKernel/GeoSerialTransformer.h"
36 #include "GeoModelKernel/GeoShapeShift.h"
37 #include "GeoModelKernel/GeoShapeUnion.h"
38 #include "GeoModelKernel/GeoIdentifierTag.h"
39 #include "GeoModelKernel/GeoSerialIdentifier.h"
40 #include "GeoModelKernel/GeoElement.h"
41 #include "GeoModelKernel/GeoMaterial.h"
42 #include "GeoModelKernel/GeoDefinitions.h"
43 #include "GeoModelKernel/Units.h"
45 #include "GeoGenericFunctions/AbsFunction.h"
46 #include "GeoGenericFunctions/Variable.h"
47 #include "GeoGenericFunctions/Sin.h"
48 #include "GeoGenericFunctions/Cos.h"
60 using namespace GeoXF;
67 double xx = vector.x();
68 double yy = vector.y();
69 vector.x() =
c*xx - s1*
yy;
70 vector.y() = s1*xx +
c*
yy;
75 double ptot2 =
a.mag2()*
b.mag2();
76 return ptot2 <= 0.0 ? 0.0 : std::acos(
a.dot(
b)/std::sqrt(ptot2));
81 return std::sqrt(vector.x()*vector.x() + vector.y()*vector.y());
87 bool useOldActiveGasMixture,
88 bool DC2CompatibleBarrelCoordinates,
89 int overridedigversion,
93 bool useDynamicAlignmentFolders)
94 :
InDetDD::DetectorFactoryBase(athenaComps),
95 m_useOldActiveGasMixture(useOldActiveGasMixture),
96 m_DC2CompatibleBarrelCoordinates(DC2CompatibleBarrelCoordinates),
97 m_overridedigversion(overridedigversion),
98 m_alignable(alignable),
100 m_strawsvcavailable(0),
102 m_doKrypton(doKrypton),
103 m_useDynamicAlignFolders(useDynamicAlignmentFolders)
140 ATH_MSG_DEBUG(
" Getting primary numbers from the Detector Description Database " );
142 m_data.reset(parameterInterface);
158 if (!
m_doArgon )
ATH_MSG_DEBUG(
"Tool setup will force to NOT to use ARGON. Ignore this warning if you are running RECONSTRUCTION or DIGI, but cross-check if you are running SIMULATION");
159 if (!
m_doKrypton)
ATH_MSG_DEBUG(
"Tool setup will force to NOT to use KRYPTON. Ignore this warning if you are running RECONSTRUCTION or DIGI, but cross-check if you are running SIMULATION");
167 const TRT_ID *idHelper =
nullptr;
183 std::string versionTag =
m_data->versionTag;
184 std::string versionName =
"DC2";
185 std::string layout =
"Final";
187 int versionMajorNumber = 2;
188 int versionMinorNumber = 1;
189 int versionPatchNumber = 0;
191 if (
m_data->initialLayout) layout =
"Initial";
196 versionMajorNumber = 3;
197 versionName =
"Rome";
201 if (
m_data->isCosmicRun) {
210 if (!
m_data->oldConfiguration) {
211 versionName =
m_data->versionName;
214 versionMajorNumber = 4;
215 versionMinorNumber = 1;
216 versionPatchNumber = 1;
231 ATH_MSG_INFO(
"In TRT Detector Factory (For DC2 and later geometries)" );
237 std::string barrelLabel =
"Barrel";
238 std::string endcapA_WheelAB_Label =
"EndcapA_WheelAB";
239 std::string endcapC_WheelAB_Label =
"EndcapC_WheelAB";
240 std::string endcapA_WheelC_Label =
"EndcapA_WheelC";
241 std::string endcapC_WheelC_Label =
"EndcapC_WheelC";
244 if (
m_data->partPresent(
"EndcapAB_Plus")) {
245 barrelLabel =
"Barrel";
246 endcapA_WheelAB_Label =
"EndcapAB_Plus";
247 endcapC_WheelAB_Label =
"EndcapAB_Minus";
248 endcapA_WheelC_Label =
"EndcapC_Plus";
249 endcapC_WheelC_Label =
"EndcapC_Minus";
253 bool barrelPresent =
m_data->partPresent(barrelLabel);
254 bool endcapABPlusPresent =
m_data->partPresent(endcapA_WheelAB_Label);
255 bool endcapABMinusPresent =
m_data->partPresent(endcapC_WheelAB_Label);
256 bool endcapCPlusPresent =
m_data->partPresent(endcapA_WheelC_Label);
257 bool endcapCMinusPresent =
m_data->partPresent(endcapC_WheelC_Label);
263 if (
m_data->oldConfiguration) {
264 if (
m_data->isCosmicRun) {
265 endcapABPlusPresent =
false;
266 endcapABMinusPresent =
false;
267 endcapCPlusPresent =
false;
268 endcapCMinusPresent =
false;
270 if (
m_data->initialLayout) {
271 endcapCPlusPresent =
false;
272 endcapCMinusPresent =
false;
284 const int AlignmentLevelSubWheel = 1;
285 const int AlignmentLevelModule = 2;
286 const int AlignmentLevelTop = 3;
300 if (endcapABPlusPresent) {
303 if (endcapABMinusPresent) {
321 if (endcapABPlusPresent) {
324 if (endcapABMinusPresent) {
343 ATH_MSG_INFO(
"Digversion overridden via joboptions from "
344 <<
m_data->digversion <<
" ('" <<
m_data->digversionname <<
"') to "
352 for (
unsigned int m=0;
m<
m_data->nBarrelRings;
m++) {
360 unsigned int nEndcapWheels = 0;
361 if (endcapABPlusPresent||endcapABMinusPresent) nEndcapWheels +=
m_data->endcapNumberOfAWheels +
m_data->endcapNumberOfBWheels;
362 if (endcapCPlusPresent||endcapCMinusPresent) nEndcapWheels +=
m_data->endcapNumberOfCWheels;
368 unsigned int nlayers;
369 if ( w < m_data->endcapNumberOfAWheels )
370 nlayers =
m_data->endCapNumberOfStrawLayersPerWheelA;
371 else if (
w < (
m_data->endcapNumberOfAWheels +
m_data->endcapNumberOfBWheels ) )
372 nlayers =
m_data->endCapNumberOfStrawLayersPerWheelB;
374 nlayers =
m_data->endCapNumberOfStrawLayersPerWheelC;
382 GeoFullPhysVol *pBarrelVol =
nullptr;
383 GeoFullPhysVol *pEndCapABPlus =
nullptr;
384 GeoFullPhysVol *pEndCapCPlus =
nullptr;
385 GeoFullPhysVol *pEndCapABMinus =
nullptr;
386 GeoFullPhysVol *pEndCapCMinus =
nullptr;
395 GeoTube* sBarrelVol =
new GeoTube(
m_data->virtualBarrelInnerRadius,
396 m_data->virtualBarrelOuterRadius,
397 m_data->virtualBarrelVolumeLength );
400 GeoLogVol *lBarrelVol =
new GeoLogVol(
"TRTBarrel", sBarrelVol,
m_materialManager->getMaterial(
"trt::CO2"));
401 pBarrelVol =
new GeoFullPhysVol(lBarrelVol);
403 ATH_MSG_DEBUG(
"Virtual TRT Barrel volume defined by RMin = "<<
m_data->virtualBarrelInnerRadius
404 <<
", Rmax = "<<
m_data->virtualBarrelOuterRadius<<
" Zmax = "<<
m_data->virtualBarrelVolumeLength );
409 GeoAlignableTransform * barrelTransform =
410 new GeoAlignableTransform(trtTransform *
m_data->partTransform(barrelLabel));
412 world->add(topLevelNameTag);
413 world->add(barrelTransform);
414 world->add(pBarrelVol);
425 GeoLogVol * lEndCapVolumeAB =
nullptr;
426 if (endcapABPlusPresent || endcapABMinusPresent) {
427 GeoTube * sEndCapVolumeAB_unshifted =
new GeoTube (
m_data->innerRadiusOfEndCapVolumeAB,
428 m_data->outerRadiusOfEndCapVolumeAB,
429 m_data->lengthOfEndCapVolumeAB/2.);
430 const GeoShape & sEndCapVolumeAB
431 = ( *sEndCapVolumeAB_unshifted << GeoTrf::TranslateZ3D(
m_data->positionOfEndCapVolumeAB));
433 lEndCapVolumeAB =
new GeoLogVol(
"TRTEndcapWheelAB", &sEndCapVolumeAB,
m_materialManager->getMaterial(
"trt::CO2"));
436 if (endcapABPlusPresent) {
437 pEndCapABPlus =
new GeoFullPhysVol(lEndCapVolumeAB);
440 new GeoAlignableTransform(trtTransform *
m_data->partTransform(endcapA_WheelAB_Label));
442 world->add(topLevelNameTag);
444 world->add(
new GeoIdentifierTag(0));
445 world->add(pEndCapABPlus);
451 if (endcapABMinusPresent) {
452 pEndCapABMinus =
new GeoFullPhysVol(lEndCapVolumeAB);
457 world->add(topLevelNameTag);
459 world->add(
new GeoIdentifierTag(1));
460 world->add(pEndCapABMinus);
469 GeoLogVol * lEndCapVolumeC =
nullptr;
470 if (endcapCPlusPresent || endcapCMinusPresent) {
471 GeoTube * sEndCapVolumeC_unshifted =
new GeoTube (
m_data->innerRadiusOfEndCapVolumeC,
472 m_data->outerRadiusOfEndCapVolumeC,
473 m_data->lengthOfEndCapVolumeC/2.);
474 const GeoShape & sEndCapVolumeC
475 = ( *sEndCapVolumeC_unshifted << GeoTrf::TranslateZ3D(
m_data->positionOfEndCapVolumeC));
477 lEndCapVolumeC =
new GeoLogVol(
"TRTEndcapWheelC", &sEndCapVolumeC,
m_materialManager->getMaterial(
"trt::CO2"));
480 if (endcapCPlusPresent) {
481 pEndCapCPlus =
new GeoFullPhysVol(lEndCapVolumeC);
484 new GeoAlignableTransform(trtTransform *
m_data->partTransform(endcapA_WheelC_Label));
486 world->add(topLevelNameTag);
488 world->add(
new GeoIdentifierTag(0));
489 world->add(pEndCapCPlus);
493 if (endcapCMinusPresent) {
494 pEndCapCMinus =
new GeoFullPhysVol(lEndCapVolumeC);
499 world->add(topLevelNameTag);
501 world->add(
new GeoIdentifierTag(0));
502 world->add(pEndCapCMinus);
507 GeoFullPhysVol *pCommonEndcapAB[2];
508 GeoFullPhysVol *pCommonEndcapC[2];
510 pCommonEndcapAB[0] = pEndCapABPlus;
511 pCommonEndcapAB[1] = pEndCapABMinus;
512 pCommonEndcapC[0] = pEndCapCPlus;
513 pCommonEndcapC[1] = pEndCapCMinus;
523 xMat.
add(pBarrelVol,
"TRTBarrel");
527 xMat.
add(pEndCapABPlus,
"TRTEndcap");
528 xMat.
add(pEndCapABPlus,
"TRTEndcapA");
530 if (pEndCapABMinus) {
532 xMat.
add(pEndCapABMinus,
"TRTEndcap");
533 xMat.
add(pEndCapABMinus,
"TRTEndcapC");
539 xMat.
add(pEndCapCPlus,
"TRTEndcap_WheelC");
540 xMat.
add(pEndCapCPlus,
"TRTEndcapA_WheelC");
544 xMat.
add(pEndCapCMinus,
"TRTEndcap_WheelC");
545 xMat.
add(pEndCapCMinus,
"TRTEndcapC_WheelC");
564 GeoTube *sBarrelInnerSupport =
new GeoTube(
m_data->innerRadiusOfBarrelVolume,
565 m_data->innerRadiusOfBarrelVolume +
m_data->thicknessOfBarrelInnerSupport,
566 m_data->lengthOfBarrelVolume/2);
569 GeoLogVol *lBarrelInnerSupport =
new GeoLogVol(
"BarrelInnerSupport", sBarrelInnerSupport,
575 GeoPhysVol *pBarrelInnerSupport =
new GeoPhysVol(lBarrelInnerSupport);
576 pBarrelVol->add(pBarrelInnerSupport);
579 GeoTube *sBarrelOuterSupport =
new GeoTube(
m_data->outerRadiusOfBarrelVolume -
m_data->thicknessOfBarrelOuterSupport,
580 m_data->outerRadiusOfBarrelVolume,
m_data->lengthOfBarrelVolume/2);
582 GeoLogVol *lBarrelOuterSupport =
new GeoLogVol(
"BarrelOuterSupport", sBarrelOuterSupport,
588 GeoPhysVol *pBarrelOuterSupport =
new GeoPhysVol(lBarrelOuterSupport);
589 pBarrelVol->add(pBarrelOuterSupport);
593 if (
m_data->includeBarServiceAndFlange) {
602 GeoTube *sEndFlangeRegion =
new GeoTube(
m_data->barFlangeRMin,
m_data->barFlangeRMax,
604 GeoLogVol *lEndFlangeRegion =
new GeoLogVol(
"EndFlangeRegion", sEndFlangeRegion,
607 GeoPhysVol *pEndFlangeRegion =
new GeoPhysVol(lEndFlangeRegion);
609 double zPosEndFlange = (
m_data->barFlangeZMin+
m_data->barFlangeZMax)/2;
610 GeoTransform *xfEndFlangeRegionPlus =
new GeoTransform(GeoTrf::TranslateZ3D(zPosEndFlange));
611 GeoTransform *xfEndFlangeRegionMinus =
new GeoTransform(GeoTrf::TranslateZ3D(-zPosEndFlange));
613 pBarrelVol->add(xfEndFlangeRegionPlus);
614 pBarrelVol->add(pEndFlangeRegion);
615 pBarrelVol->add(xfEndFlangeRegionMinus);
616 pBarrelVol->add(pEndFlangeRegion);
625 GeoTube *sServices =
new GeoTube(
m_data->barServicesRMin,
m_data->barServicesRMax,
627 GeoLogVol *lServices =
new GeoLogVol(
"Services", sServices,
630 GeoPhysVol *pServices =
new GeoPhysVol(lServices);
632 double zPosServices = (
m_data->barServicesZMin+
m_data->barServicesZMax)/2;
633 GeoTransform *xfServicesPlus =
new GeoTransform(GeoTrf::TranslateZ3D(zPosServices));
634 GeoTransform *xfServicesMinus =
new GeoTransform(GeoTrf::TranslateZ3D(-zPosServices));
636 pBarrelVol->add(xfServicesPlus);
637 pBarrelVol->add(pServices);
638 pBarrelVol->add(xfServicesMinus);
639 pBarrelVol->add(pServices);
651 std::vector<InDetDD::TRT_BarrelDescriptor *> bDescriptor;
656 GeoTube *sCoolingTube =
new GeoTube(0,
m_data->barrelOuterRadiusOfCoolingTube,
m_data->lengthOfBarrelVolume/2.0);
657 GeoLogVol *lCoolingTube =
new GeoLogVol(
"CoolingTube",sCoolingTube,
m_materialManager->getMaterial(
"trt::CoolingTube"));
658 GeoPhysVol *pCoolingTube =
new GeoPhysVol(lCoolingTube);
660 GeoTube *sCoolingFluid =
new GeoTube(0,
m_data->barrelInnerRadiusOfCoolingTube,
m_data->lengthOfBarrelVolume/2.0);
661 GeoLogVol *lCoolingFluid =
new GeoLogVol(
"CoolingFluid",sCoolingFluid,
m_materialManager->getMaterial(
"trt::CoolingFluid"));
662 GeoPhysVol*pCoolingFluid =
new GeoPhysVol(lCoolingFluid);
664 pCoolingTube->add(pCoolingFluid);
666 double lengthOfInnerDeadRegion=
m_data->lengthOfDeadRegion;
667 double lengthOfActiveGas = (
m_data->barrelLengthOfStraw-
m_data->barrelLengthOfTwister)/2.0 -
m_data->lengthOfDeadRegion - lengthOfInnerDeadRegion;
668 double activeGasZPositionNormalStraws = (lengthOfActiveGas +
m_data->barrelLengthOfTwister) / 2. + lengthOfInnerDeadRegion;
670 lengthOfInnerDeadRegion =
m_data->barrelLengthOfLargeDeadRegion;
671 lengthOfActiveGas = (
m_data->barrelLengthOfStraw-
m_data->barrelLengthOfTwister)/2.0 -
m_data->lengthOfDeadRegion - lengthOfInnerDeadRegion;
672 double activeGasZPositionStrawsWithLargeDeadRegion = (lengthOfActiveGas +
m_data->barrelLengthOfTwister) / 2. + lengthOfInnerDeadRegion;
675 for (
size_t iABC=0;iABC<
m_data->nBarrelRings;iABC++) {
679 GeoLogVol *lRad =
nullptr;
680 GeoLogVol *lShell =
nullptr;
683 std::ostringstream shellstream;
684 shellstream <<
"Shell" << iABC;
690 if ( shellCorner1.y() <= 0 ) {
ATH_MSG_DEBUG(
"shellCorner1 is <= 0 (" << shellCorner1 <<
")"); }
691 if ( shellCorner2.y() <= 0 ) {
ATH_MSG_DEBUG(
"shellCorner2 is <= 0 (" << shellCorner2 <<
")"); }
692 if ( shellCorner3.y() <= 0 ) {
ATH_MSG_DEBUG(
"shellCorner3 is <= 0 (" << shellCorner3 <<
")" ); }
693 if ( shellCorner4.y() <= 0 ) {
ATH_MSG_DEBUG(
"shellCorner4 is <= 0 (" << shellCorner4 <<
")"); }
695 shellCorner1,shellCorner2,shellCorner3,shellCorner4,shellPosition);
698 std::ostringstream layerstr;
701 std::string shellMatName =
"trt::ModuleShell"+layerstr.str();
702 std::string shellName =
"ModuleShell"+layerstr.str();
706 lShell =
new GeoLogVol(shellName, sShell, shellMat);
714 shellCorner1,shellCorner2,shellCorner3,shellCorner4,
715 radAbsolutePosition,
m_data->barrelThicknessOfModuleWalls);
718 std::string radMatName =
"trt::FibreRadiator"+layerstr.str();
719 std::string radName =
"FibreRadiator"+layerstr.str();
724 lRad =
new GeoLogVol(radName, sRad, radMat);
728 GeoTransform *xCool1 =
new GeoTransform(shellPosition.inverse()
729 *GeoTrf::Translate3D(
m_data->barrelXOfCoolingTube[iABC][0],
m_data->barrelYOfCoolingTube[iABC][0],0));
730 GeoTransform *xCool2 =
new GeoTransform(shellPosition.inverse()
731 *GeoTrf::Translate3D(
m_data->barrelXOfCoolingTube[iABC][1],
m_data->barrelYOfCoolingTube[iABC][1],0));
737 size_t nStrawsWithLargeDeadRegion = 0;
739 for (
size_t iLayer = 0; iLayer<
m_data->barrelNumberOfLayersWithLargeDeadRegion; iLayer++) {
740 nStrawsWithLargeDeadRegion +=
m_data->barrelNumberOfStrawsInStrawLayer[iABC][iLayer];
745 GeoTrf::TranslateX3D Xx(1.0);
746 GeoTrf::TranslateY3D Xy(1.0);
748 GENFUNCTION fx =
ArrayFunction(&
m_data->strawXPosition[iABC][0+nStrawsWithLargeDeadRegion],
749 &
m_data->strawXPosition[iABC][0]+
m_data->barrelNumberOfStrawsInModule[iABC]);
751 GENFUNCTION fy =
ArrayFunction(&
m_data->strawYPosition[iABC][0+nStrawsWithLargeDeadRegion],
752 &
m_data->strawYPosition[iABC][0]+
m_data->barrelNumberOfStrawsInModule[iABC]);
753 TRANSFUNCTION tx1 = Pow(Xx,fx)*Pow(Xy,fy);
756 GENFUNCTION fxDead =
ArrayFunction(&
m_data->strawXPosition[iABC][0], &
m_data->strawXPosition[iABC][0+nStrawsWithLargeDeadRegion]);
757 GENFUNCTION fyDead =
ArrayFunction(&
m_data->strawYPosition[iABC][0], &
m_data->strawYPosition[iABC][0+nStrawsWithLargeDeadRegion]);
758 TRANSFUNCTION tx1Dead = Pow(Xx,fxDead)*Pow(Xy,fyDead);
764 TRANSFUNCTION tx1All = Pow(Xx,fxAll)*Pow(Xy,fyAll);
776 m_data->strawYPosition[iABC][
m_data->barrelIndexOfSecondGlobalAlignmentStraw[iABC]],0);
782 GeoTrf::Vector2D local12((Align2Local - Align1Local).
x(),(Align2Local - Align1Local).
y());
783 GeoTrf::Vector2D global12((Align2Global - Align1Global).
x(),(Align2Global - Align1Global).
y());
784 double zrotang = global12.phi()-local12.phi();
788 GeoTrf::Transform3D absStrawXForm = GeoTrf::Translate3D(Align1Global.x(),Align1Global.y(),Align1Global.z())
789 *GeoTrf::RotateZ3D( zrotang )
790 *GeoTrf::Translate3D(-Align1Local.x(),-Align1Local.y(),-Align1Local.z());
796 TRANSFUNCTION tx2=shellPosition.inverse()*absStrawXForm*tx1;
797 TRANSFUNCTION tx2Dead=shellPosition.inverse()*absStrawXForm*tx1Dead;
798 TRANSFUNCTION tx2All=shellPosition.inverse()*absStrawXForm*tx1All;
810 while (c< m_data->barrelNumberOfStrawsInModule[iABC] ) {
833 if((iABC==0)&&(iLayer<=m_data->barrelNumberOfLayersWithLargeDeadRegion )) {
835 double lengthOfActiveGas=
836 (
m_data->barrelLengthOfStraw-
m_data->barrelLengthOfTwister)/2.0 -
m_data->lengthOfDeadRegion-
m_data->barrelLengthOfLargeDeadRegion;
837 double startZOfActiveGas=activeGasZPositionStrawsWithLargeDeadRegion-lengthOfActiveGas/2.0;
838 bDescriptor.back()->strawZPos(activeGasZPositionStrawsWithLargeDeadRegion);
839 bDescriptor.back()->strawZDead(startZOfActiveGas);
840 bDescriptor.back()->strawLength(lengthOfActiveGas);
842 double lengthOfActiveGas=(
m_data->barrelLengthOfStraw-
m_data->barrelLengthOfTwister)/2.0 - 2*
m_data->lengthOfDeadRegion;
843 double startZOfActiveGas=activeGasZPositionNormalStraws-lengthOfActiveGas/2.0;
844 bDescriptor.back()->strawZPos(activeGasZPositionNormalStraws);
845 bDescriptor.back()->strawZDead(startZOfActiveGas);
846 bDescriptor.back()->strawLength(lengthOfActiveGas);
850 bDescriptor.back()->addStraw(
z,
x);
859 pBarrelVol->add(
new GeoSerialIdentifier(0));
860 for (
size_t iMod = 0; iMod<
m_data->nBarrelModulesUsed;iMod++) {
866 GeoFullPhysVol * pShell =
new GeoFullPhysVol(lShell);
870 GeoAlignableTransform * xfx1 =
new GeoAlignableTransform(GeoTrf::RotateZ3D(delta)*shellPosition);
871 pBarrelVol->add(xfx1);
872 pBarrelVol->add(pShell);
881 pShell->add(
new GeoIdentifierTag(iABC));
890 pRad->add(pCoolingTube);
892 pRad->add(pCoolingTube);
893 pRad->add(
new GeoSerialIdentifier(0));
901 ATH_MSG_DEBUG(
"Marking Argon straws from /TRT/Cond/StatusHT:\t"
907 ATH_MSG_DEBUG(
"Marking Krypton straws from /TRT/Cond/StatusHT:\t"
913 ATH_MSG_DEBUG(
"Marking Xenon straws from /TRT/Cond/StatusHT:\t"
916 pHoleForMixedStrawWithLargeDeadRegion =
makeStraw(
true);
920 throw std::runtime_error(
"Unexpected gas mixture");
926 ,
m_data->barrelNumberOfStrawsInModule[iABC]-nStrawsWithLargeDeadRegion);
931 , nStrawsWithLargeDeadRegion);
932 pRad->add(serialTransformerDead);
934 pRad->add(serialTransformer);
949 for (
unsigned int iStrawLayer=0;iStrawLayer<nStrawLayers; iStrawLayer++) {
951 unsigned int jStrawLayer=iStrawLayer;
970 for (
unsigned int e=0;
e<2;
e++) {
971 for (
unsigned int iMod=0;iMod<
m_data->nBarrelModulesUsed; iMod++) {
973 for (
unsigned int iABC=0;iABC<
m_data->nBarrelRings;iABC++) {
987 for (
unsigned int e=0;
e<2;
e++) {
988 for (
unsigned int iABC=0;iABC<
m_data->nBarrelRings;iABC++) {
991 for (
unsigned int iMod=0;iMod<
m_data->nBarrelModulesUsed; iMod++) {
995 current->setPreviousInPhi(prev);
999 if (
m_data->nBarrelModulesUsed==
m_data->nBarrelModules) {
1002 if (
first && last) {
1003 first->setPreviousInPhi(last);
1025 if (!(endcapABPlusPresent || endcapABMinusPresent || endcapCPlusPresent || endcapCMinusPresent)){
1028 unsigned int firstIndexOfA = 0;
1029 unsigned int firstIndexOfB =
m_data->endcapNumberOfAWheels;
1030 unsigned int firstIndexOfC =
m_data->endcapNumberOfAWheels +
m_data->endcapNumberOfBWheels;
1034 if (
m_data->initialLayout) indexUpperBound = firstIndexOfC;
1036 const unsigned int nSides = 2;
1037 const unsigned int nStrawLayMaxEc = 8;
1039 unsigned int iiSide, iiWheel, iiPlane, iiPhi,
counter;
1041 double zdelta = 0.024;
1042 GeoTransform *xfRadiator, *xfPlane, *xfHeatExchanger, *xfFaradayFoilFront, *xfFaradayFoilBack;
1043 GeoTransform *xfInnerSupportGapperA,*xfOuterSupportGapperA, *xfInnerSupportGapperB, *xfOuterSupportGapperB;
1044 GeoFullPhysVol *childPlane =
nullptr;
1047 double RotationsOfStrawPlanes[nStrawLayMaxEc];
1048 double shiftForEachRotation =
m_data->endCapShiftForEachRotation;
1049 RotationsOfStrawPlanes[0] = 0.;
1051 bool oldGeometry =
true;
1053 if (shiftForEachRotation < 0) oldGeometry =
false;
1059 RotationsOfStrawPlanes[
counter] = RotationsOfStrawPlanes[
counter-1] + shiftForEachRotation;
1060 if (RotationsOfStrawPlanes[
counter] >= 1.)
1061 RotationsOfStrawPlanes[
counter] -= 1.;
1065 double RotationsOfStrawPlanesTmp[nStrawLayMaxEc] = {0,0,0,0,2,2,2,2};
1068 RotationsOfStrawPlanes[
counter] = (
counter * shiftForEachRotation) + RotationsOfStrawPlanesTmp[
counter];
1073 std::vector<InDetDD::TRT_EndcapDescriptor*> descriptorsAB[nSides][nStrawLayMaxEc];
1074 std::vector<InDetDD::TRT_EndcapDescriptor*> descriptorsC[nSides][nStrawLayMaxEc];
1078 for(iiSide = 0; iiSide<nSides; iiSide++) {
1079 for(iiPlane = 0; iiPlane < nStrawLayMaxEc; iiPlane++) {
1080 descriptorsAB[iiSide][iiPlane].resize (
m_data->nEndcapPhi);
1081 descriptorsC[iiSide][iiPlane].resize (
m_data->nEndcapPhi);
1088 if (endcapABPlusPresent || endcapABMinusPresent) {
1092 GeoTube* sInnerSupportA =
new GeoTube(
m_data->endCapInnerRadiusOfSupportA,
1093 m_data->endCapInnerRadiusOfSupportA +
m_data->endCapRadialThicknessOfInnerSupportA,
1094 m_data->endCapLengthOfWheelsA/2);
1095 GeoLogVol* lInnerSupportA =
new GeoLogVol(
"InnerSupportA", sInnerSupportA,
m_materialManager->getMaterial(
"trt::InnerSupportA"));
1096 GeoPhysVol* pInnerSupportA =
new GeoPhysVol(lInnerSupportA);
1098 GeoTube* sOuterSupportA =
new GeoTube(
m_data->endCapOuterRadiusOfSupportA -
m_data->endCapRadialThicknessOfOuterSupportA,
1099 m_data->endCapOuterRadiusOfSupportA,
m_data->endCapLengthOfWheelsA/2);
1100 GeoLogVol* lOuterSupportA =
new GeoLogVol(
"OuterSupportA", sOuterSupportA,
m_materialManager->getMaterial(
"trt::OuterSupportA"));
1101 GeoPhysVol* pOuterSupportA =
new GeoPhysVol(lOuterSupportA);
1110 GeoIntrusivePtr<GeoFullPhysVol> pStrawPlaneA =
makeStrawPlane(firstIndexOfA);
1124 GeoTube* sMainRadiatorA =
new GeoTube(
m_data->endCapInnerRadiusOfSupportA +
m_data->endCapRadialThicknessOfInnerSupportA,
1125 m_data->endCapOuterRadiusOfSupportA -
m_data->endCapRadialThicknessOfOuterSupportA
1126 -
m_data->endCapRadialDistFromRadToOuterSupportA,
m_data->endCapMainRadiatorThicknessA/2);
1127 GeoLogVol* lMainRadiatorA =
new GeoLogVol(
"MainRadiatorA",sMainRadiatorA,
m_materialManager->getMaterial(
"trt::FoilRadiatorAC"));
1128 GeoPhysVol* pMainRadiatorA =
new GeoPhysVol(lMainRadiatorA);
1130 GeoTube* sThinRadiatorA =
new GeoTube(
m_data->endCapInnerRadiusOfSupportA +
m_data->endCapRadialThicknessOfInnerSupportA,
1131 m_data->endCapOuterRadiusOfSupportA -
m_data->endCapRadialThicknessOfOuterSupportA
1132 -
m_data->endCapRadialDistFromRadToOuterSupportA,
m_data->endCapThinRadiatorThicknessA/2);
1133 GeoLogVol* lThinRadiatorA =
new GeoLogVol(
"ThinRadiatorA",sThinRadiatorA,
m_materialManager->getMaterial(
"trt::FoilRadiatorAC"));
1134 GeoPhysVol* pThinRadiatorA =
new GeoPhysVol(lThinRadiatorA);
1137 GeoTube* sWheelA =
new GeoTube(
m_data->endCapInnerRadiusOfSupportA,
m_data->endCapOuterRadiusOfSupportA,
m_data->endCapLengthOfWheelsA/2);
1138 GeoLogVol* lWheelA =
new GeoLogVol(
"WheelA", sWheelA,
m_materialManager->getMaterial(
"trt::CO2"));
1176 for(iiSide=0; iiSide<nSides; iiSide++) {
1178 if (pCommonEndcapAB[iiSide]) {
1180 double WheelPlacerA =
m_data->endCapPositionOfFirstWheelA[iiSide];
1182 for(iiWheel=firstIndexOfA; iiWheel < firstIndexOfB; iiWheel++)
1185 WheelPlacerA +=
m_data->endCapDistanceBetweenWheelCentersA[iiSide][iiWheel] ;
1187 GeoFullPhysVol* pWheelA =
new GeoFullPhysVol(lWheelA);
1189 GeoAlignableTransform * xfAlignableModule =
nullptr;
1192 for (iiPlane = 0; iiPlane <
m_data->endCapNumberOfStrawLayersPerWheelA; iiPlane++)
1201 if (iiPlane % 4 == 0) {
1203 int barrel_ec = (iiSide) ? -2 : +2;
1204 xfAlignableModule =
new GeoAlignableTransform(GeoTrf::Transform3D::Identity());
1212 double phiPlane =
m_data->endCapPhiOfFirstStraw + RotationsOfStrawPlanes[iiPlane%nStrawLayMaxEc]*deltaPhiForStrawsA;
1215 if(iiSide && oldGeometry && (iiPlane%8 == 0)) {
1216 phiPlane += deltaPhiForStrawsA;
1219 int bar_ec = (iiSide) ? -2 : +2;
1230 ATH_MSG_DEBUG(
"Marking Argon straws from /TRT/Cond/StatusHT:\t"
1232 childPlane = pStrawPlaneA_Ar->clone();
1235 ATH_MSG_DEBUG(
"Marking Krypton straws from /TRT/Cond/StatusHT:\t"
1237 childPlane = pStrawPlaneA_Kr->clone();
1240 ATH_MSG_DEBUG(
"Marking Xenon straws from /TRT/Cond/StatusHT:\t"
1242 childPlane = pStrawPlaneA->clone();
1246 throw std::runtime_error(
"Unexpected gas mixture");
1251 xfPlane =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionA[iiPlane] -
m_data->endCapLengthOfWheelsA/2)*GeoTrf::RotateZ3D(phiPlane));
1253 if (xfAlignableModule) pWheelA->add(xfAlignableModule);
1254 pWheelA->add(xfPlane);
1255 pWheelA->add(
new GeoIdentifierTag(iiPlane));
1256 pWheelA->add(childPlane);
1260 if(iiWheel==firstIndexOfA && iiPlane < nStrawLayMaxEc)
1261 for(iiPhi = 0; iiPhi <
m_data->nEndcapPhi; iiPhi++)
1267 pDescriptor->
nStraws() =
m_data->endcapNumberOfStrawsInStrawLayer_AWheels/
m_data->nEndcapPhi;
1268 pDescriptor->
strawPitch() = deltaPhiForStrawsA;
1270 double startPhi = phiPlane + iiPhi * pDescriptor->
strawPitch() * pDescriptor->
nStraws();
1284 pDescriptor->
startPhi() = startPhi;
1286 pDescriptor->
strawLength() =
m_data->endCapOuterRadiusOfSupportA -
m_data->endCapRadialThicknessOfOuterSupportA
1287 - 2*
m_data->lengthOfDeadRegion -
m_data->endCapRadialThicknessOfInnerSupportA -
m_data->endCapInnerRadiusOfSupportA;
1288 pDescriptor->
innerRadius() =
m_data->endCapInnerRadiusOfSupportA +
m_data->endCapRadialThicknessOfInnerSupportA
1289 +
m_data->lengthOfDeadRegion;
1292 descriptorsAB[iiSide][iiPlane%nStrawLayMaxEc][iiPhi] = pDescriptor;
1295 for(iiPhi = 0; iiPhi <
m_data->nEndcapPhi; iiPhi++)
1301 int iiPhiOffline = (iiSide==0) ? iiPhi : (3*
m_data->nEndcapPhi/2 - iiPhi - 1)%
m_data->nEndcapPhi;
1303 descriptorsAB[iiSide][iiPlane%nStrawLayMaxEc][iiPhi],
1318 xfRadiator =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionA[
counter-1] -
m_data->endCapLengthOfWheelsA/2
1319 -
m_data->outerRadiusOfStraw -
m_data->endCapThinRadiatorThicknessA/2));
1320 pWheelA->add(xfRadiator);
1321 pWheelA->add(pThinRadiatorA);
1326 xfRadiator =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionA[
counter-1] -
m_data->endCapLengthOfWheelsA/2
1327 +
m_data->outerRadiusOfStraw +
m_data->endCapThinRadiatorThicknessA/2));
1328 pWheelA->add(xfRadiator);
1329 pWheelA->add(pThinRadiatorA);
1333 xfRadiator =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionA[
counter-1] -
m_data->endCapLengthOfWheelsA/2
1334 +
m_data->outerRadiusOfStraw +
m_data->endCapMainRadiatorThicknessA/2));
1335 pWheelA->add(xfRadiator);
1336 pWheelA->add(pMainRadiatorA);
1339 pWheelA->add(pInnerSupportA);
1340 pWheelA->add(pOuterSupportA);
1343 GeoAlignableTransform * xfWheel =
new GeoAlignableTransform( GeoTrf::TranslateZ3D(WheelPlacerA) );
1345 pCommonEndcapAB[iiSide]->add(xfWheel);
1346 pCommonEndcapAB[iiSide]->add(
new GeoIdentifierTag(iiWheel));
1347 pCommonEndcapAB[iiSide]->add(pWheelA);
1350 int barrel_ec = (iiSide) ? -2 : +2;
1354 if (
m_data->includeECFoilHeatExchangerAndMembranes) {
1359 GeoTube* sFaradayFoilWheelAB =
new GeoTube(
m_data->endCapInnerRadiusOfSupportA +
m_data->endCapRadialThicknessOfInnerSupportA,
1360 m_data->endCapOuterRadiusOfSupportA -
m_data->endCapRadialThicknessOfOuterSupportA,
1361 m_data->endCapFaradayFoilThickness/2);
1362 GeoLogVol* lFaradayFoilWheelAB =
new GeoLogVol(
"FaradayKaptonFoil",sFaradayFoilWheelAB,
m_materialManager->getMaterial(
"trt::FaradayFoilMaterial"));
1363 GeoIntrusivePtr<GeoPhysVol> pFaradayFoilWheelAB{
new GeoPhysVol(lFaradayFoilWheelAB)};
1366 GeoTube* sHeatExchangerA =
new GeoTube(
m_data->endCapRMinOfHeatExchanger,
m_data->endCapRMaxOfHeatExchanger,
m_data->endCapHeatExchangerThicknessA/2);
1367 GeoLogVol* lHeatExchangerA =
new GeoLogVol(
"HeatExchangerA",sHeatExchangerA,
m_materialManager->getMaterial(
"trt::HeatExchangerAMat"));
1368 GeoIntrusivePtr<GeoPhysVol> pHeatExchangerA{
new GeoPhysVol(lHeatExchangerA)};
1371 GeoTube* sInnerSupportGapperA =
new GeoTube(
m_data->endCapInnerRadiusOfSupportA,
1372 m_data->endCapInnerRadiusOfSupportA +
m_data->endCapRadialThicknessOfInnerSupportA,
1373 m_data->endCapHeatExchangerThicknessA/2 +
m_data->endCapFaradayFoilThickness/2 + zdelta);
1374 GeoLogVol* lInnerSupportGapperA =
new GeoLogVol(
"InnerSupportGapperA", sInnerSupportGapperA,
m_materialManager->getMaterial(
"trt::InnerSupportA"));
1375 GeoIntrusivePtr<GeoPhysVol> pInnerSupportGapperA{
new GeoPhysVol(lInnerSupportGapperA)};
1377 GeoTube* sOuterSupportGapperA =
new GeoTube(
m_data->endCapOuterRadiusOfSupportA -
m_data->endCapRadialThicknessOfOuterSupportA,
1378 m_data->endCapOuterRadiusOfSupportA,
1379 m_data->endCapHeatExchangerThicknessA/2 +
m_data->endCapFaradayFoilThickness/2 + zdelta);
1380 GeoLogVol* lOuterSupportGapperA =
new GeoLogVol(
"OuterSupportGapperA", sOuterSupportGapperA,
m_materialManager->getMaterial(
"trt::OuterSupportA"));
1381 GeoIntrusivePtr<GeoPhysVol> pOuterSupportGapperA{
new GeoPhysVol(lOuterSupportGapperA)};
1383 if(iiWheel<=firstIndexOfB-1)
1385 xfFaradayFoilFront =
new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerA
1386 -
m_data->endCapLengthOfWheelsA/2
1387 -
m_data->endCapFaradayFoilThickness/2.0));
1388 xfFaradayFoilBack =
new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerA
1389 +
m_data->endCapLengthOfWheelsA/2
1390 +
m_data->endCapFaradayFoilThickness/2.0));
1391 pCommonEndcapAB[iiSide]->add(xfFaradayFoilFront);
1392 pCommonEndcapAB[iiSide]->add(pFaradayFoilWheelAB);
1393 pCommonEndcapAB[iiSide]->add(xfFaradayFoilBack);
1394 pCommonEndcapAB[iiSide]->add(pFaradayFoilWheelAB);
1399 if(iiWheel<firstIndexOfB-1)
1401 xfHeatExchanger =
new GeoTransform(GeoTrf::TranslateZ3D( WheelPlacerA
1402 +
m_data->endCapLengthOfWheelsA/2
1403 +
m_data->endCapFaradayFoilThickness
1404 +
m_data->endCapHeatExchangerThicknessA/2));
1405 pCommonEndcapAB[iiSide]->add(xfHeatExchanger);
1406 pCommonEndcapAB[iiSide]->add(pHeatExchangerA);
1408 xfInnerSupportGapperA =
new GeoTransform(GeoTrf::TranslateZ3D( WheelPlacerA
1409 +
m_data->endCapLengthOfWheelsA/2
1410 +
m_data->endCapFaradayFoilThickness
1411 +
m_data->endCapHeatExchangerThicknessA/2));
1412 xfOuterSupportGapperA =
new GeoTransform(GeoTrf::TranslateZ3D( WheelPlacerA
1413 +
m_data->endCapLengthOfWheelsA/2
1414 +
m_data->endCapFaradayFoilThickness
1415 +
m_data->endCapHeatExchangerThicknessA/2));
1416 pCommonEndcapAB[iiSide]->add(xfInnerSupportGapperA);
1417 pCommonEndcapAB[iiSide]->add(pInnerSupportGapperA);
1418 pCommonEndcapAB[iiSide]->add(xfOuterSupportGapperA);
1419 pCommonEndcapAB[iiSide]->add(pOuterSupportGapperA);
1436 GeoTube* sInnerSupportB =
new GeoTube(
m_data->endCapInnerRadiusOfSupportB,
1437 m_data->endCapInnerRadiusOfSupportB +
m_data->endCapRadialThicknessOfInnerSupportB,
1438 m_data->endCapLengthOfWheelsB/2);
1439 GeoLogVol* lInnerSupportB =
new GeoLogVol(
"InnerSupportB", sInnerSupportB,
m_materialManager->getMaterial(
"trt::InnerSupportB"));
1440 GeoPhysVol* pInnerSupportB =
new GeoPhysVol(lInnerSupportB);
1442 GeoTube* sOuterSupportB =
new GeoTube(
m_data->endCapOuterRadiusOfSupportB -
m_data->endCapRadialThicknessOfOuterSupportB,
1443 m_data->endCapOuterRadiusOfSupportB,
m_data->endCapLengthOfWheelsB/2);
1444 GeoLogVol* lOuterSupportB =
new GeoLogVol(
"OuterSupportB", sOuterSupportB,
m_materialManager->getMaterial(
"trt::OuterSupportB"));
1445 GeoPhysVol* pOuterSupportB =
new GeoPhysVol(lOuterSupportB);
1448 GeoFullPhysVol* pStrawPlaneB_Kr =
nullptr;
1449 GeoFullPhysVol* pStrawPlaneB_Ar =
nullptr;
1454 GeoIntrusivePtr<GeoFullPhysVol> pStrawPlaneB {
makeStrawPlane(firstIndexOfB)};
1458 GeoTube* sMainRadiatorB =
new GeoTube(
m_data->endCapInnerRadiusOfSupportB +
m_data->endCapRadialThicknessOfInnerSupportB,
1459 m_data->endCapOuterRadiusOfSupportB -
m_data->endCapRadialThicknessOfOuterSupportB
1460 -
m_data->endCapRadialDistFromRadToOuterSupportB,
m_data->endCapMainRadiatorThicknessB/2);
1461 GeoLogVol* lMainRadiatorB =
new GeoLogVol(
"MainRadiatorB",sMainRadiatorB,
m_materialManager->getMaterial(
"trt::FoilRadiatorB"));
1462 GeoPhysVol* pMainRadiatorB =
new GeoPhysVol(lMainRadiatorB);
1464 GeoTube* sThinRadiatorB =
new GeoTube(
m_data->endCapInnerRadiusOfSupportB +
m_data->endCapRadialThicknessOfInnerSupportB,
1465 m_data->endCapOuterRadiusOfSupportB -
m_data->endCapRadialThicknessOfOuterSupportB
1466 -
m_data->endCapRadialDistFromRadToOuterSupportB,
1467 m_data->endCapThinRadiatorThicknessB/2);
1468 GeoLogVol* lThinRadiatorB =
new GeoLogVol(
"ThinRadiatorB",sThinRadiatorB,
m_materialManager->getMaterial(
"trt::FoilRadiatorB"));
1469 GeoPhysVol* pThinRadiatorB =
new GeoPhysVol(lThinRadiatorB);
1471 GeoTube* sMiddleRadiatorB =
new GeoTube(
m_data->endCapInnerRadiusOfSupportB +
m_data->endCapRadialThicknessOfInnerSupportB,
1472 m_data->endCapOuterRadiusOfSupportB -
m_data->endCapRadialThicknessOfOuterSupportB
1473 -
m_data->endCapRadialDistFromRadToOuterSupportB,
m_data->endCapMiddleRadiatorThicknessB/2);
1474 GeoLogVol* lMiddleRadiatorB =
new GeoLogVol(
"MiddleRadiatorB",sMiddleRadiatorB,
m_materialManager->getMaterial(
"trt::FoilRadiatorB"));
1475 GeoPhysVol* pMiddleRadiatorB =
new GeoPhysVol(lMiddleRadiatorB);
1479 GeoTube* sWheelB =
new GeoTube(
m_data->endCapInnerRadiusOfSupportB,
m_data->endCapOuterRadiusOfSupportB,
m_data->endCapLengthOfWheelsB/2);
1480 GeoLogVol* lWheelB =
new GeoLogVol(
"WheelB", sWheelB,
m_materialManager->getMaterial(
"trt::CO2"));
1485 for(iiSide=0; iiSide<nSides; iiSide++) {
1487 double WheelPlacerB =
m_data->endCapPositionOfFirstWheelB[iiSide];
1490 if (pCommonEndcapAB[iiSide]) {
1491 for(iiWheel=firstIndexOfB; iiWheel < firstIndexOfC; iiWheel++)
1494 WheelPlacerB +=
m_data->endCapDistanceBetweenWheelCentersB[iiSide][iiWheel];
1496 GeoFullPhysVol* pWheelB =
new GeoFullPhysVol(lWheelB);
1498 GeoAlignableTransform * xfAlignableModule =
nullptr;
1501 for (iiPlane = 0; iiPlane <
m_data->endCapNumberOfStrawLayersPerWheelB; iiPlane++)
1508 if (iiPlane % 4 == 0) {
1510 int barrel_ec = (iiSide) ? -2 : +2;
1511 xfAlignableModule =
new GeoAlignableTransform(GeoTrf::Transform3D::Identity());
1518 int bar_ec = (iiSide) ? -2 : +2;
1529 ATH_MSG_DEBUG(
"Marking Argon straws from /TRT/Cond/StatusHT:\t"
1531 childPlane = pStrawPlaneB_Ar->clone();
1534 ATH_MSG_DEBUG(
"Marking Krypton straws from /TRT/Cond/StatusHT:\t"
1536 childPlane = pStrawPlaneB_Kr->clone();
1539 ATH_MSG_DEBUG(
"Marking Xenon straws from /TRT/Cond/StatusHT:\t"
1541 childPlane = pStrawPlaneB->clone();
1545 throw std::runtime_error(
"Unexpected gas mixture");
1550 double phiPlane =
m_data->endCapPhiOfFirstStraw + RotationsOfStrawPlanes[iiPlane%nStrawLayMaxEc]*deltaPhiForStrawsB;
1553 if(iiSide && oldGeometry && (iiPlane%8 == 0)) {
1554 phiPlane += deltaPhiForStrawsB;
1557 xfPlane =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionB[iiPlane]
1558 -
m_data->endCapLengthOfWheelsB/2)*GeoTrf::RotateZ3D(phiPlane));
1560 if (xfAlignableModule) pWheelB->add(xfAlignableModule);
1561 pWheelB->add(xfPlane);
1562 pWheelB->add(
new GeoIdentifierTag(iiPlane));
1563 pWheelB->add(childPlane);
1566 for(iiPhi = 0; iiPhi <
m_data->nEndcapPhi; iiPhi++)
1572 int iiPhiOffline = (iiSide==0) ? iiPhi : (3*
m_data->nEndcapPhi/2 - iiPhi - 1)%
m_data->nEndcapPhi;
1574 descriptorsAB[iiSide][iiPlane%nStrawLayMaxEc][iiPhi],
1591 xfRadiator =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionB[
counter-1] -
m_data->endCapLengthOfWheelsB/2
1592 +
m_data->outerRadiusOfStraw +
m_data->endCapMainRadiatorThicknessB/2));
1593 pWheelB->add(xfRadiator);
1594 pWheelB->add(pMainRadiatorB);
1601 xfRadiator =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionB[
counter-1] -
m_data->endCapLengthOfWheelsB/2 +
sign*(
m_data->outerRadiusOfStraw +
m_data->endCapThinRadiatorThicknessB/2)));
1602 pWheelB->add(xfRadiator);
1603 pWheelB->add(pThinRadiatorB);
1610 xfRadiator =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionB[
counter-1] -
m_data->endCapLengthOfWheelsB/2 +
sign*(
m_data->outerRadiusOfStraw +
m_data->endCapMiddleRadiatorThicknessB/2)));
1611 pWheelB->add(xfRadiator);
1612 pWheelB->add(pMiddleRadiatorB);
1617 pWheelB->add(pInnerSupportB);
1618 pWheelB->add(pOuterSupportB);
1621 GeoAlignableTransform * xfWheel =
new GeoAlignableTransform(GeoTrf::TranslateZ3D( WheelPlacerB ));
1624 pCommonEndcapAB[iiSide]->add(xfWheel);
1625 pCommonEndcapAB[iiSide]->add(
new GeoIdentifierTag(iiWheel));
1626 pCommonEndcapAB[iiSide]->add(pWheelB);
1629 int barrel_ec = (iiSide) ? -2 : +2;
1634 if (
m_data->includeECFoilHeatExchangerAndMembranes) {
1639 GeoTube* sFaradayFoilWheelAB =
new GeoTube(
m_data->endCapInnerRadiusOfSupportB +
m_data->endCapRadialThicknessOfInnerSupportB,
1640 m_data->endCapOuterRadiusOfSupportB -
m_data->endCapRadialThicknessOfOuterSupportB,
1641 m_data->endCapFaradayFoilThickness/2);
1642 GeoLogVol* lFaradayFoilWheelAB =
new GeoLogVol(
"FaradayKaptonFoil",sFaradayFoilWheelAB,
m_materialManager->getMaterial(
"trt::FaradayFoilMaterial"));
1643 GeoIntrusivePtr<GeoPhysVol> pFaradayFoilWheelAB{
new GeoPhysVol(lFaradayFoilWheelAB)};
1646 GeoTube* sHeatExchangerB =
new GeoTube(
m_data->endCapRMinOfHeatExchanger,
m_data->endCapRMaxOfHeatExchanger,
m_data->endCapHeatExchangerThicknessB/2);
1648 GeoLogVol* lHeatExchangerB =
new GeoLogVol(
"HeatExchangerB", sHeatExchangerB,
m_materialManager->getMaterial(
"trt::HeatExchangerBMat"));
1649 GeoIntrusivePtr<GeoPhysVol> pHeatExchangerB{
new GeoPhysVol(lHeatExchangerB)};
1652 GeoTube* sInnerSupportGapperB =
new GeoTube(
m_data->endCapInnerRadiusOfSupportB,
1653 m_data->endCapInnerRadiusOfSupportB +
m_data->endCapRadialThicknessOfInnerSupportB,
1654 m_data->endCapHeatExchangerThicknessB/2 +
m_data->endCapFaradayFoilThickness/2 + zdelta);
1655 GeoLogVol* lInnerSupportGapperB =
new GeoLogVol(
"InnerSupportGapperB", sInnerSupportGapperB,
m_materialManager->getMaterial(
"trt::InnerSupportB"));
1656 GeoIntrusivePtr<GeoPhysVol> pInnerSupportGapperB{
new GeoPhysVol(lInnerSupportGapperB)};
1658 GeoTube* sOuterSupportGapperB =
new GeoTube(
m_data->endCapOuterRadiusOfSupportB -
m_data->endCapRadialThicknessOfOuterSupportB,
1659 m_data->endCapOuterRadiusOfSupportB,
1660 m_data->endCapHeatExchangerThicknessB/2 +
m_data->endCapFaradayFoilThickness/2 + zdelta);
1661 GeoLogVol* lOuterSupportGapperB =
new GeoLogVol(
"OuterSupportGapperB", sOuterSupportGapperB,
m_materialManager->getMaterial(
"trt::OuterSupportB"));
1662 GeoIntrusivePtr<GeoPhysVol> pOuterSupportGapperB{
new GeoPhysVol(lOuterSupportGapperB)};
1665 if(iiWheel-firstIndexOfB<firstIndexOfC-firstIndexOfB)
1667 xfFaradayFoilFront =
new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerB
1668 -
m_data->endCapLengthOfWheelsB/2
1669 -
m_data->endCapFaradayFoilThickness/2.0));
1670 xfFaradayFoilBack =
new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerB
1671 +
m_data->endCapLengthOfWheelsB/2
1672 +
m_data->endCapFaradayFoilThickness/2.0));
1674 pCommonEndcapAB[iiSide]->add(xfFaradayFoilFront);
1675 pCommonEndcapAB[iiSide]->add(pFaradayFoilWheelAB);
1676 pCommonEndcapAB[iiSide]->add(xfFaradayFoilBack);
1677 pCommonEndcapAB[iiSide]->add(pFaradayFoilWheelAB);
1682 if(iiWheel-firstIndexOfB<firstIndexOfC-firstIndexOfB-1)
1684 xfHeatExchanger =
new GeoTransform(GeoTrf::TranslateZ3D( WheelPlacerB
1685 +
m_data->endCapLengthOfWheelsB/2
1686 +
m_data->endCapFaradayFoilThickness
1687 +
m_data->endCapHeatExchangerThicknessB/2));
1688 pCommonEndcapAB[iiSide]->add(xfHeatExchanger);
1689 pCommonEndcapAB[iiSide]->add(pHeatExchangerB);
1691 xfInnerSupportGapperB =
new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerB
1692 +
m_data->endCapLengthOfWheelsB/2
1693 +
m_data->endCapFaradayFoilThickness
1694 +
m_data->endCapHeatExchangerThicknessB/2));
1696 xfOuterSupportGapperB =
new GeoTransform(GeoTrf::TranslateZ3D(WheelPlacerB
1697 +
m_data->endCapLengthOfWheelsB/2
1698 +
m_data->endCapFaradayFoilThickness
1699 +
m_data->endCapHeatExchangerThicknessB/2));
1700 pCommonEndcapAB[iiSide]->add(xfInnerSupportGapperB);
1701 pCommonEndcapAB[iiSide]->add(pInnerSupportGapperB);
1702 pCommonEndcapAB[iiSide]->add(xfOuterSupportGapperB);
1703 pCommonEndcapAB[iiSide]->add(pOuterSupportGapperB);
1719 if (
m_data->includeECFoilHeatExchangerAndMembranes) {
1722 GeoTube* sMbrane =
new GeoTube(
m_data->endCapRMinOfMbrane,
m_data->endCapRMaxOfMbrane,
m_data->endCapThicknessOfMbrane/2.0);
1723 GeoLogVol* lMbrane =
new GeoLogVol(
"Membrane", sMbrane,
m_materialManager->getMaterial(
"trt::EndCapMbrane"));
1724 GeoPhysVol* pMbrane =
new GeoPhysVol(lMbrane);
1726 GeoTransform *xfMbraneWheelA1 =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapZMinOfMbraneWheelA1 +
m_data->endCapThicknessOfMbrane/2.0));
1727 GeoTransform *xfMbraneWheelA2 =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapZMinOfMbraneWheelA2 +
m_data->endCapThicknessOfMbrane/2.0));
1728 GeoTransform *xfMbraneWheelB1 =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapZMinOfMbraneWheelB1 +
m_data->endCapThicknessOfMbrane/2.0));
1729 GeoTransform *xfMbraneWheelB2 =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapZMinOfMbraneWheelB2 +
m_data->endCapThicknessOfMbrane/2.0));
1731 for(iiSide=0; iiSide<nSides; iiSide++) {
1732 pCommonEndcapAB[iiSide]->add(xfMbraneWheelA1);
1733 pCommonEndcapAB[iiSide]->add(pMbrane);
1734 pCommonEndcapAB[iiSide]->add(xfMbraneWheelA2);
1735 pCommonEndcapAB[iiSide]->add(pMbrane);
1736 pCommonEndcapAB[iiSide]->add(xfMbraneWheelB1);
1737 pCommonEndcapAB[iiSide]->add(pMbrane);
1738 pCommonEndcapAB[iiSide]->add(xfMbraneWheelB2);
1739 pCommonEndcapAB[iiSide]->add(pMbrane);
1747 if (endcapCPlusPresent || endcapCMinusPresent) {
1749 GeoTube* sInnerSupportC =
new GeoTube(
m_data->endCapInnerRadiusOfSupportC,
m_data->endCapInnerRadiusOfSupportC
1750 +
m_data->endCapRadialThicknessOfInnerSupportC,
m_data->endCapLengthOfWheelsC/2);
1751 GeoLogVol* lInnerSupportC =
new GeoLogVol(
"InnerSupportC", sInnerSupportC,
m_materialManager->getMaterial(
"trt::InnerSupportC"));
1752 GeoPhysVol* pInnerSupportC =
new GeoPhysVol(lInnerSupportC);
1754 GeoTube* sOuterSupportC =
new GeoTube(
m_data->endCapOuterRadiusOfSupportC -
m_data->endCapRadialThicknessOfOuterSupportC,
1755 m_data->endCapOuterRadiusOfSupportC,
m_data->endCapLengthOfWheelsC/2);
1756 GeoLogVol* lOuterSupportC =
new GeoLogVol(
"OuterSupportC", sOuterSupportC,
m_materialManager->getMaterial(
"trt::OuterSupportC"));
1757 GeoPhysVol* pOuterSupportC =
new GeoPhysVol(lOuterSupportC);
1760 GeoIntrusivePtr<GeoFullPhysVol> pStrawPlaneC =
makeStrawPlane(firstIndexOfC);
1763 GeoTube* sMainRadiatorC =
new GeoTube(
m_data->endCapInnerRadiusOfSupportC +
m_data->endCapRadialThicknessOfInnerSupportC,
1764 m_data->endCapOuterRadiusOfSupportC -
m_data->endCapRadialThicknessOfOuterSupportC
1765 -
m_data->endCapRadialDistFromRadToOuterSupportC,
m_data->endCapMainRadiatorThicknessC/2);
1766 GeoLogVol* lMainRadiatorC =
new GeoLogVol(
"MainRadiatorC",sMainRadiatorC,
m_materialManager->getMaterial(
"trt::FoilRadiatorAC"));
1767 GeoPhysVol* pMainRadiatorC =
new GeoPhysVol(lMainRadiatorC);
1769 GeoTube* sThinRadiatorC =
new GeoTube(
m_data->endCapInnerRadiusOfSupportC +
m_data->endCapRadialThicknessOfInnerSupportC,
1770 m_data->endCapOuterRadiusOfSupportC -
m_data->endCapRadialThicknessOfOuterSupportC
1771 -
m_data->endCapRadialDistFromRadToOuterSupportC,
m_data->endCapThinRadiatorThicknessC/2);
1772 GeoLogVol* lThinRadiatorC =
new GeoLogVol(
"ThinRadiatorC",sThinRadiatorC,
m_materialManager->getMaterial(
"trt::FoilRadiatorAC"));
1773 GeoPhysVol* pThinRadiatorC =
new GeoPhysVol(lThinRadiatorC);
1776 GeoTube* sWheelC =
new GeoTube(
m_data->endCapInnerRadiusOfSupportC,
m_data->endCapOuterRadiusOfSupportC,
m_data->endCapLengthOfWheelsC/2);
1777 GeoLogVol* lWheelC =
new GeoLogVol(
"WheelC", sWheelC,
m_materialManager->getMaterial(
"trt::CO2"));
1782 for(iiSide=0; iiSide<nSides; iiSide++) {
1784 if (pCommonEndcapC[iiSide]) {
1785 for(iiWheel=firstIndexOfC; iiWheel < indexUpperBound; iiWheel++)
1787 GeoFullPhysVol* pWheelC =
new GeoFullPhysVol(lWheelC);
1790 for (iiPlane = 0; iiPlane <
m_data->endCapNumberOfStrawLayersPerWheelC; iiPlane++)
1793 double phiPlane =
m_data->endCapPhiOfFirstStraw + RotationsOfStrawPlanes[iiPlane%nStrawLayMaxEc]*deltaPhiForStrawsC;
1796 if(iiSide && oldGeometry && (iiPlane%8 == 0)) {
1797 phiPlane += deltaPhiForStrawsC;
1801 childPlane = pStrawPlaneC->clone();
1803 xfPlane =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionC[iiPlane]
1804 -
m_data->endCapLengthOfWheelsC/2)*GeoTrf::RotateZ3D(phiPlane));
1805 pWheelC->add(xfPlane);
1806 pWheelC->add(
new GeoIdentifierTag(iiPlane));
1807 pWheelC->add(childPlane);
1811 if(iiWheel==firstIndexOfC && iiPlane < nStrawLayMaxEc)
1812 for(iiPhi = 0; iiPhi <
m_data->nEndcapPhi; iiPhi++)
1817 pDescriptor->
nStraws() =
m_data->endcapNumberOfStrawsInStrawLayer_CWheels/
m_data->nEndcapPhi;
1818 pDescriptor->
strawPitch() = deltaPhiForStrawsC;
1821 double startPhi = phiPlane + iiPhi * pDescriptor->
strawPitch() * pDescriptor->
nStraws();
1834 pDescriptor->
startPhi() = startPhi;
1836 pDescriptor->
strawLength() =
m_data->endCapOuterRadiusOfSupportC -
m_data->endCapRadialThicknessOfOuterSupportC
1837 - 2*
m_data->lengthOfDeadRegion -
m_data->endCapRadialThicknessOfInnerSupportC -
m_data->endCapInnerRadiusOfSupportC;
1838 pDescriptor->
innerRadius() =
m_data->endCapInnerRadiusOfSupportC +
m_data->endCapRadialThicknessOfInnerSupportC +
m_data->lengthOfDeadRegion;
1842 descriptorsC[iiSide][iiPlane%nStrawLayMaxEc][iiPhi] = pDescriptor;
1846 for(iiPhi = 0; iiPhi <
m_data->nEndcapPhi; iiPhi++)
1852 int iiPhiOffline = (iiSide==0) ? iiPhi : (3*
m_data->nEndcapPhi/2 - iiPhi - 1)%
m_data->nEndcapPhi;
1854 descriptorsC[iiSide][iiPlane%nStrawLayMaxEc][iiPhi],
1870 xfRadiator =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionC[
counter-1] -
m_data->endCapLengthOfWheelsC/2
1871 -
m_data->lengthOfDeadRegion -
m_data->endCapThinRadiatorThicknessC/2));
1872 pWheelC->add(xfRadiator);
1873 pWheelC->add(pThinRadiatorC);
1878 xfRadiator =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionC[
counter-1] -
m_data->endCapLengthOfWheelsC/2
1879 +
m_data->outerRadiusOfStraw +
m_data->endCapThinRadiatorThicknessC/2));
1880 pWheelC->add(xfRadiator);
1881 pWheelC->add(pThinRadiatorC);
1885 xfRadiator =
new GeoTransform(GeoTrf::TranslateZ3D(
m_data->endCapLayerZPositionC[
counter-1] -
m_data->endCapLengthOfWheelsC/2
1886 +
m_data->outerRadiusOfStraw +
m_data->endCapMainRadiatorThicknessC/2));
1887 pWheelC->add(xfRadiator);
1888 pWheelC->add(pMainRadiatorC);
1892 pWheelC->add(pInnerSupportC);
1893 pWheelC->add(pOuterSupportC);
1896 GeoAlignableTransform * xfWheel
1897 =
new GeoAlignableTransform(GeoTrf::TranslateZ3D(
m_data->endCapPositionOfFirstWheelC
1898 + (iiWheel - firstIndexOfC)*
m_data->endCapDistanceBetweenWheelCentersC));
1900 pCommonEndcapC[iiSide]->add(xfWheel);
1901 pCommonEndcapC[iiSide]->add(
new GeoIdentifierTag(iiWheel));
1902 pCommonEndcapC[iiSide]->add(pWheelC);
1905 int barrel_ec = (iiSide) ? -2 : +2;
1918 for (iiSide=0; iiSide<2; iiSide++)
1919 for(iiPhi=0; iiPhi<
m_data->nEndcapPhi; iiPhi++)
1922 for (iiWheel=0; iiWheel<indexUpperBound; iiWheel++)
1929 current->setPreviousInZ(prev);
1978 double openingAngleOfFirstCorner=
angle(delta12,delta14);
1986 double commonSide = (
magn(delta14) +
magn(delta23) + (
sign==1?
magn(delta24):
magn(delta13)) ) / 3.;
1987 double base1 =
magn(delta12);
1988 double base2 =
magn(delta34);
1990 if (shrinkDist!=0) {
1992 double cosAlpha= sqrt(commonSide*commonSide-0.25*base1*base1)/commonSide;
1993 commonSide -= (1+1/cosAlpha)*shrinkDist;
1994 base1 -= 2*shrinkDist;
1995 base2 -= 2*shrinkDist;
1998 double height1 = sqrt (commonSide*commonSide-0.25*base1*base1);
1999 double height2 = sqrt (commonSide*commonSide-0.25*base2*base2);
2000 double rot =
atan(base2/height2/2)-
atan(base1/height1/2);
2002 GeoTrd *trd1 =
new GeoTrd(base1/2+epsilon, epsilon,
length/2,
length/2, height1/2);
2003 GeoTrd *trd2 =
new GeoTrd(epsilon, base2/2+epsilon,
length/2,
length/2, height2/2);
2005 double gamma =
atan((base2/2+epsilon)*2/height2);
2006 double r = sqrt((base2/2+epsilon)*(base2/2+epsilon) + height2*height2/4);
2008 const GeoShape & sShell = (*trd1).add((*trd2)<<xForm);
2015 GeoTrf::Vector2D actualCorner1, actualCorner2, actualCorner3, actualCorner4;
2016 actualCorner1 = corner1;
2032 rotate(modRot,actualCorner1);
2033 rotate(modRot,actualCorner2);
2034 rotate(modRot,actualCorner3);
2035 rotate(modRot,actualCorner4);
2040 GeoTrf::Vector2D displacement = 0.25*( (corner1+corner2+corner3+corner4) - (actualCorner1+actualCorner2+actualCorner3+actualCorner4) );
2046 center += displacement;
2047 actualCorner1 += displacement;
2048 actualCorner2 += displacement;
2049 actualCorner3 += displacement;
2050 actualCorner4 += displacement;
2073 double lengthOfInnerDeadRegion= hasLargeDeadRegion ?
m_data->barrelLengthOfLargeDeadRegion :
m_data->lengthOfDeadRegion ;
2074 double lengthOfActiveGas = (
m_data->barrelLengthOfStraw-
m_data->barrelLengthOfTwister)/2.0 -
m_data->lengthOfDeadRegion - lengthOfInnerDeadRegion;
2075 double posA = (lengthOfActiveGas +
m_data->barrelLengthOfTwister) / 2. + lengthOfInnerDeadRegion;
2076 double posInnerDeadRegion = (
m_data->barrelLengthOfTwister + lengthOfInnerDeadRegion ) / 2;
2079 GeoTube *sHole =
new GeoTube(0,
m_data->barrelOuterRadiusOfStrawHole,
m_data->barrelLengthOfStraw/2.0);
2080 GeoLogVol *lHole =
new GeoLogVol(
"Hole", sHole,
m_materialManager->getMaterial(
"trt::CO2"));
2081 GeoPhysVol *pHole =
new GeoPhysVol(lHole);
2084 GeoTube *sStraw =
new GeoTube(0,
m_data->outerRadiusOfStraw,
m_data->barrelLengthOfStraw/2.0);
2085 GeoLogVol *lStrawMixed =
new GeoLogVol(
"StrawM", sStraw,
m_materialManager->getMaterial(
"trt::Straw"));
2086 GeoPhysVol *pStrawMixed =
new GeoPhysVol(lStrawMixed);
2089 GeoShape *sDeadRegion =
new GeoTube(
m_data->outerRadiusOfWire ,
m_data->innerRadiusOfStraw ,
m_data->lengthOfDeadRegion/2 );
2090 GeoLogVol *lDeadRegion =
nullptr;
2092 lDeadRegion =
new GeoLogVol(
"DeadRegion_Ar", sDeadRegion,
m_materialManager->getMaterial(
"trt::ArCO2O2"));
2094 lDeadRegion =
new GeoLogVol(
"DeadRegion_Kr", sDeadRegion,
m_materialManager->getMaterial(
"trt::KrCO2O2"));
2097 GeoPhysVol *pDeadRegion =
new GeoPhysVol(lDeadRegion);
2100 GeoShape * sInnerDeadRegion =
new GeoTube(
m_data->outerRadiusOfWire ,
m_data->innerRadiusOfStraw, lengthOfInnerDeadRegion/2 );
2101 GeoLogVol * lInnerDeadRegion =
nullptr;
2103 lInnerDeadRegion =
new GeoLogVol(
"InnerDeadRegion_Ar", sInnerDeadRegion,
m_materialManager->getMaterial(
"trt::ArCO2O2"));
2105 lInnerDeadRegion =
new GeoLogVol(
"InnerDeadRegion_Kr", sInnerDeadRegion,
m_materialManager->getMaterial(
"trt::KrCO2O2"));
2108 GeoPhysVol* pInnerDeadRegion =
new GeoPhysVol(lInnerDeadRegion);
2111 GeoShape *sTwister =
new GeoTube(
m_data->outerRadiusOfWire ,
m_data->innerRadiusOfStraw,
m_data->barrelLengthOfTwister/2);
2112 GeoLogVol *lTwister =
new GeoLogVol(
"Twister", sTwister,
m_materialManager->getMaterial(
"trt::Twister"));
2113 GeoPhysVol *pTwister =
new GeoPhysVol(lTwister);
2116 GeoShape *sWire =
new GeoTube( 0,
m_data->outerRadiusOfWire,
m_data->barrelLengthOfStraw/2.0);
2117 GeoLogVol *lWire =
new GeoLogVol(
"Wire", sWire,
m_materialManager->getMaterial(
"trt::Wire"));
2118 GeoPhysVol *pWire =
new GeoPhysVol(lWire);
2124 GeoTube *sGasMA =
new GeoTube(
m_data->outerRadiusOfWire ,
m_data->innerRadiusOfStraw,lengthOfActiveGas/2.0);
2125 GeoLogVol * lGasMA =
nullptr;
2127 lGasMA =
new GeoLogVol(
"GasMA_Ar", sGasMA,
m_materialManager->getMaterial(
"trt::ArCO2O2"));
2129 lGasMA =
new GeoLogVol(
"GasMA_Kr", sGasMA,
m_materialManager->getMaterial(
"trt::KrCO2O2"));
2132 GeoNameTag *nGasMAPos =
new GeoNameTag(
"GasMAPos");
2133 GeoTransform *xGasMAPos =
new GeoTransform(GeoTrf::RotateY3D(
M_PI)*GeoTrf::TranslateZ3D(-posA));
2134 GeoNameTag *nGasMANeg =
new GeoNameTag(
"GasMANeg");
2135 GeoTransform *xGasMANeg =
new GeoTransform(GeoTrf::TranslateZ3D(-posA));
2136 GeoPhysVol *pGasMA =
new GeoPhysVol(lGasMA);
2139 GeoSerialIdentifier *
id =
new GeoSerialIdentifier(0);
2140 pStrawMixed->add(
id);
2141 pStrawMixed->add(nGasMANeg);
2142 pStrawMixed->add(xGasMANeg);
2143 pStrawMixed->add(pGasMA);
2144 pStrawMixed->add(nGasMAPos);
2145 pStrawMixed->add(xGasMAPos);
2146 pStrawMixed->add(pGasMA);
2149 GeoSerialDenominator *nDeadMA =
new GeoSerialDenominator(
"DeadRegionL");
2150 GeoTransform *xDeadPosMA =
new GeoTransform(GeoTrf::TranslateZ3D(+(
m_data->barrelLengthOfStraw-
m_data->lengthOfDeadRegion)/2.0));
2151 GeoTransform *xDeadNegMA =
new GeoTransform(GeoTrf::TranslateZ3D(-(
m_data->barrelLengthOfStraw-
m_data->lengthOfDeadRegion)/2.0));
2154 pStrawMixed->add(nDeadMA);
2155 pStrawMixed->add(xDeadPosMA);
2156 pStrawMixed->add(pDeadRegion);
2157 pStrawMixed->add(xDeadNegMA);
2158 pStrawMixed->add(pDeadRegion);
2161 GeoSerialDenominator *nInnerDeadMA =
new GeoSerialDenominator(
"InnerDeadRegionL");
2162 GeoTransform *xInnerDeadPosMA =
new GeoTransform(GeoTrf::TranslateZ3D(+posInnerDeadRegion));
2163 GeoTransform *xInnerDeadNegMA =
new GeoTransform(GeoTrf::TranslateZ3D(-posInnerDeadRegion));
2165 pStrawMixed->add(nInnerDeadMA);
2166 pStrawMixed->add(xInnerDeadPosMA);
2167 pStrawMixed->add(pInnerDeadRegion);
2168 pStrawMixed->add(xInnerDeadNegMA);
2169 pStrawMixed->add(pInnerDeadRegion);
2172 GeoNameTag *nTwister =
new GeoNameTag(
"TwisterM");
2173 pStrawMixed->add(nTwister);
2174 pStrawMixed->add(pTwister);
2177 GeoNameTag *nWire =
new GeoNameTag(
"WireM");
2178 pStrawMixed->add(nWire);
2179 pStrawMixed->add(pWire);
2181 pHole->add(pStrawMixed);
2204 const size_t firstIndexOfC = 14;
2206 unsigned iplane = 0;
2214 if (
w>=firstIndexOfC) {
2218 nstraws=
m_data->endcapNumberOfStrawsInStrawLayer_CWheels;
2224 nstraws=
m_data->endcapNumberOfStrawsInStrawLayer_AWheels;
2228 double MultiplierForStrawLength = 0.999;
2230 double ldead =
m_data->lengthOfDeadRegion;
2231 double r0 =
m_data->outerRadiusOfWire;
2232 double r1 =
m_data->innerRadiusOfStraw;
2233 double r2 =
m_data->outerRadiusOfStraw;
2236 if (
w >= firstIndexOfC) {
2238 R0 =
m_data->endcapOuterRadiusOfInnerSupport_wheelC;
2239 R1 =
m_data->endcapInnerRadiusOfOuterSupport_wheelC;
2242 R0 =
m_data->endcapOuterRadiusOfInnerSupport_wheelAB;
2243 R1 =
m_data->endcapInnerRadiusOfOuterSupport_wheelAB;
2246 double Length = (R1-R0)*MultiplierForStrawLength;
2247 double pos = 0.5*(R0+R1);
2250 GeoFullPhysVol *pStrawPlane=
nullptr;
2251 GeoTube *sStrawPlane =
new GeoTube(R0,R1,r2);
2252 GeoLogVol *lStrawPlane =
new GeoLogVol(
"StrawPlane", sStrawPlane,
m_materialManager->getMaterial(
"trt::CO2"));
2253 pStrawPlane =
new GeoFullPhysVol(lStrawPlane);
2256 GeoTube *sStraw =
new GeoTube( 0, r2, Length/2.0);
2257 GeoLogVol *lStraw =
new GeoLogVol(
"Straw",sStraw,
m_materialManager->getMaterial(
"trt::Straw"));
2258 GeoPhysVol *pStraw =
new GeoPhysVol(lStraw);
2261 double dphi = 2*
M_PI/ nstraws;
2262 GeoTrf::RotateZ3D Rz(1.0);
2263 GeoTrf::TranslateX3D Tx(1.0);
2264 GeoTrf::TranslateY3D Ty(1.0);
2269 GeoSerialTransformer *serialTransformer=
new GeoSerialTransformer(pStraw, &
tx, nstraws);
2270 pStrawPlane->add(
new GeoSerialIdentifier(0));
2271 pStrawPlane->add(serialTransformer);
2274 if (
w<firstIndexOfC) {
2284 GeoTube *sGas =
new GeoTube (
r0,r1,(Length-2*ldead)/2);
2285 GeoLogVol *lGas =
nullptr;
2287 lGas =
new GeoLogVol(
"Gas_Ar", sGas,
m_materialManager->getMaterial(
"trt::ArCO2O2"));
2289 lGas =
new GeoLogVol(
"Gas_Kr", sGas,
m_materialManager->getMaterial(
"trt::KrCO2O2"));
2292 GeoPhysVol *pGas =
new GeoPhysVol(lGas);
2296 GeoTube *sDeadRegion =
new GeoTube(
r0,r1,ldead/2);
2297 GeoLogVol *lDeadRegion =
nullptr;
2299 lDeadRegion =
new GeoLogVol(
"DeadRegion_Ar",sDeadRegion,
m_materialManager->getMaterial(
"trt::ArCO2O2"));
2301 lDeadRegion =
new GeoLogVol(
"DeadRegion_Kr",sDeadRegion,
m_materialManager->getMaterial(
"trt::KrCO2O2"));
2304 GeoPhysVol *pDeadRegion =
new GeoPhysVol(lDeadRegion);
2306 GeoTransform *xDeadPos =
new GeoTransform(GeoTrf::TranslateZ3D(+(Length/2-ldead/2)));
2307 GeoTransform *xDeadNeg =
new GeoTransform(GeoTrf::TranslateZ3D(-(Length/2-ldead/2)));
2308 pStraw->add(xDeadPos);
2309 pStraw->add(pDeadRegion);
2310 pStraw->add(xDeadNeg);
2311 pStraw->add(pDeadRegion);
2315 GeoTube *sWire =
new GeoTube( 0,
r0, Length/2);
2316 GeoLogVol *lWire =
new GeoLogVol(
"Wire", sWire,
m_materialManager->getMaterial(
"trt::Wire"));
2317 GeoPhysVol *pWire =
new GeoPhysVol(lWire);
2320 if (
w>=firstIndexOfC) {
2348 throw std::runtime_error(
"Unexpected StatusHT value");