Skip to content

Commit 43d02f3

Browse files
committed
Add low-level information in standalone LST output ntuple
1 parent d403d7a commit 43d02f3

28 files changed

+1232
-448
lines changed

RecoTracker/LST/plugins/alpaka/LSTModulesDevESProducer.cc

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,32 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
2525

2626
private:
2727
edm::ESGetToken<SDL::LSTESHostData<SDL::Dev>, TrackerRecoGeometryRecord> lstESHostToken_;
28+
std::string ptCutLabel_;
2829
};
2930

30-
LSTModulesDevESProducer::LSTModulesDevESProducer(const edm::ParameterSet& iConfig) : ESProducer(iConfig) {
31-
setWhatProduced(this, &LSTModulesDevESProducer::produceHost);
32-
auto cc = setWhatProduced(this, &LSTModulesDevESProducer::produceDevice);
33-
lstESHostToken_ = cc.consumes();
31+
LSTModulesDevESProducer::LSTModulesDevESProducer(const edm::ParameterSet& iConfig)
32+
: ESProducer(iConfig), ptCutLabel_(iConfig.getParameter<std::string>("ptCutLabel")) {
33+
setWhatProduced(this, &LSTModulesDevESProducer::produceHost, ptCutLabel_);
34+
auto cc = setWhatProduced(this, &LSTModulesDevESProducer::produceDevice, ptCutLabel_);
35+
lstESHostToken_ = cc.consumes(edm::ESInputTag("", ptCutLabel_));
3436
}
3537

3638
void LSTModulesDevESProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
3739
edm::ParameterSetDescription desc;
40+
desc.add<std::string>("ptCutLabel", "0.8");
3841
descriptions.addWithDefaultLabel(desc);
3942
}
4043

4144
std::unique_ptr<SDL::LSTESHostData<SDL::Dev>> LSTModulesDevESProducer::produceHost(
4245
TrackerRecoGeometryRecord const& iRecord) {
43-
return SDL::loadAndFillESHost();
46+
return SDL::loadAndFillESHost(ptCutLabel_);
4447
}
4548

4649
std::unique_ptr<SDL::LSTESDeviceData<SDL::Dev>> LSTModulesDevESProducer::produceDevice(
4750
device::Record<TrackerRecoGeometryRecord> const& iRecord) {
4851
auto const& lstESHostData = iRecord.get(lstESHostToken_);
4952
SDL::QueueAcc& queue = iRecord.queue();
50-
return SDL::loadAndFillESDevice(queue, &lstESHostData);
53+
return SDL::loadAndFillESDevice(queue, &lstESHostData, ptCutLabel_);
5154
}
5255

5356
} // namespace ALPAKA_ACCELERATOR_NAMESPACE

RecoTracker/LST/plugins/alpaka/LSTProducer.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,9 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
2929
: lstPixelSeedInputToken_{consumes<LSTPixelSeedInput>(config.getParameter<edm::InputTag>("pixelSeedInput"))},
3030
lstPhase2OTHitsInputToken_{
3131
consumes<LSTPhase2OTHitsInput>(config.getParameter<edm::InputTag>("phase2OTHitsInput"))},
32-
lstESToken_{esConsumes()},
32+
lstESToken_{esConsumes(edm::ESInputTag("", config.getParameter<std::string>("ptCutLabel")))},
3333
verbose_(config.getParameter<bool>("verbose")),
34+
ptCut_(config.getParameter<double>("ptCut")),
3435
nopLSDupClean_(config.getParameter<bool>("nopLSDupClean")),
3536
tcpLSTriplets_(config.getParameter<bool>("tcpLSTriplets")),
3637
lstOutputToken_{produces()} {}
@@ -44,6 +45,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
4445

4546
lst_.run(event.queue(),
4647
verbose_,
48+
static_cast<float>(ptCut_),
4749
&lstESDeviceData,
4850
pixelSeeds.px(),
4951
pixelSeeds.py(),
@@ -81,6 +83,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
8183
desc.add<edm::InputTag>("pixelSeedInput", edm::InputTag{"lstPixelSeedInputProducer"});
8284
desc.add<edm::InputTag>("phase2OTHitsInput", edm::InputTag{"lstPhase2OTHitsInputProducer"});
8385
desc.add<bool>("verbose", false);
86+
desc.add<double>("ptCut", 0.8);
87+
desc.add<std::string>("ptCutLabel", "0.8");
8488
desc.add<bool>("nopLSDupClean", false);
8589
desc.add<bool>("tcpLSTriplets", false);
8690
descriptions.addWithDefaultLabel(desc);
@@ -90,7 +94,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
9094
edm::EDGetTokenT<LSTPixelSeedInput> lstPixelSeedInputToken_;
9195
edm::EDGetTokenT<LSTPhase2OTHitsInput> lstPhase2OTHitsInputToken_;
9296
device::ESGetToken<SDL::LSTESDeviceData<SDL::Dev>, TrackerRecoGeometryRecord> lstESToken_;
93-
const bool verbose_, nopLSDupClean_, tcpLSTriplets_;
97+
const bool verbose_;
98+
const double ptCut_;
99+
const bool nopLSDupClean_;
100+
const bool tcpLSTriplets_;
94101
edm::EDPutTokenT<LSTOutput> lstOutputToken_;
95102

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

RecoTracker/LSTCore/BuildFile.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<use name="boost_header"/>
33
<use name="root"/>
44
<use name="HeterogeneousCore/AlpakaInterface"/>
5-
<flags CXXFLAGS="-DCACHE_ALLOC -DT4FromT3 -DUSE_RZCHI2 -DUSE_T5_DNN -DPT_CUT=0.8 -DDUP_pLS -DDUP_T5 -DDUP_pT5 -DDUP_pT3 -DCrossclean_T5 -DCrossclean_pT3 -Wshadow"/>
5+
<flags CXXFLAGS="-DCACHE_ALLOC -DT4FromT3 -DUSE_RZCHI2 -DUSE_T5_DNN -DDUP_pLS -DDUP_T5 -DDUP_pT5 -DDUP_pT3 -DCrossclean_T5 -DCrossclean_pT3 -Wshadow"/>
66
<flags ALPAKA_BACKENDS="1"/>
77
<export>
88
<lib name="1"/>

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
@@ -23,6 +23,7 @@ namespace SDL {
2323

2424
void run(QueueAcc& queue,
2525
bool verbose,
26+
const float ptCut,
2627
const LSTESDeviceData<Dev>* deviceESData,
2728
const std::vector<float> see_px,
2829
const std::vector<float> see_py,
@@ -69,7 +70,8 @@ namespace SDL {
6970
const std::vector<unsigned int> ph2_detId,
7071
const std::vector<float> ph2_x,
7172
const std::vector<float> ph2_y,
72-
const std::vector<float> ph2_z);
73+
const std::vector<float> ph2_z,
74+
const float ptCut);
7375

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

RecoTracker/LSTCore/interface/alpaka/LSTESData.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,10 @@ namespace SDL {
7272
pixelMapping(pixelMappingIn) {}
7373
};
7474

75-
std::unique_ptr<LSTESHostData<Dev>> loadAndFillESHost();
76-
std::unique_ptr<LSTESDeviceData<Dev>> loadAndFillESDevice(SDL::QueueAcc& queue, const LSTESHostData<Dev>* hostData);
75+
std::unique_ptr<LSTESHostData<Dev>> loadAndFillESHost(std::string& ptCutLabel);
76+
std::unique_ptr<LSTESDeviceData<Dev>> loadAndFillESDevice(SDL::QueueAcc& queue,
77+
const LSTESHostData<Dev>* hostData,
78+
std::string& ptCutLabel);
7779

7880
} // namespace SDL
7981

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

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ void SDL::Event<SDL::Acc>::addPixelSegmentToEvent(std::vector<unsigned int> hitI
265265

266266
SDL::createMDArrayRangesGPU createMDArrayRangesGPU_kernel;
267267
auto const createMDArrayRangesGPUTask(alpaka::createTaskKernel<Acc>(
268-
createMDArrayRangesGPU_workDiv, createMDArrayRangesGPU_kernel, *modulesBuffers_->data(), *rangesInGPU));
268+
createMDArrayRangesGPU_workDiv, createMDArrayRangesGPU_kernel, *modulesBuffers_->data(), *rangesInGPU, ptCut));
269269

270270
alpaka::enqueue(queue, createMDArrayRangesGPUTask);
271271
alpaka::wait(queue);
@@ -299,7 +299,8 @@ void SDL::Event<SDL::Acc>::addPixelSegmentToEvent(std::vector<unsigned int> hitI
299299
createSegmentArrayRanges_kernel,
300300
*modulesBuffers_->data(),
301301
*rangesInGPU,
302-
*mdsInGPU));
302+
*mdsInGPU,
303+
ptCut));
303304

304305
alpaka::enqueue(queue, createSegmentArrayRangesTask);
305306
alpaka::wait(queue);
@@ -409,7 +410,7 @@ void SDL::Event<SDL::Acc>::createMiniDoublets() {
409410

410411
SDL::createMDArrayRangesGPU createMDArrayRangesGPU_kernel;
411412
auto const createMDArrayRangesGPUTask(alpaka::createTaskKernel<Acc>(
412-
createMDArrayRangesGPU_workDiv, createMDArrayRangesGPU_kernel, *modulesBuffers_->data(), *rangesInGPU));
413+
createMDArrayRangesGPU_workDiv, createMDArrayRangesGPU_kernel, *modulesBuffers_->data(), *rangesInGPU, ptCut));
413414

414415
alpaka::enqueue(queue, createMDArrayRangesGPUTask);
415416
alpaka::wait(queue);
@@ -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

@@ -521,7 +524,8 @@ void SDL::Event<SDL::Acc>::createTriplets() {
521524
createTripletArrayRanges_kernel,
522525
*modulesBuffers_->data(),
523526
*rangesInGPU,
524-
*segmentsInGPU));
527+
*segmentsInGPU,
528+
ptCut));
525529

526530
alpaka::enqueue(queue, createTripletArrayRangesTask);
527531
alpaka::wait(queue);
@@ -593,7 +597,8 @@ void SDL::Event<SDL::Acc>::createTriplets() {
593597
*tripletsInGPU,
594598
*rangesInGPU,
595599
alpaka::getPtrNative(index_gpu_buf),
596-
nonZeroModules));
600+
nonZeroModules,
601+
ptCut));
597602

598603
alpaka::enqueue(queue, createTripletsInGPUv2Task);
599604

@@ -872,7 +877,8 @@ void SDL::Event<SDL::Acc>::createPixelTriplets() {
872877
*pixelTripletsInGPU,
873878
alpaka::getPtrNative(connectedPixelSize_dev_buf),
874879
alpaka::getPtrNative(connectedPixelIndex_dev_buf),
875-
nInnerSegments));
880+
nInnerSegments,
881+
ptCut));
876882

877883
alpaka::enqueue(queue, createPixelTripletsInGPUFromMapv2Task);
878884
alpaka::wait(queue);
@@ -913,7 +919,8 @@ void SDL::Event<SDL::Acc>::createQuintuplets() {
913919
createEligibleModulesListForQuintupletsGPU_kernel,
914920
*modulesBuffers_->data(),
915921
*tripletsInGPU,
916-
*rangesInGPU));
922+
*rangesInGPU,
923+
ptCut));
917924

918925
alpaka::enqueue(queue, createEligibleModulesListForQuintupletsGPUTask);
919926
alpaka::wait(queue);
@@ -951,7 +958,8 @@ void SDL::Event<SDL::Acc>::createQuintuplets() {
951958
*tripletsInGPU,
952959
*quintupletsInGPU,
953960
*rangesInGPU,
954-
nEligibleT5Modules));
961+
nEligibleT5Modules,
962+
ptCut));
955963

956964
alpaka::enqueue(queue, createQuintupletsInGPUv2Task);
957965

@@ -1102,7 +1110,8 @@ void SDL::Event<SDL::Acc>::createPixelQuintuplets() {
11021110
alpaka::getPtrNative(connectedPixelSize_dev_buf),
11031111
alpaka::getPtrNative(connectedPixelIndex_dev_buf),
11041112
nInnerSegments,
1105-
*rangesInGPU));
1113+
*rangesInGPU,
1114+
ptCut));
11061115

11071116
alpaka::enqueue(queue, createPixelQuintupletsInGPUFromMapv2Task);
11081117

RecoTracker/LSTCore/src/alpaka/Event.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ namespace SDL {
2525
class Event<SDL::Acc> {
2626
private:
2727
QueueAcc queue;
28+
const float ptCut;
2829
Dev devAcc;
2930
DevHost devHost;
3031
bool addObjects;
@@ -91,8 +92,9 @@ namespace SDL {
9192
public:
9293
// Constructor used for CMSSW integration. Uses an external queue.
9394
template <typename TQueue>
94-
Event(bool verbose, TQueue const& q, const LSTESDeviceData<Dev>* deviceESData)
95+
Event(bool verbose, const float pt_cut, TQueue const& q, const LSTESDeviceData<Dev>* deviceESData)
9596
: queue(q),
97+
ptCut(pt_cut),
9698
devAcc(alpaka::getDev(q)),
9799
devHost(cms::alpakatools::host()),
98100
nModules_(deviceESData->nModules),
@@ -101,6 +103,10 @@ namespace SDL {
101103
modulesBuffers_(deviceESData->modulesBuffers),
102104
pixelMapping_(deviceESData->pixelMapping),
103105
endcapGeometry_(deviceESData->endcapGeometry) {
106+
if (pt_cut < 0.6f) {
107+
throw std::invalid_argument("Minimum pT cut must be at least 0.6 GeV. Provided value: " +
108+
std::to_string(pt_cut));
109+
}
104110
init(verbose);
105111
}
106112
void resetEvent();

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

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

88
void SDL::LST<SDL::Acc>::run(SDL::QueueAcc& queue,
99
bool verbose,
10+
const float ptCut,
1011
const LSTESDeviceData<SDL::Dev>* deviceESData,
1112
const std::vector<float> see_px,
1213
const std::vector<float> see_py,
@@ -29,7 +30,7 @@ void SDL::LST<SDL::Acc>::run(SDL::QueueAcc& queue,
2930
const std::vector<float> ph2_z,
3031
bool no_pls_dupclean,
3132
bool tc_pls_triplets) {
32-
auto event = SDL::Event<Acc>(verbose, queue, deviceESData);
33+
auto event = SDL::Event<Acc>(verbose, ptCut, queue, deviceESData);
3334
prepareInput(see_px,
3435
see_py,
3536
see_pz,
@@ -48,7 +49,8 @@ void SDL::LST<SDL::Acc>::run(SDL::QueueAcc& queue,
4849
ph2_detId,
4950
ph2_x,
5051
ph2_y,
51-
ph2_z);
52+
ph2_z,
53+
ptCut);
5254

5355
event.addHitToEvent(in_trkX_, in_trkY_, in_trkZ_, in_hitId_, in_hitIdxs_);
5456
event.addPixelSegmentToEvent(in_hitIndices_vec0_,
@@ -188,7 +190,8 @@ void SDL::LST<SDL::Acc>::prepareInput(const std::vector<float> see_px,
188190
const std::vector<unsigned int> ph2_detId,
189191
const std::vector<float> ph2_x,
190192
const std::vector<float> ph2_y,
191-
const std::vector<float> ph2_z) {
193+
const std::vector<float> ph2_z,
194+
const float ptCut) {
192195
unsigned int count = 0;
193196
auto n_see = see_stateTrajGlbPx.size();
194197
std::vector<float> px_vec;
@@ -240,7 +243,7 @@ void SDL::LST<SDL::Acc>::prepareInput(const std::vector<float> see_px,
240243
float eta = p3LH.eta();
241244
float ptErr = see_ptErr[iSeed];
242245

243-
if ((ptIn > 0.8 - 2 * ptErr)) {
246+
if ((ptIn > ptCut - 2 * ptErr)) {
244247
XYZVector r3LH(see_stateTrajGlbX[iSeed], see_stateTrajGlbY[iSeed], see_stateTrajGlbZ[iSeed]);
245248
XYZVector p3PCA(see_px[iSeed], see_py[iSeed], see_pz[iSeed]);
246249
XYZVector r3PCA(calculateR3FromPCA(p3PCA, see_dxy[iSeed], see_dz[iSeed]));
@@ -256,7 +259,7 @@ void SDL::LST<SDL::Acc>::prepareInput(const std::vector<float> see_px,
256259

257260
if (ptIn >= 2.0)
258261
pixtype = 0;
259-
else if (ptIn >= (0.8 - 2 * ptErr) and ptIn < 2.0) {
262+
else if (ptIn >= (ptCut - 2 * ptErr) and ptIn < 2.0) {
260263
if (pixelSegmentDeltaPhiChange >= 0)
261264
pixtype = 1;
262265
else

0 commit comments

Comments
 (0)