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/Event.h
"
4
#include "
FWCore/Framework/interface/EventSetup.h
"
5
#include "
FWCore/Framework/interface/ESHandle.h
"
6
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
7
#include "
FWCore/ParameterSet/interface/ParameterSetDescription.h
"
8
#include "
FWCore/ParameterSet/interface/ConfigurationDescriptions.h
"
9
10
#include "
CondFormats/RPCObjects/interface/RPCLBLinkMap.h
"
11
#include "
CondFormats/DataRecord/interface/RPCLBLinkMapRcd.h
"
12
#include "
CondFormats/DataRecord/interface/RPCInverseLBLinkMapRcd.h
"
13
14
#include "
DataFormats/MuonDetId/interface/RPCDetId.h
"
15
16
RPCInverseLBLinkMapESProducer::RPCInverseLBLinkMapESProducer
(
edm::ParameterSet
const
& _config) {
17
auto
cc
=
setWhatProduced
(
this
);
18
19
es_rpc_lb_map_token_
=
cc
.consumesFrom<
RPCLBLinkMap
,
RPCLBLinkMapRcd
>();
20
}
21
22
void
RPCInverseLBLinkMapESProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& _descs) {
23
edm::ParameterSetDescription
_desc;
24
_descs.
add
(
"RPCInverseLBLinkMapESProducer"
, _desc);
25
}
26
27
void
RPCInverseLBLinkMapESProducer::setupRPCLBLinkMap
(
RPCLBLinkMapRcd
const
& _rcd,
28
RPCInverseLBLinkMap
* inverse_linkmap) {
29
RPCInverseLBLinkMap::map_type
& _inverse_map(inverse_linkmap->
getMap
());
30
_inverse_map.clear();
31
32
RPCLBLinkMap
const
& _map = _rcd.
get
(
es_rpc_lb_map_token_
);
33
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
auto
host
=
holder_
.
makeOrGet
([]() {
return
new
HostType
; });
41
42
host
->ifRecordChanges<
RPCLBLinkMapRcd
>(_rcd, [
this
,
h
=
host
.get()](
auto
const
& rec) {
setupRPCLBLinkMap
(rec,
h
); });
43
44
return
host
;
45
}
46
47
//define this as a module
48
#include "
FWCore/Framework/interface/ModuleFactory.h
"
49
DEFINE_FWK_EVENTSETUP_MODULE
(
RPCInverseLBLinkMapESProducer
);
ConfigurationDescriptions.h
RPCInverseLBLinkMapESProducer
Definition:
RPCInverseLBLinkMapESProducer.h:23
RPCInverseLBLinkMapESProducer::RPCInverseLBLinkMapESProducer
RPCInverseLBLinkMapESProducer(edm::ParameterSet const &_config)
Definition:
RPCInverseLBLinkMapESProducer.cc:16
RPCInverseLBLinkMapESProducer::es_rpc_lb_map_token_
edm::ESGetToken< RPCLBLinkMap, RPCLBLinkMapRcd > es_rpc_lb_map_token_
Definition:
RPCInverseLBLinkMapESProducer.h:38
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
RPCInverseLBLinkMapESProducer.h
h
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
RPCDetId.h
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
RPCInverseLBLinkMapESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &_descs)
Definition:
RPCInverseLBLinkMapESProducer.cc:22
RPCInverseLBLinkMapESProducer::produce
std::shared_ptr< RPCInverseLBLinkMap > produce(RPCInverseLBLinkMapRcd const &_rcd)
Definition:
RPCInverseLBLinkMapESProducer.cc:39
RPCInverseLBLinkMapESProducer::setupRPCLBLinkMap
void setupRPCLBLinkMap(RPCLBLinkMapRcd const &, RPCInverseLBLinkMap *)
Definition:
RPCInverseLBLinkMapESProducer.cc:27
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
cc
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
EventSetup.h
RPCInverseLBLinkMapESProducer::HostType
edm::ESProductHost< RPCInverseLBLinkMap, RPCLBLinkMapRcd > HostType
Definition:
RPCInverseLBLinkMapESProducer.h:32
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:36
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