CMS 3D CMS Logo

RPCInverseCPPFLinkMapESProducer.cc
Go to the documentation of this file.
2 
7 
11 
13 {
14  setWhatProduced(this);
15 }
16 
18 {
20  _descs.add("RPCInverseCPPFLinkMapESProducer", _desc);
21 }
22 
24  RPCInverseAMCLinkMap* inverse_linkmap)
25 {
26  RPCInverseAMCLinkMap::map_type & _inverse_map(inverse_linkmap->getMap());
27  _inverse_map.clear();
28 
30  _rcd.get(_es_map);
31  RPCAMCLinkMap const & _map = *(_es_map.product());
32  for (auto const & _link : _map.getMap()) {
33  _inverse_map.insert(RPCInverseAMCLinkMap::map_type::value_type(_link.second, _link.first));
34  }
35 }
36 
37 std::shared_ptr<RPCInverseAMCLinkMap> RPCInverseCPPFLinkMapESProducer::produce(RPCInverseCPPFLinkMapRcd const & _rcd)
38 {
39  auto host = holder_.makeOrGet([]() {
40  return new HostType;
41  });
42 
43  host->ifRecordChanges<RPCCPPFLinkMapRcd>(_rcd,
44  [this,h=host.get()](auto const& rec) {
45  setupRPCCPPFLinkMap(rec, h);
46  });
47 
48  return host;
49 }
50 
51 //define this as a module
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.
edm::ReusableObjectHolder< HostType > holder_
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
RPCInverseCPPFLinkMapESProducer(edm::ParameterSet const &_config)
std::multimap< RPCLBLink, RPCAMCLink > map_type
map_type & getMap()
Definition: RPCAMCLinkMap.h:28
void setupRPCCPPFLinkMap(RPCCPPFLinkMapRcd const &, RPCInverseAMCLinkMap *)
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
std::shared_ptr< RPCInverseAMCLinkMap > produce(RPCInverseCPPFLinkMapRcd const &_rcd)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::ESProductHost< RPCInverseAMCLinkMap, RPCCPPFLinkMapRcd > HostType
static void fillDescriptions(edm::ConfigurationDescriptions &_descs)
T const * product() const
Definition: ESHandle.h:86