CMS 3D CMS Logo

EERecHitFromSoA.cc
Go to the documentation of this file.
8 
11 
13 public:
14  explicit EERecHitFromSoA(const edm::ParameterSet& ps);
15  ~EERecHitFromSoA() override;
16 
17  void produce(edm::Event&, const edm::EventSetup&) override;
19 
20 private:
21  std::unique_ptr<HGCeeRecHitCollection> rechits_;
24 };
25 
27  recHitSoAToken_ = consumes<HGCRecHitCPUProduct>(ps.getParameter<edm::InputTag>("EERecHitSoATok"));
28  recHitCollectionToken_ = produces<HGCeeRecHitCollection>();
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 
edm::EDGetTokenT< HGCRecHitCPUProduct > recHitSoAToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
std::vector< HGCRecHit > HGCRecHitCollection
uint32_t const * id_
void convert_soa_data_to_collection_(uint32_t, HGCRecHitCollection &, ConstHGCRecHitSoA *)
EERecHitFromSoA(const edm::ParameterSet &ps)
~EERecHitFromSoA() override
std::unique_ptr< HGCeeRecHitCollection > rechits_
float const * time_
void produce(edm::Event &, const edm::EventSetup &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Definition: DetId.h:17
float const * energy_
edm::EDPutTokenT< HGCeeRecHitCollection > recHitCollectionToken_
uint32_t const * flagBits_
float const * timeError_
uint8_t const * son_
def move(src, dest)
Definition: eostools.py:511
Definition: event.py:1