134{
135 int circuitsPerEta{2};
136 int circuitsPerPhi{2};
137 double thickness{0.150};
138 double pitchEta{};
139 double pitchPhi{};
140 double pitchEtaLong{};
141 double pitchPhiLong{};
142 double pitchEtaEnd{};
143 double pitchPhiEnd{};
144 int nEtaLongPerSide{};
145 int nPhiLongPerSide{};
146 int nEtaEndPerSide{};
147 int nPhiEndPerSide{};
148 int rowsPerCircuit{};
149 int columnsPerCircuit{};
150
151
153 int readoutSide{1};
154 bool is3D{false};
155
156 bool phiSymmetric{true};
157 bool etaSymmetric{true};
158 bool depthSymmetric{true};
159
160
161 getParameter(typeName, parameters,
"circuitsPerEta", circuitsPerEta);
162 getParameter(typeName, parameters,
"circuitsPerPhi", circuitsPerPhi);
163 getParameter(typeName, parameters,
"thickness", thickness);
165 getParameter(typeName, parameters,
"rows", rowsPerCircuit);
166 getParameter(typeName, parameters,
"columns", columnsPerCircuit);
167 getParameter(typeName, parameters,
"pitchEta", pitchEta);
168 getParameter(typeName, parameters,
"pitchPhi", pitchPhi);
169 getParameter(typeName, parameters,
"pitchEtaLong", pitchEtaLong);
170 getParameter(typeName, parameters,
"pitchPhiLong", pitchPhiLong);
171 getParameter(typeName, parameters,
"pitchEtaEnd", pitchEtaEnd);
172 getParameter(typeName, parameters,
"pitchPhiEnd", pitchPhiEnd);
173 getParameter(typeName, parameters,
"nPhiLongPerSide", nPhiLongPerSide);
174 getParameter(typeName, parameters,
"nEtaLongPerSide", nEtaLongPerSide);
175 getParameter(typeName, parameters,
"nPhiEndPerSide", nPhiEndPerSide);
176 getParameter(typeName, parameters,
"nEtaEndPerSide", nEtaEndPerSide);
177
178 checkParameter(typeName, parameters, "phiSymmetric", phiSymmetric);
179 checkParameter(typeName, parameters, "etaSymmetric", etaSymmetric);
180 checkParameter(typeName, parameters, "depthSymmetric", depthSymmetric);
181
182
183
184
185 ATH_MSG_DEBUG(
"readout geo - design thickness " << thickness <<
" "
186 << " circuits " << circuitsPerPhi << " " << circuitsPerEta << " "
187 << " rows/columns " << rowsPerCircuit << " " << columnsPerCircuit << " "
188 << " pitch regular/long/end " << pitchPhi << " " << pitchEta
189 << " " << pitchPhiLong << " " << pitchEtaLong
190 << " " << pitchPhiEnd << " " << pitchEtaEnd
191 << " n-long " << nPhiLongPerSide << " " << nEtaLongPerSide
192 << " n-end " << nPhiEndPerSide << " " << nEtaEndPerSide
193 << carrier << " " << readoutSide);
194
195
196
198 int detectorTypeEnum = 0;
199 if (checkParameter(typeName, parameters, "detectorType", detectorTypeEnum)) {
203 }
204
206
207 if ( circuitsPerPhi*rowsPerCircuit<0 || circuitsPerPhi*rowsPerCircuit >= std::numeric_limits<PixelDiodeTree::CellIndexType>::max()
208 || circuitsPerEta*columnsPerCircuit<0 || circuitsPerEta*columnsPerCircuit >= std::numeric_limits<PixelDiodeTree::CellIndexType>::max()) {
209 std::stringstream amsg;
210 amsg << "Index overflows index type of PixelDiodeTree. Parameters "
211 << "( " << circuitsPerPhi << " * " << rowsPerCircuit << " ), ( "
212 << "( " << circuitsPerEta << " * " << columnsPerCircuit << " ) !<"
213 << std::numeric_limits<PixelDiodeTree::CellIndexType>::max() << " each.";
214 throw std::runtime_error(amsg.str());
215 }
216
217
218
219 bool flipFE=(
typeName.find(
"_even") !=std::string::npos);
220
221
222
223 auto computeAttribute = [readoutTechnology,
224 pitchPhi,
225 pitchEta,
226 circuitsPerPhi,
227 circuitsPerEta,
228 rowsPerCircuit,
229 columnsPerCircuit,
230 flipFE
231 ](const std::array<PixelDiodeTree::IndexType,2> &split_idx,
233 [[maybe_unused]] const std::array<bool,4> &ganged,
234 [[maybe_unused]] unsigned int split_i,
237 -> std::tuple<PixelDiodeTree::AttributeType,PixelDiodeTree::AttributeType>
238 {
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257 assert(split_idx[0]>=0 && split_idx[1]>=0);
258 std::array<int,2> chip_idx{split_idx[0]/rowsPerCircuit, split_idx[1]/columnsPerCircuit};
259
260 unsigned int n_large_dimensions = ( (std::abs(diode_width[0]-pitchPhi)>pitchPhi*.25)
261 +(std::abs(diode_width[1]-pitchEta)>pitchEta*.25));
262 switch (n_large_dimensions) {
263 case 1:
265 break;
266 case 2:
268 break;
269 default:
271 }
272
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288 if (flipFE) {
290 }
291 else {
293 }
294
295 }
296 else {
297
298
299
300
301
302
303
304
306 ? circuitsPerEta - chip_idx[1] - 1
307 : (circuitsPerPhi-1) * circuitsPerEta + chip_idx[1]);
308 }
309 return std::make_tuple(current_matrix_attribute, current_diode_attribute);
310 };
311
312 PixelDiodeTree diode_tree
313 =
createPixelDiodeTree(std::array<unsigned int,2>{
static_cast<unsigned int>(circuitsPerPhi),
static_cast<unsigned int>(circuitsPerEta)},
314 std::array<unsigned int,2>{static_cast<unsigned int>(rowsPerCircuit),static_cast<unsigned int>(columnsPerCircuit)},
316 std::array<std::array<unsigned int,2>, 2>{ std::array<unsigned int,2>{static_cast<unsigned int>(nPhiEndPerSide),
317 static_cast<unsigned int>(nEtaEndPerSide)},
318 std::array<unsigned int,2>{static_cast<unsigned int>(nPhiLongPerSide),
319 static_cast<unsigned int>(nEtaLongPerSide)}},
322 },
323 std::array<std::array<unsigned int,2>, 2>{ std::array<unsigned int,2>{0
u,0
u},
324 std::array<unsigned int,2>{0
u,0
u}
325 },
326 computeAttribute,
327 nullptr);
328
329 auto design = std::make_unique<PixelModuleDesign>(thickness,
330 phiSymmetric, etaSymmetric, depthSymmetric,
331 circuitsPerPhi, circuitsPerEta,
332 columnsPerCircuit, rowsPerCircuit,
333 columnsPerCircuit, rowsPerCircuit,
334 std::move(diode_tree), carrier,
335 readoutSide, is3D, detectorType, readoutTechnology);
336
338 << " " << design->width() << "x" << design->length() << "x" << design->thickness()
339 << " " << design->rows() << "x" << design->columns()
340 << ", " << circuitsPerPhi << "x" << circuitsPerEta << " "
341 << rowsPerCircuit << " " << columnsPerCircuit << ":\n"
342 << diode_tree.debugStringRepr());
343
344 [[maybe_unused]]
auto observePtr =
m_detectorManager->addDesign(std::move(design));
345
346
348}
unsigned int AttributeType
InDetDD::PixelDiodeTree::AttributeType makeAttributeType(T val)
convenience method to convert the given value into an attribute
PixelDiodeTree createPixelDiodeTree(const std::array< unsigned int, 2 > &chip_dim, const std::array< unsigned int, 2 > &chip_matrix_dim, const PixelDiodeTree::Vector2D &pitch, const std::array< std::array< unsigned int, 2 >, 2 > &edge_dim, const std::array< PixelDiodeTree::Vector2D, 2 > &edge_pitch, const std::array< std::array< unsigned int, 2 >, 2 > &dead_zone, const AttributeRefiner &func_compute_attribute, std::ostream *debug_out=nullptr)
Create a pixel diode tree.
std::vector< T > getParameter(const std::string &varName, const std::vector< std::string > &buffer)
@ u
Enums for curvilinear frames.