CMS 3D CMS Logo

HGCalSoARecHitsLayerClustersProducer.cc
Go to the documentation of this file.
16 
21 
22 // Processes the input RecHit SoA collection and generates an output SoA
23 // containing all the necessary information to build the clusters.
24 // Specifically, this producer does not create the clusters in any format.
25 // Instead, it fills a SoA (HGCalSoARecHitsExtra) with the same size as the input
26 // RecHit SoA. This output SoA includes all the data needed to assemble the
27 // clusters and assigns a clusterId to each cell that belongs to a cluster.
28 // Consequently, this producer must be used by another downstream producer to
29 // either build traditional clusters or to create a SoA representing the
30 // clusters, complete with all required information (e.g., energy, position).
32 
34  public:
36  : getTokenDevice_{consumes(config.getParameter<edm::InputTag>("hgcalRecHitsSoA"))},
38  deltac_((float)config.getParameter<double>("deltac")),
39  kappa_((float)config.getParameter<double>("kappa")),
40  outlierDeltaFactor_((float)config.getParameter<double>("outlierDeltaFactor")) {}
41 
42  ~HGCalSoARecHitsLayerClustersProducer() override = default;
43 
44  void produce(device::Event& iEvent, device::EventSetup const& iSetup) override {
45  auto const& deviceInput = iEvent.get(getTokenDevice_);
46  //std::cout << "Size of device collection: " << deviceInput->metadata().size() << std::endl;
47  auto const input_v = deviceInput.view();
48  // Allocate output SoA
49  HGCalSoARecHitsExtraDeviceCollection output(deviceInput->metadata().size(), iEvent.queue());
50  auto output_v = output.view();
51 
52  algo_.run(
53  iEvent.queue(), deviceInput->metadata().size(), deltac_, kappa_, outlierDeltaFactor_, input_v, output_v);
55  }
56 
57  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
59  desc.add<edm::InputTag>("hgcalRecHitsSoA", edm::InputTag("TO BE DEFINED"));
60  desc.add<double>("deltac", 1.3);
61  desc.add<double>("kappa", 9.);
62  desc.add<double>("outlierDeltaFactor", 2.);
63  descriptions.addWithDefaultLabel(desc);
64  }
65 
66  private:
67  // use device::EDGetToken<T> to read from device memory space
71  const float deltac_;
72  const float kappa_;
73  const float outlierDeltaFactor_;
74  };
75 
76 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
77 
79 DEFINE_FWK_ALPAKA_MODULE(HGCalSoARecHitsLayerClustersProducer);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
device::EDGetToken< HGCalSoARecHitsDeviceCollection > const getTokenDevice_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: config.py:1
PortableCollection< HGCalSoARecHitsExtra > HGCalSoARecHitsExtraDeviceCollection
int iEvent
Definition: GenABIO.cc:224
void produce(device::Event &iEvent, device::EventSetup const &iSetup) override
void run(Queue &queue, const unsigned int size, const float dc, const float kappa, const float outlierDeltaFactor, const HGCalSoARecHitsDeviceCollection::ConstView inputs, HGCalSoARecHitsExtraDeviceCollection::View outputs) const
auto produces(std::string instanceName) noexcept
declare what type of product will make and with which optional label
device::EDPutToken< HGCalSoARecHitsExtraDeviceCollection > const deviceToken_
#define DEFINE_FWK_ALPAKA_MODULE(name)
Definition: MakerMacros.h:16
Definition: output.py:1
def move(src, dest)
Definition: eostools.py:511