CMS 3D CMS Logo

SiStripClustersFromSOA.cc
Go to the documentation of this file.
1 /*
2  */
5 
15 
17 
18 #include <memory>
19 
21 public:
23  : inputToken_(consumes<SiStripClustersCUDAHost>(conf.getParameter<edm::InputTag>("ProductLabel"))),
24  outputToken_(produces<edmNew::DetSetVector<SiStripCluster>>()) {}
25 
26  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
28 
29  desc.add("ProductLabel", edm::InputTag("siStripClustersSOAtoHost"));
30  descriptions.addWithDefaultLabel(desc);
31  }
32 
33 private:
34  void produce(edm::Event& ev, const edm::EventSetup& es) override {
35  const auto& clust_data = ev.get(inputToken_);
36 
37  const int nSeedStripsNC = clust_data.nClusters();
38  const auto clusterSize = clust_data.clusterSize().get();
39  const auto clusterADCs = clust_data.clusterADCs().get();
40  const auto detIDs = clust_data.clusterDetId().get();
41  const auto stripIDs = clust_data.firstStrip().get();
42  const auto trueCluster = clust_data.trueCluster().get();
43 
44  const unsigned int initSeedStripsSize = 15000;
45 
47  auto output{std::make_unique<out_t>(edmNew::DetSetVector<SiStripCluster>())};
48  output->reserve(initSeedStripsSize, nSeedStripsNC);
49 
50  std::vector<uint8_t> adcs;
51 
52  for (int i = 0; i < nSeedStripsNC;) {
53  const auto detid = detIDs[i];
54  out_t::FastFiller record(*output, detid);
55 
56  while (i < nSeedStripsNC && detIDs[i] == detid) {
57  if (trueCluster[i]) {
58  const auto size = clusterSize[i];
59  const auto firstStrip = stripIDs[i];
60 
61  adcs.clear();
62  adcs.reserve(size);
63 
64  for (uint32_t j = 0; j < size; ++j) {
65  adcs.push_back(clusterADCs[i + j * nSeedStripsNC]);
66  }
67  record.push_back(SiStripCluster(firstStrip, std::move(adcs)));
68  }
69  i++;
70  }
71  }
72 
73  output->shrink_to_fit();
74  ev.put(std::move(output));
75  }
76 
77 private:
80 };
81 
size
Write out results.
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void produce(edm::Event &ev, const edm::EventSetup &es) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::EDGetTokenT< SiStripClustersCUDAHost > inputToken_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::EDPutTokenT< edmNew::DetSetVector< SiStripCluster > > outputToken_
HLT enums.
Definition: output.py:1
def move(src, dest)
Definition: eostools.py:511
SiStripClustersFromSOA(const edm::ParameterSet &conf)