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) {
232 unsigned int count=0;
237 it != itEnd; ++it,++itAlwaysGet) {
238 if(iBranch==it->m_branchType) {
247 oIndices.reserve(oIndices.size()+
count);
252 it != itEnd; ++it,++itAlwaysGet) {
253 if(iBranch==it->m_branchType) {
256 oIndices.push_back(it->m_index);
268 unsigned int count=0;
273 it != itEnd; ++it,++itAlwaysGet) {
274 if(iBranch==it->m_branchType) {
276 if(not *itAlwaysGet) {
283 oIndices.reserve(oIndices.size()+
count);
288 it != itEnd; ++it,++itAlwaysGet) {
289 if(iBranch==it->m_branchType) {
291 if(not *itAlwaysGet) {
292 oIndices.push_back(it->m_index);
317 if(it->m_index.productResolverIndex() == iIndex and
318 it->m_index.skipCurrentProcess() == skipCurrentProcess and
319 it->m_branchType == iBranch) {
334 it->m_type == iType and
335 it->m_branchType == iBranch) {
347 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.";
358 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.";
360 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.";
365 throw cms::Exception(
"LogicError") <<
"A module declared it consumes a product after its constructor.\n" 366 <<
"This must be done in the contructor\n" 367 <<
"The product type was: " << typeToGet.
type() <<
"\n" 368 <<
"and " << inputTag <<
"\n";
372 struct CharStarComp {
373 bool operator()(
const char* iLHS,
const char* iRHS)
const {
374 return strcmp(iLHS,iRHS) < 0;
381 insertFoundModuleLabel(
const char* consumedModuleLabel,
382 std::vector<ModuleDescription const*>&
modules,
383 std::set<std::string>& alreadyFound,
384 std::map<std::string, ModuleDescription const*>
const& labelsToDesc,
388 auto it = labelsToDesc.find(consumedModuleLabel);
389 if(it != labelsToDesc.end()) {
390 if(alreadyFound.insert(consumedModuleLabel).second) {
391 modules.push_back(it->second);
396 std::vector<std::pair<std::string, std::string> >
const& aliasToOriginal = preg.
aliasToOriginal();
398 auto iter = std::lower_bound(aliasToOriginal.begin(), aliasToOriginal.end(),
target);
399 if(iter != aliasToOriginal.end() && iter->first == consumedModuleLabel) {
401 std::string const& originalModuleLabel = iter->second;
402 auto iter2 = labelsToDesc.find(originalModuleLabel);
403 if(iter2 != labelsToDesc.end()) {
404 if(alreadyFound.insert(originalModuleLabel).second) {
405 modules.push_back(iter2->second);
415 <<
"Couldn't find ModuleDescription for the consumed module label: " 424 std::map<std::string, ModuleDescription const*>
const& labelsToDesc,
429 std::set<std::string> alreadyFound;
434 itInfo != itEnd; ++itInfo,++itKind,++itLabels) {
436 if(itInfo->m_branchType ==
InEvent and
437 (not itInfo->m_index.skipCurrentProcess())) {
439 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
440 const char* consumedModuleLabel = &(
m_tokenLabels[labelStart]);
441 const char* consumedProcessName = consumedModuleLabel+itLabels->m_deltaToProcessName;
443 if(*consumedModuleLabel !=
'\0') {
444 if(*consumedProcessName !=
'\0') {
445 if (processName == consumedProcessName &&
446 iHelper.
index(*itKind,
449 consumedModuleLabel+itLabels->m_deltaToProductInstance,
451 insertFoundModuleLabel(consumedModuleLabel, modules, alreadyFound, labelsToDesc, preg);
457 consumedModuleLabel+itLabels->m_deltaToProductInstance);
458 for(
unsigned int j = 0; j <
matches.numberOfMatches(); ++j) {
459 if(processName ==
matches.processName(j)) {
460 insertFoundModuleLabel(consumedModuleLabel, modules, alreadyFound, labelsToDesc, preg);
468 for(
unsigned int j = 0; j <
matches.numberOfMatches(); ++j) {
469 if(processName ==
matches.processName(j)) {
470 insertFoundModuleLabel(
matches.moduleLabel(j),
modules, alreadyFound, labelsToDesc, preg);
486 std::vector<char> newTokenLabels;
492 iter != itEnd; ++iter) {
493 newProcessName = &
m_tokenLabels[iter->m_startOfModuleLabel + iter->m_deltaToProcessName];
497 newSize += (iter->m_deltaToProcessName + newProcessName.size() + 1);
499 newTokenLabels.reserve(newSize);
501 unsigned int newStartOfModuleLabel = 0;
503 iter != itEnd; ++iter) {
505 unsigned int startOfModuleLabel = iter->m_startOfModuleLabel;
506 unsigned short deltaToProcessName = iter->m_deltaToProcessName;
508 iter->m_startOfModuleLabel = newStartOfModuleLabel;
510 newProcessName = &
m_tokenLabels[startOfModuleLabel + deltaToProcessName];
515 newStartOfModuleLabel += (deltaToProcessName + newProcessName.size() + 1);
518 newTokenLabels.insert(newTokenLabels.end(),
520 m_tokenLabels.begin() + (startOfModuleLabel + deltaToProcessName));
522 newTokenLabels.insert(newTokenLabels.end(), newProcessName.begin(), newProcessName.end());
523 newTokenLabels.push_back(
'\0');
529 std::vector<ConsumesInfo>
536 std::set<edm::TypeID> alreadySeenTypes;
538 std::vector<ConsumesInfo>
result;
543 itInfo != itEnd; ++itInfo,++itKind,++itLabels, ++itAlways) {
545 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
546 const char* consumedModuleLabel = &(
m_tokenLabels[labelStart]);
547 const char* consumedInstance = consumedModuleLabel+itLabels->m_deltaToProductInstance;
548 const char* consumedProcessName = consumedModuleLabel+itLabels->m_deltaToProcessName;
551 if(*consumedModuleLabel ==
'\0') {
552 if(!alreadySeenTypes.insert(itInfo->m_type).second) {
558 result.emplace_back(itInfo->m_type,
562 itInfo->m_branchType,
565 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 uncheckedIndexFrom(EDGetToken) const
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
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
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
std::array< std::vector< ProductResolverIndexAndSkipBit >, edm::NumBranchTypes > itemsToGetFromBranch_