File indexing completed on 2024-07-03 04:18:12
0001 #include "DataFormats/PortableTestObjects/interface/alpaka/TestDeviceCollection.h"
0002 #include "FWCore/Framework/interface/ConsumesCollector.h"
0003 #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
0004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0005 #include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
0006 #include "FWCore/Utilities/interface/InputTag.h"
0007 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/stream/EDProducer.h"
0008 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/EDPutToken.h"
0009 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/ESGetToken.h"
0010 #include "HeterogeneousCore/AlpakaInterface/interface/config.h"
0011 #include "HeterogeneousCore/AlpakaTest/interface/AlpakaESTestRecords.h"
0012 #include "HeterogeneousCore/AlpakaTest/interface/alpaka/AlpakaESTestData.h"
0013 #include "RecoLocalCalo/HGCalRecProducers/interface/HGCalTilesConstants.h"
0014 #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h"
0015 #include "DataFormats/HGCRecHit/interface/HGCRecHitCollections.h"
0016
0017 #include "DataFormats/HGCalReco/interface/HGCalSoARecHitsHostCollection.h"
0018 #include "DataFormats/HGCalReco/interface/alpaka/HGCalSoARecHitsDeviceCollection.h"
0019 #include "DataFormats/HGCalReco/interface/alpaka/HGCalSoARecHitsExtraDeviceCollection.h"
0020 #include "HGCalLayerClustersAlgoWrapper.h"
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 namespace ALPAKA_ACCELERATOR_NAMESPACE {
0032
0033 class HGCalSoARecHitsLayerClustersProducer : public stream::EDProducer<> {
0034 public:
0035 HGCalSoARecHitsLayerClustersProducer(edm::ParameterSet const& config)
0036 : getTokenDevice_{consumes(config.getParameter<edm::InputTag>("hgcalRecHitsSoA"))},
0037 deviceToken_{produces()},
0038 deltac_((float)config.getParameter<double>("deltac")),
0039 kappa_((float)config.getParameter<double>("kappa")),
0040 outlierDeltaFactor_((float)config.getParameter<double>("outlierDeltaFactor")) {}
0041
0042 ~HGCalSoARecHitsLayerClustersProducer() override = default;
0043
0044 void produce(device::Event& iEvent, device::EventSetup const& iSetup) override {
0045 auto const& deviceInput = iEvent.get(getTokenDevice_);
0046
0047 auto const input_v = deviceInput.view();
0048
0049 HGCalSoARecHitsExtraDeviceCollection output(deviceInput->metadata().size(), iEvent.queue());
0050 auto output_v = output.view();
0051
0052 algo_.run(
0053 iEvent.queue(), deviceInput->metadata().size(), deltac_, kappa_, outlierDeltaFactor_, input_v, output_v);
0054 iEvent.emplace(deviceToken_, std::move(output));
0055 }
0056
0057 static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0058 edm::ParameterSetDescription desc;
0059 desc.add<edm::InputTag>("hgcalRecHitsSoA", edm::InputTag("TO BE DEFINED"));
0060 desc.add<double>("deltac", 1.3);
0061 desc.add<double>("kappa", 9.);
0062 desc.add<double>("outlierDeltaFactor", 2.);
0063 descriptions.addWithDefaultLabel(desc);
0064 }
0065
0066 private:
0067
0068 device::EDGetToken<HGCalSoARecHitsDeviceCollection> const getTokenDevice_;
0069 device::EDPutToken<HGCalSoARecHitsExtraDeviceCollection> const deviceToken_;
0070 HGCalLayerClustersAlgoWrapper algo_;
0071 const float deltac_;
0072 const float kappa_;
0073 const float outlierDeltaFactor_;
0074 };
0075
0076 }
0077
0078 #include "HeterogeneousCore/AlpakaCore/interface/alpaka/MakerMacros.h"
0079 DEFINE_FWK_ALPAKA_MODULE(HGCalSoARecHitsLayerClustersProducer);