98 {
99
100
101 struct GBTS_SlidingWindow {
102
103 GBTS_SlidingWindow() : m_first_it(0), m_deltaPhi(0.0), m_has_nodes(false), m_bin(nullptr) {};
104
105 unsigned int m_first_it;
106 float m_deltaPhi;
107 bool m_has_nodes;
108
109 const TrigFTF_GNN_EtaBin* m_bin;
110 };
111
113
114 const float cut_dphi_max =
m_LRTmode ? 0.07f : 0.012f;
115 const float cut_dcurv_max =
m_LRTmode ? 0.015f : 0.001f;
119 const float min_deltaPhi =
m_LRTmode ? 0.01f : 0.001f;
120 const float tau_ratio_precut = 0.009f;
121
122 const float maxOuterRadius =
m_LRTmode ? 1050.0 : 550.0;
123
124 const float cut_zMinU = min_z0 + maxOuterRadius*roi.
dzdrMinus();
125 const float cut_zMaxU = max_z0 + maxOuterRadius*roi.
dzdrPlus();
126
127 constexpr float ptCoeff = 0.29997*1.9972/2.0;
128
129 float tripletPtMin = 0.8f*
m_minPt;
130 const float pt_scale = 900.0f/
m_minPt;
131
132 float maxCurv = ptCoeff/tripletPtMin;
133
134 float maxKappa_high_eta =
m_LRTmode ? 1.0f*maxCurv : std::sqrt(0.8f)*maxCurv;
135 float maxKappa_low_eta =
m_LRTmode ? 1.0f*maxCurv : std::sqrt(0.6f)*maxCurv;
136
138 maxKappa_high_eta = 4.75e-4f*pt_scale;
139 maxKappa_low_eta = 3.75e-4f*pt_scale;
140 }
141
142 const float dphi_coeff =
m_LRTmode ? 1.0f*maxCurv : 0.68f*maxCurv;
143
144 const float minDeltaRadius = 2.0;
145
147
148 unsigned int nConnections = 0;
149
151
152 int nEdges = 0;
153
154 for(
const auto& bg :
m_geo->bin_groups()) {
155
156 TrigFTF_GNN_EtaBin& B1 = storage->getEtaBin(
bg.first);
157
158 if(B1.
empty())
continue;
159
161
163
164
165
166 std::vector<GBTS_SlidingWindow> vSLW;
167
168 vSLW.resize(
bg.second.size());
169
170 int win_idx = 0;
171
172 for(
const auto& b2_idx :
bg.second) {
173
174 const TrigFTF_GNN_EtaBin& B2 = storage->getEtaBin(b2_idx);
175
177 win_idx++;
178 continue;
179 }
180
182
184
186 float abs_dr = std::fabs(rb2-rb1);
188 deltaPhi = min_deltaPhi + dphi_coeff*abs_dr;
189 }
190 else {
191 if(abs_dr < 60.0) {
192 deltaPhi = 0.002f + 4.33e-4f*pt_scale*abs_dr;
193 } else {
194 deltaPhi = 0.015f + 2.2e-4f*pt_scale*abs_dr;
195 }
196 }
197 }
198
199 vSLW[win_idx].m_bin = &B2;
200 vSLW[win_idx].m_has_nodes = true;
201 vSLW[win_idx].m_deltaPhi =
deltaPhi;
202 win_idx++;
203 }
204
205 for(
unsigned int n1Idx = 0;n1Idx<B1.
m_vn.size();n1Idx++) {
206
208
209 unsigned short num_created_edges = 0;
210
211 const std::array<float, 5>& n1pars = B1.
m_params[n1Idx];
212
213 float phi1 = n1pars[2];
214 float r1 = n1pars[3];
215 float z1 = n1pars[4];
216
217 for(unsigned int winIdx = 0; winIdx < vSLW.size(); winIdx++) {
218
219 GBTS_SlidingWindow& slw = vSLW[winIdx];
220
221 if (!slw.m_has_nodes) continue;
222
223 const TrigFTF_GNN_EtaBin& B2 = *slw.m_bin;
224
226
227
228
231
232 for(
unsigned int n2PhiIdx = slw.m_first_it; n2PhiIdx<B2.
m_vPhiNodes.size();n2PhiIdx++) {
233
235
236 if(phi2 < minPhi) {
237 slw.m_first_it = n2PhiIdx;
238 continue;
239 }
240 if(phi2 > maxPhi) break;
241
242 unsigned int n2Idx = B2.
m_vPhiNodes[n2PhiIdx].second;
243
245 unsigned short n2_num_edges = B2.
m_vNumEdges[n2Idx];
246 unsigned int n2_last_edge = n2_first_edge + n2_num_edges;
247
248 const std::array<float, 5>& n2pars = B2.
m_params[n2Idx];
249
250 float r2 = n2pars[3];
251
253
254 if(dr < minDeltaRadius) {
255 continue;
256 }
257
258 float z2 = n2pars[4];
259
260 float dz = z2 - z1;
262 float ftau = std::fabs(tau);
263 if (ftau > 36.0) {
264 continue;
265 }
266
267 if(ftau < n1pars[0]) continue;
268 if(ftau > n1pars[1]) continue;
269
270 if(ftau < n2pars[0]) continue;
271 if(ftau > n2pars[1]) continue;
272
274
275 float z0 = z1 -
r1*tau;
276
277 if(z0 < min_z0 || z0 > max_z0) continue;
278
279 float zouter =
z0 + maxOuterRadius*tau;
280
281 if(zouter < cut_zMinU || zouter > cut_zMaxU) continue;
282 }
283
284 float curv = (phi2-phi1)/dr;
285 float abs_curv = std::abs(curv);
286
287 if(ftau < 4.0) {
288 if(abs_curv > maxKappa_low_eta) {
289 continue;
290 }
291 }
292 else {
293 if(abs_curv > maxKappa_high_eta) {
294 continue;
295 }
296 }
297
298 float exp_eta = std::sqrt(1.f+tau*tau) - tau;
299
301
302 bool isGood = n2_num_edges <= 2;
303
304 if(!isGood) {
305
306 float uat_1 = 1.0f/exp_eta;
307
308 for(unsigned int n2_in_idx = n2_first_edge; n2_in_idx < n2_last_edge; n2_in_idx++) {
309
310 float tau2 = edgeStorage.at(n2_in_idx).m_p[0];
311 float tau_ratio = tau2*uat_1 - 1.0f;
312
313 if(std::fabs(tau_ratio) > tau_ratio_precut){
314 continue;
315 }
316 isGood = true;
317 break;
318 }
319 }
320
321 if(!isGood) {
322 continue;
323 }
324 }
325
326 float dPhi2 = curv*
r2;
327 float dPhi1 = curv*
r1;
328
330
331 edgeStorage.emplace_back(B1.
m_vn[n1Idx], B2.
m_vn[n2Idx], exp_eta, curv, phi1 + dPhi1);
332
333 num_created_edges++;
334
335 int outEdgeIdx = nEdges;
336
337 float uat_2 = 1.f/exp_eta;
338 float Phi2 = phi2 + dPhi2;
339 float curv2 = curv;
340
341 for(unsigned int inEdgeIdx = n2_first_edge; inEdgeIdx < n2_last_edge; inEdgeIdx++) {
342
343 TrigFTF_GNN_Edge* pS = &(edgeStorage.at(inEdgeIdx));
344
346
347 float tau_ratio = pS->
m_p[0]*uat_2 - 1.0f;
348
349 if(std::abs(tau_ratio) > cut_tau_ratio_max){
350 continue;
351 }
352
353 float dPhi = Phi2 - pS->
m_p[2];
354
357
358 if(std::abs(dPhi) > cut_dphi_max) {
359 continue;
360 }
361
362 float dcurv = curv2 - pS->
m_p[1];
363
364 if(dcurv < -cut_dcurv_max || dcurv > cut_dcurv_max) {
365 continue;
366 }
367
369
370 nConnections++;
371
372 }
373 nEdges++;
374 }
375 }
376 }
377
379
380 }
381 }
382
384 ATH_MSG_WARNING(
"Maximum number of graph edges exceeded - possible efficiency loss "<< nEdges);
385 }
386
387 return std::make_pair(nEdges, nConnections);
388}
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_MSG_WARNING(x)
virtual double zedPlus() const =0
the zed and eta values at the most forward and most rear ends of the RoI
virtual double dzdrMinus() const =0
return the gradients
virtual double zedMinus() const =0
virtual double dzdrPlus() const =0
unsigned int m_vNei[N_SEG_CONNS]
std::vector< const TrigFTF_GNN_Node * > m_vn
float getMinBinRadius() const
float getMaxBinRadius() const
std::vector< unsigned int > m_vFirstEdge
std::vector< std::pair< float, unsigned int > > m_vPhiNodes
std::vector< std::array< float, 5 > > m_params
std::vector< unsigned short > m_vNumEdges
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
@ deltaPhi0
difference between the cluster phi (presampler) and the eta of the track extrapolated to the presampl...