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 
21  reco::BeamSpot const& beamspot = event.get(legacyToken_);
22 
23  BeamSpotHost hostProduct{event.queue()};
24  hostProduct->x = beamspot.x0();
25  hostProduct->y = beamspot.y0();
26  hostProduct->z = beamspot.z0();
27  hostProduct->sigmaZ = beamspot.sigmaZ();
28  hostProduct->beamWidthX = beamspot.BeamWidthX();
29  hostProduct->beamWidthY = beamspot.BeamWidthY();
30  hostProduct->dxdz = beamspot.dxdz();
31  hostProduct->dydz = beamspot.dydz();
32  hostProduct->emittanceX = beamspot.emittanceX();
33  hostProduct->emittanceY = beamspot.emittanceY();
34  hostProduct->betaStar = beamspot.betaStar();
35 
36  if constexpr (std::is_same_v<Device, alpaka::DevCpu>) {
37  event.emplace(deviceToken_, std::move(hostProduct));
38  } else {
39  BeamSpotDevice deviceProduct{event.queue()};
40  alpaka::memcpy(event.queue(), deviceProduct.buffer(), hostProduct.const_buffer());
41  event.emplace(deviceToken_, std::move(deviceProduct));
42  }
43  }
44 
45  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
47  desc.add("src", edm::InputTag{});
48  descriptions.addWithDefaultLabel(desc);
49  }
50 
51  private:
54  };
55 
56 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
57 
59 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