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