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});
130 std::ofstream geometryStream;
141 std::set<Acts::Experimental::GbtsExperimentLayerId> layerIds;
143 short layerIndex = 0;
144 for (
const auto& [key, modules] : hashMap) {
145 const auto& [sideKey, technology, volId, layId] = key;
147 const short barrelEc = sideKey == kBarrelSideKey ? 0 : sideKey;
148 const auto combinedId =
149 static_cast<Acts::Experimental::GbtsExperimentLayerId
>(volId) * 1000 +
150 static_cast<Acts::Experimental::GbtsExperimentLayerId
>(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 =
201 layer.id = combinedId;
202 layer.type = barrelEc == 0 ? Acts::Experimental::GbtsLayerType::Barrel
203 : Acts::Experimental::GbtsLayerType::Endcap;
204 layer.technology = technology == kPixel
205 ? Acts::Experimental::GbtsLayerTechnology::Pixel
206 : Acts::Experimental::GbtsLayerTechnology::Strip;
207 layer.refCoord = refCoordSum / nModules;
209 layer.minBound = barrelEc == 0 ? minZ : minR;
210 layer.maxBound = barrelEc == 0 ? maxZ : maxR;
213 geometryStream << minR <<
" " << maxR <<
" " << minZ <<
" " << maxZ <<
" "
214 << combinedId <<
"\n";
218 <<
") : reference coordinate = " << layer.refCoord
219 <<
" boundaries: " << layer.minBound <<
" "
220 << layer.maxBound <<
" type=" << barrelEc
222 << (technology == kPixel ?
"pixel" :
"strip"));
227 return StatusCode::SUCCESS;