51 std::map<LayerKey, std::vector<ModuleEntry>> hashMap;
56 for (
int hash = 0; hash < static_cast<int>(
m_pixelId->wafer_hash_max());
63 const short barrelEc =
m_pixelId->barrel_ec(offlineId);
64 if (std::abs(barrelEc) > 2) {
68 const short phiIndex =
m_pixelId->phi_module(offlineId);
69 const short etaIndex =
m_pixelId->eta_module(offlineId);
70 const int layerDisk =
m_pixelId->layer_disk(offlineId);
71 const int etaModule =
m_pixelId->eta_module(offlineId);
76 }
else if (barrelEc == -2) {
78 }
else if (barrelEc == 2) {
84 if (volId == 7 || volId == 9) {
85 newVol = 10 * volId + layerDisk;
87 }
else if (volId == 8) {
88 newVol = 10 * volId + layerDisk;
92 const LayerKey key{barrelEc == 0 ? kBarrelSideKey : barrelEc, kPixel,
93 static_cast<short>(newVol),
static_cast<short>(newLay)};
94 hashMap[key].push_back(
ModuleEntry{phiIndex, etaIndex, hash});
98 for (
int hash = 0; hash < static_cast<int>(
m_stripId->wafer_hash_max());
101 if (offlineId == 0) {
105 const short barrelEc =
m_stripId->barrel_ec(offlineId);
106 const short phiIndex =
m_stripId->phi_module(offlineId);
107 const short etaIndex =
m_stripId->eta_module(offlineId);
117 const int layerDisk =
m_stripId->layer_disk(offlineId);
119 const LayerKey key{barrelEc == 0 ? kBarrelSideKey : barrelEc, kStrip,
120 static_cast<short>(volId),
121 static_cast<short>(layerDisk)};
122 hashMap[key].push_back(
ModuleEntry{phiIndex, etaIndex, hash});
132 std::ofstream geometryStream;
143 std::set<int> layerIds;
145 short layerIndex = 0;
146 for (
const auto& [key, modules] : hashMap) {
147 const auto& [sideKey, technology, volId, layId] = key;
149 const short barrelEc = sideKey == kBarrelSideKey ? 0 : sideKey;
150 const int combinedId =
static_cast<int>(volId) * 1000 + layId;
152 if (!layerIds.insert(combinedId).second) {
154 << combinedId <<
": this detector does not fit the layer "
156 return StatusCode::FAILURE;
159 float refCoordSum = 0.f;
161 double minZ = 100000.0;
162 double maxZ = -100000.0;
163 double minR = 100000.0;
164 double maxR = -100000.0;
168 if (technology == kPixel) {
175 if (element ==
nullptr) [[
unlikely]] {
180 minZ = std::min(minZ, element->
zMin());
181 maxZ = std::max(maxZ, element->
zMax());
182 minR = std::min(minR, element->
rMin());
183 maxR = std::max(maxR, element->
rMax());
188 refCoordSum += barrelEc == 0
189 ? std::hypot(centre(0), centre(1))
195 ATH_MSG_ERROR(
"GBTS layer " << combinedId <<
" has no modules.");
196 return StatusCode::FAILURE;
199 Acts::Experimental::GbtsLayerDescription& layer =
203 layer.id = combinedId;
204 layer.type = barrelEc == 0 ? Acts::Experimental::GbtsLayerType::Barrel
205 : Acts::Experimental::GbtsLayerType::Endcap;
206 layer.technology = technology == kPixel
207 ? Acts::Experimental::GbtsLayerTechnology::Pixel
208 : Acts::Experimental::GbtsLayerTechnology::Strip;
209 layer.refCoord = refCoordSum / nModules;
211 layer.minBound = barrelEc == 0 ? minZ : minR;
212 layer.maxBound = barrelEc == 0 ? maxZ : maxR;
215 geometryStream << minR <<
" " << maxR <<
" " << minZ <<
" " << maxZ <<
" "
216 << combinedId <<
"\n";
220 <<
") : reference coordinate = " << layer.refCoord
221 <<
" boundaries: " << layer.minBound <<
" "
222 << layer.maxBound <<
" type=" << barrelEc
224 << (technology == kPixel ?
"pixel" :
"strip"));
229 return StatusCode::SUCCESS;