Skip to content

Commit da70a36

Browse files
committed
Move to 0.6 Maps + Add pT Runtime Toggle
1 parent 314e95d commit da70a36

File tree

19 files changed

+230
-161
lines changed

19 files changed

+230
-161
lines changed

RecoTracker/LST/plugins/alpaka/LSTProducer.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
3131
consumes<LSTPhase2OTHitsInput>(config.getParameter<edm::InputTag>("phase2OTHitsInput"))},
3232
lstESToken_{esConsumes()},
3333
verbose_(config.getParameter<int>("verbose")),
34+
ptCut_(config.getParameter<bool>("ptCut")),
3435
lstOutputToken_{produces()} {}
3536

3637
void acquire(device::Event const& event, device::EventSetup const& setup) override {
@@ -42,6 +43,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
4243

4344
lst_.run(event.queue(),
4445
verbose_,
46+
ptCut_,
4547
&lstESDeviceData,
4648
pixelSeeds.px(),
4749
pixelSeeds.py(),
@@ -77,6 +79,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
7779
desc.add<edm::InputTag>("pixelSeedInput", edm::InputTag{"lstPixelSeedInputProducer"});
7880
desc.add<edm::InputTag>("phase2OTHitsInput", edm::InputTag{"lstPhase2OTHitsInputProducer"});
7981
desc.add<int>("verbose", 0);
82+
desc.add<float>("ptCut", 0.8);
8083
descriptions.addWithDefaultLabel(desc);
8184
}
8285

@@ -85,6 +88,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
8588
edm::EDGetTokenT<LSTPhase2OTHitsInput> lstPhase2OTHitsInputToken_;
8689
device::ESGetToken<SDL::LSTESDeviceData<SDL::Dev>, TrackerRecoGeometryRecord> lstESToken_;
8790
const int verbose_;
91+
const float ptCut_;
8892
edm::EDPutTokenT<LSTOutput> lstOutputToken_;
8993

9094
SDL::LST<SDL::Acc> lst_;

RecoTracker/LSTCore/interface/alpaka/Constants.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,6 @@ namespace SDL {
9999
return WorkDiv(adjustedBlocks, adjustedThreads, elementsPerThreadArg);
100100
}
101101

102-
// If a compile time flag does not define PT_CUT, default to 0.8 (GeV)
103-
#ifndef PT_CUT
104-
constexpr float PT_CUT = 0.8f;
105-
#endif
106-
107102
const unsigned int MAX_BLOCKS = 80;
108103
const unsigned int MAX_CONNECTED_MODULES = 40;
109104

@@ -129,7 +124,6 @@ namespace SDL {
129124
ALPAKA_STATIC_ACC_MEM_GLOBAL const float k2Rinv1GeVf = (2.99792458e-3 * 3.8) / 2;
130125
ALPAKA_STATIC_ACC_MEM_GLOBAL const float kR1GeVf = 1. / (2.99792458e-3 * 3.8);
131126
ALPAKA_STATIC_ACC_MEM_GLOBAL const float sinAlphaMax = 0.95;
132-
ALPAKA_STATIC_ACC_MEM_GLOBAL const float ptCut = PT_CUT;
133127
ALPAKA_STATIC_ACC_MEM_GLOBAL const float deltaZLum = 15.0;
134128
ALPAKA_STATIC_ACC_MEM_GLOBAL const float pixelPSZpitch = 0.15;
135129
ALPAKA_STATIC_ACC_MEM_GLOBAL const float strip2SZpitch = 5.0;

RecoTracker/LSTCore/interface/alpaka/LST.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ namespace SDL {
2828

2929
void run(QueueAcc& queue,
3030
bool verbose,
31+
float ptCut,
3132
const LSTESDeviceData<Dev>* deviceESData,
3233
const std::vector<float> see_px,
3334
const std::vector<float> see_py,
@@ -72,7 +73,8 @@ namespace SDL {
7273
const std::vector<unsigned int> ph2_detId,
7374
const std::vector<float> ph2_x,
7475
const std::vector<float> ph2_y,
75-
const std::vector<float> ph2_z);
76+
const std::vector<float> ph2_z,
77+
const float ptCut);
7678

7779
void getOutput(SDL::Event<Acc>& event);
7880
std::vector<unsigned int> getHitIdxs(const short trackCandidateType,

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#include "Event.h"
22

3-
void SDL::Event<SDL::Acc>::init(bool verbose) {
3+
void SDL::Event<SDL::Acc>::init(bool verbose, float pt_cut) {
44
addObjects = verbose;
5+
ptCut = pt_cut;
56
hitsInGPU = nullptr;
67
mdsInGPU = nullptr;
78
segmentsInGPU = nullptr;
@@ -440,7 +441,8 @@ void SDL::Event<SDL::Acc>::createMiniDoublets() {
440441
*modulesBuffers_->data(),
441442
*hitsInGPU,
442443
*mdsInGPU,
443-
*rangesInGPU));
444+
*rangesInGPU,
445+
ptCut));
444446

445447
alpaka::enqueue(queue, createMiniDoubletsInGPUv2Task);
446448

@@ -485,7 +487,8 @@ void SDL::Event<SDL::Acc>::createSegmentsWithModuleMap() {
485487
*modulesBuffers_->data(),
486488
*mdsInGPU,
487489
*segmentsInGPU,
488-
*rangesInGPU));
490+
*rangesInGPU,
491+
ptCut));
489492

490493
alpaka::enqueue(queue, createSegmentsInGPUv2Task);
491494

@@ -593,7 +596,8 @@ void SDL::Event<SDL::Acc>::createTriplets() {
593596
*tripletsInGPU,
594597
*rangesInGPU,
595598
alpaka::getPtrNative(index_gpu_buf),
596-
nonZeroModules));
599+
nonZeroModules,
600+
ptCut));
597601

598602
alpaka::enqueue(queue, createTripletsInGPUv2Task);
599603

@@ -871,7 +875,8 @@ void SDL::Event<SDL::Acc>::createPixelTriplets() {
871875
*pixelTripletsInGPU,
872876
alpaka::getPtrNative(connectedPixelSize_dev_buf),
873877
alpaka::getPtrNative(connectedPixelIndex_dev_buf),
874-
nInnerSegments));
878+
nInnerSegments,
879+
ptCut));
875880

876881
alpaka::enqueue(queue, createPixelTripletsInGPUFromMapv2Task);
877882
alpaka::wait(queue);
@@ -950,7 +955,8 @@ void SDL::Event<SDL::Acc>::createQuintuplets() {
950955
*tripletsInGPU,
951956
*quintupletsInGPU,
952957
*rangesInGPU,
953-
nEligibleT5Modules));
958+
nEligibleT5Modules,
959+
ptCut));
954960

955961
alpaka::enqueue(queue, createQuintupletsInGPUv2Task);
956962

@@ -1101,7 +1107,8 @@ void SDL::Event<SDL::Acc>::createPixelQuintuplets() {
11011107
alpaka::getPtrNative(connectedPixelSize_dev_buf),
11021108
alpaka::getPtrNative(connectedPixelIndex_dev_buf),
11031109
nInnerSegments,
1104-
*rangesInGPU));
1110+
*rangesInGPU,
1111+
ptCut));
11051112

11061113
alpaka::enqueue(queue, createPixelQuintupletsInGPUFromMapv2Task);
11071114

RecoTracker/LSTCore/src/alpaka/Event.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ namespace SDL {
3434
Dev devAcc;
3535
DevHost devHost;
3636
bool addObjects;
37+
float ptCut;
3738

3839
std::array<unsigned int, 6> n_hits_by_layer_barrel_;
3940
std::array<unsigned int, 5> n_hits_by_layer_endcap_;
@@ -81,7 +82,7 @@ namespace SDL {
8182
pixelTripletsBuffer<alpaka::DevCpu>* pixelTripletsInCPU;
8283
pixelQuintupletsBuffer<alpaka::DevCpu>* pixelQuintupletsInCPU;
8384

84-
void init(bool verbose);
85+
void init(bool verbose, float pt_cut);
8586

8687
int* superbinCPU;
8788
int8_t* pixelTypeCPU;
@@ -97,7 +98,7 @@ namespace SDL {
9798
public:
9899
// Constructor used for CMSSW integration. Uses an external queue.
99100
template <typename TQueue>
100-
Event(bool verbose, TQueue const& q, const LSTESDeviceData<Dev>* deviceESData)
101+
Event(bool verbose, float pt_cut, TQueue const& q, const LSTESDeviceData<Dev>* deviceESData)
101102
: queue(q),
102103
devAcc(alpaka::getDev(q)),
103104
devHost(cms::alpakatools::host()),
@@ -107,7 +108,7 @@ namespace SDL {
107108
modulesBuffers_(deviceESData->modulesBuffers),
108109
pixelMapping_(deviceESData->pixelMapping),
109110
endcapGeometry_(deviceESData->endcapGeometry) {
110-
init(verbose);
111+
init(verbose, pt_cut);
111112
}
112113
void resetEvent();
113114

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ using XYZVector = ROOT::Math::XYZVector;
1111

1212
void SDL::LST<SDL::Acc>::run(SDL::QueueAcc& queue,
1313
bool verbose,
14+
float ptCut,
1415
const LSTESDeviceData<SDL::Dev>* deviceESData,
1516
const std::vector<float> see_px,
1617
const std::vector<float> see_py,
@@ -31,7 +32,7 @@ void SDL::LST<SDL::Acc>::run(SDL::QueueAcc& queue,
3132
const std::vector<float> ph2_x,
3233
const std::vector<float> ph2_y,
3334
const std::vector<float> ph2_z) {
34-
auto event = SDL::Event<Acc>(verbose, queue, deviceESData);
35+
auto event = SDL::Event<Acc>(verbose, ptCut, queue, deviceESData);
3536
prepareInput(see_px,
3637
see_py,
3738
see_pz,
@@ -50,7 +51,8 @@ void SDL::LST<SDL::Acc>::run(SDL::QueueAcc& queue,
5051
ph2_detId,
5152
ph2_x,
5253
ph2_y,
53-
ph2_z);
54+
ph2_z,
55+
ptCut);
5456

5557
event.addHitToEvent(in_trkX_, in_trkY_, in_trkZ_, in_hitId_, in_hitIdxs_);
5658
event.addPixelSegmentToEvent(in_hitIndices_vec0_,
@@ -190,7 +192,8 @@ void SDL::LST<SDL::Acc>::prepareInput(const std::vector<float> see_px,
190192
const std::vector<unsigned int> ph2_detId,
191193
const std::vector<float> ph2_x,
192194
const std::vector<float> ph2_y,
193-
const std::vector<float> ph2_z) {
195+
const std::vector<float> ph2_z,
196+
const float ptCut) {
194197
unsigned int count = 0;
195198
auto n_see = see_stateTrajGlbPx.size();
196199
std::vector<float> px_vec;
@@ -242,7 +245,7 @@ void SDL::LST<SDL::Acc>::prepareInput(const std::vector<float> see_px,
242245
float eta = p3LH.eta();
243246
float ptErr = see_ptErr[iSeed];
244247

245-
if ((ptIn > 0.8 - 2 * ptErr)) {
248+
if ((ptIn > ptCut - 2 * ptErr)) {
246249
XYZVector r3LH(see_stateTrajGlbX[iSeed], see_stateTrajGlbY[iSeed], see_stateTrajGlbZ[iSeed]);
247250
XYZVector p3PCA(see_px[iSeed], see_py[iSeed], see_pz[iSeed]);
248251
XYZVector r3PCA(calculateR3FromPCA(p3PCA, see_dxy[iSeed], see_dz[iSeed]));
@@ -258,7 +261,7 @@ void SDL::LST<SDL::Acc>::prepareInput(const std::vector<float> see_px,
258261

259262
if (ptIn >= 2.0)
260263
pixtype = 0;
261-
else if (ptIn >= (0.8 - 2 * ptErr) and ptIn < 2.0) {
264+
else if (ptIn >= (ptCut - 2 * ptErr) and ptIn < 2.0) {
262265
if (pixelSegmentDeltaPhiChange >= 0)
263266
pixtype = 1;
264267
else

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ namespace {
4949
std::shared_ptr<SDL::ModuleConnectionMap<SDL::Dev>> moduleConnectionMap) {
5050
// Module orientation information (DrDz or phi angles)
5151
auto endcap_geom =
52-
get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/endcap_orientation.bin");
52+
get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.6/endcap_orientation.bin");
5353
auto tilted_geom = get_absolute_path_after_check_file_exists(
54-
trackLooperDir() + "/data/OT800_IT615_pt0.8/tilted_barrel_orientation.bin");
54+
trackLooperDir() + "/data/OT800_IT615_pt0.6/tilted_barrel_orientation.bin");
5555
// Module connection map (for line segment building)
5656
auto mappath = get_absolute_path_after_check_file_exists(
57-
trackLooperDir() + "/data/OT800_IT615_pt0.8/module_connection_tracing_merged.bin");
57+
trackLooperDir() + "/data/OT800_IT615_pt0.6/module_connection_tracing_merged.bin");
5858

5959
endcapGeometry->load(endcap_geom);
6060
tiltedGeometry->load(tilted_geom);
6161
moduleConnectionMap->load(mappath);
6262

63-
auto pLSMapDir = trackLooperDir() + "/data/OT800_IT615_pt0.8/pixelmap/pLS_map";
63+
auto pLSMapDir = trackLooperDir() + "/data/OT800_IT615_pt0.6/pixelmap/pLS_map";
6464
const std::array<std::string, 4> connects{
6565
{"_layer1_subdet5", "_layer2_subdet5", "_layer1_subdet4", "_layer2_subdet4"}};
6666
std::string path;
@@ -102,7 +102,7 @@ std::unique_ptr<SDL::LSTESDeviceData<SDL::Dev>> SDL::loadAndFillESDevice(SDL::Qu
102102
auto moduleConnectionMap = hostData->moduleConnectionMap;
103103

104104
auto path =
105-
get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.8/sensor_centroids.bin");
105+
get_absolute_path_after_check_file_exists(trackLooperDir() + "/data/OT800_IT615_pt0.6/sensor_centroids.bin");
106106
SDL::loadModulesFromFile(queue,
107107
hostData->mapPLStoLayer.get(),
108108
path.c_str(),

RecoTracker/LSTCore/src/alpaka/MiniDoublet.h

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ namespace SDL {
341341
float rt,
342342
struct SDL::modules& modulesInGPU,
343343
uint16_t& moduleIndex,
344+
float& ptCut,
344345
float dPhi = 0,
345346
float dz = 0) {
346347
// =================================================================
@@ -589,7 +590,8 @@ namespace SDL {
589590
float xUpper,
590591
float yUpper,
591592
float zUpper,
592-
float rtUpper) {
593+
float rtUpper,
594+
float& ptCut) {
593595
if (modulesInGPU.subdets[lowerModuleIndex] == SDL::Barrel) {
594596
return runMiniDoubletDefaultAlgoBarrel(acc,
595597
modulesInGPU,
@@ -613,7 +615,8 @@ namespace SDL {
613615
xUpper,
614616
yUpper,
615617
zUpper,
616-
rtUpper);
618+
rtUpper,
619+
ptCut);
617620
} else {
618621
return runMiniDoubletDefaultAlgoEndcap(acc,
619622
modulesInGPU,
@@ -637,7 +640,8 @@ namespace SDL {
637640
xUpper,
638641
yUpper,
639642
zUpper,
640-
rtUpper);
643+
rtUpper,
644+
ptCut);
641645
}
642646
};
643647

@@ -664,7 +668,8 @@ namespace SDL {
664668
float xUpper,
665669
float yUpper,
666670
float zUpper,
667-
float rtUpper) {
671+
float rtUpper,
672+
float& ptCut) {
668673
bool pass = true;
669674
dz = zLower - zUpper;
670675
const float dzCut = modulesInGPU.moduleType[lowerModuleIndex] == SDL::PS ? 2.f : 10.f;
@@ -679,8 +684,8 @@ namespace SDL {
679684
float miniCut = 0;
680685

681686
miniCut = modulesInGPU.moduleLayerType[lowerModuleIndex] == SDL::Pixel
682-
? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex)
683-
: dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex);
687+
? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex, ptCut)
688+
: dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex, ptCut);
684689

685690
// Cut #2: dphi difference
686691
// Ref to original code: https://github.com/slava77/cms-tkph2-ntuple/blob/184d2325147e6930030d3d1f780136bc2dd29ce6/doubletAnalysis.C#L3085
@@ -798,7 +803,8 @@ namespace SDL {
798803
float xUpper,
799804
float yUpper,
800805
float zUpper,
801-
float rtUpper) {
806+
float rtUpper,
807+
float& ptCut) {
802808
bool pass = true;
803809

804810
// There are series of cuts that applies to mini-doublet in a "endcap" region
@@ -875,8 +881,8 @@ namespace SDL {
875881

876882
float miniCut = 0;
877883
miniCut = modulesInGPU.moduleLayerType[lowerModuleIndex] == SDL::Pixel
878-
? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex, dPhi, dz)
879-
: dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex, dPhi, dz);
884+
? dPhiThreshold(acc, rtLower, modulesInGPU, lowerModuleIndex, ptCut, dPhi, dz)
885+
: dPhiThreshold(acc, rtUpper, modulesInGPU, lowerModuleIndex, ptCut, dPhi, dz);
880886

881887
pass = pass && (alpaka::math::abs(acc, dPhi) < miniCut);
882888
if (not pass)
@@ -899,7 +905,8 @@ namespace SDL {
899905
struct SDL::modules modulesInGPU,
900906
struct SDL::hits hitsInGPU,
901907
struct SDL::miniDoublets mdsInGPU,
902-
struct SDL::objectRanges rangesInGPU) const {
908+
struct SDL::objectRanges rangesInGPU,
909+
float ptCut) const {
903910
auto const globalThreadIdx = alpaka::getIdx<alpaka::Grid, alpaka::Threads>(acc);
904911
auto const gridThreadExtent = alpaka::getWorkDiv<alpaka::Grid, alpaka::Threads>(acc);
905912

@@ -955,7 +962,8 @@ namespace SDL {
955962
xUpper,
956963
yUpper,
957964
zUpper,
958-
rtUpper);
965+
rtUpper,
966+
ptCut);
959967
if (success) {
960968
int totOccupancyMDs =
961969
alpaka::atomicOp<alpaka::AtomicAdd>(acc, &mdsInGPU.totOccupancyMDs[lowerModuleIndex], 1u);

0 commit comments

Comments
 (0)