1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/global/EDProducer.h"
#include "FWCore/Framework/interface/MakerMacros.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/EDPutToken.h"
#include "FWCore/Utilities/interface/StreamID.h"
#include "DataFormats/TrackSoA/interface/TracksHost.h"
#include <memory>
#include <utility>
#include <vector>
namespace edmtest {
class TestWriteHostTrackSoA : public edm::global::EDProducer<> {
public:
TestWriteHostTrackSoA(edm::ParameterSet const&);
void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override;
static void fillDescriptions(edm::ConfigurationDescriptions&);
private:
unsigned int trackSize_;
edm::EDPutTokenT<::reco::TracksHost> putToken_;
};
TestWriteHostTrackSoA::TestWriteHostTrackSoA(edm::ParameterSet const& iPSet)
: trackSize_(iPSet.getParameter<unsigned int>("trackSize")), putToken_(produces()) {}
void TestWriteHostTrackSoA::produce(edm::StreamID, edm::Event& iEvent, edm::EventSetup const&) const {
::reco::TracksHost tracks({{int(trackSize_), int(4 * trackSize_)}}, cms::alpakatools::host());
auto tracksView = tracks.view();
for (unsigned int i = 0; i < trackSize_; ++i) {
tracksView[i].eta() = float(i);
}
iEvent.emplace(putToken_, std::move(tracks));
}
void TestWriteHostTrackSoA::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
desc.add<unsigned int>("trackSize", 1000);
descriptions.addDefault(desc);
}
} // namespace edmtest
using edmtest::TestWriteHostTrackSoA;
DEFINE_FWK_MODULE(TestWriteHostTrackSoA);
|