3 #include <alpaka/alpaka.hpp> 23 using namespace particleFlowRecHitProducer;
25 template <
typename CAL>
30 deviceToken_(produces()),
31 synchronise_(
config.getUntrackedParameter<
bool>(
"synchronise")) {}
35 const int32_t num_recHits =
recHits.size();
37 printf(
"Found %d recHits\n", num_recHits);
40 auto&
view = hostProduct.view();
42 for (
int i = 0;
i < num_recHits;
i++) {
46 printf(
"recHit %4d %u %f %f\n",
i,
view.detId(
i),
view.energy(
i),
view.timeM0(
i));
50 alpaka::memcpy(
event.queue(), deviceProduct.buffer(), hostProduct.buffer());
53 event.emplace(deviceToken_,
std::move(deviceProduct));
59 desc.addUntracked<
bool>(
"synchronise",
false)
60 ->setComment(
"Add synchronisation point after execution (for benchmarking asynchronous execution)");
69 static void convertRecHit(hcal::RecHitHostCollection::View::element
to,
const typename CAL::CaloRecHitType& from);
void produce(edm::StreamID sid, device::Event &event, device::EventSetup const &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
CaloRecHitSoAProducer(edm::ParameterSet const &config)
CaloRecHitSoAProducer< HCAL > HCALRecHitSoAProducer
const device::EDPutToken< hcal::RecHitDeviceCollection > deviceToken_
const edm::EDGetTokenT< edm::SortedCollection< typename CAL::CaloRecHitType > > recHitsToken_
static void convertRecHit(hcal::RecHitHostCollection::View::element to, const typename CAL::CaloRecHitType &from)
constexpr float energy() const
constexpr HcalDetId id() const
get the id
constexpr uint32_t rawId() const
get the raw id
constexpr float time() const
#define DEFINE_FWK_ALPAKA_MODULE(name)
PortableCollection< HcalRecHitSoA > RecHitDeviceCollection