ATLAS Offline Software
Loading...
Searching...
No Matches
ActsClusterComparisonAlg.cxx
Go to the documentation of this file.
1
2/*
3 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4*/
5
6#include <algorithm>
7#include <cstdint>
8#include <fstream>
9#include <stdexcept>
10
12
31
32
33namespace ActsTrk {
34
36{
37 ATH_MSG_INFO("ActsClusterComparisonAlg::initialize");
38
41
42 ATH_CHECK(detStore()->retrieve(m_stripID, "SCT_ID"));
43
45
48
51
54
55 ATH_CHECK(m_monCondKey.initialize());
56
59
60 ATH_MSG_INFO("ActsClusterComparisonAlg::initialize complete");
61 return StatusCode::SUCCESS;
62}
63
64StatusCode ActsClusterComparisonAlg::execute(const EventContext& ctx) const
65{
66
67
68 // Create per-event data structures
69 std::unordered_map<const xAOD::PixelCluster*, const xAOD::PixelCluster*>
70 pixel_cluster_matches;
71
72 std::unordered_map<const xAOD::StripCluster*, const xAOD::StripCluster*>
73 strip_cluster_matches;
74
75
76 ATH_CHECK(validateClusters(ctx, pixel_cluster_matches, strip_cluster_matches));
77
79 ATH_CHECK(validatePixelSpacepoints(ctx, pixel_cluster_matches));
80
81 return StatusCode::SUCCESS;
82}
83
84// Match pixel clusters
86 std::vector<const xAOD::PixelCluster*>& monitored_list,
87 std::vector<const xAOD::PixelCluster*>& reference_list,
88 const std::string& module_id,
89 std::vector<
90 std::pair<const xAOD::PixelCluster*, const xAOD::PixelCluster*>>& pairs) const
91{
92
93 // Extract RDO sets
94 std::vector<std::set<Identifier>> monitored_rdo_sets;
95 std::vector<std::set<Identifier>> reference_rdo_sets;
96
97 for (const auto* c : monitored_list) {
98 const auto& rdoListRange = c->rdoList();
99 std::vector<Identifier> rdoList(rdoListRange.begin(), rdoListRange.end());
100 monitored_rdo_sets.emplace_back(rdoList.begin(), rdoList.end());
101 }
102
103 for (const auto* c : reference_list) {
104 const auto& rdoListRange = c->rdoList();
105 std::vector<Identifier> rdoList(rdoListRange.begin(), rdoListRange.end());
106 reference_rdo_sets.emplace_back(rdoList.begin(), rdoList.end());
107 }
108
109 // Match clusters
110 std::vector<std::pair<int, int>> matched_pairs;
111 std::vector<int> unmatched_monitored;
112 std::set<int> unmatched_reference;
113
114 for (size_t j = 0; j < reference_rdo_sets.size(); ++j) {
115 unmatched_reference.insert(j);
116 }
117
118 for (size_t i = 0; i < monitored_rdo_sets.size(); ++i) {
119
120 bool found_match = false;
121 for (size_t j = 0; j < reference_rdo_sets.size(); ++j) {
122 if (monitored_rdo_sets[i] == reference_rdo_sets[j]) {
123 matched_pairs.emplace_back(i, j);
124 pairs.emplace_back(monitored_list.at(i), reference_list.at(j));
125 found_match = true;
126 unmatched_reference.erase(j);
127 break;
128 }
129 }
130 if (!found_match) {
131 unmatched_monitored.push_back(i);
132 }
133 }
134
135 // Report mismatches
136 if (!unmatched_monitored.empty() || !unmatched_reference.empty()) {
137 ATH_MSG_DEBUG("[ERROR] Module " << module_id
138 << ": cluster mismatch detected!");
139 if (!unmatched_monitored.empty()) {
140 ATH_MSG_DEBUG(" Unmatched monitored clusters ("
141 << unmatched_monitored.size() << "):");
142 for (int i : unmatched_monitored) {
143 ATH_MSG_DEBUG(" - #" << i);
144 const xAOD::PixelCluster* monitored_cluster = monitored_list.at(i);
145 const auto& monitored_cov = monitored_cluster->localCovariance<1>();
146
147 ATH_MSG_DEBUG("Detailed print of cluster: ");
148
149 ATH_MSG_DEBUG("Local position: ");
151 " Monitored: ("
152 << monitored_cluster->localPosition<2>()[Trk::locX] << ", "
153 << monitored_cluster->localPosition<2>()[Trk::locY] << ")");
154
155 ATH_MSG_DEBUG("Cluster cov: ");
156 ATH_MSG_DEBUG(" Monitored: (" << monitored_cov(0, 0) << ", "
157 << monitored_cov(1, 1) << ")");
158 }
159 m_pix_unmatched_mon+= unmatched_monitored.size();
160 }
161 if (!unmatched_reference.empty()) {
162 ATH_MSG_DEBUG(" Unmatched reference clusters (" << unmatched_reference.size()
163 << "):");
164 for (int j : unmatched_reference) {
165 ATH_MSG_DEBUG(" - #" << j);
166 const xAOD::PixelCluster* reference_cluster = reference_list.at(j);
167 const auto& reference_cov = reference_cluster->localCovariance<1>();
168
169 ATH_MSG_DEBUG("Detailed print of cluster: ");
170
171 ATH_MSG_DEBUG("Local position: ");
172
173 ATH_MSG_DEBUG(" Reference: ("
174 << reference_cluster->localPosition<2>()[Trk::locX] << ", "
175 << reference_cluster->localPosition<2>()[Trk::locY]
176 << ")");
177
178 ATH_MSG_DEBUG("Cluster cov: ");
179
180 ATH_MSG_DEBUG(" Reference: (" << reference_cov(0, 0) << ", "
181 << reference_cov(1, 1) << ")");
182 }
183 m_pix_unmatched_ref+= unmatched_reference.size();
184 }
185 ATH_MSG_DEBUG("------------------------------------------------------------");
186 }
187}
188
189// Match strip clusters
191 std::vector<const xAOD::StripCluster*>& monitored_list,
192 std::vector<const xAOD::StripCluster*>& reference_list,
193 const std::string& module_id,
194 std::vector<
195 std::pair<const xAOD::StripCluster*, const xAOD::StripCluster*>>& pairs) const
196{
197
198 // Extract RDO sets
199 std::vector<std::set<Identifier>> monitored_rdo_sets;
200 std::vector<std::set<Identifier>> reference_rdo_sets;
201
202 for (const auto* c : monitored_list) {
203 const auto& rdoListRange = c->rdoList();
204 std::vector<Identifier> rdoList(rdoListRange.begin(), rdoListRange.end());
205 monitored_rdo_sets.emplace_back(rdoList.begin(), rdoList.end());
206 }
207
208 for (const auto* c : reference_list) {
209 const auto& rdoListRange = c->rdoList();
210 std::vector<Identifier> rdoList(rdoListRange.begin(), rdoListRange.end());
211 reference_rdo_sets.emplace_back(rdoList.begin(), rdoList.end());
212 }
213
214 // Match clusters
215 std::vector<std::pair<int, int>> matched_pairs;
216 std::vector<int> unmatched_monitored;
217 std::set<int> unmatched_reference;
218
219 for (size_t j = 0; j < reference_rdo_sets.size(); ++j) {
220 unmatched_reference.insert(j);
221 }
222
223 for (size_t i = 0; i < monitored_rdo_sets.size(); ++i) {
224 bool found_match = false;
225 for (size_t j = 0; j < reference_rdo_sets.size(); ++j) {
226 if (monitored_rdo_sets[i] == reference_rdo_sets[j]) {
227 matched_pairs.emplace_back(i, j);
228 pairs.emplace_back(monitored_list.at(i), reference_list.at(j));
229 found_match = true;
230 unmatched_reference.erase(j);
231 break;
232 }
233 }
234 if (!found_match) {
235 unmatched_monitored.push_back(i);
236 }
237 }
238
239 // Report mismatches
240 if (!unmatched_monitored.empty() || !unmatched_reference.empty()) {
241 ATH_MSG_DEBUG("[ERROR] Module " << module_id
242 << ": cluster mismatch detected!");
243 if (!unmatched_monitored.empty()) {
244 ATH_MSG_DEBUG(" Unmatched monitored clusters ("
245 << unmatched_monitored.size() << "):");
246 for (int i : unmatched_monitored) {
247 ATH_MSG_DEBUG(" - #" << i);
248 const xAOD::StripCluster* monitored_cluster = monitored_list.at(i);
249 const auto& monitored_cov = monitored_cluster->localCovariance<1>();
250
251 ATH_MSG_DEBUG("Detailed print of cluster: ");
252
253 ATH_MSG_DEBUG("Local position: ");
255 " Monitored: ("
256 << monitored_cluster->localPosition<1>()[Trk::locX] << ")");
257
258 ATH_MSG_DEBUG("Cluster cov: ");
259 ATH_MSG_DEBUG(" Monitored: (" << monitored_cov(0, 0) << ")");
260 }
261 m_strip_unmatched_mon+= unmatched_monitored.size();
262 }
263 if (!unmatched_reference.empty()) {
264 ATH_MSG_DEBUG(" Unmatched reference clusters (" << unmatched_reference.size()
265 << "):");
266 for (int j : unmatched_reference) {
267 ATH_MSG_DEBUG(" - #" << j);
268 const xAOD::StripCluster* reference_cluster = reference_list.at(j);
269 const auto& reference_cov = reference_cluster->localCovariance<1>();
270
271 ATH_MSG_DEBUG("Detailed print of cluster: ");
272
273 ATH_MSG_DEBUG("Local position: ");
274
275 ATH_MSG_DEBUG(" Reference: ("
276 << reference_cluster->localPosition<1>()[Trk::locX] << ")");
277
278 ATH_MSG_DEBUG("Cluster cov: ");
279
280 ATH_MSG_DEBUG(" Reference: (" << reference_cov(0, 0) << ")");
281 }
282 m_strip_unmatched_ref+= unmatched_reference.size();
283 }
284 ATH_MSG_DEBUG("------------------------------------------------------------");
285 }
286}
287
288std::optional<std::pair<float, float>> ActsClusterComparisonAlg::tracccLorentzShift(
289 const Identifier& athenaId,
290 const traccc::detector_conditions_description::host& cond) const
291{
292 const auto detrayId = m_idMapping->athenaToDetray(athenaId);
293 if (!detrayId) return std::nullopt;
294 const auto condIndex = m_idMapping->detrayToDetDescIndex(*detrayId);
295 if (!condIndex || *condIndex >= cond.size()) return std::nullopt;
296 const auto& shift = cond.measurement_translation()[*condIndex];
297 return std::make_pair(static_cast<float>(shift[0]), static_cast<float>(shift[1]));
298}
299
300std::optional<std::array<float, 2>> ActsClusterComparisonAlg::tracccCellPosition(
301 const Identifier& athenaId, unsigned int channel0, unsigned int channel1,
302 const traccc::detector_design_description::host& design,
303 const traccc::detector_conditions_description::host& cond) const
304{
305 const auto detrayId = m_idMapping->athenaToDetray(athenaId);
306 if (!detrayId) return std::nullopt;
307 const auto condIndex = m_idMapping->detrayToDetDescIndex(*detrayId);
308 if (!condIndex || *condIndex >= cond.size()) return std::nullopt;
309 const unsigned int designIndex = cond.module_to_design_id()[*condIndex];
310 if (designIndex >= design.size()) return std::nullopt;
311 const auto& edgesX = design.bin_edges_x()[designIndex];
312 const auto& edgesY = design.bin_edges_y()[designIndex];
313 if (channel0 + 1 >= edgesX.size() || channel1 + 1 >= edgesY.size()) return std::nullopt;
314 return std::array<float, 2>{
315 0.5f * static_cast<float>(edgesX[channel0] + edgesX[channel0 + 1]),
316 0.5f * static_cast<float>(edgesY[channel1] + edgesY[channel1 + 1])};
317}
318
320 const EventContext& eventContext, std::unordered_map<const xAOD::PixelCluster*, const xAOD::PixelCluster*>& pixel_cluster_matches, std::unordered_map<const xAOD::StripCluster*, const xAOD::StripCluster*>& strip_cluster_matches) const
321{
322
324 "============================================================");
325 // retrieve the clusters in form of xAOD containers
326 ATH_MSG_INFO("Reading monitored clusters: " << m_monitoredPixelClustersKey.key()
327 << " and "
329 ATH_MSG_INFO("Reading reference clusters: " << m_referencePixelClustersKey.key()
330 << " and "
333 "============================================================");
334
335 SG::ReadHandle<xAOD::PixelClusterContainer> monitoredPixelClustersHandle =
337 ATH_CHECK(monitoredPixelClustersHandle.isValid());
338 const xAOD::PixelClusterContainer* monitoredPixelClusters =
339 monitoredPixelClustersHandle.cptr();
340
341 SG::ReadHandle<xAOD::StripClusterContainer> monitoredStripClustersHandle =
343 ATH_CHECK(monitoredStripClustersHandle.isValid());
344 const xAOD::StripClusterContainer* monitoredStripClusters =
345 monitoredStripClustersHandle.cptr();
346
347 SG::ReadHandle<xAOD::PixelClusterContainer> referencePixelClustersHandle =
349 ATH_CHECK(referencePixelClustersHandle.isValid());
350 const xAOD::PixelClusterContainer* referencePixelClusters =
351 referencePixelClustersHandle.cptr();
352
353 SG::ReadHandle<xAOD::StripClusterContainer> referenceStripClustersHandle =
355 ATH_CHECK(referenceStripClustersHandle.isValid());
356 const xAOD::StripClusterContainer* referenceStripClusters =
357 referenceStripClustersHandle.cptr();
358
359 const traccc::detector_design_description::host* monDesign = nullptr;
360 ATH_CHECK(detStore()->retrieve(monDesign, m_monDesignObjectName.value()));
361
362 const traccc::detector_conditions_description::host* monCond{};
363 ATH_CHECK(SG::get(monCond,m_monCondKey, eventContext));
364
365 size_t t_n_pixel = monitoredPixelClusters->size();
366 size_t t_n_strip = monitoredStripClusters->size();
367 size_t a_n_pixel = referencePixelClusters->size();
368 size_t a_n_strip = referenceStripClusters->size();
369
370 ATH_MSG_DEBUG(" Monitored/reference pixel clusters " << t_n_pixel << " / "
371 << a_n_pixel);
372 ATH_MSG_DEBUG(" Monitored/reference strip clusters " << t_n_strip << " / "
373 << a_n_strip);
374
375 if (t_n_pixel != a_n_pixel) {
376 ATH_MSG_ERROR("Mismatched pixel cluster numbers found!");
377 ATH_MSG_ERROR(" Monitored/reference clusters " << t_n_pixel << " / "
378 << a_n_pixel);
379 return StatusCode::FAILURE;
380 }
381 if (t_n_strip != a_n_strip) {
382 ATH_MSG_ERROR("Mismatched strip cluster numbers found!");
383 ATH_MSG_ERROR(" Monitored/reference clusters " << t_n_strip << " / "
384 << a_n_strip);
385 return StatusCode::FAILURE;
386 }
387
388 // Group by module
389 std::map<std::string, std::vector<const xAOD::PixelCluster*>>
390 monitored_pixel_map, reference_pixel_map;
391 std::map<std::string, std::vector<const xAOD::StripCluster*>>
392 monitored_strip_map, reference_strip_map;
393
394 for (const auto* c : *monitoredPixelClusters) {
395 monitored_pixel_map[std::to_string(c->identifierHash())].push_back(c);
396 }
397 for (const auto* c : *monitoredStripClusters) {
398 monitored_strip_map[std::to_string(c->identifierHash())].push_back(c);
399 }
400 for (const auto* c : *referencePixelClusters) {
401 reference_pixel_map[std::to_string(c->identifierHash())].push_back(c);
402 }
403 for (const auto* c : *referenceStripClusters) {
404 reference_strip_map[std::to_string(c->identifierHash())].push_back(c);
405 }
406
407 // Collect all module IDs
408 std::set<std::string> pixel_modules, strip_modules;
409 for (const auto& [key, _] : monitored_pixel_map)
410 pixel_modules.insert(key);
411 for (const auto& [key, _] : reference_pixel_map)
412 pixel_modules.insert(key);
413 for (const auto& [key, _] : monitored_strip_map)
414 strip_modules.insert(key);
415 for (const auto& [key, _] : reference_strip_map)
416 strip_modules.insert(key);
417
418 int pixel_unequal = 0, strip_unequal = 0;
419 int matched_pixel = 0, matched_strip = 0;
420 int pixel_pos_diff_0p5sig = 0;
421 int pixel_pos_diff_0p25sig = 0;
422 int pixel_pos_diff_1sig = 0;
423 int strip_pos_diff_0p5sig = 0;
424 int strip_pos_diff_0p25sig = 0;
425 int strip_pos_diff_1sig = 0;
426 int strip_pos_diff_barrel = 0;
427 int strip_pos_diff_EC = 0;
428
429 ATH_MSG_DEBUG("Pixel/Strip modules " << pixel_modules.size() << " / "
430 << strip_modules.size());
431 ATH_MSG_DEBUG("Pixel cluster validation: ");
433 "============================================================");
434
435 // Process pixel modules
436 for (const auto& hid : pixel_modules) {
437 auto& tpixel = monitored_pixel_map[hid];
438 auto& apixel = reference_pixel_map[hid];
439
440 if (tpixel.empty() && apixel.empty())
441 continue;
442
443 if (tpixel.size() != apixel.size()) {
444 ATH_MSG_DEBUG("[ERROR] Pixel Module " << hid
445 << ": mismatched clusters found!");
446 ATH_MSG_DEBUG(" Reference found " << apixel.size()
447 << " and monitored found " << tpixel.size() << " clusters!");
448 pixel_unequal++;
449 continue;
450 }
451
452 std::vector<
453 std::pair<const xAOD::PixelCluster*, const xAOD::PixelCluster*>>
454 pixel_pairs;
455 matchPixelClusters(tpixel, apixel, hid, pixel_pairs);
456
457 matched_pixel += pixel_pairs.size();
458
459 // Add matched pairs and check position differences
460 for (const auto& pair : pixel_pairs) {
461 const xAOD::PixelCluster* monitored_cluster = pair.first;
462 const xAOD::PixelCluster* reference_cluster = pair.second;
463
464 (pixel_cluster_matches)[pair.first] = pair.second;
465
466 // Calculate local position difference
467 double l_dx = monitored_cluster->localPosition<2>()[Trk::locX] -
468 reference_cluster->localPosition<2>()[Trk::locX];
469 double l_dy = monitored_cluster->localPosition<2>()[Trk::locY] -
470 reference_cluster->localPosition<2>()[Trk::locY];
471 double l_pos_diff = std::sqrt(l_dx * l_dx + l_dy * l_dy);
472
473 // Calculate global position difference
474 float g_dx = (monitored_cluster->globalPosition()).x() -
475 (reference_cluster->globalPosition()).x();
476 float g_dy = (monitored_cluster->globalPosition()).y() -
477 (reference_cluster->globalPosition()).y();
478 float g_dz = (monitored_cluster->globalPosition()).z() -
479 (reference_cluster->globalPosition()).z();
480 float g_pos_diff =
481 std::sqrt(g_dx * g_dx + g_dy * g_dy + g_dz * g_dz);
482
483 // Calculate error difference
484 Eigen::Matrix<float, 2, 2> monitored_cov =
485 monitored_cluster->localCovariance<2>();
486 Eigen::Matrix<float, 2, 2> reference_cov =
487 reference_cluster->localCovariance<2>();
488
489 const InDetDD::SiDetectorElement* monitored_element =
490 m_pixelManager->getDetectorElement(
491 monitored_cluster->identifierHash());
492 const InDetDD::PixelModuleDesign& design =
493 static_cast<const InDetDD::PixelModuleDesign&>(
494 monitored_element->design());
495
496 const Identifier monitored_Pixel_ModuleID =
497 monitored_element->identify();
498 double monitored_lorentz_shift =
499 m_pixelLorentzAngleTool->getLorentzShift(
500 monitored_element->identifyHash(), eventContext);
501
502
503 if (std::abs(l_dx / (std::sqrt(reference_cov(0, 0)))) > 0.25 ||
504 std::abs(l_dy / (std::sqrt(reference_cov(1, 1)))) > 0.25) {
505 pixel_pos_diff_0p25sig++;
506
507 ATH_MSG_DEBUG("Detailed print of cluster discrepancy: ");
508 ATH_MSG_DEBUG("On module: " << monitored_Pixel_ModuleID);
509 ATH_MSG_DEBUG("Lorentz shift: " << std::fixed << std::setprecision(9) << monitored_lorentz_shift);
510 if (auto tracccShift = tracccLorentzShift(monitored_Pixel_ModuleID, *monCond)) {
511 ATH_MSG_DEBUG("Lorentz shift (traccc conditions): " << tracccShift->first);
512 ATH_MSG_DEBUG(" Δshift = " << tracccShift->first - monitored_lorentz_shift);
513 } else {
514 ATH_MSG_DEBUG("Lorentz shift (traccc conditions): not found for module " << monitored_Pixel_ModuleID);
515 }
516
517
518 ATH_MSG_DEBUG("Local position: ");
520 " Monitored: ("
521 << monitored_cluster->localPosition<2>()[Trk::locX] << ", "
522 << monitored_cluster->localPosition<2>()[Trk::locY] << ")");
523 ATH_MSG_DEBUG(" Reference: ("
524 << reference_cluster->localPosition<2>()[Trk::locX] << ", "
525 << reference_cluster->localPosition<2>()[Trk::locY]
526 << ")");
527 ATH_MSG_DEBUG(" Δx = " << l_dx << ", Δy = " << l_dy
528 << ", Δr = " << l_pos_diff);
529 ATH_MSG_DEBUG("Cluster cov: ");
530 ATH_MSG_DEBUG(" Monitored: (" << monitored_cov(0, 0) << ", "
531 << monitored_cov(1, 1) << ")");
532 ATH_MSG_DEBUG(" Reference: (" << reference_cov(0, 0) << ", "
533 << reference_cov(1, 1) << ")");
534 ATH_MSG_DEBUG(" Δx = " << monitored_cov(0, 0) - reference_cov(0, 0)
535 << ", Δy = "
536 << monitored_cov(1, 1) - reference_cov(1, 1));
537
538
539 const auto& rdoListRange = monitored_cluster->rdoList();
540 std::vector<Identifier> monitored_rdoList(
541 rdoListRange.begin(), rdoListRange.end());
542 for (auto rdoIter : monitored_rdoList) {
543 const InDetDD::SiCellId& chargeCellId =
544 monitored_element->cellIdFromIdentifier(rdoIter);
545 std::array<InDetDD::PixelDiodeTree::CellIndexType, 2>
547 chargeCellId.phiIndex(), chargeCellId.etaIndex());
548
550 design.diodeProxyFromIdxCachePosition(diode_idx));
551 ATH_MSG_DEBUG("hit id for this cell: "
552 << chargeCellId
553 << ", position: " << si_param.position()[0]
554 << ", " << si_param.position()[1]);
555 // traccc cells use channel0 = phi index, channel1 = eta index for pixels
556 if (auto tracccPos = tracccCellPosition(monitored_Pixel_ModuleID,
557 chargeCellId.phiIndex(), chargeCellId.etaIndex(),
558 *monDesign, *monCond)) {
559 ATH_MSG_DEBUG(" traccc position for this cell: " << (*tracccPos)[0]
560 << ", " << (*tracccPos)[1]
561 << " (Δ = " << (*tracccPos)[0] - si_param.position()[0]
562 << ", " << (*tracccPos)[1] - si_param.position()[1] << ")");
563 } else {
564 ATH_MSG_DEBUG(" traccc position for this cell: not found");
565 }
566 }
567
568 // Calculate width difference
569 ATH_MSG_DEBUG("Cluster width: ");
570 ATH_MSG_DEBUG(" Monitored phi/eta channels, eta width: ("
571 << monitored_cluster->channelsInPhi() << ", "
572 << monitored_cluster->channelsInEta() << ", "
573 << monitored_cluster->widthInEta() << ")");
574 ATH_MSG_DEBUG(" Reference phi/eta channels, eta width: ("
575 << reference_cluster->channelsInPhi() << ", "
576 << reference_cluster->channelsInEta() << ", "
577 << reference_cluster->widthInEta() << ")");
578
579 ATH_MSG_DEBUG(" Δphi = " << monitored_cluster->channelsInPhi() -
580 reference_cluster->channelsInPhi()
581 << ", Δeta = "
582 << monitored_cluster->channelsInEta() -
583 reference_cluster->channelsInEta()
584 << ", Δwidth = "
585 << monitored_cluster->widthInEta() -
586 reference_cluster->widthInEta());
587 }
588 if (std::abs(l_dx / (std::sqrt(reference_cov(0, 0)))) > 0.5 ||
589 std::abs(l_dy / (std::sqrt(reference_cov(1, 1)))) > 0.5) {
590 pixel_pos_diff_0p5sig++;
591 }
592 if (std::abs(l_dx / (std::sqrt(reference_cov(0, 0)))) > 1 ||
593 std::abs(l_dy / (std::sqrt(reference_cov(1, 1)))) > 1) {
594 pixel_pos_diff_1sig++;
595 }
596
597
598 ATH_MSG_VERBOSE("Global position: ");
599 ATH_MSG_VERBOSE(" Monitored: ("
600 << (monitored_cluster->globalPosition()).x() << ", "
601 << (monitored_cluster->globalPosition()).y() << ", "
602 << (monitored_cluster->globalPosition()).z() << ")");
603 ATH_MSG_VERBOSE(" Reference: ("
604 << (reference_cluster->globalPosition()).x() << ", "
605 << (reference_cluster->globalPosition()).y() << ", "
606 << (reference_cluster->globalPosition()).z() << ")");
607 ATH_MSG_VERBOSE(" Δx = " << g_dx << ", Δy = " << g_dy << ", Δz = "
608 << g_dz << ", Δr = " << g_pos_diff);
609
610 }
611 }
612
614 "============================================================");
615 ATH_MSG_DEBUG("Strip cluster validation: ");
617 "============================================================");
618 // Process strip modules
619 for (const auto& hid : strip_modules) {
620 auto& tstrip = monitored_strip_map[hid];
621 auto& astrip = reference_strip_map[hid];
622
623 if (tstrip.empty() && astrip.empty())
624 continue;
625
626 if (tstrip.size() != astrip.size()) {
627 ATH_MSG_DEBUG("[ERROR] Strip Module "
628 << hid << ": mismatched clusters found!");
629 ATH_MSG_DEBUG(" Reference found " << astrip.size()
630 << " and monitored found "
631 << tstrip.size() << " clusters!");
632 strip_unequal++;
633 continue;
634 }
635
636 std::vector<
637 std::pair<const xAOD::StripCluster*, const xAOD::StripCluster*>>
638 strip_pairs;
639 matchStripClusters(tstrip, astrip, hid, strip_pairs);
640
641 matched_strip += strip_pairs.size();
642
643 // Add matched pairs and check position differences
644 for (const auto& pair : strip_pairs) {
645 const xAOD::StripCluster* monitored_cluster = pair.first;
646 const xAOD::StripCluster* reference_cluster = pair.second;
647
648 (strip_cluster_matches)[pair.first] = pair.second;
649
650 // Calculate position difference
651 double pos_diff = monitored_cluster->localPosition<1>()[Trk::locX] -
652 reference_cluster->localPosition<1>()[Trk::locX];
653
654
655 // Calculate error difference
656 Eigen::Matrix<float, 1, 1> monitored_cov =
657 monitored_cluster->localCovariance<1>();
658 Eigen::Matrix<float, 1, 1> reference_cov =
659 reference_cluster->localCovariance<1>();
660
661 const InDetDD::SiDetectorElement* monitored_element =
662 m_stripManager->getDetectorElement(monitored_cluster->identifierHash());
663
664
665 if (std::abs(pos_diff / (std::sqrt(reference_cov(0, 0)))) > 0.25) {
666 strip_pos_diff_0p25sig++;
667
668 int side = m_stripID->side(monitored_element->identify());
669 const Identifier strip_moduleID = m_stripID->module_id(monitored_element->identify());
670
671 if (m_stripID->barrel_ec(strip_moduleID) == 0) strip_pos_diff_barrel++;
672 else strip_pos_diff_EC++;
673
674 const IdentifierHash Strip_ModuleHash = m_stripID->wafer_hash(strip_moduleID);
675 double monitored_lorentz_shift =
676 m_stripLorentzAngleTool->getLorentzShift(Strip_ModuleHash + side, eventContext);
677
678 ATH_MSG_DEBUG("Detailed print of cluster discrepancy: ");
679 ATH_MSG_DEBUG("On module: " << strip_moduleID << ", side: " << m_stripID->side(monitored_element->identify()));
680 ATH_MSG_DEBUG("Lorentz shift: " << std::fixed << std::setprecision(9) << monitored_lorentz_shift);
681 // conditions object is keyed by the wafer (side) id, as in DeviceDetectorDescriptionCondAlg
682 const Identifier strip_waferID = m_stripID->wafer_id(Strip_ModuleHash + side);
683 if (auto tracccShift = tracccLorentzShift(strip_waferID, *monCond)) {
684 ATH_MSG_DEBUG("Lorentz shift (traccc conditions): " << tracccShift->first);
685 ATH_MSG_DEBUG(" Δshift = " << tracccShift->first - monitored_lorentz_shift);
686 } else {
687 ATH_MSG_DEBUG("Lorentz shift (traccc conditions): not found for wafer " << strip_waferID);
688 }
689
690 ATH_MSG_DEBUG("Local position: ");
692 " Monitored: ("
693 << monitored_cluster->localPosition<1>()[Trk::locX] << ")");
694 ATH_MSG_DEBUG(" Reference: ("
695 << reference_cluster->localPosition<1>()[Trk::locX] << ")");
696 ATH_MSG_DEBUG(" Δx = " << pos_diff );
697 ATH_MSG_DEBUG("Cluster cov: ");
698 ATH_MSG_DEBUG(" Monitored: (" << monitored_cov(0, 0) << ")");
699 ATH_MSG_DEBUG(" Reference: (" << reference_cov(0, 0) << ")");
700 ATH_MSG_DEBUG(" Δx = " << monitored_cov(0, 0) - reference_cov(0, 0));
701
702 const auto& rdoListRange = monitored_cluster->rdoList();
703 std::vector<Identifier> monitored_rdoList(
704 rdoListRange.begin(), rdoListRange.end());
705
706 if (monitored_element->isBarrel()) {
707 const InDetDD::SCT_BarrelModuleSideDesign* s_design = (static_cast<const InDetDD::SCT_BarrelModuleSideDesign*>(&monitored_element->design()));
708
709 for (auto rdoIter : monitored_rdoList) {
710 const InDetDD::SiCellId& chargeCellId =
711 monitored_element->cellIdFromIdentifier(rdoIter);
713 s_design->localPositionOfCell(chargeCellId);
714 Amg::Vector2D loc_pos(si_pos.xPhi(), si_pos.xEta());
715 ATH_MSG_DEBUG("hit id for this cell: "
716 << chargeCellId
717 << ", position: " << loc_pos[0]
718 << ", " << loc_pos[1]);
719 // barrel: traccc channel0 = strip, measured coordinate is local x
720 const int strip = m_stripID->strip(rdoIter);
721 if (auto tracccPos = tracccCellPosition(strip_waferID, strip, 0, *monDesign, *monCond)) {
722 ATH_MSG_DEBUG(" traccc position for this cell (strip " << strip << "): "
723 << (*tracccPos)[0]
724 << " (Δ = " << (*tracccPos)[0] - loc_pos[0] << ")");
725 } else {
726 ATH_MSG_DEBUG(" traccc position for this cell (strip " << strip << "): not found");
727 }
728 }
729
730 }else{
731
732 const InDetDD::StripStereoAnnulusDesign* annulus_design = (static_cast<const InDetDD::StripStereoAnnulusDesign*>(&monitored_element->design()));
733
734 for (auto rdoIter : monitored_rdoList) {
735 const InDetDD::SiCellId& chargeCellId =
736 monitored_element->cellIdFromIdentifier(rdoIter);
737
739 annulus_design->localPositionOfCell(chargeCellId);
740 Amg::Vector2D loc_pos(si_pos.xPhi(), si_pos.xEta());
741 // polar-coordinate position, i.e. the frame the cluster localPosition is stored in
742 const InDetDD::SiLocalPosition pc_pos =
743 annulus_design->localPositionOfCellPC(chargeCellId);
744 ATH_MSG_DEBUG("hit id for this cell: "
745 << chargeCellId
746 << ", position: " << loc_pos[0]
747 << ", " << loc_pos[1]
748 << ", polar (phi, r): " << pc_pos.xPhi()
749 << ", " << pc_pos.xEta());
750 // endcap: traccc channel1 = strip, measured coordinate is local y (phi)
751 const int strip = m_stripID->strip(rdoIter);
752 if (auto tracccPos = tracccCellPosition(strip_waferID, 0, strip, *monDesign, *monCond)) {
753 ATH_MSG_DEBUG(" traccc position for this cell (strip " << strip << "): "
754 << (*tracccPos)[1]
755 << " (Δphi = " << (*tracccPos)[1] - pc_pos.xPhi() << ")");
756 } else {
757 ATH_MSG_DEBUG(" traccc position for this cell (strip " << strip << "): not found");
758 }
759 }
760
761 }
762
763 // Calculate width difference
764 ATH_MSG_DEBUG("Cluster width: ");
765 ATH_MSG_DEBUG(" Monitored phi channels: ("
766 << monitored_cluster->channelsInPhi() << ")");
767 ATH_MSG_DEBUG(" Reference phi channels: ("
768 << reference_cluster->channelsInPhi() << ")");
769
770 ATH_MSG_DEBUG(" Δphi = " << monitored_cluster->channelsInPhi() -
771 reference_cluster->channelsInPhi());
772
773 }
774 if (std::abs(pos_diff / (std::sqrt(reference_cov(0, 0)))) > 0.5) {
775 strip_pos_diff_0p5sig++;
776 }
777 if (std::abs(pos_diff / (std::sqrt(reference_cov(0, 0)))) > 1) {
778 strip_pos_diff_1sig++;
779 }
780
781 }
782 }
783
785 "============================================================");
786
787 // Print statistics
789 "============================================================");
790 ATH_MSG_DEBUG("PIXEL CLUSTER MATCHING STATISTICS: ");
791 ATH_MSG_DEBUG(" Total matched clusters: " << matched_pixel);
792 ATH_MSG_DEBUG(" Clusters with pos diff > 1 sigma: "
793 << pixel_pos_diff_1sig << " ("
794 << (matched_pixel > 0
795 ? 100.0 * pixel_pos_diff_1sig / matched_pixel
796 : 0.0)
797 << "%)");
798 ATH_MSG_DEBUG(" Clusters with pos diff > 0.5 sigma: "
799 << pixel_pos_diff_0p5sig << " ("
800 << (matched_pixel > 0
801 ? 100.0 * pixel_pos_diff_0p5sig / matched_pixel
802 : 0.0)
803 << "%)");
804 ATH_MSG_DEBUG(" Clusters with pos diff > 0.25 sigma: "
805 << pixel_pos_diff_0p25sig << " ("
806 << (matched_pixel > 0
807 ? 100.0 * pixel_pos_diff_0p25sig / matched_pixel
808 : 0.0)
809 << "%)");
811 "============================================================");
813 "============================================================");
814 ATH_MSG_DEBUG("STRIP CLUSTER MATCHING STATISTICS:");
815 ATH_MSG_DEBUG(" Total matched clusters: " << matched_strip);
816 ATH_MSG_DEBUG(" Clusters with pos diff > 1 sigma: "
817 << strip_pos_diff_1sig << " ("
818 << (matched_strip > 0
819 ? 100.0 * strip_pos_diff_1sig / matched_strip
820 : 0.0)
821 << "%)");
822 ATH_MSG_DEBUG(" Clusters with pos diff > 0.5 sigma: "
823 << strip_pos_diff_0p5sig << " ("
824 << (matched_strip > 0
825 ? 100.0 * strip_pos_diff_0p5sig / matched_strip
826 : 0.0)
827 << "%)");
828 ATH_MSG_DEBUG(" Clusters with pos diff > 0.25 sigma: "
829 << strip_pos_diff_0p25sig << " ("
830 << (matched_strip > 0
831 ? 100.0 * strip_pos_diff_0p25sig / matched_strip
832 : 0.0)
833 << "%)");
835 "============================================================");
836
837 m_pixel_unequal += pixel_unequal;
838 m_strip_unequal += strip_unequal;
839 m_matched_pixel += matched_pixel;
840 m_matched_strip += matched_strip;
841 m_pixel_pos_diff_1sig += pixel_pos_diff_1sig;
842 m_pixel_pos_diff_0p5sig += pixel_pos_diff_0p5sig;
843 m_pixel_pos_diff_0p25sig += pixel_pos_diff_0p25sig;
844 m_strip_pos_diff_1sig += strip_pos_diff_1sig;
845 m_strip_pos_diff_0p5sig += strip_pos_diff_0p5sig;
846 m_strip_pos_diff_0p25sig += strip_pos_diff_0p25sig;
847 m_strip_pos_diff_EC += strip_pos_diff_EC;
848 m_strip_pos_diff_barrel += strip_pos_diff_barrel;
849
850 return StatusCode::SUCCESS;
851}
852
854 const EventContext& eventContext, std::unordered_map<const xAOD::PixelCluster*, const xAOD::PixelCluster*>& pixel_cluster_matches) const
855{
856
857 // retrieve the spacepoints in form of xAOD containers
859 "Reading monitored spacepoints: " << m_monitoredSpacepointsKey.key());
860 ATH_MSG_INFO("Reading reference spacepoints: " << m_referenceSpacepointsKey.key());
861
862 SG::ReadHandle<xAOD::SpacePointContainer> monitoredSpacepointsHandle =
864 ATH_CHECK(monitoredSpacepointsHandle.isValid());
865 const xAOD::SpacePointContainer* monitoredSpacepoints =
866 monitoredSpacepointsHandle.cptr();
867
868 SG::ReadHandle<xAOD::SpacePointContainer> referenceSpacepointsHandle =
870 ATH_CHECK(referenceSpacepointsHandle.isValid());
871 const xAOD::SpacePointContainer* referenceSpacepoints =
872 referenceSpacepointsHandle.cptr();
873
874 size_t t_n_sp = monitoredSpacepoints->size();
875 size_t a_n_sp = referenceSpacepoints->size();
876
877 ATH_MSG_DEBUG(" Monitored/reference spacepoints " << t_n_sp << " / " << a_n_sp);
878
879 if (t_n_sp != a_n_sp) {
880 ATH_MSG_DEBUG("[ERROR] mismatched spacepoint numbers found!");
881 ATH_MSG_DEBUG(" Monitored/reference spacepoints " << t_n_sp << " / "
882 << a_n_sp);
883 }
884
885 // Now match spacepoints based on their constituent clusters
886 int matched_sp = 0;
887 int unmatched_monitored_sp = 0;
888 int unmatched_reference_sp = 0;
889 int sp_global_pos_diff_1mm = 0;
890 int sp_global_pos_diff_5mm = 0;
891 int sp_variance_r_diff = 0;
892 int sp_variance_z_diff = 0;
893
894 std::vector<std::pair<const xAOD::SpacePoint*, const xAOD::SpacePoint*>>
895 sp_matches;
896 std::set<const xAOD::SpacePoint*> matched_reference_sp;
897
898 for (const auto* monitored_sp : *monitoredSpacepoints) {
899
900 const auto& monitored_measurements = monitored_sp->measurements();
901
902 // Find matching ACTS spacepoint by comparing cluster content
903 bool found_match = false;
904 for (const auto* reference_sp : *referenceSpacepoints) {
905
906 const auto& reference_measurements = reference_sp->measurements();
907
908 // Check if measurements sizes match
909 if (monitored_measurements.size() != reference_measurements.size())
910 continue;
911
912 // Check if all clusters match
913 bool all_clusters_match = true;
914 for (size_t i = 0; i < monitored_measurements.size(); ++i) {
915 const xAOD::UncalibratedMeasurement* monitored_meas =
916 monitored_measurements[i];
917 const xAOD::UncalibratedMeasurement* reference_meas =
918 reference_measurements[i];
919
920 // Try pixel cluster matching
921 auto monitored_pixel =
922 dynamic_cast<const xAOD::PixelCluster*>(monitored_meas);
923 auto reference_pixel =
924 dynamic_cast<const xAOD::PixelCluster*>(reference_meas);
925
926 if (monitored_pixel && reference_pixel) {
927 auto it = pixel_cluster_matches.find(monitored_pixel);
928 if (it == pixel_cluster_matches.end() ||
929 it->second != reference_pixel) {
930 all_clusters_match = false;
931 break;
932 }
933 } else {
934 // Only pixel spacepoints are supported for now
935 ATH_MSG_WARNING("Non-pixel measurement in spacepoint comparison — "
936 "strip spacepoints are not yet handled, skipping pair");
937 all_clusters_match = false;
938 break;
939 }
940 }
941
942 if (all_clusters_match) {
943
944 // Found matching spacepoint pair
945 matched_sp++;
946 sp_matches.push_back(std::make_pair(monitored_sp, reference_sp));
947 matched_reference_sp.insert(reference_sp);
948 found_match = true;
949
950 break;
951 }
952 }
953
954 if (!found_match) {
955 unmatched_monitored_sp++;
956 }
957 }
958
959 for (auto& sp_pair : sp_matches) {
960
961 const xAOD::SpacePoint* monitored_sp = sp_pair.first;
962 const xAOD::SpacePoint* reference_sp = sp_pair.second;
963
964 double dx = monitored_sp->x() - reference_sp->x();
965 double dy = monitored_sp->y() - reference_sp->y();
966 double dz = monitored_sp->z() - reference_sp->z();
967 double pos_diff = std::sqrt(dx * dx + dy * dy + dz * dz);
968
969 // Calculate global position difference
970 ATH_MSG_DEBUG("Spacepoint global position: ");
971 ATH_MSG_DEBUG(" Monitored: (" << monitored_sp->x() << ", " << monitored_sp->y()
972 << ", " << monitored_sp->z() << ")");
973 ATH_MSG_DEBUG(" Reference: (" << reference_sp->x() << ", " << reference_sp->y()
974 << ", " << reference_sp->z() << ")");
975 ATH_MSG_DEBUG(" Δx = " << dx << ", Δy = " << dy << ", Δz = " << dz
976 << ", Δr = " << pos_diff);
977
978 if (pos_diff > 1.0)
979 sp_global_pos_diff_1mm++;
980 if (pos_diff > 5.0)
981 sp_global_pos_diff_5mm++;
982
983 // Calculate covariance difference
984 ATH_MSG_DEBUG("Spacepoint cov and radius: ");
985 ATH_MSG_DEBUG(" Monitored r/z and radius: ("
986 << monitored_sp->varianceR() << ", "
987 << monitored_sp->varianceZ() << ", " << monitored_sp->radius()
988 << ")");
989 ATH_MSG_DEBUG(" Reference r/z and radius: (" << reference_sp->varianceR() << ", "
990 << reference_sp->varianceZ() << ", "
991 << reference_sp->radius() << ")");
992 ATH_MSG_DEBUG(" Δcov_r = "
993 << monitored_sp->varianceR() - reference_sp->varianceR()
994 << ", Δcov_z = "
995 << monitored_sp->varianceZ() - reference_sp->varianceZ()
996 << ", Δradius = "
997 << monitored_sp->radius() - reference_sp->radius());
998
999 if (reference_sp->varianceR() > 0 &&
1000 std::abs(monitored_sp->varianceR() - reference_sp->varianceR()) /
1001 reference_sp->varianceR() > 0.1)
1002 sp_variance_r_diff++;
1003 if (reference_sp->varianceZ() > 0 &&
1004 std::abs(monitored_sp->varianceZ() - reference_sp->varianceZ()) /
1005 reference_sp->varianceZ() > 0.1)
1006 sp_variance_z_diff++;
1007
1008 }
1009
1010 unmatched_reference_sp = referenceSpacepoints->size() - matched_reference_sp.size();
1011
1012 // Print statistics
1014 "============================================================");
1015 ATH_MSG_INFO("SPACEPOINT MATCHING STATISTICS:");
1016 ATH_MSG_INFO(" Total monitored spacepoints: " << t_n_sp);
1017 ATH_MSG_INFO(" Total reference spacepoints: " << a_n_sp);
1018 ATH_MSG_INFO(" Matched spacepoints: " << matched_sp);
1019 ATH_MSG_INFO(" Unmatched monitored spacepoints: " << unmatched_monitored_sp);
1020 ATH_MSG_INFO(" Unmatched reference spacepoints: " << unmatched_reference_sp);
1022 "============================================================");
1023 ATH_MSG_INFO("SPACEPOINT POSITION COMPARISON:");
1025 " Spacepoints with global pos diff > 1 mm: "
1026 << sp_global_pos_diff_1mm << " ("
1027 << (matched_sp > 0 ? 100.0 * sp_global_pos_diff_1mm / matched_sp : 0.0)
1028 << "%)");
1030 " Spacepoints with global pos diff > 5 mm: "
1031 << sp_global_pos_diff_5mm << " ("
1032 << (matched_sp > 0 ? 100.0 * sp_global_pos_diff_5mm / matched_sp : 0.0)
1033 << "%)");
1035 "============================================================");
1036 ATH_MSG_INFO("SPACEPOINT VARIANCE COMPARISON:");
1038 " Spacepoints with >10% variance R difference: "
1039 << sp_variance_r_diff << " ("
1040 << (matched_sp > 0 ? 100.0 * sp_variance_r_diff / matched_sp : 0.0)
1041 << "%)");
1043 " Spacepoints with >10% variance Z difference: "
1044 << sp_variance_z_diff << " ("
1045 << (matched_sp > 0 ? 100.0 * sp_variance_z_diff / matched_sp : 0.0)
1046 << "%)");
1048 "============================================================");
1049
1050
1051 m_nMonSp += t_n_sp;
1052 m_nRefSp += a_n_sp;
1053 m_nMatchedSp += matched_sp;
1054 m_nUnmatchedMonSp += unmatched_monitored_sp;
1055 m_nUnmatchedRefSp += unmatched_reference_sp;
1056 m_nSpPosDiff1mm += sp_global_pos_diff_1mm;
1057 m_nSpPosDiff5mm += sp_global_pos_diff_5mm;
1058 m_nSpVarRDiff += sp_variance_r_diff;
1059 m_nSpVarZDiff += sp_variance_z_diff;
1060
1061 return StatusCode::SUCCESS;
1062}
1063
1065{
1066
1067 // Print cluster statistics
1068 ATH_MSG_INFO("Validation Summary");
1069 ATH_MSG_INFO("ValSum ============================================================");
1070 ATH_MSG_INFO("ValSum PIXEL CLUSTER MATCHING STATISTICS: ");
1071 ATH_MSG_INFO("ValSum Total unmatched clusters mon/ref: " << m_pix_unmatched_mon << " / " << m_pix_unmatched_ref);
1072 ATH_MSG_INFO("ValSum Total matched clusters: " << m_matched_pixel);
1073 ATH_MSG_INFO("ValSum Clusters with pos diff > 1 sigma: "
1074 << m_pixel_pos_diff_1sig << " ("
1075 << (m_matched_pixel.value() > 0
1076 ? 100.0 * m_pixel_pos_diff_1sig.value() / m_matched_pixel.value()
1077 : 0.0)
1078 << "%)");
1079 ATH_MSG_INFO("ValSum Clusters with pos diff > 0.5 sigma: "
1080 << m_pixel_pos_diff_0p5sig << " ("
1081 << (m_matched_pixel.value() > 0
1082 ? 100.0 * m_pixel_pos_diff_0p5sig.value() / m_matched_pixel.value()
1083 : 0.0)
1084 << "%)");
1085 ATH_MSG_INFO("ValSum Clusters with pos diff > 0.25 sigma: "
1086 << m_pixel_pos_diff_0p25sig << " ("
1087 << (m_matched_pixel.value() > 0
1088 ? 100.0 * m_pixel_pos_diff_0p25sig.value() / m_matched_pixel.value()
1089 : 0.0)
1090 << "%)");
1091 ATH_MSG_INFO("ValSum ============================================================");
1092 ATH_MSG_INFO("ValSum ============================================================");
1093 ATH_MSG_INFO("ValSum STRIP CLUSTER MATCHING STATISTICS:");
1094 ATH_MSG_INFO("ValSum Total unmatched clusters mon/ref: " << m_strip_unmatched_mon << " / " << m_strip_unmatched_ref);
1095 ATH_MSG_INFO("ValSum Total matched clusters: " << m_matched_strip);
1096 ATH_MSG_INFO("ValSum Clusters with pos diff > 1 sigma: "
1097 << m_strip_pos_diff_1sig << " ("
1098 << (m_matched_strip.value() > 0
1099 ? 100.0 * m_strip_pos_diff_1sig.value() / m_matched_strip.value()
1100 : 0.0)
1101 << "%)");
1102 ATH_MSG_INFO("ValSum Clusters with pos diff > 0.5 sigma: "
1103 << m_strip_pos_diff_0p5sig << " ("
1104 << (m_matched_strip.value() > 0
1105 ? 100.0 * m_strip_pos_diff_0p5sig.value() / m_matched_strip.value()
1106 : 0.0)
1107 << "%)");
1108 ATH_MSG_INFO("ValSum Clusters with pos diff > 0.25 sigma: "
1109 << m_strip_pos_diff_0p25sig << " ("
1110 << (m_matched_strip.value() > 0
1111 ? 100.0 * m_strip_pos_diff_0p25sig.value() / m_matched_strip.value()
1112 : 0.0)
1113 << "%)");
1114 ATH_MSG_INFO("ValSum Distribution of clusters with poss diff > 0.25 sigma (barrel/EC): "
1116 ATH_MSG_INFO("ValSum ============================================================");
1117
1119 ATH_MSG_INFO("ValSum ============================================================");
1120 ATH_MSG_INFO("ValSum PIXEL SPACEPOINT MATCHING STATISTICS:");
1121 ATH_MSG_INFO("ValSum Total monitored spacepoints: " << m_nMonSp);
1122 ATH_MSG_INFO("ValSum Total reference spacepoints: " << m_nRefSp);
1123 ATH_MSG_INFO("ValSum Matched spacepoints: " << m_nMatchedSp);
1124 ATH_MSG_INFO("ValSum Unmatched monitored spacepoints: " << m_nUnmatchedMonSp);
1125 ATH_MSG_INFO("ValSum Unmatched reference spacepoints: " << m_nUnmatchedRefSp);
1126 ATH_MSG_INFO("ValSum ============================================================");
1127 ATH_MSG_INFO("ValSum SPACEPOINT POSITION COMPARISON:");
1128 ATH_MSG_INFO("ValSum Spacepoints with global pos diff > 1 mm: "
1129 << m_nSpPosDiff1mm << " ("
1130 << (m_nMatchedSp.value() > 0 ? 100.0 * m_nSpPosDiff1mm.value() / m_nMatchedSp.value() : 0.0)
1131 << "%)");
1132 ATH_MSG_INFO("ValSum Spacepoints with global pos diff > 5 mm: "
1133 << m_nSpPosDiff5mm << " ("
1134 << (m_nMatchedSp.value() > 0 ? 100.0 * m_nSpPosDiff5mm.value() / m_nMatchedSp.value() : 0.0)
1135 << "%)");
1136 ATH_MSG_INFO("ValSum ============================================================");
1137 ATH_MSG_INFO("ValSum SPACEPOINT VARIANCE COMPARISON:");
1138 ATH_MSG_INFO("ValSum Spacepoints with >10% variance R difference: "
1139 << m_nSpVarRDiff << " ("
1140 << (m_nMatchedSp.value() > 0 ? 100.0 * m_nSpVarRDiff.value() / m_nMatchedSp.value() : 0.0)
1141 << "%)");
1142 ATH_MSG_INFO("ValSum Spacepoints with >10% variance Z difference: "
1143 << m_nSpVarZDiff << " ("
1144 << (m_nMatchedSp.value() > 0 ? 100.0 * m_nSpVarZDiff.value() / m_nMatchedSp.value() : 0.0)
1145 << "%)");
1146 ATH_MSG_INFO("ValSum ============================================================");
1147 }
1148
1149 return StatusCode::SUCCESS;
1150}
1151
1152} // namespace ActsTrk
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_INFO(x,...)
Handle class for reading from StoreGate.
Gaudi::Accumulators::Counter m_nMatchedSp
StatusCode validateClusters(const EventContext &eventContext, std::unordered_map< const xAOD::PixelCluster *, const xAOD::PixelCluster * > &pixel_cluster_matches, std::unordered_map< const xAOD::StripCluster *, const xAOD::StripCluster * > &strip_cluster_matches) const
Gaudi::Accumulators::Counter m_pix_unmatched_mon
Gaudi::Accumulators::Counter m_strip_pos_diff_barrel
SG::ReadHandleKey< xAOD::PixelClusterContainer > m_referencePixelClustersKey
void matchPixelClusters(std::vector< const xAOD::PixelCluster * > &monitored_list, std::vector< const xAOD::PixelCluster * > &reference_list, const std::string &module_id, std::vector< std::pair< const xAOD::PixelCluster *, const xAOD::PixelCluster * > > &pairs) const
ToolHandle< ISiLorentzAngleTool > m_pixelLorentzAngleTool
Gaudi::Accumulators::Counter m_pixel_unequal
Gaudi::Accumulators::Counter m_strip_pos_diff_EC
Gaudi::Accumulators::Counter m_strip_unmatched_ref
std::optional< std::pair< float, float > > tracccLorentzShift(const Identifier &athenaId, const traccc::detector_conditions_description::host &cond) const
Lorentz shift stored in the traccc host conditions object for the given Athena module (side).
Gaudi::Property< std::string > m_monDesignObjectName
SG::ReadHandleKey< xAOD::SpacePointContainer > m_monitoredSpacepointsKey
const ActsTrk::GeometryIdMapping * m_idMapping
SG::ReadHandleKey< xAOD::StripClusterContainer > m_referenceStripClustersKey
SG::ReadHandleKey< xAOD::PixelClusterContainer > m_monitoredPixelClustersKey
Gaudi::Accumulators::Counter m_nUnmatchedRefSp
std::optional< std::array< float, 2 > > tracccCellPosition(const Identifier &athenaId, unsigned int channel0, unsigned int channel1, const traccc::detector_design_description::host &design, const traccc::detector_conditions_description::host &cond) const
Centre of the traccc readout bin (channel0, channel1) on the given Athena module, computed like tracc...
Gaudi::Accumulators::Counter m_strip_unequal
Gaudi::Accumulators::Counter m_pixel_pos_diff_0p25sig
Gaudi::Property< std::string > m_stripManagerKey
Gaudi::Accumulators::Counter m_nSpPosDiff5mm
Gaudi::Accumulators::Counter m_strip_pos_diff_0p5sig
const InDetDD::PixelDetectorManager * m_pixelManager
Gaudi::Accumulators::Counter m_nSpVarRDiff
SG::ReadHandleKey< xAOD::StripClusterContainer > m_monitoredStripClustersKey
Gaudi::Accumulators::Counter m_matched_pixel
Gaudi::Accumulators::Counter m_nSpVarZDiff
virtual StatusCode execute(const EventContext &ctx) const override
Execute the algorithm.
Gaudi::Accumulators::Counter m_nSpPosDiff1mm
Gaudi::Accumulators::Counter m_strip_pos_diff_0p25sig
virtual StatusCode finalize() override
Finalize the algorithm.
ToolHandle< ISiLorentzAngleTool > m_stripLorentzAngleTool
Gaudi::Accumulators::Counter m_nUnmatchedMonSp
Gaudi::Accumulators::Counter m_strip_pos_diff_1sig
const InDetDD::SCT_DetectorManager * m_stripManager
Gaudi::Accumulators::Counter m_pixel_pos_diff_1sig
Gaudi::Accumulators::Counter m_strip_unmatched_mon
Gaudi::Accumulators::Counter m_matched_strip
SG::ReadCondHandleKey< traccc::detector_conditions_description::host > m_monCondKey
SG::ReadHandleKey< xAOD::SpacePointContainer > m_referenceSpacepointsKey
Gaudi::Accumulators::Counter m_pix_unmatched_ref
virtual StatusCode initialize() override
Initialize the algorithm.
Gaudi::Property< std::string > m_pixelManagerKey
void matchStripClusters(std::vector< const xAOD::StripCluster * > &monitored_list, std::vector< const xAOD::StripCluster * > &reference_list, const std::string &module_id, std::vector< std::pair< const xAOD::StripCluster *, const xAOD::StripCluster * > > &pairs) const
Gaudi::Accumulators::Counter m_pixel_pos_diff_0p5sig
Gaudi::Property< std::string > m_geoIdMappingObjectName
StatusCode validatePixelSpacepoints(const EventContext &eventContext, std::unordered_map< const xAOD::PixelCluster *, const xAOD::PixelCluster * > &pixel_cluster_matches) const
const ServiceHandle< StoreGateSvc > & detStore() const
size_type size() const noexcept
Returns the number of elements in the collection.
This is a "hash" representation of an Identifier.
static constexpr std::array< PixelDiodeTree::CellIndexType, 2 > makeCellIndex(T local_x_idx, T local_y_idx)
Create a 2D cell index from the indices in local-x (phi, row) and local-y (eta, column) direction.
Class used to describe the design of a module (diode segmentation and readout scheme).
PixelDiodeTree::DiodeProxyWithPosition diodeProxyFromIdxCachePosition(const std::array< PixelDiodeTree::IndexType, 2 > &idx) const
Barrel module design description for the SCT.
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const
id -> position
Identifier for the strip or pixel cell.
Definition SiCellId.h:29
int phiIndex() const
Get phi index. Equivalent to strip().
Definition SiCellId.h:122
int etaIndex() const
Get eta index.
Definition SiCellId.h:114
Class to hold geometrical description of a silicon detector element.
virtual SiCellId cellIdFromIdentifier(const Identifier &identifier) const override final
SiCellId from Identifier.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
Class to represent a position in the natural frame of a silicon sensor, for Pixel and SCT For Pixel: ...
double xPhi() const
position along phi direction:
double xEta() const
position along eta direction:
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
virtual Identifier identify() const override final
identifier of this detector element (inline)
virtual SiLocalPosition localPositionOfCell(const SiCellId &cellId) const override
id -> position
SiLocalPosition localPositionOfCellPC(const SiCellId &cellId) const
This is for debugging only.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
STL class.
SG::ConstAccessor< SG::JaggedVecElt< Identifier::value_type > >::element_type rdoList() const
Returns the list of identifiers of the channels building the cluster.
int channelsInPhi() const
Returns the dimensions of the cluster in numbers of channels in phi (x) and eta (y) directions,...
ConstVectorMap< 3 > globalPosition() const
Returns the global position of the pixel cluster.
int channelsInEta() const
float widthInEta() const
Returns the width of the cluster in phi (x) and eta (y) directions, respectively.
float varianceZ() const
float varianceR() const
Returns the variances.
float z() const
float y() const
float x() const
float radius() const
SG::ConstAccessor< SG::JaggedVecElt< Identifier::value_type > >::element_type rdoList() const
Returns the list of identifiers of the channels building the cluster.
int channelsInPhi() const
Returns the dimensions of the cluster in numbers of channels in phi (x), respectively.
ConstMatrixMap< N > localCovariance() const
Returns the local covariance of the measurement.
DetectorIDHashType identifierHash() const
Returns the IdentifierHash of the measurement (corresponds to the detector element IdentifierHash).
ConstVectorMap< N > localPosition() const
Returns the local position of the measurement.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Eigen::Matrix< double, 2, 1 > Vector2D
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
PixelClusterContainer_v1 PixelClusterContainer
Define the version of the pixel cluster container.
StripCluster_v1 StripCluster
Define the version of the strip cluster class.
SpacePointContainer_v1 SpacePointContainer
Define the version of the space point container.
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
StripClusterContainer_v1 StripClusterContainer
Define the version of the strip cluster container.
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.
A diode proxy which caches the position of a diode.
const Vector2D & position() const
get the cached position of this diode