Skip to content

Commit

Permalink
Fixed include issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed Jan 10, 2025
1 parent ab6a5d6 commit 1a27b2a
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 38 deletions.
43 changes: 43 additions & 0 deletions RecoTracker/LSTCore/interface/Circle.h
Original file line number Diff line number Diff line change
@@ -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 <typename TAcc>
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
2 changes: 2 additions & 0 deletions RecoTracker/LSTCore/src/alpaka/LSTEvent.dev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "LSTEvent.h"

#include "Hit.h"
#include "Kernels.h"
#include "MiniDoublet.h"
#include "PixelQuintuplet.h"
#include "PixelTriplet.h"
Expand Down
4 changes: 1 addition & 3 deletions RecoTracker/LSTCore/src/alpaka/LSTEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
34 changes: 1 addition & 33 deletions RecoTracker/LSTCore/src/alpaka/Triplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -628,39 +629,6 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
return false; // failsafe
}

template <typename TAcc>
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 <typename TAcc>
ALPAKA_FN_ACC ALPAKA_FN_INLINE bool runTripletConstraintsAndAlgo(TAcc const& acc,
ModulesConst modules,
Expand Down
3 changes: 1 addition & 2 deletions RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// to use computeRadiusFromThreeAnchorHits
#include "LSTEvent.h"
#include "Triplet.h"
#include "Circle.h"

#include "write_lst_ntuple.h"

Expand Down

0 comments on commit 1a27b2a

Please sign in to comment.