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::OutputModule 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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

template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, 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)
 
void throwBadToken (edm::TypeID const &iType, EDGetToken iToken) const
 
void throwBranchMismatch (BranchType, EDGetToken) const
 
void throwConsumesCallAfterFrozen (TypeToGet const &, InputTag const &) const
 
void throwTypeMismatch (edm::TypeID const &, EDGetToken) const
 

Private Attributes

bool containsCurrentProcessAlias_
 
std::array< std::vector< ESProxyIndex >, static_cast< unsigned int >edm::Transition::NumberOfTransitions)> esItemsToGetFromTransition_
 
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<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 62 of file EDConsumerBase.h.

Member Typedef Documentation

Definition at line 97 of file EDConsumerBase.h.

Member Enumeration Documentation

anonymous enum
private
anonymous enum
private
Enumerator
kESLookupInfo 
kESProxyIndex 

Definition at line 246 of file EDConsumerBase.h.

Constructor & Destructor Documentation

edm::EDConsumerBase::EDConsumerBase ( )
inline

Definition at line 64 of file EDConsumerBase.h.

References noexcept.

64 : m_tokenLabels{'\0'}, frozen_(false), containsCurrentProcessAlias_(false) {}
std::vector< char > m_tokenLabels
EDConsumerBase::~EDConsumerBase ( )
virtualnoexcept

Definition at line 54 of file EDConsumerBase.cc.

54 {}
edm::EDConsumerBase::EDConsumerBase ( EDConsumerBase const &  )
delete
edm::EDConsumerBase::EDConsumerBase ( EDConsumerBase &&  )
default

Member Function Documentation

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

Definition at line 78 of file EDConsumerBase.cc.

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

78  {
79  if (iTag.label().empty()) {
80  return kWasEmpty;
81  }
82  return iTag;
83 }
static const edm::InputTag kWasEmpty("@EmptyLabel@")
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT<ProductType> edm::EDConsumerBase::consumes ( edm::InputTag const &  tag)
inlineprotected

Definition at line 126 of file EDConsumerBase.h.

References TtFullHadDaughter::B.

Referenced by AlCaECALRecHitReducer::AlCaECALRecHitReducer(), CrossingFramePSimHitToPSimHitsConverter::CrossingFramePSimHitToPSimHitsConverter(), ElectronMVANtuplizer::ElectronMVANtuplizer(), edm::EventContentAnalyzer::EventContentAnalyzer(), HLTMuonIsoFilter::HLTMuonIsoFilter(), HLTMuonPFIsoFilter::HLTMuonPFIsoFilter(), JetCollectionReducerT< T >::JetCollectionReducerT(), edm::OutputModule::keepThisBranch(), edm::SubProcess::keepThisBranch(), edm::one::OutputModuleBase::keepThisBranch(), edm::global::OutputModuleBase::keepThisBranch(), edm::limited::OutputModuleBase::keepThisBranch(), L1RCTProducer::L1RCTProducer(), edm::LogErrorHarvester::LogErrorHarvester(), MultiplicityCorrelator::MultiplicityCorrelator(), MultiTrackValidator::MultiTrackValidator(), pat::PATPackedCandidateProducer::PATPackedCandidateProducer(), PhotonMVANtuplizer::PhotonMVANtuplizer(), SeedMultiplicityAnalyzer::SeedMultiplicityAnalyzer(), ShallowSimhitClustersProducer::ShallowSimhitClustersProducer(), edm::SwitchProducer::SwitchProducer(), TrackingParticleNumberOfLayersProducer::TrackingParticleNumberOfLayersProducer(), and TTClusterBuilder< T >::TTClusterBuilder().

126  {
127  TypeToGet tid = TypeToGet::make<ProductType>();
128  return EDGetTokenT<ProductType>{recordConsumes(B, tid, checkIfEmpty(tag), true)};
129  }
unsigned int recordConsumes(BranchType iBranch, TypeToGet const &iType, edm::InputTag const &iTag, bool iAlwaysGets)
static const std::string B
edm::InputTag const & checkIfEmpty(edm::InputTag const &tag)
EDGetToken edm::EDConsumerBase::consumes ( const TypeToGet id,
edm::InputTag const &  tag 
)
inlineprotected

Definition at line 131 of file EDConsumerBase.h.

References edm::InEvent.

131  {
132  return EDGetToken{recordConsumes(InEvent, id, checkIfEmpty(tag), true)};
133  }
unsigned int recordConsumes(BranchType iBranch, TypeToGet const &iType, edm::InputTag const &iTag, bool iAlwaysGets)
edm::InputTag const & checkIfEmpty(edm::InputTag const &tag)
template<BranchType B>
EDGetToken edm::EDConsumerBase::consumes ( TypeToGet const &  id,
edm::InputTag const &  tag 
)
inlineprotected

Definition at line 136 of file EDConsumerBase.h.

References TtFullHadDaughter::B.

136  {
137  return EDGetToken{recordConsumes(B, id, checkIfEmpty(tag), true)};
138  }
unsigned int recordConsumes(BranchType iBranch, TypeToGet const &iType, edm::InputTag const &iTag, bool iAlwaysGets)
static const std::string B
edm::InputTag const & checkIfEmpty(edm::InputTag const &tag)
ConsumesCollector EDConsumerBase::consumesCollector ( )
protected

Use a ConsumesCollector to gather consumes information from helper functions.

Definition at line 71 of file EDConsumerBase.cc.

References EnergyCorrector::c, and kWasEmpty.

Referenced by AlcaBeamSpotProducer::AlcaBeamSpotProducer(), IsolatedParticlesGeneratedJets::analyze(), OverlapValidation::analyze(), edm::AnalyzerWrapper< T >::AnalyzerWrapper(), BCToEFilter::BCToEFilter(), BeamMonitorBx::BeamMonitorBx(), BeamSpotAnalyzer::BeamSpotAnalyzer(), DTTrigTest::beginRun(), CaloParticleDebugger::CaloParticleDebugger(), ConfigurableAnalysis::ConfigurableAnalysis(), CosmicSplitterValidation::CosmicSplitterValidation(), edm::OutputModule::doPreallocate(), edm::global::OutputModuleBase::doPreallocate(), edm::limited::OutputModuleBase::doPreallocate(), edm::one::OutputModuleBase::doPreallocate(), DTResidualCalibration::DTResidualCalibration(), DTTTrigOffsetCalibration::DTTTrigOffsetCalibration(), DTVDriftCalibration::DTVDriftCalibration(), DTVDriftSegmentCalibration::DTVDriftSegmentCalibration(), EcalCosmicsHists::EcalCosmicsHists(), EDMtoMEConverter::EDMtoMEConverter(), EopTreeWriter::EopTreeWriter(), EventWithHistoryEDFilter::EventWithHistoryEDFilter(), edm::FilterWrapper< T >::FilterWrapper(), HcalIsoTrkAnalyzer::HcalIsoTrkAnalyzer(), HGCalTriggerNtupleManager::HGCalTriggerNtupleManager(), HighPtTrackEcalDetIdProducer::HighPtTrackEcalDetIdProducer(), HLTBitAnalyzer::HLTBitAnalyzer(), HLTMuonIsoFilter::HLTMuonIsoFilter(), cms::CkfDebugTrackCandidateMaker::initDebugger(), IsolatedTracksCone::IsolatedTracksCone(), L1EventTreeProducer::L1EventTreeProducer(), L1MuGlobalMuonTrigger::L1MuGlobalMuonTrigger(), pat::helper::ManyThingsToValueMaps< Adaptor, Collection, value_type >::ManyThingsToValueMaps(), pat::PATMETSlimmer::maybeReadShifts(), MomentumConstraintProducer::MomentumConstraintProducer(), MultiplicityCorrelator::MultiplicityCorrelator(), MultiplicityInvestigator::MultiplicityInvestigator(), MultiplicityTimeCorrelations::MultiplicityTimeCorrelations(), MuPFIsoEmbedder::MuPFIsoEmbedder(), OccupancyPlots::OccupancyPlots(), edm::OutputModule::OutputModule(), edm::global::OutputModuleBase::OutputModuleBase(), edm::limited::OutputModuleBase::OutputModuleBase(), edm::one::OutputModuleBase::OutputModuleBase(), OverlapValidation::OverlapValidation(), edm::PathStatusFilter::PathStatusFilter(), PlottingDevice::PlottingDevice(), QuickTrackAssociatorByHitsProducer::QuickTrackAssociatorByHitsProducer(), ReduceHcalRecHitCollectionProducer::ReduceHcalRecHitCollectionProducer(), SeedMultiplicityAnalyzer::SeedMultiplicityAnalyzer(), SiStripDCSFilter::SiStripDCSFilter(), edm::SubProcess::SubProcess(), TagProbeFitTreeProducer::TagProbeFitTreeProducer(), Tau3MuSkim::Tau3MuSkim(), TtDilepEvtSolutionMaker::TtDilepEvtSolutionMaker(), and TtSemiEvtSolutionMaker::TtSemiEvtSolutionMaker().

71  {
72  ConsumesCollector c{this};
73  return c;
74 }
std::vector< ConsumesInfo > EDConsumerBase::consumesInfo ( ) const

Definition at line 553 of file EDConsumerBase.cc.

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

553  {
554  // Use this to eliminate duplicate entries related
555  // to consumesMany items where only the type was specified
556  // and the there are multiple matches. In these cases the
557  // label, instance, and process will be empty.
558  std::set<edm::TypeID> alreadySeenTypes;
559 
560  std::vector<ConsumesInfo> result;
561  auto itAlways = m_tokenInfo.begin<kAlwaysGets>();
562  auto itKind = m_tokenInfo.begin<kKind>();
563  auto itLabels = m_tokenInfo.begin<kLabels>();
564  for (auto itInfo = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); itInfo != itEnd;
565  ++itInfo, ++itKind, ++itLabels, ++itAlways) {
566  const unsigned int labelStart = itLabels->m_startOfModuleLabel;
567  const char* consumedModuleLabel = &(m_tokenLabels[labelStart]);
568  const char* consumedInstance = consumedModuleLabel + itLabels->m_deltaToProductInstance;
569  const char* consumedProcessName = consumedModuleLabel + itLabels->m_deltaToProcessName;
570 
571  // consumesMany case
572  if (*consumedModuleLabel == '\0') {
573  if (!alreadySeenTypes.insert(itInfo->m_type).second) {
574  continue;
575  }
576  }
577 
578  // Just copy the information into the ConsumesInfo data structure
579  result.emplace_back(itInfo->m_type,
580  consumedModuleLabel,
581  consumedInstance,
582  consumedProcessName,
583  itInfo->m_branchType,
584  *itKind,
585  *itAlways,
586  itInfo->m_index.skipCurrentProcess());
587  }
588  return result;
589 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
std::vector< char > m_tokenLabels
template<typename ProductType , BranchType B = InEvent>
void edm::EDConsumerBase::consumesMany ( )
inlineprotected

Definition at line 154 of file EDConsumerBase.h.

154  {
155  TypeToGet tid = TypeToGet::make<ProductType>();
156  consumesMany<B>(tid);
157  }
void edm::EDConsumerBase::consumesMany ( const TypeToGet id)
inlineprotected

Definition at line 159 of file EDConsumerBase.h.

References triggerObjects_cff::id.

159 { consumesMany<InEvent>(id); }
template<BranchType B>
void edm::EDConsumerBase::consumesMany ( const TypeToGet id)
inlineprotected

Definition at line 162 of file EDConsumerBase.h.

References TtFullHadDaughter::B.

162  {
163  recordConsumes(B, id, edm::InputTag{}, true);
164  }
unsigned int recordConsumes(BranchType iBranch, TypeToGet const &iType, edm::InputTag const &iTag, bool iAlwaysGets)
static const std::string B
void EDConsumerBase::convertCurrentProcessAlias ( std::string const &  processName)

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

Definition at line 507 of file EDConsumerBase.cc.

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

507  {
508  frozen_ = true;
509 
512 
513  std::vector<char> newTokenLabels;
514 
515  // first calculate the size of the new vector and reserve memory for it
516  std::vector<char>::size_type newSize = 0;
517  std::string newProcessName;
518  for (auto iter = m_tokenInfo.begin<kLabels>(), itEnd = m_tokenInfo.end<kLabels>(); iter != itEnd; ++iter) {
519  newProcessName = &m_tokenLabels[iter->m_startOfModuleLabel + iter->m_deltaToProcessName];
520  if (newProcessName == InputTag::kCurrentProcess) {
521  newProcessName = processName;
522  }
523  newSize += (iter->m_deltaToProcessName + newProcessName.size() + 1);
524  }
525  newTokenLabels.reserve(newSize);
526 
527  unsigned int newStartOfModuleLabel = 0;
528  for (auto iter = m_tokenInfo.begin<kLabels>(), itEnd = m_tokenInfo.end<kLabels>(); iter != itEnd; ++iter) {
529  unsigned int startOfModuleLabel = iter->m_startOfModuleLabel;
530  unsigned short deltaToProcessName = iter->m_deltaToProcessName;
531 
532  iter->m_startOfModuleLabel = newStartOfModuleLabel;
533 
534  newProcessName = &m_tokenLabels[startOfModuleLabel + deltaToProcessName];
535  if (newProcessName == InputTag::kCurrentProcess) {
536  newProcessName = processName;
537  }
538 
539  newStartOfModuleLabel += (deltaToProcessName + newProcessName.size() + 1);
540 
541  // Copy in both the module label and instance, they are the same
542  newTokenLabels.insert(newTokenLabels.end(),
543  m_tokenLabels.begin() + startOfModuleLabel,
544  m_tokenLabels.begin() + (startOfModuleLabel + deltaToProcessName));
545 
546  newTokenLabels.insert(newTokenLabels.end(), newProcessName.begin(), newProcessName.end());
547  newTokenLabels.push_back('\0');
548  }
549  m_tokenLabels = std::move(newTokenLabels);
550  }
551 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
uint16_t size_type
static const std::string kCurrentProcess
Definition: InputTag.h:54
std::vector< char > m_tokenLabels
def move(src, dest)
Definition: eostools.py:511
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto edm::EDConsumerBase::esConsumes ( )
inlineprotected

Definition at line 168 of file EDConsumerBase.h.

168  {
169  return esConsumes<ESProduct, ESRecord, Tr>(ESInputTag{});
170  }
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto edm::EDConsumerBase::esConsumes ( ESInputTag const &  tag)
inlineprotected

Definition at line 173 of file EDConsumerBase.h.

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

173  {
174  auto index = recordESConsumes(Tr,
176  std::conditional_t<std::is_same_v<ESRecord, edm::DefaultRecord>,
177  eventsetup::default_record_t<ESHandleAdapter<ESProduct>>,
178  ESRecord>>(),
179  eventsetup::heterocontainer::HCTypeTag::make<ESProduct>(),
180  tag);
181  return ESGetToken<ESProduct, ESRecord>{static_cast<unsigned int>(Tr), index, labelFor(index)};
182  }
const char * labelFor(ESTokenIndex) const
typename default_record< T >::RecordT default_record_t
static EventSetupRecordKey makeKey()
ESTokenIndex recordESConsumes(Transition, eventsetup::EventSetupRecordKey const &, eventsetup::heterocontainer::HCTypeTag const &, edm::ESInputTag const &iTag)
ESProxyIndex const* edm::EDConsumerBase::esGetTokenIndices ( edm::Transition  iTrans) const
inline

Definition at line 110 of file EDConsumerBase.h.

References findQualityFiles::v.

Referenced by edm::global::EDFilterBase::doAcquire(), edm::global::EDProducerBase::doAcquire(), edm::EDAnalyzer::doBeginLuminosityBlock(), edm::EDProducer::doBeginLuminosityBlock(), edm::EDFilter::doBeginLuminosityBlock(), edm::one::EDProducerBase::doBeginLuminosityBlock(), edm::one::EDFilterBase::doBeginLuminosityBlock(), edm::one::EDAnalyzerBase::doBeginLuminosityBlock(), edm::global::EDAnalyzerBase::doBeginLuminosityBlock(), edm::limited::EDProducerBase::doBeginLuminosityBlock(), edm::global::EDProducerBase::doBeginLuminosityBlock(), edm::limited::EDFilterBase::doBeginLuminosityBlock(), edm::global::EDFilterBase::doBeginLuminosityBlock(), edm::limited::EDAnalyzerBase::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::limited::EDProducerBase::doBeginRun(), edm::global::EDProducerBase::doBeginRun(), edm::limited::EDFilterBase::doBeginRun(), edm::global::EDFilterBase::doBeginRun(), edm::limited::EDAnalyzerBase::doBeginRun(), edm::EDAnalyzer::doEndLuminosityBlock(), edm::EDProducer::doEndLuminosityBlock(), edm::EDFilter::doEndLuminosityBlock(), edm::one::EDProducerBase::doEndLuminosityBlock(), edm::one::EDFilterBase::doEndLuminosityBlock(), edm::one::EDAnalyzerBase::doEndLuminosityBlock(), edm::global::EDAnalyzerBase::doEndLuminosityBlock(), edm::limited::EDProducerBase::doEndLuminosityBlock(), edm::global::EDProducerBase::doEndLuminosityBlock(), edm::limited::EDFilterBase::doEndLuminosityBlock(), edm::global::EDFilterBase::doEndLuminosityBlock(), edm::limited::EDAnalyzerBase::doEndLuminosityBlock(), edm::EDAnalyzer::doEndRun(), edm::EDProducer::doEndRun(), edm::EDFilter::doEndRun(), edm::one::EDProducerBase::doEndRun(), edm::one::EDFilterBase::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::EDAnalyzer::doEvent(), edm::EDProducer::doEvent(), edm::EDFilter::doEvent(), edm::global::EDFilterBase::doEvent(), edm::global::EDAnalyzerBase::doEvent(), edm::one::EDFilterBase::doEvent(), edm::one::EDProducerBase::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::limited::EDProducerBase::doStreamBeginLuminosityBlock(), edm::global::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().

110  {
111  auto const& v = esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)];
112  if (v.empty()) {
113  return nullptr;
114  }
115  return &(esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)].front());
116  }
std::array< std::vector< ESProxyIndex >, static_cast< unsigned int >edm::Transition::NumberOfTransitions)> esItemsToGetFromTransition_
ProductResolverIndexAndSkipBit EDConsumerBase::indexFrom ( EDGetToken  iToken,
BranchType  iBranch,
TypeID const &  iType 
) const

Definition at line 260 of file EDConsumerBase.cc.

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

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

262  {
263  if (UNLIKELY(iToken.index() >= m_tokenInfo.size())) {
264  throwBadToken(iType, iToken);
265  }
266  const auto& info = m_tokenInfo.get<kLookupInfo>(iToken.index());
267  if (LIKELY(iBranch == info.m_branchType)) {
268  if (LIKELY(iType == info.m_type)) {
269  return info.m_index;
270  } else {
271  throwTypeMismatch(iType, iToken);
272  }
273  } else {
274  throwBranchMismatch(iBranch, iToken);
275  }
277 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
static const TGPicture * info(bool iBackgroundIsBlack)
void throwTypeMismatch(edm::TypeID const &, EDGetToken) const
void throwBadToken(edm::TypeID const &iType, EDGetToken iToken) const
#define LIKELY(x)
Definition: Likely.h:20
void throwBranchMismatch(BranchType, EDGetToken) const
#define UNLIKELY(x)
Definition: Likely.h:21
unsigned int index() const
Definition: EDGetToken.h:45
void EDConsumerBase::itemsMayGet ( BranchType  iBranch,
std::vector< ProductResolverIndexAndSkipBit > &  oIndices 
) const

Definition at line 315 of file EDConsumerBase.cc.

References KineDebug3::count(), kAlwaysGets, kLookupInfo, m_tokenInfo, and edm::ProductResolverIndexInvalid.

Referenced by updateLookup().

315  {
316  //how many are we adding?
317  unsigned int count = 0;
318  {
319  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
320  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
321  ++it, ++itAlwaysGet) {
322  if (iBranch == it->m_branchType) {
323  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
324  if (not*itAlwaysGet) {
325  ++count;
326  }
327  }
328  }
329  }
330  }
331  oIndices.reserve(oIndices.size() + count);
332  {
333  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
334  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
335  ++it, ++itAlwaysGet) {
336  if (iBranch == it->m_branchType) {
337  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
338  if (not*itAlwaysGet) {
339  oIndices.push_back(it->m_index);
340  }
341  }
342  }
343  }
344  }
345 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
void EDConsumerBase::itemsToGet ( BranchType  iBranch,
std::vector< ProductResolverIndexAndSkipBit > &  oIndices 
) const

Definition at line 283 of file EDConsumerBase.cc.

References KineDebug3::count(), kAlwaysGets, kLookupInfo, m_tokenInfo, and edm::ProductResolverIndexInvalid.

Referenced by updateLookup().

283  {
284  //how many are we adding?
285  unsigned int count = 0;
286  {
287  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
288  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
289  ++it, ++itAlwaysGet) {
290  if (iBranch == it->m_branchType) {
291  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
292  if (*itAlwaysGet) {
293  ++count;
294  }
295  }
296  }
297  }
298  }
299  oIndices.reserve(oIndices.size() + count);
300  {
301  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
302  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
303  ++it, ++itAlwaysGet) {
304  if (iBranch == it->m_branchType) {
305  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
306  if (*itAlwaysGet) {
307  oIndices.push_back(it->m_index);
308  }
309  }
310  }
311  }
312  }
313 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
std::vector<ProductResolverIndexAndSkipBit> const& edm::EDConsumerBase::itemsToGetFrom ( BranchType  iType) const
inline

Definition at line 82 of file EDConsumerBase.h.

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

82  {
83  return itemsToGetFromBranch_[iType];
84  }
std::array< std::vector< ProductResolverIndexAndSkipBit >, edm::NumBranchTypes > itemsToGetFromBranch_
const char * EDConsumerBase::labelFor ( ESTokenIndex  iIndex) const
private

Definition at line 591 of file EDConsumerBase.cc.

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

591  {
592  return m_esTokenInfo.get<kESLookupInfo>(iIndex.value()).m_key.name().value();
593 }
constexpr Value_t value() const noexcept
Definition: ESIndices.h:69
edm::SoATuple< ESTokenLookupInfo, ESProxyIndex > m_esTokenInfo
void EDConsumerBase::labelsForToken ( EDGetToken  iToken,
Labels oLabels 
) const

Definition at line 347 of file EDConsumerBase.cc.

References edm::EDGetToken::index(), kLabels, tablePrinter::labels, m_tokenInfo, m_tokenLabels, edm::ProductLabels::module, edm::ProductLabels::process, edm::ProductLabels::productInstance, and command_line::start.

Referenced by AlCaElectronsTest::analyze(), EnergyScaleAnalyzer::analyze(), EgammaObjects::analyzeElectrons(), EgammaObjects::analyzePhotons(), HLTVertexPerformanceAnalyzer::dqmBeginRun(), HLTBTagPerformanceAnalyzer::dqmBeginRun(), TriggerBxMonitor::dqmBeginRun(), TriggerRatesMonitor::dqmBeginRun(), TrackingNtuple::fillSeeds(), TrackingNtuple::fillTracks(), EcalSimpleUncalibRecHitFilter::filter(), EcalMIPRecHitFilter::filter(), HLTBTagPerformanceAnalyzer::HLTBTagPerformanceAnalyzer(), HLTVertexPerformanceAnalyzer::HLTVertexPerformanceAnalyzer(), edm::PrincipalGetAdapter::labelsForToken(), edm::PrincipalGetAdapter::makeFailToGetException(), MultiTrackValidator::MultiTrackValidator(), HIPixelTrackFilterProducer::produce(), HIProtoTrackFilterProducer::produce(), and edm::PrincipalGetAdapter::throwAmbiguousException().

347  {
348  unsigned int index = iToken.index();
349  auto labels = m_tokenInfo.get<kLabels>(index);
350  unsigned int start = labels.m_startOfModuleLabel;
351  oLabels.module = &(m_tokenLabels[start]);
352  oLabels.productInstance = oLabels.module + labels.m_deltaToProductInstance;
353  oLabels.process = oLabels.module + labels.m_deltaToProcessName;
354 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
Definition: start.py:1
std::vector< char > m_tokenLabels
unsigned int index() const
Definition: EDGetToken.h:45
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT<ProductType> edm::EDConsumerBase::mayConsume ( edm::InputTag const &  tag)
inlineprotected

Definition at line 141 of file EDConsumerBase.h.

References TtFullHadDaughter::B.

141  {
142  TypeToGet tid = TypeToGet::make<ProductType>();
143  return EDGetTokenT<ProductType>{recordConsumes(B, tid, checkIfEmpty(tag), false)};
144  }
unsigned int recordConsumes(BranchType iBranch, TypeToGet const &iType, edm::InputTag const &iTag, bool iAlwaysGets)
static const std::string B
edm::InputTag const & checkIfEmpty(edm::InputTag const &tag)
EDGetToken edm::EDConsumerBase::mayConsume ( const TypeToGet id,
edm::InputTag const &  tag 
)
inlineprotected
template<BranchType B>
EDGetToken edm::EDConsumerBase::mayConsume ( const TypeToGet id,
edm::InputTag const &  tag 
)
inlineprotected

Definition at line 149 of file EDConsumerBase.h.

References TtFullHadDaughter::B.

149  {
150  return EDGetToken{recordConsumes(B, id, checkIfEmpty(tag), false)};
151  }
unsigned int recordConsumes(BranchType iBranch, TypeToGet const &iType, edm::InputTag const &iTag, bool iAlwaysGets)
static const std::string B
edm::InputTag const & checkIfEmpty(edm::InputTag const &tag)
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 458 of file EDConsumerBase.cc.

References edm::ProductResolverIndexHelper::index(), edm::InEvent, kKind, kLabels, kLookupInfo, m_tokenInfo, m_tokenLabels, patRefSel_triggerMatching_cfi::matches, electrons_cff::modules, edm::ProductRegistry::productLookup(), edm::ProductResolverIndexInvalid, and edm::ProductResolverIndexHelper::relatedIndexes().

461  {
462  ProductResolverIndexHelper const& iHelper = *preg.productLookup(InEvent);
463 
464  std::set<std::string> alreadyFound;
465 
466  auto itKind = m_tokenInfo.begin<kKind>();
467  auto itLabels = m_tokenInfo.begin<kLabels>();
468  for (auto itInfo = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); itInfo != itEnd;
469  ++itInfo, ++itKind, ++itLabels) {
470  if (itInfo->m_branchType == InEvent and (not itInfo->m_index.skipCurrentProcess())) {
471  const unsigned int labelStart = itLabels->m_startOfModuleLabel;
472  const char* consumedModuleLabel = &(m_tokenLabels[labelStart]);
473  const char* consumedProcessName = consumedModuleLabel + itLabels->m_deltaToProcessName;
474 
475  if (*consumedModuleLabel != '\0') { // not a consumesMany
476  if (*consumedProcessName != '\0') { // process name is specified in consumes call
477  if (processName == consumedProcessName &&
478  iHelper.index(*itKind,
479  itInfo->m_type,
480  consumedModuleLabel,
481  consumedModuleLabel + itLabels->m_deltaToProductInstance,
482  consumedModuleLabel + itLabels->m_deltaToProcessName) != ProductResolverIndexInvalid) {
483  insertFoundModuleLabel(consumedModuleLabel, modules, alreadyFound, labelsToDesc, preg);
484  }
485  } else { // process name was empty
486  auto matches = iHelper.relatedIndexes(
487  *itKind, itInfo->m_type, consumedModuleLabel, consumedModuleLabel + itLabels->m_deltaToProductInstance);
488  for (unsigned int j = 0; j < matches.numberOfMatches(); ++j) {
489  if (processName == matches.processName(j)) {
490  insertFoundModuleLabel(consumedModuleLabel, modules, alreadyFound, labelsToDesc, preg);
491  }
492  }
493  }
494  // consumesMany case
495  } else if (itInfo->m_index.productResolverIndex() == ProductResolverIndexInvalid) {
496  auto matches = iHelper.relatedIndexes(*itKind, itInfo->m_type);
497  for (unsigned int j = 0; j < matches.numberOfMatches(); ++j) {
498  if (processName == matches.processName(j)) {
499  insertFoundModuleLabel(matches.moduleLabel(j), modules, alreadyFound, labelsToDesc, preg);
500  }
501  }
502  }
503  }
504  }
505 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
Matches relatedIndexes(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance) const
std::vector< char > m_tokenLabels
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
EDConsumerBase const& edm::EDConsumerBase::operator= ( EDConsumerBase const &  )
delete
EDConsumerBase& edm::EDConsumerBase::operator= ( EDConsumerBase &&  )
default
unsigned int EDConsumerBase::recordConsumes ( BranchType  iBranch,
TypeToGet const &  iType,
edm::InputTag const &  iTag,
bool  iAlwaysGets 
)
private

Definition at line 85 of file EDConsumerBase.cc.

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

88  {
89  if (frozen_) {
90  throwConsumesCallAfterFrozen(iType, iTag);
91  }
92 
93  unsigned int index = m_tokenInfo.size();
94 
95  bool skipCurrentProcess = iTag.willSkipCurrentProcess();
96 
97  const size_t labelSize = iTag.label().size();
98  const size_t productInstanceSize = iTag.instance().size();
99  unsigned int labelStart = m_tokenLabels.size();
100  unsigned short delta1 = labelSize + 1;
101  unsigned short delta2 = labelSize + 2 + productInstanceSize;
102  m_tokenInfo.emplace_back(TokenLookupInfo{iType.type(), ProductResolverIndexInvalid, skipCurrentProcess, iBranch},
103  iAlwaysGets,
104  LabelPlacement{labelStart, delta1, delta2},
105  iType.kind());
106 
107  const size_t additionalSize = skipCurrentProcess ? labelSize + productInstanceSize + 3
108  : labelSize + productInstanceSize + iTag.process().size() + 3;
109 
110  m_tokenLabels.reserve(m_tokenLabels.size() + additionalSize);
111  {
112  const std::string& m = iTag.label();
113  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
114  m_tokenLabels.push_back('\0');
115  }
116  {
117  const std::string& m = iTag.instance();
118  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
119  m_tokenLabels.push_back('\0');
120  }
121  {
122  const std::string& m = iTag.process();
123  if (m == InputTag::kCurrentProcess) {
125  }
126  if (!skipCurrentProcess) {
127  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
128  m_tokenLabels.push_back('\0');
129  } else {
130  m_tokenLabels.push_back('\0');
131  }
132  }
133  return index;
134 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
void throwConsumesCallAfterFrozen(TypeToGet const &, InputTag const &) const
static const std::string kCurrentProcess
Definition: InputTag.h:54
std::vector< char > m_tokenLabels
ESTokenIndex EDConsumerBase::recordESConsumes ( Transition  iTrans,
eventsetup::EventSetupRecordKey const &  iRecord,
eventsetup::heterocontainer::HCTypeTag const &  iDataType,
edm::ESInputTag const &  iTag 
)
private

Definition at line 230 of file EDConsumerBase.cc.

References edm::ESInputTag::data(), esItemsToGetFromTransition_, funct::m, m_esTokenInfo, m_tokenLabels, edm::ESInputTag::module(), findQualityFiles::size, and AlCaHLTBitMon_QueryRunRegistry::string.

233  {
234  //m_tokenLabels first entry is a null. Since most ES data requests have
235  // empty labels we will assume we can reuse the first entry
236  unsigned int startOfComponentName = 0;
237  if (not iTag.module().empty()) {
238  startOfComponentName = m_tokenLabels.size();
239 
240  m_tokenLabels.reserve(m_tokenLabels.size() + iTag.module().size() + 1);
241  {
242  const std::string& m = iTag.module();
243  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
244  m_tokenLabels.push_back('\0');
245  }
246  }
247 
248  auto index = static_cast<ESProxyIndex::Value_t>(m_esTokenInfo.size());
249  m_esTokenInfo.emplace_back(
250  ESTokenLookupInfo{iRecord, eventsetup::DataKey{iDataType, iTag.data().c_str()}, startOfComponentName},
251  ESProxyIndex{-1});
252  auto indexForToken = esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)].size();
253  esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)].push_back(ESProxyIndex{-1 * (index + 1)});
254  return ESTokenIndex{static_cast<ESTokenIndex::Value_t>(indexForToken)};
255 }
size
Write out results.
std::array< std::vector< ESProxyIndex >, static_cast< unsigned int >edm::Transition::NumberOfTransitions)> esItemsToGetFromTransition_
std::vector< char > m_tokenLabels
edm::SoATuple< ESTokenLookupInfo, ESProxyIndex > m_esTokenInfo
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 356 of file EDConsumerBase.cc.

References kLookupInfo, and m_tokenInfo.

Referenced by edm::Principal::findProductByLabel().

358  {
359  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd; ++it) {
360  if (it->m_index.productResolverIndex() == iIndex and it->m_index.skipCurrentProcess() == skipCurrentProcess and
361  it->m_branchType == iBranch) {
362  return true;
363  }
364  }
365  return false;
366 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
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 368 of file EDConsumerBase.cc.

References kLookupInfo, m_tokenInfo, and edm::ProductResolverIndexInvalid.

Referenced by edm::Principal::getManyByType().

368  {
369  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd; ++it) {
370  //consumesMany entries do not have their index resolved
371  if (it->m_index.productResolverIndex() == ProductResolverIndexInvalid and it->m_type == iType and
372  it->m_branchType == iBranch) {
373  return true;
374  }
375  }
376  return false;
377 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
void EDConsumerBase::throwBadToken ( edm::TypeID const &  iType,
EDGetToken  iToken 
) const
private

Definition at line 392 of file EDConsumerBase.cc.

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

Referenced by indexFrom().

392  {
393  if (iToken.isUninitialized()) {
394  throw cms::Exception("BadToken") << "A get using a EDGetToken with the C++ type '" << iType.className()
395  << "' was made using an uninitialized token.\n Please check that the variable is "
396  "being initialized from a 'consumes' call.";
397  }
398  throw cms::Exception("BadToken")
399  << "A get using a EDGetToken with the C++ type '" << iType.className() << "' was made using a token with a value "
400  << iToken.index()
401  << " which is beyond the range used by this module.\n Please check that the variable is being initialized from a "
402  "'consumes' call from this module.\n You can not share EDGetToken values between modules.";
403 }
bool isUninitialized() const
Definition: EDGetToken.h:46
unsigned int index() const
Definition: EDGetToken.h:45
void EDConsumerBase::throwBranchMismatch ( BranchType  iBranch,
EDGetToken  iToken 
) const
private

Definition at line 385 of file EDConsumerBase.cc.

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

Referenced by indexFrom().

385  {
386  throw cms::Exception("BranchTypeMismatch")
387  << "A get using a EDGetToken was done in " << BranchTypeToString(iBranch) << " but the consumes call was for "
388  << BranchTypeToString(m_tokenInfo.get<kLookupInfo>(iToken.index()).m_branchType)
389  << ".\n Please modify the consumes call to use the correct branch type.";
390 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
std::string const & BranchTypeToString(BranchType const &branchType)
Definition: BranchType.cc:100
unsigned int index() const
Definition: EDGetToken.h:45
void EDConsumerBase::throwConsumesCallAfterFrozen ( TypeToGet const &  typeToGet,
InputTag const &  inputTag 
) const
private

Definition at line 405 of file EDConsumerBase.cc.

References edm::ProductRegistry::aliasToOriginal(), Exception, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, AlCaHLTBitMon_QueryRunRegistry::string, edmPickEvents::target, and edm::TypeToGet::type().

Referenced by recordConsumes().

405  {
406  throw cms::Exception("LogicError") << "A module declared it consumes a product after its constructor.\n"
407  << "This must be done in the contructor\n"
408  << "The product type was: " << typeToGet.type() << "\n"
409  << "and " << inputTag << "\n";
410 }
void EDConsumerBase::throwTypeMismatch ( edm::TypeID const &  iType,
EDGetToken  iToken 
) const
private

Definition at line 379 of file EDConsumerBase.cc.

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

Referenced by indexFrom().

379  {
380  throw cms::Exception("TypeMismatch") << "A get using a EDGetToken used the C++ type '" << iType.className()
381  << "' but the consumes call was for type '"
382  << m_tokenInfo.get<kLookupInfo>(iToken.index()).m_type.className()
383  << "'.\n Please modify either the consumes or get call so the types match.";
384 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
unsigned int index() const
Definition: EDGetToken.h:45
ProductResolverIndexAndSkipBit EDConsumerBase::uncheckedIndexFrom ( EDGetToken  iToken) const
void EDConsumerBase::updateLookup ( BranchType  iBranchType,
ProductResolverIndexHelper const &  iHelper,
bool  iPrefetchMayGet 
)

Definition at line 136 of file EDConsumerBase.cc.

References containsCurrentProcessAlias_, frozen_, mps_fire::i, edm::ProductResolverIndexHelper::index(), info(), itemsMayGet(), itemsToGet(), itemsToGetFromBranch_, kAlwaysGets, callgraph::kind, kKind, kLabels, kLookupInfo, tablePrinter::labels, m_tokenInfo, m_tokenLabels, patRefSel_triggerMatching_cfi::matches, edm::ProductResolverIndexInvalid, and edm::ProductResolverIndexHelper::relatedIndexes().

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

138  {
139  frozen_ = true;
141  {
142  auto itKind = m_tokenInfo.begin<kKind>();
143  auto itLabels = m_tokenInfo.begin<kLabels>();
144  for (auto itInfo = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); itInfo != itEnd;
145  ++itInfo, ++itKind, ++itLabels) {
146  if (itInfo->m_branchType == iBranchType) {
147  const unsigned int labelStart = itLabels->m_startOfModuleLabel;
148  const char* moduleLabel = &(m_tokenLabels[labelStart]);
149  itInfo->m_index = ProductResolverIndexAndSkipBit(iHelper.index(*itKind,
150  itInfo->m_type,
151  moduleLabel,
152  moduleLabel + itLabels->m_deltaToProductInstance,
153  moduleLabel + itLabels->m_deltaToProcessName),
154  itInfo->m_index.skipCurrentProcess());
155  }
156  }
157  }
158 
159  //now add resolved requests to get many to the end of our list
160  // a get many will have an empty module label
161  for (size_t i = 0, iEnd = m_tokenInfo.size(); i != iEnd; ++i) {
162  //need to copy since pointer could be invalidated by emplace_back
163  auto const info = m_tokenInfo.get<kLookupInfo>(i);
164  if (info.m_branchType == iBranchType && info.m_index.productResolverIndex() == ProductResolverIndexInvalid &&
165  m_tokenLabels[m_tokenInfo.get<kLabels>(i).m_startOfModuleLabel] == '\0') {
166  //find all matching types
167  const auto kind = m_tokenInfo.get<kKind>(i);
168  auto matches = iHelper.relatedIndexes(kind, info.m_type);
169 
170  //NOTE: This could be changed to contain the true labels for what is being
171  // requested but for now I want to remember these are part of a get many
172  const LabelPlacement labels = m_tokenInfo.get<kLabels>(i);
173  bool alwaysGet = m_tokenInfo.get<kAlwaysGets>(i);
174  for (unsigned int j = 0; j != matches.numberOfMatches(); ++j) {
175  //only keep the ones that are for a specific data item and not a collection
176  if (matches.isFullyResolved(j)) {
177  auto index = matches.index(j);
178  m_tokenInfo.emplace_back(
179  TokenLookupInfo{info.m_type, index, info.m_index.skipCurrentProcess(), info.m_branchType},
180  alwaysGet,
181  labels,
182  kind);
183  }
184  }
185  }
186  }
187  m_tokenInfo.shrink_to_fit();
188 
189  itemsToGet(iBranchType, itemsToGetFromBranch_[iBranchType]);
190  if (iPrefetchMayGet) {
191  itemsMayGet(iBranchType, itemsToGetFromBranch_[iBranchType]);
192  }
193 }
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
static const TGPicture * info(bool iBackgroundIsBlack)
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
std::vector< char > m_tokenLabels
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
std::array< std::vector< ProductResolverIndexAndSkipBit >, edm::NumBranchTypes > itemsToGetFromBranch_
void EDConsumerBase::updateLookup ( eventsetup::ESRecordsToProxyIndices const &  iPI)

Definition at line 195 of file EDConsumerBase.cc.

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

195  {
196  unsigned int index = 0;
197  for (auto it = m_esTokenInfo.begin<kESLookupInfo>(); it != m_esTokenInfo.end<kESLookupInfo>(); ++it, ++index) {
198  auto indexInRecord = iPI.indexInRecord(it->m_record, it->m_key);
200  const char* componentName = &(m_tokenLabels[it->m_startOfComponentName]);
201  if (*componentName) {
202  auto component = iPI.component(it->m_record, it->m_key);
203  if (component->label_.empty()) {
204  if (component->type_ != componentName) {
206  }
207  } else if (component->label_ != componentName) {
209  }
210  }
211  }
212  m_esTokenInfo.get<kESProxyIndex>(index) = indexInRecord;
213 
214  int negIndex = -1 * (index + 1);
215  for (auto& items : esItemsToGetFromTransition_) {
216  for (auto& itemIndex : items) {
217  if (itemIndex.value() == negIndex) {
218  itemIndex = indexInRecord;
219  negIndex = 1;
220  break;
221  }
222  }
223  if (negIndex > 0) {
224  break;
225  }
226  }
227  }
228 }
std::array< std::vector< ESProxyIndex >, static_cast< unsigned int >edm::Transition::NumberOfTransitions)> esItemsToGetFromTransition_
static constexpr ESProxyIndex missingProxyIndex() noexcept
std::vector< char > m_tokenLabels
edm::SoATuple< ESTokenLookupInfo, ESProxyIndex > m_esTokenInfo

Friends And Related Function Documentation

friend class ConsumesCollector
friend

Definition at line 119 of file EDConsumerBase.h.

template<typename T >
friend class WillGetIfMatch
friend

Definition at line 121 of file EDConsumerBase.h.

Member Data Documentation

bool edm::EDConsumerBase::containsCurrentProcessAlias_
private

Definition at line 251 of file EDConsumerBase.h.

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

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

Definition at line 249 of file EDConsumerBase.h.

Referenced by recordESConsumes(), and updateLookup().

bool edm::EDConsumerBase::frozen_
private

Definition at line 250 of file EDConsumerBase.h.

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

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

Definition at line 229 of file EDConsumerBase.h.

Referenced by updateLookup().

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

Definition at line 247 of file EDConsumerBase.h.

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

edm::SoATuple<TokenLookupInfo, bool, LabelPlacement, edm::KindOfType> edm::EDConsumerBase::m_tokenInfo
private
std::vector<char> edm::EDConsumerBase::m_tokenLabels
private