Skip to content

Commit 1a122d6

Browse files
ariostasVourMa
authored andcommitted
Fixed issues with LST inputs
Moved trackFromSeedFitFailed.h to DataFormats/TrackReco Addressed review comments: cleanup and pinned memory for LSTInputHostCollection
1 parent 354eab8 commit 1a122d6

30 files changed

+339
-353
lines changed

DataFormats/Common/src/classes_def.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,5 @@
207207

208208
<class name="edm::StdArray<short, 4>"/>
209209
<class name="edm::StdArray<unsigned short, 11>"/>
210+
<class name="edm::StdArray<unsigned int, 4>"/>
210211
</lcgdict>

Validation/RecoTrack/interface/trackFromSeedFitFailed.h renamed to DataFormats/TrackReco/interface/trackFromSeedFitFailed.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#ifndef Validation_RecoTrack_trackFomSeedFitFailed_h
2-
#define Validation_RecoTrack_trackFomSeedFitFailed_h
1+
#ifndef DataFormats_TrackReco_trackFomSeedFitFailed_h
2+
#define DataFormats_TrackReco_trackFomSeedFitFailed_h
33

44
#include "DataFormats/TrackReco/interface/Track.h"
55

RecoTracker/LST/plugins/BuildFile.xml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
<use name="TrackingTools/Records"/>
2121
<use name="TrackingTools/TrajectoryState"/>
2222
<use name="TrackingTools/TransientTrackingRecHit"/>
23-
<use name="Validation/RecoTrack"/>
2423
<flags EDM_PLUGIN="1"/>
2524
</library>
2625

2726
<!-- alpaka-based portable plugins -->
2827
<library file="alpaka/*.cc" name="RecoTrackerLSTPluginsPortable">
2928
<use name="alpaka"/>
29+
<use name="DataFormats/TrackReco"/>
30+
<use name="TrackingTools/TrajectoryState"/>
3031
<use name="FWCore/Framework"/>
3132
<use name="FWCore/ParameterSet"/>
3233
<use name="FWCore/Utilities"/>
@@ -35,8 +36,6 @@
3536
<use name="RecoTracker/LST"/>
3637
<use name="RecoTracker/LSTCore"/>
3738
<use name="RecoTracker/Record"/>
38-
<use name="DataFormats/L1TrackTrigger"/>
39-
<use name="Validation/RecoTrack"/>
4039
<flags ALPAKA_BACKENDS="1"/>
4140
<flags EDM_PLUGIN="1"/>
4241
</library>

RecoTracker/LST/plugins/LSTOutputConverter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ void LSTOutputConverter::produce(edm::Event& iEvent, const edm::EventSetup& iSet
137137
outputpTTC.reserve(lstTC_len.size());
138138
outputpLSTC.reserve(lstTC_len.size());
139139

140-
auto OTHits = lstInputHC.const_view<lst::InputHitsSoA>().hits();
140+
auto OTHits = lstInputHC.const_view<lst::HitsBaseSoA>().hits();
141141

142142
LogDebug("LSTOutputConverter") << "lstTC size " << lstTC_len.size();
143143
for (unsigned int i = 0; i < lstTC_len.size(); i++) {

RecoTracker/LST/plugins/alpaka/LSTInputProducer.cc

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
1717
#include "DataFormats/TrackerRecHit2D/interface/SiStripMatchedRecHit2DCollection.h"
1818
#include "DataFormats/TrajectorySeed/interface/TrajectorySeedCollection.h"
19-
#include "Validation/RecoTrack/interface/trackFromSeedFitFailed.h"
19+
#include "DataFormats/TrackReco/interface/trackFromSeedFitFailed.h"
2020
#include "TrackingTools/Records/interface/TransientRecHitRecord.h"
2121
#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h"
2222
#include "TrackingTools/TransientTrackingRecHit/interface/TransientTrackingRecHitBuilder.h"
@@ -42,7 +42,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
4242

4343
const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> mfToken_;
4444
const edm::EDGetTokenT<reco::BeamSpot> beamSpotToken_;
45-
std::vector<edm::EDGetTokenT<edm::View<reco::Track>>> seedTokens_;
45+
const std::vector<edm::EDGetTokenT<edm::View<reco::Track>>> seedTokens_;
4646
const edm::EDPutTokenT<TrajectorySeedCollection> lstPixelSeedsPutToken_;
4747

4848
const edm::EDPutTokenT<lst::LSTInputHostCollection> lstInputPutToken_;
@@ -54,12 +54,11 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
5454
phase2OTRecHitToken_(consumes(iConfig.getParameter<edm::InputTag>("phase2OTRecHits"))),
5555
mfToken_(esConsumes()),
5656
beamSpotToken_(consumes(iConfig.getParameter<edm::InputTag>("beamSpot"))),
57+
seedTokens_(
58+
edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag>>("seedTracks"),
59+
[&](const edm::InputTag& tag) { return consumes<edm::View<reco::Track>>(tag); })),
5760
lstPixelSeedsPutToken_(produces()),
58-
lstInputPutToken_(produces()) {
59-
seedTokens_ =
60-
edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag>>("seedTracks"),
61-
[&](const edm::InputTag& tag) { return consumes<edm::View<reco::Track>>(tag); });
62-
}
61+
lstInputPutToken_(produces()) {}
6362

6463
void LSTInputProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
6564
edm::ParameterSetDescription desc;
@@ -124,9 +123,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
124123
std::vector<std::vector<int>> see_hitIdx;
125124
TrajectorySeedCollection see_seeds;
126125

127-
for (size_t iColl = 0; iColl < seedTokens_.size(); ++iColl) {
128-
// Get seed tokens
129-
auto const& seedToken = seedTokens_[iColl];
126+
for (auto const& seedToken : seedTokens_) {
130127
auto const& seedTracks = iEvent.get(seedToken);
131128

132129
if (seedTracks.empty())
@@ -187,7 +184,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
187184
see_stateTrajGlbPy.push_back(stateGlobal.momentum().y());
188185
see_stateTrajGlbPz.push_back(stateGlobal.momentum().z());
189186
see_q.push_back(seedTrack.charge());
190-
see_hitIdx.push_back(hitIdx);
187+
see_hitIdx.emplace_back(std::move(hitIdx));
191188
see_seeds.push_back(seed);
192189
}
193190
}
@@ -213,7 +210,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
213210
ph2_y,
214211
ph2_z,
215212
ph2_hits,
216-
ptCut_);
213+
ptCut_,
214+
iEvent.queue());
217215

218216
iEvent.emplace(lstInputPutToken_, std::move(lstInputHC));
219217
iEvent.emplace(lstPixelSeedsPutToken_, std::move(see_seeds));

RecoTracker/LSTCore/interface/HitsHostCollection.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
#include "DataFormats/Portable/interface/PortableHostCollection.h"
66

77
namespace lst {
8-
using HitsHostCollection = PortableHostMultiCollection<HitsSoA, HitsRangesSoA>;
8+
using HitsHostCollection = PortableHostMultiCollection<HitsExtendedSoA, HitsRangesSoA>;
99
} // namespace lst
1010
#endif

RecoTracker/LSTCore/interface/HitsSoA.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace lst {
1010

11-
GENERATE_SOA_LAYOUT(HitsSoALayout,
11+
GENERATE_SOA_LAYOUT(HitsExtendedSoALayout,
1212
SOA_COLUMN(uint16_t, moduleIndices),
1313
SOA_COLUMN(float, rts),
1414
SOA_COLUMN(float, phis),
@@ -25,11 +25,11 @@ namespace lst {
2525
SOA_COLUMN(int16_t, hitRangesnLower),
2626
SOA_COLUMN(int16_t, hitRangesnUpper))
2727

28-
using HitsSoA = HitsSoALayout<>;
28+
using HitsExtendedSoA = HitsExtendedSoALayout<>;
2929
using HitsRangesSoA = HitsRangesSoALayout<>;
3030

31-
using Hits = HitsSoA::View;
32-
using HitsConst = HitsSoA::ConstView;
31+
using HitsExtended = HitsExtendedSoA::View;
32+
using HitsExtendedConst = HitsExtendedSoA::ConstView;
3333
using HitsRanges = HitsRangesSoA::View;
3434
using HitsRangesConst = HitsRangesSoA::ConstView;
3535

RecoTracker/LSTCore/interface/LSTInputHostCollection.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@
66
#include "DataFormats/Portable/interface/PortableDeviceCollection.h"
77

88
namespace lst {
9-
// This needs to be PortableHostCollection3 instead of PortableHostMultiCollection for it to work
10-
using LSTInputHostCollection = PortableHostCollection3<InputHitsSoA, InputPixelHitsSoA, InputPixelSeedsSoA>;
9+
using LSTInputHostCollection = PortableHostMultiCollection<HitsBaseSoA, PixelSeedsSoA>;
1110
} // namespace lst
1211

1312
#endif

RecoTracker/LSTCore/interface/LSTInputSoA.h

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace lst {
1414

15-
GENERATE_SOA_LAYOUT(InputHitsSoALayout,
15+
GENERATE_SOA_LAYOUT(HitsBaseSoALayout,
1616
SOA_COLUMN(float, xs),
1717
SOA_COLUMN(float, ys),
1818
SOA_COLUMN(float, zs),
@@ -24,11 +24,9 @@ namespace lst {
2424
#endif
2525
)
2626

27-
GENERATE_SOA_LAYOUT(InputPixelHitsSoALayout,
27+
GENERATE_SOA_LAYOUT(PixelSeedsSoALayout,
2828
SOA_COLUMN(Params_pLS::ArrayUxHits, hitIndices),
29-
SOA_COLUMN(float, deltaPhi))
30-
31-
GENERATE_SOA_LAYOUT(InputPixelSeedsSoALayout,
29+
SOA_COLUMN(float, deltaPhi),
3230
SOA_COLUMN(unsigned int, seedIdx),
3331
SOA_COLUMN(int, charge),
3432
SOA_COLUMN(int, superbin),
@@ -43,16 +41,13 @@ namespace lst {
4341
SOA_COLUMN(float, eta),
4442
SOA_COLUMN(float, phi))
4543

46-
using InputHitsSoA = InputHitsSoALayout<>;
47-
using InputPixelHitsSoA = InputPixelHitsSoALayout<>;
48-
using InputPixelSeedsSoA = InputPixelSeedsSoALayout<>;
44+
using HitsBaseSoA = HitsBaseSoALayout<>;
45+
using PixelSeedsSoA = PixelSeedsSoALayout<>;
4946

50-
using InputHits = InputHitsSoA::View;
51-
using InputHitsConst = InputHitsSoA::ConstView;
52-
using InputPixelHits = InputPixelHitsSoA::View;
53-
using InputPixelHitsConst = InputPixelHitsSoA::ConstView;
54-
using InputPixelSeeds = InputPixelSeedsSoA::View;
55-
using InputPixelSeedsConst = InputPixelSeedsSoA::ConstView;
47+
using HitsBase = HitsBaseSoA::View;
48+
using HitsBaseConst = HitsBaseSoA::ConstView;
49+
using PixelSeeds = PixelSeedsSoA::View;
50+
using PixelSeedsConst = PixelSeedsSoA::ConstView;
5651

5752
} // namespace lst
5853

RecoTracker/LSTCore/interface/LSTPrepareInput.h

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace lst {
2020
return {vx, vy, vz};
2121
}
2222

23+
template <typename TQueue>
2324
inline LSTInputHostCollection prepareInput(std::vector<float> const& see_px,
2425
std::vector<float> const& see_py,
2526
std::vector<float> const& see_pz,
@@ -43,7 +44,8 @@ namespace lst {
4344
#ifndef LST_STANDALONE
4445
std::vector<TrackingRecHit const*> const& ph2_hits,
4546
#endif
46-
float const ptCut) {
47+
float const ptCut,
48+
TQueue const& queue) {
4749
std::vector<float> trkX;
4850
std::vector<float> trkY;
4951
std::vector<float> trkZ;
@@ -199,16 +201,15 @@ namespace lst {
199201
// Build the SoAs
200202
int nHitsOT = ph2_x.size();
201203
int nHitsIT = trkX.size();
202-
int nPixelHits = hitIndices_vec.size();
203204
int nPixelSeeds = ptIn_vec.size();
204205
if (static_cast<unsigned int>(nPixelSeeds) > n_max_pixel_segments_per_module) {
205206
nPixelSeeds = n_max_pixel_segments_per_module;
206207
}
207208

208-
std::array<int, 3> const soa_sizes{{nHitsIT + nHitsOT, nPixelHits, nPixelSeeds}};
209-
LSTInputHostCollection lstInputHC(soa_sizes, cms::alpakatools::host());
209+
std::array<int, 2> const soa_sizes{{nHitsIT + nHitsOT, nPixelSeeds}};
210+
LSTInputHostCollection lstInputHC(soa_sizes, queue);
210211

211-
auto hits = lstInputHC.view<InputHitsSoA>();
212+
auto hits = lstInputHC.view<HitsBaseSoA>();
212213
std::memcpy(hits.xs(), ph2_x.data(), nHitsOT * sizeof(float));
213214
std::memcpy(hits.ys(), ph2_y.data(), nHitsOT * sizeof(float));
214215
std::memcpy(hits.zs(), ph2_z.data(), nHitsOT * sizeof(float));
@@ -227,11 +228,9 @@ namespace lst {
227228

228229
std::memcpy(hits.idxs(), hitIdxs.data(), (nHitsIT + nHitsOT) * sizeof(unsigned int));
229230

230-
auto pixelHits = lstInputHC.view<InputPixelHitsSoA>();
231-
std::memcpy(pixelHits.hitIndices(), hitIndices_vec.data(), nPixelHits * sizeof(Params_pLS::ArrayUxHits));
232-
std::memcpy(pixelHits.deltaPhi(), deltaPhi_vec.data(), nPixelHits * sizeof(float));
233-
234-
auto pixelSeeds = lstInputHC.view<InputPixelSeedsSoA>();
231+
auto pixelSeeds = lstInputHC.view<PixelSeedsSoA>();
232+
std::memcpy(pixelSeeds.hitIndices(), hitIndices_vec.data(), nPixelSeeds * sizeof(Params_pLS::ArrayUxHits));
233+
std::memcpy(pixelSeeds.deltaPhi(), deltaPhi_vec.data(), nPixelSeeds * sizeof(float));
235234
std::memcpy(pixelSeeds.ptIn(), ptIn_vec.data(), nPixelSeeds * sizeof(float));
236235
std::memcpy(pixelSeeds.ptErr(), ptErr_vec.data(), nPixelSeeds * sizeof(float));
237236
std::memcpy(pixelSeeds.px(), px_vec.data(), nPixelSeeds * sizeof(float));

0 commit comments

Comments
 (0)