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  synchronise_(config.getParameter<bool>("synchronise")),
28  pfRecHitFractionAllocation_(config.getParameter<int>("pfRecHitFractionAllocation")) {
29  // Workaround until the ProductID problem in issue https://github.com/cms-sw/cmssw/issues/44643 is fixed
30 #ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED
31  producesTemporarily("edm::DeviceProduct<alpaka_cuda_async::reco::PFClusterDeviceCollection>");
32  producesTemporarily("edm::DeviceProduct<alpaka_cuda_async::reco::PFRecHitFractionDeviceCollection>");
33 #endif
34  }
35 
40  int nRH = 0;
41  if (pfRecHits->metadata().size() != 0)
42  nRH = pfRecHits->size();
43 
44  reco::PFClusteringVarsDeviceCollection pfClusteringVars{nRH, event.queue()};
45  reco::PFClusteringEdgeVarsDeviceCollection pfClusteringEdgeVars{(nRH * 8), event.queue()};
46  reco::PFClusterDeviceCollection pfClusters{nRH, event.queue()};
47  reco::PFRecHitFractionDeviceCollection pfrhFractions{nRH * pfRecHitFractionAllocation_, event.queue()};
48 
49  if (nRH != 0) {
50  PFClusterProducerKernel kernel(event.queue(), pfRecHits);
51  kernel.execute(event.queue(),
52  params,
53  topology,
54  pfClusteringVars,
55  pfClusteringEdgeVars,
56  pfRecHits,
57  pfClusters,
58  pfrhFractions);
59  }
60 
61  if (synchronise_)
62  alpaka::wait(event.queue());
63 
64  event.emplace(outputPFClusterSoA_Token_, std::move(pfClusters));
65  event.emplace(outputPFRHFractionSoA_Token_, std::move(pfrhFractions));
66  }
67 
68  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
70  desc.add<edm::InputTag>("pfRecHits", edm::InputTag(""));
71  desc.add<edm::ESInputTag>("pfClusterParams", edm::ESInputTag(""));
72  desc.add<edm::ESInputTag>("topology", edm::ESInputTag(""));
73  desc.add<bool>("synchronise", false);
74  desc.add<int>("pfRecHitFractionAllocation", 120);
75  descriptions.addWithDefaultLabel(desc);
76  }
77 
78  private:
84  const bool synchronise_;
86  };
87 
88 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
89 
91 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)
const edm::EDGetTokenT< reco::PFRecHitHostCollection > inputPFRecHitSoA_Token_
Definition: config.py:1
void execute(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)
const device::EDPutToken< reco::PFRecHitFractionDeviceCollection > outputPFRHFractionSoA_Token_
PortableCollection<::reco::PFClusterSoA > PFClusterDeviceCollection
PortableCollection<::reco::PFClusteringVarsSoA > PFClusteringVarsDeviceCollection
void produce(device::Event &event, device::EventSetup const &setup) override
PortableCollection<::reco::PFRecHitHCALTopologySoA > PFRecHitHCALTopologyDeviceCollection
PortableCollection<::reco::PFRecHitFractionSoA > PFRecHitFractionDeviceCollection
PortableCollection<::reco::PFClusterParamsSoA > PFClusterParamsDeviceCollection
const device::EDPutToken< reco::PFClusterDeviceCollection > outputPFClusterSoA_Token_
const device::ESGetToken< reco::PFClusterParamsDeviceCollection, JobConfigurationGPURecord > pfClusParamsToken
PortableCollection<::reco::PFClusteringEdgeVarsSoA > PFClusteringEdgeVarsDeviceCollection
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