Group the modules into layers and fill the descriptions and hash maps.
50 {
51 std::map<LayerKey, std::vector<ModuleEntry>> hashMap;
52
53
54
55
56 for (
int hash = 0; hash < static_cast<int>(
m_pixelId->wafer_hash_max());
58 const Identifier offlineId =
m_pixelId->wafer_id(hash);
59 if (offlineId == 0) {
60 continue;
61 }
62
63 const short barrelEc =
m_pixelId->barrel_ec(offlineId);
64 if (std::abs(barrelEc) > 2) {
65 continue;
66 }
67
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);
72
73 int volId = -1;
74 if (barrelEc == 0) {
75 volId = 8;
76 } else if (barrelEc == -2) {
77 volId = 7;
78 } else if (barrelEc == 2) {
79 volId = 9;
80 }
81
82 int newVol = 0;
83 int newLay = 0;
84 if (volId == 7 || volId == 9) {
85 newVol = 10 * volId + layerDisk;
86 newLay = etaModule;
87 } else if (volId == 8) {
88 newVol = 10 * volId + layerDisk;
89 newLay = 0;
90 }
91
92 const LayerKey key{barrelEc == 0 ? kBarrelSideKey : barrelEc, kPixel,
93 static_cast<short>(newVol), static_cast<short>(newLay)};
95 }
96
97
98 for (
int hash = 0; hash < static_cast<int>(
m_stripId->wafer_hash_max());
100 const Identifier offlineId =
m_stripId->wafer_id(hash);
101 if (offlineId == 0) {
102 continue;
103 }
104
105 const short barrelEc =
m_stripId->barrel_ec(offlineId);
107 const short etaIndex =
m_stripId->eta_module(offlineId);
108
109 int volId = 13;
110 if (barrelEc != 0) {
111 volId = 12;
112 }
113 if (barrelEc > 0) {
114 volId = 14;
115 }
116
117 const int layerDisk =
m_stripId->layer_disk(offlineId);
118
119 const LayerKey key{barrelEc == 0 ? kBarrelSideKey : barrelEc, kStrip,
120 static_cast<short>(volId),
121 static_cast<short>(layerDisk)};
123 }
124
131
132 std::ofstream geometryStream;
135 }
136
137
138
139
140
141
142
143 std::set<int> layerIds;
144
145 short layerIndex = 0;
146 for (const auto& [key, modules] : hashMap) {
147 const auto& [sideKey, technology, volId, layId] =
key;
148
149 const short barrelEc = sideKey == kBarrelSideKey ? 0 : sideKey;
150 const int combinedId = static_cast<int>(volId) * 1000 + layId;
151
152 if (!layerIds.insert(combinedId).second) {
154 << combinedId << ": this detector does not fit the layer "
155 "id encoding");
156 return StatusCode::FAILURE;
157 }
158
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;
165
167 const InDetDD::SiDetectorElement* element = nullptr;
168 if (technology == kPixel) {
171 } else {
174 }
175 if (element ==
nullptr) [[
unlikely]] {
177 continue;
178 }
179
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());
184
185
186
188 refCoordSum += barrelEc == 0
189 ? std::hypot(centre(0), centre(1))
190 : centre(2);
192 }
193
195 ATH_MSG_ERROR(
"GBTS layer " << combinedId <<
" has no modules.");
196 return StatusCode::FAILURE;
197 }
198
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;
210
211 layer.minBound = barrelEc == 0 ? minZ : minR;
212 layer.maxBound = barrelEc == 0 ? maxZ : maxR;
213
215 geometryStream << minR << " " << maxR << " " << minZ << " " << maxZ << " "
216 << combinedId << "\n";
217 }
218
220 <<
") : reference coordinate = " <<
layer.refCoord
221 <<
" boundaries: " <<
layer.minBound <<
" "
222 <<
layer.maxBound <<
" type=" << barrelEc
223 << " technology="
224 << (technology == kPixel ? "pixel" : "strip"));
225
226 ++layerIndex;
227 }
228
229 return StatusCode::SUCCESS;
230}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
virtual const Amg::Vector3D & center() const override final
Center in global coordinates.
Eigen::Matrix< double, 3, 1 > Vector3D
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
One module, as grouped into a layer.