ATLAS Offline Software
InnerDetector/InDetMeasurementUtilities/src/Helpers.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 namespace TrackingUtilities {
8 
9  std::pair<float, float> computeOmegas(const xAOD::PixelCluster& cluster,
10  const PixelID& pixelID)
11  {
12  const std::vector<Identifier>& rod_list_cluster = cluster.rdoList();
13  const std::vector<float>& charge_list_cluster = cluster.chargeList();
14 
15  if (rod_list_cluster.size() != charge_list_cluster.size()) {
16  return {-1.f, -1.f};
17  }
18 
19  int colmax = std::numeric_limits<int>::min();
20  int rowmax = std::numeric_limits<int>::min();
21  int colmin = std::numeric_limits<int>::max();
22  int rowmin = std::numeric_limits<int>::max();
23 
24  float qRowMin = 0.f;
25  float qRowMax = 0.f;
26  float qColMin = 0.f;
27  float qColMax = 0.f;
28 
29  for (std::size_t i(0); i<rod_list_cluster.size(); ++i) {
30  const Identifier& this_rdo = rod_list_cluster.at(i);
31  const float this_charge = charge_list_cluster.at(i);
32 
33  const int row = pixelID.phi_index(this_rdo);
34  if (row > rowmax) {
35  rowmax = row;
36  qRowMax = this_charge;
37  } else if (row == rowmax) {
38  qRowMax += this_charge;
39  }
40 
41  if (row < rowmin) {
42  rowmin = row;
43  qRowMin = this_charge;
44  } else if (row == rowmin) {
45  qRowMin += this_charge;
46  }
47 
48  const int col = pixelID.eta_index(this_rdo);
49  if (col > colmax) {
50  colmax = col;
51  qColMax = this_charge;
52  } else if (col == colmax) {
53  qColMax += this_charge;
54  }
55 
56  if (col < colmin) {
57  colmin = col;
58  qColMin = this_charge;
59  } else if (col == colmin) {
60  qColMin += this_charge;
61  }
62  } // loop on rdos and charges
63 
64  float omegax = -1.f;
65  float omegay = -1.f;
66  if(qRowMin + qRowMax > 0) omegax = qRowMax/(qRowMin + qRowMax);
67  if(qColMin + qColMax > 0) omegay = qColMax/(qColMin + qColMax);
68 
69  return std::make_pair(omegax, omegay);
70  }
71 
72 }
73 
xAOD::PixelCluster_v1::chargeList
const std::vector< float > & chargeList() const
Returns the list of charges of the channels building the cluster.
PixelID::phi_index
int phi_index(const Identifier &id) const
Definition: PixelID.h:654
xAOD::PixelCluster_v1::rdoList
const std::vector< Identifier > rdoList() const
Returns the list of identifiers of the channels building the cluster.
Definition: PixelCluster_v1.cxx:42
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
keylayer_zslicemap.row
row
Definition: keylayer_zslicemap.py:155
Helpers.h
TrackingUtilities::computeOmegas
std::pair< float, float > computeOmegas(const xAOD::PixelCluster &cluster, const PixelID &pixelID)
Definition: InnerDetector/InDetMeasurementUtilities/src/Helpers.cxx:9
lumiFormat.i
int i
Definition: lumiFormat.py:85
PixelID::eta_index
int eta_index(const Identifier &id) const
Definition: PixelID.h:660
TrackingUtilities
Definition: ClusterConversionUtilities.h:26
xAOD::PixelCluster_v1
Definition: PixelCluster_v1.h:17
PixelID
Definition: PixelID.h:67
Identifier
Definition: IdentifierFieldParser.cxx:14