ATLAS Offline Software
Loading...
Searching...
No Matches
TrigFTF_GNN_DataStorage Class Reference

#include <GNN_DataStorage.h>

Collaboration diagram for TrigFTF_GNN_DataStorage:

Public Member Functions

 TrigFTF_GNN_DataStorage (const TrigFTF_GNN_Geometry &, const std::vector< std::array< float, 5 > > &)
 ~TrigFTF_GNN_DataStorage ()
int loadPixelGraphNodes (short, const std::vector< TrigFTF_GNN_Node > &, bool)
int loadStripGraphNodes (short, const std::vector< TrigFTF_GNN_Node > &)
unsigned int numberOfNodes () const
void sortByPhi ()
void initializeNodes (bool)
void generatePhiIndexing (float)
TrigFTF_GNN_EtaBingetEtaBin (int idx)

Protected Attributes

const TrigFTF_GNN_Geometrym_geo
const std::vector< std::array< float, 5 > > & m_mlLUT
std::vector< TrigFTF_GNN_EtaBinm_etaBins

Detailed Description

Definition at line 82 of file GNN_DataStorage.h.

Constructor & Destructor Documentation

◆ TrigFTF_GNN_DataStorage()

TrigFTF_GNN_DataStorage::TrigFTF_GNN_DataStorage ( const TrigFTF_GNN_Geometry & g,
const std::vector< std::array< float, 5 > > & lut )

Definition at line 94 of file GNN_DataStorage.cxx.

94 : m_geo(g), m_mlLUT(lut) {
95 m_etaBins.resize(g.num_bins());
96}
std::vector< TrigFTF_GNN_EtaBin > m_etaBins
const TrigFTF_GNN_Geometry & m_geo
const std::vector< std::array< float, 5 > > & m_mlLUT

◆ ~TrigFTF_GNN_DataStorage()

TrigFTF_GNN_DataStorage::~TrigFTF_GNN_DataStorage ( )

Definition at line 99 of file GNN_DataStorage.cxx.

99 {
100
101}

Member Function Documentation

◆ generatePhiIndexing()

void TrigFTF_GNN_DataStorage::generatePhiIndexing ( float dphi)

Definition at line 255 of file GNN_DataStorage.cxx.

255 {
256 for(auto& b : m_etaBins) b.generatePhiIndexing(dphi);
257}

◆ getEtaBin()

TrigFTF_GNN_EtaBin & TrigFTF_GNN_DataStorage::getEtaBin ( int idx)
inline

Definition at line 96 of file GNN_DataStorage.h.

96 {
97 if(idx >= static_cast<int>(m_etaBins.size())) idx = idx-1;
98 return m_etaBins.at(idx);
99 }

◆ initializeNodes()

void TrigFTF_GNN_DataStorage::initializeNodes ( bool useML)

Definition at line 181 of file GNN_DataStorage.cxx.

181 {
182
183 for(auto& b : m_etaBins) {
184 b.initializeNodes();
185 if(!b.m_vn.empty()) {
186 b.m_layerKey = m_geo.getTrigFTF_GNN_LayerKeyByIndex((*b.m_vn.begin())->m_layer);
187 }
188 }
189
190 if(!useML) return;
191
192 unsigned int nL = m_geo.num_layers();
193
194 for(unsigned int layerIdx=0;layerIdx<nL;layerIdx++) {
195
196 const TrigFTF_GNN_Layer* pL = m_geo.getTrigFTF_GNN_LayerByIndex(layerIdx);
197
198 if(pL->m_layer.m_subdet < 20000) {//skip strips volumes: layers in range [1200X-1400X]
199 continue;
200 }
201
202 bool isBarrel = (pL->m_layer.m_type == 0);//TO-DO: implement a separate id for inclined barrel layers
203
204 if(!isBarrel) continue;
205
206 // adjusting cuts on |cot(theta)| using pre-trained LUT loaded from a file
207
208 int lutSize = m_mlLUT.size();
209
210 int nBins = pL->m_bins.size();
211
212 for(int b=0;b<nBins;b++) {//loop over eta-bins in Layer
213
214 TrigFTF_GNN_EtaBin& B = m_etaBins.at(pL->m_bins.at(b));
215
216 if(B.empty()) continue;
217
218 for(unsigned int nIdx=0;nIdx<B.m_vn.size();nIdx++) {
219
220 float cluster_width = B.m_vn[nIdx]->pixelClusterWidth();
221
222 float locPosY = B.m_vn[nIdx]->localPositionY();
223
224 int lutBinIdx = std::floor(20*cluster_width) - 1;//lut bin width is 0.05 mm
225
226 if (lutBinIdx >= lutSize) continue;
227
228 const std::array<float, 5> lutBin = m_mlLUT[lutBinIdx];
229
230 float dist2border = 10.0 - std::abs(locPosY);
231
232 float min_tau = -100.0;
233 float max_tau = 100.0;
234
235 if (dist2border > 0.3f) {//far enough from the edge
236 min_tau = lutBin[1];
237 max_tau = lutBin[2];
238 } else {//possible cluster shortening at a module edge
239 min_tau = lutBin[3];
240 max_tau = lutBin[4];
241 }
242
243 if (max_tau < 0) {//insufficient training data
244 max_tau = 100.0;//use "no-cut" default
245 }
246
247 B.m_params[nIdx][0] = min_tau;
248 B.m_params[nIdx][1] = max_tau;
249
250 }
251 }
252 }
253}
const TrigInDetSiLayer & m_layer
std::vector< int > m_bins

◆ loadPixelGraphNodes()

int TrigFTF_GNN_DataStorage::loadPixelGraphNodes ( short layerIndex,
const std::vector< TrigFTF_GNN_Node > & coll,
bool useML )

Definition at line 103 of file GNN_DataStorage.cxx.

103 {
104
105 int nLoaded = 0;
106
107 const TrigFTF_GNN_Layer* pL = m_geo.getTrigFTF_GNN_LayerByIndex(layerIndex);
108
109 if(pL == nullptr) {
110 return -1;
111 }
112
113 bool isBarrel = (pL->m_layer.m_type == 0);
114
115 for(const auto& node : coll) {
116
117 int binIndex = pL->getEtaBin(node.z(), node.r());
118
119 if(binIndex == -1) {
120 continue;
121 }
122
123 if(isBarrel) {
124 m_etaBins.at(binIndex).m_vn.push_back(&node);
125 }
126 else {
127 if (useML) {
128 float cluster_width = node.pixelClusterWidth();
129 if(cluster_width > 0.35) continue;
130 }
131 m_etaBins.at(binIndex).m_vn.push_back(&node);
132 }
133
134 nLoaded++;
135
136 }
137
138 return nLoaded;
139}
int getEtaBin(float, float) const
unsigned int binIndex(const T &val, const std::vector< T > &partitions)
general utility function to return bin index given a value and the upper endpoints of each bin

◆ loadStripGraphNodes()

int TrigFTF_GNN_DataStorage::loadStripGraphNodes ( short layerIndex,
const std::vector< TrigFTF_GNN_Node > & coll )

Definition at line 141 of file GNN_DataStorage.cxx.

141 {
142
143 int nLoaded = 0;
144
145 const TrigFTF_GNN_Layer* pL = m_geo.getTrigFTF_GNN_LayerByIndex(layerIndex);
146
147 if(pL == nullptr) {
148 return -1;
149 }
150
151 for(const auto& node : coll) {
152
153 int binIndex = pL->getEtaBin(node.z(), node.r());
154
155 if(binIndex == -1) {
156 continue;
157 }
158
159 m_etaBins.at(binIndex).m_vn.push_back(&node);
160 nLoaded++;
161 }
162
163 return nLoaded;
164}

◆ numberOfNodes()

unsigned int TrigFTF_GNN_DataStorage::numberOfNodes ( ) const

Definition at line 166 of file GNN_DataStorage.cxx.

166 {
167
168 unsigned int n=0;
169
170 for(const auto& b : m_etaBins) {
171 n += b.m_vn.size();
172 }
173 return n;
174}

◆ sortByPhi()

void TrigFTF_GNN_DataStorage::sortByPhi ( )

Definition at line 176 of file GNN_DataStorage.cxx.

176 {
177
178 for(auto& b : m_etaBins) b.sortByPhi();
179}

Member Data Documentation

◆ m_etaBins

std::vector<TrigFTF_GNN_EtaBin> TrigFTF_GNN_DataStorage::m_etaBins
protected

Definition at line 106 of file GNN_DataStorage.h.

◆ m_geo

const TrigFTF_GNN_Geometry& TrigFTF_GNN_DataStorage::m_geo
protected

Definition at line 103 of file GNN_DataStorage.h.

◆ m_mlLUT

const std::vector<std::array<float, 5> >& TrigFTF_GNN_DataStorage::m_mlLUT
protected

Definition at line 104 of file GNN_DataStorage.h.


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