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 }
ConfigurationDescriptions.h
edm::StreamID
Definition: StreamID.h:30
MessageLogger.h
ESHandle.h
edm::EDGetTokenT
Definition: EDGetToken.h:33
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::SortedCollection
Definition: SortedCollection.h:49
HGCalRecHitMapProducer::hits_bh_token_
const edm::EDGetTokenT< HGCRecHitCollection > hits_bh_token_
Definition: HGCalRecHitMapProducer.cc:26
HGCalRecHitMapProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: HGCalRecHitMapProducer.cc:40
MakerMacros.h
HGCalRecHitMapProducer
Definition: HGCalRecHitMapProducer.cc:16
DetIdRecHitMap
std::unordered_map< DetId, const HGCRecHit * > DetIdRecHitMap
Definition: HGCalRecHitMapProducer.cc:31
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
HGCalRecHitMapProducer::hits_fh_token_
const edm::EDGetTokenT< HGCRecHitCollection > hits_fh_token_
Definition: HGCalRecHitMapProducer.cc:25
ParameterSetDescription.h
edm::global::EDProducer
Definition: EDProducer.h:32
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
HGCRecHitCollections.h
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
edm::Event::put
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::EventSetup
Definition: EventSetup.h:58
HGCalRecHitMapProducer::produce
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: HGCalRecHitMapProducer.cc:48
HGCalRecHitMapProducer::HGCalRecHitMapProducer
HGCalRecHitMapProducer(const edm::ParameterSet &)
Definition: HGCalRecHitMapProducer.cc:33
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
Frameworkfwd.h
HGCalRecHitMapProducer::hits_ee_token_
const edm::EDGetTokenT< HGCRecHitCollection > hits_ee_token_
Definition: HGCalRecHitMapProducer.cc:24
EDProducer.h
edm::Event
Definition: Event.h:73
edm::Event::get
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:342
edm::InputTag
Definition: InputTag.h:15
hit
Definition: SiStripHitEffFromCalibTree.cc:88