ATLAS Offline Software
Loading...
Searching...
No Matches
InnerDetector/InDetMeasurementUtilities/src/Helpers.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7namespace TrackingUtilities {
8
9 std::pair<float, float> computeOmegas(const xAOD::PixelCluster& cluster,
10 const PixelID& pixelID)
11 {
13 rdo_list_cluster = cluster.rdoList();
15 charge_list_cluster = cluster.chargeList();
17 tot_list_cluster = cluster.totList();
18
19 // Prefer the calibrated charge for the omega weights. When charge calibration
20 // is unavailable (e.g. digital clustering) the charge list is left empty, so
21 // fall back to the ToT list, mirroring InDet::ClusterMakerTool. This keeps the
22 // analogue charge-interpolation correction defined instead of silently
23 // disabling it (returning -1) whenever the charge list is missing.
24 const bool useCharge = rdo_list_cluster.size() == charge_list_cluster.size();
25 if (not useCharge and rdo_list_cluster.size() != tot_list_cluster.size()) {
26 return {-1.f, -1.f};
27 }
28
29 int colmax = std::numeric_limits<int>::min();
30 int rowmax = std::numeric_limits<int>::min();
31 int colmin = std::numeric_limits<int>::max();
32 int rowmin = std::numeric_limits<int>::max();
33
34 float qRowMin = 0.f;
35 float qRowMax = 0.f;
36 float qColMin = 0.f;
37 float qColMax = 0.f;
38
39 for (std::size_t i(0); i<rdo_list_cluster.size(); ++i) {
40 Identifier this_rdo(rdo_list_cluster.at(i));
41 const float this_charge = useCharge ? charge_list_cluster.at(i)
42 : static_cast<float>(tot_list_cluster.at(i));
43
44 const int row = pixelID.phi_index(this_rdo);
45 if (row > rowmax) {
46 rowmax = row;
47 qRowMax = this_charge;
48 } else if (row == rowmax) {
49 qRowMax += this_charge;
50 }
51
52 if (row < rowmin) {
53 rowmin = row;
54 qRowMin = this_charge;
55 } else if (row == rowmin) {
56 qRowMin += this_charge;
57 }
58
59 const int col = pixelID.eta_index(this_rdo);
60 if (col > colmax) {
61 colmax = col;
62 qColMax = this_charge;
63 } else if (col == colmax) {
64 qColMax += this_charge;
65 }
66
67 if (col < colmin) {
68 colmin = col;
69 qColMin = this_charge;
70 } else if (col == colmin) {
71 qColMin += this_charge;
72 }
73 } // loop on rdos and charges
74
75 float omegax = -1.f;
76 float omegay = -1.f;
77 if(qRowMin + qRowMax > 0) omegax = qRowMax/(qRowMin + qRowMax);
78 if(qColMin + qColMax > 0) omegay = qColMax/(qColMin + qColMax);
79
80 return std::make_pair(omegax, omegay);
81 }
82
83}
84
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:69
int eta_index(const Identifier &id) const
Definition PixelID.h:640
int phi_index(const Identifier &id) const
Definition PixelID.h:634
Helper class to provide constant type-safe access to aux data.
SG::ConstAccessor< SG::JaggedVecElt< Identifier::value_type > >::element_type rdoList() const
Returns the list of identifiers of the channels building the cluster.
SG::ConstAccessor< SG::JaggedVecElt< float > >::element_type chargeList() const
Returns the list of charges of the channels building the cluster.
SG::ConstAccessor< SG::JaggedVecElt< int > >::element_type totList() const
Returns the list of ToT of the channels building the cluster.
std::pair< float, float > computeOmegas(const xAOD::PixelCluster &cluster, const PixelID &pixelID)
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.