Skip to content

Commit

Permalink
Merge pull request #24511 from wddgit/rpcConcurrentIOVs
Browse files Browse the repository at this point in the history
Prepare RPCInverse ESProducers for concurrent IOVs
  • Loading branch information
cmsbuild committed Sep 20, 2018
2 parents 0ca5536 + aa9aa16 commit ec8f8f8
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 36 deletions.
19 changes: 14 additions & 5 deletions CondTools/RPC/plugins/RPCInverseCPPFLinkMapESProducer.cc
Expand Up @@ -10,9 +10,8 @@
#include "CondFormats/DataRecord/interface/RPCInverseCPPFLinkMapRcd.h"

RPCInverseCPPFLinkMapESProducer::RPCInverseCPPFLinkMapESProducer(edm::ParameterSet const & _config)
: inverse_linkmap_(new RPCInverseAMCLinkMap())
{
setWhatProduced(this, edm::eventsetup::dependsOn(&RPCInverseCPPFLinkMapESProducer::RPCCPPFLinkMapCallback));
setWhatProduced(this);
}

void RPCInverseCPPFLinkMapESProducer::fillDescriptions(edm::ConfigurationDescriptions & _descs)
Expand All @@ -21,9 +20,10 @@ void RPCInverseCPPFLinkMapESProducer::fillDescriptions(edm::ConfigurationDescrip
_descs.add("RPCInverseCPPFLinkMapESProducer", _desc);
}

void RPCInverseCPPFLinkMapESProducer::RPCCPPFLinkMapCallback(RPCCPPFLinkMapRcd const & _rcd)
void RPCInverseCPPFLinkMapESProducer::setupRPCCPPFLinkMap(RPCCPPFLinkMapRcd const & _rcd,
RPCInverseAMCLinkMap* inverse_linkmap)
{
RPCInverseAMCLinkMap::map_type & _inverse_map(inverse_linkmap_->getMap());
RPCInverseAMCLinkMap::map_type & _inverse_map(inverse_linkmap->getMap());
_inverse_map.clear();

edm::ESHandle<RPCAMCLinkMap> _es_map;
Expand All @@ -36,7 +36,16 @@ void RPCInverseCPPFLinkMapESProducer::RPCCPPFLinkMapCallback(RPCCPPFLinkMapRcd c

std::shared_ptr<RPCInverseAMCLinkMap> RPCInverseCPPFLinkMapESProducer::produce(RPCInverseCPPFLinkMapRcd const & _rcd)
{
return inverse_linkmap_;
auto host = holder_.makeOrGet([]() {
return new HostType;
});

host->ifRecordChanges<RPCCPPFLinkMapRcd>(_rcd,
[this,h=host.get()](auto const& rec) {
setupRPCCPPFLinkMap(rec, h);
});

return host;
}

//define this as a module
Expand Down
15 changes: 11 additions & 4 deletions CondTools/RPC/plugins/RPCInverseCPPFLinkMapESProducer.h
Expand Up @@ -4,6 +4,8 @@
#include <memory>

#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ESProductHost.h"
#include "FWCore/Utilities/interface/ReusableObjectHolder.h"

#include "CondFormats/RPCObjects/interface/RPCInverseAMCLinkMap.h"

Expand All @@ -23,12 +25,17 @@ class RPCInverseCPPFLinkMapESProducer

static void fillDescriptions(edm::ConfigurationDescriptions & _descs);

void RPCCPPFLinkMapCallback(RPCCPPFLinkMapRcd const & _rcd);

std::shared_ptr<RPCInverseAMCLinkMap> produce(RPCInverseCPPFLinkMapRcd const & _rcd);

protected:
std::shared_ptr<RPCInverseAMCLinkMap> inverse_linkmap_;
private:

using HostType = edm::ESProductHost<RPCInverseAMCLinkMap,
RPCCPPFLinkMapRcd>;

void setupRPCCPPFLinkMap(RPCCPPFLinkMapRcd const&,
RPCInverseAMCLinkMap*);

edm::ReusableObjectHolder<HostType> holder_;
};

#endif // CondTools_RPC_RPCInverseCPPFLinkMapESProducer_h
19 changes: 14 additions & 5 deletions CondTools/RPC/plugins/RPCInverseLBLinkMapESProducer.cc
Expand Up @@ -12,9 +12,8 @@
#include "DataFormats/MuonDetId/interface/RPCDetId.h"

RPCInverseLBLinkMapESProducer::RPCInverseLBLinkMapESProducer(edm::ParameterSet const & _config)
: inverse_linkmap_(new RPCInverseLBLinkMap())
{
setWhatProduced(this, edm::eventsetup::dependsOn(&RPCInverseLBLinkMapESProducer::RPCLBLinkMapCallback));
setWhatProduced(this);
}

void RPCInverseLBLinkMapESProducer::fillDescriptions(edm::ConfigurationDescriptions & _descs)
Expand All @@ -23,9 +22,10 @@ void RPCInverseLBLinkMapESProducer::fillDescriptions(edm::ConfigurationDescripti
_descs.add("RPCInverseLBLinkMapESProducer", _desc);
}

void RPCInverseLBLinkMapESProducer::RPCLBLinkMapCallback(RPCLBLinkMapRcd const & _rcd)
void RPCInverseLBLinkMapESProducer::setupRPCLBLinkMap(RPCLBLinkMapRcd const & _rcd,
RPCInverseLBLinkMap* inverse_linkmap)
{
RPCInverseLBLinkMap::map_type & _inverse_map(inverse_linkmap_->getMap());
RPCInverseLBLinkMap::map_type & _inverse_map(inverse_linkmap->getMap());
_inverse_map.clear();

edm::ESHandle<RPCLBLinkMap> _es_map;
Expand All @@ -38,7 +38,16 @@ void RPCInverseLBLinkMapESProducer::RPCLBLinkMapCallback(RPCLBLinkMapRcd const &

std::shared_ptr<RPCInverseLBLinkMap> RPCInverseLBLinkMapESProducer::produce(RPCInverseLBLinkMapRcd const & _rcd)
{
return inverse_linkmap_;
auto host = holder_.makeOrGet([]() {
return new HostType;
});

host->ifRecordChanges<RPCLBLinkMapRcd>(_rcd,
[this,h=host.get()](auto const& rec) {
setupRPCLBLinkMap(rec, h);
});

return host;
}

//define this as a module
Expand Down
15 changes: 11 additions & 4 deletions CondTools/RPC/plugins/RPCInverseLBLinkMapESProducer.h
Expand Up @@ -4,6 +4,8 @@
#include <memory>

#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ESProductHost.h"
#include "FWCore/Utilities/interface/ReusableObjectHolder.h"

#include "CondFormats/RPCObjects/interface/RPCInverseLBLinkMap.h"

Expand All @@ -23,12 +25,17 @@ class RPCInverseLBLinkMapESProducer

static void fillDescriptions(edm::ConfigurationDescriptions & _descs);

void RPCLBLinkMapCallback(RPCLBLinkMapRcd const & _rcd);

std::shared_ptr<RPCInverseLBLinkMap> produce(RPCInverseLBLinkMapRcd const & _rcd);

protected:
std::shared_ptr<RPCInverseLBLinkMap> inverse_linkmap_;
private:

using HostType = edm::ESProductHost<RPCInverseLBLinkMap,
RPCLBLinkMapRcd>;

void setupRPCLBLinkMap(RPCLBLinkMapRcd const&,
RPCInverseLBLinkMap*);

edm::ReusableObjectHolder<HostType> holder_;
};

#endif // CondTools_RPC_RPCInverseLBLinkMapESProducer_h
19 changes: 14 additions & 5 deletions CondTools/RPC/plugins/RPCInverseOMTFLinkMapESProducer.cc
Expand Up @@ -10,9 +10,8 @@
#include "CondFormats/DataRecord/interface/RPCInverseOMTFLinkMapRcd.h"

RPCInverseOMTFLinkMapESProducer::RPCInverseOMTFLinkMapESProducer(edm::ParameterSet const & _config)
: inverse_linkmap_(new RPCInverseAMCLinkMap())
{
setWhatProduced(this, edm::eventsetup::dependsOn(&RPCInverseOMTFLinkMapESProducer::RPCOMTFLinkMapCallback));
setWhatProduced(this);
}

void RPCInverseOMTFLinkMapESProducer::fillDescriptions(edm::ConfigurationDescriptions & _descs)
Expand All @@ -21,9 +20,10 @@ void RPCInverseOMTFLinkMapESProducer::fillDescriptions(edm::ConfigurationDescrip
_descs.add("RPCInverseOMTFLinkMapESProducer", _desc);
}

void RPCInverseOMTFLinkMapESProducer::RPCOMTFLinkMapCallback(RPCOMTFLinkMapRcd const & _rcd)
void RPCInverseOMTFLinkMapESProducer::setupRPCOMTFLinkMap(RPCOMTFLinkMapRcd const & _rcd,
RPCInverseAMCLinkMap* inverse_linkmap)
{
RPCInverseAMCLinkMap::map_type & _inverse_map(inverse_linkmap_->getMap());
RPCInverseAMCLinkMap::map_type & _inverse_map(inverse_linkmap->getMap());
_inverse_map.clear();

edm::ESHandle<RPCAMCLinkMap> _es_map;
Expand All @@ -37,7 +37,16 @@ void RPCInverseOMTFLinkMapESProducer::RPCOMTFLinkMapCallback(RPCOMTFLinkMapRcd c

std::shared_ptr<RPCInverseAMCLinkMap> RPCInverseOMTFLinkMapESProducer::produce(RPCInverseOMTFLinkMapRcd const & _rcd)
{
return inverse_linkmap_;
auto host = holder_.makeOrGet([]() {
return new HostType;
});

host->ifRecordChanges<RPCOMTFLinkMapRcd>(_rcd,
[this,h=host.get()](auto const& rec) {
setupRPCOMTFLinkMap(rec, h);
});

return host;
}

//define this as a module
Expand Down
15 changes: 11 additions & 4 deletions CondTools/RPC/plugins/RPCInverseOMTFLinkMapESProducer.h
Expand Up @@ -4,6 +4,8 @@
#include <memory>

#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ESProductHost.h"
#include "FWCore/Utilities/interface/ReusableObjectHolder.h"

#include "CondFormats/RPCObjects/interface/RPCInverseAMCLinkMap.h"

Expand All @@ -23,12 +25,17 @@ class RPCInverseOMTFLinkMapESProducer

static void fillDescriptions(edm::ConfigurationDescriptions & _descs);

void RPCOMTFLinkMapCallback(RPCOMTFLinkMapRcd const & _rcd);

std::shared_ptr<RPCInverseAMCLinkMap> produce(RPCInverseOMTFLinkMapRcd const & _rcd);

protected:
std::shared_ptr<RPCInverseAMCLinkMap> inverse_linkmap_;
private:

using HostType = edm::ESProductHost<RPCInverseAMCLinkMap,
RPCOMTFLinkMapRcd>;

void setupRPCOMTFLinkMap(RPCOMTFLinkMapRcd const&,
RPCInverseAMCLinkMap*);

edm::ReusableObjectHolder<HostType> holder_;
};

#endif // CondTools_RPC_RPCInverseOMTFLinkMapESProducer_h
19 changes: 14 additions & 5 deletions CondTools/RPC/plugins/RPCInverseTwinMuxLinkMapESProducer.cc
Expand Up @@ -10,9 +10,8 @@
#include "CondFormats/DataRecord/interface/RPCInverseTwinMuxLinkMapRcd.h"

RPCInverseTwinMuxLinkMapESProducer::RPCInverseTwinMuxLinkMapESProducer(edm::ParameterSet const & _config)
: inverse_linkmap_(new RPCInverseAMCLinkMap())
{
setWhatProduced(this, edm::eventsetup::dependsOn(&RPCInverseTwinMuxLinkMapESProducer::RPCTwinMuxLinkMapCallback));
setWhatProduced(this);
}

void RPCInverseTwinMuxLinkMapESProducer::fillDescriptions(edm::ConfigurationDescriptions & _descs)
Expand All @@ -21,9 +20,10 @@ void RPCInverseTwinMuxLinkMapESProducer::fillDescriptions(edm::ConfigurationDesc
_descs.add("RPCInverseTwinMuxLinkMapESProducer", _desc);
}

void RPCInverseTwinMuxLinkMapESProducer::RPCTwinMuxLinkMapCallback(RPCTwinMuxLinkMapRcd const & _rcd)
void RPCInverseTwinMuxLinkMapESProducer::setupRPCTwinMuxLinkMap(RPCTwinMuxLinkMapRcd const & _rcd,
RPCInverseAMCLinkMap* inverse_linkmap)
{
RPCInverseAMCLinkMap::map_type & _inverse_map(inverse_linkmap_->getMap());
RPCInverseAMCLinkMap::map_type & _inverse_map(inverse_linkmap->getMap());
_inverse_map.clear();

edm::ESHandle<RPCAMCLinkMap> _es_map;
Expand All @@ -36,7 +36,16 @@ void RPCInverseTwinMuxLinkMapESProducer::RPCTwinMuxLinkMapCallback(RPCTwinMuxLin

std::shared_ptr<RPCInverseAMCLinkMap> RPCInverseTwinMuxLinkMapESProducer::produce(RPCInverseTwinMuxLinkMapRcd const & _rcd)
{
return inverse_linkmap_;
auto host = holder_.makeOrGet([]() {
return new HostType;
});

host->ifRecordChanges<RPCTwinMuxLinkMapRcd>(_rcd,
[this,h=host.get()](auto const& rec) {
setupRPCTwinMuxLinkMap(rec, h);
});

return host;
}

//define this as a module
Expand Down
15 changes: 11 additions & 4 deletions CondTools/RPC/plugins/RPCInverseTwinMuxLinkMapESProducer.h
Expand Up @@ -4,6 +4,8 @@
#include <memory>

#include "FWCore/Framework/interface/ESProducer.h"
#include "FWCore/Framework/interface/ESProductHost.h"
#include "FWCore/Utilities/interface/ReusableObjectHolder.h"

#include "CondFormats/RPCObjects/interface/RPCInverseAMCLinkMap.h"

Expand All @@ -23,12 +25,17 @@ class RPCInverseTwinMuxLinkMapESProducer

static void fillDescriptions(edm::ConfigurationDescriptions & _descs);

void RPCTwinMuxLinkMapCallback(RPCTwinMuxLinkMapRcd const & _rcd);

std::shared_ptr<RPCInverseAMCLinkMap> produce(RPCInverseTwinMuxLinkMapRcd const & _rcd);

protected:
std::shared_ptr<RPCInverseAMCLinkMap> inverse_linkmap_;
private:

using HostType = edm::ESProductHost<RPCInverseAMCLinkMap,
RPCTwinMuxLinkMapRcd>;

void setupRPCTwinMuxLinkMap(RPCTwinMuxLinkMapRcd const&,
RPCInverseAMCLinkMap*);

edm::ReusableObjectHolder<HostType> holder_;
};

#endif // CondTools_RPC_RPCInverseTwinMuxLinkMapESProducer_h

0 comments on commit ec8f8f8

Please sign in to comment.