From 1a27b2a69a751182fc651056d916171e0022d58b Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Fri, 10 Jan 2025 06:54:12 -0800 Subject: [PATCH] Fixed include issues --- RecoTracker/LSTCore/interface/Circle.h | 43 +++++++++++++++++++ .../LSTCore/src/alpaka/LSTEvent.dev.cc | 2 + RecoTracker/LSTCore/src/alpaka/LSTEvent.h | 4 +- RecoTracker/LSTCore/src/alpaka/Triplet.h | 34 +-------------- .../standalone/code/core/write_lst_ntuple.cc | 3 +- 5 files changed, 48 insertions(+), 38 deletions(-) create mode 100644 RecoTracker/LSTCore/interface/Circle.h diff --git a/RecoTracker/LSTCore/interface/Circle.h b/RecoTracker/LSTCore/interface/Circle.h new file mode 100644 index 0000000000000..894c2022895e3 --- /dev/null +++ b/RecoTracker/LSTCore/interface/Circle.h @@ -0,0 +1,43 @@ +#ifndef RecoTracker_LSTCore_interface_Circle_h +#define RecoTracker_LSTCore_interface_Circle_h + +#include "HeterogeneousCore/AlpakaInterface/interface/config.h" + +namespace lst { + + template + ALPAKA_FN_ACC ALPAKA_FN_INLINE float computeRadiusFromThreeAnchorHits( + TAcc const& acc, float x1, float y1, float x2, float y2, float x3, float y3, float& g, float& f) { + float radius = 0.f; + + //(g,f) -> center + //first anchor hit - (x1,y1), second anchor hit - (x2,y2), third anchor hit - (x3, y3) + + float denomInv = 1.0f / ((y1 - y3) * (x2 - x3) - (x1 - x3) * (y2 - y3)); + + float xy1sqr = x1 * x1 + y1 * y1; + + float xy2sqr = x2 * x2 + y2 * y2; + + float xy3sqr = x3 * x3 + y3 * y3; + + g = 0.5f * ((y3 - y2) * xy1sqr + (y1 - y3) * xy2sqr + (y2 - y1) * xy3sqr) * denomInv; + + f = 0.5f * ((x2 - x3) * xy1sqr + (x3 - x1) * xy2sqr + (x1 - x2) * xy3sqr) * denomInv; + + float c = ((x2 * y3 - x3 * y2) * xy1sqr + (x3 * y1 - x1 * y3) * xy2sqr + (x1 * y2 - x2 * y1) * xy3sqr) * denomInv; + + if (((y1 - y3) * (x2 - x3) - (x1 - x3) * (y2 - y3) == 0) || (g * g + f * f - c < 0)) { +#ifdef WARNINGS + printf("three collinear points or FATAL! r^2 < 0!\n"); +#endif + radius = -1.f; + } else + radius = alpaka::math::sqrt(acc, g * g + f * f - c); + + return radius; + } + +} //namespace lst + +#endif diff --git a/RecoTracker/LSTCore/src/alpaka/LSTEvent.dev.cc b/RecoTracker/LSTCore/src/alpaka/LSTEvent.dev.cc index 2b2b75ff2ad84..d5b209ea2382d 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTEvent.dev.cc +++ b/RecoTracker/LSTCore/src/alpaka/LSTEvent.dev.cc @@ -3,6 +3,8 @@ #include "LSTEvent.h" +#include "Hit.h" +#include "Kernels.h" #include "MiniDoublet.h" #include "PixelQuintuplet.h" #include "PixelTriplet.h" diff --git a/RecoTracker/LSTCore/src/alpaka/LSTEvent.h b/RecoTracker/LSTCore/src/alpaka/LSTEvent.h index a883436a11266..7b36c011265a8 100644 --- a/RecoTracker/LSTCore/src/alpaka/LSTEvent.h +++ b/RecoTracker/LSTCore/src/alpaka/LSTEvent.h @@ -15,6 +15,7 @@ #include "RecoTracker/LSTCore/interface/ModulesHostCollection.h" #include "RecoTracker/LSTCore/interface/alpaka/Common.h" #include "RecoTracker/LSTCore/interface/alpaka/LST.h" +#include "RecoTracker/LSTCore/interface/alpaka/HitsDeviceCollection.h" #include "RecoTracker/LSTCore/interface/alpaka/MiniDoubletsDeviceCollection.h" #include "RecoTracker/LSTCore/interface/alpaka/PixelQuintupletsDeviceCollection.h" #include "RecoTracker/LSTCore/interface/alpaka/PixelTripletsDeviceCollection.h" @@ -26,9 +27,6 @@ #include "RecoTracker/LSTCore/interface/alpaka/ObjectRangesDeviceCollection.h" #include "RecoTracker/LSTCore/interface/alpaka/EndcapGeometryDevDeviceCollection.h" -#include "Hit.h" -#include "Kernels.h" - #include "HeterogeneousCore/AlpakaInterface/interface/host.h" namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { diff --git a/RecoTracker/LSTCore/src/alpaka/Triplet.h b/RecoTracker/LSTCore/src/alpaka/Triplet.h index e84fa06a2372c..6b2e2903a5f4a 100644 --- a/RecoTracker/LSTCore/src/alpaka/Triplet.h +++ b/RecoTracker/LSTCore/src/alpaka/Triplet.h @@ -8,6 +8,7 @@ #include "RecoTracker/LSTCore/interface/ModulesSoA.h" #include "RecoTracker/LSTCore/interface/ObjectRangesSoA.h" #include "RecoTracker/LSTCore/interface/TripletsSoA.h" +#include "RecoTracker/LSTCore/interface/Circle.h" #include "Segment.h" #include "MiniDoublet.h" @@ -628,39 +629,6 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst { return false; // failsafe } - template - ALPAKA_FN_ACC ALPAKA_FN_INLINE float computeRadiusFromThreeAnchorHits( - TAcc const& acc, float x1, float y1, float x2, float y2, float x3, float y3, float& g, float& f) { - float radius = 0.f; - - //(g,f) -> center - //first anchor hit - (x1,y1), second anchor hit - (x2,y2), third anchor hit - (x3, y3) - - float denomInv = 1.0f / ((y1 - y3) * (x2 - x3) - (x1 - x3) * (y2 - y3)); - - float xy1sqr = x1 * x1 + y1 * y1; - - float xy2sqr = x2 * x2 + y2 * y2; - - float xy3sqr = x3 * x3 + y3 * y3; - - g = 0.5f * ((y3 - y2) * xy1sqr + (y1 - y3) * xy2sqr + (y2 - y1) * xy3sqr) * denomInv; - - f = 0.5f * ((x2 - x3) * xy1sqr + (x3 - x1) * xy2sqr + (x1 - x2) * xy3sqr) * denomInv; - - float c = ((x2 * y3 - x3 * y2) * xy1sqr + (x3 * y1 - x1 * y3) * xy2sqr + (x1 * y2 - x2 * y1) * xy3sqr) * denomInv; - - if (((y1 - y3) * (x2 - x3) - (x1 - x3) * (y2 - y3) == 0) || (g * g + f * f - c < 0)) { -#ifdef WARNINGS - printf("three collinear points or FATAL! r^2 < 0!\n"); -#endif - radius = -1.f; - } else - radius = alpaka::math::sqrt(acc, g * g + f * f - c); - - return radius; - } - template ALPAKA_FN_ACC ALPAKA_FN_INLINE bool runTripletConstraintsAndAlgo(TAcc const& acc, ModulesConst modules, diff --git a/RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc b/RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc index deed88f833a00..f08b18bdfc2dd 100644 --- a/RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc +++ b/RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc @@ -1,6 +1,5 @@ -// to use computeRadiusFromThreeAnchorHits #include "LSTEvent.h" -#include "Triplet.h" +#include "Circle.h" #include "write_lst_ntuple.h"