CMS 3D CMS Logo

BeamSpotDeviceProducer.cc
Go to the documentation of this file.
12 
14 
16  public:
18  : legacyToken_{consumes(config.getParameter<edm::InputTag>("src"))}, deviceToken_{produces()} {
19  // Workaround until the ProductID problem in issue https://github.com/cms-sw/cmssw/issues/44643 is fixed
20 #ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED
21  producesTemporarily("edm::DeviceProduct<alpaka_cuda_async::BeamSpotDevice>");
22 #endif
23  }
24 
26  reco::BeamSpot const& beamspot = event.get(legacyToken_);
27 
28  BeamSpotHost hostProduct{event.queue()};
29  hostProduct->x = beamspot.x0();
30  hostProduct->y = beamspot.y0();
31  hostProduct->z = beamspot.z0();
32  hostProduct->sigmaZ = beamspot.sigmaZ();
33  hostProduct->beamWidthX = beamspot.BeamWidthX();
34  hostProduct->beamWidthY = beamspot.BeamWidthY();
35  hostProduct->dxdz = beamspot.dxdz();
36  hostProduct->dydz = beamspot.dydz();
37  hostProduct->emittanceX = beamspot.emittanceX();
38  hostProduct->emittanceY = beamspot.emittanceY();
39  hostProduct->betaStar = beamspot.betaStar();
40 
41  if constexpr (std::is_same_v<Device, alpaka::DevCpu>) {
42  event.emplace(deviceToken_, std::move(hostProduct));
43  } else {
44  BeamSpotDevice deviceProduct{event.queue()};
45  alpaka::memcpy(event.queue(), deviceProduct.buffer(), hostProduct.const_buffer());
46  event.emplace(deviceToken_, std::move(deviceProduct));
47  }
48  }
49 
50  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
52  desc.add("src", edm::InputTag{});
53  descriptions.addWithDefaultLabel(desc);
54  }
55 
56  private:
59  };
60 
61 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
62 
64 DEFINE_FWK_ALPAKA_MODULE(BeamSpotDeviceProducer);
const device::EDPutToken< BeamSpotDevice > deviceToken_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
PortableHostObject< BeamSpotPOD > BeamSpotHost
Definition: BeamSpotHost.h:8
Definition: config.py:1
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const edm::EDGetTokenT< reco::BeamSpot > legacyToken_
void produce(edm::StreamID, device::Event &event, device::EventSetup const &setup) const override
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
PortableObject< BeamSpotPOD > BeamSpotDevice
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1