Skip to content

Commit

Permalink
Merge pull request #85 from SegmentLinking/CMSSW_14_1_0_pre3_LST_X_LS…
Browse files Browse the repository at this point in the history
…TCore_realfiles_smallFixesPostBatch5

Small fixes post batch 5
  • Loading branch information
slava77 authored Aug 28, 2024
2 parents 9713499 + 24f587e commit f245be0
Show file tree
Hide file tree
Showing 21 changed files with 129 additions and 318 deletions.
30 changes: 14 additions & 16 deletions RecoTracker/LST/plugins/LSTOutputConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@ class LSTOutputConverter : public edm::global::EDProducer<> {
};

LSTOutputConverter::LSTOutputConverter(edm::ParameterSet const& iConfig)
: lstOutputToken_(consumes<LSTOutput>(iConfig.getParameter<edm::InputTag>("lstOutput"))),
lstPhase2OTHitsInputToken_{consumes<LSTPhase2OTHitsInput>(iConfig.getParameter<edm::InputTag>("phase2OTHits"))},
lstPixelSeedToken_{consumes<TrajectorySeedCollection>(iConfig.getParameter<edm::InputTag>("lstPixelSeeds"))},
: lstOutputToken_(consumes(iConfig.getParameter<edm::InputTag>("lstOutput"))),
lstPhase2OTHitsInputToken_{consumes(iConfig.getParameter<edm::InputTag>("phase2OTHits"))},
lstPixelSeedToken_{consumes(iConfig.getParameter<edm::InputTag>("lstPixelSeeds"))},
includeT5s_(iConfig.getParameter<bool>("includeT5s")),
includeNonpLSTSs_(iConfig.getParameter<bool>("includeNonpLSTSs")),
mfToken_(esConsumes()),
propagatorAlongToken_{
esConsumes<Propagator, TrackingComponentsRecord>(iConfig.getParameter<edm::ESInputTag>("propagatorAlong"))},
propagatorOppositeToken_{esConsumes<Propagator, TrackingComponentsRecord>(
iConfig.getParameter<edm::ESInputTag>("propagatorOpposite"))},
propagatorAlongToken_{esConsumes(iConfig.getParameter<edm::ESInputTag>("propagatorAlong"))},
propagatorOppositeToken_{esConsumes(iConfig.getParameter<edm::ESInputTag>("propagatorOpposite"))},
tGeomToken_(esConsumes()),
seedCreator_(SeedCreatorFactory::get()->create("SeedFromConsecutiveHitsCreator",
iConfig.getParameter<edm::ParameterSet>("SeedCreatorPSet"),
Expand All @@ -77,15 +75,15 @@ LSTOutputConverter::LSTOutputConverter(edm::ParameterSet const& iConfig)
// - The minimal set for TCs is t5TCsLST, pTTCsLST and pLSTCsLST.
// That would complicate the handling of collections though,
// so it is deferred to when we have a clearer picture of what's needed.
trajectorySeedPutToken_(produces<TrajectorySeedCollection>("")),
trajectorySeedpLSPutToken_(produces<TrajectorySeedCollection>("pLSTSsLST")),
trackCandidatePutToken_(produces<TrackCandidateCollection>("")),
trackCandidatepTCPutToken_(produces<TrackCandidateCollection>("pTCsLST")),
trackCandidateT5TCPutToken_(produces<TrackCandidateCollection>("t5TCsLST")),
trackCandidateNopLSTCPutToken_(produces<TrackCandidateCollection>("nopLSTCsLST")),
trackCandidatepTTCPutToken_(produces<TrackCandidateCollection>("pTTCsLST")),
trackCandidatepLSTCPutToken_(produces<TrackCandidateCollection>("pLSTCsLST")),
seedStopInfoPutToken_(produces<std::vector<SeedStopInfo>>()) {}
trajectorySeedPutToken_(produces("")),
trajectorySeedpLSPutToken_(produces("pLSTSsLST")),
trackCandidatePutToken_(produces("")),
trackCandidatepTCPutToken_(produces("pTCsLST")),
trackCandidateT5TCPutToken_(produces("t5TCsLST")),
trackCandidateNopLSTCPutToken_(produces("nopLSTCsLST")),
trackCandidatepTTCPutToken_(produces("pTTCsLST")),
trackCandidatepLSTCPutToken_(produces("pLSTCsLST")),
seedStopInfoPutToken_(produces()) {}

void LSTOutputConverter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
Expand Down
5 changes: 2 additions & 3 deletions RecoTracker/LST/plugins/LSTPhase2OTHitsInputProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ class LSTPhase2OTHitsInputProducer : public edm::global::EDProducer<> {
};

LSTPhase2OTHitsInputProducer::LSTPhase2OTHitsInputProducer(edm::ParameterSet const& iConfig)
: phase2OTRecHitToken_(
consumes<Phase2TrackerRecHit1DCollectionNew>(iConfig.getParameter<edm::InputTag>("phase2OTRecHits"))),
lstPhase2OTHitsInputPutToken_(produces<LSTPhase2OTHitsInput>()) {}
: phase2OTRecHitToken_(consumes(iConfig.getParameter<edm::InputTag>("phase2OTRecHits"))),
lstPhase2OTHitsInputPutToken_(produces()) {}

void LSTPhase2OTHitsInputProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
Expand Down
6 changes: 3 additions & 3 deletions RecoTracker/LST/plugins/LSTPixelSeedInputProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ class LSTPixelSeedInputProducer : public edm::global::EDProducer<> {

LSTPixelSeedInputProducer::LSTPixelSeedInputProducer(edm::ParameterSet const& iConfig)
: mfToken_(esConsumes()),
beamSpotToken_(consumes<reco::BeamSpot>(iConfig.getParameter<edm::InputTag>("beamSpot"))),
lstPixelSeedInputPutToken_(produces<LSTPixelSeedInput>()),
lstPixelSeedsPutToken_(produces<TrajectorySeedCollection>()) {
beamSpotToken_(consumes(iConfig.getParameter<edm::InputTag>("beamSpot"))),
lstPixelSeedInputPutToken_(produces()),
lstPixelSeedsPutToken_(produces()) {
seedTokens_ = edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag>>("seedTracks"),
[&](const edm::InputTag& tag) { return consumes<edm::View<reco::Track>>(tag); });
}
Expand Down
5 changes: 2 additions & 3 deletions RecoTracker/LST/plugins/alpaka/LSTProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
class LSTProducer : public stream::SynchronizingEDProducer<> {
public:
LSTProducer(edm::ParameterSet const& config)
: lstPixelSeedInputToken_{consumes<LSTPixelSeedInput>(config.getParameter<edm::InputTag>("pixelSeedInput"))},
lstPhase2OTHitsInputToken_{
consumes<LSTPhase2OTHitsInput>(config.getParameter<edm::InputTag>("phase2OTHitsInput"))},
: lstPixelSeedInputToken_{consumes(config.getParameter<edm::InputTag>("pixelSeedInput"))},
lstPhase2OTHitsInputToken_{consumes(config.getParameter<edm::InputTag>("phase2OTHitsInput"))},
lstESToken_{esConsumes()},
verbose_(config.getParameter<bool>("verbose")),
nopLSDupClean_(config.getParameter<bool>("nopLSDupClean")),
Expand Down
5 changes: 4 additions & 1 deletion RecoTracker/LSTCore/interface/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ namespace lst {
alpaka_common::Vec1D(static_cast<alpaka_common::Idx>(nElements)));
}

// Named constants for pixelTypes
enum PixelType : int8_t { kInvalid = -1, kHighPt = 0, kLowPtPosCurv = 1, kLowPtNegCurv = 2 };

// If a compile time flag does not define PT_CUT, default to 0.8 (GeV)
#ifndef PT_CUT
constexpr float PT_CUT = 0.8f;
Expand All @@ -52,7 +55,7 @@ namespace lst {

constexpr unsigned int size_superbins = 45000;

//defining the constant host device variables right up here
// Defining the constant host device variables right up here
// Currently pixel tracks treated as LSs with 2 double layers (IT layers 1+2 and 3+4) and 4 hits. To be potentially handled better in the future.
struct Params_pLS {
static constexpr int kLayers = 2, kHits = 4;
Expand Down
4 changes: 0 additions & 4 deletions RecoTracker/LSTCore/interface/EndcapGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
#define RecoTracker_LSTCore_interface_EndcapGeometry_h

#include <map>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <stdexcept>

namespace lst {
class EndcapGeometry {
Expand Down
4 changes: 3 additions & 1 deletion RecoTracker/LSTCore/interface/EndcapGeometryBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ namespace lst {
struct EndcapGeometryBuffer {
Buf<TDev, unsigned int> geoMapDetId_buf;
Buf<TDev, float> geoMapPhi_buf;
EndcapGeometryDev data_;

EndcapGeometryBuffer(TDev const& dev, unsigned int nEndCapMap)
: geoMapDetId_buf(allocBufWrapper<unsigned int>(dev, nEndCapMap)),
Expand All @@ -49,6 +48,9 @@ namespace lst {
}

inline EndcapGeometryDev const* data() const { return &data_; }

private:
EndcapGeometryDev data_;
};

} // namespace lst
Expand Down
8 changes: 3 additions & 5 deletions RecoTracker/LSTCore/interface/ModuleConnectionMap.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#ifndef RecoTracker_LSTCore_interface_ModuleConnectionMap_h
#define RecoTracker_LSTCore_interface_ModuleConnectionMap_h

#include <iostream>
#include <fstream>
#include <vector>
#include <array>
#include <map>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>

namespace lst {
class ModuleConnectionMap {
Expand Down
2 changes: 1 addition & 1 deletion RecoTracker/LSTCore/interface/PixelMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace lst {
std::vector<unsigned int> connectedPixelsIndexNeg;
std::vector<unsigned int> connectedPixelsSizesNeg;

int* pixelType;
const int* pixelType;

PixelMap(unsigned int sizef = size_superbins)
: pixelModuleIndex(0),
Expand Down
6 changes: 1 addition & 5 deletions RecoTracker/LSTCore/interface/TiltedGeometry.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#ifndef RecoTracker_LSTCore_interface_TiltedGeometry_h
#define RecoTracker_LSTCore_interface_TiltedGeometry_h

#include <vector>
#include <map>
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <stdexcept>
#include <vector>

namespace lst {
class TiltedGeometry {
Expand Down
2 changes: 1 addition & 1 deletion RecoTracker/LSTCore/interface/alpaka/LST.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
std::vector<int> in_charge_vec_;
std::vector<unsigned int> in_seedIdx_vec_;
std::vector<int> in_superbin_vec_;
std::vector<int8_t> in_pixelType_vec_;
std::vector<::lst::PixelType> in_pixelType_vec_;
std::vector<char> in_isQuad_vec_;
std::vector<std::vector<unsigned int>> out_tc_hitIdxs_;
std::vector<unsigned int> out_tc_len_;
Expand Down
5 changes: 5 additions & 0 deletions RecoTracker/LSTCore/src/EndcapGeometry.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include "RecoTracker/LSTCore/interface/EndcapGeometry.h"

#include <fstream>
#include <iostream>
#include <sstream>
#include <stdexcept>

lst::EndcapGeometry::EndcapGeometry(std::string const& filename) { load(filename); }

void lst::EndcapGeometry::load(std::string const& filename) {
Expand Down
5 changes: 5 additions & 0 deletions RecoTracker/LSTCore/src/ModuleConnectionMap.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include "RecoTracker/LSTCore/interface/ModuleConnectionMap.h"

#include <fstream>
#include <iostream>
#include <sstream>
#include <algorithm>

lst::ModuleConnectionMap::ModuleConnectionMap() {}

lst::ModuleConnectionMap::ModuleConnectionMap(std::string const& filename) { load(filename); }
Expand Down
5 changes: 5 additions & 0 deletions RecoTracker/LSTCore/src/TiltedGeometry.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#include "RecoTracker/LSTCore/interface/TiltedGeometry.h"

#include <fstream>
#include <iostream>
#include <sstream>
#include <stdexcept>

lst::TiltedGeometry::TiltedGeometry(std::string const& filename) { load(filename); }

void lst::TiltedGeometry::load(std::string const& filename) {
Expand Down
94 changes: 56 additions & 38 deletions RecoTracker/LSTCore/src/alpaka/Event.dev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ void Event::addPixelSegmentToEvent(std::vector<unsigned int> const& hitIndices0,
std::vector<int> const& charge,
std::vector<unsigned int> const& seedIdx,
std::vector<int> const& superbin,
std::vector<int8_t> const& pixelType,
std::vector<::lst::PixelType> const& pixelType,
std::vector<char> const& isQuad) {
unsigned int size = ptIn.size();

Expand Down Expand Up @@ -704,7 +704,7 @@ void Event::createPixelTriplets() {
}

auto superbins_buf = allocBufWrapper<int>(devHost, n_max_pixel_segments_per_module, queue);
auto pixelTypes_buf = allocBufWrapper<int8_t>(devHost, n_max_pixel_segments_per_module, queue);
auto pixelTypes_buf = allocBufWrapper<::lst::PixelType>(devHost, n_max_pixel_segments_per_module, queue);

alpaka::memcpy(queue, superbins_buf, segmentsBuffers->superbin_buf);
alpaka::memcpy(queue, pixelTypes_buf, segmentsBuffers->pixelType_buf);
Expand Down Expand Up @@ -736,31 +736,38 @@ void Event::createPixelTriplets() {
// TODO: check if a map/reduction to just eligible pLSs would speed up the kernel
// the current selection still leaves a significant fraction of unmatchable pLSs
for (unsigned int i = 0; i < nInnerSegments; i++) { // loop over # pLS
int8_t pixelType = pixelTypes[i]; // Get pixel type for this pLS
::lst::PixelType pixelType = pixelTypes[i]; // Get pixel type for this pLS
int superbin = superbins[i]; // Get superbin for this pixel
if ((superbin < 0) or (superbin >= (int)size_superbins) or (pixelType > 2) or (pixelType < 0)) {
if ((superbin < 0) or (superbin >= (int)size_superbins) or
((pixelType != ::lst::PixelType::kHighPt) and (pixelType != ::lst::PixelType::kLowPtPosCurv) and
(pixelType != ::lst::PixelType::kLowPtNegCurv))) {
connectedPixelSize_host[i] = 0;
connectedPixelIndex_host[i] = 0;
continue;
}

// Used pixel type to select correct size-index arrays
if (pixelType == 0) {
connectedPixelSize_host[i] =
pixelMapping_.connectedPixelsSizes[superbin]; // number of connected modules to this pixel
auto connectedIdxBase = pixelMapping_.connectedPixelsIndex[superbin];
connectedPixelIndex_host[i] =
connectedIdxBase; // index to get start of connected modules for this superbin in map
} else if (pixelType == 1) {
connectedPixelSize_host[i] =
pixelMapping_.connectedPixelsSizesPos[superbin]; // number of pixel connected modules
auto connectedIdxBase = pixelMapping_.connectedPixelsIndexPos[superbin] + pixelIndexOffsetPos;
connectedPixelIndex_host[i] = connectedIdxBase; // index to get start of connected pixel modules
} else if (pixelType == 2) {
connectedPixelSize_host[i] =
pixelMapping_.connectedPixelsSizesNeg[superbin]; // number of pixel connected modules
auto connectedIdxBase = pixelMapping_.connectedPixelsIndexNeg[superbin] + pixelIndexOffsetNeg;
connectedPixelIndex_host[i] = connectedIdxBase; // index to get start of connected pixel modules
switch (pixelType) {
case ::lst::PixelType::kInvalid:
break;
case ::lst::PixelType::kHighPt:
// number of connected modules to this pixel
connectedPixelSize_host[i] = pixelMapping_.connectedPixelsSizes[superbin];
// index to get start of connected modules for this superbin in map
connectedPixelIndex_host[i] = pixelMapping_.connectedPixelsIndex[superbin];
break;
case ::lst::PixelType::kLowPtPosCurv:
// number of connected modules to this pixel
connectedPixelSize_host[i] = pixelMapping_.connectedPixelsSizesPos[superbin];
// index to get start of connected modules for this superbin in map
connectedPixelIndex_host[i] = pixelMapping_.connectedPixelsIndexPos[superbin] + pixelIndexOffsetPos;
break;
case ::lst::PixelType::kLowPtNegCurv:
// number of connected modules to this pixel
connectedPixelSize_host[i] = pixelMapping_.connectedPixelsSizesNeg[superbin];
// index to get start of connected modules for this superbin in map
connectedPixelIndex_host[i] = pixelMapping_.connectedPixelsIndexNeg[superbin] + pixelIndexOffsetNeg;
break;
}
}

Expand Down Expand Up @@ -900,7 +907,7 @@ void Event::createPixelQuintuplets() {
}

auto superbins_buf = allocBufWrapper<int>(devHost, n_max_pixel_segments_per_module, queue);
auto pixelTypes_buf = allocBufWrapper<int8_t>(devHost, n_max_pixel_segments_per_module, queue);
auto pixelTypes_buf = allocBufWrapper<::lst::PixelType>(devHost, n_max_pixel_segments_per_module, queue);

alpaka::memcpy(queue, superbins_buf, segmentsBuffers->superbin_buf);
alpaka::memcpy(queue, pixelTypes_buf, segmentsBuffers->pixelType_buf);
Expand Down Expand Up @@ -931,27 +938,38 @@ void Event::createPixelQuintuplets() {

// Loop over # pLS
for (unsigned int i = 0; i < nInnerSegments; i++) {
int8_t pixelType = pixelTypes[i]; // Get pixel type for this pLS
int superbin = superbins[i]; // Get superbin for this pixel
if ((superbin < 0) or (superbin >= (int)::size_superbins) or (pixelType > 2) or (pixelType < 0)) {
connectedPixelIndex_host[i] = 0;
::lst::PixelType pixelType = pixelTypes[i]; // Get pixel type for this pLS
int superbin = superbins[i]; // Get superbin for this pixel
if ((superbin < 0) or (superbin >= (int)size_superbins) or
((pixelType != ::lst::PixelType::kHighPt) and (pixelType != ::lst::PixelType::kLowPtPosCurv) and
(pixelType != ::lst::PixelType::kLowPtNegCurv))) {
connectedPixelSize_host[i] = 0;
connectedPixelIndex_host[i] = 0;
continue;
}

// Used pixel type to select correct size-index arrays
if (pixelType == 0) {
connectedPixelSize_host[i] =
pixelMapping_.connectedPixelsSizes[superbin]; //number of connected modules to this pixel
unsigned int connectedIdxBase = pixelMapping_.connectedPixelsIndex[superbin];
connectedPixelIndex_host[i] = connectedIdxBase;
} else if (pixelType == 1) {
connectedPixelSize_host[i] = pixelMapping_.connectedPixelsSizesPos[superbin]; //number of pixel connected modules
unsigned int connectedIdxBase = pixelMapping_.connectedPixelsIndexPos[superbin] + pixelIndexOffsetPos;
connectedPixelIndex_host[i] = connectedIdxBase;
} else if (pixelType == 2) {
connectedPixelSize_host[i] = pixelMapping_.connectedPixelsSizesNeg[superbin]; //number of pixel connected modules
unsigned int connectedIdxBase = pixelMapping_.connectedPixelsIndexNeg[superbin] + pixelIndexOffsetNeg;
connectedPixelIndex_host[i] = connectedIdxBase;
switch (pixelType) {
case ::lst::PixelType::kInvalid:
break;
case ::lst::PixelType::kHighPt:
// number of connected modules to this pixel
connectedPixelSize_host[i] = pixelMapping_.connectedPixelsSizes[superbin];
// index to get start of connected modules for this superbin in map
connectedPixelIndex_host[i] = pixelMapping_.connectedPixelsIndex[superbin];
break;
case ::lst::PixelType::kLowPtPosCurv:
// number of connected modules to this pixel
connectedPixelSize_host[i] = pixelMapping_.connectedPixelsSizesPos[superbin];
// index to get start of connected modules for this superbin in map
connectedPixelIndex_host[i] = pixelMapping_.connectedPixelsIndexPos[superbin] + pixelIndexOffsetPos;
break;
case ::lst::PixelType::kLowPtNegCurv:
// number of connected modules to this pixel
connectedPixelSize_host[i] = pixelMapping_.connectedPixelsSizesNeg[superbin];
// index to get start of connected modules for this superbin in map
connectedPixelIndex_host[i] = pixelMapping_.connectedPixelsIndexNeg[superbin] + pixelIndexOffsetNeg;
break;
}
}

Expand Down
5 changes: 1 addition & 4 deletions RecoTracker/LSTCore/src/alpaka/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {

void initSync(bool verbose);

int* superbinCPU;
int8_t* pixelTypeCPU;

const uint16_t nModules_;
const uint16_t nLowerModules_;
const unsigned int nPixels_;
Expand Down Expand Up @@ -131,7 +128,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
std::vector<int> const& charge,
std::vector<unsigned int> const& seedIdx,
std::vector<int> const& superbin,
std::vector<int8_t> const& pixelType,
std::vector<::lst::PixelType> const& pixelType,
std::vector<char> const& isQuad);

void createMiniDoublets();
Expand Down
Loading

0 comments on commit f245be0

Please sign in to comment.