CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
edm::EDConsumerBase Class Reference

#include <EDConsumerBase.h>

Inheritance diagram for edm::EDConsumerBase:
edm::EDAnalyzer edm::EDFilter edm::EDProducer edm::global::EDAnalyzerBase edm::global::EDFilterBase edm::global::EDProducerBase edm::global::OutputModuleBase edm::limited::EDAnalyzerBase edm::limited::EDFilterBase edm::limited::EDProducerBase edm::limited::OutputModuleBase edm::one::EDAnalyzerBase edm::one::EDFilterBase edm::one::EDProducerBase edm::one::OutputModuleBase edm::stream::EDAnalyzerBase edm::stream::EDFilterBase edm::stream::EDProducerBase edm::SubProcess

Classes

struct  ESTokenLookupInfo
 
struct  LabelPlacement
 
struct  TokenLookupInfo
 

Public Types

typedef ProductLabels Labels
 

Public Member Functions

std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Protected Member Functions

EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Private Types

enum  { kLookupInfo, kAlwaysGets, kLabels, kKind }
 
enum  { kESLookupInfo, kESProxyIndex }
 

Private Member Functions

edm::InputTag const & checkIfEmpty (edm::InputTag const &tag)
 
const char * labelFor (ESTokenIndex) const
 
unsigned int recordConsumes (BranchType iBranch, TypeToGet const &iType, edm::InputTag const &iTag, bool iAlwaysGets)
 
ESTokenIndex recordESConsumes (Transition, eventsetup::EventSetupRecordKey const &, eventsetup::heterocontainer::HCTypeTag const &, edm::ESInputTag const &iTag)
 
virtual void registerLateConsumes (eventsetup::ESRecordsToProxyIndices const &)
 
void throwBadToken (edm::TypeID const &iType, EDGetToken iToken) const
 
void throwBranchMismatch (BranchType, EDGetToken) const
 
void throwConsumesCallAfterFrozen (TypeToGet const &, InputTag const &) const
 
void throwESConsumesCallAfterFrozen (eventsetup::EventSetupRecordKey const &, eventsetup::heterocontainer::HCTypeTag const &, edm::ESInputTag const &) const
 
void throwESConsumesInProcessBlock () const
 
void throwTypeMismatch (edm::TypeID const &, EDGetToken) const
 

Private Attributes

bool containsCurrentProcessAlias_
 
std::array< std::vector< ESProxyIndex >, static_cast< unsigned int >edm::Transition::NumberOfEventSetupTransitions)> esItemsToGetFromTransition_
 
std::array< std::vector< ESRecordIndex >, static_cast< unsigned int >edm::Transition::NumberOfEventSetupTransitions)> esRecordsToGetFromTransition_
 
bool frozen_
 
std::array< std::vector< ProductResolverIndexAndSkipBit >, edm::NumBranchTypesitemsToGetFromBranch_
 
edm::SoATuple< ESTokenLookupInfo, ESProxyIndexm_esTokenInfo
 
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfTypem_tokenInfo
 
std::vector< char > m_tokenLabels
 

Friends

class ConsumesCollector
 
template<BranchType B>
class EDConsumerBaseAdaptor
 
template<Transition Tr>
class EDConsumerBaseESAdaptor
 
template<Transition Tr>
class EDConsumerBaseWithTagESAdaptor
 
template<typename T >
class WillGetIfMatch
 

Detailed Description

Description: Allows declaration of what data is being consumed

Usage: The EDM modules all inherit from this base class

Definition at line 70 of file EDConsumerBase.h.

Member Typedef Documentation

◆ Labels

Definition at line 105 of file EDConsumerBase.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
kLookupInfo 
kAlwaysGets 
kLabels 
kKind 

Definition at line 277 of file EDConsumerBase.h.

◆ anonymous enum

anonymous enum
private
Enumerator
kESLookupInfo 
kESProxyIndex 

Definition at line 301 of file EDConsumerBase.h.

Constructor & Destructor Documentation

◆ EDConsumerBase() [1/3]

EDConsumerBase::EDConsumerBase ( )

Definition at line 38 of file EDConsumerBase.cc.

39  : m_tokenLabels{makeEmptyTokenLabels()}, frozen_(false), containsCurrentProcessAlias_(false) {}

◆ ~EDConsumerBase()

EDConsumerBase::~EDConsumerBase ( )
virtualnoexcept

Definition at line 41 of file EDConsumerBase.cc.

41 {}

◆ EDConsumerBase() [2/3]

edm::EDConsumerBase::EDConsumerBase ( EDConsumerBase const &  )
delete

◆ EDConsumerBase() [3/3]

edm::EDConsumerBase::EDConsumerBase ( EDConsumerBase &&  )
default

Member Function Documentation

◆ checkIfEmpty()

edm::InputTag const & EDConsumerBase::checkIfEmpty ( edm::InputTag const &  tag)
private

Definition at line 53 of file EDConsumerBase.cc.

53  {
54  if (iTag.label().empty()) {
55  return kWasEmpty;
56  }
57  return iTag;
58 }

References kWasEmpty, and edm::InputTag::label().

Referenced by consumes(), and mayConsume().

◆ consumes() [1/4]

EDGetToken edm::EDConsumerBase::consumes ( const TypeToGet id,
edm::InputTag const &  tag 
)
inlineprotected

Definition at line 163 of file EDConsumerBase.h.

163  {
164  return EDGetToken{recordConsumes(InEvent, id, checkIfEmpty(tag), true)};
165  }

References checkIfEmpty(), edm::InEvent, recordConsumes(), and GlobalPosition_Frontier_DevDB_cff::tag.

◆ consumes() [2/4]

template<typename ProductType , BranchType B = InEvent>
EDGetTokenT<ProductType> edm::EDConsumerBase::consumes ( edm::InputTag const &  tag)
inlineprotected

◆ consumes() [3/4]

template<BranchType B = InEvent>
EDConsumerBaseAdaptor<B> edm::EDConsumerBase::consumes ( edm::InputTag  tag)
inlineprotectednoexcept

Definition at line 159 of file EDConsumerBase.h.

159  {
160  return EDConsumerBaseAdaptor<B>(this, std::move(tag));
161  }

References eostools::move(), and GlobalPosition_Frontier_DevDB_cff::tag.

◆ consumes() [4/4]

template<BranchType B>
EDGetToken edm::EDConsumerBase::consumes ( TypeToGet const &  id,
edm::InputTag const &  tag 
)
inlineprotected

Definition at line 168 of file EDConsumerBase.h.

168  {
169  return EDGetToken{recordConsumes(B, id, checkIfEmpty(tag), true)};
170  }

References TtFullHadDaughter::B, checkIfEmpty(), recordConsumes(), and GlobalPosition_Frontier_DevDB_cff::tag.

◆ consumesCollector()

ConsumesCollector EDConsumerBase::consumesCollector ( )
protected

Use a ConsumesCollector to gather consumes information from helper functions.

Definition at line 46 of file EDConsumerBase.cc.

46  {
47  ConsumesCollector c{this};
48  return c;
49 }

References HltBtagPostValidation_cff::c.

Referenced by AlcaBeamMonitor::AlcaBeamMonitor(), AlcaBeamSpotProducer::AlcaBeamSpotProducer(), IsolatedParticlesGeneratedJets::analyze(), OverlapValidation::analyze(), BeamMonitor::BeamMonitor(), BeamMonitorBx::BeamMonitorBx(), BeamSpotAnalyzer::BeamSpotAnalyzer(), CaloParticleDebugger::CaloParticleDebugger(), ConfigurableAnalysis::ConfigurableAnalysis(), CosmicSplitterValidation::CosmicSplitterValidation(), CSCMonitorModule::CSCMonitorModule(), edm::global::OutputModuleBase::doPreallocate(), edm::limited::OutputModuleBase::doPreallocate(), edm::one::OutputModuleBase::doPreallocate(), DTResidualCalibration::DTResidualCalibration(), DTTrigTest::DTTrigTest(), DTTTrigOffsetCalibration::DTTTrigOffsetCalibration(), DTVDriftSegmentCalibration::DTVDriftSegmentCalibration(), EcalCosmicsHists::EcalCosmicsHists(), EcalDQMonitorTask::EcalDQMonitorTask(), EcalSelectiveReadoutValidation::EcalSelectiveReadoutValidation(), EDMtoMEConverter::EDMtoMEConverter(), EgammaHLTClusterShapeProducer::EgammaHLTClusterShapeProducer(), EgammaHLTR9IDProducer::EgammaHLTR9IDProducer(), EGEnergyAnalyzer::EGEnergyAnalyzer(), ElectronIdMVAProducer::ElectronIdMVAProducer(), ElectronMVANtuplizer::ElectronMVANtuplizer(), EopTreeWriter::EopTreeWriter(), EventWithHistoryEDFilter::EventWithHistoryEDFilter(), edm::FilterWrapper< T >::FilterWrapper(), HcalIsoTrkAnalyzer::HcalIsoTrkAnalyzer(), HGCalTriggerNtupleManager::HGCalTriggerNtupleManager(), HLTBitAnalyzer::HLTBitAnalyzer(), HLTExoticaValidator::HLTExoticaValidator(), HLTMuonIsoFilter::HLTMuonIsoFilter(), cms::CkfDebugTrackCandidateMaker::initDebugger(), IsolatedTracksCone::IsolatedTracksCone(), IsolatedTracksNxN::IsolatedTracksNxN(), L1EventTreeProducer::L1EventTreeProducer(), L1MuGlobalMuonTrigger::L1MuGlobalMuonTrigger(), LogMessageMonitor::LogMessageMonitor(), pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::ManyThingsToValueMaps(), MomentumConstraintProducer::MomentumConstraintProducer(), MultiplicityCorrelator::MultiplicityCorrelator(), MultiplicityInvestigator::MultiplicityInvestigator(), MultiplicityTimeCorrelations::MultiplicityTimeCorrelations(), MuPFIsoEmbedder::MuPFIsoEmbedder(), OMTFPatternMaker::OMTFPatternMaker(), OscarProducer::OscarProducer(), edm::global::OutputModuleBase::OutputModuleBase(), edm::limited::OutputModuleBase::OutputModuleBase(), edm::one::OutputModuleBase::OutputModuleBase(), OverlapValidation::OverlapValidation(), edm::PathStatusFilter::PathStatusFilter(), PhotonIDValueMapProducer::PhotonIDValueMapProducer(), PhotonMVANtuplizer::PhotonMVANtuplizer(), PlottingDevice::PlottingDevice(), QuickTrackAssociatorByHitsProducer::QuickTrackAssociatorByHitsProducer(), ResidualRefitting::ResidualRefitting(), SingleTopTChannelLeptonDQM::SingleTopTChannelLeptonDQM(), SingleTopTChannelLeptonDQM_miniAOD::SingleTopTChannelLeptonDQM_miniAOD(), SiPixelStatusHarvester::SiPixelStatusHarvester(), SiStripDCSFilter::SiStripDCSFilter(), SiStripMonitorDigi::SiStripMonitorDigi(), edm::SubProcess::SubProcess(), TagProbeFitTreeProducer::TagProbeFitTreeProducer(), Tau3MuSkim::Tau3MuSkim(), TopDiLeptonOfflineDQM::TopDiLeptonOfflineDQM(), TopSingleLeptonDQM::TopSingleLeptonDQM(), TopSingleLeptonDQM_miniAOD::TopSingleLeptonDQM_miniAOD(), TtDilepEvtSolutionMaker::TtDilepEvtSolutionMaker(), TtSemiEvtSolutionMaker::TtSemiEvtSolutionMaker(), and ValidIsoTrkCalib::ValidIsoTrkCalib().

◆ consumesInfo()

std::vector< ConsumesInfo > EDConsumerBase::consumesInfo ( ) const

Definition at line 584 of file EDConsumerBase.cc.

584  {
585  // Use this to eliminate duplicate entries related
586  // to consumesMany items where only the type was specified
587  // and the there are multiple matches. In these cases the
588  // label, instance, and process will be empty.
589  std::set<edm::TypeID> alreadySeenTypes;
590 
591  std::vector<ConsumesInfo> result;
592  auto itAlways = m_tokenInfo.begin<kAlwaysGets>();
593  auto itKind = m_tokenInfo.begin<kKind>();
594  auto itLabels = m_tokenInfo.begin<kLabels>();
595  for (auto itInfo = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); itInfo != itEnd;
596  ++itInfo, ++itKind, ++itLabels, ++itAlways) {
597  const unsigned int labelStart = itLabels->m_startOfModuleLabel;
598  const char* consumedModuleLabel = &(m_tokenLabels[labelStart]);
599  const char* consumedInstance = consumedModuleLabel + itLabels->m_deltaToProductInstance;
600  const char* consumedProcessName = consumedModuleLabel + itLabels->m_deltaToProcessName;
601 
602  // consumesMany case
603  if (*consumedModuleLabel == '\0') {
604  if (!alreadySeenTypes.insert(itInfo->m_type).second) {
605  continue;
606  }
607  }
608 
609  // Just copy the information into the ConsumesInfo data structure
610  result.emplace_back(itInfo->m_type,
611  consumedModuleLabel,
612  consumedInstance,
613  consumedProcessName,
614  itInfo->m_branchType,
615  *itKind,
616  *itAlways,
617  itInfo->m_index.skipCurrentProcess());
618  }
619  return result;
620 }

References kAlwaysGets, kKind, kLabels, kLookupInfo, m_tokenInfo, m_tokenLabels, and mps_fire::result.

◆ consumesMany() [1/3]

template<typename ProductType , BranchType B = InEvent>
void edm::EDConsumerBase::consumesMany ( )
inlineprotected

Definition at line 186 of file EDConsumerBase.h.

186  {
187  TypeToGet tid = TypeToGet::make<ProductType>();
188  consumesMany<B>(tid);
189  }

◆ consumesMany() [2/3]

void edm::EDConsumerBase::consumesMany ( const TypeToGet id)
inlineprotected

Definition at line 191 of file EDConsumerBase.h.

191 { consumesMany<InEvent>(id); }

◆ consumesMany() [3/3]

template<BranchType B>
void edm::EDConsumerBase::consumesMany ( const TypeToGet id)
inlineprotected

Definition at line 194 of file EDConsumerBase.h.

194  {
195  recordConsumes(B, id, edm::InputTag{}, true);
196  }

References TtFullHadDaughter::B, and recordConsumes().

◆ convertCurrentProcessAlias()

void EDConsumerBase::convertCurrentProcessAlias ( std::string const &  processName)

Convert "@currentProcess" in InputTag process names to the actual current process name.

Definition at line 538 of file EDConsumerBase.cc.

538  {
539  frozen_ = true;
540 
543 
544  auto newTokenLabels = makeEmptyTokenLabels();
545 
546  // first calculate the size of the new vector and reserve memory for it
547  std::vector<char>::size_type newSize = newTokenLabels.size();
548  std::string newProcessName;
549  for (auto iter = m_tokenInfo.begin<kLabels>(), itEnd = m_tokenInfo.end<kLabels>(); iter != itEnd; ++iter) {
550  newProcessName = &m_tokenLabels[iter->m_startOfModuleLabel + iter->m_deltaToProcessName];
551  if (newProcessName == InputTag::kCurrentProcess) {
552  newProcessName = processName;
553  }
554  newSize += (iter->m_deltaToProcessName + newProcessName.size() + 1);
555  }
556  newTokenLabels.reserve(newSize);
557 
558  unsigned int newStartOfModuleLabel = newTokenLabels.size();
559  for (auto iter = m_tokenInfo.begin<kLabels>(), itEnd = m_tokenInfo.end<kLabels>(); iter != itEnd; ++iter) {
560  unsigned int startOfModuleLabel = iter->m_startOfModuleLabel;
561  unsigned short deltaToProcessName = iter->m_deltaToProcessName;
562 
563  iter->m_startOfModuleLabel = newStartOfModuleLabel;
564 
565  newProcessName = &m_tokenLabels[startOfModuleLabel + deltaToProcessName];
566  if (newProcessName == InputTag::kCurrentProcess) {
567  newProcessName = processName;
568  }
569 
570  newStartOfModuleLabel += (deltaToProcessName + newProcessName.size() + 1);
571 
572  // Copy in both the module label and instance, they are the same
573  newTokenLabels.insert(newTokenLabels.end(),
574  m_tokenLabels.begin() + startOfModuleLabel,
575  m_tokenLabels.begin() + (startOfModuleLabel + deltaToProcessName));
576 
577  newTokenLabels.insert(newTokenLabels.end(), newProcessName.begin(), newProcessName.end());
578  newTokenLabels.push_back('\0');
579  }
580  m_tokenLabels = std::move(newTokenLabels);
581  }
582 }

References containsCurrentProcessAlias_, frozen_, edm::InputTag::kCurrentProcess, kLabels, m_tokenInfo, m_tokenLabels, eostools::move(), SimL1EmulatorRepack_CalouGT_cff::processName, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ esConsumes() [1/5]

template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto edm::EDConsumerBase::esConsumes ( )
inlineprotected

◆ esConsumes() [2/5]

template<Transition Tr = Transition::Event>
constexpr auto edm::EDConsumerBase::esConsumes ( )
inlineconstexprprotectednoexcept

Definition at line 217 of file EDConsumerBase.h.

217  {
218  return EDConsumerBaseESAdaptor<Tr>(this);
219  }

◆ esConsumes() [3/5]

template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto edm::EDConsumerBase::esConsumes ( ESInputTag const &  tag)
inlineprotected

Definition at line 205 of file EDConsumerBase.h.

205  {
206  auto index = recordESConsumes(Tr,
208  std::conditional_t<std::is_same_v<ESRecord, edm::DefaultRecord>,
209  eventsetup::default_record_t<ESHandleAdapter<ESProduct>>,
210  ESRecord>>(),
211  eventsetup::heterocontainer::HCTypeTag::make<ESProduct>(),
212  tag);
213  return ESGetToken<ESProduct, ESRecord>{static_cast<unsigned int>(Tr), index, labelFor(index)};
214  }

References labelFor(), edm::eventsetup::EventSetupRecordKey::makeKey(), recordESConsumes(), and GlobalPosition_Frontier_DevDB_cff::tag.

◆ esConsumes() [4/5]

template<Transition Tr = Transition::Event>
auto edm::EDConsumerBase::esConsumes ( ESInputTag  tag)
inlineprotectednoexcept

Definition at line 222 of file EDConsumerBase.h.

222  {
223  return EDConsumerBaseWithTagESAdaptor<Tr>(this, std::move(tag));
224  }

References eostools::move(), and GlobalPosition_Frontier_DevDB_cff::tag.

◆ esConsumes() [5/5]

template<Transition Tr = Transition::Event>
ESGetTokenGeneric edm::EDConsumerBase::esConsumes ( eventsetup::EventSetupRecordKey const &  iRecord,
eventsetup::DataKey const &  iKey 
)
inlineprotected

Used with EventSetupRecord::doGet.

Definition at line 228 of file EDConsumerBase.h.

228  {
229  return ESGetTokenGeneric(static_cast<unsigned int>(Tr),
230  recordESConsumes(Tr, iRecord, iKey.type(), ESInputTag("", iKey.name().value())),
231  iRecord.type());
232  }

References edm::eventsetup::DataKey::name(), recordESConsumes(), edm::eventsetup::EventSetupRecordKey::type(), edm::eventsetup::DataKey::type(), and edm::eventsetup::SimpleStringTag::value().

◆ esGetTokenIndices()

ESProxyIndex const* edm::EDConsumerBase::esGetTokenIndices ( edm::Transition  iTrans) const
inline

Definition at line 118 of file EDConsumerBase.h.

118  {
120  auto const& v = esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)];
121  if (v.empty()) {
122  return nullptr;
123  }
124  return &(esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)].front());
125  }
126  return nullptr;
127  }

References esItemsToGetFromTransition_, edm::NumberOfEventSetupTransitions, and findQualityFiles::v.

Referenced by edm::global::EDFilterBase::doAcquire(), edm::global::EDProducerBase::doAcquire(), edm::EDAnalyzer::doBeginLuminosityBlock(), edm::EDProducer::doBeginLuminosityBlock(), edm::EDFilter::doBeginLuminosityBlock(), edm::one::EDFilterBase::doBeginLuminosityBlock(), edm::one::EDProducerBase::doBeginLuminosityBlock(), edm::one::EDAnalyzerBase::doBeginLuminosityBlock(), edm::global::EDAnalyzerBase::doBeginLuminosityBlock(), edm::global::EDProducerBase::doBeginLuminosityBlock(), edm::limited::EDProducerBase::doBeginLuminosityBlock(), edm::limited::EDFilterBase::doBeginLuminosityBlock(), edm::global::EDFilterBase::doBeginLuminosityBlock(), edm::limited::EDAnalyzerBase::doBeginLuminosityBlock(), edm::stream::EDAnalyzerAdaptor< T >::doBeginLuminosityBlock(), edm::EDAnalyzer::doBeginRun(), edm::EDProducer::doBeginRun(), edm::EDFilter::doBeginRun(), edm::one::EDProducerBase::doBeginRun(), edm::one::EDFilterBase::doBeginRun(), edm::one::EDAnalyzerBase::doBeginRun(), edm::global::EDAnalyzerBase::doBeginRun(), edm::global::EDProducerBase::doBeginRun(), edm::limited::EDProducerBase::doBeginRun(), edm::limited::EDFilterBase::doBeginRun(), edm::global::EDFilterBase::doBeginRun(), edm::limited::EDAnalyzerBase::doBeginRun(), edm::stream::EDAnalyzerAdaptor< T >::doBeginRun(), edm::EDAnalyzer::doEndLuminosityBlock(), edm::EDProducer::doEndLuminosityBlock(), edm::EDFilter::doEndLuminosityBlock(), edm::one::EDFilterBase::doEndLuminosityBlock(), edm::one::EDProducerBase::doEndLuminosityBlock(), edm::one::EDAnalyzerBase::doEndLuminosityBlock(), edm::global::EDAnalyzerBase::doEndLuminosityBlock(), edm::global::EDProducerBase::doEndLuminosityBlock(), edm::limited::EDProducerBase::doEndLuminosityBlock(), edm::limited::EDFilterBase::doEndLuminosityBlock(), edm::global::EDFilterBase::doEndLuminosityBlock(), edm::limited::EDAnalyzerBase::doEndLuminosityBlock(), edm::stream::EDAnalyzerAdaptor< T >::doEndLuminosityBlock(), edm::EDAnalyzer::doEndRun(), edm::EDProducer::doEndRun(), edm::EDFilter::doEndRun(), edm::one::EDFilterBase::doEndRun(), edm::one::EDProducerBase::doEndRun(), edm::one::EDAnalyzerBase::doEndRun(), edm::global::EDAnalyzerBase::doEndRun(), edm::limited::EDProducerBase::doEndRun(), edm::global::EDProducerBase::doEndRun(), edm::limited::EDFilterBase::doEndRun(), edm::global::EDFilterBase::doEndRun(), edm::limited::EDAnalyzerBase::doEndRun(), edm::stream::EDAnalyzerAdaptor< T >::doEndRun(), edm::EDAnalyzer::doEvent(), edm::EDProducer::doEvent(), edm::EDFilter::doEvent(), edm::global::EDFilterBase::doEvent(), edm::one::EDFilterBase::doEvent(), edm::one::EDProducerBase::doEvent(), edm::global::EDAnalyzerBase::doEvent(), edm::one::EDAnalyzerBase::doEvent(), edm::global::EDProducerBase::doEvent(), edm::limited::EDFilterBase::doEvent(), edm::limited::EDAnalyzerBase::doEvent(), edm::limited::EDProducerBase::doEvent(), edm::global::EDAnalyzerBase::doStreamBeginLuminosityBlock(), edm::global::EDProducerBase::doStreamBeginLuminosityBlock(), edm::limited::EDProducerBase::doStreamBeginLuminosityBlock(), edm::limited::EDFilterBase::doStreamBeginLuminosityBlock(), edm::global::EDFilterBase::doStreamBeginLuminosityBlock(), edm::limited::EDAnalyzerBase::doStreamBeginLuminosityBlock(), edm::global::EDAnalyzerBase::doStreamBeginRun(), edm::limited::EDProducerBase::doStreamBeginRun(), edm::global::EDProducerBase::doStreamBeginRun(), edm::limited::EDFilterBase::doStreamBeginRun(), edm::global::EDFilterBase::doStreamBeginRun(), edm::limited::EDAnalyzerBase::doStreamBeginRun(), edm::global::EDAnalyzerBase::doStreamEndLuminosityBlock(), edm::limited::EDProducerBase::doStreamEndLuminosityBlock(), edm::global::EDProducerBase::doStreamEndLuminosityBlock(), edm::limited::EDFilterBase::doStreamEndLuminosityBlock(), edm::global::EDFilterBase::doStreamEndLuminosityBlock(), edm::limited::EDAnalyzerBase::doStreamEndLuminosityBlock(), edm::global::EDAnalyzerBase::doStreamEndRun(), edm::limited::EDProducerBase::doStreamEndRun(), edm::global::EDProducerBase::doStreamEndRun(), edm::limited::EDFilterBase::doStreamEndRun(), edm::global::EDFilterBase::doStreamEndRun(), and edm::limited::EDAnalyzerBase::doStreamEndRun().

◆ esGetTokenIndicesVector()

std::vector<ESProxyIndex> const& edm::EDConsumerBase::esGetTokenIndicesVector ( edm::Transition  iTrans) const
inline

Definition at line 129 of file EDConsumerBase.h.

129  {
131  return esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)];
132  }

References cms::cuda::assert(), esItemsToGetFromTransition_, and edm::NumberOfEventSetupTransitions.

◆ esGetTokenRecordIndicesVector()

std::vector<ESRecordIndex> const& edm::EDConsumerBase::esGetTokenRecordIndicesVector ( edm::Transition  iTrans) const
inline

Definition at line 134 of file EDConsumerBase.h.

134  {
136  return esRecordsToGetFromTransition_[static_cast<unsigned int>(iTrans)];
137  }

References cms::cuda::assert(), esRecordsToGetFromTransition_, and edm::NumberOfEventSetupTransitions.

◆ indexFrom()

ProductResolverIndexAndSkipBit EDConsumerBase::indexFrom ( EDGetToken  iToken,
BranchType  iBranch,
TypeID const &  iType 
) const

Definition at line 250 of file EDConsumerBase.cc.

252  {
253  if (UNLIKELY(iToken.index() >= m_tokenInfo.size())) {
254  throwBadToken(iType, iToken);
255  }
256  const auto& info = m_tokenInfo.get<kLookupInfo>(iToken.index());
257  if (LIKELY(iBranch == info.m_branchType)) {
258  if (LIKELY(iType == info.m_type)) {
259  return info.m_index;
260  } else {
261  throwTypeMismatch(iType, iToken);
262  }
263  } else {
264  throwBranchMismatch(iBranch, iToken);
265  }
267 }

References edm::EDGetToken::index(), info(), kLookupInfo, LIKELY, m_tokenInfo, edm::ProductResolverIndexInvalid, throwBadToken(), throwBranchMismatch(), throwTypeMismatch(), and UNLIKELY.

Referenced by edm::PrincipalGetAdapter::getByToken_().

◆ itemsMayGet()

void EDConsumerBase::itemsMayGet ( BranchType  iBranch,
std::vector< ProductResolverIndexAndSkipBit > &  oIndices 
) const

Definition at line 305 of file EDConsumerBase.cc.

305  {
306  //how many are we adding?
307  unsigned int count = 0;
308  {
309  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
310  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
311  ++it, ++itAlwaysGet) {
312  if (iBranch == it->m_branchType) {
313  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
314  if (not *itAlwaysGet) {
315  ++count;
316  }
317  }
318  }
319  }
320  }
321  oIndices.reserve(oIndices.size() + count);
322  {
323  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
324  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
325  ++it, ++itAlwaysGet) {
326  if (iBranch == it->m_branchType) {
327  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
328  if (not *itAlwaysGet) {
329  oIndices.push_back(it->m_index);
330  }
331  }
332  }
333  }
334  }
335 }

References submitPVResolutionJobs::count, kAlwaysGets, kLookupInfo, m_tokenInfo, and edm::ProductResolverIndexInvalid.

Referenced by updateLookup().

◆ itemsToGet()

void EDConsumerBase::itemsToGet ( BranchType  iBranch,
std::vector< ProductResolverIndexAndSkipBit > &  oIndices 
) const

Definition at line 273 of file EDConsumerBase.cc.

273  {
274  //how many are we adding?
275  unsigned int count = 0;
276  {
277  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
278  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
279  ++it, ++itAlwaysGet) {
280  if (iBranch == it->m_branchType) {
281  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
282  if (*itAlwaysGet) {
283  ++count;
284  }
285  }
286  }
287  }
288  }
289  oIndices.reserve(oIndices.size() + count);
290  {
291  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
292  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
293  ++it, ++itAlwaysGet) {
294  if (iBranch == it->m_branchType) {
295  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
296  if (*itAlwaysGet) {
297  oIndices.push_back(it->m_index);
298  }
299  }
300  }
301  }
302  }
303 }

References submitPVResolutionJobs::count, kAlwaysGets, kLookupInfo, m_tokenInfo, and edm::ProductResolverIndexInvalid.

Referenced by updateLookup().

◆ itemsToGetFrom()

std::vector<ProductResolverIndexAndSkipBit> const& edm::EDConsumerBase::itemsToGetFrom ( BranchType  iType) const
inline

Definition at line 90 of file EDConsumerBase.h.

90  {
91  return itemsToGetFromBranch_[iType];
92  }

References itemsToGetFromBranch_.

Referenced by edm::PrincipalGetAdapter::numberOfProductsConsumed().

◆ labelFor()

const char * EDConsumerBase::labelFor ( ESTokenIndex  iIndex) const
private

Definition at line 622 of file EDConsumerBase.cc.

622  {
623  return m_esTokenInfo.get<kESLookupInfo>(iIndex.value()).m_key.name().value();
624 }

References kESLookupInfo, m_esTokenInfo, and edm::ESTokenIndex::value().

Referenced by esConsumes().

◆ labelsForToken()

void EDConsumerBase::labelsForToken ( EDGetToken  iToken,
Labels oLabels 
) const

◆ mayConsume() [1/3]

EDGetToken edm::EDConsumerBase::mayConsume ( const TypeToGet id,
edm::InputTag const &  tag 
)
inlineprotected

Definition at line 178 of file EDConsumerBase.h.

178 { return mayConsume<InEvent>(id, tag); }

References GlobalPosition_Frontier_DevDB_cff::tag.

◆ mayConsume() [2/3]

template<BranchType B>
EDGetToken edm::EDConsumerBase::mayConsume ( const TypeToGet id,
edm::InputTag const &  tag 
)
inlineprotected

Definition at line 181 of file EDConsumerBase.h.

181  {
182  return EDGetToken{recordConsumes(B, id, checkIfEmpty(tag), false)};
183  }

References TtFullHadDaughter::B, checkIfEmpty(), recordConsumes(), and GlobalPosition_Frontier_DevDB_cff::tag.

◆ mayConsume() [3/3]

template<typename ProductType , BranchType B = InEvent>
EDGetTokenT<ProductType> edm::EDConsumerBase::mayConsume ( edm::InputTag const &  tag)
inlineprotected

Definition at line 173 of file EDConsumerBase.h.

173  {
174  TypeToGet tid = TypeToGet::make<ProductType>();
175  return EDGetTokenT<ProductType>{recordConsumes(B, tid, checkIfEmpty(tag), false)};
176  }

References TtFullHadDaughter::B, checkIfEmpty(), recordConsumes(), and GlobalPosition_Frontier_DevDB_cff::tag.

◆ modulesWhoseProductsAreConsumed()

void EDConsumerBase::modulesWhoseProductsAreConsumed ( std::vector< ModuleDescription const * > &  modules,
ProductRegistry const &  preg,
std::map< std::string, ModuleDescription const * > const &  labelsToDesc,
std::string const &  processName 
) const

Definition at line 470 of file EDConsumerBase.cc.

473  {
474  ProductResolverIndexHelper const& iHelper = *preg.productLookup(InEvent);
475 
476  std::set<std::string> alreadyFound;
477 
478  auto itKind = m_tokenInfo.begin<kKind>();
479  auto itLabels = m_tokenInfo.begin<kLabels>();
480  for (auto itInfo = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); itInfo != itEnd;
481  ++itInfo, ++itKind, ++itLabels) {
482  if (itInfo->m_branchType == InEvent and (not itInfo->m_index.skipCurrentProcess())) {
483  const unsigned int labelStart = itLabels->m_startOfModuleLabel;
484  const char* const consumedModuleLabel = &(m_tokenLabels[labelStart]);
485  const char* const consumedProductInstance = consumedModuleLabel + itLabels->m_deltaToProductInstance;
486  const char* const consumedProcessName = consumedModuleLabel + itLabels->m_deltaToProcessName;
487 
488  if (*consumedModuleLabel != '\0') { // not a consumesMany
489  if (*consumedProcessName != '\0') { // process name is specified in consumes call
490  if (processName == consumedProcessName &&
491  iHelper.index(
492  *itKind, itInfo->m_type, consumedModuleLabel, consumedProductInstance, consumedProcessName) !=
494  insertFoundModuleLabel(*itKind,
495  itInfo->m_type,
496  consumedModuleLabel,
497  consumedProductInstance,
498  modules,
499  alreadyFound,
500  labelsToDesc,
501  preg);
502  }
503  } else { // process name was empty
504  auto matches = iHelper.relatedIndexes(*itKind, itInfo->m_type, consumedModuleLabel, consumedProductInstance);
505  for (unsigned int j = 0; j < matches.numberOfMatches(); ++j) {
506  if (processName == matches.processName(j)) {
507  insertFoundModuleLabel(*itKind,
508  itInfo->m_type,
509  consumedModuleLabel,
510  consumedProductInstance,
511  modules,
512  alreadyFound,
513  labelsToDesc,
514  preg);
515  }
516  }
517  }
518  // consumesMany case
519  } else if (itInfo->m_index.productResolverIndex() == ProductResolverIndexInvalid) {
520  auto matches = iHelper.relatedIndexes(*itKind, itInfo->m_type);
521  for (unsigned int j = 0; j < matches.numberOfMatches(); ++j) {
522  if (processName == matches.processName(j)) {
523  insertFoundModuleLabel(*itKind,
524  itInfo->m_type,
525  matches.moduleLabel(j),
526  matches.productInstanceName(j),
527  modules,
528  alreadyFound,
529  labelsToDesc,
530  preg);
531  }
532  }
533  }
534  }
535  }
536 }

References edm::ProductResolverIndexHelper::index(), edm::InEvent, dqmiolumiharvest::j, kKind, kLabels, kLookupInfo, m_tokenInfo, m_tokenLabels, patCandidatesForDimuonsSequences_cff::matches, LogMessageMonitor_cff::modules, SimL1EmulatorRepack_CalouGT_cff::processName, edm::ProductRegistry::productLookup(), edm::ProductResolverIndexInvalid, and edm::ProductResolverIndexHelper::relatedIndexes().

◆ operator=() [1/2]

EDConsumerBase& edm::EDConsumerBase::operator= ( EDConsumerBase &&  )
default

◆ operator=() [2/2]

EDConsumerBase const& edm::EDConsumerBase::operator= ( EDConsumerBase const &  )
delete

◆ recordConsumes()

unsigned int EDConsumerBase::recordConsumes ( BranchType  iBranch,
TypeToGet const &  iType,
edm::InputTag const &  iTag,
bool  iAlwaysGets 
)
private

Definition at line 60 of file EDConsumerBase.cc.

63  {
64  if (frozen_) {
65  throwConsumesCallAfterFrozen(iType, iTag);
66  }
67 
68  unsigned int index = m_tokenInfo.size();
69 
70  bool skipCurrentProcess = iTag.willSkipCurrentProcess();
71 
72  const size_t labelSize = iTag.label().size();
73  const size_t productInstanceSize = iTag.instance().size();
74  unsigned int labelStart = m_tokenLabels.size();
75  unsigned short delta1 = labelSize + 1;
76  unsigned short delta2 = labelSize + 2 + productInstanceSize;
77  m_tokenInfo.emplace_back(TokenLookupInfo{iType.type(), ProductResolverIndexInvalid, skipCurrentProcess, iBranch},
78  iAlwaysGets,
79  LabelPlacement{labelStart, delta1, delta2},
80  iType.kind());
81 
82  const size_t additionalSize = skipCurrentProcess ? labelSize + productInstanceSize + 3
83  : labelSize + productInstanceSize + iTag.process().size() + 3;
84 
85  m_tokenLabels.reserve(m_tokenLabels.size() + additionalSize);
86  {
87  const std::string& m = iTag.label();
88  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
89  m_tokenLabels.push_back('\0');
90  }
91  {
92  const std::string& m = iTag.instance();
93  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
94  m_tokenLabels.push_back('\0');
95  }
96  {
97  const std::string& m = iTag.process();
100  }
101  if (!skipCurrentProcess) {
102  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
103  m_tokenLabels.push_back('\0');
104  } else {
105  m_tokenLabels.push_back('\0');
106  }
107  }
108  return index;
109 }

References containsCurrentProcessAlias_, frozen_, edm::InputTag::instance(), edm::InputTag::kCurrentProcess, edm::TypeToGet::kind(), edm::InputTag::label(), visualization-live-secondInstance_cfg::m, m_tokenInfo, m_tokenLabels, edm::InputTag::process(), edm::ProductResolverIndexInvalid, AlCaHLTBitMon_QueryRunRegistry::string, throwConsumesCallAfterFrozen(), edm::TypeToGet::type(), and edm::InputTag::willSkipCurrentProcess().

Referenced by consumes(), consumesMany(), and mayConsume().

◆ recordESConsumes()

ESTokenIndex EDConsumerBase::recordESConsumes ( Transition  iTrans,
eventsetup::EventSetupRecordKey const &  iRecord,
eventsetup::heterocontainer::HCTypeTag const &  iDataType,
edm::ESInputTag const &  iTag 
)
private

Definition at line 212 of file EDConsumerBase.cc.

215  {
216  if (frozen_) {
217  throwESConsumesCallAfterFrozen(iRecord, iDataType, iTag);
218  }
219 
220  //m_tokenLabels first entry is a null. Since most ES data requests have
221  // empty labels we will assume we can reuse the first entry
222  unsigned int startOfComponentName = 0;
223  if (not iTag.module().empty()) {
224  startOfComponentName = m_tokenLabels.size();
225 
226  m_tokenLabels.reserve(m_tokenLabels.size() + iTag.module().size() + 1);
227  {
228  const std::string& m = iTag.module();
229  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
230  m_tokenLabels.push_back('\0');
231  }
232  }
233 
234  auto index = static_cast<ESProxyIndex::Value_t>(m_esTokenInfo.size());
235  m_esTokenInfo.emplace_back(
236  ESTokenLookupInfo{iRecord, eventsetup::DataKey{iDataType, iTag.data().c_str()}, startOfComponentName},
237  ESProxyIndex{-1});
240  }
241  auto indexForToken = esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)].size();
242  esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)].emplace_back(-1 * (index + 1));
243  esRecordsToGetFromTransition_[static_cast<unsigned int>(iTrans)].emplace_back();
244  return ESTokenIndex{static_cast<ESTokenIndex::Value_t>(indexForToken)};
245 }

References edm::ESInputTag::data(), esItemsToGetFromTransition_, esRecordsToGetFromTransition_, frozen_, visualization-live-secondInstance_cfg::m, m_esTokenInfo, m_tokenLabels, edm::ESInputTag::module(), edm::NumberOfEventSetupTransitions, AlCaHLTBitMon_QueryRunRegistry::string, throwESConsumesCallAfterFrozen(), and throwESConsumesInProcessBlock().

Referenced by esConsumes().

◆ registeredToConsume()

bool EDConsumerBase::registeredToConsume ( ProductResolverIndex  iIndex,
bool  skipCurrentProcess,
BranchType  iBranch 
) const
Returns
true if the product corresponding to the index was registered via consumes or mayConsume call

Definition at line 346 of file EDConsumerBase.cc.

348  {
349  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd; ++it) {
350  if (it->m_index.productResolverIndex() == iIndex and it->m_index.skipCurrentProcess() == skipCurrentProcess and
351  it->m_branchType == iBranch) {
352  return true;
353  }
354  }
355  return false;
356 }

References kLookupInfo, and m_tokenInfo.

◆ registeredToConsumeMany()

bool EDConsumerBase::registeredToConsumeMany ( TypeID const &  iType,
BranchType  iBranch 
) const
Returns
true of TypeID corresponds to a type specified in a consumesMany call

Definition at line 358 of file EDConsumerBase.cc.

358  {
359  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd; ++it) {
360  //consumesMany entries do not have their index resolved
361  if (it->m_index.productResolverIndex() == ProductResolverIndexInvalid and it->m_type == iType and
362  it->m_branchType == iBranch) {
363  return true;
364  }
365  }
366  return false;
367 }

References kLookupInfo, m_tokenInfo, and edm::ProductResolverIndexInvalid.

◆ registerLateConsumes()

virtual void edm::EDConsumerBase::registerLateConsumes ( eventsetup::ESRecordsToProxyIndices const &  )
inlineprivatevirtual

Reimplemented in edm::EventSetupRecordDataGetter.

Definition at line 235 of file EDConsumerBase.h.

235 {}

Referenced by updateLookup().

◆ throwBadToken()

void EDConsumerBase::throwBadToken ( edm::TypeID const &  iType,
EDGetToken  iToken 
) const
private

Definition at line 382 of file EDConsumerBase.cc.

382  {
383  if (iToken.isUninitialized()) {
384  throw cms::Exception("BadToken") << "A get using a EDGetToken with the C++ type '" << iType.className()
385  << "' was made using an uninitialized token.\n Please check that the variable is "
386  "being initialized from a 'consumes' call.";
387  }
388  throw cms::Exception("BadToken")
389  << "A get using a EDGetToken with the C++ type '" << iType.className() << "' was made using a token with a value "
390  << iToken.index()
391  << " which is beyond the range used by this module.\n Please check that the variable is being initialized from a "
392  "'consumes' call from this module.\n You can not share EDGetToken values between modules.";
393 }

References edm::TypeID::className(), Exception, edm::EDGetToken::index(), and edm::EDGetToken::isUninitialized().

Referenced by indexFrom().

◆ throwBranchMismatch()

void EDConsumerBase::throwBranchMismatch ( BranchType  iBranch,
EDGetToken  iToken 
) const
private

Definition at line 375 of file EDConsumerBase.cc.

375  {
376  throw cms::Exception("BranchTypeMismatch")
377  << "A get using a EDGetToken was done in " << BranchTypeToString(iBranch) << " but the consumes call was for "
378  << BranchTypeToString(m_tokenInfo.get<kLookupInfo>(iToken.index()).m_branchType)
379  << ".\n Please modify the consumes call to use the correct branch type.";
380 }

References edm::BranchTypeToString(), Exception, edm::EDGetToken::index(), kLookupInfo, and m_tokenInfo.

Referenced by indexFrom().

◆ throwConsumesCallAfterFrozen()

void EDConsumerBase::throwConsumesCallAfterFrozen ( TypeToGet const &  typeToGet,
InputTag const &  inputTag 
) const
private

Definition at line 395 of file EDConsumerBase.cc.

395  {
396  throw cms::Exception("LogicError") << "A module declared it consumes a product after its constructor.\n"
397  << "This must be done in the contructor\n"
398  << "The product type was: " << typeToGet.type() << "\n"
399  << "and " << inputTag << "\n";
400 }

References Exception, SimL1EmulatorRepack_Full_cff::inputTag, and edm::TypeToGet::type().

Referenced by recordConsumes().

◆ throwESConsumesCallAfterFrozen()

void EDConsumerBase::throwESConsumesCallAfterFrozen ( eventsetup::EventSetupRecordKey const &  iRecord,
eventsetup::heterocontainer::HCTypeTag const &  iDataType,
edm::ESInputTag const &  iTag 
) const
private

Definition at line 402 of file EDConsumerBase.cc.

404  {
405  throw cms::Exception("LogicError") << "A module declared it consumes an EventSetup product after its constructor.\n"
406  << "This must be done in the contructor\n"
407  << "The product type was: " << iDataType.name() << " in record "
408  << iRecord.type().name() << "\n"
409  << "and ESInputTag was " << iTag << "\n";
410 }

References Exception, edm::eventsetup::heterocontainer::HCTypeTag::name(), and edm::eventsetup::EventSetupRecordKey::type().

Referenced by recordESConsumes().

◆ throwESConsumesInProcessBlock()

void EDConsumerBase::throwESConsumesInProcessBlock ( ) const
private

Definition at line 412 of file EDConsumerBase.cc.

412  {
413  throw cms::Exception("LogicError")
414  << "A module declared it consumes an EventSetup product during a ProcessBlock transition.\n"
415  << "EventSetup products can only be consumed in Event, Lumi, or Run transitions.\n";
416 }

References Exception.

Referenced by recordESConsumes().

◆ throwTypeMismatch()

void EDConsumerBase::throwTypeMismatch ( edm::TypeID const &  iType,
EDGetToken  iToken 
) const
private

Definition at line 369 of file EDConsumerBase.cc.

369  {
370  throw cms::Exception("TypeMismatch") << "A get using a EDGetToken used the C++ type '" << iType.className()
371  << "' but the consumes call was for type '"
372  << m_tokenInfo.get<kLookupInfo>(iToken.index()).m_type.className()
373  << "'.\n Please modify either the consumes or get call so the types match.";
374 }

References edm::TypeID::className(), Exception, edm::EDGetToken::index(), kLookupInfo, and m_tokenInfo.

Referenced by indexFrom().

◆ uncheckedIndexFrom()

ProductResolverIndexAndSkipBit EDConsumerBase::uncheckedIndexFrom ( EDGetToken  iToken) const

◆ updateLookup() [1/2]

void EDConsumerBase::updateLookup ( BranchType  iBranchType,
ProductResolverIndexHelper const &  iHelper,
bool  iPrefetchMayGet 
)

Definition at line 111 of file EDConsumerBase.cc.

113  {
114  frozen_ = true;
116  {
117  auto itKind = m_tokenInfo.begin<kKind>();
118  auto itLabels = m_tokenInfo.begin<kLabels>();
119  for (auto itInfo = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); itInfo != itEnd;
120  ++itInfo, ++itKind, ++itLabels) {
121  if (itInfo->m_branchType == iBranchType) {
122  const unsigned int labelStart = itLabels->m_startOfModuleLabel;
123  const char* moduleLabel = &(m_tokenLabels[labelStart]);
124  itInfo->m_index = ProductResolverIndexAndSkipBit(iHelper.index(*itKind,
125  itInfo->m_type,
126  moduleLabel,
127  moduleLabel + itLabels->m_deltaToProductInstance,
128  moduleLabel + itLabels->m_deltaToProcessName),
129  itInfo->m_index.skipCurrentProcess());
130  }
131  }
132  }
133 
134  //now add resolved requests to get many to the end of our list
135  // a get many will have an empty module label
136  for (size_t i = 0, iEnd = m_tokenInfo.size(); i != iEnd; ++i) {
137  //need to copy since pointer could be invalidated by emplace_back
138  auto const info = m_tokenInfo.get<kLookupInfo>(i);
139  if (info.m_branchType == iBranchType && info.m_index.productResolverIndex() == ProductResolverIndexInvalid &&
140  m_tokenLabels[m_tokenInfo.get<kLabels>(i).m_startOfModuleLabel] == '\0') {
141  //find all matching types
142  const auto kind = m_tokenInfo.get<kKind>(i);
143  auto matches = iHelper.relatedIndexes(kind, info.m_type);
144 
145  //NOTE: This could be changed to contain the true labels for what is being
146  // requested but for now I want to remember these are part of a get many
147  const LabelPlacement labels = m_tokenInfo.get<kLabels>(i);
148  bool alwaysGet = m_tokenInfo.get<kAlwaysGets>(i);
149  for (unsigned int j = 0; j != matches.numberOfMatches(); ++j) {
150  //only keep the ones that are for a specific data item and not a collection
151  if (matches.isFullyResolved(j)) {
152  auto index = matches.index(j);
153  m_tokenInfo.emplace_back(
154  TokenLookupInfo{info.m_type, index, info.m_index.skipCurrentProcess(), info.m_branchType},
155  alwaysGet,
156  labels,
157  kind);
158  }
159  }
160  }
161  }
162  m_tokenInfo.shrink_to_fit();
163 
164  itemsToGet(iBranchType, itemsToGetFromBranch_[iBranchType]);
165  if (iPrefetchMayGet) {
166  itemsMayGet(iBranchType, itemsToGetFromBranch_[iBranchType]);
167  }
168 }

References cms::cuda::assert(), containsCurrentProcessAlias_, frozen_, mps_fire::i, edm::ProductResolverIndexHelper::index(), info(), itemsMayGet(), itemsToGet(), itemsToGetFromBranch_, dqmiolumiharvest::j, kAlwaysGets, CalibrationSummaryClient_cfi::kind, kKind, kLabels, kLookupInfo, SummaryClient_cfi::labels, m_tokenInfo, m_tokenLabels, patCandidatesForDimuonsSequences_cff::matches, HerwigMaxPtPartonFilter_cfi::moduleLabel, edm::ProductResolverIndexInvalid, and edm::ProductResolverIndexHelper::relatedIndexes().

Referenced by edm::SubProcess::beginJob().

◆ updateLookup() [2/2]

void EDConsumerBase::updateLookup ( eventsetup::ESRecordsToProxyIndices const &  iPI)

Definition at line 170 of file EDConsumerBase.cc.

170  {
171  // temporarily unfreeze to allow late EventSetup consumes registration
172  frozen_ = false;
174  frozen_ = true;
175 
176  unsigned int index = 0;
177  for (auto it = m_esTokenInfo.begin<kESLookupInfo>(); it != m_esTokenInfo.end<kESLookupInfo>(); ++it, ++index) {
178  auto indexInRecord = iPI.indexInRecord(it->m_record, it->m_key);
180  const char* componentName = &(m_tokenLabels[it->m_startOfComponentName]);
181  if (*componentName) {
182  auto component = iPI.component(it->m_record, it->m_key);
183  if (component->label_.empty()) {
184  if (component->type_ != componentName) {
186  }
187  } else if (component->label_ != componentName) {
189  }
190  }
191  }
192  m_esTokenInfo.get<kESProxyIndex>(index) = indexInRecord;
193 
194  int negIndex = -1 * (index + 1);
195  for (auto& items : esItemsToGetFromTransition_) {
196  for (auto& itemIndex : items) {
197  if (itemIndex.value() == negIndex) {
198  itemIndex = indexInRecord;
199  esRecordsToGetFromTransition_[&items - &esItemsToGetFromTransition_.front()][&itemIndex - &items.front()] =
200  iPI.recordIndexFor(it->m_record);
201  negIndex = 1;
202  break;
203  }
204  }
205  if (negIndex > 0) {
206  break;
207  }
208  }
209  }
210 }

References edm::eventsetup::ESRecordsToProxyIndices::component(), esItemsToGetFromTransition_, esRecordsToGetFromTransition_, frozen_, edm::eventsetup::ESRecordsToProxyIndices::indexInRecord(), mps_monitormerge::items, kESLookupInfo, kESProxyIndex, m_esTokenInfo, m_tokenLabels, edm::eventsetup::ESRecordsToProxyIndices::missingProxyIndex(), edm::eventsetup::ESRecordsToProxyIndices::recordIndexFor(), and registerLateConsumes().

Friends And Related Function Documentation

◆ ConsumesCollector

friend class ConsumesCollector
friend

Definition at line 140 of file EDConsumerBase.h.

◆ EDConsumerBaseAdaptor

template<BranchType B>
friend class EDConsumerBaseAdaptor
friend

Definition at line 146 of file EDConsumerBase.h.

◆ EDConsumerBaseESAdaptor

template<Transition Tr>
friend class EDConsumerBaseESAdaptor
friend

Definition at line 142 of file EDConsumerBase.h.

◆ EDConsumerBaseWithTagESAdaptor

template<Transition Tr>
friend class EDConsumerBaseWithTagESAdaptor
friend

Definition at line 144 of file EDConsumerBase.h.

◆ WillGetIfMatch

template<typename T >
friend class WillGetIfMatch
friend

Definition at line 148 of file EDConsumerBase.h.

Member Data Documentation

◆ containsCurrentProcessAlias_

bool edm::EDConsumerBase::containsCurrentProcessAlias_
private

Definition at line 308 of file EDConsumerBase.h.

Referenced by convertCurrentProcessAlias(), recordConsumes(), and updateLookup().

◆ esItemsToGetFromTransition_

std::array<std::vector<ESProxyIndex>, static_cast<unsigned int>edm::Transition::NumberOfEventSetupTransitions)> edm::EDConsumerBase::esItemsToGetFromTransition_
private

◆ esRecordsToGetFromTransition_

std::array<std::vector<ESRecordIndex>, static_cast<unsigned int>edm::Transition::NumberOfEventSetupTransitions)> edm::EDConsumerBase::esRecordsToGetFromTransition_
private

Definition at line 306 of file EDConsumerBase.h.

Referenced by esGetTokenRecordIndicesVector(), recordESConsumes(), and updateLookup().

◆ frozen_

bool edm::EDConsumerBase::frozen_
private

◆ itemsToGetFromBranch_

std::array<std::vector<ProductResolverIndexAndSkipBit>, edm::NumBranchTypes> edm::EDConsumerBase::itemsToGetFromBranch_
private

Definition at line 284 of file EDConsumerBase.h.

Referenced by itemsToGetFrom(), and updateLookup().

◆ m_esTokenInfo

edm::SoATuple<ESTokenLookupInfo, ESProxyIndex> edm::EDConsumerBase::m_esTokenInfo
private

Definition at line 302 of file EDConsumerBase.h.

Referenced by labelFor(), recordESConsumes(), and updateLookup().

◆ m_tokenInfo

edm::SoATuple<TokenLookupInfo, bool, LabelPlacement, edm::KindOfType> edm::EDConsumerBase::m_tokenInfo
private

◆ m_tokenLabels

std::vector<char> edm::EDConsumerBase::m_tokenLabels
private
edm::EDConsumerBase::throwESConsumesCallAfterFrozen
void throwESConsumesCallAfterFrozen(eventsetup::EventSetupRecordKey const &, eventsetup::heterocontainer::HCTypeTag const &, edm::ESInputTag const &) const
Definition: EDConsumerBase.cc:402
edm::EDGetToken::index
constexpr unsigned int index() const noexcept
Definition: EDGetToken.h:50
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
edm::InputTag::kCurrentProcess
static const std::string kCurrentProcess
Definition: InputTag.h:54
edm::ESTokenIndex
Definition: ESIndices.h:55
mps_fire.i
i
Definition: mps_fire.py:428
TypeToGet
start
Definition: start.py:1
LogMessageMonitor_cff.modules
modules
Definition: LogMessageMonitor_cff.py:7
edm::EDConsumerBase::esRecordsToGetFromTransition_
std::array< std::vector< ESRecordIndex >, static_cast< unsigned int >edm::Transition::NumberOfEventSetupTransitions)> esRecordsToGetFromTransition_
Definition: EDConsumerBase.h:306
ESInputTag
edm::EDConsumerBase::recordConsumes
unsigned int recordConsumes(BranchType iBranch, TypeToGet const &iType, edm::InputTag const &iTag, bool iAlwaysGets)
Definition: EDConsumerBase.cc:60
modules
Definition: ZHLTMatchFilter.cc:17
edm::ProductResolverIndexAndSkipBit
Definition: ProductResolverIndexAndSkipBit.h:28
edm::EDConsumerBase::kAlwaysGets
Definition: EDConsumerBase.h:277
edm::EDConsumerBase::kESProxyIndex
Definition: EDConsumerBase.h:301
edm::EDConsumerBase::checkIfEmpty
edm::InputTag const & checkIfEmpty(edm::InputTag const &tag)
Definition: EDConsumerBase.cc:53
edm::EDConsumerBase::m_esTokenInfo
edm::SoATuple< ESTokenLookupInfo, ESProxyIndex > m_esTokenInfo
Definition: EDConsumerBase.h:302
cms::cuda::assert
assert(be >=bs)
edm::ProductResolverIndexHelper::index
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
Definition: ProductResolverIndexHelper.cc:81
edm::eventsetup::DataKey
Definition: DataKey.h:29
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
edm::ProductResolverIndexHelper::relatedIndexes
Matches relatedIndexes(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance) const
Definition: ProductResolverIndexHelper.cc:153
edm::ProductResolverIndexHelper
Definition: ProductResolverIndexHelper.h:89
findQualityFiles.v
v
Definition: findQualityFiles.py:179
edm::EDConsumerBase::itemsMayGet
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: EDConsumerBase.cc:305
edm::EDConsumerBase::throwConsumesCallAfterFrozen
void throwConsumesCallAfterFrozen(TypeToGet const &, InputTag const &) const
Definition: EDConsumerBase.cc:395
edm::ESProxyIndex
Definition: ESIndices.h:30
mps_monitormerge.items
list items
Definition: mps_monitormerge.py:29
edm::EDConsumerBase::m_tokenLabels
std::vector< char > m_tokenLabels
Definition: EDConsumerBase.h:282
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
kWasEmpty
static const edm::InputTag kWasEmpty("@EmptyLabel@")
edm::EDConsumerBase::kKind
Definition: EDConsumerBase.h:277
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::eventsetup::default_record_t
typename default_record< T >::RecordT default_record_t
Definition: data_default_record_trait.h:68
edm::ESTokenIndex::value
constexpr Value_t value() const noexcept
Definition: ESIndices.h:70
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
edm::EDConsumerBase::itemsToGet
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: EDConsumerBase.cc:273
edm::InEvent
Definition: BranchType.h:11
edm::EDConsumerBase::kLabels
Definition: EDConsumerBase.h:277
edm::eventsetup::EventSetupRecordKey::makeKey
static EventSetupRecordKey makeKey()
Definition: EventSetupRecordKey.h:49
edm::EDConsumerBase::throwESConsumesInProcessBlock
void throwESConsumesInProcessBlock() const
Definition: EDConsumerBase.cc:412
edm::eventsetup::ESRecordsToProxyIndices::missingProxyIndex
static constexpr ESProxyIndex missingProxyIndex() noexcept
Definition: ESRecordsToProxyIndices.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EDConsumerBase::m_tokenInfo
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
Definition: EDConsumerBase.h:278
edm::EDConsumerBase::throwBadToken
void throwBadToken(edm::TypeID const &iType, EDGetToken iToken) const
Definition: EDConsumerBase.cc:382
edm::ProductResolverIndexInvalid
Definition: ProductResolverIndex.h:16
edm::EDConsumerBase::itemsToGetFromBranch_
std::array< std::vector< ProductResolverIndexAndSkipBit >, edm::NumBranchTypes > itemsToGetFromBranch_
Definition: EDConsumerBase.h:284
edm::EDConsumerBase::kLookupInfo
Definition: EDConsumerBase.h:277
ESGetToken
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::EDConsumerBase::containsCurrentProcessAlias_
bool containsCurrentProcessAlias_
Definition: EDConsumerBase.h:308
edm::EDConsumerBase::kESLookupInfo
Definition: EDConsumerBase.h:301
CalibrationSummaryClient_cfi.kind
kind
Definition: CalibrationSummaryClient_cfi.py:37
ESGetTokenGeneric
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
EDGetToken
TtFullHadDaughter::B
static const std::string B
Definition: TtFullHadronicEvent.h:9
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::EDGetToken::isUninitialized
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:51
edm::EDConsumerBase::frozen_
bool frozen_
Definition: EDConsumerBase.h:307
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
Exception
Definition: hltDiff.cc:246
edm::EDConsumerBase::labelFor
const char * labelFor(ESTokenIndex) const
Definition: EDConsumerBase.cc:622
edm::EDConsumerBase::throwBranchMismatch
void throwBranchMismatch(BranchType, EDGetToken) const
Definition: EDConsumerBase.cc:375
edm::EDConsumerBase::esItemsToGetFromTransition_
std::array< std::vector< ESProxyIndex >, static_cast< unsigned int >edm::Transition::NumberOfEventSetupTransitions)> esItemsToGetFromTransition_
Definition: EDConsumerBase.h:304
patCandidatesForDimuonsSequences_cff.matches
matches
Definition: patCandidatesForDimuonsSequences_cff.py:131
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
mps_fire.result
result
Definition: mps_fire.py:311
command_line.start
start
Definition: command_line.py:167
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
edm::EDConsumerBase::recordESConsumes
ESTokenIndex recordESConsumes(Transition, eventsetup::EventSetupRecordKey const &, eventsetup::heterocontainer::HCTypeTag const &, edm::ESInputTag const &iTag)
Definition: EDConsumerBase.cc:212
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
SimL1EmulatorRepack_Full_cff.inputTag
inputTag
Definition: SimL1EmulatorRepack_Full_cff.py:56
edm::BranchTypeToString
std::string const & BranchTypeToString(BranchType const &branchType)
Definition: BranchType.cc:91
edm::EDConsumerBase::throwTypeMismatch
void throwTypeMismatch(edm::TypeID const &, EDGetToken) const
Definition: EDConsumerBase.cc:369
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
edm::EDConsumerBase::registerLateConsumes
virtual void registerLateConsumes(eventsetup::ESRecordsToProxyIndices const &)
Definition: EDConsumerBase.h:235
edm::Transition::NumberOfEventSetupTransitions