1+ // -*- C++ -*-
12#ifndef FWCore_Framework_EDConsumerBase_h
23#define FWCore_Framework_EDConsumerBase_h
3- // -*- C++ -*-
44//
55// Package: FWCore/Framework
66// Class : EDConsumerBase
2121// system include files
2222#include < array>
2323#include < map>
24+ #include < memory>
2425#include < string>
2526#include < vector>
2627#include < array>
2728#include < cassert>
2829#include < tuple>
30+ #include < utility>
2931
3032// user include files
31- #include " DataFormats/Provenance/interface/BranchType.h"
3233#include " DataFormats/Provenance/interface/ProvenanceFwd.h"
3334#include " FWCore/Common/interface/FWCoreCommonFwd.h"
3435#include " FWCore/Framework/interface/ProductResolverIndexAndSkipBit.h"
3536#include " FWCore/Framework/interface/EventSetupRecordKey.h"
3637#include " FWCore/Framework/interface/HCTypeTag.h"
3738#include " FWCore/Framework/interface/DataKey.h"
3839#include " FWCore/Framework/interface/data_default_record_trait.h"
39- #include " FWCore/ServiceRegistry/interface/ConsumesInfo.h"
40+ #include " FWCore/ServiceRegistry/interface/ServiceRegistryfwd.h"
41+ #include " FWCore/Utilities/interface/BranchType.h"
4042#include " FWCore/Utilities/interface/ESIndices.h"
4143#include " FWCore/Utilities/interface/TypeID.h"
4244#include " FWCore/Utilities/interface/TypeToGet.h"
@@ -67,8 +69,9 @@ namespace edm {
6769 class WillGetIfMatch ;
6870
6971 namespace eventsetup {
72+ struct ComponentDescription ;
7073 class ESRecordsToProductResolverIndices ;
71- }
74+ } // namespace eventsetup
7275
7376 class EDConsumerBase {
7477 public:
@@ -103,6 +106,7 @@ namespace edm {
103106 // ---------- member functions ---------------------------
104107 void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet);
105108 void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &);
109+ void releaseMemoryPostLookupSignal ();
106110 void selectInputProcessBlocks (ProductRegistry const & productRegistry,
107111 ProcessBlockHelperBase const & processBlockHelperBase) {
108112 doSelectInputProcessBlocks (productRegistry, processBlockHelperBase);
@@ -117,10 +121,15 @@ namespace edm {
117121 std::map<std::string, ModuleDescription const *> const & labelsToDesc,
118122 std::string const & processName) const ;
119123
124+ void esModulesWhoseProductsAreConsumed (
125+ std::array<std::vector<eventsetup::ComponentDescription const *>*, kNumberOfEventSetupTransitions >& esModules,
126+ eventsetup::ESRecordsToProductResolverIndices const &) const ;
127+
120128 // / Convert "@currentProcess" in InputTag process names to the actual current process name.
121129 void convertCurrentProcessAlias (std::string const & processName);
122130
123- std::vector<ConsumesInfo> consumesInfo () const ;
131+ std::vector<ModuleConsumesInfo> moduleConsumesInfos () const ;
132+ std::vector<ModuleConsumesESInfo> moduleConsumesESInfos (eventsetup::ESRecordsToProductResolverIndices const &) const ;
124133
125134 ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const {
126135 if (iTrans < edm::Transition::NumberOfEventSetupTransitions) {
@@ -250,6 +259,31 @@ namespace edm {
250259
251260 virtual void doSelectInputProcessBlocks (ProductRegistry const &, ProcessBlockHelperBase const &);
252261
262+ struct ESTokenLookupInfo {
263+ eventsetup::EventSetupRecordKey m_record;
264+ eventsetup::DataKey m_key;
265+ unsigned int m_startOfComponentName;
266+ };
267+
268+ enum { kESLookupInfo , kESResolverIndex };
269+
270+ using ESTokenLookupInfoContainer = edm::SoATuple<ESTokenLookupInfo, ESResolverIndex>;
271+
272+ ESTokenLookupInfoContainer const & esTokenLookupInfoContainer () const {
273+ return esDataThatCanBeDeletedEarly_->esTokenLookupInfoContainer_ ;
274+ }
275+
276+ using ESResolverIndexContainer = std::array<std::vector<ESResolverIndex>, kNumberOfEventSetupTransitions >;
277+
278+ using ConsumesIndexConverter =
279+ std::vector<std::pair<ESResolverIndexContainer::size_type, std::vector<ESResolverIndex>::size_type>>;
280+
281+ // This can be used to convert from an index used to access esTokenLookupInfoContainer_
282+ // into the 2 indexes needed to access esItemsToGetFromTransition_
283+ ConsumesIndexConverter const & consumesIndexConverter () const {
284+ return esDataThatCanBeDeletedEarly_->consumesIndexConverter_ ;
285+ }
286+
253287 // ---------- member data --------------------------------
254288
255289 struct TokenLookupInfo {
@@ -282,27 +316,17 @@ namespace edm {
282316
283317 std::array<std::vector<ProductResolverIndexAndSkipBit>, edm::NumBranchTypes> itemsToGetFromBranch_;
284318
285- struct ESTokenLookupInfo {
286- eventsetup::EventSetupRecordKey m_record;
287- eventsetup::DataKey m_key;
288- unsigned int m_startOfComponentName;
319+ struct ESDataThatCanBeDeletedEarly {
320+ ESTokenLookupInfoContainer esTokenLookupInfoContainer_;
321+ ConsumesIndexConverter consumesIndexConverter_;
289322 };
290323
291- // TODO We would like to be able to access m_esTokenInfo from the
292- // index in the token, but this is currently not possible. One idea
293- // for this is to order the entries in m_esToken so that all the ones
294- // for transition 0 come first, then the ones for for transition 1
295- // and so on for all the transitions. Within a transition, the
296- // entries would be in the same order in m_esTokenInfo and
297- // esItemsToGetFromTransition_. This is something for future
298- // development and might require a change to SoATuple to support
299- // inserts in the middle of the data structure.
300- enum { kESLookupInfo , kESResolverIndex };
301- edm::SoATuple<ESTokenLookupInfo, ESResolverIndex> m_esTokenInfo;
302- std::array<std::vector<ESResolverIndex>, static_cast <unsigned int >(edm::Transition::NumberOfEventSetupTransitions)>
303- esItemsToGetFromTransition_;
304- std::array<std::vector<ESRecordIndex>, static_cast <unsigned int >(edm::Transition::NumberOfEventSetupTransitions)>
305- esRecordsToGetFromTransition_;
324+ std::unique_ptr<ESDataThatCanBeDeletedEarly> esDataThatCanBeDeletedEarly_;
325+
326+ ESResolverIndexContainer esItemsToGetFromTransition_;
327+
328+ std::array<std::vector<ESRecordIndex>, kNumberOfEventSetupTransitions > esRecordsToGetFromTransition_;
329+
306330 bool frozen_;
307331 bool containsCurrentProcessAlias_;
308332 };
0 commit comments