#include <ESProductHost.h>
Public Member Functions | |
template<typename... Args> | |
ESProductHost (Args &&...args) | |
template<typename RecordType , typename ContainingRecordType , typename FUNC > | |
void | ifRecordChanges (ContainingRecordType const &containingRecord, FUNC func) |
Static Public Member Functions | |
template<typename U > | |
static constexpr std::size_t | index () |
template<std::size_t I, typename U , typename TST , typename... M> | |
static constexpr std::size_t | indexLoop () |
static constexpr std::size_t | numberOfRecordTypes () |
Private Attributes | |
std::vector< unsigned long long > | cacheIDs_ |
Description: Helps an ESProducer produce an ESProduct that has complex dependences on multiple record types. In particular, it helps it manage what is executed in the produce function based on which records changed and which did not.
This was designed as a replacement for the EventSetup "dependsOn" functionality and is needed in some cases where the "dependsOn" callbacks would not work well when processing multiple IOVs concurrently.
Usage:
An ESProducer class would use this class.
Add to the ESProducer header
include "FWCore/Framework/interface/ESProductHost.h" include "FWCore/Utilities/interface/ReusableObjectHolder.h"
std::shared_ptr<ESTestDataB> produce(ESTestRecordB const&);
and assume there is some special dependence on ESTestRecordC and ESTestRecordD.
using HostType = edm::ESProductHost<ESTestDataB, ESTestRecordC, ESTestRecordD>; edm::ReusableObjectHolder<HostType> holder_;
Then the produce function would be defined something similar to this:
std::shared_ptr<ESTestDataB> ESTestProducerBUsingHost::produce(ESTestRecordB const& record) { auto host = holder_.makeOrGet([]() { return new HostType; }); host->ifRecordChanges<ESTestRecordC>(record, [this, h=host.get()](auto const& rec) {
Do whatever special needs to be done only when record C changes (If you are using this class to replace a dependsOn callback, you could call the function that dependsOn used as a callback here) });
host->ifRecordChanges<ESTestRecordD>(record, [this, h=host.get()](auto const& rec) { Do whatever special needs to be done only when record D changes });
... repeat for as many record types as you need.
Definition at line 93 of file ESProductHost.h.
|
inline |
Definition at line 96 of file ESProductHost.h.
|
inline |
Definition at line 103 of file ESProductHost.h.
References edm::ESProductHost< Product, RecordTypes >::cacheIDs_, patCandidates_cff::func, and record.
Referenced by HcalDbProducer::setupHcalDbService().
|
inlinestatic |
Definition at line 129 of file ESProductHost.h.
References Exhume::I, edm::ESProductHost< Product, RecordTypes >::indexLoop(), edm::ESProductHost< Product, RecordTypes >::numberOfRecordTypes(), and mitigatedMETSequence_cff::U.
Referenced by BeautifulSoup.PageElement::insert().
|
inlinestatic |
Definition at line 135 of file ESProductHost.h.
References constexpr, Exhume::I, edm::ESProductHost< Product, RecordTypes >::numberOfRecordTypes(), and mitigatedMETSequence_cff::U.
Referenced by edm::ESProductHost< Product, RecordTypes >::index().
|
inlinestatic |
Definition at line 120 of file ESProductHost.h.
Referenced by edm::ESProductHost< Product, RecordTypes >::index(), and edm::ESProductHost< Product, RecordTypes >::indexLoop().
|
private |
Definition at line 149 of file ESProductHost.h.
Referenced by edm::ESProductHost< Product, RecordTypes >::ifRecordChanges().