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);
192 if(iPrefetchMayGet) {
224 unsigned int count=0;
229 it != itEnd; ++it,++itAlwaysGet) {
230 if(iBranch==it->m_branchType) {
239 oIndices.reserve(oIndices.size()+
count);
244 it != itEnd; ++it,++itAlwaysGet) {
245 if(iBranch==it->m_branchType) {
248 oIndices.push_back(it->m_index);
260 unsigned int count=0;
265 it != itEnd; ++it,++itAlwaysGet) {
266 if(iBranch==it->m_branchType) {
268 if(not *itAlwaysGet) {
275 oIndices.reserve(oIndices.size()+
count);
280 it != itEnd; ++it,++itAlwaysGet) {
281 if(iBranch==it->m_branchType) {
283 if(not *itAlwaysGet) {
284 oIndices.push_back(it->m_index);
309 if(it->m_index.productResolverIndex() == iIndex and
310 it->m_index.skipCurrentProcess() == skipCurrentProcess and
311 it->m_branchType == iBranch) {
334 it->m_type == iType and
335 it->m_branchType == iBranch) {
354 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.";
365 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.";
367 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.";
372 throw cms::Exception(
"LogicError") <<
"A module declared it consumes a product after its constructor.\n"
373 <<
"This must be done in the contructor\n"
374 <<
"The product type was: " << typeToGet.
type() <<
"\n"
375 <<
"and " << inputTag <<
"\n";
379 struct CharStarComp {
380 bool operator()(
const char* iLHS,
const char* iRHS)
const {
381 return strcmp(iLHS,iRHS) < 0;
388 insertFoundModuleLabel(
const char* consumedModuleLabel,
389 std::vector<ModuleDescription const*>&
modules,
390 std::set<std::string>& alreadyFound,
391 std::map<std::string, ModuleDescription const*>
const& labelsToDesc,
395 auto it = labelsToDesc.find(consumedModuleLabel);
396 if(it != labelsToDesc.end()) {
397 if(alreadyFound.insert(consumedModuleLabel).second) {
398 modules.push_back(it->second);
403 std::vector<std::pair<std::string, std::string> >
const& aliasToOriginal = preg.
aliasToOriginal();
405 auto iter = std::lower_bound(aliasToOriginal.begin(), aliasToOriginal.end(),
target);
406 if(iter != aliasToOriginal.end() && iter->first == consumedModuleLabel) {
408 std::string const& originalModuleLabel = iter->second;
409 auto iter2 = labelsToDesc.find(originalModuleLabel);
410 if(iter2 != labelsToDesc.end()) {
411 if(alreadyFound.insert(originalModuleLabel).second) {
412 modules.push_back(iter2->second);
422 <<
"Couldn't find ModuleDescription for the consumed module label: "
431 std::map<std::string, ModuleDescription const*>
const& labelsToDesc,
436 std::set<std::string> alreadyFound;
441 itInfo != itEnd; ++itInfo,++itKind,++itLabels) {
443 if(itInfo->m_branchType ==
InEvent and
444 (not itInfo->m_index.skipCurrentProcess())) {
446 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
447 const char* consumedModuleLabel = &(
m_tokenLabels[labelStart]);
448 const char* consumedProcessName = consumedModuleLabel+itLabels->m_deltaToProcessName;
450 if(*consumedModuleLabel !=
'\0') {
451 if(*consumedProcessName !=
'\0') {
452 if (processName == consumedProcessName &&
453 iHelper.
index(*itKind,
456 consumedModuleLabel+itLabels->m_deltaToProductInstance,
458 insertFoundModuleLabel(consumedModuleLabel, modules, alreadyFound, labelsToDesc, preg);
464 consumedModuleLabel+itLabels->m_deltaToProductInstance);
465 for(
unsigned int j = 0;
j <
matches.numberOfMatches(); ++
j) {
466 if(processName ==
matches.processName(
j)) {
467 insertFoundModuleLabel(consumedModuleLabel, modules, alreadyFound, labelsToDesc, preg);
475 for(
unsigned int j = 0;
j <
matches.numberOfMatches(); ++
j) {
476 if(processName ==
matches.processName(
j)) {
485 std::vector<ConsumesInfo>
492 std::set<edm::TypeID> alreadySeenTypes;
494 std::vector<ConsumesInfo>
result;
499 itInfo != itEnd; ++itInfo,++itKind,++itLabels, ++itAlways) {
501 const unsigned int labelStart = itLabels->m_startOfModuleLabel;
502 const char* consumedModuleLabel = &(
m_tokenLabels[labelStart]);
503 const char* consumedInstance = consumedModuleLabel+itLabels->m_deltaToProductInstance;
504 const char* consumedProcessName = consumedModuleLabel+itLabels->m_deltaToProcessName;
507 if(*consumedModuleLabel ==
'\0') {
508 if(!alreadySeenTypes.insert(itInfo->m_type).second) {
514 result.emplace_back(itInfo->m_type,
518 itInfo->m_branchType,
521 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
std::vector< ProductResolverIndexAndSkipBit > itemsToGetFromEvent_
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)
volatile std::atomic< bool > shutdown_flag false
unsigned int index() const