CMS 3D CMS Logo

RPCInverseLBLinkMapESProducer.cc
Go to the documentation of this file.
2 
7 
11 
13 
15 {
16  setWhatProduced(this);
17 }
18 
20 {
22  _descs.add("RPCInverseLBLinkMapESProducer", _desc);
23 }
24 
26  RPCInverseLBLinkMap* inverse_linkmap)
27 {
28  RPCInverseLBLinkMap::map_type & _inverse_map(inverse_linkmap->getMap());
29  _inverse_map.clear();
30 
32  _rcd.get(_es_map);
33  RPCLBLinkMap const & _map = *(_es_map.product());
34  for (auto const & _link : _map.getMap()) {
35  _inverse_map.insert(RPCInverseLBLinkMap::map_type::value_type(_link.second.getRPCDetId().rawId(), _link));
36  }
37 }
38 
39 std::shared_ptr<RPCInverseLBLinkMap> RPCInverseLBLinkMapESProducer::produce(RPCInverseLBLinkMapRcd const & _rcd)
40 {
41  auto host = holder_.makeOrGet([]() {
42  return new HostType;
43  });
44 
45  host->ifRecordChanges<RPCLBLinkMapRcd>(_rcd,
46  [this,h=host.get()](auto const& rec) {
47  setupRPCLBLinkMap(rec, h);
48  });
49 
50  return host;
51 }
52 
53 //define this as a module
edm::ESProductHost< RPCInverseLBLinkMap, RPCLBLinkMapRcd > HostType
RPCInverseLBLinkMapESProducer(edm::ParameterSet const &_config)
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:124
host
Definition: query.py:115
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn&#39;t an object already available, creates a new one using iFunc.
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
static void fillDescriptions(edm::ConfigurationDescriptions &_descs)
map_type & getMap()
Definition: RPCLBLinkMap.h:28
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
void setupRPCLBLinkMap(RPCLBLinkMapRcd const &, RPCInverseLBLinkMap *)
edm::ReusableObjectHolder< HostType > holder_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::multimap< std::uint32_t, std::pair< RPCLBLink, RPCFebConnector > > map_type
std::shared_ptr< RPCInverseLBLinkMap > produce(RPCInverseLBLinkMapRcd const &_rcd)
T const * product() const
Definition: ESHandle.h:86