CMS 3D CMS Logo

PFClusterSoAProducer.cc
Go to the documentation of this file.
1 #include <Eigen/Core>
2 #include <Eigen/Dense>
3 
17 
20  public:
22  : pfClusParamsToken(esConsumes(config.getParameter<edm::ESInputTag>("pfClusterParams"))),
23  topologyToken_(esConsumes(config.getParameter<edm::ESInputTag>("topology"))),
24  inputPFRecHitSoA_Token_{consumes(config.getParameter<edm::InputTag>("pfRecHits"))},
27  numRHF_{cms::alpakatools::make_host_buffer<uint32_t, Platform>()},
28  synchronise_(config.getParameter<bool>("synchronise")) {}
29 
30  void acquire(device::Event const& event, device::EventSetup const& setup) override {
34  int nRH = 0;
35  if (pfRecHits->metadata().size() != 0)
36  nRH = pfRecHits->size();
37 
38  pfClusteringVars_.emplace(nRH, event.queue());
39  pfClusteringEdgeVars_.emplace(nRH * 8, event.queue());
40  pfClusters_.emplace(nRH, event.queue());
41 
42  *numRHF_ = 0;
43 
44  if (nRH != 0) {
45  PFClusterProducerKernel kernel(event.queue(), pfRecHits);
46  kernel.seedTopoAndContract(event.queue(),
47  params,
48  topology,
51  pfRecHits,
52  *pfClusters_,
53  numRHF_.data());
54  }
55  }
56 
61  int nRH = 0;
62 
63  std::optional<reco::PFRecHitFractionDeviceCollection> pfrhFractions;
64 
65  if (pfRecHits->metadata().size() != 0)
66  nRH = pfRecHits->size();
67 
68  if (nRH != 0) {
69  pfrhFractions.emplace(*numRHF_.data(), event.queue());
70  PFClusterProducerKernel kernel(event.queue(), pfRecHits);
71  kernel.cluster(event.queue(),
72  params,
73  topology,
76  pfRecHits,
77  *pfClusters_,
78  *pfrhFractions);
79  } else {
80  pfrhFractions.emplace(0, event.queue());
81  }
82 
83  if (synchronise_)
84  alpaka::wait(event.queue());
85 
87  event.emplace(outputPFRHFractionSoA_Token_, std::move(*pfrhFractions));
88  }
89 
90  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
92  desc.add<edm::InputTag>("pfRecHits", edm::InputTag(""));
93  desc.add<edm::ESInputTag>("pfClusterParams", edm::ESInputTag(""));
94  desc.add<edm::ESInputTag>("topology", edm::ESInputTag(""));
95  desc.add<bool>("synchronise", false);
96  descriptions.addWithDefaultLabel(desc);
97  }
98 
99  private:
106  std::optional<reco::PFClusteringVarsDeviceCollection> pfClusteringVars_;
107  std::optional<reco::PFClusteringEdgeVarsDeviceCollection> pfClusteringEdgeVars_;
108  std::optional<reco::PFClusterDeviceCollection> pfClusters_;
109  const bool synchronise_;
110  };
111 
112 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
113 
115 DEFINE_FWK_ALPAKA_MODULE(PFClusterSoAProducer);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const device::ESGetToken< reco::PFRecHitHCALTopologyDeviceCollection, PFRecHitHCALTopologyRecord > topologyToken_
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::optional< reco::PFClusteringEdgeVarsDeviceCollection > pfClusteringEdgeVars_
std::optional< reco::PFClusteringVarsDeviceCollection > pfClusteringVars_
const edm::EDGetTokenT< reco::PFRecHitHostCollection > inputPFRecHitSoA_Token_
Definition: config.py:1
std::optional< reco::PFClusterDeviceCollection > pfClusters_
void cluster(Queue &queue, const reco::PFClusterParamsDeviceCollection &params, const reco::PFRecHitHCALTopologyDeviceCollection &topology, reco::PFClusteringVarsDeviceCollection &pfClusteringVars, reco::PFClusteringEdgeVarsDeviceCollection &pfClusteringEdgeVars, const reco::PFRecHitHostCollection &pfRecHits, reco::PFClusterDeviceCollection &pfClusters, reco::PFRecHitFractionDeviceCollection &pfrhFractions)
void acquire(device::Event const &event, device::EventSetup const &setup) override
const device::EDPutToken< reco::PFRecHitFractionDeviceCollection > outputPFRHFractionSoA_Token_
cms::alpakatools::host_buffer< uint32_t > numRHF_
void produce(device::Event &event, device::EventSetup const &setup) override
PortableCollection<::reco::PFRecHitHCALTopologySoA > PFRecHitHCALTopologyDeviceCollection
typename detail::buffer_type< DevHost, T >::type host_buffer
Definition: memory.h:57
PortableCollection<::reco::PFClusterParamsSoA > PFClusterParamsDeviceCollection
void seedTopoAndContract(Queue &queue, const reco::PFClusterParamsDeviceCollection &params, const reco::PFRecHitHCALTopologyDeviceCollection &topology, reco::PFClusteringVarsDeviceCollection &pfClusteringVars, reco::PFClusteringEdgeVarsDeviceCollection &pfClusteringEdgeVars, const reco::PFRecHitHostCollection &pfRecHits, reco::PFClusterDeviceCollection &pfClusters, uint32_t *__restrict__ nRHF)
const device::EDPutToken< reco::PFClusterDeviceCollection > outputPFClusterSoA_Token_
const device::ESGetToken< reco::PFClusterParamsDeviceCollection, JobConfigurationGPURecord > pfClusParamsToken
HLT enums.
auto produces(std::string instanceName) noexcept
declare what type of product will make and with which optional label
#define DEFINE_FWK_ALPAKA_MODULE(name)
Definition: MakerMacros.h:16
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1