CondTools
RPC
plugins
RPCInverseLBLinkMapESProducer.cc
Go to the documentation of this file.
1
#include "
CondTools/RPC/plugins/RPCInverseLBLinkMapESProducer.h
"
2
3
#include "
FWCore/Framework/interface/ESHandle.h
"
4
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
5
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
6
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
7
8
#include "
CondFormats/RPCObjects/interface/RPCLBLinkMap.h
"
9
#include "
CondFormats/DataRecord/interface/RPCLBLinkMapRcd.h
"
10
#include "
CondFormats/DataRecord/interface/RPCInverseLBLinkMapRcd.h
"
11
12
#include "
DataFormats/MuonDetId/interface/RPCDetId.h
"
13
14
RPCInverseLBLinkMapESProducer::RPCInverseLBLinkMapESProducer
(
edm::ParameterSet
const
& _config) {
15
setWhatProduced
(
this
);
16
}
17
18
void
RPCInverseLBLinkMapESProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& _descs) {
19
edm::ParameterSetDescription
_desc;
20
_descs.
add
(
"RPCInverseLBLinkMapESProducer"
, _desc);
21
}
22
23
void
RPCInverseLBLinkMapESProducer::setupRPCLBLinkMap
(
RPCLBLinkMapRcd
const
& _rcd,
24
RPCInverseLBLinkMap
* inverse_linkmap) {
25
RPCInverseLBLinkMap::map_type
& _inverse_map(inverse_linkmap->
getMap
());
26
_inverse_map.clear();
27
28
edm::ESHandle<RPCLBLinkMap>
_es_map;
29
_rcd.
get
(_es_map);
30
RPCLBLinkMap
const
& _map = *(_es_map.
product
());
31
for
(
auto
const
& _link : _map.
getMap
()) {
32
_inverse_map.insert(
RPCInverseLBLinkMap::map_type::value_type
(_link.second.getRPCDetId().rawId(), _link));
33
}
34
}
35
36
std::shared_ptr<RPCInverseLBLinkMap>
RPCInverseLBLinkMapESProducer::produce
(
RPCInverseLBLinkMapRcd
const
& _rcd) {
37
auto
host
=
holder_
.
makeOrGet
([]() {
return
new
HostType
; });
38
39
host
->ifRecordChanges<
RPCLBLinkMapRcd
>(_rcd, [
this
,
h
=
host
.get()](
auto
const
& rec) {
setupRPCLBLinkMap
(rec,
h
); });
40
41
return
host
;
42
}
43
44
//define this as a module
45
#include "
FWCore/Framework/interface/ModuleFactory.h
"
46
DEFINE_FWK_EVENTSETUP_MODULE
(
RPCInverseLBLinkMapESProducer
);
ConfigurationDescriptions.h
edm::ESHandle::product
T const * product() const
Definition:
ESHandle.h:86
RPCInverseLBLinkMapESProducer
Definition:
RPCInverseLBLinkMapESProducer.h:20
RPCInverseLBLinkMapESProducer::RPCInverseLBLinkMapESProducer
RPCInverseLBLinkMapESProducer(edm::ParameterSet const &_config)
Definition:
RPCInverseLBLinkMapESProducer.cc:14
ESHandle.h
RPCInverseLBLinkMap
Definition:
RPCInverseLBLinkMap.h:11
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition:
ESProducer.h:163
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
RPCLBLinkMap::getMap
map_type & getMap()
Definition:
RPCLBLinkMap.h:27
query.host
string host
Definition:
query.py:115
edm::ReusableObjectHolder::makeOrGet
std::shared_ptr< T > makeOrGet(F iFunc)
If there isn't an object already available, creates a new one using iFunc.
Definition:
ReusableObjectHolder.h:126
RPCLBLinkMap.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
RPCInverseLBLinkMapRcd.h
edm::ESHandle< RPCLBLinkMap >
RPCInverseLBLinkMapESProducer.h
h
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
RPCDetId.h
edm::ParameterSet
Definition:
ParameterSet.h:47
RPCInverseLBLinkMapESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &_descs)
Definition:
RPCInverseLBLinkMapESProducer.cc:18
RPCInverseLBLinkMapESProducer::produce
std::shared_ptr< RPCInverseLBLinkMap > produce(RPCInverseLBLinkMapRcd const &_rcd)
Definition:
RPCInverseLBLinkMapESProducer.cc:36
RPCInverseLBLinkMapESProducer::setupRPCLBLinkMap
void setupRPCLBLinkMap(RPCLBLinkMapRcd const &, RPCInverseLBLinkMap *)
Definition:
RPCInverseLBLinkMapESProducer.cc:23
RPCLBLinkMap
Definition:
RPCLBLinkMap.h:11
RPCInverseLBLinkMapRcd
Definition:
RPCInverseLBLinkMapRcd.h:9
RPCLBLinkMapRcd
Definition:
RPCLBLinkMapRcd.h:6
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition:
JetExtendedAssociation.h:30
RPCInverseLBLinkMap::getMap
map_type & getMap()
Definition:
RPCInverseLBLinkMap.h:25
ModuleFactory.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition:
ModuleFactory.h:60
RPCInverseLBLinkMapESProducer::HostType
edm::ESProductHost< RPCInverseLBLinkMap, RPCLBLinkMapRcd > HostType
Definition:
RPCInverseLBLinkMapESProducer.h:29
RPCInverseLBLinkMap::map_type
std::multimap< std::uint32_t, std::pair< RPCLBLink, RPCFebConnector > > map_type
Definition:
RPCInverseLBLinkMap.h:13
RPCInverseLBLinkMapESProducer::holder_
edm::ReusableObjectHolder< HostType > holder_
Definition:
RPCInverseLBLinkMapESProducer.h:33
edm::eventsetup::EventSetupRecordImplementation::get
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Definition:
EventSetupRecordImplementation.h:74
ParameterSet.h
RPCLBLinkMapRcd.h
Generated for CMSSW Reference Manual by
1.8.16