CondTools
RPC
plugins
RPCInverseCPPFLinkMapESProducer.cc
Go to the documentation of this file.
1
#include "
CondTools/RPC/plugins/RPCInverseCPPFLinkMapESProducer.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/RPCCPPFLinkMapRcd.h
"
10
#include "
CondFormats/DataRecord/interface/RPCInverseCPPFLinkMapRcd.h
"
11
12
RPCInverseCPPFLinkMapESProducer::RPCInverseCPPFLinkMapESProducer
(
edm::ParameterSet
const
& _config) {
13
setWhatProduced
(
this
);
14
}
15
16
void
RPCInverseCPPFLinkMapESProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& _descs) {
17
edm::ParameterSetDescription
_desc;
18
_descs.
add
(
"RPCInverseCPPFLinkMapESProducer"
, _desc);
19
}
20
21
void
RPCInverseCPPFLinkMapESProducer::setupRPCCPPFLinkMap
(
RPCCPPFLinkMapRcd
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>
RPCInverseCPPFLinkMapESProducer::produce
(
RPCInverseCPPFLinkMapRcd
const
& _rcd) {
35
auto
host
=
holder_
.
makeOrGet
([]() {
return
new
HostType
; });
36
37
host
->ifRecordChanges<
RPCCPPFLinkMapRcd
>(_rcd,
38
[
this
,
h
=
host
.get()](
auto
const
& rec) {
setupRPCCPPFLinkMap
(rec,
h
); });
39
40
return
host
;
41
}
42
43
//define this as a module
44
#include "
FWCore/Framework/interface/ModuleFactory.h
"
45
DEFINE_FWK_EVENTSETUP_MODULE
(
RPCInverseCPPFLinkMapESProducer
);
ConfigurationDescriptions.h
edm::ESHandle::product
T const * product() const
Definition:
ESHandle.h:86
RPCInverseCPPFLinkMapESProducer::setupRPCCPPFLinkMap
void setupRPCCPPFLinkMap(RPCCPPFLinkMapRcd const &, RPCInverseAMCLinkMap *)
Definition:
RPCInverseCPPFLinkMapESProducer.cc:21
RPCInverseAMCLinkMap
Definition:
RPCInverseAMCLinkMap.h:9
RPCInverseCPPFLinkMapESProducer::RPCInverseCPPFLinkMapESProducer
RPCInverseCPPFLinkMapESProducer(edm::ParameterSet const &_config)
Definition:
RPCInverseCPPFLinkMapESProducer.cc:12
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:138
edm::ParameterSetDescription
Definition:
ParameterSetDescription.h:52
RPCAMCLinkMap
Definition:
RPCAMCLinkMap.h:11
RPCInverseCPPFLinkMapESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &_descs)
Definition:
RPCInverseCPPFLinkMapESProducer.cc:16
query.host
host
Definition:
query.py:115
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
RPCInverseCPPFLinkMapESProducer::produce
std::shared_ptr< RPCInverseAMCLinkMap > produce(RPCInverseCPPFLinkMapRcd const &_rcd)
Definition:
RPCInverseCPPFLinkMapESProducer.cc:34
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
RPCInverseCPPFLinkMapRcd.h
RPCInverseCPPFLinkMapESProducer
Definition:
RPCInverseCPPFLinkMapESProducer.h:20
edm::ESHandle< RPCAMCLinkMap >
h
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
RPCInverseAMCLinkMap::getMap
map_type & getMap()
Definition:
RPCInverseAMCLinkMap.h:23
edm::ParameterSet
Definition:
ParameterSet.h:36
RPCInverseCPPFLinkMapESProducer::HostType
edm::ESProductHost< RPCInverseAMCLinkMap, RPCCPPFLinkMapRcd > HostType
Definition:
RPCInverseCPPFLinkMapESProducer.h:29
RPCInverseCPPFLinkMapESProducer::holder_
edm::ReusableObjectHolder< HostType > holder_
Definition:
RPCInverseCPPFLinkMapESProducer.h:33
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition:
JetExtendedAssociation.h:30
RPCInverseCPPFLinkMapRcd
Definition:
RPCInverseCPPFLinkMapRcd.h:9
ModuleFactory.h
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition:
ModuleFactory.h:60
RPCCPPFLinkMapRcd
Definition:
RPCCPPFLinkMapRcd.h:6
RPCCPPFLinkMapRcd.h
RPCInverseCPPFLinkMapESProducer.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
Generated for CMSSW Reference Manual by
1.8.16