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/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/RPCAMCLinkMap.h
"
11
#include "
CondFormats/DataRecord/interface/RPCCPPFLinkMapRcd.h
"
12
#include "
CondFormats/DataRecord/interface/RPCInverseCPPFLinkMapRcd.h
"
13
14
RPCInverseCPPFLinkMapESProducer::RPCInverseCPPFLinkMapESProducer
(
edm::ParameterSet
const
& _config) {
15
auto
cc
=
setWhatProduced
(
this
);
16
es_rpc_cppf_l_map_token_
=
cc
.consumesFrom<
RPCAMCLinkMap
,
RPCCPPFLinkMapRcd
>();
17
}
18
19
void
RPCInverseCPPFLinkMapESProducer::fillDescriptions
(
edm::ConfigurationDescriptions
& _descs) {
20
edm::ParameterSetDescription
_desc;
21
_descs.
add
(
"RPCInverseCPPFLinkMapESProducer"
, _desc);
22
}
23
24
void
RPCInverseCPPFLinkMapESProducer::setupRPCCPPFLinkMap
(
RPCCPPFLinkMapRcd
const
& _rcd,
25
RPCInverseAMCLinkMap
* inverse_linkmap) {
26
RPCInverseAMCLinkMap::map_type
& _inverse_map(inverse_linkmap->
getMap
());
27
_inverse_map.clear();
28
29
RPCAMCLinkMap
const
& _map = _rcd.
get
(
es_rpc_cppf_l_map_token_
);
30
31
for
(
auto
const
& _link : _map.
getMap
()) {
32
_inverse_map.insert(
RPCInverseAMCLinkMap::map_type::value_type
(_link.second, _link.first));
33
}
34
}
35
36
std::shared_ptr<RPCInverseAMCLinkMap>
RPCInverseCPPFLinkMapESProducer::produce
(
RPCInverseCPPFLinkMapRcd
const
& _rcd) {
37
auto
host
=
holder_
.
makeOrGet
([]() {
return
new
HostType
; });
38
39
host
->ifRecordChanges<
RPCCPPFLinkMapRcd
>(_rcd,
40
[
this
,
h
=
host
.get()](
auto
const
& rec) {
setupRPCCPPFLinkMap
(rec,
h
); });
41
42
return
host
;
43
}
44
45
//define this as a module
46
#include "
FWCore/Framework/interface/ModuleFactory.h
"
47
DEFINE_FWK_EVENTSETUP_MODULE
(
RPCInverseCPPFLinkMapESProducer
);
ConfigurationDescriptions.h
RPCInverseCPPFLinkMapESProducer::setupRPCCPPFLinkMap
void setupRPCCPPFLinkMap(RPCCPPFLinkMapRcd const &, RPCInverseAMCLinkMap *)
Definition:
RPCInverseCPPFLinkMapESProducer.cc:24
RPCInverseAMCLinkMap
Definition:
RPCInverseAMCLinkMap.h:9
RPCInverseCPPFLinkMapESProducer::RPCInverseCPPFLinkMapESProducer
RPCInverseCPPFLinkMapESProducer(edm::ParameterSet const &_config)
Definition:
RPCInverseCPPFLinkMapESProducer.cc:14
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
RPCInverseCPPFLinkMapESProducer::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &_descs)
Definition:
RPCInverseCPPFLinkMapESProducer.cc:19
query.host
string 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:36
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition:
ConfigurationDescriptions.cc:57
RPCInverseCPPFLinkMapRcd.h
RPCInverseCPPFLinkMapESProducer
Definition:
RPCInverseCPPFLinkMapESProducer.h:23
h
ParameterSetDescription.h
edm::ConfigurationDescriptions
Definition:
ConfigurationDescriptions.h:28
RPCInverseAMCLinkMap::getMap
map_type & getMap()
Definition:
RPCInverseAMCLinkMap.h:23
edm::ParameterSet
Definition:
ParameterSet.h:47
RPCInverseCPPFLinkMapESProducer::HostType
edm::ESProductHost< RPCInverseAMCLinkMap, RPCCPPFLinkMapRcd > HostType
Definition:
RPCInverseCPPFLinkMapESProducer.h:32
Event.h
RPCInverseCPPFLinkMapESProducer::holder_
edm::ReusableObjectHolder< HostType > holder_
Definition:
RPCInverseCPPFLinkMapESProducer.h:36
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition:
JetExtendedAssociation.h:30
cc
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
EventSetup.h
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
RPCInverseCPPFLinkMapESProducer::es_rpc_cppf_l_map_token_
edm::ESGetToken< RPCAMCLinkMap, RPCCPPFLinkMapRcd > es_rpc_cppf_l_map_token_
Definition:
RPCInverseCPPFLinkMapESProducer.h:38
Generated for CMSSW Reference Manual by
1.8.16