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;
129 if (!skipCurrentProcess) {
142 bool iPrefetchMayGet)
150 itInfo != itEnd; ++itInfo,++itKind,++itLabels) {
151 if(itInfo->m_branchType == iBranchType) {
152 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
157 moduleLabel+itLabels->m_deltaToProductInstance,
158 moduleLabel+itLabels->m_deltaToProcessName),
159 itInfo->m_index.skipCurrentProcess());
169 if(
info.m_branchType == iBranchType &&
180 for(
unsigned int j=0;j!=matches.numberOfMatches();++j) {
182 if(matches.isFullyResolved(j)) {
183 auto index =matches.index(j);
195 if(iPrefetchMayGet) {
226 unsigned int count=0;
231 it != itEnd; ++it,++itAlwaysGet) {
232 if(iBranch==it->m_branchType) {
241 oIndices.reserve(oIndices.size()+
count);
246 it != itEnd; ++it,++itAlwaysGet) {
247 if(iBranch==it->m_branchType) {
250 oIndices.push_back(it->m_index);
262 unsigned int count=0;
267 it != itEnd; ++it,++itAlwaysGet) {
268 if(iBranch==it->m_branchType) {
270 if(not *itAlwaysGet) {
277 oIndices.reserve(oIndices.size()+
count);
282 it != itEnd; ++it,++itAlwaysGet) {
283 if(iBranch==it->m_branchType) {
285 if(not *itAlwaysGet) {
286 oIndices.push_back(it->m_index);
311 if(it->m_index.productResolverIndex() == iIndex and
312 it->m_index.skipCurrentProcess() == skipCurrentProcess and
313 it->m_branchType == iBranch) {
336 it->m_type == iType and
337 it->m_branchType == iBranch) {
356 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.";
367 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.";
369 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.";
374 throw cms::Exception(
"LogicError") <<
"A module declared it consumes a product after its constructor.\n" 375 <<
"This must be done in the contructor\n" 376 <<
"The product type was: " << typeToGet.
type() <<
"\n" 377 <<
"and " << inputTag <<
"\n";
381 struct CharStarComp {
382 bool operator()(
const char* iLHS,
const char* iRHS)
const {
383 return strcmp(iLHS,iRHS) < 0;
390 insertFoundModuleLabel(
const char* consumedModuleLabel,
391 std::vector<ModuleDescription const*>&
modules,
392 std::set<std::string>& alreadyFound,
393 std::map<std::string, ModuleDescription const*>
const& labelsToDesc,
397 auto it = labelsToDesc.find(consumedModuleLabel);
398 if(it != labelsToDesc.end()) {
399 if(alreadyFound.insert(consumedModuleLabel).second) {
400 modules.push_back(it->second);
405 std::vector<std::pair<std::string, std::string> >
const& aliasToOriginal = preg.
aliasToOriginal();
407 auto iter = std::lower_bound(aliasToOriginal.begin(), aliasToOriginal.end(),
target);
408 if(iter != aliasToOriginal.end() && iter->first == consumedModuleLabel) {
410 std::string const& originalModuleLabel = iter->second;
411 auto iter2 = labelsToDesc.find(originalModuleLabel);
412 if(iter2 != labelsToDesc.end()) {
413 if(alreadyFound.insert(originalModuleLabel).second) {
414 modules.push_back(iter2->second);
424 <<
"Couldn't find ModuleDescription for the consumed module label: " 433 std::map<std::string, ModuleDescription const*>
const& labelsToDesc,
438 std::set<std::string> alreadyFound;
443 itInfo != itEnd; ++itInfo,++itKind,++itLabels) {
445 if(itInfo->m_branchType ==
InEvent and
446 (not itInfo->m_index.skipCurrentProcess())) {
448 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
449 const char* consumedModuleLabel = &(
m_tokenLabels[labelStart]);
450 const char* consumedProcessName = consumedModuleLabel+itLabels->m_deltaToProcessName;
452 if(*consumedModuleLabel !=
'\0') {
453 if(*consumedProcessName !=
'\0') {
454 if (processName == consumedProcessName &&
455 iHelper.
index(*itKind,
458 consumedModuleLabel+itLabels->m_deltaToProductInstance,
460 insertFoundModuleLabel(consumedModuleLabel, modules, alreadyFound, labelsToDesc, preg);
466 consumedModuleLabel+itLabels->m_deltaToProductInstance);
467 for(
unsigned int j = 0; j <
matches.numberOfMatches(); ++j) {
468 if(processName ==
matches.processName(j)) {
469 insertFoundModuleLabel(consumedModuleLabel, modules, alreadyFound, labelsToDesc, preg);
477 for(
unsigned int j = 0; j <
matches.numberOfMatches(); ++j) {
478 if(processName ==
matches.processName(j)) {
479 insertFoundModuleLabel(
matches.moduleLabel(j),
modules, alreadyFound, labelsToDesc, preg);
495 std::vector<char> newTokenLabels;
501 iter != itEnd; ++iter) {
502 newProcessName = &
m_tokenLabels[iter->m_startOfModuleLabel + iter->m_deltaToProcessName];
506 newSize += (iter->m_deltaToProcessName + newProcessName.size() + 1);
508 newTokenLabels.reserve(newSize);
510 unsigned int newStartOfModuleLabel = 0;
512 iter != itEnd; ++iter) {
514 unsigned int startOfModuleLabel = iter->m_startOfModuleLabel;
515 unsigned short deltaToProcessName = iter->m_deltaToProcessName;
517 iter->m_startOfModuleLabel = newStartOfModuleLabel;
519 newProcessName = &
m_tokenLabels[startOfModuleLabel + deltaToProcessName];
524 newStartOfModuleLabel += (deltaToProcessName + newProcessName.size() + 1);
527 newTokenLabels.insert(newTokenLabels.end(),
529 m_tokenLabels.begin() + (startOfModuleLabel + deltaToProcessName));
531 newTokenLabels.insert(newTokenLabels.end(), newProcessName.begin(), newProcessName.end());
532 newTokenLabels.push_back(
'\0');
538 std::vector<ConsumesInfo>
545 std::set<edm::TypeID> alreadySeenTypes;
547 std::vector<ConsumesInfo>
result;
552 itInfo != itEnd; ++itInfo,++itKind,++itLabels, ++itAlways) {
554 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
555 const char* consumedModuleLabel = &(
m_tokenLabels[labelStart]);
556 const char* consumedInstance = consumedModuleLabel+itLabels->m_deltaToProductInstance;
557 const char* consumedProcessName = consumedModuleLabel+itLabels->m_deltaToProcessName;
560 if(*consumedModuleLabel ==
'\0') {
561 if(!alreadySeenTypes.insert(itInfo->m_type).second) {
567 result.emplace_back(itInfo->m_type,
571 itInfo->m_branchType,
574 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
bool containsCurrentProcessAlias_
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)
void convertCurrentProcessAlias(std::string const &processName)
Convert "@currentProcess" in InputTag process names to the actual current process name...
unsigned int index() const
std::array< std::vector< ProductResolverIndexAndSkipBit >, edm::NumBranchTypes > itemsToGetFromBranch_