CMS 3D CMS Logo

RootFile.cc
Go to the documentation of this file.
1 /*----------------------------------------------------------------------
2 ----------------------------------------------------------------------*/
3 
4 #include "RootFile.h"
5 #include "DuplicateChecker.h"
6 #include "InputFile.h"
7 #include "ProvenanceAdaptor.h"
8 #include "RunHelper.h"
9 
53 
56 
57 //used for backward compatibility
62 
63 #include "Rtypes.h"
64 #include "TClass.h"
65 #include "TString.h"
66 #include "TTree.h"
67 #include "TTreeCache.h"
68 
69 #include <algorithm>
70 #include <cassert>
71 #include <list>
72 
73 namespace edm {
74 
75  // Algorithm classes for making ProvenanceReader:
77  public:
78  std::unique_ptr<ProvenanceReaderBase> makeReader(RootTree& eventTree,
79  DaqProvenanceHelper const* daqProvenanceHelper) const override;
80  };
82  public:
83  MakeOldProvenanceReader(std::unique_ptr<EntryDescriptionMap>&& entryDescriptionMap)
84  : MakeProvenanceReader(), entryDescriptionMap_(std::move(entryDescriptionMap)) {}
85  std::unique_ptr<ProvenanceReaderBase> makeReader(RootTree& eventTree,
86  DaqProvenanceHelper const* daqProvenanceHelper) const override;
87 
88  private:
90  };
92  public:
93  std::unique_ptr<ProvenanceReaderBase> makeReader(RootTree& eventTree,
94  DaqProvenanceHelper const* daqProvenanceHelper) const override;
95  };
97  public:
98  MakeReducedProvenanceReader(std::vector<ParentageID> const& parentageIDLookup)
99  : parentageIDLookup_(parentageIDLookup) {}
100  std::unique_ptr<ProvenanceReaderBase> makeReader(RootTree& eventTree,
101  DaqProvenanceHelper const* daqProvenanceHelper) const override;
102 
103  private:
104  std::vector<ParentageID> const& parentageIDLookup_;
105  };
106 
107  namespace {
108  void checkReleaseVersion(std::vector<ProcessHistory> processHistoryVector, std::string const& fileName) {
109  std::string releaseVersion = getReleaseVersion();
110  releaseversion::DecomposedReleaseVersion currentRelease(releaseVersion);
111  for (auto const& ph : processHistoryVector) {
112  for (auto const& pc : ph) {
113  if (releaseversion::isEarlierRelease(currentRelease, pc.releaseVersion())) {
115  << "The release you are using, " << getReleaseVersion() << " , predates\n"
116  << "a release (" << pc.releaseVersion() << ") used in writing the input file, " << fileName << ".\n"
117  << "Forward compatibility cannot be supported.\n";
118  }
119  }
120  }
121  }
122  } // namespace
123 
124  // This is a helper class for IndexIntoFile.
126  public:
127  explicit RootFileEventFinder(RootTree& eventTree) : eventTree_(eventTree) {}
128  ~RootFileEventFinder() override {}
129 
133  EventAuxiliary eventAux;
134  EventAuxiliary* pEvAux = &eventAux;
136  eventTree_.setEntryNumber(saveEntry);
137  return eventAux.event();
138  }
139 
140  private:
142  };
143 
144  //---------------------------------------------------------------------
146  ProcessConfiguration const& processConfiguration,
147  std::string const& logicalFileName,
148  std::shared_ptr<InputFile> filePtr,
149  std::shared_ptr<EventSkipperByID> eventSkipperByID,
150  bool skipAnyEvents,
151  int remainingEvents,
152  int remainingLumis,
153  unsigned int nStreams,
154  unsigned int treeCacheSize,
155  int treeMaxVirtualSize,
157  RunHelperBase* runHelper,
158  bool noEventSort,
159  ProductSelectorRules const& productSelectorRules,
160  InputType inputType,
161  std::shared_ptr<BranchIDListHelper> branchIDListHelper,
162  ProcessBlockHelper* processBlockHelper,
163  std::shared_ptr<ThinnedAssociationsHelper> thinnedAssociationsHelper,
164  std::vector<BranchID> const* associationsFromSecondary,
165  std::shared_ptr<DuplicateChecker> duplicateChecker,
166  bool dropDescendants,
167  ProcessHistoryRegistry& processHistoryRegistry,
168  std::vector<std::shared_ptr<IndexIntoFile>> const& indexesIntoFiles,
169  std::vector<std::shared_ptr<IndexIntoFile>>::size_type currentIndexIntoFile,
170  std::vector<ProcessHistoryID>& orderedProcessHistoryIDs,
171  bool bypassVersionCheck,
172  bool labelRawDataLikeMC,
173  bool usingGoToEvent,
174  bool enablePrefetching,
175  bool enforceGUIDInFileName)
176  : file_(fileName),
177  logicalFile_(logicalFileName),
178  processConfiguration_(processConfiguration),
179  processHistoryRegistry_(&processHistoryRegistry),
180  filePtr_(filePtr),
181  eventSkipperByID_(eventSkipperByID),
182  fileFormatVersion_(),
183  fid_(),
184  indexIntoFileSharedPtr_(new IndexIntoFile),
185  indexIntoFile_(*indexIntoFileSharedPtr_),
186  orderedProcessHistoryIDs_(orderedProcessHistoryIDs),
187  indexIntoFileBegin_(
188  indexIntoFile_.begin(noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder)),
189  indexIntoFileEnd_(indexIntoFileBegin_),
190  indexIntoFileIter_(indexIntoFileBegin_),
191  storedMergeableRunProductMetadata_((inputType == InputType::Primary) ? new StoredMergeableRunProductMetadata
192  : nullptr),
193  eventProcessHistoryIDs_(),
194  eventProcessHistoryIter_(eventProcessHistoryIDs_.begin()),
195  savedRunAuxiliary_(),
196  skipAnyEvents_(skipAnyEvents),
197  noEventSort_(noEventSort),
198  enforceGUIDInFileName_(enforceGUIDInFileName),
199  whyNotFastClonable_(0),
200  hasNewlyDroppedBranch_(),
201  branchListIndexesUnchanged_(false),
202  eventAuxCache_(),
203  eventTree_(filePtr,
204  InEvent,
205  nStreams,
206  treeMaxVirtualSize,
207  treeCacheSize,
208  roottree::defaultLearningEntries,
209  enablePrefetching,
210  inputType),
211  lumiTree_(filePtr,
212  InLumi,
213  1,
214  treeMaxVirtualSize,
215  roottree::defaultNonEventCacheSize,
217  enablePrefetching,
218  inputType),
219  runTree_(filePtr,
220  InRun,
221  1,
222  treeMaxVirtualSize,
223  roottree::defaultNonEventCacheSize,
225  enablePrefetching,
226  inputType),
227  treePointers_(),
228  lastEventEntryNumberRead_(IndexIntoFile::invalidEntry),
229  productRegistry_(),
230  branchIDLists_(),
231  branchIDListHelper_(branchIDListHelper),
232  processBlockHelper_(processBlockHelper),
233  fileThinnedAssociationsHelper_(),
234  thinnedAssociationsHelper_(thinnedAssociationsHelper),
235  processingMode_(processingMode),
236  runHelper_(runHelper),
237  newBranchToOldBranch_(),
238  eventHistoryTree_(nullptr),
239  eventToProcessBlockIndexesBranch_(
240  inputType == InputType::Primary
241  ? eventTree_.tree()->GetBranch(poolNames::eventToProcessBlockIndexesBranchName().c_str())
242  : nullptr),
243  history_(),
244  branchChildren_(new BranchChildren),
245  duplicateChecker_(duplicateChecker),
246  provenanceAdaptor_(),
247  provenanceReaderMaker_(),
248  eventProductProvenanceRetrievers_(),
249  parentageIDLookup_(),
250  daqProvenanceHelper_(),
251  edProductClass_(TypeWithDict::byName("edm::WrapperBase").getClass()),
252  inputType_(inputType) {
253  hasNewlyDroppedBranch_.fill(false);
254 
255  treePointers_.resize(3);
259 
260  // Read the metadata tree.
261  // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
262  std::unique_ptr<TTree> metaDataTree(dynamic_cast<TTree*>(filePtr_->Get(poolNames::metaDataTreeName().c_str())));
263  if (nullptr == metaDataTree.get()) {
265  << "Could not find tree " << poolNames::metaDataTreeName() << " in the input file.\n";
266  }
267 
268  // To keep things simple, we just read in every possible branch that exists.
269  // We don't pay attention to which branches exist in which file format versions
270 
272  if (metaDataTree->FindBranch(poolNames::fileFormatVersionBranchName().c_str()) != nullptr) {
273  TBranch* fft = metaDataTree->GetBranch(poolNames::fileFormatVersionBranchName().c_str());
274  fft->SetAddress(&fftPtr);
275  roottree::getEntry(fft, 0);
276  metaDataTree->SetBranchAddress(poolNames::fileFormatVersionBranchName().c_str(), &fftPtr);
277  }
278 
279  FileID* fidPtr = &fid_;
280  if (metaDataTree->FindBranch(poolNames::fileIdentifierBranchName().c_str()) != nullptr) {
281  metaDataTree->SetBranchAddress(poolNames::fileIdentifierBranchName().c_str(), &fidPtr);
282  }
283 
284  IndexIntoFile* iifPtr = &indexIntoFile_;
285  if (metaDataTree->FindBranch(poolNames::indexIntoFileBranchName().c_str()) != nullptr) {
286  metaDataTree->SetBranchAddress(poolNames::indexIntoFileBranchName().c_str(), &iifPtr);
287  }
288 
289  storedProcessBlockHelper_ = std::make_unique<StoredProcessBlockHelper>();
290  StoredProcessBlockHelper& storedProcessBlockHelper = *storedProcessBlockHelper_;
291  StoredProcessBlockHelper* pStoredProcessBlockHelper = storedProcessBlockHelper_.get();
292  if (inputType == InputType::Primary) {
293  if (metaDataTree->FindBranch(poolNames::processBlockHelperBranchName().c_str()) != nullptr) {
294  metaDataTree->SetBranchAddress(poolNames::processBlockHelperBranchName().c_str(), &pStoredProcessBlockHelper);
295  }
296  }
297 
298  StoredMergeableRunProductMetadata* smrc = nullptr;
299  if (inputType == InputType::Primary) {
301  if (metaDataTree->FindBranch(poolNames::mergeableRunProductMetadataBranchName().c_str()) != nullptr) {
302  metaDataTree->SetBranchAddress(poolNames::mergeableRunProductMetadataBranchName().c_str(), &smrc);
303  }
304  }
305 
306  // Need to read to a temporary registry so we can do a translation of the BranchKeys.
307  // This preserves backward compatibility against friendly class name algorithm changes.
308  ProductRegistry inputProdDescReg;
309  ProductRegistry* ppReg = &inputProdDescReg;
310  metaDataTree->SetBranchAddress(poolNames::productDescriptionBranchName().c_str(), (&ppReg));
311 
312  using PsetMap = std::map<ParameterSetID, ParameterSetBlob>;
313  PsetMap psetMap;
314  PsetMap* psetMapPtr = &psetMap;
315  if (metaDataTree->FindBranch(poolNames::parameterSetMapBranchName().c_str()) != nullptr) {
316  //backward compatibility
317  assert(!fileFormatVersion().parameterSetsTree());
318  metaDataTree->SetBranchAddress(poolNames::parameterSetMapBranchName().c_str(), &psetMapPtr);
319  } else {
320  assert(fileFormatVersion().parameterSetsTree());
321  // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
322  std::unique_ptr<TTree> psetTree(dynamic_cast<TTree*>(filePtr_->Get(poolNames::parameterSetsTreeName().c_str())));
323  if (nullptr == psetTree.get()) {
325  << "Could not find tree " << poolNames::parameterSetsTreeName() << " in the input file.\n";
326  }
327 
328  using IdToBlobs = std::pair<ParameterSetID, ParameterSetBlob>;
329  IdToBlobs idToBlob;
330  IdToBlobs* pIdToBlob = &idToBlob;
331  psetTree->SetBranchAddress(poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
332 
333  std::unique_ptr<TTreeCache> psetTreeCache =
335  psetTreeCache->SetEnablePrefetching(false);
336  filePtr_->SetCacheRead(psetTreeCache.get());
337  for (Long64_t i = 0; i != psetTree->GetEntries(); ++i) {
338  psetTree->GetEntry(i);
339  psetMap.insert(idToBlob);
340  }
341  filePtr_->SetCacheRead(nullptr);
342  }
343 
344  // backward compatibility
346  ProcessHistoryRegistry::collection_type* pHistMapPtr = &pHistMap;
347  if (metaDataTree->FindBranch(poolNames::processHistoryMapBranchName().c_str()) != nullptr) {
348  metaDataTree->SetBranchAddress(poolNames::processHistoryMapBranchName().c_str(), &pHistMapPtr);
349  }
350 
352  ProcessHistoryRegistry::vector_type* pHistVectorPtr = &pHistVector;
353  if (metaDataTree->FindBranch(poolNames::processHistoryBranchName().c_str()) != nullptr) {
354  metaDataTree->SetBranchAddress(poolNames::processHistoryBranchName().c_str(), &pHistVectorPtr);
355  }
356 
357  // backward compatibility
358  ProcessConfigurationVector processConfigurations;
359  ProcessConfigurationVector* procConfigVectorPtr = &processConfigurations;
360  if (metaDataTree->FindBranch(poolNames::processConfigurationBranchName().c_str()) != nullptr) {
361  metaDataTree->SetBranchAddress(poolNames::processConfigurationBranchName().c_str(), &procConfigVectorPtr);
362  }
363 
364  auto branchIDListsAPtr = std::make_unique<BranchIDLists>();
365  BranchIDLists* branchIDListsPtr = branchIDListsAPtr.get();
366  if (metaDataTree->FindBranch(poolNames::branchIDListBranchName().c_str()) != nullptr) {
367  metaDataTree->SetBranchAddress(poolNames::branchIDListBranchName().c_str(), &branchIDListsPtr);
368  }
369 
370  if (inputType != InputType::SecondarySource) {
372  std::make_unique<ThinnedAssociationsHelper>(); // propagate_const<T> has no reset() function
373  ThinnedAssociationsHelper* thinnedAssociationsHelperPtr = fileThinnedAssociationsHelper_.get();
374  if (metaDataTree->FindBranch(poolNames::thinnedAssociationsHelperBranchName().c_str()) != nullptr) {
375  metaDataTree->SetBranchAddress(poolNames::thinnedAssociationsHelperBranchName().c_str(),
376  &thinnedAssociationsHelperPtr);
377  }
378  }
379 
380  BranchChildren* branchChildrenBuffer = branchChildren_.get();
381  if (metaDataTree->FindBranch(poolNames::productDependenciesBranchName().c_str()) != nullptr) {
382  metaDataTree->SetBranchAddress(poolNames::productDependenciesBranchName().c_str(), &branchChildrenBuffer);
383  }
384 
385  // backward compatibility
386  std::vector<EventProcessHistoryID>* eventHistoryIDsPtr = &eventProcessHistoryIDs_;
387  if (metaDataTree->FindBranch(poolNames::eventHistoryBranchName().c_str()) != nullptr) {
388  metaDataTree->SetBranchAddress(poolNames::eventHistoryBranchName().c_str(), &eventHistoryIDsPtr);
389  }
390 
391  if (metaDataTree->FindBranch(poolNames::moduleDescriptionMapBranchName().c_str()) != nullptr) {
392  if (metaDataTree->GetBranch(poolNames::moduleDescriptionMapBranchName().c_str())->GetSplitLevel() != 0) {
393  metaDataTree->SetBranchStatus((poolNames::moduleDescriptionMapBranchName() + ".*").c_str(), false);
394  } else {
395  metaDataTree->SetBranchStatus(poolNames::moduleDescriptionMapBranchName().c_str(), false);
396  }
397  }
398 
399  // Here we read the metadata tree
400  roottree::getEntry(metaDataTree.get(), 0);
401 
403 
404  // Here we read the event history tree, if we have one.
406 
408  if (!fileFormatVersion().triggerPathsTracked()) {
409  ParameterSetConverter converter(psetMap, psetIdConverter, fileFormatVersion().parameterSetsByReference());
410  } else {
411  // Merge into the parameter set registry.
412  pset::Registry& psetRegistry = *pset::Registry::instance();
413  for (auto const& psetEntry : psetMap) {
414  ParameterSet pset(psetEntry.second.pset());
415  pset.setID(psetEntry.first);
416  // For thread safety, don't update global registries when a secondary source opens a file.
417  if (inputType != InputType::SecondarySource) {
418  psetRegistry.insertMapped(pset);
419  }
420  }
421  }
422  if (!fileFormatVersion().splitProductIDs()) {
423  // Old provenance format input file. Create a provenance adaptor.
424  // propagate_const<T> has no reset() function
425  provenanceAdaptor_ = std::make_unique<ProvenanceAdaptor>(
426  inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter, true);
427  // Fill in the branchIDLists branch from the provenance adaptor
428  branchIDLists_ = provenanceAdaptor_->branchIDLists();
429  } else {
430  if (!fileFormatVersion().triggerPathsTracked()) {
431  // New provenance format, but change in ParameterSet Format. Create a provenance adaptor.
432  // propagate_const<T> has no reset() function
433  provenanceAdaptor_ = std::make_unique<ProvenanceAdaptor>(
434  inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter, false);
435  }
436  // New provenance format input file. The branchIDLists branch was read directly from the input file.
437  if (metaDataTree->FindBranch(poolNames::branchIDListBranchName().c_str()) == nullptr) {
438  throw Exception(errors::EventCorruption) << "Failed to find branchIDLists branch in metaData tree.\n";
439  }
440  branchIDLists_.reset(branchIDListsAPtr.release());
441  }
442 
444  if (metaDataTree->FindBranch(poolNames::thinnedAssociationsHelperBranchName().c_str()) == nullptr) {
446  << "Failed to find thinnedAssociationsHelper branch in metaData tree.\n";
447  }
448  }
449 
450  if (!bypassVersionCheck) {
451  checkReleaseVersion(pHistVector, file());
452  }
453 
454  if (labelRawDataLikeMC) {
455  std::string const rawData("FEDRawDataCollection");
456  std::string const source("source");
457  ProductRegistry::ProductList& pList = inputProdDescReg.productListUpdator();
458  BranchKey finder(rawData, source, "", "");
459  ProductRegistry::ProductList::iterator it = pList.lower_bound(finder);
460  if (it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() == source) {
461  // We found raw data with a module label of source.
462  // We need to change the module label and process name.
463  // Create helper.
464  it->second.init();
465  // propagate_const<T> has no reset() function
466  daqProvenanceHelper_ = std::make_unique<DaqProvenanceHelper>(it->second.unwrappedTypeID());
467  // Create the new branch description
468  BranchDescription const& newBD = daqProvenanceHelper_->branchDescription();
469  // Save info from the old and new branch descriptions
470  daqProvenanceHelper_->saveInfo(it->second, newBD);
471  // Map the new branch name to the old branch name.
472  newBranchToOldBranch_.insert(std::make_pair(newBD.branchName(), it->second.branchName()));
473  // Remove the old branch description from the product Registry.
474  pList.erase(it);
475  // Check that there was only one.
476  it = pList.lower_bound(finder);
477  assert(!(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() == source));
478  // Insert the new branch description into the product registry.
479  inputProdDescReg.copyProduct(newBD);
480  // Fix up other per file metadata.
481  daqProvenanceHelper_->fixMetaData(processConfigurations, pHistVector);
482  daqProvenanceHelper_->fixMetaData(*branchIDLists_);
483  daqProvenanceHelper_->fixMetaData(*branchChildren_);
484  }
485  }
486 
487  for (auto const& history : pHistVector) {
488  processHistoryRegistry.registerProcessHistory(history);
489  }
490 
492 
493  // Update the branch id info. This has to be done before validateFile since
494  // depending on the file format, the branchIDListHelper_ may have its fixBranchListIndexes call made
495  if (inputType == InputType::Primary) {
497  }
498 
499  validateFile(inputType, usingGoToEvent);
500 
501  // Here, we make the class that will make the ProvenanceReader
502  // It reads whatever trees it needs.
503  // propagate_const<T> has no reset() function
504  provenanceReaderMaker_ = std::unique_ptr<MakeProvenanceReader>(makeProvenanceReaderMaker(inputType).release());
505 
506  // Merge into the hashed registries.
507  if (eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
509  }
510 
511  initializeDuplicateChecker(indexesIntoFiles, currentIndexIntoFile);
518 
519  makeProcessBlockRootTrees(filePtr, treeMaxVirtualSize, enablePrefetching, inputType, storedProcessBlockHelper);
520 
521  setPresenceInProductRegistry(inputProdDescReg, storedProcessBlockHelper);
522 
523  auto newReg = std::make_unique<ProductRegistry>();
524 
525  // Do the translation from the old registry to the new one
526  {
527  ProductRegistry::ProductList const& prodList = inputProdDescReg.productList();
528  for (auto const& product : prodList) {
529  BranchDescription const& prod = product.second;
530  std::string newFriendlyName = friendlyname::friendlyName(prod.className());
531  if (newFriendlyName == prod.friendlyClassName()) {
532  newReg->copyProduct(prod);
533  } else {
534  if (fileFormatVersion().splitProductIDs()) {
536  << "Cannot change friendly class name algorithm without more development work\n"
537  << "to update BranchIDLists and ThinnedAssociationsHelper. Contact the framework group.\n";
538  }
539  BranchDescription newBD(prod);
540  newBD.updateFriendlyClassName();
541  newReg->copyProduct(newBD);
542  newBranchToOldBranch_.insert(std::make_pair(newBD.branchName(), prod.branchName()));
543  }
544  }
545 
547  *newReg, productSelectorRules, dropDescendants, inputType, storedProcessBlockHelper, processBlockHelper);
548 
549  if (inputType == InputType::SecondaryFile) {
550  thinnedAssociationsHelper->updateFromSecondaryInput(*fileThinnedAssociationsHelper_,
551  *associationsFromSecondary);
552  } else if (inputType == InputType::Primary) {
553  processBlockHelper->initializeFromPrimaryInput(storedProcessBlockHelper);
554  thinnedAssociationsHelper->updateFromPrimaryInput(*fileThinnedAssociationsHelper_);
555  }
556 
557  if (inputType == InputType::Primary) {
558  for (auto& product : newReg->productListUpdator()) {
559  setIsMergeable(product.second);
560  }
561  }
562  //inform system we want to use DelayedReader
563  for (auto& product : newReg->productListUpdator()) {
564  product.second.setOnDemand(true);
565  }
566 
567  for (auto& processBlockTree : processBlockTrees_) {
568  treePointers_.push_back(processBlockTree.get());
569  }
570 
571  // freeze the product registry
572  newReg->setFrozen(inputType != InputType::Primary);
573  productRegistry_.reset(newReg.release());
574  }
575 
576  // Set up information from the product registry.
577  ProductRegistry::ProductList const& prodList = productRegistry()->productList();
578 
579  {
580  std::vector<size_t> nBranches(treePointers_.size(), 0);
581  for (auto const& product : prodList) {
582  if (product.second.branchType() == InProcess) {
583  std::vector<std::string> const& processes = storedProcessBlockHelper.processesWithProcessBlockProducts();
584  auto it = std::find(processes.begin(), processes.end(), product.second.processName());
585  if (it != processes.end()) {
586  auto index = std::distance(processes.begin(), it);
588  }
589  } else {
590  ++nBranches[product.second.branchType()];
591  }
592  }
593 
594  int i = 0;
595  for (auto& t : treePointers_) {
596  t->numberOfBranchesToAdd(nBranches[i]);
597  ++i;
598  }
599  }
600  for (auto const& product : prodList) {
601  BranchDescription const& prod = product.second;
602  if (prod.branchType() == InProcess) {
603  std::vector<std::string> const& processes = storedProcessBlockHelper.processesWithProcessBlockProducts();
604  auto it = std::find(processes.begin(), processes.end(), prod.processName());
605  if (it != processes.end()) {
606  auto index = std::distance(processes.begin(), it);
608  newBranchToOldBranch(prod.branchName()));
609  }
610  } else {
611  treePointers_[prod.branchType()]->addBranch(prod, newBranchToOldBranch(prod.branchName()));
612  }
613  }
614 
615  // Determine if this file is fast clonable.
616  setIfFastClonable(remainingEvents, remainingLumis);
617 
618  // We are done with our initial reading of EventAuxiliary.
620 
621  // Tell the event tree to begin training at the next read.
623 
624  // Train the run and lumi trees.
625  runTree_.trainCache("*");
626  lumiTree_.trainCache("*");
627  for (auto& processBlockTree : processBlockTrees_) {
628  processBlockTree->trainCache("*");
629  }
630  }
631 
633 
634  void RootFile::readEntryDescriptionTree(EntryDescriptionMap& entryDescriptionMap, InputType inputType) {
635  // Called only for old format files.
636  // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
637  std::unique_ptr<TTree> entryDescriptionTree(
638  dynamic_cast<TTree*>(filePtr_->Get(poolNames::entryDescriptionTreeName().c_str())));
639  if (nullptr == entryDescriptionTree.get()) {
641  << "Could not find tree " << poolNames::entryDescriptionTreeName() << " in the input file.\n";
642  }
643 
644  EntryDescriptionID idBuffer;
645  EntryDescriptionID* pidBuffer = &idBuffer;
646  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionIDBranchName().c_str(), &pidBuffer);
647 
648  EventEntryDescription entryDescriptionBuffer;
649  EventEntryDescription* pEntryDescriptionBuffer = &entryDescriptionBuffer;
650  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionBranchName().c_str(), &pEntryDescriptionBuffer);
651 
652  // Fill in the parentage registry.
654 
655  for (Long64_t i = 0, numEntries = entryDescriptionTree->GetEntries(); i < numEntries; ++i) {
656  roottree::getEntry(entryDescriptionTree.get(), i);
657  if (idBuffer != entryDescriptionBuffer.id()) {
658  throw Exception(errors::EventCorruption) << "Corruption of EntryDescription tree detected.\n";
659  }
660  entryDescriptionMap.insert(std::make_pair(entryDescriptionBuffer.id(), entryDescriptionBuffer));
662  parents.setParents(entryDescriptionBuffer.parents());
663  if (daqProvenanceHelper_) {
664  ParentageID const oldID = parents.id();
665  daqProvenanceHelper_->fixMetaData(parents.parentsForUpdate());
666  ParentageID newID = parents.id();
667  if (newID != oldID) {
668  daqProvenanceHelper_->setOldParentageIDToNew(oldID, newID);
669  }
670  }
671  // For thread safety, don't update global registries when a secondary source opens a file.
672  if (inputType != InputType::SecondarySource) {
673  registry.insertMapped(parents);
674  }
675  }
676  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionIDBranchName().c_str(), nullptr);
677  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionBranchName().c_str(), nullptr);
678  }
679 
681  // New format file
682  // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
683  std::unique_ptr<TTree> parentageTree(dynamic_cast<TTree*>(filePtr_->Get(poolNames::parentageTreeName().c_str())));
684  if (nullptr == parentageTree.get()) {
686  << "Could not find tree " << poolNames::parentageTreeName() << " in the input file.\n";
687  }
688 
690  Parentage* pParentageBuffer = &parents;
691  parentageTree->SetBranchAddress(poolNames::parentageBranchName().c_str(), &pParentageBuffer);
692 
694 
695  parentageIDLookup_.reserve(parentageTree->GetEntries());
696  for (Long64_t i = 0, numEntries = parentageTree->GetEntries(); i < numEntries; ++i) {
697  roottree::getEntry(parentageTree.get(), i);
698  if (daqProvenanceHelper_) {
699  ParentageID const oldID = parents.id();
700  daqProvenanceHelper_->fixMetaData(parents.parentsForUpdate());
701  ParentageID newID = parents.id();
702  if (newID != oldID) {
703  daqProvenanceHelper_->setOldParentageIDToNew(oldID, newID);
704  }
705  }
706  // For thread safety, don't update global registries when a secondary source opens a file.
707  if (inputType != InputType::SecondarySource) {
708  registry.insertMapped(parents);
709  }
710  parentageIDLookup_.push_back(parents.id());
711  }
712  parentageTree->SetBranchAddress(poolNames::parentageBranchName().c_str(), nullptr);
713  }
714 
715  void RootFile::setIfFastClonable(int remainingEvents, int remainingLumis) {
716  if (fileFormatVersion().noMetaDataTrees() and !fileFormatVersion().storedProductProvenanceUsed()) {
717  //we must avoid copying the old branch which stored the per product per event provenance
719  return;
720  }
721  if (!fileFormatVersion().splitProductIDs()) {
723  return;
724  }
727  return;
728  }
729  // Find entry for first event in file
731  while (it != indexIntoFileEnd_ && it.getEntryType() != IndexIntoFile::kEvent) {
732  ++it;
733  }
734  if (it == indexIntoFileEnd_) {
736  return;
737  }
738 
739  // From here on, record all reasons we can't fast clone.
740  IndexIntoFile::SortOrder sortOrder =
744  }
745  if (skipAnyEvents_) {
747  }
748  if (remainingEvents >= 0 && eventTree_.entries() > remainingEvents) {
750  }
751  if (remainingLumis >= 0 && lumiTree_.entries() > remainingLumis) {
753  }
754  if (duplicateChecker_ && !duplicateChecker_->checkDisabled() && !duplicateChecker_->noDuplicatesInFile()) {
756  }
757  }
758 
759  std::shared_ptr<FileBlock> RootFile::createFileBlock() {
760  std::vector<TTree*> processBlockTrees;
761  std::vector<std::string> processesWithProcessBlockTrees;
762  processBlockTrees.reserve(processBlockTrees_.size());
763  processesWithProcessBlockTrees.reserve(processBlockTrees_.size());
764  for (auto& processBlockTree : processBlockTrees_) {
765  processBlockTrees.push_back(processBlockTree->tree());
766  processesWithProcessBlockTrees.push_back(processBlockTree->processName());
767  }
768  return std::make_shared<FileBlock>(fileFormatVersion(),
769  eventTree_.tree(),
771  lumiTree_.tree(),
773  runTree_.tree(),
774  runTree_.metaTree(),
775  std::move(processBlockTrees),
776  std::move(processesWithProcessBlockTrees),
779  file_,
781  modifiedIDs(),
782  branchChildren());
783  }
784 
786  std::vector<TTree*> processBlockTrees;
787  std::vector<std::string> processesWithProcessBlockTrees;
788  processBlockTrees.reserve(processBlockTrees_.size());
789  processesWithProcessBlockTrees.reserve(processBlockTrees_.size());
790  for (auto& processBlockTree : processBlockTrees_) {
791  processBlockTrees.push_back(processBlockTree->tree());
792  processesWithProcessBlockTrees.push_back(processBlockTree->processName());
793  }
794  fileBlock.updateTTreePointers(eventTree_.tree(),
796  lumiTree_.tree(),
798  runTree_.tree(),
799  runTree_.metaTree(),
800  std::move(processBlockTrees),
801  std::move(processesWithProcessBlockTrees));
802  }
803 
804  std::string const& RootFile::newBranchToOldBranch(std::string const& newBranch) const {
805  std::map<std::string, std::string>::const_iterator it = newBranchToOldBranch_.find(newBranch);
806  if (it != newBranchToOldBranch_.end()) {
807  return it->second;
808  }
809  return newBranch;
810  }
811 
813 
816  }
817 
818  void RootFile::initAssociationsFromSecondary(std::vector<BranchID> const& associationsFromSecondary) {
819  thinnedAssociationsHelper_->initAssociationsFromSecondary(associationsFromSecondary,
821  }
822 
825  return false;
826  }
827 
828  if (eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
829  // See first if the entire lumi or run is skipped, so we won't have to read the event Auxiliary in that case.
831  return true;
832  }
833 
834  // The Lumi is not skipped. If this is an event, see if the event is skipped.
836  auto eventAux = fillEventAuxiliary(indexIntoFileIter_.entry());
837  if (eventSkipperByID_->skipIt(indexIntoFileIter_.run(), indexIntoFileIter_.lumi(), eventAux.id().event())) {
838  return true;
839  }
840  }
841 
842  // Skip runs with no lumis if either lumisToSkip or lumisToProcess have been set to select lumis
844  // There are no lumis in this run, not even ones we will skip
846  return true;
847  }
848  // If we get here there are lumis in the run, check to see if we are skipping all of them
849  do {
851  return false;
852  }
853  } while (indexIntoFileIter_.skipLumiInRun());
854  return true;
855  }
856  }
857  return false;
858  }
859 
862  if (duplicateChecker_.get() == nullptr) {
863  return false;
864  }
865  auto const eventAux = fillEventAuxiliary(indexIntoFileIter_.entry());
866  return duplicateChecker_->isDuplicateAndCheckActive(indexIntoFileIter_.processHistoryIDIndex(),
869  eventAux.id().event(),
870  file_);
871  }
872 
875  }
876 
879  EventNumber_t& event) {
880  // First, account for consecutive skipped entries.
881  while (skipThisEntry()) {
886  } else {
888  }
889  }
890  // OK, we have an entry that is not skipped.
892  if (entryType == IndexIntoFile::kEnd) {
893  return IndexIntoFile::kEnd;
894  }
895  if (entryType == IndexIntoFile::kRun) {
897  runHelper_->checkForNewRun(run, indexIntoFileIter_.peekAheadAtLumi());
898  return IndexIntoFile::kRun;
899  } else if (processingMode_ == InputSource::Runs) {
901  return getNextItemType(run, lumi, event);
902  }
903  if (entryType == IndexIntoFile::kLumi) {
906  return IndexIntoFile::kLumi;
909  return getNextItemType(run, lumi, event);
910  }
911  if (isDuplicateEvent()) {
913  return getNextItemType(run, lumi, event);
914  }
917  auto eventAux = fillEventAuxiliary(indexIntoFileIter_.entry());
918  event = eventAux.event();
919  return IndexIntoFile::kEvent;
920  }
921 
924  itr.advanceToEvent();
925  return itr.getEntryType() == IndexIntoFile::kEnd;
926  }
927 
930  int phIndex;
933  IndexIntoFile::EntryNumber_t eventEntry;
934  itr.skipEventBackward(phIndex, run, lumi, eventEntry);
935  itr.skipEventBackward(phIndex, run, lumi, eventEntry);
936  return eventEntry == IndexIntoFile::invalidEntry;
937  }
938 
939  namespace {
940  struct RunItem {
941  RunItem(ProcessHistoryID const& phid, RunNumber_t const& run) : phid_(phid), run_(run) {}
942  ProcessHistoryID phid_;
943  RunNumber_t run_;
944  };
945  struct RunItemSortByRun {
946  bool operator()(RunItem const& a, RunItem const& b) const { return a.run_ < b.run_; }
947  };
948  struct RunItemSortByRunPhid {
949  bool operator()(RunItem const& a, RunItem const& b) const {
950  return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.phid_ < b.phid_);
951  }
952  };
953  struct LumiItem {
954  LumiItem(ProcessHistoryID const& phid,
955  RunNumber_t const& run,
958  : phid_(phid),
959  run_(run),
960  lumi_(lumi),
961  firstEventEntry_(entry),
962  lastEventEntry_(entry == IndexIntoFile::invalidEntry ? IndexIntoFile::invalidEntry : entry + 1) {}
963  ProcessHistoryID phid_;
964  RunNumber_t run_;
966  IndexIntoFile::EntryNumber_t firstEventEntry_;
967  IndexIntoFile::EntryNumber_t lastEventEntry_;
968  };
969  struct LumiItemSortByRunLumi {
970  bool operator()(LumiItem const& a, LumiItem const& b) const {
971  return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.lumi_ < b.lumi_);
972  }
973  };
974  struct LumiItemSortByRunLumiPhid {
975  bool operator()(LumiItem const& a, LumiItem const& b) const {
976  if (a.run_ < b.run_)
977  return true;
978  if (b.run_ < a.run_)
979  return false;
980  if (a.lumi_ < b.lumi_)
981  return true;
982  if (b.lumi_ < a.lumi_)
983  return false;
984  return a.phid_ < b.phid_;
985  }
986  };
987  } // namespace
988 
990  // This function is for backward compatibility.
991  // If reading a current format file, indexIntoFile_ is read from the input
992  // file and should always be there. Note that the algorithm below will work
993  // sometimes but often fail with the new format introduced in release 3_8_0.
994  // If it ever becomes necessary to rebuild IndexIntoFile from the new format,
995  // probably a separate function should be written to deal with the task.
996  // This is possible just not implemented yet.
997  assert(!fileFormatVersion().hasIndexIntoFile());
998 
999  typedef std::list<LumiItem> LumiList;
1000  LumiList lumis; // (declare 1)
1001 
1002  typedef std::set<LuminosityBlockID> RunLumiSet;
1003  RunLumiSet runLumiSet; // (declare 2)
1004 
1005  typedef std::list<RunItem> RunList;
1006  RunList runs; // (declare 5)
1007 
1008  typedef std::set<RunNumber_t> RunSet;
1009  RunSet runSet; // (declare 4)
1010 
1011  typedef std::set<RunItem, RunItemSortByRunPhid> RunItemSet;
1012  RunItemSet runItemSet; // (declare 3)
1013 
1014  typedef std::map<RunNumber_t, ProcessHistoryID> PHIDMap;
1015  PHIDMap phidMap;
1016 
1017  RunNumber_t prevRun = 0;
1018  LuminosityBlockNumber_t prevLumi = 0;
1019  ProcessHistoryID prevPhid;
1020  bool iFirst = true;
1021 
1022  indexIntoFile_.unsortedEventNumbers().clear(); // should already be empty, just being careful
1024 
1025  // First, loop through the event tree.
1026  EventSelectionIDVector eventSelectionIDs;
1027  BranchListIndexes branchListIndexes;
1028  while (eventTree_.next()) {
1029  bool newRun = false;
1030  bool newLumi = false;
1031  auto evtAux = fillThisEventAuxiliary();
1032  fillEventHistory(evtAux, eventSelectionIDs, branchListIndexes);
1033 
1034  // Save the event numbers as we loop through the event auxiliary to avoid
1035  // having to read through the event auxiliary again later. These event numbers
1036  // are not actually used in this function, but could be needed elsewhere.
1037  indexIntoFile_.unsortedEventNumbers().push_back(evtAux.event());
1038 
1039  ProcessHistoryID reducedPHID = processHistoryRegistry_->reducedProcessHistoryID(evtAux.processHistoryID());
1040 
1041  if (iFirst || prevPhid != reducedPHID || prevRun != evtAux.run()) {
1042  iFirst = false;
1043  newRun = newLumi = true;
1044  } else if (prevLumi != evtAux.luminosityBlock()) {
1045  newLumi = true;
1046  }
1047  prevPhid = reducedPHID;
1048  prevRun = evtAux.run();
1049  prevLumi = evtAux.luminosityBlock();
1050  if (newLumi) {
1051  lumis.emplace_back(
1052  reducedPHID, evtAux.run(), evtAux.luminosityBlock(), eventTree_.entryNumber()); // (insert 1)
1053  runLumiSet.insert(LuminosityBlockID(evtAux.run(), evtAux.luminosityBlock())); // (insert 2)
1054  } else {
1055  LumiItem& currentLumi = lumis.back();
1056  assert(currentLumi.lastEventEntry_ == eventTree_.entryNumber());
1057  ++currentLumi.lastEventEntry_;
1058  }
1059  if (newRun) {
1060  // Insert run in list if it is not already there.
1061  RunItem item(reducedPHID, evtAux.run());
1062  if (runItemSet.insert(item).second) { // (check 3, insert 3)
1063  runs.push_back(std::move(item)); // (insert 5)
1064  runSet.insert(evtAux.run()); // (insert 4)
1065  phidMap.insert(std::make_pair(evtAux.run(), reducedPHID));
1066  }
1067  }
1068  }
1069  // now clean up.
1072 
1073  // Loop over run entries and fill information.
1074 
1075  typedef std::map<RunNumber_t, IndexIntoFile::EntryNumber_t> RunMap;
1076  RunMap runMap; // (declare 11)
1077 
1078  typedef std::vector<RunItem> RunVector;
1079  RunVector emptyRuns; // (declare 12)
1080 
1081  if (runTree_.isValid()) {
1082  while (runTree_.next()) {
1083  // Note: adjacent duplicates will be skipped without an explicit check.
1084 
1085  std::shared_ptr<RunAuxiliary> runAux = fillRunAuxiliary();
1086  ProcessHistoryID reducedPHID = processHistoryRegistry_->reducedProcessHistoryID(runAux->processHistoryID());
1087 
1088  if (runSet.insert(runAux->run()).second) { // (check 4, insert 4)
1089  // This run was not associated with any events.
1090  emptyRuns.emplace_back(reducedPHID, runAux->run()); // (insert 12)
1091  }
1092  runMap.insert(std::make_pair(runAux->run(), runTree_.entryNumber())); // (insert 11)
1093  phidMap.insert(std::make_pair(runAux->run(), reducedPHID));
1094  }
1095  // now clean up.
1097  }
1098 
1099  // Insert the ordered empty runs into the run list.
1100  RunItemSortByRun runItemSortByRun;
1101  stable_sort_all(emptyRuns, runItemSortByRun);
1102 
1103  RunList::iterator itRuns = runs.begin(), endRuns = runs.end();
1104  for (auto const& emptyRun : emptyRuns) {
1105  for (; itRuns != endRuns; ++itRuns) {
1106  if (runItemSortByRun(emptyRun, *itRuns)) {
1107  break;
1108  }
1109  }
1110  runs.insert(itRuns, emptyRun);
1111  }
1112 
1113  // Loop over luminosity block entries and fill information.
1114 
1115  typedef std::vector<LumiItem> LumiVector;
1116  LumiVector emptyLumis; // (declare 7)
1117 
1118  typedef std::map<LuminosityBlockID, IndexIntoFile::EntryNumber_t> RunLumiMap;
1119  RunLumiMap runLumiMap; // (declare 6)
1120 
1121  if (lumiTree_.isValid()) {
1122  while (lumiTree_.next()) {
1123  // Note: adjacent duplicates will be skipped without an explicit check.
1124  std::shared_ptr<LuminosityBlockAuxiliary> lumiAux = fillLumiAuxiliary();
1125  LuminosityBlockID lumiID = LuminosityBlockID(lumiAux->run(), lumiAux->luminosityBlock());
1126  if (runLumiSet.insert(lumiID).second) { // (check 2, insert 2)
1127  // This lumi was not associated with any events.
1128  // Use the process history ID from the corresponding run. In cases of practical
1129  // importance, this should be the correct process history ID, but it is possible
1130  // to construct files where this is not the correct process history ID ...
1131  PHIDMap::const_iterator iPhidMap = phidMap.find(lumiAux->run());
1132  assert(iPhidMap != phidMap.end());
1133  emptyLumis.emplace_back(
1134  iPhidMap->second, lumiAux->run(), lumiAux->luminosityBlock(), IndexIntoFile::invalidEntry); // (insert 7)
1135  }
1136  runLumiMap.insert(std::make_pair(lumiID, lumiTree_.entryNumber()));
1137  }
1138  // now clean up.
1140  }
1141 
1142  // Insert the ordered empty lumis into the lumi list.
1143  LumiItemSortByRunLumi lumiItemSortByRunLumi;
1144  stable_sort_all(emptyLumis, lumiItemSortByRunLumi);
1145 
1146  LumiList::iterator itLumis = lumis.begin(), endLumis = lumis.end();
1147  for (auto const& emptyLumi : emptyLumis) {
1148  for (; itLumis != endLumis; ++itLumis) {
1149  if (lumiItemSortByRunLumi(emptyLumi, *itLumis)) {
1150  break;
1151  }
1152  }
1153  lumis.insert(itLumis, emptyLumi);
1154  }
1155 
1156  // Create a map of RunItems that gives the order of first appearance in the list.
1157  // Also fill in the vector of process history IDs
1158  typedef std::map<RunItem, int, RunItemSortByRunPhid> RunCountMap;
1159  RunCountMap runCountMap; // Declare (17)
1160  std::vector<ProcessHistoryID>& phids = indexIntoFile_.setProcessHistoryIDs();
1161  assert(phids.empty());
1162  std::vector<IndexIntoFile::RunOrLumiEntry>& entries = indexIntoFile_.setRunOrLumiEntries();
1163  assert(entries.empty());
1164  int rcount = 0;
1165  for (auto& run : runs) {
1166  RunCountMap::const_iterator countMapItem = runCountMap.find(run);
1167  if (countMapItem == runCountMap.end()) {
1168  countMapItem = runCountMap.insert(std::make_pair(run, rcount)).first; // Insert (17)
1169  assert(countMapItem != runCountMap.end());
1170  ++rcount;
1171  }
1172  std::vector<ProcessHistoryID>::const_iterator phidItem = find_in_all(phids, run.phid_);
1173  if (phidItem == phids.end()) {
1174  phids.push_back(run.phid_);
1175  phidItem = phids.end() - 1;
1176  }
1177  entries.emplace_back(countMapItem->second, // use (17)
1179  runMap[run.run_], // use (11)
1180  phidItem - phids.begin(),
1181  run.run_,
1182  0U,
1185  }
1186 
1187  // Create a map of LumiItems that gives the order of first appearance in the list.
1188  typedef std::map<LumiItem, int, LumiItemSortByRunLumiPhid> LumiCountMap;
1189  LumiCountMap lumiCountMap; // Declare (19)
1190  int lcount = 0;
1191  for (auto& lumi : lumis) {
1192  RunCountMap::const_iterator runCountMapItem = runCountMap.find(RunItem(lumi.phid_, lumi.run_));
1193  assert(runCountMapItem != runCountMap.end());
1194  LumiCountMap::const_iterator countMapItem = lumiCountMap.find(lumi);
1195  if (countMapItem == lumiCountMap.end()) {
1196  countMapItem = lumiCountMap.insert(std::make_pair(lumi, lcount)).first; // Insert (17)
1197  assert(countMapItem != lumiCountMap.end());
1198  ++lcount;
1199  }
1200  std::vector<ProcessHistoryID>::const_iterator phidItem = find_in_all(phids, lumi.phid_);
1201  assert(phidItem != phids.end());
1202  entries.emplace_back(runCountMapItem->second,
1203  countMapItem->second,
1204  runLumiMap[LuminosityBlockID(lumi.run_, lumi.lumi_)],
1205  phidItem - phids.begin(),
1206  lumi.run_,
1207  lumi.lumi_,
1208  lumi.firstEventEntry_,
1209  lumi.lastEventEntry_);
1210  }
1211  stable_sort_all(entries);
1212  }
1213 
1214  void RootFile::validateFile(InputType inputType, bool usingGoToEvent) {
1215  if (!fid_.isValid()) {
1217  }
1218  if (!eventTree_.isValid()) {
1219  throw Exception(errors::EventCorruption) << "'Events' tree is corrupted or not present\n"
1220  << "in the input file.\n";
1221  }
1222  if (enforceGUIDInFileName_) {
1223  auto guidFromName = stemFromPath(file_);
1224  if (guidFromName != fid_.fid()) {
1226  << "GUID " << guidFromName << " extracted from file name " << file_
1227  << " is inconsistent with the GUID read from the file " << fid_.fid();
1228  }
1229  }
1230 
1231  if (fileFormatVersion().hasIndexIntoFile()) {
1232  if (runTree().entries() > 0) {
1234  }
1236  if (daqProvenanceHelper_) {
1237  std::vector<ProcessHistoryID>& phidVec = indexIntoFile_.setProcessHistoryIDs();
1238  for (auto& phid : phidVec) {
1239  phid = daqProvenanceHelper_->mapProcessHistoryID(phid);
1240  }
1241  }
1243  }
1244  } else {
1247  }
1248 
1252  std::shared_ptr<IndexIntoFile::EventFinder>(std::make_shared<RootFileEventFinder>(eventTree_)));
1253  // We fill the event numbers explicitly if we need to find events in closed files,
1254  // such as for secondary files (or secondary sources) or if duplicate checking across files.
1255  bool needEventNumbers = false;
1256  bool needIndexesForDuplicateChecker =
1257  duplicateChecker_ && duplicateChecker_->checkingAllFiles() && !duplicateChecker_->checkDisabled();
1258  if (inputType != InputType::Primary || needIndexesForDuplicateChecker || usingGoToEvent) {
1259  needEventNumbers = true;
1260  }
1261  bool needEventEntries = false;
1262  if (inputType != InputType::Primary || !noEventSort_) {
1263  // We need event entries for sorting or for secondary files or sources.
1264  needEventEntries = true;
1265  }
1266  indexIntoFile_.fillEventNumbersOrEntries(needEventNumbers, needEventEntries);
1267  }
1268 
1269  void RootFile::reportOpened(std::string const& inputType) {
1270  // Report file opened.
1271  std::string const label = "source";
1272  std::string moduleName = "PoolSource";
1273  filePtr_->inputFileOpened(logicalFile_, inputType, moduleName, label, fid_.fid(), eventTree_.branchNames());
1274  }
1275 
1277  // Just to play it safe, zero all pointers to objects in the InputFile to be closed.
1278  eventHistoryTree_ = nullptr;
1279  for (auto& treePointer : treePointers_) {
1280  treePointer->close();
1281  treePointer = nullptr;
1282  }
1283  filePtr_->Close();
1284  filePtr_ = nullptr; // propagate_const<T> has no reset() function
1285  }
1286 
1289  // Already read.
1290  return eventAuxCache_;
1291  }
1292  if (fileFormatVersion().newAuxiliary()) {
1293  EventAuxiliary* pEvAux = &eventAuxCache_;
1295  } else {
1296  // for backward compatibility.
1297  EventAux eventAux;
1298  EventAux* pEvAux = &eventAux;
1299  eventTree_.fillAux<EventAux>(pEvAux);
1300  conversion(eventAux, eventAuxCache_);
1301  }
1303  return eventAuxCache_;
1304  }
1305 
1308  return fillThisEventAuxiliary();
1309  }
1310 
1312  TBranch* eventToProcessBlockIndexesBranch = get_underlying_safe(eventToProcessBlockIndexesBranch_);
1313  if (eventToProcessBlockIndexesBranch == nullptr) {
1314  if (processBlockHelper_.get() == nullptr) {
1316  } else {
1318  }
1319  } else {
1320  if (processBlockHelper_->cacheIndexVectorsPerFile().back() == 1u) {
1322  } else {
1323  EventToProcessBlockIndexes* pEventToProcessBlockIndexes = &eventToProcessBlockIndexes_;
1324  eventTree_.fillBranchEntry(eventToProcessBlockIndexesBranch, pEventToProcessBlockIndexes);
1325  unsigned int updatedIndex = eventToProcessBlockIndexes_.index() + processBlockHelper_->outerOffset();
1326  eventToProcessBlockIndexes_.setIndex(updatedIndex);
1327  }
1328  }
1329  }
1330 
1332  EventSelectionIDVector& eventSelectionIDs,
1333  BranchListIndexes& branchListIndexes,
1334  bool assertOnFailure) {
1335  // We could consider doing delayed reading, but because we have to
1336  // store this History object in a different tree than the event
1337  // data tree, this is too hard to do in this first version.
1338  if (fileFormatVersion().eventHistoryBranch()) {
1339  // Lumi block number was not in EventID for the relevant releases.
1340  EventID id(evtAux.id().run(), 0, evtAux.id().event());
1341  if (eventProcessHistoryIter_->eventID() != id) {
1344  assert(eventProcessHistoryIter_->eventID() == id);
1345  }
1346  evtAux.setProcessHistoryID(eventProcessHistoryIter_->processHistoryID());
1348  } else if (fileFormatVersion().eventHistoryTree()) {
1349  // for backward compatibility.
1350  History* pHistory = history_.get();
1351  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(poolNames::eventHistoryBranchName().c_str());
1352  if (!eventHistoryBranch) {
1353  throw Exception(errors::EventCorruption) << "Failed to find history branch in event history tree.\n";
1354  }
1355  eventHistoryBranch->SetAddress(&pHistory);
1357  evtAux.setProcessHistoryID(history_->processHistoryID());
1358  eventSelectionIDs.swap(history_->eventSelectionIDs());
1359  branchListIndexes.swap(history_->branchListIndexes());
1360  } else if (fileFormatVersion().noMetaDataTrees()) {
1361  // Current format
1362  EventSelectionIDVector* pESV = &eventSelectionIDs;
1363  TBranch* eventSelectionIDBranch = eventTree_.tree()->GetBranch(poolNames::eventSelectionsBranchName().c_str());
1364  assert(eventSelectionIDBranch != nullptr);
1365  eventTree_.fillBranchEntry(eventSelectionIDBranch, pESV);
1366  BranchListIndexes* pBLI = &branchListIndexes;
1367  TBranch* branchListIndexesBranch = eventTree_.tree()->GetBranch(poolNames::branchListIndexesBranchName().c_str());
1368  assert(branchListIndexesBranch != nullptr);
1369  eventTree_.fillBranchEntry(branchListIndexesBranch, pBLI);
1370  }
1371  if (provenanceAdaptor_) {
1372  evtAux.setProcessHistoryID(provenanceAdaptor_->convertID(evtAux.processHistoryID()));
1373  for (auto& esID : eventSelectionIDs) {
1374  esID = provenanceAdaptor_->convertID(esID);
1375  }
1376  }
1377  if (daqProvenanceHelper_) {
1378  evtAux.setProcessHistoryID(daqProvenanceHelper_->mapProcessHistoryID(evtAux.processHistoryID()));
1379  }
1381  // old format. branchListIndexes_ must be filled in from the ProvenanceAdaptor.
1382  provenanceAdaptor_->branchListIndexes(branchListIndexes);
1383  }
1384  if (branchIDListHelper_) {
1385  return branchIDListHelper_->fixBranchListIndexes(branchListIndexes, assertOnFailure);
1386  }
1387  return true;
1388  }
1389 
1390  std::shared_ptr<LuminosityBlockAuxiliary> RootFile::fillLumiAuxiliary() {
1391  auto lumiAuxiliary = std::make_shared<LuminosityBlockAuxiliary>();
1392  if (fileFormatVersion().newAuxiliary()) {
1393  LuminosityBlockAuxiliary* pLumiAux = lumiAuxiliary.get();
1395  } else {
1396  LuminosityBlockAux lumiAux;
1397  LuminosityBlockAux* pLumiAux = &lumiAux;
1399  conversion(lumiAux, *lumiAuxiliary);
1400  }
1401  if (provenanceAdaptor_) {
1402  lumiAuxiliary->setProcessHistoryID(provenanceAdaptor_->convertID(lumiAuxiliary->processHistoryID()));
1403  }
1404  if (daqProvenanceHelper_) {
1405  lumiAuxiliary->setProcessHistoryID(daqProvenanceHelper_->mapProcessHistoryID(lumiAuxiliary->processHistoryID()));
1406  }
1407  if (lumiAuxiliary->luminosityBlock() == 0 && !fileFormatVersion().runsAndLumis()) {
1408  lumiAuxiliary->id() = LuminosityBlockID(RunNumber_t(1), LuminosityBlockNumber_t(1));
1409  }
1410  return lumiAuxiliary;
1411  }
1412 
1413  std::shared_ptr<RunAuxiliary> RootFile::fillRunAuxiliary() {
1414  auto runAuxiliary = std::make_shared<RunAuxiliary>();
1415  if (fileFormatVersion().newAuxiliary()) {
1416  RunAuxiliary* pRunAux = runAuxiliary.get();
1417  runTree_.fillAux<RunAuxiliary>(pRunAux);
1418  } else {
1419  RunAux runAux;
1420  RunAux* pRunAux = &runAux;
1421  runTree_.fillAux<RunAux>(pRunAux);
1422  conversion(runAux, *runAuxiliary);
1423  }
1424  if (provenanceAdaptor_) {
1425  runAuxiliary->setProcessHistoryID(provenanceAdaptor_->convertID(runAuxiliary->processHistoryID()));
1426  }
1427  if (daqProvenanceHelper_) {
1428  runAuxiliary->setProcessHistoryID(daqProvenanceHelper_->mapProcessHistoryID(runAuxiliary->processHistoryID()));
1429  }
1430  return runAuxiliary;
1431  }
1432 
1434  while (offset > 0 && indexIntoFileIter_ != indexIntoFileEnd_) {
1435  int phIndexOfSkippedEvent = IndexIntoFile::invalidIndex;
1436  RunNumber_t runOfSkippedEvent = IndexIntoFile::invalidRun;
1439 
1441  phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, skippedEventEntry);
1442 
1443  // At the end of the file and there were no more events to skip
1444  if (skippedEventEntry == IndexIntoFile::invalidEntry)
1445  break;
1446 
1447  if (eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
1448  auto const evtAux = fillEventAuxiliary(skippedEventEntry);
1449  if (eventSkipperByID_->skipIt(runOfSkippedEvent, lumiOfSkippedEvent, evtAux.id().event())) {
1450  continue;
1451  }
1452  }
1453  if (duplicateChecker_ && !duplicateChecker_->checkDisabled() && !duplicateChecker_->noDuplicatesInFile()) {
1454  auto const evtAux = fillEventAuxiliary(skippedEventEntry);
1455  if (duplicateChecker_->isDuplicateAndCheckActive(
1456  phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, evtAux.id().event(), file_)) {
1457  continue;
1458  }
1459  }
1460  --offset;
1461  }
1462 
1463  while (offset < 0) {
1464  if (duplicateChecker_) {
1465  duplicateChecker_->disable();
1466  }
1467 
1468  int phIndexOfEvent = IndexIntoFile::invalidIndex;
1472 
1473  indexIntoFileIter_.skipEventBackward(phIndexOfEvent, runOfEvent, lumiOfEvent, eventEntry);
1474 
1475  if (eventEntry == IndexIntoFile::invalidEntry)
1476  break;
1477 
1478  if (eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
1479  auto const evtAux = fillEventAuxiliary(eventEntry);
1480  if (eventSkipperByID_->skipIt(runOfEvent, lumiOfEvent, evtAux.id().event())) {
1481  continue;
1482  }
1483  }
1484  ++offset;
1485  }
1487  }
1488 
1489  bool RootFile::goToEvent(EventID const& eventID) {
1491 
1492  if (duplicateChecker_) {
1493  duplicateChecker_->disable();
1494  }
1495 
1497  if (noEventSort_)
1499 
1501  indexIntoFile_.findPosition(sortOrder, eventID.run(), eventID.luminosityBlock(), eventID.event());
1502 
1503  if (iter == indexIntoFile_.end(sortOrder)) {
1504  return false;
1505  }
1506  indexIntoFileIter_ = iter;
1507  return true;
1508  }
1509 
1510  // readEvent() is responsible for creating, and setting up, the
1511  // EventPrincipal.
1512  //
1513  // 1. create an EventPrincipal with a unique EventID
1514  // 2. For each entry in the provenance, put in one ProductResolver,
1515  // holding the Provenance for the corresponding EDProduct.
1516  // 3. set up the the EventPrincipal to know about this ProductResolver.
1517  //
1518  // We do *not* create the EDProduct instance (the equivalent of reading
1519  // the branch containing this EDProduct. That will be done by the Delayed Reader,
1520  // when it is asked to do so.
1521  //
1525  // read the event
1526  auto [found, succeeded] = readCurrentEvent(principal, false);
1527  auto const& evtAux = principal.aux();
1528 
1529  runHelper_->checkRunConsistency(evtAux.run(), indexIntoFileIter_.run());
1530  runHelper_->checkLumiConsistency(evtAux.luminosityBlock(), indexIntoFileIter_.lumi());
1531 
1533  return succeeded;
1534  }
1535 
1536  // Reads event at the current entry in the event tree
1537  std::tuple<bool, bool> RootFile::readCurrentEvent(EventPrincipal& principal, bool assertOnFailure) {
1538  bool found = true;
1539  bool succeeded = true;
1540  if (!eventTree_.current()) {
1541  found = false;
1542  return {found, succeeded};
1543  }
1544  auto evtAux = fillThisEventAuxiliary();
1545  if (!fileFormatVersion().lumiInEventID()) {
1546  //ugly, but will disappear when the backward compatibility is done with schema evolution.
1547  const_cast<EventID&>(evtAux.id()).setLuminosityBlockNumber(evtAux.oldLuminosityBlock());
1548  evtAux.resetObsoleteInfo();
1549  }
1551  EventSelectionIDVector eventSelectionIDs;
1552  BranchListIndexes branchListIndexes;
1553  if (!fillEventHistory(evtAux, eventSelectionIDs, branchListIndexes, assertOnFailure)) {
1554  succeeded = false;
1555  }
1556  runHelper_->overrideRunNumber(evtAux.id(), evtAux.isRealData());
1557 
1558  // We're not done ... so prepare the EventPrincipal
1560  auto history = processHistoryRegistry_->getMapped(evtAux.processHistoryID());
1561  principal.fillEventPrincipal(evtAux,
1562  history,
1563  std::move(eventSelectionIDs),
1564  std::move(branchListIndexes),
1566  *(makeProductProvenanceRetriever(principal.streamID().value())),
1568 
1569  // If this next assert shows up in performance profiling or significantly affects memory, then these three lines should be deleted.
1570  // The IndexIntoFile should guarantee that it never fails.
1572  ? *daqProvenanceHelper_->oldProcessHistoryID()
1573  : evtAux.processHistoryID());
1574  ProcessHistoryID const& reducedPHID = processHistoryRegistry_->reducedProcessHistoryID(idToCheck);
1576 
1577  // report event read from file
1578  filePtr_->eventReadFromFile();
1579  return {found, succeeded};
1580  }
1581 
1583 
1584  std::shared_ptr<RunAuxiliary> RootFile::readRunAuxiliary_() {
1585  if (runHelper_->fakeNewRun()) {
1586  auto runAuxiliary = std::make_shared<RunAuxiliary>(*savedRunAuxiliary());
1587  runHelper_->overrideRunNumber(runAuxiliary->id());
1588  return runAuxiliary;
1589  }
1592 
1593  // Begin code for backward compatibility before the existence of run trees.
1594  if (!runTree_.isValid()) {
1595  // prior to the support of run trees.
1596  // RunAuxiliary did not contain a valid timestamp. Take it from the next event.
1598  assert(eventEntry != IndexIntoFile::invalidEntry);
1599  assert(eventTree_.current(eventEntry));
1600  auto const evtAux = fillEventAuxiliary(eventEntry);
1601 
1603  runHelper_->overrideRunNumber(run);
1604  savedRunAuxiliary_ = std::make_shared<RunAuxiliary>(run.run(), evtAux.time(), Timestamp::invalidTimestamp());
1605  return savedRunAuxiliary();
1606  }
1607  // End code for backward compatibility before the existence of run trees.
1609  std::shared_ptr<RunAuxiliary> runAuxiliary = fillRunAuxiliary();
1610  assert(runAuxiliary->run() == indexIntoFileIter_.run());
1611  runHelper_->overrideRunNumber(runAuxiliary->id());
1612  filePtr_->reportInputRunNumber(runAuxiliary->run());
1613  // If RunAuxiliary did not contain a valid begin timestamp, invalidate any end timestamp.
1614  if (runAuxiliary->beginTime() == Timestamp::invalidTimestamp()) {
1615  runAuxiliary->setEndTime(Timestamp::invalidTimestamp());
1616  }
1617 
1618  // If RunAuxiliary did not contain a valid timestamp, or if this an old format file from
1619  // when the Run's ProcessHistory included only processes where products were added to the Run itself,
1620  // we attempt to read the first event in the run to get appropriate info.
1621  if (runAuxiliary->beginTime() == Timestamp::invalidTimestamp() ||
1624  // If we have a valid event, use its information.
1625  if (eventEntry != IndexIntoFile::invalidEntry) {
1626  assert(eventTree_.current(eventEntry));
1627  auto evtAux = fillEventAuxiliary(eventEntry);
1628 
1629  // RunAuxiliary did not contain a valid timestamp. Take it from the next event in this run if there is one.
1630  if (runAuxiliary->beginTime() == Timestamp::invalidTimestamp()) {
1631  runAuxiliary->setBeginTime(evtAux.time());
1632  }
1633 
1634  // For backwards compatibility when the Run's ProcessHistory included only processes where products were added to the
1635  // Run, and then the Run and Event auxiliaries could be different. Use the event ProcessHistoryID if there is one. It should
1636  // almost always be correct by the current definition (processes included if any products are added. This makes the run, lumi,
1637  // and event ProcessHistory's always be the same if no file merging occurs).
1639  EventSelectionIDVector eventSelectionIDs;
1640  BranchListIndexes branchListIndexes;
1641  fillEventHistory(evtAux, eventSelectionIDs, branchListIndexes);
1642  runAuxiliary->setProcessHistoryID(evtAux.processHistoryID());
1643  }
1644  }
1645  }
1646  savedRunAuxiliary_ = runAuxiliary;
1647  return runAuxiliary;
1648  }
1649 
1652  std::vector<unsigned int> nEntries;
1653  nEntries.reserve(processBlockTrees_.size());
1654  for (auto const& processBlockTree : processBlockTrees_) {
1655  nEntries.push_back(processBlockTree->entries());
1656  }
1657  processBlockHelper_->fillFromPrimaryInput(*storedProcessBlockHelper_, nEntries);
1659  std::make_unique<StoredProcessBlockHelper>(); // propagate_const<T> has no reset() function
1660  }
1661 
1664  processBlockTrees_[currentProcessBlockTree_]->setEntryNumber(0);
1666  return true;
1667  }
1668  return false;
1669  }
1670 
1672 
1675  if (endOfProcessBlocksReached()) {
1676  return false;
1677  }
1679  return true;
1680  }
1681  // With the current design, the RootFile should always be
1682  // set to a valid ProcessBlock entry in one of the TTrees
1683  // if it not at the end.
1685  // Try for next entry in the same TTree
1686  if (processBlockTrees_[currentProcessBlockTree_]->nextWithCache()) {
1687  return true;
1688  }
1689  // Next ProcessBlock TTree
1691  if (endOfProcessBlocksReached()) {
1692  return false;
1693  }
1694  // With current design there should always be at least one entry.
1695  // Initialize for that entry.
1696  processBlockTrees_[currentProcessBlockTree_]->setEntryNumber(0);
1698  return true;
1699  }
1700 
1704  rootTree->insertEntryForIndex(0);
1705  assert(!rootTree->processName().empty());
1706  processBlockPrincipal.fillProcessBlockPrincipal(rootTree->processName(), rootTree->resetAndGetRootDelayedReader());
1707  }
1708 
1709  void RootFile::readRun_(RunPrincipal& runPrincipal) {
1710  MergeableRunProductMetadata* mergeableRunProductMetadata = nullptr;
1711  if (inputType_ == InputType::Primary) {
1712  mergeableRunProductMetadata = runPrincipal.mergeableRunProductMetadata();
1713  RootTree::EntryNumber const& entryNumber = runTree_.entryNumber();
1714  assert(entryNumber >= 0);
1715  mergeableRunProductMetadata->readRun(
1717  }
1718 
1719  if (!runHelper_->fakeNewRun()) {
1723  }
1724  // Begin code for backward compatibility before the existence of run trees.
1725  if (!runTree_.isValid()) {
1726  return;
1727  }
1728  // End code for backward compatibility before the existence of run trees.
1729  // NOTE: we use 0 for the index since do not do delayed reads for RunPrincipals
1732  // Read in all the products now.
1733  runPrincipal.readAllFromSourceAndMergeImmediately(mergeableRunProductMetadata);
1734  }
1735 
1736  std::shared_ptr<LuminosityBlockAuxiliary> RootFile::readLuminosityBlockAuxiliary_() {
1739  // Begin code for backward compatibility before the existence of lumi trees.
1740  if (!lumiTree_.isValid()) {
1742  assert(eventEntry != IndexIntoFile::invalidEntry);
1743  assert(eventTree_.current(eventEntry));
1744  auto const evtAux = fillEventAuxiliary(eventEntry);
1745 
1747  runHelper_->overrideRunNumber(lumi);
1748  return std::make_shared<LuminosityBlockAuxiliary>(
1749  lumi.run(), lumi.luminosityBlock(), evtAux.time(), Timestamp::invalidTimestamp());
1750  }
1751  // End code for backward compatibility before the existence of lumi trees.
1753  std::shared_ptr<LuminosityBlockAuxiliary> lumiAuxiliary = fillLumiAuxiliary();
1754  assert(lumiAuxiliary->run() == indexIntoFileIter_.run());
1755  assert(lumiAuxiliary->luminosityBlock() == indexIntoFileIter_.lumi());
1756  runHelper_->overrideRunNumber(lumiAuxiliary->id());
1757  filePtr_->reportInputLumiSection(lumiAuxiliary->run(), lumiAuxiliary->luminosityBlock());
1758  if (lumiAuxiliary->beginTime() == Timestamp::invalidTimestamp()) {
1760  if (eventEntry != IndexIntoFile::invalidEntry) {
1761  assert(eventTree_.current(eventEntry));
1762  auto const evtAux = fillEventAuxiliary(eventEntry);
1763 
1764  lumiAuxiliary->setBeginTime(evtAux.time());
1765  }
1766  lumiAuxiliary->setEndTime(Timestamp::invalidTimestamp());
1767  }
1768  if (!fileFormatVersion().processHistorySameWithinRun() && savedRunAuxiliary_) {
1769  lumiAuxiliary->setProcessHistoryID(savedRunAuxiliary_->processHistoryID());
1770  }
1771  return lumiAuxiliary;
1772  }
1773 
1777  // Begin code for backward compatibility before the existence of lumi trees.
1778  if (!lumiTree_.isValid()) {
1780  return;
1781  }
1782  // End code for backward compatibility before the existence of lumi trees.
1784  // NOTE: we use 0 for the index since do not do delayed reads for LuminosityBlockPrincipals
1786  auto history = processHistoryRegistry_->getMapped(lumiPrincipal.aux().processHistoryID());
1788  // Read in all the products now.
1789  lumiPrincipal.readAllFromSourceAndMergeImmediately();
1791  }
1792 
1796  return false;
1798  return true;
1799  }
1800 
1804  return false;
1806  return true;
1807  }
1808 
1812  return false;
1814  return true;
1815  }
1816 
1820  }
1823  return false;
1824  if (run != indexIntoFileIter_.run())
1825  return false;
1826  if (lumi != indexIntoFileIter_.lumi())
1827  return false;
1828  //The following is used for its side effect of advancing the
1829  // eventTree entry.
1831  return true;
1832  }
1833 
1835  // Read in the event history tree, if we have one...
1836  if (fileFormatVersion().eventHistoryTree()) {
1837  history_ = std::make_unique<History>(); // propagate_const<T> has no reset() function
1838  eventHistoryTree_ = dynamic_cast<TTree*>(filePtr_->Get(poolNames::eventHistoryTreeName().c_str()));
1839  if (!eventHistoryTree_) {
1840  throw Exception(errors::EventCorruption) << "Failed to find the event history tree.\n";
1841  }
1842  }
1843  }
1844 
1846  std::vector<std::shared_ptr<IndexIntoFile>> const& indexesIntoFiles,
1847  std::vector<std::shared_ptr<IndexIntoFile>>::size_type currentIndexIntoFile) {
1848  if (duplicateChecker_ && !duplicateChecker_->checkDisabled()) {
1849  if (eventTree_.next()) {
1850  auto const evtAux = fillThisEventAuxiliary();
1851 
1852  duplicateChecker_->inputFileOpened(evtAux.isRealData(), indexIntoFile_, indexesIntoFiles, currentIndexIntoFile);
1853  }
1855  }
1856  }
1857 
1859  StoredProcessBlockHelper const& storedProcessBlockHelper) {
1860  // Set product presence information in the product registry.
1861  // "Presence" is a boolean that is true if and only if the TBranch exists
1862  // in the TTree (except it will be false for ProcessBlock products in non-Primary
1863  // input files).
1864  ProductRegistry::ProductList& pList = inputProdDescReg.productListUpdator();
1865  for (auto& product : pList) {
1866  BranchDescription& prod = product.second;
1867  prod.init();
1868  if (prod.branchType() == InProcess) {
1869  std::vector<std::string> const& processes = storedProcessBlockHelper.processesWithProcessBlockProducts();
1870  auto it = std::find(processes.begin(), processes.end(), prod.processName());
1871  if (it != processes.end()) {
1872  auto index = std::distance(processes.begin(), it);
1873  processBlockTrees_[index]->setPresence(prod, newBranchToOldBranch(prod.branchName()));
1874  } else {
1875  // Given current rules for saving BranchDescriptions, this case should only occur
1876  // in non-Primary sequences.
1877  prod.setDropped(true);
1878  }
1879  } else {
1880  treePointers_[prod.branchType()]->setPresence(prod, newBranchToOldBranch(prod.branchName()));
1881  }
1882  }
1883  }
1884 
1885  void RootFile::markBranchToBeDropped(bool dropDescendants,
1886  BranchDescription const& branch,
1887  std::set<BranchID>& branchesToDrop,
1888  std::map<BranchID, BranchID> const& droppedToKeptAlias) const {
1889  if (dropDescendants) {
1890  branchChildren_->appendToDescendants(branch, branchesToDrop, droppedToKeptAlias);
1891  } else {
1892  branchesToDrop.insert(branch.branchID());
1893  }
1894  }
1895 
1897  ProductSelectorRules const& rules,
1898  bool dropDescendants,
1899  InputType inputType,
1900  StoredProcessBlockHelper& storedProcessBlockHelper,
1901  ProcessBlockHelper const* processBlockHelper) {
1903 
1904  // First fill in a map we will need to navigate to descendants
1905  // in the case of EDAliases.
1906  std::map<BranchID, BranchID> droppedToKeptAlias;
1907  for (auto const& product : prodList) {
1908  BranchDescription const& prod = product.second;
1909  if (prod.branchID() != prod.originalBranchID() && prod.present()) {
1910  droppedToKeptAlias[prod.originalBranchID()] = prod.branchID();
1911  }
1912  }
1913 
1914  // This object will select products based on the branchName and the
1915  // keep and drop statements which are in the source configuration.
1916  ProductSelector productSelector;
1917  productSelector.initialize(rules, reg.allBranchDescriptions());
1918 
1919  // In this pass, fill in a set of branches to be dropped.
1920  // Don't drop anything yet.
1921  std::set<BranchID> branchesToDrop;
1922  std::vector<BranchDescription const*> associationDescriptions;
1923  for (auto const& product : prodList) {
1924  BranchDescription const& prod = product.second;
1925  if (inputType != InputType::Primary && prod.branchType() == InProcess) {
1926  markBranchToBeDropped(dropDescendants, prod, branchesToDrop, droppedToKeptAlias);
1927  } else if (prod.unwrappedType() == typeid(ThinnedAssociation) && prod.present()) {
1928  // Special handling for ThinnedAssociations
1929  if (inputType != InputType::SecondarySource) {
1930  associationDescriptions.push_back(&prod);
1931  } else {
1932  markBranchToBeDropped(dropDescendants, prod, branchesToDrop, droppedToKeptAlias);
1933  }
1934  } else if (!productSelector.selected(prod)) {
1935  markBranchToBeDropped(dropDescendants, prod, branchesToDrop, droppedToKeptAlias);
1936  }
1937  }
1938 
1939  if (inputType != InputType::SecondarySource) {
1940  // Decide whether to keep the thinned associations and corresponding
1941  // entries in the helper. For secondary source they are all dropped,
1942  // but in other cases we look for thinned collections the associations
1943  // redirect a Ref or Ptr to when dereferencing them.
1944 
1945  // Need a list of kept products in order to determine which thinned associations
1946  // are kept.
1947  std::set<BranchID> keptProductsInEvent;
1948  for (auto const& product : prodList) {
1949  BranchDescription const& prod = product.second;
1950  if (branchesToDrop.find(prod.branchID()) == branchesToDrop.end() && prod.present() &&
1951  prod.branchType() == InEvent) {
1952  keptProductsInEvent.insert(prod.branchID());
1953  }
1954  }
1955 
1956  // Decide which ThinnedAssociations to keep and store the decision in keepAssociation
1957  std::map<BranchID, bool> keepAssociation;
1958  fileThinnedAssociationsHelper_->selectAssociationProducts(
1959  associationDescriptions, keptProductsInEvent, keepAssociation);
1960 
1961  for (auto association : associationDescriptions) {
1962  if (!keepAssociation[association->branchID()]) {
1963  markBranchToBeDropped(dropDescendants, *association, branchesToDrop, droppedToKeptAlias);
1964  }
1965  }
1966 
1967  // Also delete the dropped associations from the ThinnedAssociationsHelper
1968  auto temp = std::make_unique<ThinnedAssociationsHelper>();
1969  for (auto const& associationBranches : fileThinnedAssociationsHelper_->data()) {
1970  auto iter = keepAssociation.find(associationBranches.association());
1971  if (iter != keepAssociation.end() && iter->second) {
1972  temp->addAssociation(associationBranches);
1973  }
1974  }
1975  // propagate_const<T> has no reset() function
1976  fileThinnedAssociationsHelper_ = std::unique_ptr<ThinnedAssociationsHelper>(temp.release());
1977  }
1978 
1979  // On this pass, actually drop the branches.
1980  std::set<std::string> processesWithKeptProcessBlockProducts;
1981  std::set<BranchID>::const_iterator branchesToDropEnd = branchesToDrop.end();
1982  for (ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1983  BranchDescription const& prod = it->second;
1984  bool drop = branchesToDrop.find(prod.branchID()) != branchesToDropEnd;
1985  if (drop) {
1986  if (!prod.dropped()) {
1987  if (productSelector.selected(prod) && prod.unwrappedType() != typeid(ThinnedAssociation) &&
1988  prod.branchType() != InProcess) {
1989  LogWarning("RootFile") << "Branch '" << prod.branchName() << "' is being dropped from the input\n"
1990  << "of file '" << file_ << "' because it is dependent on a branch\n"
1991  << "that was explicitly dropped.\n";
1992  }
1993  if (prod.branchType() == InProcess) {
1994  std::vector<std::string> const& processes = storedProcessBlockHelper.processesWithProcessBlockProducts();
1995  auto it = std::find(processes.begin(), processes.end(), prod.processName());
1996  assert(it != processes.end());
1997  auto index = std::distance(processes.begin(), it);
1998  processBlockTrees_[index]->dropBranch(newBranchToOldBranch(prod.branchName()));
1999  } else {
2000  treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName()));
2001  }
2002  hasNewlyDroppedBranch_[prod.branchType()] = true;
2003  }
2004  ProductRegistry::ProductList::iterator icopy = it;
2005  ++it;
2006  prodList.erase(icopy);
2007  } else {
2008  if (prod.branchType() == InProcess && prod.present()) {
2009  processesWithKeptProcessBlockProducts.insert(prod.processName());
2010  }
2011  ++it;
2012  }
2013  }
2014 
2015  dropProcessesAndReorder(storedProcessBlockHelper, processesWithKeptProcessBlockProducts, processBlockHelper);
2016 
2017  // Drop on input mergeable run and lumi products, this needs to be invoked for secondary file input
2018  if (inputType == InputType::SecondaryFile) {
2019  TString tString;
2020  for (ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
2021  BranchDescription const& prod = it->second;
2022  if (prod.branchType() != InEvent && prod.branchType() != InProcess) {
2023  TClass* cp = prod.wrappedType().getClass();
2024  void* p = cp->New();
2025  int offset = cp->GetBaseClassOffset(edProductClass_);
2026  std::unique_ptr<WrapperBase> edp = getWrapperBasePtr(p, offset);
2027  if (edp->isMergeable()) {
2028  treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName()));
2029  ProductRegistry::ProductList::iterator icopy = it;
2030  ++it;
2031  prodList.erase(icopy);
2032  } else {
2033  ++it;
2034  }
2035  } else
2036  ++it;
2037  }
2038  }
2039  }
2040 
2042  std::set<std::string> const& processesWithKeptProcessBlockProducts,
2043  ProcessBlockHelper const* processBlockHelper) {
2044  // Modify storedProcessBlockHelper and processBlockTrees_
2045  // This should account for dropOnInput and also make the
2046  // order of process blocks in input files after the first
2047  // be the same as the first. Processes with no ProcessBlock
2048  // products should be removed. After this executes,
2049  // the items in storedProcessBlockHelper
2050  // and processBlockTrees should be in exact one to one
2051  // correspondence and in the same order. For input files
2052  // after the first, these items should be either the same
2053  // as or a subset of the items in processBlockHelper and in
2054  // the same order.
2055 
2056  if (processBlockTrees_.empty()) {
2057  return;
2058  }
2059 
2060  std::vector<unsigned int> nEntries;
2061  nEntries.reserve(processBlockTrees_.size());
2062  for (auto const& processBlockTree : processBlockTrees_) {
2063  nEntries.push_back(processBlockTree->entries());
2064  }
2065 
2066  bool firstInputFile = !processBlockHelper->initializedFromInput();
2067  bool isModified = false;
2068  std::vector<unsigned int> finalIndexToStoredIndex;
2069 
2070  if (firstInputFile) {
2071  isModified = processBlockHelper->firstFileDropProcessesAndReorderStored(
2072  storedProcessBlockHelper, processesWithKeptProcessBlockProducts, nEntries, finalIndexToStoredIndex);
2073  } else {
2074  isModified =
2075  processBlockHelper->dropProcessesAndReorderStored(storedProcessBlockHelper,
2076  processesWithKeptProcessBlockProducts,
2077  nEntries,
2078  finalIndexToStoredIndex,
2079  processBlockHelper->processesWithProcessBlockProducts());
2080  }
2081 
2082  // At this point, any modifications to storedProcessBlockHelper are done.
2083  // Make consistent changes to processBlockTrees_ and this will cause
2084  // unneeded RootTrees to be deleted.
2085  if (isModified) {
2086  std::vector<edm::propagate_const<std::unique_ptr<RootTree>>> newProcessBlockTrees;
2087  unsigned int nFinalProducts = storedProcessBlockHelper.processesWithProcessBlockProducts().size();
2088  for (unsigned int j = 0; j < nFinalProducts; ++j) {
2089  unsigned int iStored = finalIndexToStoredIndex[j];
2090  newProcessBlockTrees.push_back(std::move(processBlockTrees_[iStored]));
2091  }
2092  processBlockTrees_.swap(newProcessBlockTrees);
2093  }
2094  }
2095 
2097  signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)> const* preEventReadSource,
2098  signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)> const* postEventReadSource) {
2099  eventTree_.setSignals(preEventReadSource, postEventReadSource);
2100  }
2101 
2102  void RootFile::makeProcessBlockRootTrees(std::shared_ptr<InputFile> filePtr,
2103  int treeMaxVirtualSize,
2104  bool enablePrefetching,
2105  InputType inputType,
2106  StoredProcessBlockHelper const& storedProcessBlockHelper) {
2107  // When this functions returns there will be exactly a 1-to-1 correspondence between the
2108  // processes listed in storedProcessBlockHelper and the RootTree objects created. processBlockTrees_
2109  // has pointers to the RootTree's and will be filled in the same order. The RootTree constructor
2110  // will throw an exception if one of these TTree's is not in the file and this should be all of
2111  // the ProcessBlock TTree's in the file. (later in the RootFile constructor, dropOnInput might
2112  // remove some and also reordering may occur).
2113  for (auto const& process : storedProcessBlockHelper.processesWithProcessBlockProducts()) {
2114  processBlockTrees_.emplace_back(std::make_unique<RootTree>(filePtr,
2115  InProcess,
2116  process,
2117  1,
2118  treeMaxVirtualSize,
2121  enablePrefetching,
2122  inputType));
2123  }
2124  }
2125 
2126  std::unique_ptr<MakeProvenanceReader> RootFile::makeProvenanceReaderMaker(InputType inputType) {
2128  readParentageTree(inputType);
2129  return std::make_unique<MakeReducedProvenanceReader>(parentageIDLookup_);
2130  } else if (fileFormatVersion_.splitProductIDs()) {
2131  readParentageTree(inputType);
2132  return std::make_unique<MakeFullProvenanceReader>();
2133  } else if (fileFormatVersion_.perEventProductIDs()) {
2134  auto entryDescriptionMap = std::make_unique<EntryDescriptionMap>();
2135  readEntryDescriptionTree(*entryDescriptionMap, inputType);
2136  return std::make_unique<MakeOldProvenanceReader>(std::move(entryDescriptionMap));
2137  } else {
2138  return std::make_unique<MakeDummyProvenanceReader>();
2139  }
2140  }
2141 
2142  std::shared_ptr<ProductProvenanceRetriever> RootFile::makeProductProvenanceRetriever(unsigned int iStreamID) {
2143  if (eventProductProvenanceRetrievers_.size() <= iStreamID) {
2144  eventProductProvenanceRetrievers_.resize(iStreamID + 1);
2145  }
2146  if (!eventProductProvenanceRetrievers_[iStreamID]) {
2147  // propagate_const<T> has no reset() function
2148  eventProductProvenanceRetrievers_[iStreamID] = std::make_shared<ProductProvenanceRetriever>(
2150  }
2151  eventProductProvenanceRetrievers_[iStreamID]->reset();
2152  return eventProductProvenanceRetriever(iStreamID);
2153  }
2154 
2156  public:
2157  ReducedProvenanceReader(RootTree* iRootTree,
2158  std::vector<ParentageID> const& iParentageIDLookup,
2159  DaqProvenanceHelper const* daqProvenanceHelper);
2160 
2161  std::set<ProductProvenance> readProvenance(unsigned int) const override;
2162 
2163  private:
2165  ModuleCallingContext const* moduleCallingContext,
2166  unsigned int transitionIndex,
2167  std::atomic<const std::set<ProductProvenance>*>& writeTo) const override;
2168 
2173  std::vector<ParentageID> const& parentageIDLookup_;
2175  std::shared_ptr<std::recursive_mutex> mutex_;
2177  };
2178 
2180  std::vector<ParentageID> const& iParentageIDLookup,
2181  DaqProvenanceHelper const* daqProvenanceHelper)
2183  rootTree_(iRootTree),
2184  pProvVector_(&provVector_),
2185  parentageIDLookup_(iParentageIDLookup),
2186  daqProvenanceHelper_(daqProvenanceHelper),
2187  mutex_(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader().second),
2188  acquirer_(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader().first) {
2189  provBranch_ =
2190  rootTree_->tree()->GetBranch(BranchTypeToProductProvenanceBranchName(rootTree_->branchType()).c_str());
2191  }
2192 
2193  namespace {
2194  using SignalType = signalslot::Signal<void(StreamContext const&, ModuleCallingContext const&)>;
2195  template <typename R>
2196  void readProvenanceAsyncImpl(R const* iThis,
2197  SerialTaskQueueChain& chain,
2199  unsigned int transitionIndex,
2200  std::atomic<const std::set<ProductProvenance>*>& writeTo,
2201  ModuleCallingContext const* iContext,
2202  SignalType const* pre,
2203  SignalType const* post) {
2204  if (nullptr == writeTo.load()) {
2205  //need to be sure the task isn't run until after the read
2206  WaitingTaskHolder taskHolder{task};
2207  auto pWriteTo = &writeTo;
2208 
2209  auto serviceToken = ServiceRegistry::instance().presentToken();
2210 
2211  chain.push(
2212  *taskHolder.group(),
2213  [holder = std::move(taskHolder),
2214  pWriteTo,
2215  iThis,
2216  transitionIndex,
2217  iContext,
2218  pre,
2219  post,
2220  serviceToken]() mutable {
2221  if (nullptr == pWriteTo->load()) {
2222  ServiceRegistry::Operate operate(serviceToken);
2223  std::unique_ptr<const std::set<ProductProvenance>> prov;
2224  try {
2225  if (pre) {
2226  pre->emit(*(iContext->getStreamContext()), *iContext);
2227  }
2228  prov = std::make_unique<const std::set<ProductProvenance>>(iThis->readProvenance(transitionIndex));
2229  if (post) {
2230  post->emit(*(iContext->getStreamContext()), *iContext);
2231  }
2232 
2233  } catch (...) {
2234  if (post) {
2235  post->emit(*(iContext->getStreamContext()), *iContext);
2236  }
2237 
2238  holder.doneWaiting(std::current_exception());
2239  return;
2240  }
2241  const std::set<ProductProvenance>* expected = nullptr;
2242 
2243  if (pWriteTo->compare_exchange_strong(expected, prov.get())) {
2244  prov.release();
2245  }
2246  }
2247  holder.doneWaiting(std::exception_ptr());
2248  });
2249  }
2250  }
2251  } // namespace
2252 
2254  ModuleCallingContext const* moduleCallingContext,
2255  unsigned int transitionIndex,
2256  std::atomic<const std::set<ProductProvenance>*>& writeTo) const {
2257  readProvenanceAsyncImpl(this,
2259  task,
2260  transitionIndex,
2261  writeTo,
2262  moduleCallingContext,
2263  rootTree_->rootDelayedReader()->preEventReadFromSourceSignal(),
2264  rootTree_->rootDelayedReader()->postEventReadFromSourceSignal());
2265  }
2266 
2267  std::set<ProductProvenance> ReducedProvenanceReader::readProvenance(unsigned int transitionIndex) const {
2268  {
2269  std::lock_guard<std::recursive_mutex> guard(*mutex_);
2270  ReducedProvenanceReader* me = const_cast<ReducedProvenanceReader*>(this);
2271  me->rootTree_->fillBranchEntry(
2272  me->provBranch_, me->rootTree_->entryNumberForIndex(transitionIndex), me->pProvVector_);
2273  }
2274  std::set<ProductProvenance> retValue;
2275  if (daqProvenanceHelper_) {
2276  for (auto const& prov : provVector_) {
2277  BranchID bid(prov.branchID_);
2278  retValue.emplace(daqProvenanceHelper_->mapBranchID(BranchID(prov.branchID_)),
2279  daqProvenanceHelper_->mapParentageID(parentageIDLookup_[prov.parentageIDIndex_]));
2280  }
2281  } else {
2282  for (auto const& prov : provVector_) {
2283  if (prov.parentageIDIndex_ >= parentageIDLookup_.size()) {
2285  << "ReducedProvenanceReader::ReadProvenance\n"
2286  << "The parentage ID index value " << prov.parentageIDIndex_
2287  << " is out of bounds. The maximum value is " << parentageIDLookup_.size() - 1 << ".\n"
2288  << "This should never happen.\n"
2289  << "Please report this to the framework hypernews forum 'hn-cms-edmFramework@cern.ch'.\n";
2290  }
2291  retValue.emplace(BranchID(prov.branchID_), parentageIDLookup_[prov.parentageIDIndex_]);
2292  }
2293  }
2294  return retValue;
2295  }
2296 
2298  public:
2299  explicit FullProvenanceReader(RootTree* rootTree, DaqProvenanceHelper const* daqProvenanceHelper);
2301  std::set<ProductProvenance> readProvenance(unsigned int transitionIndex) const override;
2302 
2303  private:
2305  ModuleCallingContext const* moduleCallingContext,
2306  unsigned int transitionIndex,
2307  std::atomic<const std::set<ProductProvenance>*>& writeTo) const override;
2308 
2311  //All access to a ROOT file is serialized
2314  std::shared_ptr<std::recursive_mutex> mutex_;
2316  };
2317 
2320  rootTree_(rootTree),
2321  infoVector_(),
2322  pInfoVector_(&infoVector_),
2323  daqProvenanceHelper_(daqProvenanceHelper),
2324  mutex_(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader().second),
2325  acquirer_(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader().first) {}
2326 
2328  ModuleCallingContext const* moduleCallingContext,
2329  unsigned int transitionIndex,
2330  std::atomic<const std::set<ProductProvenance>*>& writeTo) const {
2331  readProvenanceAsyncImpl(this,
2333  task,
2334  transitionIndex,
2335  writeTo,
2336  moduleCallingContext,
2339  }
2340 
2341  std::set<ProductProvenance> FullProvenanceReader::readProvenance(unsigned int transitionIndex) const {
2342  {
2343  std::lock_guard<std::recursive_mutex> guard(*mutex_);
2346  }
2347  std::set<ProductProvenance> retValue;
2348  if (daqProvenanceHelper_) {
2349  for (auto const& info : infoVector_) {
2350  retValue.emplace(daqProvenanceHelper_->mapBranchID(info.branchID()),
2351  daqProvenanceHelper_->mapParentageID(info.parentageID()));
2352  }
2353  } else {
2354  for (auto const& info : infoVector_) {
2355  retValue.emplace(info);
2356  }
2357  }
2358  return retValue;
2359  }
2360 
2362  public:
2363  explicit OldProvenanceReader(RootTree* rootTree,
2364  EntryDescriptionMap const& theMap,
2365  DaqProvenanceHelper const* daqProvenanceHelper);
2366  ~OldProvenanceReader() override {}
2367  std::set<ProductProvenance> readProvenance(unsigned int transitionIndex) const override;
2368 
2369  private:
2371  ModuleCallingContext const* moduleCallingContext,
2372  unsigned int transitionIndex,
2373  std::atomic<const std::set<ProductProvenance>*>& writeTo) const override;
2374 
2376  std::vector<EventEntryInfo> infoVector_;
2377  //All access to ROOT file are serialized
2378  CMS_SA_ALLOW mutable std::vector<EventEntryInfo>* pInfoVector_;
2381  std::shared_ptr<std::recursive_mutex> mutex_;
2383  };
2384 
2386  EntryDescriptionMap const& theMap,
2387  DaqProvenanceHelper const* daqProvenanceHelper)
2389  rootTree_(rootTree),
2390  infoVector_(),
2391  pInfoVector_(&infoVector_),
2392  entryDescriptionMap_(theMap),
2393  daqProvenanceHelper_(daqProvenanceHelper),
2394  mutex_(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader().second),
2395  acquirer_(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader().first) {}
2396 
2398  ModuleCallingContext const* moduleCallingContext,
2399  unsigned int transitionIndex,
2400  std::atomic<const std::set<ProductProvenance>*>& writeTo) const {
2401  readProvenanceAsyncImpl(this,
2403  task,
2404  transitionIndex,
2405  writeTo,
2406  moduleCallingContext,
2407  rootTree_->rootDelayedReader()->preEventReadFromSourceSignal(),
2408  rootTree_->rootDelayedReader()->postEventReadFromSourceSignal());
2409  }
2410 
2411  std::set<ProductProvenance> OldProvenanceReader::readProvenance(unsigned int transitionIndex) const {
2412  {
2413  std::lock_guard<std::recursive_mutex> guard(*mutex_);
2414  rootTree_->branchEntryInfoBranch()->SetAddress(&pInfoVector_);
2415  roottree::getEntry(rootTree_->branchEntryInfoBranch(), rootTree_->entryNumberForIndex(transitionIndex));
2416  }
2417  std::set<ProductProvenance> retValue;
2418  for (auto const& info : infoVector_) {
2419  EntryDescriptionMap::const_iterator iter = entryDescriptionMap_.find(info.entryDescriptionID());
2420  assert(iter != entryDescriptionMap_.end());
2421  Parentage parentage(iter->second.parents());
2422  if (daqProvenanceHelper_) {
2423  retValue.emplace(daqProvenanceHelper_->mapBranchID(info.branchID()),
2424  daqProvenanceHelper_->mapParentageID(parentage.id()));
2425  } else {
2426  retValue.emplace(info.branchID(), parentage.id());
2427  }
2428  }
2429  return retValue;
2430  }
2431 
2433  public:
2436 
2437  private:
2438  std::set<ProductProvenance> readProvenance(unsigned int) const override;
2440  ModuleCallingContext const* moduleCallingContext,
2441  unsigned int transitionIndex,
2442  std::atomic<const std::set<ProductProvenance>*>& writeTo) const override;
2443  };
2444 
2446 
2447  std::set<ProductProvenance> DummyProvenanceReader::readProvenance(unsigned int) const {
2448  // Not providing parentage!!!
2449  return std::set<ProductProvenance>{};
2450  }
2452  ModuleCallingContext const* moduleCallingContext,
2453  unsigned int transitionIndex,
2454  std::atomic<const std::set<ProductProvenance>*>& writeTo) const {
2455  if (nullptr == writeTo.load()) {
2456  auto emptyProv = std::make_unique<const std::set<ProductProvenance>>();
2457  const std::set<ProductProvenance>* expected = nullptr;
2458  if (writeTo.compare_exchange_strong(expected, emptyProv.get())) {
2459  emptyProv.release();
2460  }
2461  }
2462  }
2463 
2464  std::unique_ptr<ProvenanceReaderBase> MakeDummyProvenanceReader::makeReader(RootTree&,
2465  DaqProvenanceHelper const*) const {
2466  return std::make_unique<DummyProvenanceReader>();
2467  }
2468 
2469  std::unique_ptr<ProvenanceReaderBase> MakeOldProvenanceReader::makeReader(
2470  RootTree& rootTree, DaqProvenanceHelper const* daqProvenanceHelper) const {
2471  return std::make_unique<OldProvenanceReader>(&rootTree, *entryDescriptionMap_, daqProvenanceHelper);
2472  }
2473 
2474  std::unique_ptr<ProvenanceReaderBase> MakeFullProvenanceReader::makeReader(
2475  RootTree& rootTree, DaqProvenanceHelper const* daqProvenanceHelper) const {
2476  return std::make_unique<FullProvenanceReader>(&rootTree, daqProvenanceHelper);
2477  }
2478 
2479  std::unique_ptr<ProvenanceReaderBase> MakeReducedProvenanceReader::makeReader(
2480  RootTree& rootTree, DaqProvenanceHelper const* daqProvenanceHelper) const {
2481  return std::make_unique<ReducedProvenanceReader>(&rootTree, parentageIDLookup_, daqProvenanceHelper);
2482  }
2483 } // namespace edm
edm::poolNames::idToParameterSetBlobsBranchName
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:218
edm::SharedResourcesAcquirer::serialQueueChain
SerialTaskQueueChain & serialQueueChain() const
Definition: SharedResourcesAcquirer.h:54
edm::IndexIntoFile::IndexIntoFileItr::copyPosition
void copyPosition(IndexIntoFileItr const &position)
Copy the position without modifying the pointer to the IndexIntoFile or size.
Definition: IndexIntoFile.cc:1760
edm::pset::Registry::instance
static Registry * instance()
Definition: Registry.cc:12
edm::FullProvenanceReader::pInfoVector_
ProductProvenanceVector * pInfoVector_
Definition: RootFile.cc:2312
edm::IndexIntoFile::doneFileInitialization
void doneFileInitialization()
Clears the temporary vector of event numbers to reduce memory usage.
Definition: IndexIntoFile.cc:306
edm::RootTree::tree
TTree const * tree() const
Definition: RootTree.h:169
edm::FileFormatVersion::hasThinnedAssociations
bool hasThinnedAssociations() const
Definition: FileFormatVersion.cc:45
ParameterSetConverter.h
edm::RootFile::endOfProcessBlocksReached
bool endOfProcessBlocksReached() const
Definition: RootFile.cc:1671
edm::RootFileEventFinder::~RootFileEventFinder
~RootFileEventFinder() override
Definition: RootFile.cc:128
edm::SharedResourcesAcquirer
Definition: SharedResourcesAcquirer.h:34
RunAux.h
edm::IndexIntoFile::IndexIntoFileItr::run
RunNumber_t run() const
Definition: IndexIntoFile.h:702
ThinnedAssociationsHelper.h
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
edm::source
static const std::string source("source")
edm::EventToProcessBlockIndexes::setIndex
void setIndex(unsigned int value)
Definition: EventToProcessBlockIndexes.h:17
edm::roottree::EntryNumber
IndexIntoFile::EntryNumber_t EntryNumber
Definition: RootTree.h:42
edm::EventAuxiliary::event
EventNumber_t event() const
Definition: EventAuxiliary.h:72
edm::IndexIntoFile::kLumi
Definition: IndexIntoFile.h:238
ProcessHistoryID.h
FriendlyName.h
edm::IndexIntoFile::IndexIntoFileItr::firstEventEntryThisLumi
EntryNumber_t firstEventEntryThisLumi()
Definition: IndexIntoFile.h:720
edm::RootFile::eventSkipperByID_
edm::propagate_const< std::shared_ptr< EventSkipperByID > > eventSkipperByID_
Definition: RootFile.h:360
edm::poolNames::branchIDListBranchName
std::string const & branchIDListBranchName()
Definition: BranchType.cc:183
edm::EventPrincipal::aux
EventAuxiliary const & aux() const
Definition: EventPrincipal.h:108
edm::RootFileEventFinder
Definition: RootFile.cc:125
edm::RootTree::trainCache
void trainCache(char const *branchNames)
Definition: RootTree.cc:478
ModuleCallingContext.h
edm::FileID::isValid
bool isValid() const
Definition: FileID.h:18
RunHelper.h
edm::ProcessHistoryRegistry::registerProcessHistory
bool registerProcessHistory(ProcessHistory const &processHistory)
Definition: ProcessHistoryRegistry.cc:11
edm::EventEntryDescription
Definition: EventEntryDescription.h:28
mps_fire.i
i
Definition: mps_fire.py:428
edm::IndexIntoFile::IndexIntoFileItr::lumi
LuminosityBlockNumber_t lumi() const
Definition: IndexIntoFile.h:703
edm::RootTree::setEntryNumber
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:219
edm::RootFile::eventProductProvenanceRetrievers_
std::vector< edm::propagate_const< std::shared_ptr< ProductProvenanceRetriever > > > eventProductProvenanceRetrievers_
Definition: RootFile.h:406
edm::FileFormatVersion::useReducedProcessHistoryID
bool useReducedProcessHistoryID() const
Definition: FileFormatVersion.cc:43
edm::RootTree::rootDelayedReader
DelayedReader * rootDelayedReader() const
Definition: RootTree.cc:147
edm::RootFile::eventProcessHistoryIter_
std::vector< EventProcessHistoryID >::const_iterator eventProcessHistoryIter_
Definition: RootFile.h:371
edm::RootFile::makeProductProvenanceRetriever
std::shared_ptr< ProductProvenanceRetriever > makeProductProvenanceRetriever(unsigned int iStreamIndex)
Definition: RootFile.cc:2142
DuplicateChecker.h
edm::EventToProcessBlockIndexes
Definition: EventToProcessBlockIndexes.h:12
edm::poolNames::fileFormatVersionBranchName
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:189
edm::FileFormatVersion::splitProductIDs
bool splitProductIDs() const
Definition: FileFormatVersion.cc:21
ServiceRegistry.h
edm::ReducedProvenanceReader::provBranch_
edm::propagate_const< TBranch * > provBranch_
Definition: RootFile.cc:2170
MessageLogger.h
edm::RootFile::readProcessBlock_
void readProcessBlock_(ProcessBlockPrincipal &)
Definition: RootFile.cc:1701
edm::find_in_all
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
Definition: Algorithms.h:26
funct::false
false
Definition: Factorize.h:29
edm::conversion
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
edm::roottree::trainCache
std::unique_ptr< TTreeCache > trainCache(TTree *tree, InputFile &file, unsigned int cacheSize, char const *branchNames)
Definition: RootTree.cc:535
edm::getWrapperBasePtr
std::unique_ptr< WrapperBase > getWrapperBasePtr(void *p, int offset)
Definition: getWrapperBasePtr.h:8
edm::roottree::defaultNonEventLearningEntries
unsigned const int defaultNonEventLearningEntries
Definition: RootTree.h:41
edm::IndexIntoFile::iterationWillBeInEntryOrder
bool iterationWillBeInEntryOrder(SortOrder sortOrder) const
Used to determine whether or not to disable fast cloning.
Definition: IndexIntoFile.cc:474
edm::OldProvenanceReader::readProvenanceAsync
void readProvenanceAsync(WaitingTaskHolder task, ModuleCallingContext const *moduleCallingContext, unsigned int transitionIndex, std::atomic< const std::set< ProductProvenance > * > &writeTo) const override
Definition: RootFile.cc:2397
edm::RootFile::productRegistry
std::shared_ptr< ProductRegistry const > productRegistry() const
Definition: RootFile.h:235
edm::DaqProvenanceHelper::mapParentageID
ParentageID const & mapParentageID(ParentageID const &phid) const
Definition: DaqProvenanceHelper.cc:182
edm::ReducedProvenanceReader::provVector_
StoredProductProvenanceVector provVector_
Definition: RootFile.cc:2171
edm::RootFile::lumiTree_
RootTree lumiTree_
Definition: RootFile.h:381
edm::RunID
Definition: RunID.h:28
edm::RootFile::processHistoryRegistry_
edm::propagate_const< ProcessHistoryRegistry * > processHistoryRegistry_
Definition: RootFile.h:358
edm::RootFile::indexIntoFileEnd_
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:367
edm::RootFile::daqProvenanceHelper_
edm::propagate_const< std::unique_ptr< DaqProvenanceHelper > > daqProvenanceHelper_
Definition: RootFile.h:408
edm::IndexIntoFile::findRunPosition
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
Definition: IndexIntoFile.cc:692
edm::RootFile::runHelper_
edm::propagate_const< RunHelperBase * > runHelper_
Definition: RootFile.h:396
LumiList
Definition: LumiList.py:1
edm::RootFile::readParentageTree
void readParentageTree(InputType inputType)
Definition: RootFile.cc:680
getWrapperBasePtr.h
edm::OldProvenanceReader::infoVector_
std::vector< EventEntryInfo > infoVector_
Definition: RootFile.cc:2376
edm::setIsMergeable
void setIsMergeable(BranchDescription &)
Definition: setIsMergeable.cc:15
edm::FullProvenanceReader::daqProvenanceHelper_
DaqProvenanceHelper const * daqProvenanceHelper_
Definition: RootFile.cc:2313
HLT_FULL_cff.finder
finder
Definition: HLT_FULL_cff.py:51974
edm::ProcessBlockHelper::firstFileDropProcessesAndReorderStored
bool firstFileDropProcessesAndReorderStored(StoredProcessBlockHelper &storedProcessBlockHelper, std::set< std::string > const &processesToKeep, std::vector< unsigned int > const &nEntries, std::vector< unsigned int > &finalIndexToStoredIndex) const
Definition: ProcessBlockHelper.cc:47
RunList
Definition: RunList.h:16
edm::RootFile::eventHistoryTree_
edm::propagate_const< TTree * > eventHistoryTree_
Definition: RootFile.h:398
edm::RootFile::reportOpened
void reportOpened(std::string const &inputType)
Definition: RootFile.cc:1269
edm::RootFile::readLuminosityBlock_
void readLuminosityBlock_(LuminosityBlockPrincipal &lumiPrincipal)
Definition: RootFile.cc:1774
edm::errors::LogicError
Definition: EDMException.h:37
edm::FileID::fid
std::string const & fid() const
Definition: FileID.h:19
BranchIDListHelper.h
edm::RootFile::branchListIndexesUnchanged
bool branchListIndexesUnchanged() const
Definition: RootFile.h:245
edm::IndexIntoFile::kEvent
Definition: IndexIntoFile.h:238
converter
Definition: CandidateProducer.h:25
WaitingTaskHolder.h
edm::ProvenanceReaderBase
Definition: ProductProvenanceRetriever.h:26
edm::RootFile::close
void close()
Definition: RootFile.cc:1276
edm::IndexIntoFile::setNumberOfEvents
void setNumberOfEvents(EntryNumber_t nevents)
Definition: IndexIntoFile.h:945
edm::IndexIntoFile::IndexIntoFileItr::peekAheadAtLumi
LuminosityBlockNumber_t peekAheadAtLumi() const
Definition: IndexIntoFile.h:708
edm::IndexIntoFile::numericalOrder
Definition: IndexIntoFile.h:266
MicroEventContent_cff.branch
branch
Definition: MicroEventContent_cff.py:174
edm::RootFile::runTree
RootTree const & runTree() const
Definition: RootFile.h:241
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::FullProvenanceReader::acquirer_
SharedResourcesAcquirer acquirer_
Definition: RootFile.cc:2315
edm::Principal::readAllFromSourceAndMergeImmediately
void readAllFromSourceAndMergeImmediately(MergeableRunProductMetadata const *mergeableRunProductMetadata=nullptr)
Definition: Principal.cc:968
mps_splice.entry
entry
Definition: mps_splice.py:68
edm::RootFile::initializeFirstProcessBlockEntry
bool initializeFirstProcessBlockEntry()
Definition: RootFile.cc:1662
edm::RootFileEventFinder::RootFileEventFinder
RootFileEventFinder(RootTree &eventTree)
Definition: RootFile.cc:127
edm::RootTree::processName
std::string const & processName() const
Definition: RootTree.h:185
tree
Definition: tree.py:1
ParameterSetBlob.h
edm::ProcessBlockHelper::initializedFromInput
bool initializedFromInput() const
Definition: ProcessBlockHelper.h:31
edm::RootFile::indexIntoFileIter_
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:368
edm::MakeDummyProvenanceReader
Definition: RootFile.cc:76
edm::ProductSelector::initialize
void initialize(ProductSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
Definition: ProductSelector.cc:20
edm::errors::EventCorruption
Definition: EDMException.h:43
edm::ParentageRegistry::instance
static ParentageRegistry * instance()
Definition: ParentageRegistry.cc:5
edm::RootFile::readRunAuxiliary_
std::shared_ptr< RunAuxiliary > readRunAuxiliary_()
Definition: RootFile.cc:1584
edm::moduleName
std::string moduleName(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:27
edm::RootTree::fillBranchEntryMeta
void fillBranchEntryMeta(TBranch *branch, EntryNumber entryNumber, T *&pbuf)
Definition: RootTree.h:153
edm::IndexIntoFile::invalidEntry
static constexpr EntryNumber_t invalidEntry
Definition: IndexIntoFile.h:236
l1tstage2_dqm_sourceclient-live_cfg.rawData
rawData
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:163
edm::IndexIntoFile::processHistoryID
ProcessHistoryID const & processHistoryID(int i) const
Definition: IndexIntoFile.cc:55
edm::EventToProcessBlockIndexes::index
unsigned int index() const
Definition: EventToProcessBlockIndexes.h:16
edm::poolNames::parameterSetsTreeName
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:216
edm::DaqProvenanceHelper
Definition: DaqProvenanceHelper.h:27
edm::FileBlock::NotProcessingEvents
Definition: FileBlock.h:31
writedatasetfile.runs
runs
Definition: writedatasetfile.py:27
StoredMergeableRunProductMetadata.h
edm::IndexIntoFile::unsortedEventNumbers
std::vector< EventNumber_t > & unsortedEventNumbers()
Definition: IndexIntoFile.h:994
edm::LuminosityBlockPrincipal
Definition: LuminosityBlockPrincipal.h:31
edm::BranchListIndexes
std::vector< BranchListIndex > BranchListIndexes
Definition: BranchListIndex.h:18
edm::ThinnedAssociation
Definition: ThinnedAssociation.h:15
edm::IndexIntoFile
Definition: IndexIntoFile.h:225
Algorithms.h
cms::cuda::assert
assert(be >=bs)
edm::FileBlock::RunOrLumiNotContiguous
Definition: FileBlock.h:38
edm::RootFile::branchIDListHelper_
edm::propagate_const< std::shared_ptr< BranchIDListHelper > > branchIDListHelper_
Definition: RootFile.h:390
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
edm::poolNames::indexIntoFileBranchName
std::string const & indexIntoFileBranchName()
Definition: BranchType.cc:198
edm::InputType::SecondaryFile
edm::RootFile::eventTree_
RootTree eventTree_
Definition: RootFile.h:380
edm::ProductSelector::selected
bool selected(BranchDescription const &desc) const
Definition: ProductSelector.cc:55
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
edm::RootFileEventFinder::eventTree_
RootTree & eventTree_
Definition: RootFile.cc:141
ProcessBlockPrincipal.h
edm::RootFile::currentProcessBlockTree_
unsigned int currentProcessBlockTree_
Definition: RootFile.h:384
edm::DelayedReader::preEventReadFromSourceSignal
virtual signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * preEventReadFromSourceSignal() const =0
DelayedReader.h
edm::ParameterSetConverter
Definition: ParameterSetConverter.h:40
edm::stemFromPath
std::string_view stemFromPath(std::string_view path)
Definition: stemFromPath.cc:4
ProcessHistoryRegistry.h
edm::RootFile::readEntryDescriptionTree
void readEntryDescriptionTree(EntryDescriptionMap &entryDescriptionMap, InputType inputType)
Definition: RootFile.cc:634
hgcal_conditions::parameters
Definition: HGCConditions.h:86
edm::StreamID::value
unsigned int value() const
Definition: StreamID.h:43
edm::get_underlying_safe
constexpr std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:41
ProductRegistry.h
edm::RootFile::storedProcessBlockHelper_
edm::propagate_const< std::unique_ptr< StoredProcessBlockHelper > > storedProcessBlockHelper_
Definition: RootFile.h:392
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
edm::RootFile::isDuplicateEvent
bool isDuplicateEvent()
Definition: RootFile.cc:860
edm::RootFile::enforceGUIDInFileName_
bool enforceGUIDInFileName_
Definition: RootFile.h:375
edm::FullProvenanceReader::FullProvenanceReader
FullProvenanceReader(RootTree *rootTree, DaqProvenanceHelper const *daqProvenanceHelper)
Definition: RootFile.cc:2318
edm::FileBlock::EventsToBeSorted
Definition: FileBlock.h:37
edm::RootFile::skipThisEntry
bool skipThisEntry()
Definition: RootFile.cc:823
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::IndexIntoFile::findPosition
IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
Definition: IndexIntoFile.cc:489
edm::EventID::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
edm::FileID
Definition: FileID.h:14
edm::RootFile::fileFormatVersion
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:242
edm::FileFormatVersion::perEventProductIDs
bool perEventProductIDs() const
Definition: FileFormatVersion.cc:19
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
edm::RootFile::eventProcessHistoryIDs_
std::vector< EventProcessHistoryID > eventProcessHistoryIDs_
Definition: RootFile.h:370
edm::poolNames::branchListIndexesBranchName
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:212
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
edm::InRun
Definition: BranchType.h:11
edm::ProcessBlockPrincipal
Definition: ProcessBlockPrincipal.h:22
CMS_SA_ALLOW
#define CMS_SA_ALLOW
Definition: thread_safety_macros.h:5
edm::IndexIntoFileItrHolder
Definition: IndexIntoFile.h:1109
edm::DummyProvenanceReader::DummyProvenanceReader
DummyProvenanceReader()
Definition: RootFile.cc:2445
edm::IndexIntoFile::empty
bool empty() const
True if no runs, lumis, or events are in the file.
Definition: IndexIntoFile.cc:487
edm::InputType
InputType
Definition: InputType.h:5
edm::BranchTypeToAuxiliaryBranchName
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:116
runTheMatrix.nStreams
nStreams
Definition: runTheMatrix.py:372
EventSkipperByID.h
edm::RootFile::setEntryAtLumi
bool setEntryAtLumi(RunNumber_t run, LuminosityBlockNumber_t lumi)
Definition: RootFile.cc:1801
edm::LuminosityBlockPrincipal::aux
LuminosityBlockAuxiliary const & aux() const
Definition: LuminosityBlockPrincipal.h:64
edm::RootFile::file
std::string const & file() const
Definition: RootFile.h:234
edm::ProductRegistry
Definition: ProductRegistry.h:37
edm::MakeOldProvenanceReader::entryDescriptionMap_
edm::propagate_const< std::unique_ptr< EntryDescriptionMap > > entryDescriptionMap_
Definition: RootFile.cc:89
edm::first
T first(std::pair< T, U > const &p)
Definition: ParameterSet.cc:217
edm::FileBlock
Definition: FileBlock.h:22
edm::RootFile::setEntryAtRun
bool setEntryAtRun(RunNumber_t run)
Definition: RootFile.cc:1809
edm::RootTree::resetTraining
void resetTraining()
Definition: RootTree.h:182
edm::LuminosityBlockAuxiliary
Definition: LuminosityBlockAuxiliary.h:15
edm::poolNames::mergeableRunProductMetadataBranchName
std::string const & mergeableRunProductMetadataBranchName()
Definition: BranchType.cc:201
LuminosityBlockAux.h
edm::ProcessBlockHelper::initializeFromPrimaryInput
void initializeFromPrimaryInput(StoredProcessBlockHelper const &storedProcessBlockHelper)
Definition: ProcessBlockHelper.cc:122
edm::MakeReducedProvenanceReader::parentageIDLookup_
std::vector< ParentageID > const & parentageIDLookup_
Definition: RootFile.cc:104
EDMException.h
SharedResourcesAcquirer.h
edm::numberOfRunLumiEventProductTrees
constexpr unsigned int numberOfRunLumiEventProductTrees
Definition: BranchType.h:15
edm::RootFile::inputType_
InputType inputType_
Definition: RootFile.h:410
edm::InProcess
Definition: BranchType.h:11
edm::MakeFullProvenanceReader::makeReader
std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
Definition: RootFile.cc:2474
edm::RootFile::setAtEventEntry
void setAtEventEntry(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1582
edm::RootFile::fileThinnedAssociationsHelper_
edm::propagate_const< std::unique_ptr< ThinnedAssociationsHelper > > fileThinnedAssociationsHelper_
Definition: RootFile.h:393
edm::ReducedProvenanceReader::readProvenanceAsync
void readProvenanceAsync(WaitingTaskHolder task, ModuleCallingContext const *moduleCallingContext, unsigned int transitionIndex, std::atomic< const std::set< ProductProvenance > * > &writeTo) const override
Definition: RootFile.cc:2253
BXlumiParameters_cfi.lumi
lumi
Definition: BXlumiParameters_cfi.py:6
edm::FileFormatVersion::noMetaDataTrees
bool noMetaDataTrees() const
Definition: FileFormatVersion.cc:39
ParentageRegistry.h
edm::propagate_const
Definition: propagate_const.h:32
ProcessBlockHelper.h
edm::poolNames::parentageBranchName
std::string const & parentageBranchName()
Definition: BranchType.cc:156
edm::IndexIntoFile::IndexIntoFileItr::advanceToNextRun
void advanceToNextRun()
Definition: IndexIntoFile.h:774
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::EventPrincipal
Definition: EventPrincipal.h:48
edm::IndexIntoFile::setEventFinder
void setEventFinder(std::shared_ptr< EventFinder > ptr)
Definition: IndexIntoFile.h:952
edm::RootFile::eventToProcessBlockIndexes_
EventToProcessBlockIndexes eventToProcessBlockIndexes_
Definition: RootFile.h:399
edm::FileFormatVersion::runsAndLumis
bool runsAndLumis() const
Definition: FileFormatVersion.cc:13
edm::RootFile::eventAuxCache_
EventAuxiliary eventAuxCache_
Definition: RootFile.h:379
edm::IndexIntoFile::invalidIndex
static constexpr int invalidIndex
Definition: IndexIntoFile.h:232
edm::RootTree::metaTree
TTree const * metaTree() const
Definition: RootTree.h:171
edm::OldProvenanceReader::acquirer_
SharedResourcesAcquirer acquirer_
Definition: RootFile.cc:2382
edm::StreamContext
Definition: StreamContext.h:31
edm::RootFile::provenanceAdaptor_
edm::propagate_const< std::unique_ptr< ProvenanceAdaptor > > provenanceAdaptor_
Definition: RootFile.h:404
edm::IndexIntoFile::kRun
Definition: IndexIntoFile.h:238
edm::ProductRegistry::productListUpdator
ProductList & productListUpdator()
Definition: ProductRegistry.h:81
edm::RootTree::entryNumberForIndex
EntryNumber const & entryNumberForIndex(unsigned int index) const
Definition: RootTree.cc:113
edm::FileFormatVersion::eventHistoryTree
bool eventHistoryTree() const
Definition: FileFormatVersion.cc:17
edm::RootFile::skipEvents
bool skipEvents(int &offset)
Definition: RootFile.cc:1433
edm::RootFile::modifiedIDs
bool modifiedIDs() const
Definition: RootFile.h:246
edm::poolNames::processHistoryBranchName
std::string const & processHistoryBranchName()
Definition: BranchType.cc:177
EventPrincipal.h
edm::RootFile::fillRunAuxiliary
std::shared_ptr< RunAuxiliary > fillRunAuxiliary()
Definition: RootFile.cc:1413
edm::RootFile::branchChildren_
edm::propagate_const< std::shared_ptr< BranchChildren > > branchChildren_
Definition: RootFile.h:402
edm::OldProvenanceReader
Definition: RootFile.cc:2361
edm::RootFile::wasLastEventJustRead
bool wasLastEventJustRead() const
Definition: RootFile.cc:922
edm::MakeOldProvenanceReader::MakeOldProvenanceReader
MakeOldProvenanceReader(std::unique_ptr< EntryDescriptionMap > &&entryDescriptionMap)
Definition: RootFile.cc:83
edmLumisInFiles.lumis
lumis
Definition: edmLumisInFiles.py:31
edm::ProcessBlockHelper
Definition: ProcessBlockHelper.h:19
edm::StoredMergeableRunProductMetadata
Definition: StoredMergeableRunProductMetadata.h:57
edm::BranchID
Definition: BranchID.h:14
TrackValidation_cff.task
task
Definition: TrackValidation_cff.py:253
edm::RootFile::treePointers_
std::vector< edm::propagate_const< RootTree * > > treePointers_
Definition: RootFile.h:385
edm::FullProvenanceReader::readProvenance
std::set< ProductProvenance > readProvenance(unsigned int transitionIndex) const override
Definition: RootFile.cc:2341
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
edm::RootTree::fillAux
void fillAux(T *&pAux)
Definition: RootTree.h:141
StoredProductProvenance.h
edm::RootFile::processBlockHelper_
edm::propagate_const< ProcessBlockHelper * > processBlockHelper_
Definition: RootFile.h:391
edm::poolNames::eventToProcessBlockIndexesBranchName
std::string const & eventToProcessBlockIndexesBranchName()
Definition: BranchType.cc:214
edm::RootFile::getNextItemType
IndexIntoFile::EntryType getNextItemType(RunNumber_t &run, LuminosityBlockNumber_t &lumi, EventNumber_t &event)
Definition: RootFile.cc:877
edm::MergeableRunProductMetadata
Definition: MergeableRunProductMetadata.h:52
edm::EventAuxiliary::id
EventID const & id() const
Definition: EventAuxiliary.h:63
edm::StoredProcessBlockHelper::processesWithProcessBlockProducts
std::vector< std::string > const & processesWithProcessBlockProducts() const
Definition: StoredProcessBlockHelper.h:32
edm::RootFile::fillEventAuxiliary
EventAuxiliary fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1306
edm::RootFile::RootFile
RootFile(std::string const &fileName, ProcessConfiguration const &processConfiguration, std::string const &logicalFileName, std::shared_ptr< InputFile > filePtr, std::shared_ptr< EventSkipperByID > eventSkipperByID, bool skipAnyEvents, int remainingEvents, int remainingLumis, unsigned int nStreams, unsigned int treeCacheSize, int treeMaxVirtualSize, InputSource::ProcessingMode processingMode, RunHelperBase *runHelper, bool noEventSort, ProductSelectorRules const &productSelectorRules, InputType inputType, std::shared_ptr< BranchIDListHelper > branchIDListHelper, ProcessBlockHelper *, std::shared_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper, std::vector< BranchID > const *associationsFromSecondary, std::shared_ptr< DuplicateChecker > duplicateChecker, bool dropDescendantsOfDroppedProducts, ProcessHistoryRegistry &processHistoryRegistry, std::vector< std::shared_ptr< IndexIntoFile >> const &indexesIntoFiles, std::vector< std::shared_ptr< IndexIntoFile >>::size_type currentIndexIntoFile, std::vector< ProcessHistoryID > &orderedProcessHistoryIDs, bool bypassVersionCheck, bool labelRawDataLikeMC, bool usingGoToEvent, bool enablePrefetching, bool enforceGUIDInFileName)
Definition: RootFile.cc:145
edm::RootTree::fillBranchEntry
void fillBranchEntry(TBranch *branch, T *&pbuf)
Definition: RootTree.h:147
edm::Hash< EntryDescriptionType >
edm::EventProcessHistoryID
Definition: EventProcessHistoryID.h:11
edm::MakeReducedProvenanceReader
Definition: RootFile.cc:96
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
edm::RootFile::savedRunAuxiliary
std::shared_ptr< RunAuxiliary const > savedRunAuxiliary() const
Definition: RootFile.h:342
edm::ProcessHistoryRegistry::vector_type
ProcessHistoryVector vector_type
Definition: ProcessHistoryRegistry.h:22
edm::EventAux
Definition: EventAux.h:15
edm::IndexIntoFile::IndexIntoFileItr::processHistoryIDIndex
int processHistoryIDIndex() const
Definition: IndexIntoFile.h:701
edm::RootFileEventFinder::getEventNumberOfEntry
EventNumber_t getEventNumberOfEntry(roottree::EntryNumber entry) const override
Definition: RootFile.cc:130
edm::InEvent
Definition: BranchType.h:11
edm::poolNames::parameterSetMapBranchName
std::string const & parameterSetMapBranchName()
Definition: BranchType.cc:168
edm::RootFile::whyNotFastClonable_
int whyNotFastClonable_
Definition: RootFile.h:376
edm::RootFile::thinnedAssociationsHelper_
edm::propagate_const< std::shared_ptr< ThinnedAssociationsHelper > > thinnedAssociationsHelper_
Definition: RootFile.h:394
edm::RootFile::setPosition
void setPosition(IndexIntoFile::IndexIntoFileItr const &position)
Definition: RootFile.cc:814
edm::RootFile::updateFileBlock
void updateFileBlock(FileBlock &)
Definition: RootFile.cc:785
edm::LuminosityBlockID
Definition: LuminosityBlockID.h:31
edm::InputSource::RunsAndLumis
Definition: InputSource.h:56
edm::RootFile::hasNewlyDroppedBranch
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch() const
Definition: RootFile.h:244
edm::poolNames::entryDescriptionIDBranchName
std::string const & entryDescriptionIDBranchName()
Definition: BranchType.cc:149
b
double b
Definition: hdecay.h:118
edm::OldProvenanceReader::entryDescriptionMap_
EntryDescriptionMap const & entryDescriptionMap_
Definition: RootFile.cc:2379
edm::RootTree::resetAndGetRootDelayedReader
DelayedReader * resetAndGetRootDelayedReader() const
Definition: RootTree.cc:142
edm::RootFile::fillIndexIntoFile
void fillIndexIntoFile()
Definition: RootFile.cc:989
edm::ReducedProvenanceReader::rootTree_
edm::propagate_const< RootTree * > rootTree_
Definition: RootFile.cc:2169
edm::IndexIntoFile::invalidLumi
static constexpr LuminosityBlockNumber_t invalidLumi
Definition: IndexIntoFile.h:234
edm::poolNames::parentageTreeName
std::string const & parentageTreeName()
Definition: BranchType.cc:154
edm::FileFormatVersion::newAuxiliary
bool newAuxiliary() const
Definition: FileFormatVersion.cc:11
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
edm::BranchIDLists
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
edm::EventAuxiliary
Definition: EventAuxiliary.h:14
edm::ProductSelector
Definition: ProductSelector.h:26
edm::MakeDummyProvenanceReader::makeReader
std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
Definition: RootFile.cc:2464
edm::RootFile::indexIntoFile_
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:364
edm::ProductSelectorRules
Definition: ProductSelectorRules.h:24
edm::RunHelperBase
Definition: RunHelper.h:15
edm::numEntries
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50
edm::Parentage
Definition: Parentage.h:25
edm::IndexIntoFile::IndexIntoFileItr::skipEventForward
void skipEventForward(int &phIndexOfSkippedEvent, RunNumber_t &runOfSkippedEvent, LuminosityBlockNumber_t &lumiOfSkippedEvent, EntryNumber_t &skippedEventEntry)
Definition: IndexIntoFile.h:745
edm::IndexIntoFile::begin
IndexIntoFileItr begin(SortOrder sortOrder) const
Definition: IndexIntoFile.cc:461
edm::RootFile::newBranchToOldBranch
std::string const & newBranchToOldBranch(std::string const &newBranch) const
Definition: RootFile.cc:804
edm::IndexIntoFile::IndexIntoFileItr::skipLumiInRun
bool skipLumiInRun()
Definition: IndexIntoFile.h:768
edm::RootFile::fid_
FileID fid_
Definition: RootFile.h:362
edm::ProductRegistry::copyProduct
void copyProduct(BranchDescription const &productdesc)
Definition: ProductRegistry.cc:122
edm::RootFile::orderedProcessHistoryIDs_
std::vector< ProcessHistoryID > & orderedProcessHistoryIDs_
Definition: RootFile.h:365
edm::poolNames::eventSelectionsBranchName
std::string const & eventSelectionsBranchName()
Definition: BranchType.cc:210
edm::DelayedReader::postEventReadFromSourceSignal
virtual signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const * postEventReadFromSourceSignal() const =0
summarizeEdmComparisonLogfiles.succeeded
succeeded
Definition: summarizeEdmComparisonLogfiles.py:100
edm::InputSource::ProcessingMode
ProcessingMode
Definition: InputSource.h:56
edm::LuminosityBlockAuxiliary::processHistoryID
ProcessHistoryID const & processHistoryID() const
Definition: LuminosityBlockAuxiliary.h:32
edm::ThinnedAssociationsHelper
Definition: ThinnedAssociationsHelper.h:37
ReleaseVersion.h
edm::ProductRegistry::ProductList
std::map< BranchKey, BranchDescription > ProductList
Definition: ProductRegistry.h:39
BranchDescription.h
edm::RootFile::savedRunAuxiliary_
edm::propagate_const< std::shared_ptr< RunAuxiliary > > savedRunAuxiliary_
Definition: RootFile.h:372
edm::TypeWithDict
Definition: TypeWithDict.h:38
edm::ReducedProvenanceReader::parentageIDLookup_
std::vector< ParentageID > const & parentageIDLookup_
Definition: RootFile.cc:2173
edm::ServiceRegistry::Operate
friend class Operate
Definition: ServiceRegistry.h:54
edm::OldProvenanceReader::readProvenance
std::set< ProductProvenance > readProvenance(unsigned int transitionIndex) const override
Definition: RootFile.cc:2411
edm::RootFile::storedMergeableRunProductMetadata_
edm::propagate_const< std::unique_ptr< StoredMergeableRunProductMetadata > > storedMergeableRunProductMetadata_
Definition: RootFile.h:369
edm::DaqProvenanceHelper::mapBranchID
BranchID const & mapBranchID(BranchID const &branchID) const
Definition: DaqProvenanceHelper.cc:191
edm::EventEntryDescription::parents
std::vector< BranchID > const & parents() const
Definition: EventEntryDescription.h:39
edm::ParameterSet
Definition: ParameterSet.h:47
GetReleaseVersion.h
edm::MakeOldProvenanceReader::makeReader
std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
Definition: RootFile.cc:2469
edm::RootFile::dropProcessesAndReorder
void dropProcessesAndReorder(StoredProcessBlockHelper &, std::set< std::string > const &processesWithKeptProcessBlockProducts, ProcessBlockHelper const *)
Definition: RootFile.cc:2041
edm::FileFormatVersion
Definition: FileFormatVersion.h:7
edm::RootFile::hasNewlyDroppedBranch_
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: RootFile.h:377
a
double a
Definition: hdecay.h:119
edm::IndexIntoFile::firstAppearanceOrder
Definition: IndexIntoFile.h:266
edm::RootFile::makeProvenanceReaderMaker
std::unique_ptr< MakeProvenanceReader > makeProvenanceReaderMaker(InputType inputType)
Definition: RootFile.cc:2126
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
fetchall_from_DQM_v2.release
release
Definition: fetchall_from_DQM_v2.py:92
edm::WaitingTaskHolder
Definition: WaitingTaskHolder.h:32
edm::InLumi
Definition: BranchType.h:11
edm::IndexIntoFile::IndexIntoFileItr
Definition: IndexIntoFile.h:681
edm::IndexIntoFile::SortOrder
SortOrder
Definition: IndexIntoFile.h:266
edm::poolNames::productDescriptionBranchName
std::string const & productDescriptionBranchName()
Definition: BranchType.cc:162
edm::RootFile::setEntryAtEvent
bool setEntryAtEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
Definition: RootFile.cc:1793
edm::ProductProvenanceVector
std::vector< ProductProvenance > ProductProvenanceVector
Definition: ProductProvenance.h:60
edm::ProcessBlockHelperBase::processesWithProcessBlockProducts
std::vector< std::string > const & processesWithProcessBlockProducts() const
Definition: ProcessBlockHelperBase.h:22
edm::FullProvenanceReader
Definition: RootFile.cc:2297
edm::RootFile::setIfFastClonable
void setIfFastClonable(int remainingEvents, int remainingLumis)
Definition: RootFile.cc:715
edm::RootFile::logicalFile_
const std::string logicalFile_
Definition: RootFile.h:356
edm::errors::FileNameInconsistentWithGUID
Definition: EDMException.h:68
edm::LuminosityBlockPrincipal::fillLuminosityBlockPrincipal
void fillLuminosityBlockPrincipal(ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
Definition: LuminosityBlockPrincipal.cc:16
edm::releaseversion::DecomposedReleaseVersion
Definition: ReleaseVersion.h:9
edm::ServiceRegistry::presentToken
ServiceToken presentToken() const
Definition: ServiceRegistry.cc:63
edm::ParentageRegistry
Definition: ParentageRegistry.h:12
LaserDQM_cfg.process
process
Definition: LaserDQM_cfg.py:3
edm::RootFile::initializeDuplicateChecker
void initializeDuplicateChecker(std::vector< std::shared_ptr< IndexIntoFile >> const &indexesIntoFiles, std::vector< std::shared_ptr< IndexIntoFile >>::size_type currentIndexIntoFile)
Definition: RootFile.cc:1845
edm::OldProvenanceReader::rootTree_
edm::propagate_const< RootTree * > rootTree_
Definition: RootFile.cc:2375
edm::RootFile::processingMode_
InputSource::ProcessingMode processingMode_
Definition: RootFile.h:395
edm::MakeFullProvenanceReader
Definition: RootFile.cc:91
edm::DummyProvenanceReader::readProvenanceAsync
void readProvenanceAsync(WaitingTaskHolder task, ModuleCallingContext const *moduleCallingContext, unsigned int transitionIndex, std::atomic< const std::set< ProductProvenance > * > &writeTo) const override
Definition: RootFile.cc:2451
edm::friendlyname::friendlyName
std::string friendlyName(std::string const &iFullName)
Definition: FriendlyName.cc:278
edm::RootFile::validateFile
void validateFile(InputType inputType, bool usingGoToEvent)
Definition: RootFile.cc:1214
thread_safety_macros.h
RunPrincipal.h
edm::RootFile::markBranchToBeDropped
void markBranchToBeDropped(bool dropDescendants, BranchDescription const &branch, std::set< BranchID > &branchesToDrop, std::map< BranchID, BranchID > const &droppedToKeptAlias) const
Definition: RootFile.cc:1885
edm::FileBlock::FileTooOld
Definition: FileBlock.h:35
edm::RootFile::fillEventHistory
bool fillEventHistory(EventAuxiliary &evtAux, EventSelectionIDVector &eventSelectionIDs, BranchListIndexes &branchListIndexes, bool assertOnFailure=true)
Definition: RootFile.cc:1331
edm::RootFile::filePtr_
edm::propagate_const< std::shared_ptr< InputFile > > filePtr_
Definition: RootFile.h:359
ProductSelector.h
EventEntryInfo.h
edm::IndexIntoFile::IndexIntoFileItr::firstEventEntryThisRun
EntryNumber_t firstEventEntryThisRun()
Definition: IndexIntoFile.h:719
edm::RootFile::processBlockTrees_
std::vector< edm::propagate_const< std::unique_ptr< RootTree > > > processBlockTrees_
Definition: RootFile.h:383
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
edm::poolNames::entryDescriptionTreeName
std::string const & entryDescriptionTreeName()
Definition: BranchType.cc:147
GlobalIdentifier.h
edm::IndexIntoFile::findLumiPosition
IndexIntoFileItr findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
Definition: IndexIntoFile.cc:685
edm::ProcessConfigurationVector
std::vector< ProcessConfiguration > ProcessConfigurationVector
Definition: ProcessConfiguration.h:62
edm::FileBlock::EventsOrLumisSelectedByID
Definition: FileBlock.h:39
edm::BranchChildren
Definition: BranchChildren.h:18
edm::ReducedProvenanceReader::readProvenance
std::set< ProductProvenance > readProvenance(unsigned int) const override
Definition: RootFile.cc:2267
edm::RootFile::readLuminosityBlockAuxiliary_
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
Definition: RootFile.cc:1736
edm::EventID::event
EventNumber_t event() const
Definition: EventID.h:40
StoredProcessBlockHelper.h
edm::createGlobalIdentifier
std::string createGlobalIdentifier(bool binary=false)
Definition: GlobalIdentifier.cc:5
edm::RootFile::fillProcessBlockHelper_
void fillProcessBlockHelper_()
Definition: RootFile.cc:1650
edm::MakeProvenanceReader
Definition: RootFile.h:64
edm::RootFile::branchChildren
std::shared_ptr< BranchChildren const > branchChildren() const
Definition: RootFile.h:345
edm::SharedResourcesRegistry
Definition: SharedResourcesRegistry.h:39
edm::SerialTaskQueueChain::push
void push(tbb::task_group &iGroup, T &&iAction)
asynchronously pushes functor iAction into queue
Definition: SerialTaskQueueChain.h:75
BranchType.h
edm::poolNames::processHistoryMapBranchName
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:174
edm::FileBlock::NoEventsInFile
Definition: FileBlock.h:36
edm::RootFile::eventToProcessBlockIndexesBranch_
edm::propagate_const< TBranch * > eventToProcessBlockIndexesBranch_
Definition: RootFile.h:400
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
edm::RootFile::skipAnyEvents_
bool skipAnyEvents_
Definition: RootFile.h:373
edm::roottree::defaultLearningEntries
unsigned const int defaultLearningEntries
Definition: RootTree.h:40
edm::StoredProcessBlockHelper
Definition: StoredProcessBlockHelper.h:25
edm::RootFile::edProductClass_
edm::propagate_const< TClass * > edProductClass_
Definition: RootFile.h:409
edm::RootFile::fileFormatVersion_
FileFormatVersion fileFormatVersion_
Definition: RootFile.h:361
edm::ProductRegistry::allBranchDescriptions
std::vector< BranchDescription const * > allBranchDescriptions() const
Definition: ProductRegistry.cc:199
RootFile.h
edm::BranchDescription::branchName
std::string const & branchName() const
Definition: BranchDescription.h:120
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::RootFile::fillEventToProcessBlockIndexes
void fillEventToProcessBlockIndexes()
Definition: RootFile.cc:1311
edm::IndexIntoFile::end
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
Definition: IndexIntoFile.cc:470
edm::RootFile::createFileBlock
std::shared_ptr< FileBlock > createFileBlock()
Definition: RootFile.cc:759
edm::EventPrincipal::streamID
StreamID streamID() const
Definition: EventPrincipal.h:110
InputFile.h
edm::FullProvenanceReader::infoVector_
ProductProvenanceVector infoVector_
Definition: RootFile.cc:2310
edm::FileFormatVersion::processHistorySameWithinRun
bool processHistorySameWithinRun() const
Definition: FileFormatVersion.cc:33
edm::RootFile::readEventHistoryTree
void readEventHistoryTree()
Definition: RootFile.cc:1834
edm::OldProvenanceReader::~OldProvenanceReader
~OldProvenanceReader() override
Definition: RootFile.cc:2366
edm::EntryDescriptionMap
std::map< EntryDescriptionID, EventEntryDescription > EntryDescriptionMap
Definition: RootFile.h:62
edm::lower_bound_all
ForwardSequence::const_iterator lower_bound_all(ForwardSequence const &s, Datum const &d)
wrappers for std::lower_bound
Definition: Algorithms.h:69
edm::ServiceRegistry::instance
static ServiceRegistry & instance()
Definition: ServiceRegistry.cc:90
edm::RootTree::branchNames
std::vector< std::string > const & branchNames() const
Definition: RootTree.h:137
edm::FullProvenanceReader::rootTree_
RootTree * rootTree_
Definition: RootFile.cc:2309
edm::RootTree::insertEntryForIndex
void insertEntryForIndex(unsigned int index)
Definition: RootTree.cc:118
edm::RunAux
Definition: RunAux.h:14
edm::IndexIntoFile::findEventPosition
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: IndexIntoFile.cc:676
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
LuminosityBlockPrincipal.h
edm::LuminosityBlockAux
Definition: LuminosityBlockAux.h:13
instance
static PFTauRenderPlugin instance
Definition: PFTauRenderPlugin.cc:70
edm::pset::Registry::insertMapped
bool insertMapped(value_type const &v, bool forceUpdate=false)
Definition: Registry.cc:32
edm::BranchDescription::updateFriendlyClassName
void updateFriendlyClassName()
Definition: BranchDescription.cc:294
edm::FileFormatVersion::storedProductProvenanceUsed
bool storedProductProvenanceUsed() const
Definition: FileFormatVersion.cc:41
FileBlock.h
edm::ReducedProvenanceReader::acquirer_
SharedResourcesAcquirer acquirer_
Definition: RootFile.cc:2176
edm::IndexIntoFile::containsItem
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: IndexIntoFile.cc:696
edm::InputSource::Runs
Definition: InputSource.h:56
edm::ProcessBlockPrincipal::fillProcessBlockPrincipal
void fillProcessBlockPrincipal(std::string const &processName, DelayedReader *reader=nullptr)
Definition: ProcessBlockPrincipal.cc:16
edm::EventPrincipal::fillEventPrincipal
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistory const *processHistory, DelayedReader *reader=nullptr)
Definition: EventPrincipal.cc:110
edm::RootFile::initAssociationsFromSecondary
void initAssociationsFromSecondary(std::vector< BranchID > const &)
Definition: RootFile.cc:818
Registry.h
edm::releaseversion::isEarlierRelease
bool isEarlierRelease(std::string const &a, std::string const &b)
Definition: ReleaseVersion.cc:70
edm::IndexIntoFile::IndexIntoFileItr::getEntryType
EntryType getEntryType() const
Definition: IndexIntoFile.h:700
edm::roottree::defaultNonEventCacheSize
unsigned const int defaultNonEventCacheSize
Definition: RootTree.h:39
edm::RootFile::history_
edm::propagate_const< std::unique_ptr< History > > history_
Definition: RootFile.h:401
edm::RunPrincipal::fillRunPrincipal
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
Definition: RunPrincipal.cc:28
edm::RootFile::makeProcessBlockRootTrees
void makeProcessBlockRootTrees(std::shared_ptr< InputFile > filePtr, int treeMaxVirtualSize, bool enablePrefetching, InputType inputType, StoredProcessBlockHelper const &storedProcessBlockHelper)
Definition: RootFile.cc:2102
edm::Timestamp::invalidTimestamp
static Timestamp invalidTimestamp()
Definition: Timestamp.h:82
edm::FullProvenanceReader::readProvenanceAsync
void readProvenanceAsync(WaitingTaskHolder task, ModuleCallingContext const *moduleCallingContext, unsigned int transitionIndex, std::atomic< const std::set< ProductProvenance > * > &writeTo) const override
Definition: RootFile.cc:2327
edm::RootFile::noEventSort_
bool noEventSort_
Definition: RootFile.h:374
edm::BranchTypeToProductProvenanceBranchName
std::string const & BranchTypeToProductProvenanceBranchName(BranchType const &BranchType)
Definition: BranchType.cc:139
edm::RootFile::readEvent
bool readEvent(EventPrincipal &cache)
Definition: RootFile.cc:1522
edm::RootTree::current
bool current() const
Definition: RootTree.h:126
edm::RootTree::isValid
bool isValid() const
Definition: RootTree.cc:123
edm::ParentageRegistry::insertMapped
bool insertMapped(value_type const &v)
Definition: ParentageRegistry.cc:25
edm::RootFile::setPresenceInProductRegistry
void setPresenceInProductRegistry(ProductRegistry &, StoredProcessBlockHelper const &)
Definition: RootFile.cc:1858
edm::RootFile::provenanceReaderMaker_
edm::propagate_const< std::unique_ptr< MakeProvenanceReader > > provenanceReaderMaker_
Definition: RootFile.h:405
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::RootFile::parentageIDLookup_
std::vector< ParentageID > parentageIDLookup_
Definition: RootFile.h:407
edm::ProductRegistry::productList
ProductList const & productList() const
Definition: ProductRegistry.h:76
edm::RootFile::goToEvent
bool goToEvent(EventID const &eventID)
Definition: RootFile.cc:1489
SharedResourcesRegistry.h
edm::RunPrincipal::mergeableRunProductMetadata
MergeableRunProductMetadata * mergeableRunProductMetadata()
Definition: RunPrincipal.h:81
stemFromPath.h
edm::ProcessHistoryID
Hash< ProcessHistoryType > ProcessHistoryID
Definition: ProcessHistoryID.h:8
edm::ReducedProvenanceReader::daqProvenanceHelper_
DaqProvenanceHelper const * daqProvenanceHelper_
Definition: RootFile.cc:2174
edm::RootTree::entryNumber
EntryNumber const & entryNumber() const
Definition: RootTree.h:132
edm::RootTree::EntryNumber
roottree::EntryNumber EntryNumber
Definition: RootTree.h:82
edm::FullProvenanceReader::~FullProvenanceReader
~FullProvenanceReader() override
Definition: RootFile.cc:2300
edm::RootFile::lastEventEntryNumberRead_
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
Definition: RootFile.h:387
edm::RootTree::entries
EntryNumber const & entries() const
Definition: RootTree.h:134
edm::IndexIntoFile::IndexIntoFileItr::advanceToNextLumiOrRun
void advanceToNextLumiOrRun()
Definition: IndexIntoFile.h:775
MergeableRunProductMetadata.h
edm::DummyProvenanceReader::readProvenance
std::set< ProductProvenance > readProvenance(unsigned int) const override
Definition: RootFile.cc:2447
edm::poolNames::metaDataTreeName
std::string const & metaDataTreeName()
Definition: BranchType.cc:159
edm::ProcessHistoryRegistry::collection_type
ProcessHistoryMap collection_type
Definition: ProcessHistoryRegistry.h:21
edm::EventAuxiliary::processHistoryID
ProcessHistoryID const & processHistoryID() const
Definition: EventAuxiliary.h:61
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
edm::MakeReducedProvenanceReader::MakeReducedProvenanceReader
MakeReducedProvenanceReader(std::vector< ParentageID > const &parentageIDLookup)
Definition: RootFile.cc:98
setIsMergeable.h
edm::InputType::Primary
edm::getReleaseVersion
std::string getReleaseVersion()
Definition: GetReleaseVersion.cc:7
Exception
Definition: hltDiff.cc:245
edm::IndexIntoFile::fillEventNumbersOrEntries
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
Definition: IndexIntoFile.cc:202
edm::RootTree::branchEntryInfoBranch
TBranch * branchEntryInfoBranch() const
Definition: RootTree.h:176
edm::ReducedProvenanceReader::pProvVector_
StoredProductProvenanceVector const * pProvVector_
Definition: RootFile.cc:2172
edm::RootFile::containsItem
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: RootFile.cc:873
edm::RootFile::productRegistry_
std::shared_ptr< ProductRegistry const > productRegistry_
Definition: RootFile.h:388
edm::RootFile::whyNotFastClonable
int whyNotFastClonable() const
Definition: RootFile.h:243
edm::RootFile::setEntryAtNextEventInLumi
bool setEntryAtNextEventInLumi(RunNumber_t run, LuminosityBlockNumber_t lumi)
Definition: RootFile.cc:1817
edm::IndexIntoFile::reduceProcessHistoryIDs
void reduceProcessHistoryIDs(ProcessHistoryRegistry const &processHistoryRegistry)
Definition: IndexIntoFile.cc:308
edm::InputType::SecondarySource
hgcal::association
std::tuple< layerClusterToCaloParticle, caloParticleToLayerCluster > association
Definition: LCToCPAssociatorByEnergyScoreImpl.h:44
dqmiodatasetharvest.processes
processes
Definition: dqmiodatasetharvest.py:190
edm::poolNames::thinnedAssociationsHelperBranchName
std::string const & thinnedAssociationsHelperBranchName()
Definition: BranchType.cc:186
ThinnedAssociation.h
edm::RootFile::setSignals
void setSignals(signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *preEventReadSource, signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *postEventReadSource)
Definition: RootFile.cc:2096
edm::History
Definition: History.h:22
edm::OldProvenanceReader::OldProvenanceReader
OldProvenanceReader(RootTree *rootTree, EntryDescriptionMap const &theMap, DaqProvenanceHelper const *daqProvenanceHelper)
Definition: RootFile.cc:2385
edm::OldProvenanceReader::pInfoVector_
std::vector< EventEntryInfo > * pInfoVector_
Definition: RootFile.cc:2378
edm::RootFile::dropOnInputAndReorder
void dropOnInputAndReorder(ProductRegistry &, ProductSelectorRules const &, bool dropDescendants, InputType, StoredProcessBlockHelper &, ProcessBlockHelper const *)
Definition: RootFile.cc:1896
ProvenanceAdaptor.h
edm::IndexIntoFile::EntryNumber_t
long long EntryNumber_t
Definition: IndexIntoFile.h:231
edm::ProcessHistoryRegistry
Definition: ProcessHistoryRegistry.h:18
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::poolNames::productDependenciesBranchName
std::string const & productDependenciesBranchName()
Definition: BranchType.cc:165
funct::void
TEMPL(T2) struct Divides void
Definition: Factorize.h:24
filterCSVwithJSON.target
target
Definition: filterCSVwithJSON.py:32
edm::RootFile::newBranchToOldBranch_
std::map< std::string, std::string > newBranchToOldBranch_
Definition: RootFile.h:397
edm::BranchDescription
Definition: BranchDescription.h:32
edm::poolNames::eventHistoryTreeName
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:224
drop
const int drop
Definition: GenParticlePruner.cc:50
edm::MakeReducedProvenanceReader::makeReader
std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
Definition: RootFile.cc:2479
DTskim_cfg.processingMode
processingMode
Definition: DTskim_cfg.py:82
edm::errors::FormatIncompatibility
Definition: EDMException.h:58
edm::RootTree
Definition: RootTree.h:79
edm::poolNames::processBlockHelperBranchName
std::string const & processBlockHelperBranchName()
Definition: BranchType.cc:204
edm::IndexIntoFile::kEnd
Definition: IndexIntoFile.h:238
edm::RootFile::fillThisEventAuxiliary
EventAuxiliary const & fillThisEventAuxiliary()
Definition: RootFile.cc:1287
edm::RootFile::indexIntoFileBegin_
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
Definition: RootFile.h:366
edm::roottree::getEntry
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:515
edm::RootFile::~RootFile
~RootFile()
Definition: RootFile.cc:632
edm::EDProductGetter::transitionIndex
unsigned int transitionIndex() const
Definition: EDProductGetter.h:94
cmsCodeRulesChecker.rules
rules
Definition: cmsCodeRulesChecker.py:152
ParameterSet.h
edm::RootFile::nextProcessBlock_
bool nextProcessBlock_(ProcessBlockPrincipal &)
Definition: RootFile.cc:1673
edm::IndexIntoFile::fixIndexes
void fixIndexes(std::vector< ProcessHistoryID > &processHistoryIDs)
Definition: IndexIntoFile.cc:370
edm::stable_sort_all
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
Definition: Algorithms.h:103
edm::ProcessBlockHelper::dropProcessesAndReorderStored
bool dropProcessesAndReorderStored(StoredProcessBlockHelper &storedProcessBlockHelper, std::set< std::string > const &processesToKeep, std::vector< unsigned int > const &nEntries, std::vector< unsigned int > &finalIndexToStoredIndex, std::vector< std::string > const &firstFileFinalProcesses) const
Definition: ProcessBlockHelper.cc:83
edm::RootFile::readRun_
void readRun_(RunPrincipal &runPrincipal)
Definition: RootFile.cc:1709
edm::IndexIntoFile::setRunOrLumiEntries
std::vector< RunOrLumiEntry > & setRunOrLumiEntries()
Definition: IndexIntoFile.h:1007
edm::FileBlock::MaxEventsTooSmall
Definition: FileBlock.h:41
edm::RunPrincipal
Definition: RunPrincipal.h:34
edm::poolNames::fileIdentifierBranchName
std::string const & fileIdentifierBranchName()
Definition: BranchType.cc:192
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:61
edm::RootFile::branchListIndexesUnchanged_
bool branchListIndexesUnchanged_
Definition: RootFile.h:378
parents
TPRegexp parents
Definition: eve_filter.cc:21
event
Definition: event.py:1
edm::EventID
Definition: EventID.h:31
edm::RootTree::setSignals
void setSignals(signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *preEventReadSource, signalslot::Signal< void(StreamContext const &, ModuleCallingContext const &)> const *postEventReadSource)
Definition: RootTree.cc:508
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
edm::EventEntryDescription::id
EntryDescriptionID id() const
Definition: EventEntryDescription.cc:13
edm::EventSelectionIDVector
std::vector< EventSelectionID > EventSelectionIDVector
Definition: EventSelectionID.h:16
edm::poolNames::entryDescriptionBranchName
std::string const & entryDescriptionBranchName()
Definition: BranchType.cc:151
edm::SerialTaskQueueChain
Definition: SerialTaskQueueChain.h:32
HLT_FULL_cff.distance
distance
Definition: HLT_FULL_cff.py:7746
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
edm::IndexIntoFile::IndexIntoFileItr::skipEventBackward
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
Definition: IndexIntoFile.h:759
edm::OldProvenanceReader::daqProvenanceHelper_
DaqProvenanceHelper const * daqProvenanceHelper_
Definition: RootFile.cc:2380
lumi
Definition: LumiSectionData.h:20
edm::ReducedProvenanceReader
Definition: RootFile.cc:2155
edm::MergeableRunProductMetadata::readRun
void readRun(long long inputRunEntry, StoredMergeableRunProductMetadata const &inputStoredMergeableRunProductMetadata, IndexIntoFileItrHolder const &inputIndexIntoFileItr)
Definition: MergeableRunProductMetadata.cc:23
edm::RootFile::runTree_
RootTree runTree_
Definition: RootFile.h:382
edm::errors::FileReadError
Definition: EDMException.h:50
edm::signalslot::Signal
Definition: DelayedReader.h:26
dttmaxenums::R
Definition: DTTMax.h:29
DaqProvenanceHelper.h
edm::DummyProvenanceReader
Definition: RootFile.cc:2432
edm::ReducedProvenanceReader::ReducedProvenanceReader
ReducedProvenanceReader(RootTree *iRootTree, std::vector< ParentageID > const &iParentageIDLookup, DaqProvenanceHelper const *daqProvenanceHelper)
Definition: RootFile.cc:2179
edm::EventAuxiliary::setProcessHistoryID
void setProcessHistoryID(ProcessHistoryID const &phid)
Definition: EventAuxiliary.h:62
edm::RootFile::readCurrentEvent
std::tuple< bool, bool > readCurrentEvent(EventPrincipal &cache, bool assertOnFailure=true)
Definition: RootFile.cc:1537
edm::poolNames::processConfigurationBranchName
std::string const & processConfigurationBranchName()
Definition: BranchType.cc:180
edm::RootFile::eventProductProvenanceRetriever
std::shared_ptr< ProductProvenanceRetriever const > eventProductProvenanceRetriever(size_t index) const
Definition: RootFile.h:348
EventAux.h
edm::errors::UnimplementedFeature
Definition: EDMException.h:38
RunID.h
edm::FileBlock::MaxLumisTooSmall
Definition: FileBlock.h:42
label
const char * label
Definition: PFTauDecayModeTools.cc:11
do_nothing_deleter.h
edm::InputSource::RunsLumisAndEvents
Definition: InputSource.h:56
edm::RootFile::branchIDLists_
std::shared_ptr< BranchIDLists const > branchIDLists_
Definition: RootFile.h:389
edm::IndexIntoFile::EventFinder
Definition: IndexIntoFile.h:902
edm::MakeOldProvenanceReader
Definition: RootFile.cc:81
edm::ProcessConfiguration
Definition: ProcessConfiguration.h:14
edm::StoredProductProvenanceVector
std::vector< StoredProductProvenance > StoredProductProvenanceVector
Definition: StoredProductProvenance.h:34
edm::IndexIntoFile::setProcessHistoryIDs
std::vector< ProcessHistoryID > & setProcessHistoryIDs()
Definition: IndexIntoFile.h:1012
edm::BranchKey
Definition: BranchKey.h:17
edm::pset::Registry
Definition: Registry.h:26
edm::poolNames::moduleDescriptionMapBranchName
std::string const & moduleDescriptionMapBranchName()
Definition: BranchType.cc:171
edm::RootTree::next
bool next()
Definition: RootTree.h:124
edm::RootFile::duplicateChecker_
edm::propagate_const< std::shared_ptr< DuplicateChecker > > duplicateChecker_
Definition: RootFile.h:403
edm::DummyProvenanceReader::~DummyProvenanceReader
~DummyProvenanceReader() override
Definition: RootFile.cc:2435
edm::OldProvenanceReader::mutex_
std::shared_ptr< std::recursive_mutex > mutex_
Definition: RootFile.cc:2381
edm::FileBlock::DuplicateEventsRemoved
Definition: FileBlock.h:44
edm::FullProvenanceReader::mutex_
std::shared_ptr< std::recursive_mutex > mutex_
Definition: RootFile.cc:2314
edm::ParameterSetConverter::ParameterSetIdConverter
std::map< ParameterSetID, ParameterSetID > ParameterSetIdConverter
Definition: ParameterSetConverter.h:45
edm::FileBlock::updateTTreePointers
void updateTTreePointers(TTree *ev, TTree *meta, TTree *lumi, TTree *lumiMeta, TTree *run, TTree *runMeta, std::vector< TTree * > processBlockTrees, std::vector< std::string > processesWithProcessBlockTrees)
Definition: FileBlock.cc:6
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::RootFile::indexIntoFileIter
IndexIntoFile::IndexIntoFileItr indexIntoFileIter() const
Definition: RootFile.cc:812
edm::RootFile::fillLumiAuxiliary
std::shared_ptr< LuminosityBlockAuxiliary > fillLumiAuxiliary()
Definition: RootFile.cc:1390
edm::IndexIntoFile::IndexIntoFileItr::entry
EntryNumber_t entry() const
Definition: IndexIntoFile.h:704
edm::IndexIntoFile::invalidRun
static constexpr RunNumber_t invalidRun
Definition: IndexIntoFile.h:233
edm::poolNames::eventHistoryBranchName
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:207
edm::RunAuxiliary
Definition: RunAuxiliary.h:15
edm::IndexIntoFile::IndexIntoFileItr::advanceToEvent
void advanceToEvent()
Definition: IndexIntoFile.cc:1748
edm::RootFile::wasFirstEventJustRead
bool wasFirstEventJustRead() const
Definition: RootFile.cc:928
edm::IndexIntoFile::fillEventNumbers
void fillEventNumbers() const
Definition: IndexIntoFile.cc:198
edm::IndexIntoFile::EntryType
EntryType
Definition: IndexIntoFile.h:238
edm::FileBlock::InitialEventsSkipped
Definition: FileBlock.h:40
edm::ModuleCallingContext
Definition: ModuleCallingContext.h:29
edm::ReducedProvenanceReader::mutex_
std::shared_ptr< std::recursive_mutex > mutex_
Definition: RootFile.cc:2175
edm::RootFile::file_
const std::string file_
Definition: RootFile.h:355