Skip to content

Commit 9628e8f

Browse files
authored
Merge pull request #46857 from SegmentLinking/CMSSW_14_1_0_pre3_LST_X_LSTCore_realfiles_batch1_devel_rebased
LST algorithm developments accumulated during integration PR
2 parents 15e4fe7 + 8c9753d commit 9628e8f

35 files changed

+3514
-2616
lines changed

RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,23 @@
1313
namespace ALPAKA_ACCELERATOR_NAMESPACE {
1414

1515
class LSTModulesDevESProducer : public ESProducer {
16+
private:
17+
std::string ptCutLabel_;
18+
1619
public:
17-
LSTModulesDevESProducer(edm::ParameterSet const& iConfig) : ESProducer(iConfig) { setWhatProduced(this); }
20+
LSTModulesDevESProducer(edm::ParameterSet const& iConfig)
21+
: ESProducer(iConfig), ptCutLabel_(iConfig.getParameter<std::string>("ptCutLabel")) {
22+
setWhatProduced(this, ptCutLabel_);
23+
}
1824

1925
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
2026
edm::ParameterSetDescription desc;
27+
desc.add<std::string>("ptCutLabel", "0.8");
2128
descriptions.addWithDefaultLabel(desc);
2229
}
2330

2431
std::unique_ptr<lst::LSTESData<DevHost>> produce(TrackerRecoGeometryRecord const& iRecord) {
25-
return lst::loadAndFillESHost();
32+
return lst::loadAndFillESHost(ptCutLabel_);
2633
}
2734
};
2835

RecoTracker/LST/plugins/alpaka/LSTProducer.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
2828
LSTProducer(edm::ParameterSet const& config)
2929
: lstPixelSeedInputToken_{consumes(config.getParameter<edm::InputTag>("pixelSeedInput"))},
3030
lstPhase2OTHitsInputToken_{consumes(config.getParameter<edm::InputTag>("phase2OTHitsInput"))},
31-
lstESToken_{esConsumes()},
31+
lstESToken_{esConsumes(edm::ESInputTag("", config.getParameter<std::string>("ptCutLabel")))},
3232
verbose_(config.getParameter<bool>("verbose")),
33+
ptCut_(config.getParameter<double>("ptCut")),
3334
nopLSDupClean_(config.getParameter<bool>("nopLSDupClean")),
3435
tcpLSTriplets_(config.getParameter<bool>("tcpLSTriplets")),
3536
lstOutputToken_{produces()} {}
@@ -43,6 +44,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
4344

4445
lst_.run(event.queue(),
4546
verbose_,
47+
static_cast<float>(ptCut_),
4648
&lstESDeviceData,
4749
pixelSeeds.px(),
4850
pixelSeeds.py(),
@@ -78,6 +80,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
7880
desc.add<edm::InputTag>("pixelSeedInput", edm::InputTag{"lstPixelSeedInputProducer"});
7981
desc.add<edm::InputTag>("phase2OTHitsInput", edm::InputTag{"lstPhase2OTHitsInputProducer"});
8082
desc.add<bool>("verbose", false);
83+
desc.add<double>("ptCut", 0.8);
84+
desc.add<std::string>("ptCutLabel", "0.8");
8185
desc.add<bool>("nopLSDupClean", false);
8286
desc.add<bool>("tcpLSTriplets", false);
8387
descriptions.addWithDefaultLabel(desc);
@@ -87,7 +91,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
8791
edm::EDGetTokenT<LSTPixelSeedInput> lstPixelSeedInputToken_;
8892
edm::EDGetTokenT<LSTPhase2OTHitsInput> lstPhase2OTHitsInputToken_;
8993
device::ESGetToken<lst::LSTESData<Device>, TrackerRecoGeometryRecord> lstESToken_;
90-
const bool verbose_, nopLSDupClean_, tcpLSTriplets_;
94+
const bool verbose_;
95+
const double ptCut_;
96+
const bool nopLSDupClean_;
97+
const bool tcpLSTriplets_;
9198
edm::EDPutTokenT<LSTOutput> lstOutputToken_;
9299

93100
lst::LST lst_;

RecoTracker/LSTCore/BuildFile.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<use name="boost_header"/>
33
<use name="root"/>
44
<use name="HeterogeneousCore/AlpakaInterface"/>
5-
<flags CXXFLAGS="-DPT_CUT=0.8"/>
65
<use name="RecoTracker/LSTCore" for="alpaka"/>
76
<flags ALPAKA_BACKENDS="1"/>
87
<export>

RecoTracker/LSTCore/interface/Common.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ namespace lst {
2020
// Named types for LST objects
2121
enum LSTObjType { T5 = 4, pT3 = 5, pT5 = 7, pLS = 8 };
2222

23-
// If a compile time flag does not define PT_CUT, default to 0.8 (GeV)
24-
#ifndef PT_CUT
25-
constexpr float PT_CUT = 0.8f;
26-
#endif
27-
2823
constexpr unsigned int max_blocks = 80;
2924
constexpr unsigned int max_connected_modules = 40;
3025

RecoTracker/LSTCore/interface/LSTESData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace lst {
4040
pixelMapping(pixelMappingIn) {}
4141
};
4242

43-
std::unique_ptr<LSTESData<alpaka_common::DevHost>> loadAndFillESHost();
43+
std::unique_ptr<LSTESData<alpaka_common::DevHost>> loadAndFillESHost(std::string& ptCutLabel);
4444

4545
} // namespace lst
4646

RecoTracker/LSTCore/interface/QuintupletsSoA.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ namespace lst {
2828
SOA_COLUMN(float, regressionF),
2929
SOA_COLUMN(float, rzChiSquared), // r-z only chi2
3030
SOA_COLUMN(float, chiSquared),
31-
SOA_COLUMN(float, nonAnchorChiSquared));
31+
SOA_COLUMN(float, nonAnchorChiSquared),
32+
SOA_COLUMN(float, dBeta1),
33+
SOA_COLUMN(float, dBeta2));
3234

3335
using QuintupletsSoA = QuintupletsSoALayout<>;
3436
using Quintuplets = QuintupletsSoA::View;

RecoTracker/LSTCore/interface/alpaka/Common.h

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
4949
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float k2Rinv1GeVf = (2.99792458e-3 * 3.8) / 2;
5050
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kR1GeVf = 1. / (2.99792458e-3 * 3.8);
5151
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kSinAlphaMax = 0.95;
52-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float ptCut = PT_CUT;
5352
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kDeltaZLum = 15.0;
5453
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kPixelPSZpitch = 0.15;
5554
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kStripPSZpitch = 2.4;
@@ -60,22 +59,27 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
6059
// To be updated with std::numeric_limits<float>::infinity() in the code and data files
6160
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kVerticalModuleSlope = 123456789.0;
6261

63-
namespace t5dnn {
64-
65-
// Working points matching LST fake rate (43.9%) or signal acceptance (82.0%)
66-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kLSTWp1 = 0.3418833f; // 94.0% TPR, 43.9% FPR
67-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kLSTWp2 = 0.6177366f; // 82.0% TPR, 20.0% FPR
68-
// Other working points
69-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kWp70 = 0.7776195f; // 70.0% TPR, 10.0% FPR
70-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kWp75 = 0.7181118f; // 75.0% TPR, 13.5% FPR
71-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kWp80 = 0.6492643f; // 80.0% TPR, 17.9% FPR
72-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kWp85 = 0.5655319f; // 85.0% TPR, 23.8% FPR
73-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kWp90 = 0.4592205f; // 90.0% TPR, 32.6% FPR
74-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kWp95 = 0.3073708f; // 95.0% TPR, 47.7% FPR
75-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kWp97p5 = 0.2001348f; // 97.5% TPR, 61.2% FPR
76-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kWp99 = 0.1120605f; // 99.0% TPR, 75.9% FPR
77-
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kWp99p9 = 0.0218196f; // 99.9% TPR, 95.4% FPR
62+
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMiniDeltaTilted[3] = {0.26f, 0.26f, 0.26f};
63+
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMiniDeltaFlat[6] = {0.26f, 0.16f, 0.16f, 0.18f, 0.18f, 0.18f};
64+
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMiniDeltaLooseTilted[3] = {0.4f, 0.4f, 0.4f};
65+
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kMiniDeltaEndcap[5][15] = {
66+
{0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, /*10*/ 0.18f, 0.18f, 0.18f, 0.18f, 0.18f},
67+
{0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, /*10*/ 0.18f, 0.18f, 0.18f, 0.18f, 0.18f},
68+
{0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.18f, 0.18f, /*10*/ 0.18f, 0.18f, 0.18f, 0.18f, 0.18f},
69+
{0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.18f, 0.18f, /*10*/ 0.18f, 0.18f, 0.18f, 0.18f, 0.18f},
70+
{0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.18f, /*10*/ 0.18f, 0.18f, 0.18f, 0.18f, 0.18f}};
7871

72+
namespace t5dnn {
73+
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kZ_max = 267.2349854f;
74+
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kR_max = 110.1099396f;
75+
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kEta_norm = 2.5f;
76+
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kPhi_norm = kPi;
77+
// pt, eta binned
78+
constexpr unsigned int kPtBins = 2;
79+
constexpr unsigned int kEtaBins = 10;
80+
ALPAKA_STATIC_ACC_MEM_GLOBAL constexpr float kWp[kPtBins][kEtaBins] = {
81+
{0.4493, 0.4939, 0.5715, 0.6488, 0.5709, 0.5938, 0.7164, 0.7565, 0.8103, 0.8593},
82+
{0.4488, 0.4448, 0.5067, 0.5929, 0.4836, 0.4112, 0.4968, 0.4403, 0.5597, 0.5067}};
7983
} // namespace t5dnn
8084

8185
} // namespace ALPAKA_ACCELERATOR_NAMESPACE::lst

RecoTracker/LSTCore/interface/alpaka/LST.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
1717

1818
void run(Queue& queue,
1919
bool verbose,
20+
const float ptCut,
2021
LSTESData<Device> const* deviceESData,
2122
std::vector<float> const& see_px,
2223
std::vector<float> const& see_py,
@@ -63,7 +64,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
6364
std::vector<unsigned int> const& ph2_detId,
6465
std::vector<float> const& ph2_x,
6566
std::vector<float> const& ph2_y,
66-
std::vector<float> const& ph2_z);
67+
std::vector<float> const& ph2_z,
68+
const float ptCut);
6769

6870
void getOutput(LSTEvent& event);
6971

RecoTracker/LSTCore/src/LSTESData.cc

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@
1010

1111
namespace {
1212
std::string geometryDataDir() {
13-
const char* path_lst_base = std::getenv("LST_BASE");
13+
std::string path_str, path;
1414
const char* path_tracklooperdir = std::getenv("TRACKLOOPERDIR");
15-
std::string path_str;
16-
if (path_lst_base != nullptr) {
17-
path_str = path_lst_base;
18-
} else if (path_tracklooperdir != nullptr) {
15+
std::stringstream search_path;
16+
search_path << std::getenv("CMSSW_SEARCH_PATH");
17+
18+
while (std::getline(search_path, path, ':')) {
19+
if (std::filesystem::exists(path + "/RecoTracker/LSTCore/data")) {
20+
path_str = path;
21+
break;
22+
}
23+
}
24+
25+
if (path_str.empty()) {
1926
path_str = path_tracklooperdir;
20-
path_str += "/../";
27+
path_str += "/..";
2128
} else {
22-
std::stringstream search_path(std::getenv("CMSSW_SEARCH_PATH"));
23-
std::string path;
24-
while (std::getline(search_path, path, ':')) {
25-
if (std::filesystem::exists(path + "/RecoTracker/LSTCore/data")) {
26-
path_str = path;
27-
break;
28-
}
29-
}
3029
path_str += "/RecoTracker/LSTCore";
3130
}
31+
3232
return path_str;
3333
}
3434

@@ -43,21 +43,22 @@ namespace {
4343
void loadMapsHost(lst::MapPLStoLayer& pLStoLayer,
4444
lst::EndcapGeometry& endcapGeometry,
4545
lst::TiltedGeometry& tiltedGeometry,
46-
lst::ModuleConnectionMap& moduleConnectionMap) {
46+
lst::ModuleConnectionMap& moduleConnectionMap,
47+
std::string& ptCutLabel) {
4748
// Module orientation information (DrDz or phi angles)
48-
auto endcap_geom =
49-
get_absolute_path_after_check_file_exists(geometryDataDir() + "/data/OT800_IT615_pt0.8/endcap_orientation.bin");
50-
auto tilted_geom = get_absolute_path_after_check_file_exists(
51-
geometryDataDir() + "/data/OT800_IT615_pt0.8/tilted_barrel_orientation.bin");
49+
auto endcap_geom = get_absolute_path_after_check_file_exists(geometryDataDir() + "/data/OT800_IT615_pt" +
50+
ptCutLabel + "/endcap_orientation.bin");
51+
auto tilted_geom = get_absolute_path_after_check_file_exists(geometryDataDir() + "/data/OT800_IT615_pt" +
52+
ptCutLabel + "/tilted_barrel_orientation.bin");
5253
// Module connection map (for line segment building)
53-
auto mappath = get_absolute_path_after_check_file_exists(
54-
geometryDataDir() + "/data/OT800_IT615_pt0.8/module_connection_tracing_merged.bin");
54+
auto mappath = get_absolute_path_after_check_file_exists(geometryDataDir() + "/data/OT800_IT615_pt" + ptCutLabel +
55+
"/module_connection_tracing_merged.bin");
5556

5657
endcapGeometry.load(endcap_geom);
5758
tiltedGeometry.load(tilted_geom);
5859
moduleConnectionMap.load(mappath);
5960

60-
auto pLSMapDir = geometryDataDir() + "/data/OT800_IT615_pt0.8/pixelmap/pLS_map";
61+
auto pLSMapDir = geometryDataDir() + "/data/OT800_IT615_pt" + ptCutLabel + "/pixelmap/pLS_map";
6162
const std::array<std::string, 4> connects{
6263
{"_layer1_subdet5", "_layer2_subdet5", "_layer1_subdet4", "_layer2_subdet4"}};
6364
std::string path;
@@ -78,7 +79,7 @@ namespace {
7879
}
7980
} // namespace
8081

81-
std::unique_ptr<lst::LSTESData<alpaka_common::DevHost>> lst::loadAndFillESHost() {
82+
std::unique_ptr<lst::LSTESData<alpaka_common::DevHost>> lst::loadAndFillESHost(std::string& ptCutLabel) {
8283
uint16_t nModules;
8384
uint16_t nLowerModules;
8485
unsigned int nPixels;
@@ -87,7 +88,7 @@ std::unique_ptr<lst::LSTESData<alpaka_common::DevHost>> lst::loadAndFillESHost()
8788
TiltedGeometry tiltedGeometry;
8889
PixelMap pixelMapping;
8990
ModuleConnectionMap moduleConnectionMap;
90-
::loadMapsHost(pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap);
91+
::loadMapsHost(pLStoLayer, endcapGeometry, tiltedGeometry, moduleConnectionMap, ptCutLabel);
9192

9293
auto endcapGeometryDev =
9394
std::make_shared<EndcapGeometryDevHostCollection>(endcapGeometry.nEndCapMap, cms::alpakatools::host());
@@ -98,8 +99,8 @@ std::unique_ptr<lst::LSTESData<alpaka_common::DevHost>> lst::loadAndFillESHost()
9899
endcapGeometry.geoMapPhi_buf.data(),
99100
endcapGeometry.nEndCapMap * sizeof(float));
100101

101-
auto path =
102-
get_absolute_path_after_check_file_exists(geometryDataDir() + "/data/OT800_IT615_pt0.8/sensor_centroids.bin");
102+
auto path = get_absolute_path_after_check_file_exists(geometryDataDir() + "/data/OT800_IT615_pt" + ptCutLabel +
103+
"/sensor_centroids.bin");
103104
auto modulesBuffers = lst::loadModulesFromFile(pLStoLayer,
104105
path.c_str(),
105106
nModules,

RecoTracker/LSTCore/src/alpaka/Kernels.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,22 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
217217

218218
for (unsigned int ix1 = 0; ix1 < nQuintuplets_lowmod1; ix1 += 1) {
219219
unsigned int ix = quintupletModuleIndices_lowmod1 + ix1;
220-
if (quintuplets.partOfPT5()[ix] || (quintuplets.isDup()[ix] & 1))
220+
if (quintuplets.isDup()[ix] & 1)
221221
continue;
222222

223+
bool isPT5_ix = quintuplets.partOfPT5()[ix];
224+
223225
for (unsigned int jx1 = 0; jx1 < nQuintuplets_lowmod2; jx1++) {
224226
unsigned int jx = quintupletModuleIndices_lowmod2 + jx1;
225227
if (ix == jx)
226228
continue;
227229

228-
if (quintuplets.partOfPT5()[jx] || (quintuplets.isDup()[jx] & 1))
230+
if (quintuplets.isDup()[jx] & 1)
231+
continue;
232+
233+
bool isPT5_jx = quintuplets.partOfPT5()[jx];
234+
235+
if (isPT5_ix && isPT5_jx)
229236
continue;
230237

231238
float eta1 = __H2F(quintuplets.eta()[ix]);
@@ -249,9 +256,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::lst {
249256
int nMatched = checkHitsT5(ix, jx, quintuplets);
250257
const int minNHitsForDup_T5 = 5;
251258
if (dR2 < 0.001f || nMatched >= minNHitsForDup_T5) {
252-
if (score_rphisum1 > score_rphisum2) {
259+
if (isPT5_jx || score_rphisum1 > score_rphisum2) {
253260
rmQuintupletFromMemory(quintuplets, ix, true);
254-
} else if (score_rphisum1 < score_rphisum2) {
261+
} else if (isPT5_ix || score_rphisum1 < score_rphisum2) {
255262
rmQuintupletFromMemory(quintuplets, jx, true);
256263
} else {
257264
rmQuintupletFromMemory(quintuplets, (ix < jx ? ix : jx), true);

0 commit comments

Comments
 (0)