The stereo angle is defined clock-wise from the y-axis. So we need to input it with a minus when defining the trapezoid
37 {
38
40 <<std::endl<<std::endl<<
m_geoUtilTool->dumpVolume(define.physVol->getParent()));
41 const GeoShape* shape =
m_geoUtilTool->extractShape(define.physVol);
42 if (!shape) {
44 return StatusCode::FAILURE;
45 }
48 if (shape->typeID() != GeoTrd::getClassTypeID()) {
50 return StatusCode::FAILURE;
51 }
52
53 const GeoTrd* trapezoid = static_cast<const GeoTrd*>(shape);
54 define.halfThickness = trapezoid->getXHalfLength1() * Gaudi::Units::mm;
55 define.halfShortWidth = trapezoid->getYHalfLength1() * Gaudi::Units::mm;
56 define.halfLongWidth = trapezoid->getYHalfLength2() * Gaudi::Units::mm;
57 define.halfHeight = trapezoid->getZHalfLength() * Gaudi::Units::mm;
58
60 <<", halfThickness: "<<define.halfThickness<<"/"
61 <<", halfShortWidth : "<<define.halfShortWidth<<"/"
62 <<", halfLongWidth : "<<define.halfLongWidth<<"/"
63 <<", halfHeight : "<<define.halfHeight);
64
65
66 std::vector<physVolWithTrans> allGasGaps =
m_geoUtilTool->findAllLeafNodesByName(define.physVol,
"actMicroMegaGas");
67 if (allGasGaps.empty()) {
69 return StatusCode::FAILURE;
70 }
71
73 define.nGasGaps = allGasGaps.size();
75
76 FactoryCache::ParamBookTable::const_iterator parBookItr = factoryCache.parameterBook.find(define.chambDesign);
77 if (parBookItr == factoryCache.parameterBook.end()) {
78 ATH_MSG_FATAL(
"The chamber "<<define.chambDesign<<
" is not part of the WMM table");
79 return StatusCode::FAILURE;
80 }
81
82 const wMMTable& paramBook{parBookItr->second};
83
85
86 for (std::size_t gap = 0;
gap < allGasGaps.size(); ++
gap) {
87
88 auto& gapVol = allGasGaps[
gap];
90
91
92
93 ATH_MSG_DEBUG(
"quadruplet " << define.chambDesign.substr(6,7) <<
" stereoAngle : " << paramBook.stereoAngle.at(gap) <<
" totalStrips " << paramBook.totalActiveStrips.at(gap) <<
" GasGAP POS X : " << posGapI.x() );
94
95 const GeoShape* gapShape =
m_geoUtilTool->extractShape(gapVol.volume);
96 if (gapShape->typeID() != GeoTrd::getClassTypeID()) {
98 return StatusCode::FAILURE;
99 }
100
101 bool isStereo = static_cast<bool>(paramBook.stereoAngle.at(gap));
102
103 const GeoTrd* gapTrd = static_cast<const GeoTrd*>(gapShape);
105 double gapHalfHeight = gapTrd->getZHalfLength();
106 double gapHalfShortY = std::min(gapTrd->getYHalfLength1(), gapTrd->getYHalfLength2());
107 double gapHalfLongY = std::max(gapTrd->getYHalfLength1(), gapTrd->getYHalfLength2());
108
109 double firstStripPos{0.};
110 int firstActiveStrip{0};
111 if (isStereo) {
112 firstActiveStrip = paramBook.nMissedBottomStereo + 1;
113 firstStripPos = -gapHalfHeight + (1.*(firstActiveStrip - paramBook.nMissedBottomEta) -0.5)* paramBook.stripPitch;
114 } else {
115 firstActiveStrip = paramBook.nMissedBottomEta + 1;
116 firstStripPos = -gapHalfHeight + 0.5*paramBook.stripPitch;
117 }
118
119
120
122
123 stripDesign->defineStripLayout(firstStripPos * Amg::Vector2D::UnitX(),
124 paramBook.stripPitch,
125 paramBook.stripWidth,
126 paramBook.totalActiveStrips.at(gap),
127 firstActiveStrip);
128
130 stripDesign->defineTrapezoid(gapHalfShortY, gapHalfLongY, gapHalfHeight, paramBook.stereoAngle.at(gap));
131
132
136
137
138 stripDesign = (*factoryCache.stripDesigns.emplace(stripDesign).first);
139 auto stripLayer = std::make_unique<StripLayer>(factoryCache.trfNodeMaker.makeTransform(stripLayerRotation),
140 stripDesign,
141 IdentifierHash{static_cast<unsigned int>(gap)});
142 define.layers.push_back(*factoryCache.stripLayers.emplace(std::move(stripLayer)).first);
143 }
144 return StatusCode::SUCCESS;
145}
#define ATH_MSG_VERBOSE(x)
Amg::Transform3D getRotateZ3D(double angle)
get a rotation transformation around Z-axis
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Amg::Transform3D getRotateY3D(double angle)
get a rotation transformation around Y-axis
gap(flags, cells_name, *args, **kw)
GeoModel::TransientConstSharedPtr< StripDesign > StripDesignPtr