CMS 3D CMS Logo

EcalElectronicsMappingHostESProducer.cc
Go to the documentation of this file.
13 
16  public:
18  auto cc = setWhatProduced(this);
19  token_ = cc.consumes();
20  }
21 
22  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
24  descriptions.addWithDefaultLabel(desc);
25  }
26 
27  std::unique_ptr<EcalElectronicsMappingHost> produce(EcalMappingElectronicsRcd const& iRecord) {
28  auto const& mapping = iRecord.get(token_);
29 
30  // TODO: 0x3FFFFF * 4B ~= 16MB
31  // tmp solution for linear mapping of eid -> did
32  int const size = 0x3FFFFF;
33  auto product = std::make_unique<EcalElectronicsMappingHost>(size, cms::alpakatools::host());
34 
35  // fill in eb
36  auto const& barrelValues = mapping.barrelItems();
37  for (unsigned int i = 0; i < barrelValues.size(); ++i) {
38  EcalElectronicsId eid{barrelValues[i].electronicsid};
40  product->view()[eid.linearIndex()].rawid() = did.rawId();
41  }
42 
43  // fill in ee
44  auto const& endcapValues = mapping.endcapItems();
45  for (unsigned int i = 0; i < endcapValues.size(); ++i) {
46  EcalElectronicsId eid{endcapValues[i].electronicsid};
48  product->view()[eid.linearIndex()].rawid() = did.rawId();
49  }
50  return product;
51  }
52 
53  private:
55  };
56 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
57 
58 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)
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