File indexing completed on 2025-02-05 03:15:16
0001 #include <alpaka/alpaka.hpp>
0002
0003 #include "RecoTracker/LSTCore/interface/alpaka/LST.h"
0004
0005 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0006 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0007 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0009 #include "FWCore/Utilities/interface/InputTag.h"
0010
0011 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/EDGetToken.h"
0012 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/EDPutToken.h"
0013 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/Event.h"
0014 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/EventSetup.h"
0015 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/stream/SynchronizingEDProducer.h"
0016 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0017
0018 #include "RecoTracker/LST/interface/LSTOutput.h"
0019 #include "RecoTracker/LST/interface/LSTPhase2OTHitsInput.h"
0020 #include "RecoTracker/LST/interface/LSTPixelSeedInput.h"
0021
0022 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
0023
0024 namespace ALPAKA_ACCELERATOR_NAMESPACE {
0025
0026 class LSTProducer : public stream::SynchronizingEDProducer<> {
0027 public:
0028 LSTProducer(edm::ParameterSet const& config)
0029 : SynchronizingEDProducer(config),
0030 lstPixelSeedInputToken_{consumes(config.getParameter<edm::InputTag>("pixelSeedInput"))},
0031 lstPhase2OTHitsInputToken_{consumes(config.getParameter<edm::InputTag>("phase2OTHitsInput"))},
0032 lstESToken_{esConsumes(edm::ESInputTag("", config.getParameter<std::string>("ptCutLabel")))},
0033 verbose_(config.getParameter<bool>("verbose")),
0034 ptCut_(config.getParameter<double>("ptCut")),
0035 nopLSDupClean_(config.getParameter<bool>("nopLSDupClean")),
0036 tcpLSTriplets_(config.getParameter<bool>("tcpLSTriplets")),
0037 lstOutputToken_{produces()} {}
0038
0039 void acquire(device::Event const& event, device::EventSetup const& setup) override {
0040
0041 auto const& pixelSeeds = event.get(lstPixelSeedInputToken_);
0042 auto const& phase2OTHits = event.get(lstPhase2OTHitsInputToken_);
0043
0044 auto const& lstESDeviceData = setup.getData(lstESToken_);
0045
0046 lst_.run(event.queue(),
0047 verbose_,
0048 static_cast<float>(ptCut_),
0049 &lstESDeviceData,
0050 pixelSeeds.px(),
0051 pixelSeeds.py(),
0052 pixelSeeds.pz(),
0053 pixelSeeds.dxy(),
0054 pixelSeeds.dz(),
0055 pixelSeeds.ptErr(),
0056 pixelSeeds.etaErr(),
0057 pixelSeeds.stateTrajGlbX(),
0058 pixelSeeds.stateTrajGlbY(),
0059 pixelSeeds.stateTrajGlbZ(),
0060 pixelSeeds.stateTrajGlbPx(),
0061 pixelSeeds.stateTrajGlbPy(),
0062 pixelSeeds.stateTrajGlbPz(),
0063 pixelSeeds.q(),
0064 pixelSeeds.hitIdx(),
0065 phase2OTHits.detId(),
0066 phase2OTHits.x(),
0067 phase2OTHits.y(),
0068 phase2OTHits.z(),
0069 nopLSDupClean_,
0070 tcpLSTriplets_);
0071 }
0072
0073 void produce(device::Event& event, device::EventSetup const&) override {
0074
0075 LSTOutput lstOutput(lst_.hits(), lst_.len(), lst_.seedIdx(), lst_.trackCandidateType());
0076 event.emplace(lstOutputToken_, std::move(lstOutput));
0077 }
0078
0079 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0080 edm::ParameterSetDescription desc;
0081 desc.add<edm::InputTag>("pixelSeedInput", edm::InputTag{"lstPixelSeedInputProducer"});
0082 desc.add<edm::InputTag>("phase2OTHitsInput", edm::InputTag{"lstPhase2OTHitsInputProducer"});
0083 desc.add<bool>("verbose", false);
0084 desc.add<double>("ptCut", 0.8);
0085 desc.add<std::string>("ptCutLabel", "0.8");
0086 desc.add<bool>("nopLSDupClean", false);
0087 desc.add<bool>("tcpLSTriplets", false);
0088 descriptions.addWithDefaultLabel(desc);
0089 }
0090
0091 private:
0092 edm::EDGetTokenT<LSTPixelSeedInput> lstPixelSeedInputToken_;
0093 edm::EDGetTokenT<LSTPhase2OTHitsInput> lstPhase2OTHitsInputToken_;
0094 device::ESGetToken<lst::LSTESData<Device>, TrackerRecoGeometryRecord> lstESToken_;
0095 const bool verbose_;
0096 const double ptCut_;
0097 const bool nopLSDupClean_;
0098 const bool tcpLSTriplets_;
0099 edm::EDPutTokenT<LSTOutput> lstOutputToken_;
0100
0101 lst::LST lst_;
0102 };
0103
0104 }
0105
0106 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/MakerMacros.h"
0107 DEFINE_FWK_ALPAKA_MODULE(LSTProducer);