Skip to content

Commit 1416747

Browse files
committed
Fixed include issues
1 parent 7929700 commit 1416747

File tree

10 files changed

+69
-64
lines changed

10 files changed

+69
-64
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#ifndef RecoTracker_LSTCore_interface_Circle_h
2+
#define RecoTracker_LSTCore_interface_Circle_h
3+
4+
#include <tuple>
5+
6+
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"
7+
8+
namespace lst {
9+
10+
template <typename TAcc>
11+
ALPAKA_FN_ACC ALPAKA_FN_INLINE std::tuple<float, float, float> computeRadiusFromThreeAnchorHits(
12+
TAcc const& acc, float x1, float y1, float x2, float y2, float x3, float y3) {
13+
float radius = 0.f;
14+
15+
//first anchor hit - (x1,y1), second anchor hit - (x2,y2), third anchor hit - (x3, y3)
16+
17+
float denomInv = 1.0f / ((y1 - y3) * (x2 - x3) - (x1 - x3) * (y2 - y3));
18+
19+
float xy1sqr = x1 * x1 + y1 * y1;
20+
21+
float xy2sqr = x2 * x2 + y2 * y2;
22+
23+
float xy3sqr = x3 * x3 + y3 * y3;
24+
25+
float regressionCenterX = 0.5f * ((y3 - y2) * xy1sqr + (y1 - y3) * xy2sqr + (y2 - y1) * xy3sqr) * denomInv;
26+
27+
float regressionCenterY = 0.5f * ((x2 - x3) * xy1sqr + (x3 - x1) * xy2sqr + (x1 - x2) * xy3sqr) * denomInv;
28+
29+
float c = ((x2 * y3 - x3 * y2) * xy1sqr + (x3 * y1 - x1 * y3) * xy2sqr + (x1 * y2 - x2 * y1) * xy3sqr) * denomInv;
30+
31+
if (((y1 - y3) * (x2 - x3) - (x1 - x3) * (y2 - y3) == 0) ||
32+
(regressionCenterX * regressionCenterX + regressionCenterY * regressionCenterY - c < 0)) {
33+
#ifdef WARNINGS
34+
printf("three collinear points or FATAL! r^2 < 0!\n");
35+
#endif
36+
radius = -1.f;
37+
} else
38+
radius =
39+
alpaka::math::sqrt(acc, regressionCenterX * regressionCenterX + regressionCenterY * regressionCenterY - c);
40+
41+
return std::make_tuple(radius, regressionCenterX, regressionCenterY);
42+
}
43+
44+
} //namespace lst
45+
46+
#endif

RecoTracker/LSTCore/src/alpaka/LSTEvent.dev.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
#include "LSTEvent.h"
55

6+
#include "Hit.h"
7+
#include "Kernels.h"
68
#include "MiniDoublet.h"
79
#include "PixelQuintuplet.h"
810
#include "PixelTriplet.h"

RecoTracker/LSTCore/src/alpaka/LSTEvent.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "RecoTracker/LSTCore/interface/ModulesHostCollection.h"
1616
#include "RecoTracker/LSTCore/interface/alpaka/Common.h"
1717
#include "RecoTracker/LSTCore/interface/alpaka/LST.h"
18+
#include "RecoTracker/LSTCore/interface/alpaka/HitsDeviceCollection.h"
1819
#include "RecoTracker/LSTCore/interface/alpaka/MiniDoubletsDeviceCollection.h"
1920
#include "RecoTracker/LSTCore/interface/alpaka/PixelQuintupletsDeviceCollection.h"
2021
#include "RecoTracker/LSTCore/interface/alpaka/PixelTripletsDeviceCollection.h"
@@ -26,9 +27,6 @@
2627
#include "RecoTracker/LSTCore/interface/alpaka/ObjectRangesDeviceCollection.h"
2728
#include "RecoTracker/LSTCore/interface/alpaka/EndcapGeometryDevDeviceCollection.h"
2829

29-
#include "Hit.h"
30-
#include "Kernels.h"
31-
3230
#include "HeterogeneousCore/AlpakaInterface/interface/host.h"
3331

3432
namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {

RecoTracker/LSTCore/src/alpaka/MiniDoublet.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55
#include "FWCore/Utilities/interface/isFinite.h"
66

77
#include "RecoTracker/LSTCore/interface/alpaka/Common.h"
8+
#include "RecoTracker/LSTCore/interface/HitsSoA.h"
89
#include "RecoTracker/LSTCore/interface/MiniDoubletsSoA.h"
910
#include "RecoTracker/LSTCore/interface/alpaka/MiniDoubletsDeviceCollection.h"
1011
#include "RecoTracker/LSTCore/interface/ModulesSoA.h"
1112
#include "RecoTracker/LSTCore/interface/EndcapGeometry.h"
1213
#include "RecoTracker/LSTCore/interface/ObjectRangesSoA.h"
1314

14-
#include "Hit.h"
15-
1615
namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
1716
template <typename TAcc>
1817
ALPAKA_FN_ACC ALPAKA_FN_INLINE void addMDToMemory(TAcc const& acc,

RecoTracker/LSTCore/src/alpaka/PixelQuintuplet.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define RecoTracker_LSTCore_src_alpaka_PixelQuintuplet_h
33

44
#include "RecoTracker/LSTCore/interface/alpaka/Common.h"
5+
#include "RecoTracker/LSTCore/interface/HitsSoA.h"
56
#include "RecoTracker/LSTCore/interface/ModulesSoA.h"
67
#include "RecoTracker/LSTCore/interface/ObjectRangesSoA.h"
78
#include "RecoTracker/LSTCore/interface/MiniDoubletsSoA.h"
@@ -10,7 +11,7 @@
1011
#include "RecoTracker/LSTCore/interface/SegmentsSoA.h"
1112
#include "RecoTracker/LSTCore/interface/TripletsSoA.h"
1213

13-
#include "Hit.h"
14+
#include "Quintuplet.h"
1415
#include "PixelTriplet.h"
1516

1617
namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {

RecoTracker/LSTCore/src/alpaka/Quintuplet.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
#include "RecoTracker/LSTCore/interface/ModulesSoA.h"
1414
#include "RecoTracker/LSTCore/interface/EndcapGeometry.h"
1515
#include "RecoTracker/LSTCore/interface/ObjectRangesSoA.h"
16+
#include "RecoTracker/LSTCore/interface/Circle.h"
1617

1718
#include "NeuralNetwork.h"
18-
#include "Hit.h"
19-
#include "Triplet.h" // FIXME: need to refactor common functions to a common place
2019

2120
namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
2221
ALPAKA_FN_ACC ALPAKA_FN_INLINE void addQuintupletToMemory(TripletsConst triplets,
@@ -1502,7 +1501,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
15021501

15031502
float g, f;
15041503
outerRadius = triplets.radius()[outerTripletIndex];
1505-
bridgeRadius = computeRadiusFromThreeAnchorHits(acc, x2, y2, x3, y3, x4, y4, g, f);
1504+
std::tie(bridgeRadius, g, f) = computeRadiusFromThreeAnchorHits(acc, x2, y2, x3, y3, x4, y4);
15061505
innerRadius = triplets.radius()[innerTripletIndex];
15071506

15081507
bool inference = lst::t5dnn::runInference(acc,

RecoTracker/LSTCore/src/alpaka/Segment.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
#include "RecoTracker/LSTCore/interface/SegmentsSoA.h"
1010
#include "RecoTracker/LSTCore/interface/alpaka/SegmentsDeviceCollection.h"
1111
#include "RecoTracker/LSTCore/interface/ModulesSoA.h"
12+
#include "RecoTracker/LSTCore/interface/HitsSoA.h"
13+
#include "RecoTracker/LSTCore/interface/MiniDoubletsSoA.h"
1214
#include "RecoTracker/LSTCore/interface/EndcapGeometry.h"
1315
#include "RecoTracker/LSTCore/interface/ObjectRangesSoA.h"
1416

15-
#include "MiniDoublet.h"
16-
#include "Hit.h"
17-
1817
namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
1918

2019
ALPAKA_FN_ACC ALPAKA_FN_INLINE bool isTighterTiltedModules_seg(ModulesConst modules, unsigned int moduleIndex) {

RecoTracker/LSTCore/src/alpaka/TrackCandidate.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include "RecoTracker/LSTCore/interface/alpaka/Common.h"
77
#include "RecoTracker/LSTCore/interface/ModulesSoA.h"
8+
#include "RecoTracker/LSTCore/interface/HitsSoA.h"
89
#include "RecoTracker/LSTCore/interface/MiniDoubletsSoA.h"
910
#include "RecoTracker/LSTCore/interface/PixelQuintupletsSoA.h"
1011
#include "RecoTracker/LSTCore/interface/PixelTripletsSoA.h"
@@ -13,8 +14,6 @@
1314
#include "RecoTracker/LSTCore/interface/TrackCandidatesSoA.h"
1415
#include "RecoTracker/LSTCore/interface/TripletsSoA.h"
1516

16-
#include "Hit.h"
17-
1817
namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
1918
ALPAKA_FN_ACC ALPAKA_FN_INLINE void addpLSTrackCandidateToMemory(TrackCandidates& cands,
2019
unsigned int trackletIndex,

RecoTracker/LSTCore/src/alpaka/Triplet.h

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
#include "RecoTracker/LSTCore/interface/ModulesSoA.h"
99
#include "RecoTracker/LSTCore/interface/ObjectRangesSoA.h"
1010
#include "RecoTracker/LSTCore/interface/TripletsSoA.h"
11-
12-
#include "Segment.h"
13-
#include "MiniDoublet.h"
14-
#include "Hit.h"
11+
#include "RecoTracker/LSTCore/interface/Circle.h"
1512

1613
namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
1714

@@ -628,39 +625,6 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
628625
return false; // failsafe
629626
}
630627

631-
template <typename TAcc>
632-
ALPAKA_FN_ACC ALPAKA_FN_INLINE float computeRadiusFromThreeAnchorHits(
633-
TAcc const& acc, float x1, float y1, float x2, float y2, float x3, float y3, float& g, float& f) {
634-
float radius = 0.f;
635-
636-
//(g,f) -> center
637-
//first anchor hit - (x1,y1), second anchor hit - (x2,y2), third anchor hit - (x3, y3)
638-
639-
float denomInv = 1.0f / ((y1 - y3) * (x2 - x3) - (x1 - x3) * (y2 - y3));
640-
641-
float xy1sqr = x1 * x1 + y1 * y1;
642-
643-
float xy2sqr = x2 * x2 + y2 * y2;
644-
645-
float xy3sqr = x3 * x3 + y3 * y3;
646-
647-
g = 0.5f * ((y3 - y2) * xy1sqr + (y1 - y3) * xy2sqr + (y2 - y1) * xy3sqr) * denomInv;
648-
649-
f = 0.5f * ((x2 - x3) * xy1sqr + (x3 - x1) * xy2sqr + (x1 - x2) * xy3sqr) * denomInv;
650-
651-
float c = ((x2 * y3 - x3 * y2) * xy1sqr + (x3 * y1 - x1 * y3) * xy2sqr + (x1 * y2 - x2 * y1) * xy3sqr) * denomInv;
652-
653-
if (((y1 - y3) * (x2 - x3) - (x1 - x3) * (y2 - y3) == 0) || (g * g + f * f - c < 0)) {
654-
#ifdef WARNINGS
655-
printf("three collinear points or FATAL! r^2 < 0!\n");
656-
#endif
657-
radius = -1.f;
658-
} else
659-
radius = alpaka::math::sqrt(acc, g * g + f * f - c);
660-
661-
return radius;
662-
}
663-
664628
template <typename TAcc>
665629
ALPAKA_FN_ACC ALPAKA_FN_INLINE bool runTripletConstraintsAndAlgo(TAcc const& acc,
666630
ModulesConst modules,
@@ -694,7 +658,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
694658
float y2 = mds.anchorY()[secondMDIndex];
695659
float y3 = mds.anchorY()[thirdMDIndex];
696660

697-
circleRadius = computeRadiusFromThreeAnchorHits(acc, x1, y1, x2, y2, x3, y3, circleCenterX, circleCenterY);
661+
std::tie(circleRadius, circleCenterX, circleCenterY) =
662+
computeRadiusFromThreeAnchorHits(acc, x1, y1, x2, y2, x3, y3);
698663

699664
if (not passRZConstraint(acc,
700665
modules,

RecoTracker/LSTCore/standalone/code/core/write_lst_ntuple.cc

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
// to use computeRadiusFromThreeAnchorHits
21
#include "LSTEvent.h"
3-
#include "Triplet.h"
2+
#include "Circle.h"
43

54
#include "write_lst_ntuple.h"
65

@@ -672,17 +671,15 @@ void fillT5DNNBranches(LSTEvent* event, unsigned int iT3) {
672671
ana.tx->pushbackToBranch<int>("t5_t3_" + idx + "_moduleType", modules.moduleType()[module]);
673672
}
674673

675-
float g, f;
674+
float radius;
676675
auto const& devHost = cms::alpakatools::host();
677-
float radius = computeRadiusFromThreeAnchorHits(devHost,
678-
hitObjects[0].x(),
679-
hitObjects[0].y(),
680-
hitObjects[1].x(),
681-
hitObjects[1].y(),
682-
hitObjects[2].x(),
683-
hitObjects[2].y(),
684-
g,
685-
f);
676+
std::tie(radius, std::ignore, std::ignore) = computeRadiusFromThreeAnchorHits(devHost,
677+
hitObjects[0].x(),
678+
hitObjects[0].y(),
679+
hitObjects[1].x(),
680+
hitObjects[1].y(),
681+
hitObjects[2].x(),
682+
hitObjects[2].y());
686683
ana.tx->pushbackToBranch<float>("t5_t3_pt", k2Rinv1GeVf * 2 * radius);
687684

688685
// Angles

0 commit comments

Comments
 (0)