CondTools
RPC
plugins
RPCInverseTwinMuxLinkMapESProducer.cc
Go to the documentation of this file.
1
#include "
CondTools/RPC/plugins/RPCInverseTwinMuxLinkMapESProducer.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/RPCAMCLinkMap.h
"
9
#include "
CondFormats/DataRecord/interface/RPCTwinMuxLinkMapRcd.h
"
10
#include "
CondFormats/DataRecord/interface/RPCInverseTwinMuxLinkMapRcd.h
"
11
12
RPCInverseTwinMuxLinkMapESProducer::RPCInverseTwinMuxLinkMapESProducer
(
edm::ParameterSet
const
& _config) {
13
setWhatProduced
(
this
);
14
}
15
16
void
RPCInverseTwinMuxLinkMapESProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& _descs) {
17
edm::ParameterSetDescription
_desc;
18
_descs.
add
(
"RPCInverseTwinMuxLinkMapESProducer"
, _desc);
19
}
20
21
void
RPCInverseTwinMuxLinkMapESProducer::setupRPCTwinMuxLinkMap
(
RPCTwinMuxLinkMapRcd
const
& _rcd,
22
RPCInverseAMCLinkMap
* inverse_linkmap) {
23
RPCInverseAMCLinkMap::map_type
& _inverse_map(inverse_linkmap->
getMap
());
24
_inverse_map.clear();
25
26
edm::ESHandle<RPCAMCLinkMap>
_es_map;
27
_rcd.
get
(_es_map);
28
RPCAMCLinkMap
const
& _map = *(_es_map.
product
());
29
for
(
auto
const
& _link : _map.
getMap
()) {
30
_inverse_map.insert(
RPCInverseAMCLinkMap::map_type::value_type
(_link.second, _link.first));
31
}
32
}
33
34
std::shared_ptr<RPCInverseAMCLinkMap>
RPCInverseTwinMuxLinkMapESProducer::produce
(
35
RPCInverseTwinMuxLinkMapRcd
const
& _rcd) {
36
auto
host
=
holder_
.
makeOrGet
([]() {
return
new
HostType
; });
37
38
host
->ifRecordChanges<
RPCTwinMuxLinkMapRcd
>(
39
_rcd, [
this
,
h
=
host
.get()](
auto
const
& rec) {
setupRPCTwinMuxLinkMap
(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
(
RPCInverseTwinMuxLinkMapESProducer
);
ConfigurationDescriptions.h
edm::ESHandle::product
T const * product() const
Definition:
ESHandle.h:86
RPCInverseTwinMuxLinkMapESProducer::RPCInverseTwinMuxLinkMapESProducer
RPCInverseTwinMuxLinkMapESProducer(edm::ParameterSet const &_config)
Definition:
RPCInverseTwinMuxLinkMapESProducer.cc:12
RPCInverseAMCLinkMap
Definition:
RPCInverseAMCLinkMap.h:9
ESHandle.h
RPCInverseAMCLinkMap::map_type
std::multimap< RPCLBLink, RPCAMCLink > map_type
Definition:
RPCInverseAMCLinkMap.h:11
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition:
ESProducer.h:163
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
RPCAMCLinkMap
Definition:
RPCAMCLinkMap.h:11
RPCInverseTwinMuxLinkMapESProducer::produce
std::shared_ptr< RPCInverseAMCLinkMap > produce(RPCInverseTwinMuxLinkMapRcd const &_rcd)
Definition:
RPCInverseTwinMuxLinkMapESProducer.cc:34
query.host
string host
Definition:
query.py:115
RPCInverseTwinMuxLinkMapESProducer
Definition:
RPCInverseTwinMuxLinkMapESProducer.h:20
RPCAMCLinkMap.h
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
RPCTwinMuxLinkMapRcd.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
edm::ESHandle< RPCAMCLinkMap >
h
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
RPCInverseAMCLinkMap::getMap
map_type & getMap()
Definition:
RPCInverseAMCLinkMap.h:23
RPCInverseTwinMuxLinkMapESProducer::holder_
edm::ReusableObjectHolder< HostType > holder_
Definition:
RPCInverseTwinMuxLinkMapESProducer.h:33
edm::ParameterSet
Definition:
ParameterSet.h:47
RPCInverseTwinMuxLinkMapRcd.h
RPCInverseTwinMuxLinkMapESProducer::setupRPCTwinMuxLinkMap
void setupRPCTwinMuxLinkMap(RPCTwinMuxLinkMapRcd const &, RPCInverseAMCLinkMap *)
Definition:
RPCInverseTwinMuxLinkMapESProducer.cc:21
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition:
JetExtendedAssociation.h:30
RPCInverseTwinMuxLinkMapESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &_descs)
Definition:
RPCInverseTwinMuxLinkMapESProducer.cc:16
ModuleFactory.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition:
ModuleFactory.h:60
RPCInverseTwinMuxLinkMapRcd
Definition:
RPCInverseTwinMuxLinkMapRcd.h:9
RPCInverseTwinMuxLinkMapESProducer::HostType
edm::ESProductHost< RPCInverseAMCLinkMap, RPCTwinMuxLinkMapRcd > HostType
Definition:
RPCInverseTwinMuxLinkMapESProducer.h:29
RPCInverseTwinMuxLinkMapESProducer.h
edm::eventsetup::EventSetupRecordImplementation::get
PRODUCT const & get(ESGetToken< PRODUCT, T > const &iToken) const
Definition:
EventSetupRecordImplementation.h:74
RPCAMCLinkMap::getMap
map_type & getMap()
Definition:
RPCAMCLinkMap.h:27
ParameterSet.h
RPCTwinMuxLinkMapRcd
Definition:
RPCTwinMuxLinkMapRcd.h:6
Generated for CMSSW Reference Manual by
1.8.16