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

#include <TrigInDetTrackSeedingTool.h>

Inheritance diagram for TrigInDetTrackSeedingTool:
Collaboration diagram for TrigInDetTrackSeedingTool:

Public Member Functions

 TrigInDetTrackSeedingTool (const std::string &, const std::string &, const IInterface *)
virtual ~TrigInDetTrackSeedingTool ()
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual TrigInDetTrackSeedingResult findSeeds (const IRoiDescriptor &, std::vector< TrigInDetTracklet > &, const EventContext &) const override final
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const
 DeclareInterfaceID (ITrigInDetTrackSeedingTool, 1, 0)

Protected Types

typedef TrigFTF_GNN_Node GNN_Node
typedef TrigFTF_GNN_DataStorage GNN_DataStorage
typedef TrigFTF_GNN_Edge GNN_Edge
typedef TrigFTF_GNNR3_Node GNNR3_Node
typedef TrigFTF_GNNR3_DataStorage GNNR3_DataStorage
typedef TrigFTF_GNNR3_Edge GNNR3_Edge

Protected Member Functions

void createGraphNodes (const SpacePointCollection *, std::vector< GNN_Node > &, std::vector< const Trk::SpacePoint * > &, unsigned short, float, float) const
std::pair< int, int > buildTheGraph (const IRoiDescriptor &, const std::unique_ptr< GNN_DataStorage > &, std::vector< GNN_Edge > &) const
std::pair< int, int > buildTheGraph (const IRoiDescriptor &, const std::unique_ptr< GNNR3_DataStorage > &, std::vector< GNNR3_Edge > &) const
int runCCA (int, std::vector< GNN_Edge > &) const
int runCCA (int, std::vector< GNNR3_Edge > &) const
void extractSeedsFromTheGraph (int, int, int, std::vector< GNN_Edge > &, std::vector< std::pair< float, std::vector< unsigned int > > > &) const
bool check_z0_bitmask (const unsigned short &, const float &, const float &, const float &) const
float estimate_curvature (const std::array< const GNN_Node *, 3 > &) const
bool validate_triplet (std::array< const GNN_Node *, 3 > &, const float min_pt, const float tau_ratio, const float tau_ratio_cut) const
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

SG::ReadCondHandleKey< InDet::BeamSpotDatam_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
BooleanProperty m_usePixelSpacePoints {this, "UsePixelSpacePoints", true}
BooleanProperty m_useSctSpacePoints {this, "UseSctSpacePoints", false}
SG::ReadHandleKey< SpacePointContainerm_sctSpacePointsContainerKey {this, "SCT_SP_ContainerName", "ITkStripTrigSpacePoints"}
SG::ReadHandleKey< SpacePointContainerm_pixelSpacePointsContainerKey {this, "PixelSP_ContainerName", "ITkPixelTrigSpacePoints"}
ToolHandle< IRegSelToolm_regsel_pix { this, "RegSelTool_Pixel", "RegSelTool/RegSelTool_Pixel" }
 region selector tools
ToolHandle< IRegSelToolm_regsel_sct { this, "RegSelTool_SCT", "RegSelTool/RegSelTool_SCT" }
BooleanProperty m_useGPU {this, "UseGPU", false}
ServiceHandle< ITrigInDetAccelerationSvcm_accelSvc {this, "TrigAccelerationSvc", ""}
ToolHandle< ITrigL2LayerNumberToolm_layerNumberTool {this, "layerNumberTool", "TrigL2LayerNumberToolITk"}
const AtlasDetectorIDm_atlasId = nullptr
const SCT_IDm_sctId = nullptr
const PixelIDm_pixelId = nullptr
BooleanProperty m_filter_phi {this, "DoPhiFiltering", true}
BooleanProperty m_useBeamTilt {this, "UseBeamTilt", false}
BooleanProperty m_LRTmode {this, "LRTMode",false}
BooleanProperty m_useML {this, "useML", true}
UnsignedIntegerProperty m_nMaxPhiSlice {this, "nMaxPhiSlice", 53}
BooleanProperty m_doubletFilterRZ {this, "Doublet_FilterRZ", true}
BooleanProperty m_useEtaBinning {this, "UseEtaBinning", true}
BooleanProperty m_matchBeforeCreate {this, "MatchBeforeCreate", true}
FloatProperty m_minPt {this, "pTmin", 1000.0}
FloatProperty m_etaBinOverride {this, "etaBin", 0.0f, "specify non-zero to override eta bin width from connection file (default 0.2 in createLinkingScheme.py)"}
IntegerProperty m_nMaxEdges {this, "MaxGraphEdges", 2000000}
IntegerProperty m_nBufferEdges {this, "BufferEdges", 200000}
StringProperty m_connectionFile {this, "ConnectionFileName", "binTables_ITK_RUN4.txt"}
StringProperty m_lutFile {this, "MLpredictorLutFileName", "gbts_ml_pixel_barrel_loose.lut"}
BooleanProperty m_useGPUseedExtraction {this, "UseGPUseedExtraction", true}
BooleanProperty m_useOldTunings {this, "UseOldTunings", false}
BooleanProperty m_validateTriplets {this, "ValidateTriplets", true}
BooleanProperty m_useAdaptiveCuts {this, "UseAdaptiveCuts", true}
FloatProperty m_tau_ratio_cut {this, "tau_ratio_cut", 0.007}
FloatProperty m_tau_ratio_corr {this, "tau_ratio_correction", 0.006}
FloatProperty m_d0_max {this, "d0_max", 3.0}
float m_phiSliceWidth = 0.
std::unique_ptr< GNN_FasTrackConnectorm_connector = nullptr
std::unique_ptr< GNNR3_FasTrackConnectorm_connector = nullptr
std::vector< TrigInDetSiLayerm_layerGeometry
std::unique_ptr< const TrigFTF_GNN_Geometrym_geo = nullptr
std::unique_ptr< const TrigFTF_GNNR3_Geometrym_geo = nullptr
std::vector< std::array< float, 5 > > m_mlLUT

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Definition at line 37 of file TrigInDetTrackSeedingTool.h.

Member Typedef Documentation

◆ GNN_DataStorage

◆ GNN_Edge

typedef TrigFTF_GNN_Edge SeedingToolBase::GNN_Edge
protectedinherited

Definition at line 37 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

◆ GNN_Node

typedef TrigFTF_GNN_Node SeedingToolBase::GNN_Node
protectedinherited

Definition at line 35 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

◆ GNNR3_DataStorage

◆ GNNR3_Edge

◆ GNNR3_Node

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TrigInDetTrackSeedingTool()

TrigInDetTrackSeedingTool::TrigInDetTrackSeedingTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 27 of file TrigInDetTrackSeedingTool.cxx.

29 : SeedingToolBase(t,n,p)
30{
31
32}
SeedingToolBase(const std::string &t, const std::string &n, const IInterface *p)

◆ ~TrigInDetTrackSeedingTool()

virtual TrigInDetTrackSeedingTool::~TrigInDetTrackSeedingTool ( )
inlinevirtual

Definition at line 42 of file TrigInDetTrackSeedingTool.h.

42{};

Member Function Documentation

◆ buildTheGraph() [1/2]

std::pair< int, int > SeedingToolBase::buildTheGraph ( const IRoiDescriptor & roi,
const std::unique_ptr< GNN_DataStorage > & storage,
std::vector< GNN_Edge > & edgeStorage ) const
protectedinherited

Definition at line 98 of file TrigInDetPattRecoTools/src/SeedingToolBase.cxx.

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;// sliding window position
106 float m_deltaPhi; // window half-width;
107 bool m_has_nodes; // active or not
108
109 const TrigFTF_GNN_EtaBin* m_bin;//associated eta bin
110 };
111
112 constexpr float M_2PI = 2.0*M_PI;
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;
116 const float cut_tau_ratio_max = m_LRTmode ? 0.015f : static_cast<float>(m_tau_ratio_cut);
117 const float min_z0 = m_LRTmode ? -600.0 : roi.zedMinus();
118 const float max_z0 = m_LRTmode ? 600.0 : roi.zedPlus();
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;// ~0.3*B/2 - assuming nominal field of 2*T
128
129 float tripletPtMin = 0.8f*m_minPt;//correction due to limited pT resolution
130 const float pt_scale = 900.0f/m_minPt;//to re-scale original tunings done for the 900 MeV pT cut
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
137 if(!m_useOldTunings && !m_LRTmode) {//new settings for curvature cuts
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
146 float deltaPhi0 = 0.5f*m_phiSliceWidth;//the default sliding window along phi
147
148 unsigned int nConnections = 0;
149
150 edgeStorage.reserve(m_nMaxEdges);
151
152 int nEdges = 0;
153
154 float z0_histo_coeff = 16/(max_z0 - min_z0 + 1e-6);//assuming 16-bit z0 bitmask
155
156 for(const auto& bg : m_geo->bin_groups()) {//loop over bin groups
157
158 TrigFTF_GNN_EtaBin& B1 = storage->getEtaBin(bg.first);
159
160 if(B1.empty()) continue;
161
162 float rb1 = B1.getMinBinRadius();
163
164 const unsigned int lk1 = B1.m_layerKey;
165
166 const bool isBarrel1 = (lk1 / 10000) == 8;
167
168 //prepare a sliding window for each bin2 in the group
169
170 std::vector<GBTS_SlidingWindow> vSLW;
171
172 vSLW.resize(bg.second.size());//initialization using default ctor
173
174 int win_idx = 0;
175
176 for(const auto& b2_idx : bg.second) { //loop over n2 eta-bins in L2 layers
177
178 const TrigFTF_GNN_EtaBin& B2 = storage->getEtaBin(b2_idx);
179
180 if(B2.empty()) {
181 win_idx++;
182 continue;
183 }
184
185 float rb2 = B2.getMaxBinRadius();
186
187 float deltaPhi = deltaPhi0;//the default
188
189 if(m_useEtaBinning) { //override the default window width
190 float abs_dr = std::fabs(rb2-rb1);
191 if (m_useOldTunings) {
192 deltaPhi = min_deltaPhi + dphi_coeff*abs_dr;
193 }
194 else {
195 if(abs_dr < 60.0) {
196 deltaPhi = 0.002f + 4.33e-4f*pt_scale*abs_dr;
197 } else {
198 deltaPhi = 0.015f + 2.2e-4f*pt_scale*abs_dr;
199 }
200 }
201 }
202
203 vSLW[win_idx].m_bin = &B2;
204 vSLW[win_idx].m_has_nodes = true;
205 vSLW[win_idx].m_deltaPhi = deltaPhi;
206 win_idx++;
207 }
208
209 for(unsigned int n1Idx = 0;n1Idx<B1.m_vn.size();n1Idx++) {//in GBTSv3 the outer loop goes over n1 nodes in the Layer 1 bin
210
211 B1.m_vFirstEdge[n1Idx] = nEdges;//initialization using the top watermark of the edge storage
212
213 unsigned short num_created_edges = 0;//the counter for the incoming graph edges created for n1
214
215 bool is_connected = false;
216
217 std::array<unsigned char, 16> z0_histo = {};
218
219 const std::array<float, 5>& n1pars = B1.m_params[n1Idx];
220
221 float phi1 = n1pars[2];
222 float r1 = n1pars[3];
223 float z1 = n1pars[4];
224
225 for(unsigned int winIdx = 0; winIdx < vSLW.size(); winIdx++) {//the intermediate loop over sliding windows
226
227 GBTS_SlidingWindow& slw = vSLW[winIdx];
228
229 if (!slw.m_has_nodes) continue;
230
231 const TrigFTF_GNN_EtaBin& B2 = *slw.m_bin;
232
233 const unsigned int lk2 = B2.m_layerKey;
234
235 const bool isBarrel2 = (lk2 / 10000) == 8;
236
237 float deltaPhi = slw.m_deltaPhi;
238
239 //sliding window phi1 +/- deltaPhi
240
241 float minPhi = phi1 - deltaPhi;
242 float maxPhi = phi1 + deltaPhi;
243
244 for(unsigned int n2PhiIdx = slw.m_first_it; n2PhiIdx<B2.m_vPhiNodes.size();n2PhiIdx++) {//the inner loop over n2 nodes using sliding window
245
246 float phi2 = B2.m_vPhiNodes[n2PhiIdx].first;
247
248 if(phi2 < minPhi) {
249 slw.m_first_it = n2PhiIdx; //update the window position
250 continue;
251 }
252 if(phi2 > maxPhi) break; //break and go to the next window
253
254 unsigned int n2Idx = B2.m_vPhiNodes[n2PhiIdx].second;
255
256 unsigned short node_info = B2.m_vIsConnected[n2Idx];
257
258 if ((lk1 == 80000) && (node_info == 0) ) continue;//skip isolated nodes as their incoming edges lead to nowhere
259
260 unsigned int n2_first_edge = B2.m_vFirstEdge[n2Idx];
261 unsigned short n2_num_edges = B2.m_vNumEdges[n2Idx];
262 unsigned int n2_last_edge = n2_first_edge + n2_num_edges;
263
264 const std::array<float, 5>& n2pars = B2.m_params[n2Idx];
265
266 float r2 = n2pars[3];
267
268 float dr = r2 - r1;
269
270 if(dr < minDeltaRadius) {
271 continue;
272 }
273
274 float z2 = n2pars[4];
275
276 float dz = z2 - z1;
277 float tau = dz/dr;
278 float ftau = std::fabs(tau);
279 if (ftau > 36.0) {
280 continue;
281 }
282
283 if(ftau < n1pars[0]) continue;
284 if(ftau > n1pars[1]) continue;
285
286 if(ftau < n2pars[0]) continue;
287 if(ftau > n2pars[1]) continue;
288
289 float z0 = z1 - r1*tau;
290
291 if (lk1 == 80000) {//check against non-empty z0 histogram
292
293 if ( !check_z0_bitmask(node_info, z0, min_z0, z0_histo_coeff) ) {
294 continue;
295 }
296 }
297
298 if (m_doubletFilterRZ) {
299
300 if(z0 < min_z0 || z0 > max_z0) continue;
301
302 float zouter = z0 + maxOuterRadius*tau;
303
304 if(zouter < cut_zMinU || zouter > cut_zMaxU) continue;
305 }
306
307 float curv = (phi2-phi1)/dr;
308 float abs_curv = std::abs(curv);
309
310 if(ftau < 4.0) {//eta = 2.1
311 if(abs_curv > maxKappa_low_eta) {
312 continue;
313 }
314 }
315 else {
316 if(abs_curv > maxKappa_high_eta) {
317 continue;
318 }
319 }
320
321 float exp_eta = std::sqrt(1.f+tau*tau) - tau;
322
323 if (m_matchBeforeCreate && (lk1 == 80000 || lk1 == 81000) ) {//match edge candidate against edges incoming to n2
324
325 bool isGood = n2_num_edges <= 2;//we must have enough incoming edges to decide
326
327 if(!isGood) {
328
329 float uat_1 = 1.0f/exp_eta;
330
331 for(unsigned int n2_in_idx = n2_first_edge; n2_in_idx < n2_last_edge; n2_in_idx++) {
332
333 float tau2 = edgeStorage.at(n2_in_idx).m_p[0];
334 float tau_ratio = tau2*uat_1 - 1.0f;
335
336 if(std::fabs(tau_ratio) > tau_ratio_precut){//bad match
337 continue;
338 }
339 isGood = true;//good match found
340 break;
341 }
342 }
343
344 if(!isGood) {//no match found, skip creating [n1 <- n2] edge
345 continue;
346 }
347 }
348
349 float dPhi2 = curv*r2;
350 float dPhi1 = curv*r1;
351
352 if(nEdges < m_nMaxEdges) {
353
354 edgeStorage.emplace_back(B1.m_vn[n1Idx], B2.m_vn[n2Idx], exp_eta, curv, phi1 + dPhi1);
355
356 num_created_edges++;
357
358 int outEdgeIdx = nEdges;
359
360 float uat_2 = 1.f/exp_eta;
361 float Phi2 = phi2 + dPhi2;
362 float curv2 = curv;
363
364 for(unsigned int inEdgeIdx = n2_first_edge; inEdgeIdx < n2_last_edge; inEdgeIdx++) {//looking for neighbours of the new edge
365
366 TrigFTF_GNN_Edge* pS = &(edgeStorage.at(inEdgeIdx));
367
368 if(pS->m_nNei >= N_SEG_CONNS) continue;
369
370 const unsigned int lk3 = m_geo->getTrigFTF_GNN_LayerKeyByIndex(pS->m_n2->m_layer);
371
372 const bool isBarrel3 = (lk3 / 10000) == 8;
373
374 float abs_tau_ratio = std::abs(pS->m_p[0]*uat_2 - 1.0f);
375 float add_tau_ratio_corr = 0;
376
377 if (m_useAdaptiveCuts) {
378
379 if (isBarrel1 && isBarrel2 && isBarrel3) {
380 bool no_gap = ((lk3-lk2) == 1000) && ((lk2-lk1) == 1000);
381 if(!no_gap) {
382 add_tau_ratio_corr = m_tau_ratio_corr;//assume more scattering due to the layer in between
383 }
384 }
385 else {
386 bool mixed_triplet = isBarrel1 && isBarrel2 && !isBarrel3;
387 if (mixed_triplet) {
388 add_tau_ratio_corr = m_tau_ratio_corr;
389 }
390 }
391 }
392
393 if(abs_tau_ratio > cut_tau_ratio_max + add_tau_ratio_corr){//bad match
394 continue;
395 }
396
397 float dPhi = Phi2 - pS->m_p[2];
398
399 if(dPhi<-M_PI) dPhi += M_2PI;
400 else if(dPhi>M_PI) dPhi -= M_2PI;
401
402 if(std::abs(dPhi) > cut_dphi_max) {
403 continue;
404 }
405
406 float dcurv = curv2 - pS->m_p[1];
407
408 if(dcurv < -cut_dcurv_max || dcurv > cut_dcurv_max) {
409 continue;
410 }
411
412 //final check: cuts on pT and d0
413
414 if (isBarrel1 && isBarrel2 && isBarrel3) {//Pixel barrel
415
416 std::array<const GNN_Node*, 3> sps = {B1.m_vn[n1Idx], B2.m_vn[n2Idx], pS->m_n2};
417
418 if (!validate_triplet(sps, tripletPtMin, abs_tau_ratio, cut_tau_ratio_max) ) continue;
419
420 }
421
422 pS->m_vNei[pS->m_nNei++] = outEdgeIdx;
423
424 is_connected = true;//there is at least one good match
425
426 //edge confirmed - update z0 histogram
427
428 int z0_bin_index = z0_histo_coeff*(z0 - min_z0);
429
430 ++z0_histo[z0_bin_index];
431
432 nConnections++;
433
434 }
435 nEdges++;
436 }
437 } //loop over n2 (outer) nodes inside a sliding window on n2 bin
438 } //loop over sliding windows associated with n2 bins
439
440 //updating the n1 node attributes
441
442 B1.m_vNumEdges[n1Idx] = num_created_edges;
443
444 if (is_connected) {
445
446 unsigned short z0_bitmask = 0x0;
447
448 for(unsigned int bIdx = 0; bIdx < 16; bIdx++) {
449
450 if (z0_histo[bIdx] == 0) continue;
451
452 z0_bitmask |= (1 << bIdx);
453 }
454
455 B1.m_vIsConnected[n1Idx] = z0_bitmask;//non-zero mask indicates that there is at least one connected edge
456 }
457
458 } //loop over n1 (inner) nodes
459 } //loop over bin groups: a single n1 bin and multiple n2 bins
460
461 if(nEdges >= m_nMaxEdges) {
462 ATH_MSG_WARNING("Maximum number of graph edges exceeded - possible efficiency loss "<< nEdges);
463 }
464
465 return std::make_pair(nEdges, nConnections);
466}
#define M_PI
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
#define ATH_MSG_WARNING(x)
#define M_2PI
#define N_SEG_CONNS
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
bool check_z0_bitmask(const unsigned short &, const float &, const float &, const float &) const
std::unique_ptr< const TrigFTF_GNN_Geometry > m_geo
bool validate_triplet(std::array< const GNN_Node *, 3 > &, const float min_pt, const float tau_ratio, const float tau_ratio_cut) const
unsigned int m_vNei[N_SEG_CONNS]
unsigned char m_nNei
const TrigFTF_GNN_Node * m_n2
std::vector< const TrigFTF_GNN_Node * > m_vn
float getMinBinRadius() const
std::vector< unsigned short > m_vIsConnected
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
unsigned int m_layerKey
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...
unsigned short m_layer

◆ buildTheGraph() [2/2]

std::pair< int, int > SeedingToolBase::buildTheGraph ( const IRoiDescriptor & roi,
const std::unique_ptr< GNNR3_DataStorage > & storage,
std::vector< GNNR3_Edge > & edgeStorage ) const
protectedinherited

Definition at line 71 of file TrigInDetR3PattRecoTools/src/SeedingToolBase.cxx.

71 {
72
73 const float M_2PI = 2.0*M_PI;
74
75 const float cut_dphi_max = m_LRTmode ? 0.07 : 0.012;
76 const float cut_dcurv_max = m_LRTmode ? 0.015 : 0.001;
77 const float cut_tau_ratio_max = m_LRTmode ? 0.015 : 0.007;
78 const float min_z0 = m_LRTmode ? -600.0 : roi.zedMinus();
79 const float max_z0 = m_LRTmode ? 600.0 : roi.zedPlus();
80 const float min_deltaPhi = m_LRTmode ? 0.01f : 0.001f;
81
82 const float maxOuterRadius = m_LRTmode ? 1050.0 : 550.0;
83
84 const float cut_zMinU = min_z0 + maxOuterRadius*roi.dzdrMinus();
85 const float cut_zMaxU = max_z0 + maxOuterRadius*roi.dzdrPlus();
86
87 const float ptCoeff = 0.29997*1.9972/2.0;// ~0.3*B/2 - assuming nominal field of 2*T
88
89 float tripletPtMin = 0.8*m_minPt;//correction due to limited pT resolution
90
91 float maxCurv = ptCoeff/tripletPtMin;
92
93 const float maxKappa_high_eta = m_LRTmode ? 1.0*maxCurv : std::sqrt(0.8)*maxCurv;
94 const float maxKappa_low_eta = m_LRTmode ? 1.0*maxCurv : std::sqrt(0.6)*maxCurv;
95 const float dphi_coeff = m_LRTmode ? 1.0*maxCurv : 0.68*maxCurv;
96
97 const float minDeltaRadius = 2.0;
98
99 float deltaPhi = 0.5f*m_phiSliceWidth;//the default sliding window along phi
100
101 unsigned int nConnections = 0;
102
103 edgeStorage.reserve(m_nMaxEdges);
104
105 int nEdges = 0;
106
107 for(const auto& bg : m_geo->bin_groups()) {//loop over bin groups
108
109 TrigFTF_GNNR3_EtaBin& B1 = storage->getEtaBin(bg.first);
110
111 if(B1.empty()) continue;
112
113 float rb1 = B1.getMinBinRadius();
114
115 for(const auto& b2_idx : bg.second) {
116
117 const TrigFTF_GNNR3_EtaBin& B2 = storage->getEtaBin(b2_idx);
118
119 if(B2.empty()) continue;
120
121 float rb2 = B2.getMaxBinRadius();
122
123 if(m_useEtaBinning) {
124 deltaPhi = min_deltaPhi + dphi_coeff*std::fabs(rb2-rb1);
125 }
126
127 unsigned int first_it = 0;
128
129 for(unsigned int n1Idx = 0;n1Idx<B1.m_vn.size();n1Idx++) {//loop over nodes in Layer 1
130
131 std::vector<unsigned int>& v1In = B1.m_in[n1Idx];
132
133 if(v1In.size() >= MAX_SEG_PER_NODE) continue;
134
135 const std::array<float, 5>& n1pars = B1.m_params[n1Idx];
136
137 float phi1 = n1pars[2];
138 float r1 = n1pars[3];
139 float z1 = n1pars[4];
140
141 //sliding window phi1 +/- deltaPhi
142
143 float minPhi = phi1 - deltaPhi;
144 float maxPhi = phi1 + deltaPhi;
145
146 for(unsigned int n2PhiIdx = first_it; n2PhiIdx<B2.m_vPhiNodes.size();n2PhiIdx++) {//sliding window over nodes in Layer 2
147
148 float phi2 = B2.m_vPhiNodes[n2PhiIdx].first;
149
150 if(phi2 < minPhi) {
151 first_it = n2PhiIdx;
152 continue;
153 }
154 if(phi2 > maxPhi) break;
155
156 unsigned int n2Idx = B2.m_vPhiNodes[n2PhiIdx].second;
157
158 const std::vector<unsigned int>& v2In = B2.m_in[n2Idx];
159
160 if(v2In.size() >= MAX_SEG_PER_NODE) continue;
161
162 const std::array<float, 5>& n2pars = B2.m_params[n2Idx];
163
164 float r2 = n2pars[3];
165
166 float dr = r2 - r1;
167
168 if(dr < minDeltaRadius) {
169 continue;
170 }
171
172 float z2 = n2pars[4];
173
174 float dz = z2 - z1;
175 float tau = dz/dr;
176 float ftau = std::fabs(tau);
177 if (ftau > 36.0) {
178 continue;
179 }
180
181 if(ftau < n1pars[0]) continue;
182 if(ftau > n1pars[1]) continue;
183
184 if(ftau < n2pars[0]) continue;
185 if(ftau > n2pars[1]) continue;
186
187 if (m_doubletFilterRZ) {
188
189 float z0 = z1 - r1*tau;
190
191 if(z0 < min_z0 || z0 > max_z0) continue;
192
193 float zouter = z0 + maxOuterRadius*tau;
194
195 if(zouter < cut_zMinU || zouter > cut_zMaxU) continue;
196 }
197
198 float curv = (phi2-phi1)/dr;
199 float abs_curv = std::abs(curv);
200
201 if(ftau < 4.0) {//eta = 2.1
202 if(abs_curv > maxKappa_low_eta) {
203 continue;
204 }
205 }
206 else {
207 if(abs_curv > maxKappa_high_eta) {
208 continue;
209 }
210 }
211
212 float exp_eta = std::sqrt(1+tau*tau)-tau;
213
214 if (m_matchBeforeCreate) {//match edge candidate against edges incoming to n2
215
216 bool isGood = v2In.size() <= 2;//we must have enough incoming edges to decide
217
218 if(!isGood) {
219
220 float uat_1 = 1.0f/exp_eta;
221
222 for(const auto& n2_in_idx : v2In) {
223
224 float tau2 = edgeStorage.at(n2_in_idx).m_p[0];
225 float tau_ratio = tau2*uat_1 - 1.0f;
226
227 if(std::fabs(tau_ratio) > cut_tau_ratio_max){//bad match
228 continue;
229 }
230 isGood = true;//good match found
231 break;
232 }
233 }
234
235 if(!isGood) {//no match found, skip creating [n1 <- n2] edge
236 continue;
237 }
238 }
239
240 float dPhi2 = curv*r2;
241 float dPhi1 = curv*r1;
242
243 if(nEdges < m_nMaxEdges) {
244
245 edgeStorage.emplace_back(B1.m_vn[n1Idx], B2.m_vn[n2Idx], exp_eta, curv, phi1 + dPhi1);
246
247 if(v1In.size() < MAX_SEG_PER_NODE) v1In.push_back(nEdges);
248
249 int outEdgeIdx = nEdges;
250
251 float uat_2 = 1/exp_eta;
252 float Phi2 = phi2 + dPhi2;
253 float curv2 = curv;
254
255 for(const auto& inEdgeIdx : v2In) {//looking for neighbours of the new edge
256
257 TrigFTF_GNNR3_Edge* pS = &(edgeStorage.at(inEdgeIdx));
258
259 if(pS->m_nNei >= N_SEG_CONNS) continue;
260
261 float tau_ratio = pS->m_p[0]*uat_2 - 1.0f;
262
263 if(std::abs(tau_ratio) > cut_tau_ratio_max){//bad match
264 continue;
265 }
266
267 float dPhi = Phi2 - pS->m_p[2];
268
269 if(dPhi<-M_PI) dPhi += M_2PI;
270 else if(dPhi>M_PI) dPhi -= M_2PI;
271
272 if(dPhi < -cut_dphi_max || dPhi > cut_dphi_max) {
273 continue;
274 }
275
276 float dcurv = curv2 - pS->m_p[1];
277
278 if(dcurv < -cut_dcurv_max || dcurv > cut_dcurv_max) {
279 continue;
280 }
281
282 pS->m_vNei[pS->m_nNei++] = outEdgeIdx;
283
284 nConnections++;
285
286 }
287 nEdges++;
288 }
289 } //loop over n2 (outer) nodes
290 } //loop over n1 (inner) nodes
291 } //loop over bins in Layer 2
292 } //loop over bin groups
293
294 return std::make_pair(nEdges, nConnections);
295}
#define MAX_SEG_PER_NODE
unsigned int m_vNei[N_SEG_CONNS]
float getMaxBinRadius() const
std::vector< std::array< float, 5 > > m_params
float getMinBinRadius() const
std::vector< const TrigFTF_GNNR3_Node * > m_vn
std::vector< std::pair< float, unsigned int > > m_vPhiNodes
std::vector< std::vector< unsigned int > > m_in

◆ check_z0_bitmask()

bool SeedingToolBase::check_z0_bitmask ( const unsigned short & z0_bitmask,
const float & z0,
const float & min_z0,
const float & z0_histo_coeff ) const
protectedinherited

Definition at line 788 of file TrigInDetPattRecoTools/src/SeedingToolBase.cxx.

788 {
789
790 if (z0_bitmask == 0) return true;
791
792 float dz = z0 - min_z0;
793 int z0_bin_index = z0_histo_coeff*dz;
794
795 if ((z0_bitmask >> z0_bin_index) & 1) return true;
796
797 //check adjacent bins as well
798
799 const float z0_resolution = 2.5;
800
801 float dzm = dz - z0_resolution;
802
803 int next_bin = z0_histo_coeff*dzm;
804
805 if (next_bin >= 0 && next_bin != z0_bin_index) {
806
807 if ((z0_bitmask >> next_bin) & 1) return true;
808
809 }
810
811 float dzp = dz + z0_resolution;
812
813 next_bin = z0_histo_coeff*dzp;
814
815 if (next_bin < 16 && next_bin != z0_bin_index) {
816
817 if ((z0_bitmask >> next_bin) & 1) return true;
818
819 }
820
821 return false;
822}

◆ createGraphNodes()

void TrigInDetTrackSeedingTool::createGraphNodes ( const SpacePointCollection * spColl,
std::vector< GNN_Node > & tmpColl,
std::vector< const Trk::SpacePoint * > & vSP,
unsigned short layer,
float shift_x,
float shift_y ) const
protected

Definition at line 580 of file TrigInDetTrackSeedingTool.cxx.

580 {
581
582 tmpColl.resize(spColl->size(), GNN_Node(layer));//all nodes belong to the same layer
583
584 int idx = 0;
585 int init_size = vSP.size();
586 for(const auto sp : *spColl) {
587 const auto& pos = sp->globalPosition();
588 vSP.emplace_back(sp);
589 float xs = pos.x() - shift_x;
590 float ys = pos.y() - shift_y;
591 float zs = pos.z();
592 tmpColl[idx].m_x = xs;
593 tmpColl[idx].m_y = ys;
594 tmpColl[idx].m_z = zs;
595 tmpColl[idx].m_r = std::sqrt(xs*xs + ys*ys);
596 tmpColl[idx].m_phi = std::atan2(ys,xs);
597 tmpColl[idx].m_idx = init_size + idx;
598
599 const InDet::PixelCluster* pCL = dynamic_cast<const InDet::PixelCluster*>(sp->clusterList().first);
600 if(pCL != nullptr){
601 tmpColl[idx].m_pcw = pCL->width().z();
602 tmpColl[idx].m_locPosY = pCL->localPosition().y();
603 }
604
605 idx++;
606 }
607}
static Double_t sp
size_type size() const noexcept
Returns the number of elements in the collection.
const InDet::SiWidth & width() const
return width class reference
double z() const
Definition SiWidth.h:131
const Amg::Vector2D & localPosition() const
return the local position reference

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ DeclareInterfaceID()

ITrigInDetTrackSeedingTool::DeclareInterfaceID ( ITrigInDetTrackSeedingTool ,
1 ,
0  )
inherited

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ estimate_curvature()

float SeedingToolBase::estimate_curvature ( const std::array< const GNN_Node *, 3 > & sps) const
protectedinherited

Definition at line 825 of file TrigInDetPattRecoTools/src/SeedingToolBase.cxx.

825 {
826
827 //conformal mapping with the center at the last spacepoint
828
829 float u[2], v[2];
830
831 float x0 = sps[2]->x();
832 float y0 = sps[2]->y();
833
834 float r0 = sps[2]->r();
835
836 float cosA = x0/r0;
837
838 float sinA = y0/r0;
839
840
841 for(unsigned int k=0;k<2;k++) {
842
843 float dx = sps[k]->x() - x0;
844
845 float dy = sps[k]->y() - y0;
846
847 float r2_inv = 1.0/(dx*dx+dy*dy);
848
849 float xn = dx*cosA + dy*sinA;
850
851 float yn =-dx*sinA + dy*cosA;
852
853 u[k] = xn*r2_inv;
854 v[k] = yn*r2_inv;
855 }
856
857 float du = u[0] - u[1];
858
859 if(du==0.0) return 0.0;
860
861 float A = (v[0] - v[1])/du;
862
863 float B = v[1] - A*u[1];
864
865 return 1000.0*B/std::sqrt(1 + A*A); //inverse meters
866
867}
const double r0
electron radius{cm}
@ u
Enums for curvilinear frames.
Definition ParamDefs.h:77

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extractSeedsFromTheGraph()

void SeedingToolBase::extractSeedsFromTheGraph ( int maxLevel,
int nEdges,
int nHits,
std::vector< GNN_Edge > & edgeStorage,
std::vector< std::pair< float, std::vector< unsigned int > > > & vOutputSeeds ) const
protectedinherited

Definition at line 536 of file TrigInDetPattRecoTools/src/SeedingToolBase.cxx.

536 {
537
538 const float edge_mask_min_eta = 1.5;
539 const float hit_share_threshold = 0.49;
540 const float max_eta_for_seed_split = 0.6;
541 const float max_inv_rad_diff = 0.7e-2;//in inverse meters
542
543 int minLevel = 3;//a triplet + 2 confirmation
544
545 if(m_LRTmode) {
546 minLevel = 2;//a triplet + 1 confirmation
547 }
548
549 if(maxLevel < minLevel) return;
550
551 std::vector<GNN_Edge*> vSeeds;
552
553 vSeeds.reserve(nEdges/2);
554
555 for(int edgeIndex = 0; edgeIndex < nEdges; edgeIndex++) {
556
557 GNN_Edge* pS = &(edgeStorage.at(edgeIndex));
558
559 if(pS->m_level < minLevel) continue;
560
561 vSeeds.push_back(pS);
562 }
563
564 if(vSeeds.empty()) return;
565
566 std::sort(vSeeds.begin(), vSeeds.end(), GNN_Edge::CompareLevel());
567
568 //backtracking
569
570 std::vector<std::tuple<float, int, std::vector<const GNN_Node*>, int > > vSeedCandidates;
571
572 vSeedCandidates.reserve(vSeeds.size());
573
574 std::vector<std::pair<float, unsigned int> > vArgSort;
575
576 vArgSort.reserve(vSeeds.size());
577
578 unsigned int seed_counter = 0;
579
580 auto tFilter = std::make_unique<TrigFTF_GNN_TrackingFilter>(m_layerGeometry, edgeStorage);
581
582 for(auto pS : vSeeds) {
583
584 if(pS->m_level == -1) continue;
585
586 TrigFTF_GNN_EdgeState rs(false);
587
588 tFilter->followTrack(pS, rs);
589
590 if(!rs.m_initialized) {
591 continue;
592 }
593
594 if(static_cast<int>(rs.m_vs.size()) < minLevel) continue;
595
596 float seed_eta = std::abs(-std::log(pS->m_p[0]));
597
598 std::vector<const GNN_Node*> vN;
599
600 for(std::vector<GNN_Edge*>::reverse_iterator sIt=rs.m_vs.rbegin();sIt!=rs.m_vs.rend();++sIt) {
601
602 if (seed_eta > edge_mask_min_eta) {
603 (*sIt)->m_level = -1;//mark as collected
604 }
605
606 if(sIt == rs.m_vs.rbegin()) {
607 vN.push_back((*sIt)->m_n1);
608 }
609
610 vN.push_back((*sIt)->m_n2);
611
612 }
613
614 if(vN.size()<3) continue;
615
616 unsigned int orig_seed_size = vN.size();
617
618 float orig_seed_quality = -rs.m_J/orig_seed_size;
619
620 int seed_split_flag = (seed_eta < max_eta_for_seed_split) && (orig_seed_size > 3) && (orig_seed_size <= 5) ? 1 : 0;
621
622 if (seed_split_flag) {//split the seed by dropping spacepoints
623
624 std::array< std::array<const GNN_Node*, 3>, 3> triplets;//2 "drop-outs" and the original seed candidate
625
626 std::array<float, 3> inv_rads;//triplet parameter estimate
627
628 triplets[0] = {vN[0], vN[orig_seed_size/2], vN[orig_seed_size-1]};
629
630 std::vector<const GNN_Node*> drop_out1 = {vN.begin()+1, vN.end()}; //all but the first one
631
632 triplets[1] = {drop_out1[0], drop_out1[(orig_seed_size-1)/2], drop_out1[orig_seed_size-2]};
633
634 std::vector<const GNN_Node*> drop_out2;
635
636 drop_out2.reserve(orig_seed_size-1);
637
638 for(unsigned int k = 0; k < orig_seed_size; k++) {
639
640 if (k == orig_seed_size/2) continue;//drop the middle SP in the original seed
641
642 drop_out2.emplace_back(vN[k]);
643 }
644
645 triplets[2] = {drop_out2[0], drop_out2[(orig_seed_size-1)/2], drop_out2[orig_seed_size-2]};
646
647 for (unsigned int k = 0; k < inv_rads.size(); k++) {
648
649 inv_rads[k] = estimate_curvature(triplets[k]);
650
651 }
652
653 float diffs[3] = {std::abs(inv_rads[1] - inv_rads[0]), std::abs(inv_rads[2] - inv_rads[0]), std::abs(inv_rads[2] - inv_rads[1])};
654
655 bool confirmed = diffs[0] < max_inv_rad_diff && diffs[1] < max_inv_rad_diff && diffs[2] < max_inv_rad_diff;
656
657 if (confirmed) {
658 seed_split_flag = 0;//reset the flag
659 }
660
661 }
662
663 vSeedCandidates.emplace_back(orig_seed_quality, 0, vN, seed_split_flag);
664
665 vArgSort.emplace_back(orig_seed_quality, seed_counter);
666
667 ++seed_counter;
668
669 }
670
671 //clone removal code goes below ...
672
673 std::sort(vArgSort.begin(), vArgSort.end());
674
675 std::vector<int> H2T(nHits + 1, 0);//hit to track associations
676
677 int trackId = 0;
678
679
680 for(const auto& ags : vArgSort) {
681
682 const auto& seed = vSeedCandidates[ags.second];
683
684 trackId++;
685
686 for(const auto& h : std::get<2>(seed) ) {//loop over spacepoints indices
687
688 unsigned int hit_id = h->sp_idx() + 1;
689
690 int tid = H2T[hit_id];
691
692 if(tid == 0 || tid > trackId) {//unused hit or used by a lesser track
693
694 H2T[hit_id] = trackId;//overwrite
695
696 }
697 }
698 }
699
700 unsigned int trackIdx = 0;
701
702 for(const auto& ags : vArgSort) {
703
704 const auto& seed = std::get<2>(vSeedCandidates[ags.second]);
705
706 int nTotal = seed.size();
707
708 int nOther = 0;
709
710 int trackId = trackIdx + 1;
711
712 ++trackIdx;
713
714 for(const auto& h : seed ) {
715
716 unsigned int hit_id = h->sp_idx() + 1;
717
718 int tid = H2T[hit_id];
719
720 if(tid != trackId) {//taken by a better candidate
721 nOther++;
722 }
723 }
724
725 if (nOther > hit_share_threshold*nTotal) {
726 std::get<1>(vSeedCandidates[ags.second]) = -1;//reject
727 }
728
729 }
730
731 vOutputSeeds.reserve(vSeedCandidates.size());
732
733 //drop the clones and split seeds if need be
734
735 for(const auto& ags : vArgSort) {
736
737 const auto& seed = vSeedCandidates[ags.second];
738
739 if (std::get<1>(seed) != 0) continue;//identified as a clone of a better candidate
740
741 const auto& vN = std::get<2>(seed);
742
743 if (std::get<3>(seed) == 0) {
744
745 //add seed to output
746
747 std::vector<unsigned int> vSpIdx;
748
749 vSpIdx.resize(vN.size());
750
751 for(unsigned int k = 0; k < vSpIdx.size(); k++) {
752 vSpIdx[k] = vN[k]->sp_idx();
753 }
754
755 vOutputSeeds.emplace_back(std::get<0>(seed), vSpIdx);
756
757 continue;
758
759 }
760
761 //seed split into "drop-out" seeds
762
763 unsigned int seedSize = vN.size();
764
765 std::array<std::size_t, 2> indices2drop = {0, seedSize / 2ul};//the first and the middle
766
767 for(const auto& skipIdx : indices2drop) {
768
769 std::vector<unsigned int> new_seed;
770
771 new_seed.reserve(seedSize-1);
772
773 for (unsigned int k = 0; k < seedSize; k++) {
774
775 if (k == skipIdx) continue;
776
777 new_seed.emplace_back(vN[k]->sp_idx());
778 }
779
780 vOutputSeeds.emplace_back(std::get<0>(seed), new_seed);
781
782 }
783
784 }
785
786}
static Double_t rs
static const uint32_t nHits
std::vector< TrigInDetSiLayer > m_layerGeometry
float estimate_curvature(const std::array< const GNN_Node *, 3 > &) const
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode TrigInDetTrackSeedingTool::finalize ( )
overridevirtual

Reimplemented from SeedingToolBase.

Definition at line 68 of file TrigInDetTrackSeedingTool.cxx.

◆ findSeeds()

TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds ( const IRoiDescriptor & internalRoI,
std::vector< TrigInDetTracklet > & output,
const EventContext & ctx ) const
finaloverridevirtual

Implements ITrigInDetTrackSeedingTool.

Definition at line 73 of file TrigInDetTrackSeedingTool.cxx.

73 {
74
75 TrigInDetTrackSeedingResult seedStats;
76
77 output.clear();
78
79 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx };
80 const Amg::Vector3D &vertex = beamSpotHandle->beamPos();
81 float shift_x = vertex.x() - beamSpotHandle->beamTilt(0)*vertex.z();
82 float shift_y = vertex.y() - beamSpotHandle->beamTilt(1)*vertex.z();
83
84 std::unique_ptr<GNN_DataStorage> storage = std::make_unique<GNN_DataStorage>(*m_geo, m_mlLUT);
85
86 int nPixels = 0;
87 int nStrips = 0;
88
89 const SpacePointContainer* sctSpacePointsContainer = nullptr;
90 const SpacePointContainer* pixelSpacePointsContainer = nullptr;
91
92 std::map<short, std::vector<IdentifierHash> > detIdMap;//relates global detector layer ID to constituent detector elements
93
95
96 SG::ReadHandle<SpacePointContainer> sctHandle(m_sctSpacePointsContainerKey, ctx);
97
98 if(!sctHandle.isValid()) {
99 ATH_MSG_WARNING("Invalid Strip Spacepoints handle: "<<sctHandle);
100 return seedStats;
101
102 }
103
104 sctSpacePointsContainer = sctHandle.ptr();
105
106 std::vector<IdentifierHash> listOfSctIds;
107 m_regsel_sct->lookup(ctx)->HashIDList( internalRoI, listOfSctIds );
108
109 const std::vector<short>* h2l = m_layerNumberTool->sctLayers();
110
111 for(const auto& hashId : listOfSctIds) {
112
113 short layerIndex = h2l->at(static_cast<int>(hashId));
114
115 auto it = detIdMap.find(layerIndex);
116 if(it != detIdMap.end()) (*it).second.push_back(hashId);
117 else {
118 std::vector<IdentifierHash> v = {hashId};
119 detIdMap.insert(std::make_pair(layerIndex,v));
120 }
121 }
122 }
123
125
126 SG::ReadHandle<SpacePointContainer> pixHandle(m_pixelSpacePointsContainerKey, ctx);
127
128 if(!pixHandle.isValid()) {
129 ATH_MSG_WARNING("Invalid Pixel Spacepoints handle: "<<pixHandle);
130 return seedStats;
131 }
132
133 pixelSpacePointsContainer = pixHandle.ptr();
134
135 std::vector<IdentifierHash> listOfPixIds;
136
137 m_regsel_pix->lookup(ctx)->HashIDList( internalRoI, listOfPixIds );
138
139 const std::vector<short>* h2l = m_layerNumberTool->pixelLayers();
140
141 for(const auto& hashId : listOfPixIds) {
142
143 short layerIndex = h2l->at(static_cast<int>(hashId));
144
145 auto it = detIdMap.find(layerIndex);
146 if(it != detIdMap.end()) (*it).second.push_back(hashId);
147 else {
148 std::vector<IdentifierHash> v = {hashId};
149 detIdMap.insert(std::make_pair(layerIndex,v));
150 }
151 }
152 }
153
154 if(!m_useGPU) {
155
156 std::unique_ptr<GNN_DataStorage> storage = std::make_unique<GNN_DataStorage>(*m_geo, m_mlLUT);
157
158 std::vector<const Trk::SpacePoint*> vSP;
159
160 vSP.reserve(m_nMaxEdges);
161
162 std::vector<std::vector<GNN_Node> > trigSpStorage[2];
163
164 trigSpStorage[1].resize(m_layerNumberTool->sctLayers()->size());
165
166 trigSpStorage[0].resize(m_layerNumberTool->pixelLayers()->size());
167
168 for(const auto& lColl : detIdMap) {
169
170 short layerIndex = lColl.first;
171
172 int layerKey = m_geo->getTrigFTF_GNN_LayerByIndex(layerIndex)->m_layer.m_subdet;
173
174 bool isPixel = layerKey > 20000;
175
176 auto pCont = isPixel ? pixelSpacePointsContainer : sctSpacePointsContainer;
177
178 int contIdx= isPixel ? 0 : 1;
179
180 int nNewNodes = 0;
181
182 for(const auto& idx : lColl.second) {
183
184 std::vector<GNN_Node>& tmpColl = trigSpStorage[contIdx].at(static_cast<int>(idx));
185
186 auto input_coll = pCont->indexFindPtr(idx);
187
188 if(input_coll == nullptr) continue;
189
190 createGraphNodes(input_coll, tmpColl, vSP, layerIndex, shift_x, shift_y);//TO-DO: if(m_useBeamTilt) SP full transform functor
191
192 nNewNodes += (isPixel) ? storage->loadPixelGraphNodes(layerIndex, tmpColl, m_useML) : storage->loadStripGraphNodes(layerIndex, tmpColl);
193 }
194
195 if(isPixel) nPixels += nNewNodes;
196 else nStrips += nNewNodes;
197 }
198
199 seedStats.m_nPixelSPs = nPixels;
200 seedStats.m_nStripSPs = nStrips;
201
202 storage->sortByPhi();
203 storage->initializeNodes(m_useML);
204 storage->generatePhiIndexing(1.5*m_phiSliceWidth);
205
206 std::vector<GNN_Edge> edgeStorage;
207
208 std::pair<int, int> graphStats = buildTheGraph(internalRoI, storage, edgeStorage);
209
210 ATH_MSG_DEBUG("Created graph with "<<graphStats.first<<" edges and "<<graphStats.second<< " edge links");
211
212 seedStats.m_nGraphEdges = graphStats.first;
213 seedStats.m_nEdgeLinks = graphStats.second;
214
215 if (graphStats.second == 0) return seedStats;
216
217 int maxLevel = runCCA(graphStats.first, edgeStorage);
218
219 ATH_MSG_DEBUG("Reached Level "<<maxLevel<<" after GNN iterations");
220
221 std::vector<std::pair<float, std::vector<unsigned int> > > vSeedCandidates;
222
223 extractSeedsFromTheGraph(maxLevel, graphStats.first, vSP.size(), edgeStorage, vSeedCandidates);
224
225 if (vSeedCandidates.empty()) return seedStats;
226
227 for(const auto& seed : vSeedCandidates) {
228
229 unsigned int lastIdx = output.size();
230 output.emplace_back(seed.first);
231
232 for(const auto& sp_idx : seed.second) {
233 output[lastIdx].addSpacePoint(vSP[sp_idx]);
234 }
235 }
236
237 ATH_MSG_DEBUG("Found "<<output.size()<<" tracklets");
238 }
239 else {//GPU-accelerated graph building
240 //1. data export
241
242 std::vector<const Trk::SpacePoint*> vSP;
243 std::vector<short> vL;
244
247
248 std::unique_ptr<TrigAccel::DATA_EXPORT_BUFFER> dataBuffer = std::unique_ptr<TrigAccel::DATA_EXPORT_BUFFER>(new TrigAccel::DATA_EXPORT_BUFFER(5000));
249
250 size_t dataTypeSize = sizeof(TrigAccel::ITk::GRAPH_MAKING_INPUT_DATA);
251 const size_t bufferOffset = 256;
252 size_t totalSize = bufferOffset+dataTypeSize;//make room for the header
253 if(!dataBuffer->fit(totalSize)) dataBuffer->reallocate(totalSize);
254
255 TrigAccel::ITk::GRAPH_MAKING_INPUT_DATA* pJobData = reinterpret_cast<TrigAccel::ITk::GRAPH_MAKING_INPUT_DATA*>(dataBuffer->m_buffer + bufferOffset);
256
257 unsigned int spIdx = 0;
258 int sp_offset = 0;
259 int nLayers = 0;
260 int MaxEtaBin = 0;
261 int nEtaBins = 0;
262
263 for(const auto& lColl : detIdMap) {
264
265 short layerIndex = lColl.first;
266
267 const TrigFTF_GNN_Layer* pL = m_geo->getTrigFTF_GNN_LayerByIndex(layerIndex);
268
269 int layerKey = pL->m_layer.m_subdet;
270
271 bool isPixel = layerKey > 20000;
272 bool isBarrel = (pL->m_layer.m_type == 0);
273
274 auto pCont = isPixel ? pixelSpacePointsContainer : sctSpacePointsContainer;
275
276 pJobData->m_layerIdx[nLayers] = layerIndex;
277
278 pJobData->m_layerInfo[4*nLayers ] = spIdx;//layerInfo.x
279 pJobData->m_layerInfo[4*nLayers + 2] = pL->num_bins();//layerInfo.z
280 pJobData->m_layerInfo[4*nLayers + 3] = pL->m_bins[0];//layerInfo.w
281
282 pJobData->m_layerGeo[2*nLayers ] = pL->m_minEta;//layerGeo.x
283 pJobData->m_layerGeo[2*nLayers + 1] = pL->m_etaBin;//layerGeo.y
284
285 nEtaBins += pL->m_bins.size();
286
287 for(auto b : pL->m_bins) {
288 if(b > MaxEtaBin) MaxEtaBin = b;
289 }
290
291 for(const auto& idx : lColl.second) {
292
293 auto input_coll = pCont->indexFindPtr(idx);
294
295 if(input_coll == nullptr) continue;
296
297 for(const auto sp : *input_coll) {
298
299 float cw = -1.0;
300
301 const InDet::PixelCluster* pCL = dynamic_cast<const InDet::PixelCluster*>(sp->clusterList().first);
302 if(pCL != nullptr) {
303 cw = pCL->width().widthPhiRZ().y();
304 if(!isBarrel && m_useML) {
305 if(cw > 0.2) continue;
306 cw = -1.0;//set it to -1 so that it can be skipped later in the ML code on GPU
307 }
308 }
309
310 vSP.emplace_back(sp);
311 vL.emplace_back(layerIndex);
312
313 const auto& p = sp->globalPosition();
314
315 float params[4] = {(float)(p.x() - shift_x), float(p.y() - shift_y), (float)(p.z()), cw};
316
317 memcpy(&pJobData->m_params[sp_offset], &params[0], sizeof(params));
318
319 sp_offset += 4;
320 spIdx++;
322 }
324 }
325
326 pJobData->m_layerInfo[4*nLayers + 1] = spIdx;//layerInfo.y
327
328 if (isPixel) nPixels += spIdx - pJobData->m_layerInfo[4*nLayers];
329 else nStrips += spIdx - pJobData->m_layerInfo[4*nLayers];
330
331 nLayers++;
332 }
333
334 if(spIdx == 0) return seedStats;
335
336 pJobData->m_nSpacepoints = spIdx;
337 pJobData->m_nLayers = nLayers;
338 pJobData->m_nEtaBins = nEtaBins;
339 pJobData->m_maxEtaBin = MaxEtaBin;
340 pJobData->m_nMaxEdges = static_cast<unsigned int>(7*spIdx);
341
342 //load bin pairs
343
344 int pairIdx = 0;
345
346 for(const auto& bg : m_geo->bin_groups()) {//loop over bin groups
347
348 int bin1_idx = bg.first;
349
350 for(const auto& bin2_idx : bg.second) {
351 pJobData->m_bin_pairs[2*pairIdx ] = bin1_idx;
352 pJobData->m_bin_pairs[2*pairIdx+1] = bin2_idx;
353 pairIdx++;
354 }
355 }
356
357 pJobData->m_nBinPairs = pairIdx;
358
359 //add algorithm parameters
360
361 const float ptCoeff = 0.29997*1.9972/2.0;// ~0.3*B/2 - assuming nominal field of 2*T
362
363 float tripletPtMin = 0.8*m_minPt;//correction due to limited pT resolution
364
365 float maxCurv = ptCoeff/tripletPtMin;
366
367 const float pt_scale = 900/m_minPt;
368
369 const float min_deltaPhi_low_dr = 0.002*pt_scale;
370 const float dphi_coeff_low_dr = 4.33e-4*pt_scale;
371 const float min_deltaPhi = 0.015*pt_scale;
372 const float dphi_coeff = 2.2e-4*pt_scale;
373
374 const float cut_dphi_max = m_LRTmode ? 0.07 : 0.012;
375 const float cut_dcurv_max = m_LRTmode ? 0.015 : 0.001;
376 const float cut_tau_ratio_max = m_LRTmode ? 0.015f : 0.01;
377 const float min_z0 = m_LRTmode ? -600.0 : internalRoI.zedMinus();
378 const float max_z0 = m_LRTmode ? 600.0 : internalRoI.zedPlus();
379
380 const float maxOuterRadius = m_LRTmode ? 1050.0 : 550.0;
381 const float minDeltaRadius = 2.0;
382
383 const float cut_zMinU = min_z0 + maxOuterRadius*internalRoI.dzdrMinus();
384 const float cut_zMaxU = max_z0 + maxOuterRadius*internalRoI.dzdrPlus();
385
386 const float maxKappa = m_LRTmode ? 1.0*maxCurv : 0.9*maxCurv;
387
388 pJobData->m_algo_params[0] = min_deltaPhi;
389 pJobData->m_algo_params[1] = dphi_coeff;
390 pJobData->m_algo_params[2] = min_deltaPhi_low_dr;
391 pJobData->m_algo_params[3] = dphi_coeff_low_dr;
392 pJobData->m_algo_params[4] = minDeltaRadius;
393 pJobData->m_algo_params[5] = min_z0;
394 pJobData->m_algo_params[6] = max_z0;
395 pJobData->m_algo_params[7] = maxOuterRadius;
396 pJobData->m_algo_params[8] = cut_zMinU;
397 pJobData->m_algo_params[9] = cut_zMaxU;
398 pJobData->m_algo_params[10] = maxKappa;
399 pJobData->m_algo_params[11] = cut_dphi_max;
400 pJobData->m_algo_params[12] = cut_dcurv_max;
401 pJobData->m_algo_params[13] = cut_tau_ratio_max;
402
403 int minLevel = 3;//a triplet + 1 confirmation
404
405 if(m_LRTmode) {
406 minLevel = 2;//a triplet
407 }
408
409 pJobData->m_minLevel = minLevel;
410
412
413 seedStats.m_nPixelSPs = nPixels;
414 seedStats.m_nStripSPs = nStrips;
415
416 ATH_MSG_DEBUG("Loaded "<<nPixels<< " Pixel Spacepoints and "<<nStrips<< " Strip SpacePoints");
417
418 std::shared_ptr<TrigAccel::OffloadBuffer> pBuff = std::make_shared<TrigAccel::OffloadBuffer>(dataBuffer.get());
419
420 std::unique_ptr<TrigAccel::Work> pWork = std::unique_ptr<TrigAccel::Work>(m_accelSvc->createWork(TrigAccel::InDetJobControlCode::RUN_GBTS, pBuff));
421
422 if(!pWork) {
423 ATH_MSG_WARNING("Failed to create a work item for task "<<TrigAccel::InDetJobControlCode::RUN_GBTS);
424 return seedStats;
425 }
426
427 bool workSuccess = pWork->run();
428 if(!workSuccess) {
429 ATH_MSG_WARNING("Work item failed to complete");
430 return seedStats;
431 }
432
433 std::shared_ptr<TrigAccel::OffloadBuffer> pOutput = pWork->getOutput();
434
435 TrigAccel::ITk::GRAPH_AND_SEEDS_OUTPUT* pGraphAndSeeds = reinterpret_cast<TrigAccel::ITk::GRAPH_AND_SEEDS_OUTPUT*>(pOutput->m_rawBuffer);
436 TrigAccel::ITk::COMPRESSED_GRAPH* pGraph = &pGraphAndSeeds->m_CompressedGraph;
437 TrigAccel::ITk::OUTPUT_SEEDS* pSeeds = &pGraphAndSeeds->m_OutputSeeds;
438
440 if(pSeeds->m_nSeeds == 0) return seedStats;
441 //converting tracklet into GBTS-CPU format
442 for(unsigned int seed=0; seed<pSeeds->m_nSeeds; seed++) {
443
444 unsigned int lastIdx = output.size();
445 output.emplace_back(pSeeds->m_seedsArray[seed].m_Q);
446 for(int node=0; node<pSeeds->m_seedsArray[seed].m_size; node++) {
447 output[lastIdx].addSpacePoint(vSP[pSeeds->m_seedsArray[seed].m_nodes[node]]);
448 }
449 }
450 }
451 else {
452
453 unsigned int nEdges = pGraph->m_nEdges;
454 unsigned int nMaxNei = pGraph->m_nMaxNeighbours;
455
456 //populating the edgeStorage
457
458 std::vector<GNN_Node> nodes;
459
460 nodes.reserve(vSP.size());
461
462 for(unsigned int idx = 0;idx < vSP.size(); idx++) {
463
464 nodes.emplace_back(vL[idx]);
465
466 const auto& pos = vSP[idx]->globalPosition();
467 float xs = pos.x() - shift_x;
468 float ys = pos.y() - shift_y;
469 float zs = pos.z();
470
471 nodes[idx].m_x = xs;
472 nodes[idx].m_y = ys;
473 nodes[idx].m_z = zs;
474 nodes[idx].m_r = std::sqrt(xs*xs + ys*ys);
475
476 nodes[idx].m_idx = idx;
477
478 }
479
480 std::vector<GNN_Edge> edgeStorage;
481
482 std::pair<int, int> graphStats(0,0);
483
484 edgeStorage.resize(nEdges);
485
486 unsigned int edgeSize = nMaxNei + 1 + 2;//neigbours, num_neighbours, 2 nodes
487
488 for(unsigned int idx=0;idx<nEdges;idx++) {
489 unsigned int pos = idx*edgeSize;
490
491 int node1Idx = pGraph->m_graphArray[pos + TrigAccel::ITk::node1];
492 int node2Idx = pGraph->m_graphArray[pos + TrigAccel::ITk::node2];
493 int nNei = pGraph->m_graphArray[pos + TrigAccel::ITk::nNei];
494
495 if(nNei > N_SEG_CONNS) nNei = N_SEG_CONNS;
496
497 edgeStorage[idx].m_n1 = &nodes[node1Idx];
498 edgeStorage[idx].m_n2 = &nodes[node2Idx];
499 edgeStorage[idx].m_level = 1;
500 edgeStorage[idx].m_nNei = nNei;
501 for(int k=0;k<nNei;k++) {
502 edgeStorage[idx].m_vNei[k] = pGraph->m_graphArray[pos + TrigAccel::ITk::nei_idx_start + k];
503 }
504 }
505
506 graphStats.first = nEdges;
507 graphStats.second = pGraph->m_nLinks;
508
509 //run the rest of the GBTS workflow
510
511 int maxLevel = runCCA(graphStats.first, edgeStorage);
512
513 ATH_MSG_DEBUG("Reached Level "<<maxLevel<<" after GNN iterations");
514
515 if(maxLevel < minLevel) return seedStats;
516
517 std::vector<GNN_Edge*> vSeeds;
518
519 vSeeds.reserve(graphStats.first/2);
520
521 for(int edgeIndex=0;edgeIndex<graphStats.first;edgeIndex++) {
522 GNN_Edge* pS = &(edgeStorage.at(edgeIndex));
523
524 if(pS->m_level < minLevel) continue;
525
526 vSeeds.push_back(pS);
527 }
528
529 if(vSeeds.empty()) return seedStats;
530
531 std::sort(vSeeds.begin(), vSeeds.end(), GNN_Edge::CompareLevel());
532
533 //backtracking
534
535 TrigFTF_GNN_TrackingFilter tFilter(m_layerGeometry, edgeStorage);
536
537 output.reserve(vSeeds.size());
538
539 for(auto pS : vSeeds) {
540
541 if(pS->m_level == -1) continue;
542
543 TrigFTF_GNN_EdgeState rs(false);
544
545 tFilter.followTrack(pS, rs);
546
547 if(!rs.m_initialized) {
548 continue;
549 }
550
551 if(static_cast<int>(rs.m_vs.size()) < minLevel) continue;
552
553 std::vector<const GNN_Node*> vN;
554
555 for(std::vector<GNN_Edge*>::reverse_iterator sIt=rs.m_vs.rbegin();sIt!=rs.m_vs.rend();++sIt) {
556
557 (*sIt)->m_level = -1;//mark as collected
558
559 if(sIt == rs.m_vs.rbegin()) {
560 vN.push_back((*sIt)->m_n1);
561 }
562 vN.push_back((*sIt)->m_n2);
563 }
564
565 if(vN.size()<3) continue;
566
567 unsigned int lastIdx = output.size();
568 output.emplace_back(rs.m_J);
569
570 for(const auto& n : vN) {
571 output[lastIdx].addSpacePoint(vSP[n->m_idx]);
572 }
573 }
574 }
575 ATH_MSG_DEBUG("Found "<<output.size()<<" tracklets");
576 }
577 return seedStats;
578}
#define ATH_MSG_DEBUG(x)
static unsigned int totalSize(const MultiDimArray< T, N > &ht)
const Amg::Vector2D & widthPhiRZ() const
Definition SiWidth.h:121
int runCCA(int, std::vector< GNN_Edge > &) const
ToolHandle< ITrigL2LayerNumberTool > m_layerNumberTool
std::vector< std::array< float, 5 > > m_mlLUT
void extractSeedsFromTheGraph(int, int, int, std::vector< GNN_Edge > &, std::vector< std::pair< float, std::vector< unsigned int > > > &) const
std::pair< int, int > buildTheGraph(const IRoiDescriptor &, const std::unique_ptr< GNN_DataStorage > &, std::vector< GNN_Edge > &) const
const TrigInDetSiLayer & m_layer
std::vector< int > m_bins
int num_bins() const
void createGraphNodes(const SpacePointCollection *, std::vector< GNN_Node > &, std::vector< const Trk::SpacePoint * > &, unsigned short, float, float) const
SG::ReadHandleKey< SpacePointContainer > m_pixelSpacePointsContainerKey
SG::ReadHandleKey< SpacePointContainer > m_sctSpacePointsContainerKey
ToolHandle< IRegSelTool > m_regsel_sct
ToolHandle< IRegSelTool > m_regsel_pix
region selector tools
ServiceHandle< ITrigInDetAccelerationSvc > m_accelSvc
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Eigen::Matrix< double, 3, 1 > Vector3D
int nStrips(const MuonGM::TgcReadoutElement &readoutEle, int layer)
constexpr unsigned nEtaBins
struct TrigAccel::ITk::GraphMakingInputData GRAPH_MAKING_INPUT_DATA
static constexpr unsigned int GBTS_MAX_NUMBER_SPACEPOINTS
static constexpr unsigned char nNei
static constexpr unsigned char node1
static constexpr unsigned char node2
struct TrigAccel::ITk::OutputSeeds OUTPUT_SEEDS
struct TrigAccel::ITk::GraphAndSeedsOutput GRAPH_AND_SEEDS_OUTPUT
static constexpr unsigned char nei_idx_start
struct TrigAccel::ITk::CompressedGraph COMPRESSED_GRAPH
struct TrigAccel::DataExportBuffer DATA_EXPORT_BUFFER
output
Definition merge.py:16
SpacePointContainer_v1 SpacePointContainer
Define the version of the space point container.
std::unique_ptr< int[]> m_graphArray
int m_bin_pairs[2 *GBTS_MAX_ETA_BIN_PAIR]
int m_layerInfo[4 *GBTS_MAX_SILICON_LAYERS]
float m_layerGeo[2 *GBTS_MAX_SILICON_LAYERS]
int m_layerIdx[GBTS_MAX_SILICON_LAYERS]
float m_params[4 *GBTS_MAX_NUMBER_SPACEPOINTS]
std::unique_ptr< Tracklet[]> m_seedsArray

◆ initialize()

StatusCode TrigInDetTrackSeedingTool::initialize ( )
overridevirtual

Reimplemented from SeedingToolBase.

Definition at line 34 of file TrigInDetTrackSeedingTool.cxx.

34 {
35
37
38 ATH_CHECK(m_regsel_pix.retrieve());
39 ATH_CHECK(m_regsel_sct.retrieve());
40
41 ATH_CHECK(m_beamSpotKey.initialize());
42
43 if(m_useGPU) {//for GPU offloading
44 ATH_CHECK(m_accelSvc.retrieve());
45 ATH_CHECK(m_accelSvc->isReady());
46 }
47
49 ATH_MSG_FATAL("Both usePixelSpacePoints and useSctSpacePoints set to False. At least one needs to be True");
50 return StatusCode::FAILURE;
51 }
52
53 if (!m_useSctSpacePoints) ATH_MSG_INFO("Only using Pixel spacepoints => Pixel seeds only");
54
55 if (!m_usePixelSpacePoints) ATH_MSG_INFO("Only using SCT spacepoints => Strip seeds only");
56
57 if (m_usePixelSpacePoints && m_useSctSpacePoints) ATH_MSG_INFO("Using SCT and Pixel spacepoints");
58
60
62
63 ATH_MSG_INFO("TrigInDetTrackSeedingTool initialized with " << m_useGPU);
64
65 return StatusCode::SUCCESS;
66}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ runCCA() [1/2]

int SeedingToolBase::runCCA ( int nEdges,
std::vector< GNN_Edge > & edgeStorage ) const
protectedinherited

Definition at line 468 of file TrigInDetPattRecoTools/src/SeedingToolBase.cxx.

468 {
469
470 constexpr int maxIter = 15;
471
472 int maxLevel = 0;
473
474 int iter = 0;
475
476 std::vector<TrigFTF_GNN_Edge*> v_old;
477
478 for(int edgeIndex=0;edgeIndex<nEdges;edgeIndex++) {
479
480 TrigFTF_GNN_Edge* pS = &(edgeStorage[edgeIndex]);
481 if(pS->m_nNei == 0) continue;
482
483 v_old.push_back(pS);//TO-DO: increment level for segments as they already have at least one neighbour
484 }
485
486 std::vector<TrigFTF_GNN_Edge*> v_new;
487 v_new.reserve(v_old.size());
488
489 for(;iter<maxIter;iter++) {
490
491 //generate proposals
492 v_new.clear();
493
494 for(auto pS : v_old) {
495
496 int next_level = pS->m_level;
497
498 for(int nIdx=0;nIdx<pS->m_nNei;nIdx++) {
499
500 unsigned int nextEdgeIdx = pS->m_vNei[nIdx];
501
502 TrigFTF_GNN_Edge* pN = &(edgeStorage[nextEdgeIdx]);
503
504 if(pS->m_level == pN->m_level) {
505 next_level = pS->m_level + 1;
506 v_new.push_back(pS);
507 break;
508 }
509 }
510
511 pS->m_next = next_level;//proposal
512 }
513
514 //update
515
516 int nChanges = 0;
517
518 for(auto pS : v_new) {
519 if(pS->m_next != pS->m_level) {
520 nChanges++;
521 pS->m_level = pS->m_next;
522 if(maxLevel < pS->m_level) maxLevel = pS->m_level;
523 }
524 }
525
526 if(nChanges == 0) break;
527
528
529 v_old.swap(v_new);
530 v_new.clear();
531 }
532
533 return maxLevel;
534}

◆ runCCA() [2/2]

int SeedingToolBase::runCCA ( int nEdges,
std::vector< GNNR3_Edge > & edgeStorage ) const
protectedinherited

Definition at line 297 of file TrigInDetR3PattRecoTools/src/SeedingToolBase.cxx.

297 {
298
299 const int maxIter = 15;
300
301 int maxLevel = 0;
302
303 int iter = 0;
304
305 std::vector<TrigFTF_GNNR3_Edge*> v_old;
306
307 for(int edgeIndex=0;edgeIndex<nEdges;edgeIndex++) {
308
309 TrigFTF_GNNR3_Edge* pS = &(edgeStorage[edgeIndex]);
310 if(pS->m_nNei == 0) continue;
311
312 v_old.push_back(pS);//TO-DO: increment level for segments as they already have at least one neighbour
313 }
314
315 for(;iter<maxIter;iter++) {
316
317 //generate proposals
318 std::vector<TrigFTF_GNNR3_Edge*> v_new;
319 v_new.clear();
320 v_new.reserve(v_old.size());
321
322 for(auto pS : v_old) {
323
324 int next_level = pS->m_level;
325
326 for(int nIdx=0;nIdx<pS->m_nNei;nIdx++) {
327
328 unsigned int nextEdgeIdx = pS->m_vNei[nIdx];
329
330 TrigFTF_GNNR3_Edge* pN = &(edgeStorage[nextEdgeIdx]);
331
332 if(pS->m_level == pN->m_level) {
333 next_level = pS->m_level + 1;
334 v_new.push_back(pS);
335 break;
336 }
337 }
338
339 pS->m_next = next_level;//proposal
340 }
341
342 //update
343
344 int nChanges = 0;
345
346 for(auto pS : v_new) {
347 if(pS->m_next != pS->m_level) {
348 nChanges++;
349 pS->m_level = pS->m_next;
350 if(maxLevel < pS->m_level) maxLevel = pS->m_level;
351 }
352 }
353
354 if(nChanges == 0) break;
355
356
357 v_old = std::move(v_new);
358 v_new.clear();
359 }
360
361 return maxLevel;
362}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

◆ validate_triplet()

bool SeedingToolBase::validate_triplet ( std::array< const GNN_Node *, 3 > & sps,
const float min_pt,
const float tau_ratio,
const float tau_ratio_cut ) const
protectedinherited

Definition at line 869 of file TrigInDetPattRecoTools/src/SeedingToolBase.cxx.

869 {
870
871 //conformal mapping with the center at the middle spacepoint
872
873 float u[2], v[2];
874
875 const float x0 = sps[1]->x();
876 const float y0 = sps[1]->y();
877
878 const float r0 = sps[1]->r();
879
880 const float cosA = x0/r0;
881
882 const float sinA = y0/r0;
883
884 for(unsigned int k=0;k<2;k++) {
885
886 int sp_idx = (k==1) ? 2 : k;
887
888 const float dx = sps[sp_idx]->x() - x0;
889
890 const float dy = sps[sp_idx]->y() - y0;
891
892 const float r2_inv = 1.0/(dx*dx+dy*dy);
893
894 const float xn = dx*cosA + dy*sinA;
895
896 const float yn =-dx*sinA + dy*cosA;
897
898 u[k] = xn*r2_inv;
899 v[k] = yn*r2_inv;
900 }
901
902 const float du = u[0] - u[1];
903
904 if ( du == 0.0 ) return false;
905
906 const float A = (v[0] - v[1])/du;
907
908 const float B = v[1] - A*u[1];
909
910 const float d0 = r0*(B*r0 - A);
911
912 if (std::abs(d0) > m_d0_max) return false;
913
914 if (B != 0.0) {//straight-line track is OK
915
916 const float R = std::sqrt(1 + A*A)/B; //signed radius in mm
917
918 const float pT = std::abs(0.3*R); //asssuming uniform 2T field
919
920 if (pT < min_pT) return false;
921
922 if (pT > 5*min_pT) {//relatively high-pT track
923
924 if (tau_ratio > 0.9*tau_ratio_cut) return false;
925
926 }
927
928 }
929
930 return true;
931
932}
double R(const INavigable4Momentum *p1, const double v_eta, const double v_phi)

Member Data Documentation

◆ m_accelSvc

ServiceHandle<ITrigInDetAccelerationSvc> TrigInDetTrackSeedingTool::m_accelSvc {this, "TrigAccelerationSvc", ""}
protected

Definition at line 72 of file TrigInDetTrackSeedingTool.h.

72{this, "TrigAccelerationSvc", ""};

◆ m_atlasId

const AtlasDetectorID * SeedingToolBase::m_atlasId = nullptr
protectedinherited

Definition at line 56 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

◆ m_beamSpotKey

SG::ReadCondHandleKey<InDet::BeamSpotData> TrigInDetTrackSeedingTool::m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
protected

Definition at line 55 of file TrigInDetTrackSeedingTool.h.

55{ this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };

◆ m_connectionFile

StringProperty SeedingToolBase::m_connectionFile {this, "ConnectionFileName", "binTables_ITK_RUN4.txt"}
protectedinherited

Definition at line 73 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

73{this, "ConnectionFileName", "binTables_ITK_RUN4.txt"};

◆ m_connector [1/2]

std::unique_ptr<GNN_FasTrackConnector> SeedingToolBase::m_connector = nullptr
protectedinherited

Definition at line 88 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

◆ m_connector [2/2]

std::unique_ptr<GNNR3_FasTrackConnector> SeedingToolBase::m_connector = nullptr
protectedinherited

◆ m_d0_max

FloatProperty SeedingToolBase::m_d0_max {this, "d0_max", 3.0}
protectedinherited

Definition at line 84 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

84{this, "d0_max", 3.0};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doubletFilterRZ

BooleanProperty SeedingToolBase::m_doubletFilterRZ {this, "Doublet_FilterRZ", true}
protectedinherited

Definition at line 66 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

66{this, "Doublet_FilterRZ", true};

◆ m_etaBinOverride

FloatProperty SeedingToolBase::m_etaBinOverride {this, "etaBin", 0.0f, "specify non-zero to override eta bin width from connection file (default 0.2 in createLinkingScheme.py)"}
protectedinherited

Definition at line 70 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

70{this, "etaBin", 0.0f, "specify non-zero to override eta bin width from connection file (default 0.2 in createLinkingScheme.py)"};

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_filter_phi

BooleanProperty SeedingToolBase::m_filter_phi {this, "DoPhiFiltering", true}
protectedinherited

Definition at line 60 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

60{this, "DoPhiFiltering", true};

◆ m_geo [1/2]

std::unique_ptr<const TrigFTF_GNN_Geometry> SeedingToolBase::m_geo = nullptr
protectedinherited

Definition at line 90 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

◆ m_geo [2/2]

std::unique_ptr<const TrigFTF_GNNR3_Geometry> SeedingToolBase::m_geo = nullptr
protectedinherited

◆ m_layerGeometry

std::vector< TrigInDetSiLayer > SeedingToolBase::m_layerGeometry
protectedinherited

Definition at line 89 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

◆ m_layerNumberTool

ToolHandle< ITrigL2LayerNumberTool > SeedingToolBase::m_layerNumberTool {this, "layerNumberTool", "TrigL2LayerNumberToolITk"}
protectedinherited

Definition at line 54 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

54{this, "layerNumberTool", "TrigL2LayerNumberToolITk"};

◆ m_LRTmode

BooleanProperty SeedingToolBase::m_LRTmode {this, "LRTMode",false}
protectedinherited

Definition at line 62 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

62{this, "LRTMode",false};

◆ m_lutFile

StringProperty SeedingToolBase::m_lutFile {this, "MLpredictorLutFileName", "gbts_ml_pixel_barrel_loose.lut"}
protectedinherited

Definition at line 74 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

74{this, "MLpredictorLutFileName", "gbts_ml_pixel_barrel_loose.lut"};

◆ m_matchBeforeCreate

BooleanProperty SeedingToolBase::m_matchBeforeCreate {this, "MatchBeforeCreate", true}
protectedinherited

Definition at line 68 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

68{this, "MatchBeforeCreate", true};

◆ m_minPt

FloatProperty SeedingToolBase::m_minPt {this, "pTmin", 1000.0}
protectedinherited

Definition at line 69 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

69{this, "pTmin", 1000.0};

◆ m_mlLUT

std::vector<std::array<float, 5> > SeedingToolBase::m_mlLUT
protectedinherited

Definition at line 91 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

◆ m_nBufferEdges

IntegerProperty SeedingToolBase::m_nBufferEdges {this, "BufferEdges", 200000}
protectedinherited

Definition at line 72 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

72{this, "BufferEdges", 200000};

◆ m_nMaxEdges

IntegerProperty SeedingToolBase::m_nMaxEdges {this, "MaxGraphEdges", 2000000}
protectedinherited

Definition at line 71 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

71{this, "MaxGraphEdges", 2000000};

◆ m_nMaxPhiSlice

UnsignedIntegerProperty SeedingToolBase::m_nMaxPhiSlice {this, "nMaxPhiSlice", 53}
protectedinherited

Definition at line 65 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

65{this, "nMaxPhiSlice", 53};

◆ m_phiSliceWidth

float SeedingToolBase::m_phiSliceWidth = 0.
protectedinherited

Definition at line 86 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

◆ m_pixelId

const PixelID * SeedingToolBase::m_pixelId = nullptr
protectedinherited

Definition at line 58 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

◆ m_pixelSpacePointsContainerKey

SG::ReadHandleKey<SpacePointContainer> TrigInDetTrackSeedingTool::m_pixelSpacePointsContainerKey {this, "PixelSP_ContainerName", "ITkPixelTrigSpacePoints"}
protected

Definition at line 62 of file TrigInDetTrackSeedingTool.h.

62{this, "PixelSP_ContainerName", "ITkPixelTrigSpacePoints"};

◆ m_regsel_pix

ToolHandle<IRegSelTool> TrigInDetTrackSeedingTool::m_regsel_pix { this, "RegSelTool_Pixel", "RegSelTool/RegSelTool_Pixel" }
protected

region selector tools

Definition at line 66 of file TrigInDetTrackSeedingTool.h.

66{ this, "RegSelTool_Pixel", "RegSelTool/RegSelTool_Pixel" };

◆ m_regsel_sct

ToolHandle<IRegSelTool> TrigInDetTrackSeedingTool::m_regsel_sct { this, "RegSelTool_SCT", "RegSelTool/RegSelTool_SCT" }
protected

Definition at line 67 of file TrigInDetTrackSeedingTool.h.

67{ this, "RegSelTool_SCT", "RegSelTool/RegSelTool_SCT" };

◆ m_sctId

const SCT_ID * SeedingToolBase::m_sctId = nullptr
protectedinherited

Definition at line 57 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

◆ m_sctSpacePointsContainerKey

SG::ReadHandleKey<SpacePointContainer> TrigInDetTrackSeedingTool::m_sctSpacePointsContainerKey {this, "SCT_SP_ContainerName", "ITkStripTrigSpacePoints"}
protected

Definition at line 61 of file TrigInDetTrackSeedingTool.h.

61{this, "SCT_SP_ContainerName", "ITkStripTrigSpacePoints"};

◆ m_tau_ratio_corr

FloatProperty SeedingToolBase::m_tau_ratio_corr {this, "tau_ratio_correction", 0.006}
protectedinherited

Definition at line 82 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

82{this, "tau_ratio_correction", 0.006};

◆ m_tau_ratio_cut

FloatProperty SeedingToolBase::m_tau_ratio_cut {this, "tau_ratio_cut", 0.007}
protectedinherited

Definition at line 81 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

81{this, "tau_ratio_cut", 0.007};

◆ m_useAdaptiveCuts

BooleanProperty SeedingToolBase::m_useAdaptiveCuts {this, "UseAdaptiveCuts", true}
protectedinherited

Definition at line 79 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

79{this, "UseAdaptiveCuts", true};

◆ m_useBeamTilt

BooleanProperty SeedingToolBase::m_useBeamTilt {this, "UseBeamTilt", false}
protectedinherited

Definition at line 61 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

61{this, "UseBeamTilt", false};

◆ m_useEtaBinning

BooleanProperty SeedingToolBase::m_useEtaBinning {this, "UseEtaBinning", true}
protectedinherited

Definition at line 67 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

67{this, "UseEtaBinning", true};

◆ m_useGPU

BooleanProperty TrigInDetTrackSeedingTool::m_useGPU {this, "UseGPU", false}
protected

Definition at line 71 of file TrigInDetTrackSeedingTool.h.

71{this, "UseGPU", false};

◆ m_useGPUseedExtraction

BooleanProperty SeedingToolBase::m_useGPUseedExtraction {this, "UseGPUseedExtraction", true}
protectedinherited

Definition at line 76 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

76{this, "UseGPUseedExtraction", true};

◆ m_useML

BooleanProperty SeedingToolBase::m_useML {this, "useML", true}
protectedinherited

Definition at line 63 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

63{this, "useML", true};

◆ m_useOldTunings

BooleanProperty SeedingToolBase::m_useOldTunings {this, "UseOldTunings", false}
protectedinherited

Definition at line 77 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

77{this, "UseOldTunings", false};

◆ m_usePixelSpacePoints

BooleanProperty TrigInDetTrackSeedingTool::m_usePixelSpacePoints {this, "UsePixelSpacePoints", true}
protected

Definition at line 57 of file TrigInDetTrackSeedingTool.h.

57{this, "UsePixelSpacePoints", true};

◆ m_useSctSpacePoints

BooleanProperty TrigInDetTrackSeedingTool::m_useSctSpacePoints {this, "UseSctSpacePoints", false}
protected

Definition at line 58 of file TrigInDetTrackSeedingTool.h.

58{this, "UseSctSpacePoints", false};

◆ m_validateTriplets

BooleanProperty SeedingToolBase::m_validateTriplets {this, "ValidateTriplets", true}
protectedinherited

Definition at line 78 of file TrigInDetPattRecoTools/src/SeedingToolBase.h.

78{this, "ValidateTriplets", true};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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