ATLAS Offline Software
Loading...
Searching...
No Matches
Gep::EratioMaker Class Reference

#include <EratioMaker.h>

Collaboration diagram for Gep::EratioMaker:

Public Member Functions

 EratioMaker (const GepCellMap &caloCellsMap)
const EratioObj makeEratio (const ROOT::Math::PtEtaPhiEVector obj) const

Private Member Functions

std::vector< std::vector< GepCaloCell > > makeWindow (const ROOT::Math::PtEtaPhiEVector &obj) const
std::pair< double, double > findLocalMaxima (const std::vector< std::vector< GepCaloCell > > &window) const
double computeEratio (double E1, double E2) const

Private Attributes

const GepCellMapm_caloCellsMap

Detailed Description

Definition at line 27 of file EratioMaker.h.

Constructor & Destructor Documentation

◆ EratioMaker()

Gep::EratioMaker::EratioMaker ( const GepCellMap & caloCellsMap)

Definition at line 15 of file EratioMaker.cxx.

16 : m_caloCellsMap{caloCellsMap}
17{
18
19}
const GepCellMap & m_caloCellsMap
Definition EratioMaker.h:43

Member Function Documentation

◆ computeEratio()

double Gep::EratioMaker::computeEratio ( double E1,
double E2 ) const
private

Definition at line 149 of file EratioMaker.cxx.

150{
151 return (E1 + E2 > 0) ? (E1 - E2) / (E1 + E2) : -999;
152}

◆ findLocalMaxima()

std::pair< double, double > Gep::EratioMaker::findLocalMaxima ( const std::vector< std::vector< GepCaloCell > > & window) const
private

Definition at line 94 of file EratioMaker.cxx.

95{
96
97 struct LocalMax {
98 double energy;
99 int i;
100 int j;
101 };
102
103 std::vector<LocalMax> localMaxima;
104
105 int rows = window.size();
106 int cols = window[0].size();
107
108 for (int i = 0; i < rows; ++i) {
109 for (int j = 0; j < cols; ++j) {
110 double current = window[i][j].e;
111 bool isMax = true;
112
113 for (int di = -1; di <= 1; ++di) {
114 for (int dj = -1; dj <= 1; ++dj) {
115 if (di == 0 && dj == 0) continue;
116 int ni = i + di;
117 int nj = j + dj;
118 if (ni >= 0 && ni < rows && nj >= 0 && nj < cols) {
119 if (window[ni][nj].e >= current) {
120 isMax = false;
121 break;
122 }
123 }
124 }
125 if (!isMax) break;
126 }
127
128 if (isMax) localMaxima.push_back({current, i, j });
129 }
130 }
131
132 if (localMaxima.empty()) return {0., 0.};
133
134 // Sort local maximas in descendent fashion
135 std::sort(localMaxima.begin(), localMaxima.end(),
136 [](const LocalMax& a, const LocalMax& b){ return a.energy > b.energy; });
137
138 double E1 = localMaxima[0].energy;
139 double E2 = (localMaxima.size() > 1) ? localMaxima[1].energy : 0.0;
140
141 return {E1, E2};
142
143}
static Double_t a
float j(const xAOD::IParticle &, const xAOD::TrackMeasurementValidation &hit, const Eigen::Matrix3d &jab_inv)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ makeEratio()

const EratioObj Gep::EratioMaker::makeEratio ( const ROOT::Math::PtEtaPhiEVector obj) const

Definition at line 158 of file EratioMaker.cxx.

159{
160 auto window = makeWindow(seed);
161 auto [E1, E2] = findLocalMaxima(window);
162 double eratio = computeEratio(E1, E2);
163
164 EratioObj obj;
165 obj.seedEta = seed.eta();
166 obj.seedPhi = seed.phi();
167 obj.E1 = E1;
168 obj.E2 = E2;
169 obj.Eratio = eratio;
170
171 return obj;
172}
std::pair< double, double > findLocalMaxima(const std::vector< std::vector< GepCaloCell > > &window) const
double computeEratio(double E1, double E2) const
std::vector< std::vector< GepCaloCell > > makeWindow(const ROOT::Math::PtEtaPhiEVector &obj) const
setCharge setNTRTHiThresholdHits eratio

◆ makeWindow()

std::vector< std::vector< GepCaloCell > > Gep::EratioMaker::makeWindow ( const ROOT::Math::PtEtaPhiEVector & obj) const
private

Definition at line 27 of file EratioMaker.cxx.

28{
29 std::vector<std::vector<GepCaloCell>> window(17, std::vector<GepCaloCell>(3));
30
31 auto cellMap = m_caloCellsMap.getCellMap();
32
33 // 1. Find cell that contains the seed
34 const GepCaloCell* centerCell = nullptr;
35 unsigned int centerCellId = 0;
36 bool exactMatchFound = false;
37
38 for (auto it = cellMap->begin(); it != cellMap->end(); ++it) {
39 const auto& cell = it->second;
40 if (cell.sampling != 1) continue; // Only ECAL layer 1
41
42 // Verify if seed coordinates fall inside the limits of some cell
43 if (cell.etaMin < seed.eta() && seed.eta() < cell.etaMax &&
44 cell.phiMin < seed.phi() && seed.phi() < cell.phiMax) {
45 centerCell = &cell;
46 centerCellId = cell.id;
47 exactMatchFound = true;
48 break;
49 }
50 }
51
52 // If not exact match, return empty window
53 if (!exactMatchFound || !centerCell) {
54 return window;
55 }
56
57 // 2. Construct 17x3 (rows x cols) window based on cell ID relations starting from seed
58 // Rows: -8 to +8 from central cell in eta (17 total)
59 // Columns: -1, 0, +1 from central cell in phi (3 total)
60
61 // Construct each window row
62 for (int etaOffset = -8; etaOffset <= 8; etaOffset++) {
63 unsigned int windowRow = etaOffset + 8; // Convertir a índice 0..16
64
65 // Get base ID for this row (central cell of the phi column)
66 unsigned int baseId = static_cast<unsigned int>(static_cast<int>(centerCellId) + (etaOffset * 512));
67
68 // Loop phi columns (-1, 0, +1)
69 for (int phiOffset = -1; phiOffset <= 1; phiOffset++) {
70 int windowCol = phiOffset + 1;
71
72 // Compute desired cell ID
73 unsigned int cellId = static_cast<unsigned int>(static_cast<int>(baseId) + phiOffset * 2);
74
75 // Look for that cell within the map
76 auto it = cellMap->find(cellId);
77 if (it != cellMap->end()) {
78 const auto& cell = it->second;
79 if (cell.sampling == 1) {
80 window[windowRow][windowCol] = cell;
81 }
82 }
83 }
84 }
85
86 return window;
87}

Member Data Documentation

◆ m_caloCellsMap

const GepCellMap& Gep::EratioMaker::m_caloCellsMap
private

Definition at line 43 of file EratioMaker.h.


The documentation for this class was generated from the following files: