CMS 3D CMS Logo

EDConsumerBase.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWCore/Framework
4 // Class : EDConsumerBase
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author: Chris Jones
10 // Created: Tue, 02 Apr 2013 21:36:06 GMT
11 //
12 
13 // system include files
14 #include <algorithm>
15 #include <cassert>
16 #include <cstring>
17 #include <set>
18 #include <utility>
19 
20 // user include files
31 
32 using namespace edm;
33 
34 namespace {
35  std::vector<char> makeEmptyTokenLabels() { return std::vector<char>{'\0'}; }
36 } // namespace
37 
39  : m_tokenLabels{makeEmptyTokenLabels()}, frozen_(false), containsCurrentProcessAlias_(false) {}
40 
42 
43 //
44 // member functions
45 //
47  ConsumesCollector c{this};
48  return c;
49 }
50 
51 static const edm::InputTag kWasEmpty("@EmptyLabel@");
52 
54  if (iTag.label().empty()) {
55  return kWasEmpty;
56  }
57  return iTag;
58 }
59 
61  TypeToGet const& iType,
62  edm::InputTag const& iTag,
63  bool iAlwaysGets) {
64  if (frozen_) {
65  throwConsumesCallAfterFrozen(iType, iTag);
66  }
67 
68  unsigned int index = m_tokenInfo.size();
69 
70  bool skipCurrentProcess = iTag.willSkipCurrentProcess();
71 
72  const size_t labelSize = iTag.label().size();
73  const size_t productInstanceSize = iTag.instance().size();
74  unsigned int labelStart = m_tokenLabels.size();
75  unsigned short delta1 = labelSize + 1;
76  unsigned short delta2 = labelSize + 2 + productInstanceSize;
77  m_tokenInfo.emplace_back(TokenLookupInfo{iType.type(), ProductResolverIndexInvalid, skipCurrentProcess, iBranch},
78  iAlwaysGets,
79  LabelPlacement{labelStart, delta1, delta2},
80  iType.kind());
81 
82  const size_t additionalSize = skipCurrentProcess ? labelSize + productInstanceSize + 3
83  : labelSize + productInstanceSize + iTag.process().size() + 3;
84 
85  m_tokenLabels.reserve(m_tokenLabels.size() + additionalSize);
86  {
87  const std::string& m = iTag.label();
88  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
89  m_tokenLabels.push_back('\0');
90  }
91  {
92  const std::string& m = iTag.instance();
93  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
94  m_tokenLabels.push_back('\0');
95  }
96  {
97  const std::string& m = iTag.process();
100  }
101  if (!skipCurrentProcess) {
102  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
103  m_tokenLabels.push_back('\0');
104  } else {
105  m_tokenLabels.push_back('\0');
106  }
107  }
108  return index;
109 }
110 
112  ProductResolverIndexHelper const& iHelper,
113  bool iPrefetchMayGet) {
114  frozen_ = true;
116  {
117  auto itKind = m_tokenInfo.begin<kKind>();
118  auto itLabels = m_tokenInfo.begin<kLabels>();
119  for (auto itInfo = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); itInfo != itEnd;
120  ++itInfo, ++itKind, ++itLabels) {
121  if (itInfo->m_branchType == iBranchType) {
122  const unsigned int labelStart = itLabels->m_startOfModuleLabel;
123  const char* moduleLabel = &(m_tokenLabels[labelStart]);
124  itInfo->m_index = ProductResolverIndexAndSkipBit(iHelper.index(*itKind,
125  itInfo->m_type,
126  moduleLabel,
127  moduleLabel + itLabels->m_deltaToProductInstance,
128  moduleLabel + itLabels->m_deltaToProcessName),
129  itInfo->m_index.skipCurrentProcess());
130  }
131  }
132  }
133 
134  //now add resolved requests to get many to the end of our list
135  // a get many will have an empty module label
136  for (size_t i = 0, iEnd = m_tokenInfo.size(); i != iEnd; ++i) {
137  //need to copy since pointer could be invalidated by emplace_back
138  auto const info = m_tokenInfo.get<kLookupInfo>(i);
139  if (info.m_branchType == iBranchType && info.m_index.productResolverIndex() == ProductResolverIndexInvalid &&
140  m_tokenLabels[m_tokenInfo.get<kLabels>(i).m_startOfModuleLabel] == '\0') {
141  //find all matching types
142  const auto kind = m_tokenInfo.get<kKind>(i);
143  auto matches = iHelper.relatedIndexes(kind, info.m_type);
144 
145  //NOTE: This could be changed to contain the true labels for what is being
146  // requested but for now I want to remember these are part of a get many
147  const LabelPlacement labels = m_tokenInfo.get<kLabels>(i);
148  bool alwaysGet = m_tokenInfo.get<kAlwaysGets>(i);
149  for (unsigned int j = 0; j != matches.numberOfMatches(); ++j) {
150  //only keep the ones that are for a specific data item and not a collection
151  if (matches.isFullyResolved(j)) {
152  auto index = matches.index(j);
153  m_tokenInfo.emplace_back(
154  TokenLookupInfo{info.m_type, index, info.m_index.skipCurrentProcess(), info.m_branchType},
155  alwaysGet,
156  labels,
157  kind);
158  }
159  }
160  }
161  }
162  m_tokenInfo.shrink_to_fit();
163 
164  itemsToGet(iBranchType, itemsToGetFromBranch_[iBranchType]);
165  if (iPrefetchMayGet) {
166  itemsMayGet(iBranchType, itemsToGetFromBranch_[iBranchType]);
167  }
168 }
169 
171  // temporarily unfreeze to allow late EventSetup consumes registration
172  frozen_ = false;
174  frozen_ = true;
175 
176  unsigned int index = 0;
177  for (auto it = m_esTokenInfo.begin<kESLookupInfo>(); it != m_esTokenInfo.end<kESLookupInfo>(); ++it, ++index) {
178  auto indexInRecord = iPI.indexInRecord(it->m_record, it->m_key);
180  const char* componentName = &(m_tokenLabels[it->m_startOfComponentName]);
181  if (*componentName) {
182  auto component = iPI.component(it->m_record, it->m_key);
183  if (component->label_.empty()) {
184  if (component->type_ != componentName) {
186  }
187  } else if (component->label_ != componentName) {
189  }
190  }
191  }
192  m_esTokenInfo.get<kESProxyIndex>(index) = indexInRecord;
193 
194  int negIndex = -1 * (index + 1);
195  for (auto& items : esItemsToGetFromTransition_) {
196  for (auto& itemIndex : items) {
197  if (itemIndex.value() == negIndex) {
198  itemIndex = indexInRecord;
199  esRecordsToGetFromTransition_[&items - &esItemsToGetFromTransition_.front()][&itemIndex - &items.front()] =
200  iPI.recordIndexFor(it->m_record);
201  negIndex = 1;
202  break;
203  }
204  }
205  if (negIndex > 0) {
206  break;
207  }
208  }
209  }
210 }
211 
213  eventsetup::EventSetupRecordKey const& iRecord,
215  edm::ESInputTag const& iTag) {
216  if (frozen_) {
217  throwESConsumesCallAfterFrozen(iRecord, iDataType, iTag);
218  }
219 
220  //m_tokenLabels first entry is a null. Since most ES data requests have
221  // empty labels we will assume we can reuse the first entry
222  unsigned int startOfComponentName = 0;
223  if (not iTag.module().empty()) {
224  startOfComponentName = m_tokenLabels.size();
225 
226  m_tokenLabels.reserve(m_tokenLabels.size() + iTag.module().size() + 1);
227  {
228  const std::string& m = iTag.module();
229  m_tokenLabels.insert(m_tokenLabels.end(), m.begin(), m.end());
230  m_tokenLabels.push_back('\0');
231  }
232  }
233 
234  auto index = static_cast<ESProxyIndex::Value_t>(m_esTokenInfo.size());
235  m_esTokenInfo.emplace_back(
236  ESTokenLookupInfo{iRecord, eventsetup::DataKey{iDataType, iTag.data().c_str()}, startOfComponentName},
237  ESProxyIndex{-1});
240  }
241  auto indexForToken = esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)].size();
242  esItemsToGetFromTransition_[static_cast<unsigned int>(iTrans)].emplace_back(-1 * (index + 1));
243  esRecordsToGetFromTransition_[static_cast<unsigned int>(iTrans)].emplace_back();
244  return ESTokenIndex{static_cast<ESTokenIndex::Value_t>(indexForToken)};
245 }
246 
247 //
248 // const member functions
249 //
251  BranchType iBranch,
252  TypeID const& iType) const {
253  if (UNLIKELY(iToken.index() >= m_tokenInfo.size())) {
254  throwBadToken(iType, iToken);
255  }
256  const auto& info = m_tokenInfo.get<kLookupInfo>(iToken.index());
257  if (LIKELY(iBranch == info.m_branchType)) {
258  if (LIKELY(iType == info.m_type)) {
259  return info.m_index;
260  } else {
261  throwTypeMismatch(iType, iToken);
262  }
263  } else {
264  throwBranchMismatch(iBranch, iToken);
265  }
267 }
268 
270  return m_tokenInfo.get<kLookupInfo>(iToken.index()).m_index;
271 }
272 
273 void EDConsumerBase::itemsToGet(BranchType iBranch, std::vector<ProductResolverIndexAndSkipBit>& oIndices) const {
274  //how many are we adding?
275  unsigned int count = 0;
276  {
277  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
278  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
279  ++it, ++itAlwaysGet) {
280  if (iBranch == it->m_branchType) {
281  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
282  if (*itAlwaysGet) {
283  ++count;
284  }
285  }
286  }
287  }
288  }
289  oIndices.reserve(oIndices.size() + count);
290  {
291  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
292  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
293  ++it, ++itAlwaysGet) {
294  if (iBranch == it->m_branchType) {
295  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
296  if (*itAlwaysGet) {
297  oIndices.push_back(it->m_index);
298  }
299  }
300  }
301  }
302  }
303 }
304 
305 void EDConsumerBase::itemsMayGet(BranchType iBranch, std::vector<ProductResolverIndexAndSkipBit>& oIndices) const {
306  //how many are we adding?
307  unsigned int count = 0;
308  {
309  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
310  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
311  ++it, ++itAlwaysGet) {
312  if (iBranch == it->m_branchType) {
313  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
314  if (not *itAlwaysGet) {
315  ++count;
316  }
317  }
318  }
319  }
320  }
321  oIndices.reserve(oIndices.size() + count);
322  {
323  auto itAlwaysGet = m_tokenInfo.begin<kAlwaysGets>();
324  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd;
325  ++it, ++itAlwaysGet) {
326  if (iBranch == it->m_branchType) {
327  if (it->m_index.productResolverIndex() != ProductResolverIndexInvalid) {
328  if (not *itAlwaysGet) {
329  oIndices.push_back(it->m_index);
330  }
331  }
332  }
333  }
334  }
335 }
336 
337 void EDConsumerBase::labelsForToken(EDGetToken iToken, Labels& oLabels) const {
338  unsigned int index = iToken.index();
339  auto labels = m_tokenInfo.get<kLabels>(index);
340  unsigned int start = labels.m_startOfModuleLabel;
341  oLabels.module = &(m_tokenLabels[start]);
342  oLabels.productInstance = oLabels.module + labels.m_deltaToProductInstance;
343  oLabels.process = oLabels.module + labels.m_deltaToProcessName;
344 }
345 
347  bool skipCurrentProcess,
348  BranchType iBranch) const {
349  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd; ++it) {
350  if (it->m_index.productResolverIndex() == iIndex and it->m_index.skipCurrentProcess() == skipCurrentProcess and
351  it->m_branchType == iBranch) {
352  return true;
353  }
354  }
355  return false;
356 }
357 
358 bool EDConsumerBase::registeredToConsumeMany(TypeID const& iType, BranchType iBranch) const {
359  for (auto it = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); it != itEnd; ++it) {
360  //consumesMany entries do not have their index resolved
361  if (it->m_index.productResolverIndex() == ProductResolverIndexInvalid and it->m_type == iType and
362  it->m_branchType == iBranch) {
363  return true;
364  }
365  }
366  return false;
367 }
368 
369 void EDConsumerBase::throwTypeMismatch(edm::TypeID const& iType, EDGetToken iToken) const {
370  throw cms::Exception("TypeMismatch") << "A get using a EDGetToken used the C++ type '" << iType.className()
371  << "' but the consumes call was for type '"
372  << m_tokenInfo.get<kLookupInfo>(iToken.index()).m_type.className()
373  << "'.\n Please modify either the consumes or get call so the types match.";
374 }
376  throw cms::Exception("BranchTypeMismatch")
377  << "A get using a EDGetToken was done in " << BranchTypeToString(iBranch) << " but the consumes call was for "
378  << BranchTypeToString(m_tokenInfo.get<kLookupInfo>(iToken.index()).m_branchType)
379  << ".\n Please modify the consumes call to use the correct branch type.";
380 }
381 
382 void EDConsumerBase::throwBadToken(edm::TypeID const& iType, EDGetToken iToken) const {
383  if (iToken.isUninitialized()) {
384  throw cms::Exception("BadToken") << "A get using a EDGetToken with the C++ type '" << iType.className()
385  << "' was made using an uninitialized token.\n Please check that the variable is "
386  "being initialized from a 'consumes' call.";
387  }
388  throw cms::Exception("BadToken")
389  << "A get using a EDGetToken with the C++ type '" << iType.className() << "' was made using a token with a value "
390  << iToken.index()
391  << " which is beyond the range used by this module.\n Please check that the variable is being initialized from a "
392  "'consumes' call from this module.\n You can not share EDGetToken values between modules.";
393 }
394 
396  throw cms::Exception("LogicError") << "A module declared it consumes a product after its constructor.\n"
397  << "This must be done in the contructor\n"
398  << "The product type was: " << typeToGet.type() << "\n"
399  << "and " << inputTag << "\n";
400 }
401 
404  edm::ESInputTag const& iTag) const {
405  throw cms::Exception("LogicError") << "A module declared it consumes an EventSetup product after its constructor.\n"
406  << "This must be done in the contructor\n"
407  << "The product type was: " << iDataType.name() << " in record "
408  << iRecord.type().name() << "\n"
409  << "and ESInputTag was " << iTag << "\n";
410 }
411 
413  throw cms::Exception("LogicError")
414  << "A module declared it consumes an EventSetup product during a ProcessBlock transition.\n"
415  << "EventSetup products can only be consumed in Event, Lumi, or Run transitions.\n";
416 }
417 
418 namespace {
419  struct CharStarComp {
420  bool operator()(const char* iLHS, const char* iRHS) const { return strcmp(iLHS, iRHS) < 0; }
421  };
422 } // namespace
423 
424 namespace {
425  void insertFoundModuleLabel(edm::KindOfType consumedTypeKind,
426  edm::TypeID consumedType,
427  const char* consumedModuleLabel,
428  const char* consumedProductInstance,
429  std::vector<ModuleDescription const*>& modules,
430  std::set<std::string>& alreadyFound,
431  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
432  ProductRegistry const& preg) {
433  // Convert from label string to module description, eliminate duplicates,
434  // then insert into the vector of modules
435  if (auto it = labelsToDesc.find(consumedModuleLabel); it != labelsToDesc.end()) {
436  if (alreadyFound.insert(consumedModuleLabel).second) {
437  modules.push_back(it->second);
438  }
439  return;
440  }
441  // Deal with EDAlias's by converting to the original module label first
442  if (auto aliasToModuleLabels =
443  preg.aliasToModules(consumedTypeKind, consumedType, consumedModuleLabel, consumedProductInstance);
444  not aliasToModuleLabels.empty()) {
445  bool foundInLabelsToDesc = false;
446  for (auto const& label : aliasToModuleLabels) {
447  if (auto it = labelsToDesc.find(label); it != labelsToDesc.end()) {
448  if (alreadyFound.insert(label).second) {
449  modules.push_back(it->second);
450  }
451  foundInLabelsToDesc = true;
452  }
453  }
454  if (foundInLabelsToDesc) {
455  return;
456  }
457  }
458  // Ignore the source products, we are only interested in module products.
459  // As far as I know, it should never be anything else so throw if something
460  // unknown gets passed in.
461  if (std::string_view(consumedModuleLabel) != "source") {
462  throw cms::Exception("EDConsumerBase", "insertFoundModuleLabel")
463  << "Couldn't find ModuleDescription for the consumed product type: '" << consumedType.className()
464  << "' module label: '" << consumedModuleLabel << "' product instance name: '" << consumedProductInstance
465  << "'";
466  }
467  }
468 } // namespace
469 
470 void EDConsumerBase::modulesWhoseProductsAreConsumed(std::vector<ModuleDescription const*>& modules,
471  ProductRegistry const& preg,
472  std::map<std::string, ModuleDescription const*> const& labelsToDesc,
473  std::string const& processName) const {
474  ProductResolverIndexHelper const& iHelper = *preg.productLookup(InEvent);
475 
476  std::set<std::string> alreadyFound;
477 
478  auto itKind = m_tokenInfo.begin<kKind>();
479  auto itLabels = m_tokenInfo.begin<kLabels>();
480  for (auto itInfo = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); itInfo != itEnd;
481  ++itInfo, ++itKind, ++itLabels) {
482  if (itInfo->m_branchType == InEvent and (not itInfo->m_index.skipCurrentProcess())) {
483  const unsigned int labelStart = itLabels->m_startOfModuleLabel;
484  const char* const consumedModuleLabel = &(m_tokenLabels[labelStart]);
485  const char* const consumedProductInstance = consumedModuleLabel + itLabels->m_deltaToProductInstance;
486  const char* const consumedProcessName = consumedModuleLabel + itLabels->m_deltaToProcessName;
487 
488  if (*consumedModuleLabel != '\0') { // not a consumesMany
489  if (*consumedProcessName != '\0') { // process name is specified in consumes call
490  if (processName == consumedProcessName &&
491  iHelper.index(
492  *itKind, itInfo->m_type, consumedModuleLabel, consumedProductInstance, consumedProcessName) !=
494  insertFoundModuleLabel(*itKind,
495  itInfo->m_type,
496  consumedModuleLabel,
497  consumedProductInstance,
498  modules,
499  alreadyFound,
500  labelsToDesc,
501  preg);
502  }
503  } else { // process name was empty
504  auto matches = iHelper.relatedIndexes(*itKind, itInfo->m_type, consumedModuleLabel, consumedProductInstance);
505  for (unsigned int j = 0; j < matches.numberOfMatches(); ++j) {
506  if (processName == matches.processName(j)) {
507  insertFoundModuleLabel(*itKind,
508  itInfo->m_type,
509  consumedModuleLabel,
510  consumedProductInstance,
511  modules,
512  alreadyFound,
513  labelsToDesc,
514  preg);
515  }
516  }
517  }
518  // consumesMany case
519  } else if (itInfo->m_index.productResolverIndex() == ProductResolverIndexInvalid) {
520  auto matches = iHelper.relatedIndexes(*itKind, itInfo->m_type);
521  for (unsigned int j = 0; j < matches.numberOfMatches(); ++j) {
522  if (processName == matches.processName(j)) {
523  insertFoundModuleLabel(*itKind,
524  itInfo->m_type,
525  matches.moduleLabel(j),
526  matches.productInstanceName(j),
527  modules,
528  alreadyFound,
529  labelsToDesc,
530  preg);
531  }
532  }
533  }
534  }
535  }
536 }
537 
539  frozen_ = true;
540 
543 
544  auto newTokenLabels = makeEmptyTokenLabels();
545 
546  // first calculate the size of the new vector and reserve memory for it
547  std::vector<char>::size_type newSize = newTokenLabels.size();
548  std::string newProcessName;
549  for (auto iter = m_tokenInfo.begin<kLabels>(), itEnd = m_tokenInfo.end<kLabels>(); iter != itEnd; ++iter) {
550  newProcessName = &m_tokenLabels[iter->m_startOfModuleLabel + iter->m_deltaToProcessName];
551  if (newProcessName == InputTag::kCurrentProcess) {
552  newProcessName = processName;
553  }
554  newSize += (iter->m_deltaToProcessName + newProcessName.size() + 1);
555  }
556  newTokenLabels.reserve(newSize);
557 
558  unsigned int newStartOfModuleLabel = newTokenLabels.size();
559  for (auto iter = m_tokenInfo.begin<kLabels>(), itEnd = m_tokenInfo.end<kLabels>(); iter != itEnd; ++iter) {
560  unsigned int startOfModuleLabel = iter->m_startOfModuleLabel;
561  unsigned short deltaToProcessName = iter->m_deltaToProcessName;
562 
563  iter->m_startOfModuleLabel = newStartOfModuleLabel;
564 
565  newProcessName = &m_tokenLabels[startOfModuleLabel + deltaToProcessName];
566  if (newProcessName == InputTag::kCurrentProcess) {
567  newProcessName = processName;
568  }
569 
570  newStartOfModuleLabel += (deltaToProcessName + newProcessName.size() + 1);
571 
572  // Copy in both the module label and instance, they are the same
573  newTokenLabels.insert(newTokenLabels.end(),
574  m_tokenLabels.begin() + startOfModuleLabel,
575  m_tokenLabels.begin() + (startOfModuleLabel + deltaToProcessName));
576 
577  newTokenLabels.insert(newTokenLabels.end(), newProcessName.begin(), newProcessName.end());
578  newTokenLabels.push_back('\0');
579  }
580  m_tokenLabels = std::move(newTokenLabels);
581  }
582 }
583 
584 std::vector<ConsumesInfo> EDConsumerBase::consumesInfo() const {
585  // Use this to eliminate duplicate entries related
586  // to consumesMany items where only the type was specified
587  // and the there are multiple matches. In these cases the
588  // label, instance, and process will be empty.
589  std::set<edm::TypeID> alreadySeenTypes;
590 
591  std::vector<ConsumesInfo> result;
592  auto itAlways = m_tokenInfo.begin<kAlwaysGets>();
593  auto itKind = m_tokenInfo.begin<kKind>();
594  auto itLabels = m_tokenInfo.begin<kLabels>();
595  for (auto itInfo = m_tokenInfo.begin<kLookupInfo>(), itEnd = m_tokenInfo.end<kLookupInfo>(); itInfo != itEnd;
596  ++itInfo, ++itKind, ++itLabels, ++itAlways) {
597  const unsigned int labelStart = itLabels->m_startOfModuleLabel;
598  const char* consumedModuleLabel = &(m_tokenLabels[labelStart]);
599  const char* consumedInstance = consumedModuleLabel + itLabels->m_deltaToProductInstance;
600  const char* consumedProcessName = consumedModuleLabel + itLabels->m_deltaToProcessName;
601 
602  // consumesMany case
603  if (*consumedModuleLabel == '\0') {
604  if (!alreadySeenTypes.insert(itInfo->m_type).second) {
605  continue;
606  }
607  }
608 
609  // Just copy the information into the ConsumesInfo data structure
610  result.emplace_back(itInfo->m_type,
611  consumedModuleLabel,
612  consumedInstance,
613  consumedProcessName,
614  itInfo->m_branchType,
615  *itKind,
616  *itAlways,
617  itInfo->m_index.skipCurrentProcess());
618  }
619  return result;
620 }
621 
622 const char* EDConsumerBase::labelFor(ESTokenIndex iIndex) const {
623  return m_esTokenInfo.get<kESLookupInfo>(iIndex.value()).m_key.name().value();
624 }
edm::EDConsumerBase::throwESConsumesCallAfterFrozen
void throwESConsumesCallAfterFrozen(eventsetup::EventSetupRecordKey const &, eventsetup::heterocontainer::HCTypeTag const &, edm::ESInputTag const &) const
Definition: EDConsumerBase.cc:402
Likely.h
edm::EDGetToken::index
constexpr unsigned int index() const noexcept
Definition: EDGetToken.h:50
SummaryClient_cfi.labels
labels
Definition: SummaryClient_cfi.py:61
edm::InputTag::kCurrentProcess
static const std::string kCurrentProcess
Definition: InputTag.h:54
edm::ESTokenIndex
Definition: ESIndices.h:55
ProductResolverIndexHelper.h
edm::EDConsumerBase::modulesWhoseProductsAreConsumed
void modulesWhoseProductsAreConsumed(std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
Definition: EDConsumerBase.cc:470
edm::ProductResolverIndex
unsigned int ProductResolverIndex
Definition: ProductResolverIndex.h:8
mps_fire.i
i
Definition: mps_fire.py:428
edm::ESInputTag
Definition: ESInputTag.h:87
start
Definition: start.py:1
LogMessageMonitor_cff.modules
modules
Definition: LogMessageMonitor_cff.py:7
MessageLogger.h
edm::eventsetup::ESRecordsToProxyIndices
Definition: ESRecordsToProxyIndices.h:35
funct::false
false
Definition: Factorize.h:29
edm::EDConsumerBase::esRecordsToGetFromTransition_
std::array< std::vector< ESRecordIndex >, static_cast< unsigned int >edm::Transition::NumberOfEventSetupTransitions)> esRecordsToGetFromTransition_
Definition: EDConsumerBase.h:306
edm::EDConsumerBase::registeredToConsumeMany
bool registeredToConsumeMany(TypeID const &, BranchType) const
Definition: EDConsumerBase.cc:358
BranchType.h
edm::InputTag::instance
std::string const & instance() const
Definition: InputTag.h:37
edm::EDConsumerBase::recordConsumes
unsigned int recordConsumes(BranchType iBranch, TypeToGet const &iType, edm::InputTag const &iTag, bool iAlwaysGets)
Definition: EDConsumerBase.cc:60
edm::EDConsumerBase::ESTokenLookupInfo
Definition: EDConsumerBase.h:286
modules
Definition: ZHLTMatchFilter.cc:17
edm::ProductResolverIndexAndSkipBit
Definition: ProductResolverIndexAndSkipBit.h:28
edm::EDConsumerBase::kAlwaysGets
Definition: EDConsumerBase.h:277
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::ProductLabels::module
char const * module
Definition: ProductLabels.h:5
edm::EDConsumerBase::kESProxyIndex
Definition: EDConsumerBase.h:301
edm::ESInputTag::data
const std::string & data() const
Definition: ESInputTag.h:104
edm::EDConsumerBase::checkIfEmpty
edm::InputTag const & checkIfEmpty(edm::InputTag const &tag)
Definition: EDConsumerBase.cc:53
ComponentDescription.h
edm::EDConsumerBase::m_esTokenInfo
edm::SoATuple< ESTokenLookupInfo, ESProxyIndex > m_esTokenInfo
Definition: EDConsumerBase.h:302
cms::cuda::assert
assert(be >=bs)
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:46
edm::ProductResolverIndexHelper::index
ProductResolverIndex index(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance, char const *process=nullptr) const
Definition: ProductResolverIndexHelper.cc:81
edm::InputTag::process
std::string const & process() const
Definition: InputTag.h:40
edm::eventsetup::DataKey
Definition: DataKey.h:29
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
edm::ProductRegistry::productLookup
std::shared_ptr< ProductResolverIndexHelper const > productLookup(BranchType branchType) const
Definition: ProductRegistry.cc:145
ESRecordsToProxyIndices.h
ProductRegistry.h
edm::ProductResolverIndexHelper::relatedIndexes
Matches relatedIndexes(KindOfType kindOfType, TypeID const &typeID, char const *moduleLabel, char const *instance) const
Definition: ProductResolverIndexHelper.cc:153
edm::ProductResolverIndexHelper
Definition: ProductResolverIndexHelper.h:89
edm::EDConsumerBase::itemsMayGet
void itemsMayGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: EDConsumerBase.cc:305
edm::EDConsumerBase::throwConsumesCallAfterFrozen
void throwConsumesCallAfterFrozen(TypeToGet const &, InputTag const &) const
Definition: EDConsumerBase.cc:395
edm::eventsetup::EventSetupRecordKey
Definition: EventSetupRecordKey.h:30
edm::EDConsumerBase::registeredToConsume
bool registeredToConsume(ProductResolverIndex, bool, BranchType) const
Definition: EDConsumerBase.cc:346
edm::BranchType
BranchType
Definition: BranchType.h:11
edm::ESProxyIndex
Definition: ESIndices.h:30
mps_monitormerge.items
list items
Definition: mps_monitormerge.py:29
edm::EDConsumerBase::m_tokenLabels
std::vector< char > m_tokenLabels
Definition: EDConsumerBase.h:282
edm::ProductLabels::process
char const * process
Definition: ProductLabels.h:7
edm::InputTag::willSkipCurrentProcess
bool willSkipCurrentProcess() const
Definition: InputTag.h:42
edm::EDConsumerBase::consumesInfo
std::vector< ConsumesInfo > consumesInfo() const
Definition: EDConsumerBase.cc:584
edm::ProductRegistry
Definition: ProductRegistry.h:37
edm::InputTag::label
std::string const & label() const
Definition: InputTag.h:36
edm::EDConsumerBase::uncheckedIndexFrom
ProductResolverIndexAndSkipBit uncheckedIndexFrom(EDGetToken) const
Definition: EDConsumerBase.cc:269
UNLIKELY
#define UNLIKELY(x)
Definition: Likely.h:21
kWasEmpty
static const edm::InputTag kWasEmpty("@EmptyLabel@")
edm::EDConsumerBase::kKind
Definition: EDConsumerBase.h:277
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
edm::ESTokenIndex::value
constexpr Value_t value() const noexcept
Definition: ESIndices.h:70
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
edm::EDConsumerBase::itemsToGet
void itemsToGet(BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
Definition: EDConsumerBase.cc:273
edm::InEvent
Definition: BranchType.h:11
edm::EDConsumerBase::kLabels
Definition: EDConsumerBase.h:277
edm::EDConsumerBase::TokenLookupInfo
Definition: EDConsumerBase.h:256
edm::EDConsumerBase::throwESConsumesInProcessBlock
void throwESConsumesInProcessBlock() const
Definition: EDConsumerBase.cc:412
edm::eventsetup::ESRecordsToProxyIndices::missingProxyIndex
static constexpr ESProxyIndex missingProxyIndex() noexcept
Definition: ESRecordsToProxyIndices.h:48
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::EDConsumerBase::m_tokenInfo
edm::SoATuple< TokenLookupInfo, bool, LabelPlacement, edm::KindOfType > m_tokenInfo
Definition: EDConsumerBase.h:278
edm::eventsetup::ESRecordsToProxyIndices::indexInRecord
ESProxyIndex indexInRecord(EventSetupRecordKey const &iRK, DataKey const &iDK) const noexcept
If the index is not found, returns missingProxyIndex()
Definition: ESRecordsToProxyIndices.cc:50
edm::Transition
Transition
Definition: Transition.h:12
EDConsumerBase.h
edm::eventsetup::heterocontainer::HCTypeTag
Definition: HCTypeTag.h:38
edm::EDConsumerBase::throwBadToken
void throwBadToken(edm::TypeID const &iType, EDGetToken iToken) const
Definition: EDConsumerBase.cc:382
edm::eventsetup::EventSetupRecordKey::type
const TypeTag & type() const
Definition: EventSetupRecordKey.h:40
edm::ProductResolverIndexInvalid
Definition: ProductResolverIndex.h:16
edm::eventsetup::heterocontainer::HCTypeTag::name
char const * name() const
Definition: HCTypeTag.h:46
edm::EDConsumerBase::updateLookup
void updateLookup(BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
Definition: EDConsumerBase.cc:111
edm::EDConsumerBase::~EDConsumerBase
virtual ~EDConsumerBase() noexcept(false)
Definition: EDConsumerBase.cc:41
edm::EDConsumerBase::EDConsumerBase
EDConsumerBase()
Definition: EDConsumerBase.cc:38
edm::EDConsumerBase::itemsToGetFromBranch_
std::array< std::vector< ProductResolverIndexAndSkipBit >, edm::NumBranchTypes > itemsToGetFromBranch_
Definition: EDConsumerBase.h:284
edm::EDConsumerBase::kLookupInfo
Definition: EDConsumerBase.h:277
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
edm::EDConsumerBase::containsCurrentProcessAlias_
bool containsCurrentProcessAlias_
Definition: EDConsumerBase.h:308
edm::EDConsumerBase::kESLookupInfo
Definition: EDConsumerBase.h:301
edm::EDGetToken
Definition: EDGetToken.h:35
CalibrationSummaryClient_cfi.kind
kind
Definition: CalibrationSummaryClient_cfi.py:37
edm::TypeToGet::type
TypeID const & type() const
Definition: TypeToGet.h:42
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
edm::TypeID::className
std::string const & className() const
Definition: TypeID.cc:40
edm::EDConsumerBase::labelsForToken
void labelsForToken(EDGetToken iToken, Labels &oLabels) const
Definition: EDConsumerBase.cc:337
edm::ESInputTag::module
const std::string & module() const
Definition: ESInputTag.h:99
edm::ProductLabels::productInstance
char const * productInstance
Definition: ProductLabels.h:6
edm::TypeID
Definition: TypeID.h:22
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::EDGetToken::isUninitialized
constexpr bool isUninitialized() const noexcept
Definition: EDGetToken.h:51
edm::KindOfType
KindOfType
Definition: ProductKindOfType.h:5
edm::EDConsumerBase::frozen_
bool frozen_
Definition: EDConsumerBase.h:307
LIKELY
#define LIKELY(x)
Definition: Likely.h:20
Exception
Definition: hltDiff.cc:246
edm::EDConsumerBase::labelFor
const char * labelFor(ESTokenIndex) const
Definition: EDConsumerBase.cc:622
edm::EDConsumerBase::throwBranchMismatch
void throwBranchMismatch(BranchType, EDGetToken) const
Definition: EDConsumerBase.cc:375
edm::EDConsumerBase::esItemsToGetFromTransition_
std::array< std::vector< ESProxyIndex >, static_cast< unsigned int >edm::Transition::NumberOfEventSetupTransitions)> esItemsToGetFromTransition_
Definition: EDConsumerBase.h:304
edm::ProductRegistry::aliasToModules
std::vector< std::string > aliasToModules(KindOfType kindOfType, TypeID const &type, std::string_view moduleLabel, std::string_view productInstanceName) const
Definition: ProductRegistry.cc:613
Exception.h
patCandidatesForDimuonsSequences_cff.matches
matches
Definition: patCandidatesForDimuonsSequences_cff.py:131
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::eventsetup::ESRecordsToProxyIndices::component
ComponentDescription const * component(EventSetupRecordKey const &iRK, DataKey const &iDK) const noexcept
Definition: ESRecordsToProxyIndices.cc:77
mps_fire.result
result
Definition: mps_fire.py:311
ConsumesCollector.h
command_line.start
start
Definition: command_line.py:167
HerwigMaxPtPartonFilter_cfi.moduleLabel
moduleLabel
Definition: HerwigMaxPtPartonFilter_cfi.py:4
edm::EDConsumerBase::LabelPlacement
Definition: EDConsumerBase.h:264
edm::EDConsumerBase::recordESConsumes
ESTokenIndex recordESConsumes(Transition, eventsetup::EventSetupRecordKey const &, eventsetup::heterocontainer::HCTypeTag const &, edm::ESInputTag const &iTag)
Definition: EDConsumerBase.cc:212
edm::TypeToGet
Definition: TypeToGet.h:32
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::TypeToGet::kind
KindOfType kind() const
Definition: TypeToGet.h:43
SimL1EmulatorRepack_Full_cff.inputTag
inputTag
Definition: SimL1EmulatorRepack_Full_cff.py:56
edm::BranchTypeToString
std::string const & BranchTypeToString(BranchType const &branchType)
Definition: BranchType.cc:91
edm::EDConsumerBase::throwTypeMismatch
void throwTypeMismatch(edm::TypeID const &, EDGetToken) const
Definition: EDConsumerBase.cc:369
edm::InputTag
Definition: InputTag.h:15
edm::eventsetup::ESRecordsToProxyIndices::recordIndexFor
ESRecordIndex recordIndexFor(EventSetupRecordKey const &iRK) const noexcept
Definition: ESRecordsToProxyIndices.cc:69
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
label
const char * label
Definition: PFTauDecayModeTools.cc:11
edm::EDConsumerBase::indexFrom
ProductResolverIndexAndSkipBit indexFrom(EDGetToken, BranchType, TypeID const &) const
Definition: EDConsumerBase.cc:250
edm::ProductLabels
Definition: ProductLabels.h:4
edm::EDConsumerBase::convertCurrentProcessAlias
void convertCurrentProcessAlias(std::string const &processName)
Convert "@currentProcess" in InputTag process names to the actual current process name.
Definition: EDConsumerBase.cc:538
edm::EDConsumerBase::registerLateConsumes
virtual void registerLateConsumes(eventsetup::ESRecordsToProxyIndices const &)
Definition: EDConsumerBase.h:235
edm::Transition::NumberOfEventSetupTransitions