From f6a499ce982de422e024bc0b3870793dd5b76813 Mon Sep 17 00:00:00 2001 From: Andres Rios Tascon Date: Mon, 23 Dec 2024 06:56:03 -0800 Subject: [PATCH] Fixed include issues --- .../LSTCore/src/alpaka/LSTEvent.dev.cc | 2 + RecoTracker/LSTCore/src/alpaka/LSTEvent.h | 4 +- .../standalone/code/core/write_lst_ntuple.cc | 38 ++++++++++++++++--- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/RecoTracker/LSTCore/src/alpaka/LSTEvent.dev.cc b/RecoTracker/LSTCore/src/alpaka/LSTEvent.dev.cc index 384961e52277d..10ad11c0a628b 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/standalone/code/core/write_lst_ntuple.cc b/RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc index deed88f833a00..2f13f3fc4c206 100644 --- a/RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc +++ b/RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc @@ -1,11 +1,41 @@ -// to use computeRadiusFromThreeAnchorHits #include "LSTEvent.h" -#include "Triplet.h" #include "write_lst_ntuple.h" using namespace ALPAKA_ACCELERATOR_NAMESPACE::lst; +// copied from Tripelet.h +float computeRadiusFromThreeAnchorHits(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 = sqrt(g * g + f * f - c); + + return radius; +} + //________________________________________________________________________________________________________________________________ void createOutputBranches() { createRequiredOutputBranches(); @@ -673,9 +703,7 @@ void fillT5DNNBranches(LSTEvent* event, unsigned int iT3) { } float g, f; - auto const& devHost = cms::alpakatools::host(); - float radius = computeRadiusFromThreeAnchorHits(devHost, - hitObjects[0].x(), + float radius = computeRadiusFromThreeAnchorHits(hitObjects[0].x(), hitObjects[0].y(), hitObjects[1].x(), hitObjects[1].y(),