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

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

100 {
101
102}

Member Function Documentation

◆ generatePhiIndexing()

void TrigFTF_GNN_DataStorage::generatePhiIndexing ( float dphi)

Definition at line 256 of file GNN_DataStorage.cxx.

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

◆ 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 182 of file GNN_DataStorage.cxx.

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

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

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

◆ numberOfNodes()

unsigned int TrigFTF_GNN_DataStorage::numberOfNodes ( ) const

Definition at line 167 of file GNN_DataStorage.cxx.

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

◆ sortByPhi()

void TrigFTF_GNN_DataStorage::sortByPhi ( )

Definition at line 177 of file GNN_DataStorage.cxx.

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

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: