81 if (iTag.
label().empty()) {
98 const size_t labelSize = iTag.
label().size();
99 const size_t productInstanceSize = iTag.
instance().size();
101 unsigned short delta1 = labelSize+1;
102 unsigned short delta2 = labelSize+2+productInstanceSize;
108 const size_t additionalSize =
110 labelSize+productInstanceSize+3 :
111 labelSize+productInstanceSize+iTag.
process().size()+3;
125 if (!skipCurrentProcess) {
139 bool iPrefetchMayGet)
146 itInfo != itEnd; ++itInfo,++itKind,++itLabels) {
147 if(itInfo->m_branchType == iBranchType) {
148 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
153 moduleLabel+itLabels->m_deltaToProductInstance,
154 moduleLabel+itLabels->m_deltaToProcessName),
155 itInfo->m_index.skipCurrentProcess());
165 if(
info.m_branchType == iBranchType &&
176 for(
unsigned int j=0;j!=matches.numberOfMatches();++j) {
178 if(matches.isFullyResolved(j)) {
179 auto index =matches.index(j);
191 if(iPrefetchMayGet) {
222 unsigned int count=0;
227 it != itEnd; ++it,++itAlwaysGet) {
228 if(iBranch==it->m_branchType) {
237 oIndices.reserve(oIndices.size()+
count);
242 it != itEnd; ++it,++itAlwaysGet) {
243 if(iBranch==it->m_branchType) {
246 oIndices.push_back(it->m_index);
258 unsigned int count=0;
263 it != itEnd; ++it,++itAlwaysGet) {
264 if(iBranch==it->m_branchType) {
266 if(not *itAlwaysGet) {
273 oIndices.reserve(oIndices.size()+
count);
278 it != itEnd; ++it,++itAlwaysGet) {
279 if(iBranch==it->m_branchType) {
281 if(not *itAlwaysGet) {
282 oIndices.push_back(it->m_index);
307 if(it->m_index.productResolverIndex() == iIndex and
308 it->m_index.skipCurrentProcess() == skipCurrentProcess and
309 it->m_branchType == iBranch) {
332 it->m_type == iType and
333 it->m_branchType == iBranch) {
352 throw cms::Exception(
"TypeMismatch")<<
"A get using a EDGetToken used the C++ type '"<<iType.
className()<<
"' but the consumes call was for type '"<<
m_tokenInfo.get<
kLookupInfo>(iToken.
index()).m_type.className()<<
"'.\n Please modify either the consumes or get call so the types match.";
363 throw cms::Exception(
"BadToken")<<
"A get using a EDGetToken with the C++ type '"<<iType.
className()<<
"' was made using an uninitialized token.\n Please check that the variable is being initialized from a 'consumes' call.";
365 throw cms::Exception(
"BadToken")<<
"A get using a EDGetToken with the C++ type '"<<iType.
className()<<
"' was made using a token with a value "<<iToken.
index()<<
" which is beyond the range used by this module.\n Please check that the variable is being initialized from a 'consumes' call from this module.\n You can not share EDGetToken values between modules.";
370 throw cms::Exception(
"LogicError") <<
"A module declared it consumes a product after its constructor.\n" 371 <<
"This must be done in the contructor\n" 372 <<
"The product type was: " << typeToGet.
type() <<
"\n" 373 <<
"and " << inputTag <<
"\n";
377 struct CharStarComp {
378 bool operator()(
const char* iLHS,
const char* iRHS)
const {
379 return strcmp(iLHS,iRHS) < 0;
386 insertFoundModuleLabel(
const char* consumedModuleLabel,
387 std::vector<ModuleDescription const*>&
modules,
388 std::set<std::string>& alreadyFound,
389 std::map<std::string, ModuleDescription const*>
const& labelsToDesc,
393 auto it = labelsToDesc.find(consumedModuleLabel);
394 if(it != labelsToDesc.end()) {
395 if(alreadyFound.insert(consumedModuleLabel).second) {
396 modules.push_back(it->second);
401 std::vector<std::pair<std::string, std::string> >
const& aliasToOriginal = preg.
aliasToOriginal();
403 auto iter = std::lower_bound(aliasToOriginal.begin(), aliasToOriginal.end(),
target);
404 if(iter != aliasToOriginal.end() && iter->first == consumedModuleLabel) {
406 std::string const& originalModuleLabel = iter->second;
407 auto iter2 = labelsToDesc.find(originalModuleLabel);
408 if(iter2 != labelsToDesc.end()) {
409 if(alreadyFound.insert(originalModuleLabel).second) {
410 modules.push_back(iter2->second);
420 <<
"Couldn't find ModuleDescription for the consumed module label: " 429 std::map<std::string, ModuleDescription const*>
const& labelsToDesc,
434 std::set<std::string> alreadyFound;
439 itInfo != itEnd; ++itInfo,++itKind,++itLabels) {
441 if(itInfo->m_branchType ==
InEvent and
442 (not itInfo->m_index.skipCurrentProcess())) {
444 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
445 const char* consumedModuleLabel = &(
m_tokenLabels[labelStart]);
446 const char* consumedProcessName = consumedModuleLabel+itLabels->m_deltaToProcessName;
448 if(*consumedModuleLabel !=
'\0') {
449 if(*consumedProcessName !=
'\0') {
450 if (processName == consumedProcessName &&
451 iHelper.
index(*itKind,
454 consumedModuleLabel+itLabels->m_deltaToProductInstance,
456 insertFoundModuleLabel(consumedModuleLabel, modules, alreadyFound, labelsToDesc, preg);
462 consumedModuleLabel+itLabels->m_deltaToProductInstance);
463 for(
unsigned int j = 0; j <
matches.numberOfMatches(); ++j) {
464 if(processName ==
matches.processName(j)) {
465 insertFoundModuleLabel(consumedModuleLabel, modules, alreadyFound, labelsToDesc, preg);
473 for(
unsigned int j = 0; j <
matches.numberOfMatches(); ++j) {
474 if(processName ==
matches.processName(j)) {
475 insertFoundModuleLabel(
matches.moduleLabel(j),
modules, alreadyFound, labelsToDesc, preg);
483 std::vector<ConsumesInfo>
490 std::set<edm::TypeID> alreadySeenTypes;
492 std::vector<ConsumesInfo>
result;
497 itInfo != itEnd; ++itInfo,++itKind,++itLabels, ++itAlways) {
499 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
500 const char* consumedModuleLabel = &(
m_tokenLabels[labelStart]);
501 const char* consumedInstance = consumedModuleLabel+itLabels->m_deltaToProductInstance;
502 const char* consumedProcessName = consumedModuleLabel+itLabels->m_deltaToProcessName;
505 if(*consumedModuleLabel ==
'\0') {
506 if(!alreadySeenTypes.insert(itInfo->m_type).second) {
512 result.emplace_back(itInfo->m_type,
516 itInfo->m_branchType,
519 itInfo->m_index.skipCurrentProcess());
std::vector< ConsumesInfo > consumesInfo() const
unsigned int ProductResolverIndex
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
void throwTypeMismatch(edm::TypeID const &, EDGetToken) const
void throwBadToken(edm::TypeID const &iType, EDGetToken iToken) const
void throwConsumesCallAfterFrozen(TypeToGet const &, InputTag const &) const
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
void modulesWhoseProductsAreConsumed(std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
unsigned int recordConsumes(BranchType iBranch, TypeToGet const &iType, edm::InputTag const &iTag, bool iAlwaysGets)
ProductResolverIndexAndSkipBit indexFrom(EDGetToken, BranchType, TypeID const &) const
bool registeredToConsume(ProductResolverIndex, bool, BranchType) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Matches relatedIndexes(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance) const
void throwBranchMismatch(BranchType, EDGetToken) const
bool isUninitialized() const
std::vector< char > m_tokenLabels
edm::InputTag const & checkIfEmpty(edm::InputTag const &tag)
static const edm::InputTag kWasEmpty("@EmptyLabel@")
std::vector< std::pair< std::string, std::string > > const & aliasToOriginal() const
bool registeredToConsumeMany(TypeID const &, BranchType) const
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
std::string const & BranchTypeToString(BranchType const &branchType)
std::shared_ptr< ProductResolverIndexHelper const > productLookup(BranchType branchType) const
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
char const * productInstance
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=0) const
TypeID const & type() const
std::string const & className() const
virtual ~EDConsumerBase() noexcept(false)
unsigned int index() const
std::array< std::vector< ProductResolverIndexAndSkipBit >, edm::NumBranchTypes > itemsToGetFromBranch_