From cad9190bccc7ccaa73c8bd41ac4c904132414f02 Mon Sep 17 00:00:00 2001 From: Rosie-Hasan Date: Fri, 18 Aug 2023 11:42:30 +0100 Subject: [PATCH] More tidying --- Core/include/Acts/Seeding/GNN_DataStorage.hpp | 81 +++++++++---------- .../python/acts/examples/reconstruction.py | 4 - 2 files changed, 38 insertions(+), 47 deletions(-) diff --git a/Core/include/Acts/Seeding/GNN_DataStorage.hpp b/Core/include/Acts/Seeding/GNN_DataStorage.hpp index 48dcf885e4e..8094f27b56d 100644 --- a/Core/include/Acts/Seeding/GNN_DataStorage.hpp +++ b/Core/include/Acts/Seeding/GNN_DataStorage.hpp @@ -1,20 +1,19 @@ #include "Acts/Definitions/Algebra.hpp" +#include "Acts/Seeding/GNN_Geometry.hpp" #include #include #include -#include "Acts/Seeding/GNN_Geometry.hpp" - namespace Acts { -constexpr size_t MAX_SEG_PER_NODE = 1000; // was 30 -constexpr size_t N_SEG_CONNS = 6; // was 6 +constexpr size_t MAX_SEG_PER_NODE = 1000; // was 30 +constexpr size_t N_SEG_CONNS = 6; // was 6 -template class TrigFTF_GNN_Node { -public: +template +class TrigFTF_GNN_Node { + public: struct CompareByPhi { - bool operator()(const TrigFTF_GNN_Node *n1, const TrigFTF_GNN_Node *n2) { // return n1->m_sp.phi() < n2->m_sp.phi(); @@ -59,13 +58,14 @@ template class TrigFTF_GNN_Node { const space_point_t &m_sp; - std::vector m_in; // indices of the edges in the edge storage + std::vector m_in; // indices of the edges in the edge storage std::vector m_out; float m_minCutOnTau, m_maxCutOnTau; }; -template class TrigFTF_GNN_EtaBin { -public: +template +class TrigFTF_GNN_EtaBin { + public: TrigFTF_GNN_EtaBin() { m_vn.clear(); } ~TrigFTF_GNN_EtaBin() { @@ -85,9 +85,7 @@ template class TrigFTF_GNN_EtaBin { bool empty() const { return m_vn.empty(); } void generatePhiIndexing(float dphi) { - for (unsigned int nIdx = 0; nIdx < m_vn.size(); nIdx++) { - TrigFTF_GNN_Node *pN = m_vn.at(nIdx); // float phi = pN->m_sp.phi(); float phi = (std::atan(pN->m_sp.x() / pN->m_sp.y())); @@ -120,32 +118,32 @@ template class TrigFTF_GNN_EtaBin { std::vector> m_vPhiNodes; }; // new sp struct -template struct FTF_SP { - const space_point_t *SP; // want inside to have pointer +template +struct FTF_SP { + const space_point_t *SP; // want inside to have pointer int FTF_ID; int combined_ID; FTF_SP(const space_point_t *sp, int id, int combined_id) : SP(sp), FTF_ID(id), combined_ID{combined_id} {}; }; -template class TrigFTF_GNN_DataStorage { -public: +template +class TrigFTF_GNN_DataStorage { + public: TrigFTF_GNN_DataStorage(const TrigFTF_GNN_Geometry &g) : m_geo(g) { m_etaBins.reserve(g.num_bins()); for (int k = 0; k < g.num_bins(); k++) { - m_etaBins.emplace_back( - TrigFTF_GNN_EtaBin()); // usde to be push + m_etaBins.emplace_back(TrigFTF_GNN_EtaBin()); } } ~TrigFTF_GNN_DataStorage() {} int addSpacePoint(const FTF_SP &sp, bool useClusterWidth) { - // found needed to search by key which is the combined ID const TrigFTF_GNN_Layer *pL = - m_geo.getTrigFTF_GNN_LayerByKey(sp.combined_ID); // want combined ID + m_geo.getTrigFTF_GNN_LayerByKey(sp.combined_ID); // want combined ID if (pL == nullptr) return -1; @@ -161,14 +159,13 @@ template class TrigFTF_GNN_DataStorage { if (isBarrel) { float min_tau = -100.0; float max_tau = 100.0; - // //cant do this bit yet as dont have cluster width, these loops just - // change the values on tau + // cant do this bit yet as dont have cluster width if (useClusterWidth) { - // // const Trk::SpacePoint* osp = sp.offlineSpacePoint(); - // // const InDet::PixelCluster* pCL = dynamic_cast(osp->clusterList().first); - // // float cluster_width = pCL->width().widthPhiRZ().y(); - float cluster_width = 1; // temporary while cluster width not available + // float cluster_width = pCL->width().widthPhiRZ().y(); + float cluster_width = 1; // temporary while cluster width not available min_tau = 6.7 * (cluster_width - 0.2); max_tau = 1.6 + 0.15 / (cluster_width + 0.2) + 6.1 * (cluster_width - 0.2); @@ -178,17 +175,16 @@ template class TrigFTF_GNN_DataStorage { new TrigFTF_GNN_Node(*sp.SP, min_tau, max_tau)); } else { if (useClusterWidth) { - // // const Trk::SpacePoint* osp = sp.offlineSpacePoint(); - // // const InDet::PixelCluster* pCL = dynamic_cast(osp->clusterList().first); - // // float cluster_width = pCL->width().widthPhiRZ().y(); - float cluster_width = 1; // temporary while cluster width not available + // float cluster_width = pCL->width().widthPhiRZ().y(); + float cluster_width = 1; // temporary while cluster width not available if (cluster_width > 0.2) return -3; } - m_etaBins.at(binIndex).m_vn.push_back(new TrigFTF_GNN_Node( - *sp.SP)); // add template here? add , min_tau, max_tau here for - // constructor + m_etaBins.at(binIndex).m_vn.push_back( + new TrigFTF_GNN_Node(*sp.SP)); } return 0; @@ -199,7 +195,6 @@ template class TrigFTF_GNN_DataStorage { TrigFTF_GNN_DataStorage &operator=(const TrigFTF_GNN_DataStorage &) = delete; unsigned int numberOfNodes() const { - unsigned int n = 0; for (auto &b : m_etaBins) { @@ -208,9 +203,8 @@ template class TrigFTF_GNN_DataStorage { return n; } - void - getConnectingNodes(std::vector *> &vn) { - + void getConnectingNodes( + std::vector *> &vn) { vn.clear(); vn.reserve(numberOfNodes()); @@ -244,16 +238,17 @@ template class TrigFTF_GNN_DataStorage { return m_etaBins.at(idx); } -protected: + protected: const TrigFTF_GNN_Geometry &m_geo; std::vector> m_etaBins; }; -template class TrigFTF_GNN_Edge { -public: +template +class TrigFTF_GNN_Edge { + public: struct CompareLevel { - public: + public: bool operator()(const TrigFTF_GNN_Edge *pS1, const TrigFTF_GNN_Edge *pS2) { return pS1->m_level > pS2->m_level; } @@ -282,7 +277,7 @@ template class TrigFTF_GNN_Edge { unsigned char m_nNei{0}; float m_p[4]{}; - unsigned int m_vNei[N_SEG_CONNS]{}; // global indices of the connected edges + unsigned int m_vNei[N_SEG_CONNS]{}; // global indices of the connected edges }; -} // namespace Acts +} // namespace Acts diff --git a/Examples/Python/python/acts/examples/reconstruction.py b/Examples/Python/python/acts/examples/reconstruction.py index a3246eafb52..44a36267893 100644 --- a/Examples/Python/python/acts/examples/reconstruction.py +++ b/Examples/Python/python/acts/examples/reconstruction.py @@ -759,9 +759,6 @@ def addHoughTransformSeeding( logLevel = acts.examples.defaultLogging(sequence, logLevel)() ht = acts.examples.HoughTransformSeeder(config=config, level=logLevel) sequence.addAlgorithm(ht) -#potentially HT can be extended to also produce seeds, \ - but it is not yet implemented yet -#configuration option(outputSeeds) exists return config.outputProtoTracks, "" def addFTFSeeding( @@ -817,7 +814,6 @@ def addFTFSeeding( numSeedIncrement=seedFilterConfigArg.numSeedIncrement, seedWeightIncrement=seedFilterConfigArg.seedWeightIncrement, seedConfirmation=seedFilterConfigArg.seedConfirmation, -#curvatureSortingInFilter = seedFilterConfigArg.curvatureSortingInFilter, maxSeedsPerSpMConf=seedFilterConfigArg.maxSeedsPerSpMConf, maxQualitySeedsPerSpMConf=seedFilterConfigArg.maxQualitySeedsPerSpMConf, useDeltaRorTopRadius=seedFilterConfigArg.useDeltaRorTopRadius,