CMS 3D CMS Logo

EcalElectronicsMappingHostESProducer.cc
Go to the documentation of this file.
1 #include <alpaka/alpaka.hpp>
2 
15 
18  public:
20  auto cc = setWhatProduced(this);
21  token_ = cc.consumes();
22  }
23 
24  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
26  descriptions.addWithDefaultLabel(desc);
27  }
28 
29  std::unique_ptr<EcalElectronicsMappingHost> produce(EcalMappingElectronicsRcd const& iRecord) {
30  auto const& mapping = iRecord.get(token_);
31 
32  // TODO: 0x3FFFFF * 4B ~= 16MB
33  // tmp solution for linear mapping of eid -> did
34  int const size = 0x3FFFFF;
35  auto product = std::make_unique<EcalElectronicsMappingHost>(size, cms::alpakatools::host());
36 
37  // fill the whole collection with null detids
38  alpaka::QueueCpuBlocking queue{cms::alpakatools::host()};
39  alpaka::memset(queue, product->buffer(), 0x00);
40 
41  // fill in eb
42  auto const& barrelValues = mapping.barrelItems();
43  for (unsigned int i = 0; i < barrelValues.size(); ++i) {
44  EcalElectronicsId eid{barrelValues[i].electronicsid};
46  product->view()[eid.linearIndex()].rawid() = did.rawId();
47  }
48 
49  // fill in ee
50  auto const& endcapValues = mapping.endcapItems();
51  for (unsigned int i = 0; i < endcapValues.size(); ++i) {
52  EcalElectronicsId eid{endcapValues[i].electronicsid};
54  product->view()[eid.linearIndex()].rawid() = did.rawId();
55  }
56  return product;
57  }
58 
59  private:
61  };
62 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
63 
64 DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(EcalElectronicsMappingHostESProducer);
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:166
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
uint32_t cc[maxCellsPerHit]
Definition: gpuFishbone.h:49
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
std::unique_ptr< EcalElectronicsMappingHost > produce(EcalMappingElectronicsRcd const &iRecord)
static EEDetId unhashIndex(int hi)
Definition: EEDetId.cc:65
edm::ESGetToken< EcalMappingElectronics, EcalMappingElectronicsRcd > token_
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
alpaka::DevCpu const & host()
Definition: host.h:14
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
SerialTaskQueueChain & queue()
Definition: ESProducer.h:155
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static EBDetId unhashIndex(int hi)
get a DetId from a compact index for arrays
Definition: EBDetId.h:110
#define DEFINE_FWK_EVENTSETUP_ALPAKA_MODULE(type)
Definition: ModuleFactory.h:17