CMS 3D CMS Logo

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