diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/CMakeLists.txt b/Trigger/TrigTools/TrigInDetPattRecoTools/CMakeLists.txt index f78b67d0a35a01dbc9e043ade686777f89a3d3a9..bcde481caa7acde434d2aa3fb1c247b1e139d8e2 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/CMakeLists.txt +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/CMakeLists.txt @@ -13,6 +13,7 @@ atlas_add_library( TrigInDetPattRecoToolsLib # Component(s) in the package: atlas_add_component( TrigInDetPattRecoToolsComp + src/SeedingToolBase.cxx src/TrigInDetTrackSeedingTool.cxx src/Gbts2ActsSeedingTool.cxx src/GNN_*.cxx diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_DataStorage.ipp b/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_DataStorage.cxx similarity index 66% rename from Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_DataStorage.ipp rename to Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_DataStorage.cxx index 38f878a74bcce1f678675b023dbfa77a75d3209d..6a459a2f3589ba75bf5062517f33244b3f7be7b1 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_DataStorage.ipp +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_DataStorage.cxx @@ -1,22 +1,19 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ + #ifndef TRIGINDETPATTRECOTOOLS_GNN_DATA_STORAGE_IPP #define TRIGINDETPATTRECOTOOLS_GNN_DATA_STORAGE_IPP -#include "InDetPrepRawData/PixelCluster.h" -#include "TrkSpacePoint/SpacePoint.h" -#include "TrkSpacePoint/SpacePointCollection.h" - #include "TrigInDetPattRecoEvent/TrigInDetSiLayer.h" #include "GNN_Geometry.h" +#include "GNN_DataStorage.h" #include<cmath> #include<cstring> #include<algorithm> -template<typename externalSP> -TrigFTF_GNN_EtaBin<externalSP>::TrigFTF_GNN_EtaBin(): m_minRadius(0), m_maxRadius(0) { +TrigFTF_GNN_EtaBin::TrigFTF_GNN_EtaBin(): m_minRadius(0), m_maxRadius(0) { m_in.clear(); m_vn.clear(); @@ -24,17 +21,15 @@ TrigFTF_GNN_EtaBin<externalSP>::TrigFTF_GNN_EtaBin(): m_minRadius(0), m_maxRadiu m_vn.reserve(1000); } -template<typename externalSP> -TrigFTF_GNN_EtaBin<externalSP>::~TrigFTF_GNN_EtaBin() { +TrigFTF_GNN_EtaBin::~TrigFTF_GNN_EtaBin() { m_in.clear(); m_vn.clear(); m_params.clear(); } -template<typename externalSP> -void TrigFTF_GNN_EtaBin<externalSP>::sortByPhi() { +void TrigFTF_GNN_EtaBin::sortByPhi() { - std::vector<std::pair<float, const TrigFTF_GNN_Node<externalSP>*> > phiBuckets[32]; + std::vector<std::pair<float, const TrigFTF_GNN_Node*> > phiBuckets[32]; int nBuckets = 31; @@ -56,8 +51,8 @@ void TrigFTF_GNN_EtaBin<externalSP>::sortByPhi() { } -template<typename externalSP> -void TrigFTF_GNN_EtaBin<externalSP>::initializeNodes() { + +void TrigFTF_GNN_EtaBin::initializeNodes() { if(m_vn.size() ==0) return; m_params.resize(m_vn.size()); @@ -66,16 +61,15 @@ void TrigFTF_GNN_EtaBin<externalSP>::initializeNodes() { for(auto& v : m_in) v.reserve(50);//reasonably high number of incoming edges per node std::transform(m_vn.begin(), m_vn.end(), m_params.begin(), - [](const TrigFTF_GNN_Node<externalSP>* pN) { std::array<float,5> a = {-100.0, 100.0, pN->phi(), pN->r(), pN->z()}; return a;}); + [](const TrigFTF_GNN_Node* pN) { std::array<float,5> a = {-100.0, 100.0, pN->phi(), pN->r(), pN->z()}; return a;}); auto [min_iter, max_iter] = std::minmax_element(m_vn.begin(), m_vn.end(), - [](const TrigFTF_GNN_Node<externalSP>* s, const TrigFTF_GNN_Node<externalSP>* s1) { return (s->r() < s1->r()); }); + [](const TrigFTF_GNN_Node* s, const TrigFTF_GNN_Node* s1) { return (s->r() < s1->r()); }); m_maxRadius = (*max_iter)->r(); m_minRadius = (*min_iter)->r(); } -template<typename externalSP> -void TrigFTF_GNN_EtaBin<externalSP>::generatePhiIndexing(float dphi) { +void TrigFTF_GNN_EtaBin::generatePhiIndexing(float dphi) { for(unsigned int nIdx=0;nIdx<m_vn.size();nIdx++) { @@ -99,18 +93,16 @@ void TrigFTF_GNN_EtaBin<externalSP>::generatePhiIndexing(float dphi) { } -template<typename externalSP> -TrigFTF_GNN_DataStorage<externalSP>::TrigFTF_GNN_DataStorage(const TrigFTF_GNN_Geometry& g) : m_geo(g) { +TrigFTF_GNN_DataStorage::TrigFTF_GNN_DataStorage(const TrigFTF_GNN_Geometry& g) : m_geo(g) { m_etaBins.resize(g.num_bins()); } -template<typename externalSP> -TrigFTF_GNN_DataStorage<externalSP>::~TrigFTF_GNN_DataStorage() { + +TrigFTF_GNN_DataStorage::~TrigFTF_GNN_DataStorage() { } -template<typename externalSP> -int TrigFTF_GNN_DataStorage<externalSP>::loadPixelGraphNodes(short layerIndex, const std::vector<TrigFTF_GNN_Node<externalSP>>& coll, bool useML) { +int TrigFTF_GNN_DataStorage::loadPixelGraphNodes(short layerIndex, const std::vector<TrigFTF_GNN_Node>& coll, bool useML) { int nLoaded = 0; @@ -148,8 +140,7 @@ int TrigFTF_GNN_DataStorage<externalSP>::loadPixelGraphNodes(short layerIndex, c return nLoaded; } -template<typename externalSP> -int TrigFTF_GNN_DataStorage<externalSP>::loadStripGraphNodes(short layerIndex, const std::vector<TrigFTF_GNN_Node<externalSP>>& coll) { +int TrigFTF_GNN_DataStorage::loadStripGraphNodes(short layerIndex, const std::vector<TrigFTF_GNN_Node>& coll) { int nLoaded = 0; @@ -174,8 +165,7 @@ int TrigFTF_GNN_DataStorage<externalSP>::loadStripGraphNodes(short layerIndex, c return nLoaded; } -template<typename externalSP> -unsigned int TrigFTF_GNN_DataStorage<externalSP>::numberOfNodes() const { +unsigned int TrigFTF_GNN_DataStorage::numberOfNodes() const { unsigned int n=0; @@ -185,14 +175,12 @@ unsigned int TrigFTF_GNN_DataStorage<externalSP>::numberOfNodes() const { return n; } -template<typename externalSP> -void TrigFTF_GNN_DataStorage<externalSP>::sortByPhi() { +void TrigFTF_GNN_DataStorage::sortByPhi() { for(auto& b : m_etaBins) b.sortByPhi(); } -template<typename externalSP> -void TrigFTF_GNN_DataStorage<externalSP>::initializeNodes(bool useML) { +void TrigFTF_GNN_DataStorage::initializeNodes(bool useML) { for(auto& b : m_etaBins) { b.initializeNodes(); @@ -218,7 +206,7 @@ void TrigFTF_GNN_DataStorage<externalSP>::initializeNodes(bool useML) { for(int b=0;b<nBins;b++) {//loop over eta-bins in Layer - TrigFTF_GNN_EtaBin<externalSP>& B = m_etaBins.at(pL->m_bins.at(b)); + TrigFTF_GNN_EtaBin& B = m_etaBins.at(pL->m_bins.at(b)); if(B.empty()) continue; @@ -236,8 +224,7 @@ void TrigFTF_GNN_DataStorage<externalSP>::initializeNodes(bool useML) { } } -template<typename externalSP> -void TrigFTF_GNN_DataStorage<externalSP>::generatePhiIndexing(float dphi) { +void TrigFTF_GNN_DataStorage::generatePhiIndexing(float dphi) { for(auto& b : m_etaBins) b.generatePhiIndexing(dphi); } diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_DataStorage.h b/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_DataStorage.h index 1dbedb791b782591159d74935b74578efc78fa1b..70f535c7259a9e75902fed9c216bdefac9ffddce 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_DataStorage.h +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_DataStorage.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGINDETPATTRECOTOOLS_GNN_DATA_STORAGE_H @@ -9,18 +9,17 @@ #include<map> #include<algorithm> #include<array> - +#include<limits> #define MAX_SEG_PER_NODE 1000 //was 30 #define N_SEG_CONNS 6 //was 6 -#include "TrkSpacePoint/SpacePoint.h" +//#include "TrkSpacePoint/SpacePoint.h" class TrigFTF_GNN_Geometry; -template<typename externalSP> struct TrigFTF_GNN_Node { - TrigFTF_GNN_Node(unsigned short l) : m_x(0), m_y(0), m_z(0), m_r(0), m_phi(0), m_layer(l), m_pSP(nullptr), m_pcw(0) {}; + TrigFTF_GNN_Node(unsigned short l) : m_x(0), m_y(0), m_z(0), m_r(0), m_phi(0), m_layer(l), m_pcw(0) {}; inline float x() const {return m_x;} inline float y() const {return m_y;} @@ -31,21 +30,21 @@ struct TrigFTF_GNN_Node { inline unsigned short layer() const {return m_layer;} inline float pixelClusterWidth() const {return m_pcw;} - inline externalSP sp() const {return m_pSP;} + inline int sp_idx() const {return m_idx;} float m_x, m_y, m_z, m_r, m_phi; unsigned short m_layer{10000}; - externalSP m_pSP{nullptr}; + unsigned int m_idx{std::numeric_limits<unsigned int>::max()}; float m_pcw; }; -template<typename externalSP> + class TrigFTF_GNN_EtaBin { public: struct CompareNodesByPhi { - bool operator()(const TrigFTF_GNN_Node<externalSP>* n1, const TrigFTF_GNN_Node<externalSP>* n2) { + bool operator()(const TrigFTF_GNN_Node* n1, const TrigFTF_GNN_Node* n2) { return n1->phi() < n2->phi(); } @@ -70,7 +69,7 @@ public: return m_maxRadius; } - std::vector<const TrigFTF_GNN_Node<externalSP>*> m_vn;//nodes of the graph + std::vector<const TrigFTF_GNN_Node*> m_vn;//nodes of the graph std::vector<std::pair<float, unsigned int> > m_vPhiNodes; std::vector<std::vector<unsigned int> > m_in;//vectors of incoming edges std::vector<std::array<float,5> > m_params;//node attributes: m_minCutOnTau, m_maxCutOnTau, m_phi, m_r, m_z; @@ -79,14 +78,13 @@ public: }; -template<typename externalSP> class TrigFTF_GNN_DataStorage { public: TrigFTF_GNN_DataStorage(const TrigFTF_GNN_Geometry&); ~TrigFTF_GNN_DataStorage(); - int loadPixelGraphNodes(short, const std::vector<TrigFTF_GNN_Node<externalSP>>&, bool); - int loadStripGraphNodes(short, const std::vector<TrigFTF_GNN_Node<externalSP>>&); + 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(); @@ -94,7 +92,7 @@ public: void generatePhiIndexing(float); - TrigFTF_GNN_EtaBin<externalSP>& getEtaBin(int idx) { + TrigFTF_GNN_EtaBin& getEtaBin(int idx) { if(idx >= static_cast<int>(m_etaBins.size())) idx = idx-1; return m_etaBins.at(idx); } @@ -103,22 +101,21 @@ protected: const TrigFTF_GNN_Geometry& m_geo; - std::vector<TrigFTF_GNN_EtaBin<externalSP>> m_etaBins; + std::vector<TrigFTF_GNN_EtaBin> m_etaBins; }; -template<typename externalSP> class TrigFTF_GNN_Edge { public: struct CompareLevel { public: - bool operator()(const TrigFTF_GNN_Edge<externalSP>* pS1, const TrigFTF_GNN_Edge<externalSP>* pS2) { - return pS1->m_level > pS2->m_level; + bool operator()(const TrigFTF_GNN_Edge* pE1, const TrigFTF_GNN_Edge* pE2) { + return pE1->m_level > pE2->m_level; } }; - TrigFTF_GNN_Edge(const TrigFTF_GNN_Node<externalSP>* n1, const TrigFTF_GNN_Node<externalSP>* n2, float p1, float p2, float p3) : m_n1(n1), m_n2(n2), m_level(1), m_next(1), m_nNei(0) { + TrigFTF_GNN_Edge(const TrigFTF_GNN_Node* n1, const TrigFTF_GNN_Node* n2, float p1, float p2, float p3) : m_n1(n1), m_n2(n2), m_level(1), m_next(1), m_nNei(0) { m_p[0] = p1; m_p[1] = p2; m_p[2] = p3; @@ -127,8 +124,8 @@ public: TrigFTF_GNN_Edge() : m_n1(nullptr), m_n2(nullptr), m_level(-1), m_next(-1), m_nNei(0) {}; - const TrigFTF_GNN_Node<externalSP>* m_n1{nullptr}; - const TrigFTF_GNN_Node<externalSP>* m_n2{nullptr}; + const TrigFTF_GNN_Node* m_n1{nullptr}; + const TrigFTF_GNN_Node* m_n2{nullptr}; signed char m_level{-1}, m_next{-1}; @@ -141,4 +138,3 @@ public: #endif -#include "GNN_DataStorage.ipp" \ No newline at end of file diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_TrackingFilter.ipp b/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_TrackingFilter.cxx similarity index 78% rename from Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_TrackingFilter.ipp rename to Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_TrackingFilter.cxx index 22ca6d790d2bd848d013e6fd1135dd45c021d8c9..5dc700e4c49517486c960dbbef38f0aebb9eca0d 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_TrackingFilter.ipp +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_TrackingFilter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGINDETPATTRECOTOOLS_GNN_TRACKING_FILTER_IPP @@ -12,8 +12,9 @@ #include<algorithm> #include<list> -template<typename externalSP> -void TrigFTF_GNN_EdgeState<externalSP>::initialize(TrigFTF_GNN_Edge<externalSP>* pS) { +#include "GNN_TrackingFilter.h" + +void TrigFTF_GNN_EdgeState::initialize(TrigFTF_GNN_Edge* pS) { m_initialized = true; @@ -60,8 +61,7 @@ void TrigFTF_GNN_EdgeState<externalSP>::initialize(TrigFTF_GNN_Edge<externalSP>* } -template<typename externalSP> -void TrigFTF_GNN_EdgeState<externalSP>::clone(const TrigFTF_GNN_EdgeState<externalSP>& st) { +void TrigFTF_GNN_EdgeState::clone(const TrigFTF_GNN_EdgeState& st) { memcpy(&m_X[0], &st.m_X[0], sizeof(m_X)); memcpy(&m_Y[0], &st.m_Y[0], sizeof(m_Y)); @@ -79,11 +79,9 @@ void TrigFTF_GNN_EdgeState<externalSP>::clone(const TrigFTF_GNN_EdgeState<extern m_initialized = true; } -template<typename externalSP> -TrigFTF_GNN_TrackingFilter<externalSP>::TrigFTF_GNN_TrackingFilter(const std::vector<TrigInDetSiLayer>& g, std::vector<TrigFTF_GNN_Edge<externalSP>>& sb) : m_geo(g), m_segStore(sb) { } +TrigFTF_GNN_TrackingFilter::TrigFTF_GNN_TrackingFilter(const std::vector<TrigInDetSiLayer>& g, std::vector<TrigFTF_GNN_Edge>& sb) : m_geo(g), m_segStore(sb) { } -template<typename externalSP> -void TrigFTF_GNN_TrackingFilter<externalSP>::followTrack(TrigFTF_GNN_Edge<externalSP>* pS, TrigFTF_GNN_EdgeState<externalSP>& output) { +void TrigFTF_GNN_TrackingFilter::followTrack(TrigFTF_GNN_Edge* pS, TrigFTF_GNN_EdgeState& output) { if(pS->m_level == -1) return;//already collected @@ -92,7 +90,7 @@ void TrigFTF_GNN_TrackingFilter<externalSP>::followTrack(TrigFTF_GNN_Edge<extern //create track state - TrigFTF_GNN_EdgeState<externalSP>* pInitState = &m_stateStore[m_globalStateCounter++]; + TrigFTF_GNN_EdgeState* pInitState = &m_stateStore[m_globalStateCounter++]; pInitState->initialize(pS); @@ -105,9 +103,9 @@ void TrigFTF_GNN_TrackingFilter<externalSP>::followTrack(TrigFTF_GNN_Edge<extern if(m_stateVec.empty()) return; - std::sort(m_stateVec.begin(), m_stateVec.end(), typename TrigFTF_GNN_EdgeState<externalSP>::Compare()); + std::sort(m_stateVec.begin(), m_stateVec.end(), typename TrigFTF_GNN_EdgeState::Compare()); - TrigFTF_GNN_EdgeState<externalSP>* best = (*m_stateVec.begin()); + TrigFTF_GNN_EdgeState* best = (*m_stateVec.begin()); output.clone(*best); @@ -115,14 +113,13 @@ void TrigFTF_GNN_TrackingFilter<externalSP>::followTrack(TrigFTF_GNN_Edge<extern m_globalStateCounter = 0; } -template<typename externalSP> -void TrigFTF_GNN_TrackingFilter<externalSP>::propagate(TrigFTF_GNN_Edge<externalSP>* pS, TrigFTF_GNN_EdgeState<externalSP>& ts) { +void TrigFTF_GNN_TrackingFilter::propagate(TrigFTF_GNN_Edge* pS, TrigFTF_GNN_EdgeState& ts) { if(m_globalStateCounter >= MAX_EDGE_STATE) return; - TrigFTF_GNN_EdgeState<externalSP>* p_new_ts = &m_stateStore[m_globalStateCounter++]; + TrigFTF_GNN_EdgeState* p_new_ts = &m_stateStore[m_globalStateCounter++]; - TrigFTF_GNN_EdgeState<externalSP>& new_ts = *p_new_ts; + TrigFTF_GNN_EdgeState& new_ts = *p_new_ts; new_ts.clone(ts); new_ts.m_vs.push_back(pS); @@ -133,12 +130,12 @@ void TrigFTF_GNN_TrackingFilter<externalSP>::propagate(TrigFTF_GNN_Edge<external int level = pS->m_level; - std::list<TrigFTF_GNN_Edge<externalSP>*> lCont; + std::list<TrigFTF_GNN_Edge*> lCont; for(int nIdx=0;nIdx<pS->m_nNei;nIdx++) {//loop over the neighbours of this segment unsigned int nextSegmentIdx = pS->m_vNei[nIdx]; - TrigFTF_GNN_Edge<externalSP>* pN = &(m_segStore[nextSegmentIdx]); + TrigFTF_GNN_Edge* pN = &(m_segStore[nextSegmentIdx]); if(pN->m_level == -1) continue;//already collected @@ -154,14 +151,14 @@ void TrigFTF_GNN_TrackingFilter<externalSP>::propagate(TrigFTF_GNN_Edge<external if(m_globalStateCounter < MAX_EDGE_STATE) { if(m_stateVec.empty()) {//add the first segment state - TrigFTF_GNN_EdgeState<externalSP>* p = &m_stateStore[m_globalStateCounter++]; + TrigFTF_GNN_EdgeState* p = &m_stateStore[m_globalStateCounter++]; p->clone(new_ts); m_stateVec.push_back(p); } else {//compare with the best and add float best_so_far = (*m_stateVec.begin())->m_J; if(new_ts.m_J > best_so_far) { - TrigFTF_GNN_EdgeState<externalSP>* p = &m_stateStore[m_globalStateCounter++]; + TrigFTF_GNN_EdgeState* p = &m_stateStore[m_globalStateCounter++]; p->clone(new_ts); m_stateVec.push_back(p); } @@ -176,8 +173,7 @@ void TrigFTF_GNN_TrackingFilter<externalSP>::propagate(TrigFTF_GNN_Edge<external } } -template<typename externalSP> -bool TrigFTF_GNN_TrackingFilter<externalSP>::update(TrigFTF_GNN_Edge<externalSP>* pS, TrigFTF_GNN_EdgeState<externalSP>& ts) { +bool TrigFTF_GNN_TrackingFilter::update(TrigFTF_GNN_Edge* pS, TrigFTF_GNN_EdgeState& ts) { const float sigma_t = 0.0003; const float sigma_w = 0.00009; @@ -320,8 +316,7 @@ bool TrigFTF_GNN_TrackingFilter<externalSP>::update(TrigFTF_GNN_Edge<externalSP> return true; } -template<typename externalSP> -int TrigFTF_GNN_TrackingFilter<externalSP>::getLayerType(int l) { +int TrigFTF_GNN_TrackingFilter::getLayerType(int l) { return m_geo.at(l).m_type; } diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_TrackingFilter.h b/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_TrackingFilter.h index 62082315ed71d2591f1185c51b09bd3ed64729da..011a808949fc6775d996ea389912f19e2ae3c31a 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_TrackingFilter.h +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/GNN_TrackingFilter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGINDETPATTRECOTOOLS_GNN_TRACKING_FILTER_H @@ -8,13 +8,12 @@ #include "GNN_DataStorage.h" #include "TrigInDetPattRecoEvent/TrigInDetSiLayer.h" -template<typename externalSP> struct TrigFTF_GNN_EdgeState { public: struct Compare { - bool operator()(const struct TrigFTF_GNN_EdgeState<externalSP>* s1, const struct TrigFTF_GNN_EdgeState<externalSP>* s2) { + bool operator()(const struct TrigFTF_GNN_EdgeState* s1, const struct TrigFTF_GNN_EdgeState* s2) { return s1->m_J > s2->m_J; } }; @@ -22,16 +21,16 @@ struct Compare { TrigFTF_GNN_EdgeState() {}; -TrigFTF_GNN_EdgeState(bool f) : m_initialized(f) {}; + TrigFTF_GNN_EdgeState(bool f) : m_initialized(f) {}; ~TrigFTF_GNN_EdgeState() {}; - void initialize(TrigFTF_GNN_Edge<externalSP>*); - void clone(const struct TrigFTF_GNN_EdgeState<externalSP>&); + void initialize(TrigFTF_GNN_Edge*); + void clone(const struct TrigFTF_GNN_EdgeState&); float m_J{}; - std::vector<TrigFTF_GNN_Edge<externalSP>*> m_vs; + std::vector<TrigFTF_GNN_Edge*> m_vs; float m_X[3]{}, m_Y[2]{}, m_Cx[3][3]{}, m_Cy[2][2]{}; float m_refX{}, m_refY{}, m_c{}, m_s{}; @@ -42,30 +41,29 @@ TrigFTF_GNN_EdgeState(bool f) : m_initialized(f) {}; #define MAX_EDGE_STATE 2500 -template<typename externalSP> class TrigFTF_GNN_TrackingFilter { public: - TrigFTF_GNN_TrackingFilter(const std::vector<TrigInDetSiLayer>&, std::vector<TrigFTF_GNN_Edge<externalSP>>&); + TrigFTF_GNN_TrackingFilter(const std::vector<TrigInDetSiLayer>&, std::vector<TrigFTF_GNN_Edge>&); ~TrigFTF_GNN_TrackingFilter(){}; - void followTrack(TrigFTF_GNN_Edge<externalSP>*, TrigFTF_GNN_EdgeState<externalSP>&); + void followTrack(TrigFTF_GNN_Edge*, TrigFTF_GNN_EdgeState&); protected: - void propagate(TrigFTF_GNN_Edge<externalSP>*, TrigFTF_GNN_EdgeState<externalSP>&); + void propagate(TrigFTF_GNN_Edge*, TrigFTF_GNN_EdgeState&); - bool update(TrigFTF_GNN_Edge<externalSP>*, TrigFTF_GNN_EdgeState<externalSP>&); + bool update(TrigFTF_GNN_Edge*, TrigFTF_GNN_EdgeState&); int getLayerType(int); const std::vector<TrigInDetSiLayer>& m_geo; - std::vector<TrigFTF_GNN_Edge<externalSP>>& m_segStore; + std::vector<TrigFTF_GNN_Edge>& m_segStore; - std::vector<TrigFTF_GNN_EdgeState<externalSP>*> m_stateVec; + std::vector<TrigFTF_GNN_EdgeState*> m_stateVec; - TrigFTF_GNN_EdgeState<externalSP> m_stateStore[MAX_EDGE_STATE]; + TrigFTF_GNN_EdgeState m_stateStore[MAX_EDGE_STATE]; int m_globalStateCounter{0}; @@ -73,4 +71,3 @@ class TrigFTF_GNN_TrackingFilter { #endif -#include "GNN_TrackingFilter.ipp" \ No newline at end of file diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/Gbts2ActsSeedingTool.cxx b/Trigger/TrigTools/TrigInDetPattRecoTools/src/Gbts2ActsSeedingTool.cxx index 2ab510ca9e0f18fb4b596c7be9435ccda3420188..e07a0930c335ed32bae5bd0c6746f7ee93fbdb73 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/Gbts2ActsSeedingTool.cxx +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/Gbts2ActsSeedingTool.cxx @@ -2,10 +2,13 @@ Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ -#include "Gbts2ActsSeedingTool.h" #include "xAODInDetMeasurement/ContainerAccessor.h" #include "TrigSteeringEvent/TrigRoiDescriptor.h" #include "xAODInDetMeasurement/PixelCluster.h" + +#include "Gbts2ActsSeedingTool.h" +#include "GNN_TrackingFilter.h" + #include <optional> Gbts2ActsSeedingTool::Gbts2ActsSeedingTool(const std::string& t, @@ -15,7 +18,7 @@ Gbts2ActsSeedingTool::Gbts2ActsSeedingTool(const std::string& t, } StatusCode Gbts2ActsSeedingTool::initialize(){ - ATH_CHECK(SeedingToolBase<const xAOD::SpacePoint*>::initialize()); + ATH_CHECK(SeedingToolBase::initialize()); ATH_CHECK( m_pixelDetEleCollKey.initialize() ); ATH_CHECK(m_stripDetEleCollKey.initialize()); ATH_CHECK(m_beamSpotKey.initialize()); @@ -24,22 +27,29 @@ StatusCode Gbts2ActsSeedingTool::initialize(){ } StatusCode Gbts2ActsSeedingTool::finalize() { - return SeedingToolBase<const xAOD::SpacePoint*>::finalize(); + return SeedingToolBase::finalize(); } -StatusCode Gbts2ActsSeedingTool::createSeeds(const EventContext& ctx, const Acts::SpacePointContainer<ActsTrk::SpacePointCollector, Acts::detail::RefHolder>& spContainer, const Acts::Vector3&, const Acts::Vector3&, ActsTrk::SeedContainer& seedContainer) const{ +StatusCode Gbts2ActsSeedingTool::createSeeds(const EventContext& ctx, const Acts::SpacePointContainer<ActsTrk::SpacePointCollector, Acts::detail::RefHolder>& spContainer, const Acts::Vector3&, const Acts::Vector3&, ActsTrk::SeedContainer& seedContainer) const { + std::unique_ptr<GNN_DataStorage> storage = std::make_unique<GNN_DataStorage>(*m_geo); SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> pixelDetEleHandle = SG::makeHandle(m_pixelDetEleCollKey, ctx); - ATH_CHECK(pixelDetEleHandle.isValid()) ; + + ATH_CHECK(pixelDetEleHandle.isValid()); + const InDetDD::SiDetectorElementCollection* pixelElements = pixelDetEleHandle.cptr(); SG::ReadCondHandle<InDetDD::SiDetectorElementCollection> stripDetEleHandle = SG::makeHandle(m_stripDetEleCollKey, ctx); - ATH_CHECK(stripDetEleHandle.isValid()) ; + + ATH_CHECK(stripDetEleHandle.isValid()); + const InDetDD::SiDetectorElementCollection* stripElements = stripDetEleHandle.cptr(); - SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx }; + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx }; + const Amg::Vector3D &vertex = beamSpotHandle->beamPos(); + float shift_x = vertex.x() - beamSpotHandle->beamTilt(0)*vertex.z(); float shift_y = vertex.y() - beamSpotHandle->beamTilt(1)*vertex.z(); @@ -79,10 +89,11 @@ StatusCode Gbts2ActsSeedingTool::createSeeds(const EventContext& ctx, const Acts node.m_z = pos.z(); node.m_r = std::sqrt(node.m_x*node.m_x + node.m_y*node.m_y); node.m_phi = std::atan2(node.m_y,node.m_x); - node.m_pSP = &extSP; + node.m_idx = idx; - if(isPixel){ - const xAOD::PixelCluster* pCL = dynamic_cast<const xAOD::PixelCluster*>(extSP.measurements().front()); + if(isPixel && m_useML){ + const auto& lm = extSP.measurements(); + const xAOD::PixelCluster* pCL = dynamic_cast<const xAOD::PixelCluster*>(lm.front()); if(pCL != nullptr){ node.m_pcw = pCL->widthInEta(); } @@ -154,12 +165,12 @@ StatusCode Gbts2ActsSeedingTool::createSeeds(const EventContext& ctx, const Acts //backtracking - TrigFTF_GNN_TrackingFilter<const xAOD::SpacePoint*> tFilter(m_layerGeometry, edgeStorage); + TrigFTF_GNN_TrackingFilter tFilter(m_layerGeometry, edgeStorage); for(auto pS : vSeeds) { if(pS->m_level == -1) continue; - TrigFTF_GNN_EdgeState<const xAOD::SpacePoint*> rs(false); + TrigFTF_GNN_EdgeState rs(false); tFilter.followTrack(pS, rs); @@ -182,9 +193,15 @@ StatusCode Gbts2ActsSeedingTool::createSeeds(const EventContext& ctx, const Acts } if(vN.size()<3) continue; - - //add seed to output - std::unique_ptr<ActsTrk::Seed> to_add = std::make_unique<ActsTrk::Seed>(*(vN[0]->sp()), *(vN[1]->sp()), *(vN[2]->sp())); + + const auto & sp1 = spContainer.at(vN[0]->sp_idx()).externalSpacePoint(); + const auto & sp2 = spContainer.at(vN[1]->sp_idx()).externalSpacePoint(); + const auto & sp3 = spContainer.at(vN[2]->sp_idx()).externalSpacePoint(); + + //add seed to output + + std::unique_ptr<ActsTrk::Seed> to_add = std::make_unique<ActsTrk::Seed>(sp1, sp2, sp3); + seedContainer.push_back(std::move(to_add)); } diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/Gbts2ActsSeedingTool.h b/Trigger/TrigTools/TrigInDetPattRecoTools/src/Gbts2ActsSeedingTool.h index 9b95845d4586a79495acbdc1d00ea1be860dde42..b00c002464190b0c68fee3389e34872d9f113b2a 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/Gbts2ActsSeedingTool.h +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/Gbts2ActsSeedingTool.h @@ -7,12 +7,13 @@ #include "ActsToolInterfaces/ISeedingTool.h" #include "StoreGate/ReadCondHandleKey.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetReadoutGeometry/SiDetectorElementCollection.h" #include "BeamSpotConditionsData/BeamSpotData.h" #include "SeedingToolBase.h" -class Gbts2ActsSeedingTool: public SeedingToolBase<const xAOD::SpacePoint*>, public ActsTrk::ISeedingTool{ +class Gbts2ActsSeedingTool: public SeedingToolBase, public ActsTrk::ISeedingTool { public: // standard AlgTool methods @@ -35,4 +36,5 @@ class Gbts2ActsSeedingTool: public SeedingToolBase<const xAOD::SpacePoint*>, pub SG::ReadCondHandleKey<InDetDD::SiDetectorElementCollection> m_stripDetEleCollKey{this, "StripDetectorElements", "ITkStripDetectorElementCollection", "Key of input SiDetectorElementCollection for Strip"}; SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; }; + #endif diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/SeedingToolBase.ipp b/Trigger/TrigTools/TrigInDetPattRecoTools/src/SeedingToolBase.cxx similarity index 87% rename from Trigger/TrigTools/TrigInDetPattRecoTools/src/SeedingToolBase.ipp rename to Trigger/TrigTools/TrigInDetPattRecoTools/src/SeedingToolBase.cxx index 6785f5ce4d7c2fe15dbc4fa81b9290e3b1870296..e29d5e36aa7dd82ec97277f40e43b7aac78022e3 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/SeedingToolBase.ipp +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/SeedingToolBase.cxx @@ -1,27 +1,25 @@ /* - Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration */ + #ifndef TRIGINDETPATTRECOTOOLS_SEEDINGTOOLBASE_IPP #define TRIGINDETPATTRECOTOOLS_SEEDINGTOOLBASE_IPP #include "InDetIdentifier/SCT_ID.h" #include "InDetIdentifier/PixelID.h" -#include "TrkSpacePoint/SpacePoint.h" -#include "TrkSpacePoint/SpacePointCollection.h" -#include "TrkSpacePoint/SpacePointContainer.h" #include "AtlasDetDescr/AtlasDetectorID.h" - #include "PathResolver/PathResolver.h" #include "GNN_TrackingFilter.h" #include "IRegionSelector/IRegSelTool.h" +#include "SeedingToolBase.h" + -template<typename externalSP> -StatusCode SeedingToolBase<externalSP>::initialize() { +StatusCode SeedingToolBase::initialize() { ATH_CHECK(AthAlgTool::initialize()); ATH_CHECK(m_layerNumberTool.retrieve()); @@ -64,14 +62,12 @@ StatusCode SeedingToolBase<externalSP>::initialize() { return StatusCode::SUCCESS; } -template<typename externalSP> -StatusCode SeedingToolBase<externalSP>::finalize() { +StatusCode SeedingToolBase::finalize() { StatusCode sc = AthAlgTool::finalize(); return sc; } -template<typename externalSP> -std::pair<int, int> SeedingToolBase<externalSP>::buildTheGraph(const IRoiDescriptor& roi, const std::unique_ptr<TrigFTF_GNN_DataStorage<externalSP>>& storage, std::vector<TrigFTF_GNN_Edge<externalSP>>& edgeStorage) const { +std::pair<int, int> SeedingToolBase::buildTheGraph(const IRoiDescriptor& roi, const std::unique_ptr<TrigFTF_GNN_DataStorage>& storage, std::vector<TrigFTF_GNN_Edge>& edgeStorage) const { const float M_2PI = 2.0*M_PI; @@ -109,7 +105,7 @@ std::pair<int, int> SeedingToolBase<externalSP>::buildTheGraph(const IRoiDescrip for(const auto& bg : m_geo->bin_groups()) {//loop over bin groups - TrigFTF_GNN_EtaBin<externalSP>& B1 = storage->getEtaBin(bg.first); + TrigFTF_GNN_EtaBin& B1 = storage->getEtaBin(bg.first); if(B1.empty()) continue; @@ -117,7 +113,7 @@ std::pair<int, int> SeedingToolBase<externalSP>::buildTheGraph(const IRoiDescrip for(const auto& b2_idx : bg.second) { - const TrigFTF_GNN_EtaBin<externalSP>& B2 = storage->getEtaBin(b2_idx); + const TrigFTF_GNN_EtaBin& B2 = storage->getEtaBin(b2_idx); if(B2.empty()) continue; @@ -256,7 +252,7 @@ std::pair<int, int> SeedingToolBase<externalSP>::buildTheGraph(const IRoiDescrip for(const auto& inEdgeIdx : v2In) {//looking for neighbours of the new edge - TrigFTF_GNN_Edge<externalSP>* pS = &(edgeStorage.at(inEdgeIdx)); + TrigFTF_GNN_Edge* pS = &(edgeStorage.at(inEdgeIdx)); if(pS->m_nNei >= N_SEG_CONNS) continue; @@ -296,8 +292,7 @@ std::pair<int, int> SeedingToolBase<externalSP>::buildTheGraph(const IRoiDescrip return std::make_pair(nEdges, nConnections); } -template<typename externalSP> -int SeedingToolBase<externalSP>::runCCA(int nEdges, std::vector<TrigFTF_GNN_Edge<externalSP>>& edgeStorage) const { +int SeedingToolBase::runCCA(int nEdges, std::vector<TrigFTF_GNN_Edge>& edgeStorage) const { const int maxIter = 15; @@ -305,11 +300,11 @@ int SeedingToolBase<externalSP>::runCCA(int nEdges, std::vector<TrigFTF_GNN_Edge int iter = 0; - std::vector<TrigFTF_GNN_Edge<externalSP>*> v_old; + std::vector<TrigFTF_GNN_Edge*> v_old; for(int edgeIndex=0;edgeIndex<nEdges;edgeIndex++) { - TrigFTF_GNN_Edge<externalSP>* pS = &(edgeStorage[edgeIndex]); + TrigFTF_GNN_Edge* pS = &(edgeStorage[edgeIndex]); if(pS->m_nNei == 0) continue; v_old.push_back(pS);//TO-DO: increment level for segments as they already have at least one neighbour @@ -318,7 +313,7 @@ int SeedingToolBase<externalSP>::runCCA(int nEdges, std::vector<TrigFTF_GNN_Edge for(;iter<maxIter;iter++) { //generate proposals - std::vector<TrigFTF_GNN_Edge<externalSP>*> v_new; + std::vector<TrigFTF_GNN_Edge*> v_new; v_new.clear(); v_new.reserve(v_old.size()); @@ -330,7 +325,7 @@ int SeedingToolBase<externalSP>::runCCA(int nEdges, std::vector<TrigFTF_GNN_Edge unsigned int nextEdgeIdx = pS->m_vNei[nIdx]; - TrigFTF_GNN_Edge<externalSP>* pN = &(edgeStorage[nextEdgeIdx]); + TrigFTF_GNN_Edge* pN = &(edgeStorage[nextEdgeIdx]); if(pS->m_level == pN->m_level) { next_level = pS->m_level + 1; diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/SeedingToolBase.h b/Trigger/TrigTools/TrigInDetPattRecoTools/src/SeedingToolBase.h index 60945336238b5ad45488266bef7c232abf6f9498..69edde2da9b9bce6c47fcc8c41b6fffc9f9bb12f 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/SeedingToolBase.h +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/SeedingToolBase.h @@ -4,15 +4,14 @@ #ifndef TRIGINDETPATTRECOTOOLS_SEEDINGTOOLBASE_H #define TRIGINDETPATTRECOTOOLS_SEEDINGTOOLBASE_H + #include "GaudiKernel/ToolHandle.h" -#include "TrigInDetToolInterfaces/ITrigInDetTrackSeedingTool.h" +//#include "TrigInDetToolInterfaces/ITrigInDetTrackSeedingTool.h" #include "AthenaBaseComps/AthAlgTool.h" #include "StoreGate/ReadHandleKey.h" #include <string> #include <vector> - - #include "IRegionSelector/IRegSelTool.h" #include "TrigInDetToolInterfaces/ITrigL2LayerNumberTool.h" @@ -24,16 +23,15 @@ class AtlasDetectorID; class SCT_ID; class PixelID; -template<typename externalSP> class SeedingToolBase: public AthAlgTool { public: SeedingToolBase(const std::string& t,const std::string& n,const IInterface* p): AthAlgTool(t,n,p){} protected: - typedef TrigFTF_GNN_Node<externalSP> GNN_Node; - typedef TrigFTF_GNN_DataStorage<externalSP> GNN_DataStorage; - typedef TrigFTF_GNN_Edge<externalSP> GNN_Edge; + typedef TrigFTF_GNN_Node GNN_Node; + typedef TrigFTF_GNN_DataStorage GNN_DataStorage; + typedef TrigFTF_GNN_Edge GNN_Edge; virtual StatusCode initialize(); virtual StatusCode finalize(); @@ -68,5 +66,3 @@ class SeedingToolBase: public AthAlgTool { }; #endif - -#include "SeedingToolBase.ipp" diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigInDetTrackSeedingTool.cxx b/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigInDetTrackSeedingTool.cxx index 4588d83c8503692b78f625406facb7d10eb28a24..b155ebe3b9a3b2f53b0507ec8f6045c354b18c06 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigInDetTrackSeedingTool.cxx +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigInDetTrackSeedingTool.cxx @@ -8,16 +8,17 @@ #include "TrkSpacePoint/SpacePoint.h" #include "TrkSpacePoint/SpacePointCollection.h" #include "TrkSpacePoint/SpacePointContainer.h" +#include "InDetPrepRawData/PixelCluster.h" #include "AtlasDetDescr/AtlasDetectorID.h" #include "PathResolver/PathResolver.h" -#include "GNN_TrackingFilter.h" - #include "IRegionSelector/IRegSelTool.h" #include "TrigInDetTrackSeedingTool.h" +#include "GNN_TrackingFilter.h" + //for GPU offloading #include "TrigAccelEvent/TrigITkAccelEDM.h" @@ -25,14 +26,14 @@ TrigInDetTrackSeedingTool::TrigInDetTrackSeedingTool(const std::string& t, const std::string& n, - const IInterface* p ) : - SeedingToolBase(t,n,p) + const IInterface* p ) : SeedingToolBase(t,n,p) { } StatusCode TrigInDetTrackSeedingTool::initialize() { - ATH_CHECK(SeedingToolBase<const Trk::SpacePoint*>::initialize()); + + ATH_CHECK(SeedingToolBase::initialize()); ATH_CHECK(m_regsel_pix.retrieve()); ATH_CHECK(m_regsel_sct.retrieve()); @@ -65,7 +66,7 @@ StatusCode TrigInDetTrackSeedingTool::initialize() { } StatusCode TrigInDetTrackSeedingTool::finalize() { - return SeedingToolBase<const Trk::SpacePoint*>::finalize(); + return SeedingToolBase::finalize(); } @@ -153,7 +154,11 @@ TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds(const IRoiDescr if(!m_useGPU) { std::unique_ptr<GNN_DataStorage> storage = std::make_unique<GNN_DataStorage>(*m_geo); - + + std::vector<const Trk::SpacePoint*> vSP; + + vSP.reserve(m_nMaxEdges); + std::vector<std::vector<GNN_Node> > trigSpStorage[2]; trigSpStorage[1].resize(m_layerNumberTool->sctLayers()->size()); @@ -182,7 +187,7 @@ TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds(const IRoiDescr if(input_coll == nullptr) continue; - createGraphNodes(input_coll, tmpColl, layerIndex, shift_x, shift_y);//TO-DO: if(m_useBeamTilt) SP full transform functor + createGraphNodes(input_coll, tmpColl, vSP, layerIndex, shift_x, shift_y);//TO-DO: if(m_useBeamTilt) SP full transform functor nNewNodes += (isPixel) ? storage->loadPixelGraphNodes(layerIndex, tmpColl, m_useML) : storage->loadStripGraphNodes(layerIndex, tmpColl); } @@ -239,7 +244,7 @@ TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds(const IRoiDescr //backtracking - TrigFTF_GNN_TrackingFilter<const Trk::SpacePoint*> tFilter(m_layerGeometry, edgeStorage); + TrigFTF_GNN_TrackingFilter tFilter(m_layerGeometry, edgeStorage); output.reserve(vSeeds.size()); @@ -247,7 +252,7 @@ TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds(const IRoiDescr if(pS->m_level == -1) continue; - TrigFTF_GNN_EdgeState<const Trk::SpacePoint*> rs(false); + TrigFTF_GNN_EdgeState rs(false); tFilter.followTrack(pS, rs); @@ -275,7 +280,7 @@ TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds(const IRoiDescr output.emplace_back(rs.m_J); for(const auto& n : vN) { - output[lastIdx].addSpacePoint(n->m_pSP); + output[lastIdx].addSpacePoint(vSP[n->m_idx]); } } @@ -470,7 +475,7 @@ TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds(const IRoiDescr nodes.reserve(vSP.size()); - for(unsigned int idx=0;idx<vSP.size();idx++) { + for(unsigned int idx = 0;idx < vSP.size(); idx++) { nodes.emplace_back(vL[idx]); @@ -484,7 +489,7 @@ TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds(const IRoiDescr nodes[idx].m_z = zs; nodes[idx].m_r = std::sqrt(xs*xs + ys*ys); - nodes[idx].m_pSP = vSP[idx]; + nodes[idx].m_idx = idx; } @@ -557,7 +562,7 @@ TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds(const IRoiDescr //backtracking - TrigFTF_GNN_TrackingFilter<const Trk::SpacePoint*> tFilter(m_layerGeometry, edgeStorage); + TrigFTF_GNN_TrackingFilter tFilter(m_layerGeometry, edgeStorage); output.reserve(vSeeds.size()); @@ -565,7 +570,7 @@ TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds(const IRoiDescr if(pS->m_level == -1) continue; - TrigFTF_GNN_EdgeState<const Trk::SpacePoint*> rs(false); + TrigFTF_GNN_EdgeState rs(false); tFilter.followTrack(pS, rs); @@ -593,7 +598,7 @@ TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds(const IRoiDescr output.emplace_back(rs.m_J); for(const auto& n : vN) { - output[lastIdx].addSpacePoint(n->m_pSP); + output[lastIdx].addSpacePoint(vSP[n->m_idx]); } } @@ -604,13 +609,15 @@ TrigInDetTrackSeedingResult TrigInDetTrackSeedingTool::findSeeds(const IRoiDescr } -void TrigInDetTrackSeedingTool::createGraphNodes(const SpacePointCollection* spColl, std::vector<GNN_Node>& tmpColl, unsigned short layer, float shift_x, float shift_y) const { +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 { tmpColl.resize(spColl->size(), GNN_Node(layer));//all nodes belong to the same layer int idx = 0; + int init_size = vSP.size(); for(const auto sp : *spColl) { const auto& pos = sp->globalPosition(); + vSP.emplace_back(sp); float xs = pos.x() - shift_x; float ys = pos.y() - shift_y; float zs = pos.z(); @@ -619,7 +626,7 @@ void TrigInDetTrackSeedingTool::createGraphNodes(const SpacePointCollection* spC tmpColl[idx].m_z = zs; tmpColl[idx].m_r = std::sqrt(xs*xs + ys*ys); tmpColl[idx].m_phi = std::atan2(ys,xs); - tmpColl[idx].m_pSP = sp; + tmpColl[idx].m_idx = init_size + idx; const InDet::PixelCluster* pCL = dynamic_cast<const InDet::PixelCluster*>(sp->clusterList().first); if(pCL != nullptr){ diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigInDetTrackSeedingTool.h b/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigInDetTrackSeedingTool.h index 9291e9fd241d06303eac9e1d769048d55eb10370..567393c32825c9fceebcd200a00e83fa2613ae4d 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigInDetTrackSeedingTool.h +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/TrigInDetTrackSeedingTool.h @@ -6,7 +6,9 @@ #define TRIGINDETPATTRECOTOOLS_TRIGINDETTRACKSEEDINGTOOL_H #include "GaudiKernel/ToolHandle.h" + #include "TrigInDetToolInterfaces/ITrigInDetTrackSeedingTool.h" + #include "AthenaBaseComps/AthAlgTool.h" #include "StoreGate/ReadHandleKey.h" #include <string> @@ -32,7 +34,7 @@ class AtlasDetectorID; class SCT_ID; class PixelID; -class TrigInDetTrackSeedingTool: public SeedingToolBase<const Trk::SpacePoint*>, public ITrigInDetTrackSeedingTool { +class TrigInDetTrackSeedingTool: public SeedingToolBase, public ITrigInDetTrackSeedingTool { public: // standard AlgTool methods @@ -48,7 +50,7 @@ class TrigInDetTrackSeedingTool: public SeedingToolBase<const Trk::SpacePoint*>, protected: - void createGraphNodes(const SpacePointCollection*, std::vector<GNN_Node>&, unsigned short, float, float) const; + void createGraphNodes(const SpacePointCollection*, std::vector<GNN_Node>&, std::vector<const Trk::SpacePoint*>&, unsigned short, float, float) const; SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; diff --git a/Trigger/TrigTools/TrigInDetPattRecoTools/src/components/TrigInDetTrackSeedingTools_entries.cxx b/Trigger/TrigTools/TrigInDetPattRecoTools/src/components/TrigInDetTrackSeedingTools_entries.cxx index 50372084aa1da025184e4d019fddc209a1538a6b..4b78457ecf3c082d6e946dbffa37fd7efb6f938c 100644 --- a/Trigger/TrigTools/TrigInDetPattRecoTools/src/components/TrigInDetTrackSeedingTools_entries.cxx +++ b/Trigger/TrigTools/TrigInDetPattRecoTools/src/components/TrigInDetTrackSeedingTools_entries.cxx @@ -1,4 +1,4 @@ #include "../TrigInDetTrackSeedingTool.h" #include "../Gbts2ActsSeedingTool.h" DECLARE_COMPONENT( TrigInDetTrackSeedingTool ) -DECLARE_COMPONENT( Gbts2ActsSeedingTool ) \ No newline at end of file +DECLARE_COMPONENT( Gbts2ActsSeedingTool )