CMS 3D CMS Logo

HGCalRecHitMapProducer.cc
Go to the documentation of this file.
1 // user include files
2 #include <unordered_map>
3 
7 
13 
15 
17 public:
19  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
20 
21  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
22 
23 private:
27 };
28 
30 
31 using DetIdRecHitMap = std::unordered_map<DetId, const HGCRecHit*>;
32 
34  : hits_ee_token_(consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("EEInput"))),
35  hits_fh_token_(consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("FHInput"))),
36  hits_bh_token_(consumes<HGCRecHitCollection>(ps.getParameter<edm::InputTag>("BHInput"))) {
37  produces<DetIdRecHitMap>();
38 }
39 
42  desc.add<edm::InputTag>("EEInput", {"HGCalRecHit", "HGCEERecHits"});
43  desc.add<edm::InputTag>("FHInput", {"HGCalRecHit", "HGCHEFRecHits"});
44  desc.add<edm::InputTag>("BHInput", {"HGCalRecHit", "HGCHEBRecHits"});
45  descriptions.add("hgcalRecHitMapProducer", desc);
46 }
47 
49  auto hitMap = std::make_unique<DetIdRecHitMap>();
50  const auto& ee_hits = evt.get(hits_ee_token_);
51  const auto& fh_hits = evt.get(hits_fh_token_);
52  const auto& bh_hits = evt.get(hits_bh_token_);
53 
54  for (const auto& hit : ee_hits) {
55  hitMap->emplace(hit.detid(), &hit);
56  }
57 
58  for (const auto& hit : fh_hits) {
59  hitMap->emplace(hit.detid(), &hit);
60  }
61 
62  for (const auto& hit : bh_hits) {
63  hitMap->emplace(hit.detid(), &hit);
64  }
65  evt.put(std::move(hitMap));
66 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
std::unordered_map< DetId, const HGCRecHit * > DetIdRecHitMap
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
HGCalRecHitMapProducer(const edm::ParameterSet &)
const edm::EDGetTokenT< HGCRecHitCollection > hits_ee_token_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
const edm::EDGetTokenT< HGCRecHitCollection > hits_bh_token_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
def move(src, dest)
Definition: eostools.py:511
const edm::EDGetTokenT< HGCRecHitCollection > hits_fh_token_