46 <<std::endl<<std::endl<<
m_geoUtilTool->dumpVolume(define.physVol));
47 const GeoShape* shape =
m_geoUtilTool->extractShape(define.physVol);
50 return StatusCode::FAILURE;
53 if (shape->typeID() != GeoTrd::getClassTypeID()) {
55 <<
" is expected to be a trapezoid "<<
m_geoUtilTool->dumpShape(shape));
56 return StatusCode::FAILURE;
58 const GeoTrd* chambTrd =
static_cast<const GeoTrd*
>(shape);
59 define.halfWidthShort =
std::min(chambTrd->getYHalfLength1(), chambTrd->getYHalfLength2());
60 define.halfWidthLong =
std::max(chambTrd->getYHalfLength1(), chambTrd->getYHalfLength2());
61 define.halfHeight = chambTrd->getZHalfLength();
62 define.halfThickness = chambTrd->getXHalfLength1();
64 std::vector<physVolWithTrans> allGasGaps =
m_geoUtilTool->findAllLeafNodesByName(define.physVol,
"TgcGas");
65 if (allGasGaps.empty()) {
68 return StatusCode::FAILURE;
72 std::stringstream
key{};
74 <<(
m_idHelperSvc->stationEta(define.detElId) > 0 ?
"A" :
"C");
79 if (!stripLayout || !wireLayout) {
80 const wTgcTable&
table{factoryCache.parameterBook[
key.str()]};
84 <<
" "<<define.chambDesign<<
", gasGap "<<(
gasGap+1));
85 return StatusCode::FAILURE;
87 const GeoShape* gapShape =
m_geoUtilTool->extractShape(pVolTrans.volume);
88 if (gapShape->typeID() != GeoTrd::getClassTypeID()) {
90 <<
" to be a trapezoid");
91 return StatusCode::FAILURE;
93 const GeoTrd* gapTrd =
static_cast<const GeoTrd*
>(gapShape);
95 const double halfMinX =
std::min(gapTrd->getYHalfLength1(), gapTrd->getYHalfLength2());
96 const double halfMaxX =
std::max(gapTrd->getYHalfLength1(), gapTrd->getYHalfLength2());
97 const double halfY = gapTrd->getZHalfLength();
99 if (!wireLayout &&
table.wireGangs.size()) {
101 wireGrp->defineTrapezoid(halfMinX, halfMaxX, halfY);
102 for (
unsigned int gang :
table.wireGangs) {
103 wireGrp->declareGroup(gang);
105 const double wireOffSet = -0.5*
table.wirePitch * wireGrp->nAllWires();
114 wireLayout = std::make_unique<StripLayer>(trans, (*factoryCache.wireLayouts.insert(std::move(wireGrp)).first),
hash);
116 if (!stripLayout &&
table.bottomStripPos.size()) {
118 radDesign->defineTrapezoid(halfMinX, halfMaxX, halfY);
120 0.,0.,
table.bottomStripPos.size());
121 radDesign->flipTrapezoid();
122 for (
size_t s = 0;
s <
table.bottomStripPos.size(); ++
s) {
123 radDesign->addStrip(
table.bottomStripPos.at(
s),
131 stripLayout = std::make_unique<StripLayer>(trans, (*factoryCache.stripLayouts.insert(std::move(radDesign)).first),
hash);
136 unsigned int stripIdx =
static_cast<unsigned>(stripLayout->hash());
137 if (stripIdx >= define.sensorLayouts.size()) {
139 return StatusCode::FAILURE;
141 define.sensorLayouts[stripIdx] = stripLayout;
144 unsigned int wireIdx =
static_cast<unsigned>(wireLayout->hash());
145 if (wireIdx >= define.sensorLayouts.size()) {
147 return StatusCode::FAILURE;
149 define.sensorLayouts[wireIdx] = wireLayout;
153 return StatusCode::SUCCESS;