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 80 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 96 of file GNN_DataStorage.cxx.

96 : m_geo(g), m_mlLUT(lut) {
97 m_etaBins.resize(g.num_bins());
98}
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 101 of file GNN_DataStorage.cxx.

101 {
102
103}

Member Function Documentation

◆ generatePhiIndexing()

void TrigFTF_GNN_DataStorage::generatePhiIndexing ( float dphi)

Definition at line 257 of file GNN_DataStorage.cxx.

257 {
258 for(auto& b : m_etaBins) b.generatePhiIndexing(dphi);
259}

◆ getEtaBin()

TrigFTF_GNN_EtaBin & TrigFTF_GNN_DataStorage::getEtaBin ( int idx)
inline

Definition at line 94 of file GNN_DataStorage.h.

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

◆ initializeNodes()

void TrigFTF_GNN_DataStorage::initializeNodes ( bool useML)

Definition at line 183 of file GNN_DataStorage.cxx.

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

105 {
106
107 int nLoaded = 0;
108
109 const TrigFTF_GNN_Layer* pL = m_geo.getTrigFTF_GNN_LayerByIndex(layerIndex);
110
111 if(pL == nullptr) {
112 return -1;
113 }
114
115 bool isBarrel = (pL->m_layer.m_type == 0);
116
117 for(const auto& node : coll) {
118
119 int binIndex = pL->getEtaBin(node.z(), node.r());
120
121 if(binIndex == -1) {
122 continue;
123 }
124
125 if(isBarrel) {
126 m_etaBins.at(binIndex).m_vn.push_back(&node);
127 }
128 else {
129 if (useML) {
130 float cluster_width = node.pixelClusterWidth();
131 if(cluster_width > 0.35) continue;
132 }
133 m_etaBins.at(binIndex).m_vn.push_back(&node);
134 }
135
136 nLoaded++;
137
138 }
139
140 return nLoaded;
141}
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 143 of file GNN_DataStorage.cxx.

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

◆ numberOfNodes()

unsigned int TrigFTF_GNN_DataStorage::numberOfNodes ( ) const

Definition at line 168 of file GNN_DataStorage.cxx.

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

◆ sortByPhi()

void TrigFTF_GNN_DataStorage::sortByPhi ( )

Definition at line 178 of file GNN_DataStorage.cxx.

178 {
179
180 for(auto& b : m_etaBins) b.sortByPhi();
181}

Member Data Documentation

◆ m_etaBins

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

Definition at line 104 of file GNN_DataStorage.h.

◆ m_geo

const TrigFTF_GNN_Geometry& TrigFTF_GNN_DataStorage::m_geo
protected

Definition at line 101 of file GNN_DataStorage.h.

◆ m_mlLUT

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

Definition at line 102 of file GNN_DataStorage.h.


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