CMS 3D CMS Logo

HEBRecHitFromSoA.cc
Go to the documentation of this file.
1 #include <memory>
2 
10 
13 
15 public:
16  explicit HEBRecHitFromSoA(const edm::ParameterSet& ps);
17  ~HEBRecHitFromSoA() override;
18 
19  void produce(edm::Event&, const edm::EventSetup&) override;
21 
22 private:
23  std::unique_ptr<HGChefRecHitCollection> rechits_;
26 };
27 
29  recHitSoAToken_ = consumes<HGCRecHitCPUProduct>(ps.getParameter<edm::InputTag>("HEBRecHitSoATok"));
30  recHitCollectionToken_ = produces<HGChebRecHitCollection>();
31 }
32 
34 
36  const HGCRecHitCPUProduct& recHits = event.get(recHitSoAToken_);
37  ConstHGCRecHitSoA recHitsSoA = recHits.get();
38  rechits_ = std::make_unique<HGCRecHitCollection>();
39  convert_soa_data_to_collection_(recHits.nHits(), *rechits_, &recHitsSoA);
40  event.put(std::move(rechits_));
41 }
42 
45  ConstHGCRecHitSoA* h_calibSoA) {
46  rechits.reserve(nhits);
47  for (uint i = 0; i < nhits; ++i) {
48  DetId id_converted(h_calibSoA->id_[i]);
49  rechits.emplace_back(id_converted,
50  h_calibSoA->energy_[i],
51  h_calibSoA->time_[i],
52  0,
53  h_calibSoA->flagBits_[i],
54  h_calibSoA->son_[i],
55  h_calibSoA->timeError_[i]);
56  }
57 }
58 
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
~HEBRecHitFromSoA() override
uint32_t const * id_
edm::EDGetTokenT< HGCRecHitCPUProduct > recHitSoAToken_
float const * time_
std::unique_ptr< HGChefRecHitCollection > rechits_
void convert_soa_data_to_collection_(uint32_t, HGCRecHitCollection &, ConstHGCRecHitSoA *)
void produce(edm::Event &, const edm::EventSetup &) override
Definition: DetId.h:17
HEBRecHitFromSoA(const edm::ParameterSet &ps)
float const * energy_
edm::EDPutTokenT< HGChefRecHitCollection > recHitCollectionToken_
uint32_t const * flagBits_
float const * timeError_
uint8_t const * son_
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1