CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
41 
42 //used for backward compatibility
47 
48 #include "TROOT.h"
49 #include "Rtypes.h"
50 #include "TClass.h"
51 #include "TString.h"
52 #include "TTree.h"
53 #include "TTreeCache.h"
54 
55 #include <algorithm>
56 #include <list>
57 
58 namespace edm {
59 
60  // Algorithm classes for making ProvenanceReader:
62  public:
63  virtual std::unique_ptr<ProvenanceReaderBase> makeReader(RootTree& eventTree, DaqProvenanceHelper const* daqProvenanceHelper) const override;
64  };
66  public:
67  MakeOldProvenanceReader(std::unique_ptr<EntryDescriptionMap>&& entryDescriptionMap) : MakeProvenanceReader(), entryDescriptionMap_(std::move(entryDescriptionMap)) {}
68  virtual std::unique_ptr<ProvenanceReaderBase> makeReader(RootTree& eventTree, DaqProvenanceHelper const* daqProvenanceHelper) const override;
69  private:
70  std::unique_ptr<EntryDescriptionMap> entryDescriptionMap_;
71  };
73  public:
74  virtual std::unique_ptr<ProvenanceReaderBase> makeReader(RootTree& eventTree, DaqProvenanceHelper const* daqProvenanceHelper) const override;
75  };
77  public:
78  MakeReducedProvenanceReader(std::vector<ParentageID> const& parentageIDLookup) : parentageIDLookup_(parentageIDLookup) {}
79  virtual std::unique_ptr<ProvenanceReaderBase> makeReader(RootTree& eventTree, DaqProvenanceHelper const* daqProvenanceHelper) const override;
80  private:
81  std::vector<ParentageID> const& parentageIDLookup_;
82  };
83 
84  namespace {
85  int
86  forcedRunOffset(RunNumber_t const& forcedRunNumber, IndexIntoFile::IndexIntoFileItr inxBegin, IndexIntoFile::IndexIntoFileItr inxEnd) {
87  if(inxBegin == inxEnd) return 0;
88  int defaultOffset = (inxBegin.run() != 0 ? 0 : 1);
89  int offset = (forcedRunNumber != 0U ? forcedRunNumber - inxBegin.run() : defaultOffset);
90  if(offset < 0) {
92  << "The value of the 'setRunNumber' parameter must not be\n"
93  << "less than the first run number in the first input file.\n"
94  << "'setRunNumber' was " << forcedRunNumber <<", while the first run was "
95  << forcedRunNumber - offset << ".\n";
96  }
97  return offset;
98  }
99 
100  void
101  checkReleaseVersion(std::vector<ProcessHistory> processHistoryVector, std::string const& fileName) {
102  std::string releaseVersion = getReleaseVersion();
103  releaseversion::DecomposedReleaseVersion currentRelease(releaseVersion);
104  for(auto const& ph : processHistoryVector) {
105  for(auto const& pc : ph) {
106  if(releaseversion::isEarlierRelease(currentRelease, pc.releaseVersion())) {
108  << "The release you are using, " << getReleaseVersion() << " , predates\n"
109  << "a release (" << pc.releaseVersion() << ") used in writing the input file, " << fileName <<".\n"
110  << "Forward compatibility cannot be supported.\n";
111  }
112  }
113  }
114  }
115  }
116 
117  // This is a helper class for IndexIntoFile.
119  public:
120  explicit RootFileEventFinder(RootTree& eventTree) : eventTree_(eventTree) {}
121  virtual ~RootFileEventFinder() {}
122  virtual
125  eventTree_.setEntryNumber(entry);
126  EventAuxiliary eventAux;
127  EventAuxiliary *pEvAux = &eventAux;
129  eventTree_.setEntryNumber(saveEntry);
130  return eventAux.event();
131  }
132 
133  private:
135  };
136 
137 //---------------------------------------------------------------------
140  std::string const& logicalFileName,
141  boost::shared_ptr<InputFile> filePtr,
142  boost::shared_ptr<EventSkipperByID> eventSkipperByID,
143  bool skipAnyEvents,
144  int remainingEvents,
145  int remainingLumis,
146  unsigned int nStreams,
147  unsigned int treeCacheSize,
148  int treeMaxVirtualSize,
150  RunNumber_t const& forcedRunNumber,
151  bool noEventSort,
152  ProductSelectorRules const& productSelectorRules,
153  InputType inputType,
154  boost::shared_ptr<BranchIDListHelper> branchIDListHelper,
155  boost::shared_ptr<DuplicateChecker> duplicateChecker,
156  bool dropDescendants,
157  ProcessHistoryRegistry& processHistoryRegistry,
158  std::vector<boost::shared_ptr<IndexIntoFile> > const& indexesIntoFiles,
159  std::vector<boost::shared_ptr<IndexIntoFile> >::size_type currentIndexIntoFile,
160  std::vector<ProcessHistoryID>& orderedProcessHistoryIDs,
161  bool bypassVersionCheck,
162  bool labelRawDataLikeMC,
163  bool usingGoToEvent,
164  bool enablePrefetching) :
165  file_(fileName),
166  logicalFile_(logicalFileName),
167  processConfiguration_(processConfiguration),
168  processHistoryRegistry_(&processHistoryRegistry),
169  filePtr_(filePtr),
170  eventSkipperByID_(eventSkipperByID),
171  fileFormatVersion_(),
172  fid_(),
173  indexIntoFileSharedPtr_(new IndexIntoFile),
174  indexIntoFile_(*indexIntoFileSharedPtr_),
175  orderedProcessHistoryIDs_(orderedProcessHistoryIDs),
176  indexIntoFileBegin_(indexIntoFile_.begin(noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder)),
177  indexIntoFileEnd_(indexIntoFileBegin_),
178  indexIntoFileIter_(indexIntoFileBegin_),
179  eventProcessHistoryIDs_(),
180  eventProcessHistoryIter_(eventProcessHistoryIDs_.begin()),
181  savedRunAuxiliary_(),
182  skipAnyEvents_(skipAnyEvents),
183  noEventSort_(noEventSort),
184  whyNotFastClonable_(0),
185  hasNewlyDroppedBranch_(),
186  branchListIndexesUnchanged_(false),
187  eventAux_(),
188  eventTree_(filePtr_, InEvent, nStreams, treeMaxVirtualSize, treeCacheSize, roottree::defaultLearningEntries, enablePrefetching, inputType),
189  lumiTree_(filePtr_, InLumi, 1, treeMaxVirtualSize, roottree::defaultNonEventCacheSize, roottree::defaultNonEventLearningEntries, enablePrefetching, inputType),
190  runTree_(filePtr_, InRun, 1, treeMaxVirtualSize, roottree::defaultNonEventCacheSize, roottree::defaultNonEventLearningEntries, enablePrefetching, inputType),
191  treePointers_(),
192  lastEventEntryNumberRead_(IndexIntoFile::invalidEntry),
193  productRegistry_(),
194  branchIDLists_(),
195  branchIDListHelper_(branchIDListHelper),
196  processingMode_(processingMode),
197  forcedRunOffset_(0),
198  newBranchToOldBranch_(),
199  eventHistoryTree_(nullptr),
200  eventSelectionIDs_(),
201  branchListIndexes_(),
202  history_(),
203  branchChildren_(new BranchChildren),
204  duplicateChecker_(duplicateChecker),
205  provenanceAdaptor_(),
206  provenanceReaderMaker_(),
207  eventProductProvenanceRetrievers_(),
208  parentageIDLookup_(),
209  daqProvenanceHelper_() {
210 
211  hasNewlyDroppedBranch_.fill(false);
212 
216 
217  // Read the metadata tree.
218  // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
219  std::unique_ptr<TTree> metaDataTree(dynamic_cast<TTree *>(filePtr_->Get(poolNames::metaDataTreeName().c_str())));
220  if(nullptr == metaDataTree.get()) {
221  throw Exception(errors::FileReadError) << "Could not find tree " << poolNames::metaDataTreeName()
222  << " in the input file.\n";
223  }
224 
225  // To keep things simple, we just read in every possible branch that exists.
226  // We don't pay attention to which branches exist in which file format versions
227 
229  if(metaDataTree->FindBranch(poolNames::fileFormatVersionBranchName().c_str()) != nullptr) {
230  TBranch *fft = metaDataTree->GetBranch(poolNames::fileFormatVersionBranchName().c_str());
231  fft->SetAddress(&fftPtr);
232  roottree::getEntry(fft, 0);
233  metaDataTree->SetBranchAddress(poolNames::fileFormatVersionBranchName().c_str(), &fftPtr);
234  }
235 
236  FileID *fidPtr = &fid_;
237  if(metaDataTree->FindBranch(poolNames::fileIdentifierBranchName().c_str()) != nullptr) {
238  metaDataTree->SetBranchAddress(poolNames::fileIdentifierBranchName().c_str(), &fidPtr);
239  }
240 
241  IndexIntoFile *iifPtr = &indexIntoFile_;
242  if(metaDataTree->FindBranch(poolNames::indexIntoFileBranchName().c_str()) != nullptr) {
243  metaDataTree->SetBranchAddress(poolNames::indexIntoFileBranchName().c_str(), &iifPtr);
244  }
245 
246  // Need to read to a temporary registry so we can do a translation of the BranchKeys.
247  // This preserves backward compatibility against friendly class name algorithm changes.
248  ProductRegistry inputProdDescReg;
249  ProductRegistry *ppReg = &inputProdDescReg;
250  metaDataTree->SetBranchAddress(poolNames::productDescriptionBranchName().c_str(), (&ppReg));
251 
252  typedef std::map<ParameterSetID, ParameterSetBlob> PsetMap;
253  PsetMap psetMap;
254  PsetMap *psetMapPtr = &psetMap;
255  if(metaDataTree->FindBranch(poolNames::parameterSetMapBranchName().c_str()) != nullptr) {
256  //backward compatibility
257  assert(!fileFormatVersion().parameterSetsTree());
258  metaDataTree->SetBranchAddress(poolNames::parameterSetMapBranchName().c_str(), &psetMapPtr);
259  } else {
260  assert(fileFormatVersion().parameterSetsTree());
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> psetTree(dynamic_cast<TTree *>(filePtr_->Get(poolNames::parameterSetsTreeName().c_str())));
263  if(nullptr == psetTree.get()) {
264  throw Exception(errors::FileReadError) << "Could not find tree " << poolNames::parameterSetsTreeName()
265  << " in the input file.\n";
266  }
267 
268  typedef std::pair<ParameterSetID, ParameterSetBlob> IdToBlobs;
269  IdToBlobs idToBlob;
270  IdToBlobs* pIdToBlob = &idToBlob;
271  psetTree->SetBranchAddress(poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
272 
273  std::unique_ptr<TTreeCache> psetTreeCache = roottree::trainCache(psetTree.get(), *filePtr_, roottree::defaultNonEventCacheSize, "*");
274  psetTreeCache->SetEnablePrefetching(false);
275  filePtr_->SetCacheRead(psetTreeCache.get());
276  for(Long64_t i = 0; i != psetTree->GetEntries(); ++i) {
277  psetTree->GetEntry(i);
278  psetMap.insert(idToBlob);
279  }
280  filePtr_->SetCacheRead(0);
281  }
282 
283  // backward compatibility
285  ProcessHistoryRegistry::collection_type *pHistMapPtr = &pHistMap;
286  if(metaDataTree->FindBranch(poolNames::processHistoryMapBranchName().c_str()) != nullptr) {
287  metaDataTree->SetBranchAddress(poolNames::processHistoryMapBranchName().c_str(), &pHistMapPtr);
288  }
289 
291  ProcessHistoryRegistry::vector_type *pHistVectorPtr = &pHistVector;
292  if(metaDataTree->FindBranch(poolNames::processHistoryBranchName().c_str()) != nullptr) {
293  metaDataTree->SetBranchAddress(poolNames::processHistoryBranchName().c_str(), &pHistVectorPtr);
294  }
295 
296  // backward compatibility
297  ProcessConfigurationVector processConfigurations;
298  ProcessConfigurationVector* procConfigVectorPtr = &processConfigurations;
299  if(metaDataTree->FindBranch(poolNames::processConfigurationBranchName().c_str()) != nullptr) {
300  metaDataTree->SetBranchAddress(poolNames::processConfigurationBranchName().c_str(), &procConfigVectorPtr);
301  }
302 
303  std::unique_ptr<BranchIDLists> branchIDListsAPtr(new BranchIDLists);
304  BranchIDLists* branchIDListsPtr = branchIDListsAPtr.get();
305  if(metaDataTree->FindBranch(poolNames::branchIDListBranchName().c_str()) != nullptr) {
306  metaDataTree->SetBranchAddress(poolNames::branchIDListBranchName().c_str(), &branchIDListsPtr);
307  }
308 
309  BranchChildren* branchChildrenBuffer = branchChildren_.get();
310  if(metaDataTree->FindBranch(poolNames::productDependenciesBranchName().c_str()) != nullptr) {
311  metaDataTree->SetBranchAddress(poolNames::productDependenciesBranchName().c_str(), &branchChildrenBuffer);
312  }
313 
314  // backward compatibility
315  std::vector<EventProcessHistoryID> *eventHistoryIDsPtr = &eventProcessHistoryIDs_;
316  if(metaDataTree->FindBranch(poolNames::eventHistoryBranchName().c_str()) != nullptr) {
317  metaDataTree->SetBranchAddress(poolNames::eventHistoryBranchName().c_str(), &eventHistoryIDsPtr);
318  }
319 
320  if(metaDataTree->FindBranch(poolNames::moduleDescriptionMapBranchName().c_str()) != nullptr) {
321  if(metaDataTree->GetBranch(poolNames::moduleDescriptionMapBranchName().c_str())->GetSplitLevel() != 0) {
322  metaDataTree->SetBranchStatus((poolNames::moduleDescriptionMapBranchName() + ".*").c_str(), 0);
323  } else {
324  metaDataTree->SetBranchStatus(poolNames::moduleDescriptionMapBranchName().c_str(), 0);
325  }
326  }
327 
328  // Here we read the metadata tree
329  roottree::getEntry(metaDataTree.get(), 0);
330 
332 
333  // Here we read the event history tree, if we have one.
335 
337  if(!fileFormatVersion().triggerPathsTracked()) {
338  ParameterSetConverter converter(psetMap, psetIdConverter, fileFormatVersion().parameterSetsByReference());
339  } else {
340  // Merge into the parameter set registry.
341  pset::Registry& psetRegistry = *pset::Registry::instance();
342  for(auto const& psetEntry : psetMap) {
343  ParameterSet pset(psetEntry.second.pset());
344  pset.setID(psetEntry.first);
345  // For thread safety, don't update global registries when a secondary source opens a file.
346  if(inputType != InputType::SecondarySource) {
347  psetRegistry.insertMapped(pset);
348  }
349  }
350  }
351  if(!fileFormatVersion().splitProductIDs()) {
352  // Old provenance format input file. Create a provenance adaptor.
354  inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter, true));
355  // Fill in the branchIDLists branch from the provenance adaptor
356  branchIDLists_ = provenanceAdaptor_->branchIDLists();
357  } else {
358  if(!fileFormatVersion().triggerPathsTracked()) {
359  // New provenance format, but change in ParameterSet Format. Create a provenance adaptor.
361  inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter, false));
362  }
363  // New provenance format input file. The branchIDLists branch was read directly from the input file.
364  if(metaDataTree->FindBranch(poolNames::branchIDListBranchName().c_str()) == nullptr) {
366  << "Failed to find branchIDLists branch in metaData tree.\n";
367  }
368  branchIDLists_.reset(branchIDListsAPtr.release());
369  }
370 
371  if(!bypassVersionCheck) {
372  checkReleaseVersion(pHistVector, file());
373  }
374 
375  if(labelRawDataLikeMC) {
376  std::string const rawData("FEDRawDataCollection");
377  std::string const source("source");
378  ProductRegistry::ProductList& pList = inputProdDescReg.productListUpdator();
379  BranchKey finder(rawData, source, "", "");
380  ProductRegistry::ProductList::iterator it = pList.lower_bound(finder);
381  if(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() == source) {
382  // We found raw data with a module label of source.
383  // We need to change the module label and process name.
384  // Create helper.
385  it->second.init();
386  daqProvenanceHelper_.reset(new DaqProvenanceHelper(it->second.unwrappedTypeID()));
387  // Create the new branch description
388  BranchDescription const& newBD = daqProvenanceHelper_->branchDescription();
389  // Save info from the old and new branch descriptions
390  daqProvenanceHelper_->saveInfo(it->second, newBD);
391  // Map the new branch name to the old branch name.
392  newBranchToOldBranch_.insert(std::make_pair(newBD.branchName(), it->second.branchName()));
393  // Remove the old branch description from the product Registry.
394  pList.erase(it);
395  // Check that there was only one.
396  it = pList.lower_bound(finder);
397  assert(!(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() == source));
398  // Insert the new branch description into the product registry.
399  inputProdDescReg.copyProduct(newBD);
400  // Fix up other per file metadata.
401  daqProvenanceHelper_->fixMetaData(processConfigurations, pHistVector);
402  daqProvenanceHelper_->fixMetaData(*branchIDLists_);
403  daqProvenanceHelper_->fixMetaData(*branchChildren_);
404  }
405  }
406 
407  for(auto const& history : pHistVector) {
408  processHistoryRegistry.registerProcessHistory(history);
409  }
410 
412 
413  // Update the branch id info. This has to be done before validateFile since
414  // depending on the file format, the branchIDListHelper_ may have its fixBranchListIndexes call made
415  if(inputType == InputType::Primary || inputType == InputType::SecondarySource) {
417  }
418 
419  validateFile(inputType, usingGoToEvent);
420 
421  // Here, we make the class that will make the ProvenanceReader
422  // It reads whatever trees it needs.
424 
425  // Merge into the hashed registries.
426  if(eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
428  }
429 
430  initializeDuplicateChecker(indexesIntoFiles, currentIndexIntoFile);
432  indexIntoFileEnd_ = indexIntoFile_.end(noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder);
433  forcedRunOffset_ = forcedRunOffset(forcedRunNumber, indexIntoFileBegin_, indexIntoFileEnd_);
434  eventProcessHistoryIter_ = eventProcessHistoryIDs_.begin();
435 
436  // Set product presence information in the product registry.
437  ProductRegistry::ProductList& pList = inputProdDescReg.productListUpdator();
438  for(auto& product : pList) {
439  BranchDescription& prod = product.second;
440  prod.init();
441  treePointers_[prod.branchType()]->setPresence(prod, newBranchToOldBranch(prod.branchName()));
442  }
443 
444  std::unique_ptr<ProductRegistry> newReg(new ProductRegistry);
445 
446  // Do the translation from the old registry to the new one
447  {
448  ProductRegistry::ProductList const& prodList = inputProdDescReg.productList();
449  for(auto const& product : prodList) {
450  BranchDescription const& prod = product.second;
451  std::string newFriendlyName = friendlyname::friendlyName(prod.className());
452  if(newFriendlyName == prod.friendlyClassName()) {
453  newReg->copyProduct(prod);
454  } else {
455  if(fileFormatVersion().splitProductIDs()) {
457  << "Cannot change friendly class name algorithm without more development work\n"
458  << "to update BranchIDLists. Contact the framework group.\n";
459  }
460  BranchDescription newBD(prod);
461  newBD.updateFriendlyClassName();
462  newReg->copyProduct(newBD);
463  newBranchToOldBranch_.insert(std::make_pair(newBD.branchName(), prod.branchName()));
464  }
465  }
466  dropOnInput(*newReg, productSelectorRules, dropDescendants, inputType);
467  // freeze the product registry
468  newReg->setFrozen(inputType != InputType::Primary);
469  productRegistry_.reset(newReg.release());
470  }
471 
472  // Set up information from the product registry.
473  ProductRegistry::ProductList const& prodList = productRegistry()->productList();
474  for(auto const& product : prodList) {
475  BranchDescription const& prod = product.second;
476  treePointers_[prod.branchType()]->addBranch(product.first, prod,
478  }
479 
480  // Determine if this file is fast clonable.
481  setIfFastClonable(remainingEvents, remainingLumis);
482 
483  setRefCoreStreamer(true); // backward compatibility
484 
485  // We are done with our initial reading of EventAuxiliary.
487 
488  // Tell the event tree to begin training at the next read.
490 
491  // Train the run and lumi trees.
492  runTree_.trainCache("*");
493  lumiTree_.trainCache("*");
494  }
495 
497  }
498 
499  void
501  // Called only for old format files.
502  // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
503  std::unique_ptr<TTree> entryDescriptionTree(dynamic_cast<TTree*>(filePtr_->Get(poolNames::entryDescriptionTreeName().c_str())));
504  if(nullptr == entryDescriptionTree.get()) {
505  throw Exception(errors::FileReadError) << "Could not find tree " << poolNames::entryDescriptionTreeName()
506  << " in the input file.\n";
507  }
508 
509  EntryDescriptionID idBuffer;
510  EntryDescriptionID* pidBuffer = &idBuffer;
511  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionIDBranchName().c_str(), &pidBuffer);
512 
513  EventEntryDescription entryDescriptionBuffer;
514  EventEntryDescription *pEntryDescriptionBuffer = &entryDescriptionBuffer;
515  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionBranchName().c_str(), &pEntryDescriptionBuffer);
516 
517  // Fill in the parentage registry.
519 
520  for(Long64_t i = 0, numEntries = entryDescriptionTree->GetEntries(); i < numEntries; ++i) {
521  roottree::getEntry(entryDescriptionTree.get(), i);
522  if(idBuffer != entryDescriptionBuffer.id()) {
523  throw Exception(errors::EventCorruption) << "Corruption of EntryDescription tree detected.\n";
524  }
525  entryDescriptionMap.insert(std::make_pair(entryDescriptionBuffer.id(),entryDescriptionBuffer));
527  parents.setParents(entryDescriptionBuffer.parents());
529  ParentageID const oldID = parents.id();
530  daqProvenanceHelper_->fixMetaData(parents.parentsForUpdate());
531  ParentageID newID = parents.id();
532  if(newID != oldID) {
533  daqProvenanceHelper_->setOldParentageIDToNew(oldID,newID);
534  }
535  }
536  // For thread safety, don't update global registries when a secondary source opens a file.
537  if(inputType != InputType::SecondarySource) {
538  registry.insertMapped(parents);
539  }
540  }
541  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionIDBranchName().c_str(), nullptr);
542  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionBranchName().c_str(), nullptr);
543  }
544 
545  void
547  // New format file
548  // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
549  std::unique_ptr<TTree> parentageTree(dynamic_cast<TTree*>(filePtr_->Get(poolNames::parentageTreeName().c_str())));
550  if(nullptr == parentageTree.get()) {
551  throw Exception(errors::FileReadError) << "Could not find tree " << poolNames::parentageTreeName()
552  << " in the input file.\n";
553  }
554 
556  Parentage *pParentageBuffer = &parents;
557  parentageTree->SetBranchAddress(poolNames::parentageBranchName().c_str(), &pParentageBuffer);
558 
560 
561  parentageIDLookup_.reserve(parentageTree->GetEntries());
562  for(Long64_t i = 0, numEntries = parentageTree->GetEntries(); i < numEntries; ++i) {
563  roottree::getEntry(parentageTree.get(), i);
565  ParentageID const oldID = parents.id();
566  daqProvenanceHelper_->fixMetaData(parents.parentsForUpdate());
567  ParentageID newID = parents.id();
568  if(newID != oldID) {
569  daqProvenanceHelper_->setOldParentageIDToNew(oldID,newID);
570  }
571  }
572  // For thread safety, don't update global registries when a secondary source opens a file.
573  if(inputType != InputType::SecondarySource) {
574  registry.insertMapped(parents);
575  }
576  parentageIDLookup_.push_back(parents.id());
577  }
578  parentageTree->SetBranchAddress(poolNames::parentageBranchName().c_str(), nullptr);
579  }
580 
581  void
582  RootFile::setIfFastClonable(int remainingEvents, int remainingLumis) {
583  if(fileFormatVersion().noMetaDataTrees() and !fileFormatVersion().storedProductProvenanceUsed()) {
584  //we must avoid copying the old branch which stored the per product per event provenance
586  return;
587  }
588  if(!fileFormatVersion().splitProductIDs()) {
590  return;
591  }
594  return;
595  }
596  // Find entry for first event in file
598  while(it != indexIntoFileEnd_ && it.getEntryType() != IndexIntoFile::kEvent) {
599  ++it;
600  }
601  if(it == indexIntoFileEnd_) {
603  return;
604  }
605 
606  // From here on, record all reasons we can't fast clone.
610  }
611  if(skipAnyEvents_) {
613  }
614  if(remainingEvents >= 0 && eventTree_.entries() > remainingEvents) {
616  }
617  if(remainingLumis >= 0 && lumiTree_.entries() > remainingLumis) {
619  }
620  // We no longer fast copy the EventAuxiliary branch, so there
621  // is no longer any need to disable fast copying because the run
622  // number is being modified. Also, this check did not work anyway
623  // because this function is called before forcedRunOffset_ is set.
624 
625  // if(forcedRunOffset_ != 0) {
626  // whyNotFastClonable_ += FileBlock::RunNumberModified;
627  // }
628  if(duplicateChecker_ &&
629  !duplicateChecker_->checkDisabled() &&
630  !duplicateChecker_->noDuplicatesInFile()) {
632  }
633  }
634 
635  std::unique_ptr<FileBlock>
637  return std::unique_ptr<FileBlock>(new FileBlock(fileFormatVersion(),
638  eventTree_.tree(),
640  lumiTree_.tree(),
642  runTree_.tree(),
643  runTree_.metaTree(),
646  file_,
648  modifiedIDs(),
649  branchChildren_));
650  }
651 
652  std::string const&
653  RootFile::newBranchToOldBranch(std::string const& newBranch) const {
654  std::map<std::string, std::string>::const_iterator it = newBranchToOldBranch_.find(newBranch);
655  if(it != newBranchToOldBranch_.end()) {
656  return it->second;
657  }
658  return newBranch;
659  }
660 
663  return indexIntoFileIter_;
664  }
665 
666  void
669  }
670 
671  bool
674  return false;
675  }
676  if(eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
677 
678  // See first if the entire lumi or run is skipped, so we won't have to read the event Auxiliary in that case.
680  return true;
681  }
682 
683  // The Lumi is not skipped. If this is an event, see if the event is skipped.
688  eventAux_.id().event())) {
689  return true;
690  }
691  }
692 
693  // Skip runs with no lumis if either lumisToSkip or lumisToProcess have been set to select lumis
695  eventSkipperByID_->skippingLumis()) {
697 
698  // There are no lumis in this run, not even ones we will skip
699  if(iterLumi.peekAheadAtLumi() == IndexIntoFile::invalidLumi) {
700  return true;
701  }
702  // If we get here there are lumis in the run, check to see if we are skipping all of them
703  do {
704  if(!eventSkipperByID_->skipIt(iterLumi.run(), iterLumi.peekAheadAtLumi(), 0U)) {
705  return false;
706  }
707  }
708  while(iterLumi.skipLumiInRun());
709  return true;
710  }
711  }
712  return false;
713  }
714 
715  bool
718  if(duplicateChecker_.get() == nullptr) {
719  return false;
720  }
722  return duplicateChecker_->isDuplicateAndCheckActive(indexIntoFileIter_.processHistoryIDIndex(),
724  }
725 
726  bool
728  return indexIntoFile_.containsItem(run, lumi, event);
729  }
730 
733  // First, account for consecutive skipped entries.
734  while(skipThisEntry()) {
737  }
740  }
741  else {
743  }
744  }
745  // OK, we have an entry that is not skipped.
747  if(entryType == IndexIntoFile::kEnd) {
748  return IndexIntoFile::kEnd;
749  }
750  if(entryType == IndexIntoFile::kRun) {
751  run = indexIntoFileIter_.run();
752  return IndexIntoFile::kRun;
753  } else if(processingMode_ == InputSource::Runs) {
755  return getNextItemType(run, lumi, event);
756  }
757  if(entryType == IndexIntoFile::kLumi) {
758  run = indexIntoFileIter_.run();
759  lumi = indexIntoFileIter_.lumi();
760  return IndexIntoFile::kLumi;
763  return getNextItemType(run, lumi, event);
764  }
765  if(isDuplicateEvent()) {
767  return getNextItemType(run, lumi, event);
768  }
769  run = indexIntoFileIter_.run();
770  lumi = indexIntoFileIter_.lumi();
772  event = eventAux_.event();
773  return IndexIntoFile::kEvent;
774  }
775 
776  bool
779  itr.advanceToEvent();
780  return itr.getEntryType() == IndexIntoFile::kEnd;
781  }
782 
783  bool
786  int phIndex;
789  IndexIntoFile::EntryNumber_t eventEntry;
790  itr.skipEventBackward(phIndex,
791  run,
792  lumi,
793  eventEntry);
794  itr.skipEventBackward(phIndex,
795  run,
796  lumi,
797  eventEntry);
798  return eventEntry == IndexIntoFile::invalidEntry;
799  }
800 
801  namespace {
802  struct RunItem {
803  RunItem(ProcessHistoryID const& phid, RunNumber_t const& run) :
804  phid_(phid), run_(run) {}
805  ProcessHistoryID phid_;
806  RunNumber_t run_;
807  };
808  struct RunItemSortByRun {
809  bool operator()(RunItem const& a, RunItem const& b) const {
810  return a.run_ < b.run_;
811  }
812  };
813  struct RunItemSortByRunPhid {
814  bool operator()(RunItem const& a, RunItem const& b) const {
815  return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.phid_ < b.phid_);
816  }
817  };
818  struct LumiItem {
819  LumiItem(ProcessHistoryID const& phid, RunNumber_t const& run,
821  phid_(phid), run_(run), lumi_(lumi), firstEventEntry_(entry),
822  lastEventEntry_(entry == IndexIntoFile::invalidEntry ? IndexIntoFile::invalidEntry : entry + 1) {}
823  ProcessHistoryID phid_;
824  RunNumber_t run_;
826  IndexIntoFile::EntryNumber_t firstEventEntry_;
827  IndexIntoFile::EntryNumber_t lastEventEntry_;
828  };
829  struct LumiItemSortByRunLumi {
830  bool operator()(LumiItem const& a, LumiItem const& b) const {
831  return a.run_ < b.run_ || (!(b.run_ < a.run_) && a.lumi_ < b.lumi_);
832  }
833  };
834  struct LumiItemSortByRunLumiPhid {
835  bool operator()(LumiItem const& a, LumiItem const& b) const {
836  if(a.run_ < b.run_) return true;
837  if(b.run_ < a.run_) return false;
838  if(a.lumi_ < b.lumi_) return true;
839  if(b.lumi_ < a.lumi_) return false;
840  return a.phid_ < b.phid_;
841  }
842  };
843  }
844 
845  void
847  // This function is for backward compatibility.
848  // If reading a current format file, indexIntoFile_ is read from the input
849  // file and should always be there. Note that the algorithm below will work
850  // sometimes but often fail with the new format introduced in release 3_8_0.
851  // If it ever becomes necessary to rebuild IndexIntoFile from the new format,
852  // probably a separate function should be written to deal with the task.
853  // This is possible just not implemented yet.
854  assert(!fileFormatVersion().hasIndexIntoFile());
855 
856  typedef std::list<LumiItem> LumiList;
857  LumiList lumis; // (declare 1)
858 
859  typedef std::set<LuminosityBlockID> RunLumiSet;
860  RunLumiSet runLumiSet; // (declare 2)
861 
862  typedef std::list<RunItem> RunList;
863  RunList runs; // (declare 5)
864 
865  typedef std::set<RunNumber_t> RunSet;
866  RunSet runSet; // (declare 4)
867 
868  typedef std::set<RunItem, RunItemSortByRunPhid> RunItemSet;
869  RunItemSet runItemSet; // (declare 3)
870 
871  typedef std::map<RunNumber_t, ProcessHistoryID> PHIDMap;
872  PHIDMap phidMap;
873 
874  RunNumber_t prevRun = 0;
875  LuminosityBlockNumber_t prevLumi = 0;
876  ProcessHistoryID prevPhid;
877  bool iFirst = true;
878 
879  indexIntoFile_.unsortedEventNumbers().clear(); // should already be empty, just being careful
881 
882  // First, loop through the event tree.
883  while(eventTree_.next()) {
884  bool newRun = false;
885  bool newLumi = false;
888 
889  // Save the event numbers as we loop through the event auxiliary to avoid
890  // having to read through the event auxiliary again later. These event numbers
891  // are not actually used in this function, but could be needed elsewhere.
893 
894  ProcessHistoryID reducedPHID = processHistoryRegistry_->reducedProcessHistoryID(eventAux().processHistoryID());
895 
896  if(iFirst || prevPhid != reducedPHID || prevRun != eventAux().run()) {
897  iFirst = false;
898  newRun = newLumi = true;
899  } else if(prevLumi != eventAux().luminosityBlock()) {
900  newLumi = true;
901  }
902  prevPhid = reducedPHID;
903  prevRun = eventAux().run();
904  prevLumi = eventAux().luminosityBlock();
905  if(newLumi) {
906  lumis.emplace_back(reducedPHID,
907  eventAux().run(), eventAux().luminosityBlock(), eventTree_.entryNumber()); // (insert 1)
908  runLumiSet.insert(LuminosityBlockID(eventAux().run(), eventAux().luminosityBlock())); // (insert 2)
909  } else {
910  LumiItem& currentLumi = lumis.back();
911  assert(currentLumi.lastEventEntry_ == eventTree_.entryNumber());
912  ++currentLumi.lastEventEntry_;
913  }
914  if(newRun) {
915  // Insert run in list if it is not already there.
916  RunItem item(reducedPHID, eventAux().run());
917  if(runItemSet.insert(item).second) { // (check 3, insert 3)
918  runs.push_back(std::move(item)); // (insert 5)
919  runSet.insert(eventAux().run()); // (insert 4)
920  phidMap.insert(std::make_pair(eventAux().run(), reducedPHID));
921  }
922  }
923  }
924  // now clean up.
928 
929  // Loop over run entries and fill information.
930 
931  typedef std::map<RunNumber_t, IndexIntoFile::EntryNumber_t> RunMap;
932  RunMap runMap; // (declare 11)
933 
934  typedef std::vector<RunItem> RunVector;
935  RunVector emptyRuns; // (declare 12)
936 
937  if(runTree_.isValid()) {
938  while(runTree_.next()) {
939  // Note: adjacent duplicates will be skipped without an explicit check.
940 
941  boost::shared_ptr<RunAuxiliary> runAux = fillRunAuxiliary();
942  ProcessHistoryID reducedPHID = processHistoryRegistry_->reducedProcessHistoryID(runAux->processHistoryID());
943 
944  if(runSet.insert(runAux->run()).second) { // (check 4, insert 4)
945  // This run was not associated with any events.
946  emptyRuns.emplace_back(reducedPHID, runAux->run()); // (insert 12)
947  }
948  runMap.insert(std::make_pair(runAux->run(), runTree_.entryNumber())); // (insert 11)
949  phidMap.insert(std::make_pair(runAux->run(), reducedPHID));
950  }
951  // now clean up.
953  }
954 
955  // Insert the ordered empty runs into the run list.
956  RunItemSortByRun runItemSortByRun;
957  stable_sort_all(emptyRuns, runItemSortByRun);
958 
959  RunList::iterator itRuns = runs.begin(), endRuns = runs.end();
960  for(auto const& emptyRun : emptyRuns) {
961  for(; itRuns != endRuns; ++itRuns) {
962  if(runItemSortByRun(emptyRun, *itRuns)) {
963  break;
964  }
965  }
966  runs.insert(itRuns, emptyRun);
967  }
968 
969  // Loop over luminosity block entries and fill information.
970 
971  typedef std::vector<LumiItem> LumiVector;
972  LumiVector emptyLumis; // (declare 7)
973 
974  typedef std::map<LuminosityBlockID, IndexIntoFile::EntryNumber_t> RunLumiMap;
975  RunLumiMap runLumiMap; // (declare 6)
976 
977  if(lumiTree_.isValid()) {
978  while(lumiTree_.next()) {
979  // Note: adjacent duplicates will be skipped without an explicit check.
980  boost::shared_ptr<LuminosityBlockAuxiliary> lumiAux = fillLumiAuxiliary();
981  LuminosityBlockID lumiID = LuminosityBlockID(lumiAux->run(), lumiAux->luminosityBlock());
982  if(runLumiSet.insert(lumiID).second) { // (check 2, insert 2)
983  // This lumi was not associated with any events.
984  // Use the process history ID from the corresponding run. In cases of practical
985  // importance, this should be the correct process history ID, but it is possible
986  // to construct files where this is not the correct process history ID ...
987  PHIDMap::const_iterator iPhidMap = phidMap.find(lumiAux->run());
988  assert(iPhidMap != phidMap.end());
989  emptyLumis.emplace_back(iPhidMap->second, lumiAux->run(), lumiAux->luminosityBlock(), IndexIntoFile::invalidEntry); // (insert 7)
990  }
991  runLumiMap.insert(std::make_pair(lumiID, lumiTree_.entryNumber()));
992  }
993  // now clean up.
995  }
996 
997  // Insert the ordered empty lumis into the lumi list.
998  LumiItemSortByRunLumi lumiItemSortByRunLumi;
999  stable_sort_all(emptyLumis, lumiItemSortByRunLumi);
1000 
1001  LumiList::iterator itLumis = lumis.begin(), endLumis = lumis.end();
1002  for(auto const& emptyLumi : emptyLumis) {
1003  for(; itLumis != endLumis; ++itLumis) {
1004  if(lumiItemSortByRunLumi(emptyLumi, *itLumis)) {
1005  break;
1006  }
1007  }
1008  lumis.insert(itLumis, emptyLumi);
1009  }
1010 
1011  // Create a map of RunItems that gives the order of first appearance in the list.
1012  // Also fill in the vector of process history IDs
1013  typedef std::map<RunItem, int, RunItemSortByRunPhid> RunCountMap;
1014  RunCountMap runCountMap; // Declare (17)
1015  std::vector<ProcessHistoryID>& phids = indexIntoFile_.setProcessHistoryIDs();
1016  assert(phids.empty());
1017  std::vector<IndexIntoFile::RunOrLumiEntry>& entries = indexIntoFile_.setRunOrLumiEntries();
1018  assert(entries.empty());
1019  int rcount = 0;
1020  for(auto& run : runs) {
1021  RunCountMap::const_iterator countMapItem = runCountMap.find(run);
1022  if(countMapItem == runCountMap.end()) {
1023  countMapItem = runCountMap.insert(std::make_pair(run, rcount)).first; // Insert (17)
1024  assert(countMapItem != runCountMap.end());
1025  ++rcount;
1026  }
1027  std::vector<ProcessHistoryID>::const_iterator phidItem = find_in_all(phids, run.phid_);
1028  if(phidItem == phids.end()) {
1029  phids.push_back(run.phid_);
1030  phidItem = phids.end() - 1;
1031  }
1032  entries.emplace_back(
1033  countMapItem->second, // use (17)
1035  runMap[run.run_], // use (11)
1036  phidItem - phids.begin(),
1037  run.run_,
1038  0U,
1041  }
1042 
1043  // Create a map of LumiItems that gives the order of first appearance in the list.
1044  typedef std::map<LumiItem, int, LumiItemSortByRunLumiPhid> LumiCountMap;
1045  LumiCountMap lumiCountMap; // Declare (19)
1046  int lcount = 0;
1047  for(auto& lumi : lumis) {
1048  RunCountMap::const_iterator runCountMapItem = runCountMap.find(RunItem(lumi.phid_, lumi.run_));
1049  assert(runCountMapItem != runCountMap.end());
1050  LumiCountMap::const_iterator countMapItem = lumiCountMap.find(lumi);
1051  if(countMapItem == lumiCountMap.end()) {
1052  countMapItem = lumiCountMap.insert(std::make_pair(lumi, lcount)).first; // Insert (17)
1053  assert(countMapItem != lumiCountMap.end());
1054  ++lcount;
1055  }
1056  std::vector<ProcessHistoryID>::const_iterator phidItem = find_in_all(phids, lumi.phid_);
1057  assert(phidItem != phids.end());
1058  entries.emplace_back(
1059  runCountMapItem->second,
1060  countMapItem->second,
1061  runLumiMap[LuminosityBlockID(lumi.run_, lumi.lumi_)],
1062  phidItem - phids.begin(),
1063  lumi.run_,
1064  lumi.lumi_,
1065  lumi.firstEventEntry_,
1066  lumi.lastEventEntry_);
1067  }
1068  stable_sort_all(entries);
1069  }
1070 
1071  void
1072  RootFile::validateFile(InputType inputType, bool usingGoToEvent) {
1073  if(!fid_.isValid()) {
1075  }
1076  if(!eventTree_.isValid()) {
1078  "'Events' tree is corrupted or not present\n" << "in the input file.\n";
1079  }
1080 
1081  if(fileFormatVersion().hasIndexIntoFile()) {
1082  if(runTree().entries() > 0) {
1083  assert(!indexIntoFile_.empty());
1084  }
1086  if(daqProvenanceHelper_) {
1087  std::vector<ProcessHistoryID>& phidVec = indexIntoFile_.setProcessHistoryIDs();
1088  for(auto& phid : phidVec) {
1089  phid = daqProvenanceHelper_->mapProcessHistoryID(phid);
1090  }
1091  }
1093  }
1094  }
1095  else {
1096  assert(indexIntoFile_.empty());
1098  }
1099 
1102  indexIntoFile_.setEventFinder(boost::shared_ptr<IndexIntoFile::EventFinder>(new RootFileEventFinder(eventTree_)));
1103  // We fill the event numbers explicitly if we need to find events in closed files,
1104  // such as for secondary files (or secondary sources) or if duplicate checking across files.
1105  bool needEventNumbers = false;
1106  bool needIndexesForDuplicateChecker = duplicateChecker_ && duplicateChecker_->checkingAllFiles() && !duplicateChecker_->checkDisabled();
1107  if(inputType != InputType::Primary || needIndexesForDuplicateChecker || usingGoToEvent) {
1108  needEventNumbers = true;
1109  }
1110  bool needEventEntries = false;
1111  if(inputType != InputType::Primary || !noEventSort_) {
1112  // We need event entries for sorting or for secondary files or sources.
1113  needEventEntries = true;
1114  }
1115  indexIntoFile_.fillEventNumbersOrEntries(needEventNumbers, needEventEntries);
1116  }
1117 
1118  void
1120  // Report file opened.
1121  std::string const label = "source";
1122  std::string moduleName = "PoolSource";
1123  filePtr_->inputFileOpened(
1124  logicalFile_,
1125  inputType,
1126  moduleName,
1127  label,
1128  fid_.fid(),
1130  }
1131 
1132  void
1134  // Just to play it safe, zero all pointers to objects in the InputFile to be closed.
1135  eventHistoryTree_ = nullptr;
1136  for(auto& treePointer : treePointers_) {
1137  treePointer->close();
1138  treePointer = nullptr;
1139  }
1140  filePtr_->Close();
1141  filePtr_.reset();
1142  }
1143 
1144  void
1147  // Already read.
1148  return;
1149  }
1151  EventAuxiliary *pEvAux = &eventAux_;
1153  } else {
1154  // for backward compatibility.
1156  EventAux *pEvAux = &eventAux;
1157  eventTree_.fillAux<EventAux>(pEvAux);
1158  conversion(eventAux, eventAux_);
1159  }
1161  }
1162 
1163  bool
1165  if(!eventTree_.current(entry)) {
1166  return false;
1167  }
1168  eventTree_.setEntryNumber(entry);
1170  return true;
1171  }
1172 
1173  void
1175  // We could consider doing delayed reading, but because we have to
1176  // store this History object in a different tree than the event
1177  // data tree, this is too hard to do in this first version.
1178 
1179  if(fileFormatVersion().eventHistoryBranch()) {
1180  // Lumi block number was not in EventID for the relevant releases.
1181  EventID id(eventAux().id().run(), 0, eventAux().id().event());
1182  if(eventProcessHistoryIter_->eventID() != id) {
1185  assert(eventProcessHistoryIter_->eventID() == id);
1186  }
1189  } else if(fileFormatVersion().eventHistoryTree()) {
1190  // for backward compatibility.
1191  History* pHistory = history_.get();
1192  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(poolNames::eventHistoryBranchName().c_str());
1193  if(!eventHistoryBranch) {
1195  << "Failed to find history branch in event history tree.\n";
1196  }
1197  eventHistoryBranch->SetAddress(&pHistory);
1199  eventAux_.setProcessHistoryID(history_->processHistoryID());
1200  eventSelectionIDs_.swap(history_->eventSelectionIDs());
1201  branchListIndexes_.swap(history_->branchListIndexes());
1202  } else if(fileFormatVersion().noMetaDataTrees()) {
1203  // Current format
1205  TBranch* eventSelectionIDBranch = eventTree_.tree()->GetBranch(poolNames::eventSelectionsBranchName().c_str());
1206  assert(eventSelectionIDBranch != nullptr);
1207  eventTree_.fillBranchEntry(eventSelectionIDBranch, pESV);
1209  TBranch* branchListIndexesBranch = eventTree_.tree()->GetBranch(poolNames::branchListIndexesBranchName().c_str());
1210  assert(branchListIndexesBranch != nullptr);
1211  eventTree_.fillBranchEntry(branchListIndexesBranch, pBLI);
1212  }
1213  if(provenanceAdaptor_) {
1214  eventAux_.setProcessHistoryID(provenanceAdaptor_->convertID(eventAux().processHistoryID()));
1215  for(auto& esID : eventSelectionIDs_) {
1216  esID = provenanceAdaptor_->convertID(esID);
1217  }
1218  }
1219  if(daqProvenanceHelper_) {
1221  }
1223  // old format. branchListIndexes_ must be filled in from the ProvenanceAdaptor.
1224  provenanceAdaptor_->branchListIndexes(branchListIndexes_);
1225  }
1226  branchIDListHelper_->fixBranchListIndexes(branchListIndexes_);
1227  }
1228 
1229  boost::shared_ptr<LuminosityBlockAuxiliary>
1231  boost::shared_ptr<LuminosityBlockAuxiliary> lumiAuxiliary(new LuminosityBlockAuxiliary);
1232  if(fileFormatVersion().newAuxiliary()) {
1233  LuminosityBlockAuxiliary *pLumiAux = lumiAuxiliary.get();
1235  } else {
1236  LuminosityBlockAux lumiAux;
1237  LuminosityBlockAux *pLumiAux = &lumiAux;
1239  conversion(lumiAux, *lumiAuxiliary);
1240  }
1241  if(provenanceAdaptor_) {
1242  lumiAuxiliary->setProcessHistoryID(provenanceAdaptor_->convertID(lumiAuxiliary->processHistoryID()));
1243  }
1244  if(daqProvenanceHelper_) {
1245  lumiAuxiliary->setProcessHistoryID(daqProvenanceHelper_->mapProcessHistoryID(lumiAuxiliary->processHistoryID()));
1246  }
1247  if(lumiAuxiliary->luminosityBlock() == 0 && !fileFormatVersion().runsAndLumis()) {
1248  lumiAuxiliary->id() = LuminosityBlockID(RunNumber_t(1), LuminosityBlockNumber_t(1));
1249  }
1250  return lumiAuxiliary;
1251  }
1252 
1253  boost::shared_ptr<RunAuxiliary>
1255  boost::shared_ptr<RunAuxiliary> runAuxiliary(new RunAuxiliary);
1256  if(fileFormatVersion().newAuxiliary()) {
1257  RunAuxiliary *pRunAux = runAuxiliary.get();
1258  runTree_.fillAux<RunAuxiliary>(pRunAux);
1259  } else {
1260  RunAux runAux;
1261  RunAux *pRunAux = &runAux;
1262  runTree_.fillAux<RunAux>(pRunAux);
1263  conversion(runAux, *runAuxiliary);
1264  }
1265  if(provenanceAdaptor_) {
1266  runAuxiliary->setProcessHistoryID(provenanceAdaptor_->convertID(runAuxiliary->processHistoryID()));
1267  }
1268  if(daqProvenanceHelper_) {
1269  runAuxiliary->setProcessHistoryID(daqProvenanceHelper_->mapProcessHistoryID(runAuxiliary->processHistoryID()));
1270  }
1271  return runAuxiliary;
1272  }
1273 
1274  bool
1276  while(offset > 0 && indexIntoFileIter_ != indexIntoFileEnd_) {
1277 
1278  int phIndexOfSkippedEvent = IndexIntoFile::invalidIndex;
1279  RunNumber_t runOfSkippedEvent = IndexIntoFile::invalidRun;
1282 
1283  indexIntoFileIter_.skipEventForward(phIndexOfSkippedEvent,
1284  runOfSkippedEvent,
1285  lumiOfSkippedEvent,
1286  skippedEventEntry);
1287 
1288  // At the end of the file and there were no more events to skip
1289  if(skippedEventEntry == IndexIntoFile::invalidEntry) break;
1290 
1291  if(eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
1292  fillEventAuxiliary(skippedEventEntry);
1293  if(eventSkipperByID_->skipIt(runOfSkippedEvent, lumiOfSkippedEvent, eventAux_.id().event())) {
1294  continue;
1295  }
1296  }
1297  if(duplicateChecker_ &&
1298  !duplicateChecker_->checkDisabled() &&
1299  !duplicateChecker_->noDuplicatesInFile()) {
1300 
1301  fillEventAuxiliary(skippedEventEntry);
1302  if(duplicateChecker_->isDuplicateAndCheckActive(phIndexOfSkippedEvent,
1303  runOfSkippedEvent,
1304  lumiOfSkippedEvent,
1305  eventAux_.id().event(),
1306  file_)) {
1307  continue;
1308  }
1309  }
1310  --offset;
1311  }
1312 
1313  while(offset < 0) {
1314 
1315  if(duplicateChecker_) {
1316  duplicateChecker_->disable();
1317  }
1318 
1319  int phIndexOfEvent = IndexIntoFile::invalidIndex;
1323 
1324  indexIntoFileIter_.skipEventBackward(phIndexOfEvent,
1325  runOfEvent,
1326  lumiOfEvent,
1327  eventEntry);
1328 
1329  if(eventEntry == IndexIntoFile::invalidEntry) break;
1330 
1331  if(eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
1332  fillEventAuxiliary(eventEntry);
1333  if(eventSkipperByID_->skipIt(runOfEvent, lumiOfEvent, eventAux_.id().event())) {
1334  continue;
1335  }
1336  }
1337  ++offset;
1338  }
1340  }
1341 
1342  bool
1343  RootFile::goToEvent(EventID const& eventID) {
1344 
1346 
1347  if(duplicateChecker_) {
1348  duplicateChecker_->disable();
1349  }
1350 
1353 
1355  indexIntoFile_.findPosition(sortOrder, eventID.run(), eventID.luminosityBlock(), eventID.event());
1356 
1357  if(iter == indexIntoFile_.end(sortOrder)) {
1358  return false;
1359  }
1361  return true;
1362  }
1363 
1364  // readEvent() is responsible for creating, and setting up, the
1365  // EventPrincipal.
1366  //
1367  // 1. create an EventPrincipal with a unique EventID
1368  // 2. For each entry in the provenance, put in one ProductHolder,
1369  // holding the Provenance for the corresponding EDProduct.
1370  // 3. set up the the EventPrincipal to know about this ProductHolder.
1371  //
1372  // We do *not* create the EDProduct instance (the equivalent of reading
1373  // the branch containing this EDProduct. That will be done by the Delayed Reader,
1374  // when it is asked to do so.
1375  //
1376  void
1380  // read the event auxiliary if not alrady read.
1382 
1383  // read the event
1384  readCurrentEvent(principal);
1385 
1386  assert(eventAux().run() == indexIntoFileIter_.run() + forcedRunOffset_);
1387  assert(eventAux().luminosityBlock() == indexIntoFileIter_.lumi());
1388 
1389  // If this next assert shows up in performance profiling or significantly affects memory, then these three lines should be deleted.
1390  // The IndexIntoFile should guarantee that it never fails.
1392  ProcessHistoryID const& reducedPHID = processHistoryRegistry_->reducedProcessHistoryID(idToCheck);
1394 
1396  }
1397 
1398  // Reads event at the current entry in the event tree
1399  bool
1401  if(!eventTree_.current()) {
1402  return false;
1403  }
1405  if(!fileFormatVersion().lumiInEventID()) {
1406  //ugly, but will disappear when the backward compatibility is done with schema evolution.
1407  const_cast<EventID&>(eventAux_.id()).setLuminosityBlockNumber(eventAux_.oldLuminosityBlock());
1409  }
1410  fillEventHistory();
1412 
1413  // We're not done ... so prepare the EventPrincipal
1415  principal.fillEventPrincipal(eventAux(),
1417  std::move(eventSelectionIDs_),
1418  std::move(branchListIndexes_),
1419  *(makeProductProvenanceRetriever(principal.streamID().value())),
1421 
1422  // report event read from file
1423  filePtr_->eventReadFromFile();
1424  return true;
1425  }
1426 
1427  void
1429  eventTree_.setEntryNumber(entry);
1430  }
1431 
1432  boost::shared_ptr<RunAuxiliary>
1436 
1437  // Begin code for backward compatibility before the existence of run trees.
1438  if(!runTree_.isValid()) {
1439 
1440  // prior to the support of run trees.
1441  // RunAuxiliary did not contain a valid timestamp. Take it from the next event.
1443  assert(eventEntry != IndexIntoFile::invalidEntry);
1444  assert(eventTree_.current(eventEntry));
1445  fillEventAuxiliary(eventEntry);
1446 
1448  overrideRunNumber(run);
1449  return boost::shared_ptr<RunAuxiliary>(new RunAuxiliary(run.run(), eventAux().time(), Timestamp::invalidTimestamp()));
1450  }
1451  // End code for backward compatibility before the existence of run trees.
1453  boost::shared_ptr<RunAuxiliary> runAuxiliary = fillRunAuxiliary();
1454  assert(runAuxiliary->run() == indexIntoFileIter_.run());
1455  overrideRunNumber(runAuxiliary->id());
1456  filePtr_->reportInputRunNumber(runAuxiliary->run());
1457  // If RunAuxiliary did not contain a valid begin timestamp, invalidate any end timestamp.
1458  if(runAuxiliary->beginTime() == Timestamp::invalidTimestamp()) {
1459  runAuxiliary->setEndTime(Timestamp::invalidTimestamp());
1460  }
1461 
1462  // If RunAuxiliary did not contain a valid timestamp, or if this an old format file from
1463  // when the Run's ProcessHistory included only processes where products were added to the Run itself,
1464  // we attempt to read the first event in the run to get appropriate info.
1465  if(runAuxiliary->beginTime() == Timestamp::invalidTimestamp() ||
1467 
1469  // If we have a valid event, use its information.
1470  if(eventEntry != IndexIntoFile::invalidEntry) {
1471  assert(eventTree_.current(eventEntry));
1472  fillEventAuxiliary(eventEntry);
1473 
1474  // RunAuxiliary did not contain a valid timestamp. Take it from the next event in this run if there is one.
1475  if(runAuxiliary->beginTime() == Timestamp::invalidTimestamp()) {
1476  runAuxiliary->setBeginTime(eventAux().time());
1477  }
1478 
1479  // For backwards compatibility when the Run's ProcessHistory included only processes where products were added to the
1480  // Run, and then the Run and Event auxiliaries could be different. Use the event ProcessHistoryID if there is one. It should
1481  // almost always be correct by the current definition (processes included if any products are added. This makes the run, lumi,
1482  // and event ProcessHistory's always be the same if no file merging occurs).
1483  if(!fileFormatVersion().processHistorySameWithinRun()) {
1484  fillEventHistory();
1485  runAuxiliary->setProcessHistoryID(eventAux().processHistoryID());
1486  savedRunAuxiliary_ = runAuxiliary;
1487  }
1488  } else {
1489  // No valid event, just use what is there, because it is the best we can do.
1490  savedRunAuxiliary_ = runAuxiliary;
1491  }
1492  }
1493  return runAuxiliary;
1494  }
1495 
1496  void
1500  // Begin code for backward compatibility before the existence of run trees.
1501  if(!runTree_.isValid()) {
1503  return;
1504  }
1505  // End code for backward compatibility before the existence of run trees.
1508  // Read in all the products now.
1509  runPrincipal.readImmediate();
1511  }
1512 
1513  boost::shared_ptr<LuminosityBlockAuxiliary>
1517  // Begin code for backward compatibility before the existence of lumi trees.
1518  if(!lumiTree_.isValid()) {
1520  assert(eventEntry != IndexIntoFile::invalidEntry);
1521  assert(eventTree_.current(eventEntry));
1522  fillEventAuxiliary(eventEntry);
1523 
1525  overrideRunNumber(lumi);
1526  return boost::shared_ptr<LuminosityBlockAuxiliary>(new LuminosityBlockAuxiliary(lumi.run(), lumi.luminosityBlock(), eventAux().time(), Timestamp::invalidTimestamp()));
1527  }
1528  // End code for backward compatibility before the existence of lumi trees.
1530  boost::shared_ptr<LuminosityBlockAuxiliary> lumiAuxiliary = fillLumiAuxiliary();
1531  assert(lumiAuxiliary->run() == indexIntoFileIter_.run());
1532  assert(lumiAuxiliary->luminosityBlock() == indexIntoFileIter_.lumi());
1533  overrideRunNumber(lumiAuxiliary->id());
1534  filePtr_->reportInputLumiSection(lumiAuxiliary->run(), lumiAuxiliary->luminosityBlock());
1535  if(lumiAuxiliary->beginTime() == Timestamp::invalidTimestamp()) {
1537  if(eventEntry != IndexIntoFile::invalidEntry) {
1538  assert(eventTree_.current(eventEntry));
1539  fillEventAuxiliary(eventEntry);
1540 
1541  lumiAuxiliary->setBeginTime(eventAux().time());
1542  }
1543  lumiAuxiliary->setEndTime(Timestamp::invalidTimestamp());
1544  }
1545  if(!fileFormatVersion().processHistorySameWithinRun() && savedRunAuxiliary_) {
1546  lumiAuxiliary->setProcessHistoryID(savedRunAuxiliary_->processHistoryID());
1547  }
1548  return lumiAuxiliary;
1549  }
1550 
1551  void
1555  // Begin code for backward compatibility before the existence of lumi trees.
1556  if(!lumiTree_.isValid()) {
1558  return;
1559  }
1560  // End code for backward compatibility before the existence of lumi trees.
1564  // Read in all the products now.
1565  lumiPrincipal.readImmediate();
1567  }
1568 
1569  bool
1572  if(indexIntoFileIter_ == indexIntoFileEnd_) return false;
1574  return true;
1575  }
1576 
1577  bool
1580  if(indexIntoFileIter_ == indexIntoFileEnd_) return false;
1582  return true;
1583  }
1584 
1585  bool
1588  if(indexIntoFileIter_ == indexIntoFileEnd_) return false;
1590  return true;
1591  }
1592 
1593  bool
1597  }
1600  if(run != indexIntoFileIter_.run()) return false;
1601  if(lumi != indexIntoFileIter_.lumi()) return false;
1603  return true;
1604  }
1605 
1606  void
1608  if(forcedRunOffset_ != 0) {
1609  id = RunID(id.run() + forcedRunOffset_);
1610  }
1611  if(id < RunID::firstValidRun()) id = RunID::firstValidRun();
1612  }
1613 
1614  void
1616  if(forcedRunOffset_ != 0) {
1617  id = LuminosityBlockID(id.run() + forcedRunOffset_, id.luminosityBlock());
1618  }
1619  if(RunID(id.run()) < RunID::firstValidRun()) id = LuminosityBlockID(RunID::firstValidRun().run(), id.luminosityBlock());
1620  }
1621 
1622  void
1623  RootFile::overrideRunNumber(EventID& id, bool isRealData) {
1624  if(forcedRunOffset_ != 0) {
1625  if(isRealData) {
1626  throw Exception(errors::Configuration, "RootFile::RootFile()")
1627  << "The 'setRunNumber' parameter of PoolSource cannot be used with real data.\n";
1628  }
1629  id = EventID(id.run() + forcedRunOffset_, id.luminosityBlock(), id.event());
1630  }
1631  if(RunID(id.run()) < RunID::firstValidRun()) {
1633  }
1634  }
1635 
1636 
1637  void
1639  // Read in the event history tree, if we have one...
1640  if(fileFormatVersion().eventHistoryTree()) {
1641  history_.reset(new History);
1642  eventHistoryTree_ = dynamic_cast<TTree*>(filePtr_->Get(poolNames::eventHistoryTreeName().c_str()));
1643  if(!eventHistoryTree_) {
1645  << "Failed to find the event history tree.\n";
1646  }
1647  }
1648  }
1649 
1650  void
1652  std::vector<boost::shared_ptr<IndexIntoFile> > const& indexesIntoFiles,
1653  std::vector<boost::shared_ptr<IndexIntoFile> >::size_type currentIndexIntoFile) {
1654  if(duplicateChecker_) {
1655  if(eventTree_.next()) {
1657  duplicateChecker_->inputFileOpened(eventAux().isRealData(),
1659  indexesIntoFiles,
1660  currentIndexIntoFile);
1661  }
1663  }
1664  }
1665 
1666  void
1667  RootFile::dropOnInput (ProductRegistry& reg, ProductSelectorRules const& rules, bool dropDescendants, InputType inputType) {
1668  // This is the selector for drop on input.
1669  ProductSelector productSelector;
1670  productSelector.initialize(rules, reg.allBranchDescriptions());
1671 
1673  // Do drop on input. On the first pass, just fill in a set of branches to be dropped.
1674  std::set<BranchID> branchesToDrop;
1675  for(auto const& product : prodList) {
1676  BranchDescription const& prod = product.second;
1677  if(!productSelector.selected(prod)) {
1678  if(dropDescendants) {
1679  branchChildren_->appendToDescendants(prod.branchID(), branchesToDrop);
1680  } else {
1681  branchesToDrop.insert(prod.branchID());
1682  }
1683  }
1684  }
1685 
1686  // On this pass, actually drop the branches.
1687  std::set<BranchID>::const_iterator branchesToDropEnd = branchesToDrop.end();
1688  for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1689  BranchDescription const& prod = it->second;
1690  bool drop = branchesToDrop.find(prod.branchID()) != branchesToDropEnd;
1691  if(drop) {
1692  if(productSelector.selected(prod)) {
1693  LogWarning("RootFile")
1694  << "Branch '" << prod.branchName() << "' is being dropped from the input\n"
1695  << "of file '" << file_ << "' because it is dependent on a branch\n"
1696  << "that was explicitly dropped.\n";
1697  }
1698  treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName()));
1699  hasNewlyDroppedBranch_[prod.branchType()] = true;
1700  ProductRegistry::ProductList::iterator icopy = it;
1701  ++it;
1702  prodList.erase(icopy);
1703  } else {
1704  ++it;
1705  }
1706  }
1707 
1708  // Drop on input mergeable run and lumi products, this needs to be invoked for secondary file input
1709  if(inputType == InputType::SecondaryFile) {
1710  TString tString;
1711  for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1712  BranchDescription const& prod = it->second;
1713  if(prod.branchType() != InEvent) {
1714  TClass *cp = gROOT->GetClass(prod.wrappedName().c_str());
1715  WrapperOwningHolder edp(cp->New(), prod.getInterface());
1716  if(edp.isMergeable()) {
1717  treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName()));
1718  ProductRegistry::ProductList::iterator icopy = it;
1719  ++it;
1720  prodList.erase(icopy);
1721  } else {
1722  ++it;
1723  }
1724  }
1725  else ++it;
1726  }
1727  }
1728  }
1729 
1730  std::unique_ptr<MakeProvenanceReader>
1733  readParentageTree(inputType);
1734  return std::unique_ptr<MakeProvenanceReader>(new MakeReducedProvenanceReader(parentageIDLookup_));
1735  } else if(fileFormatVersion_.splitProductIDs()) {
1736  readParentageTree(inputType);
1737  return std::unique_ptr<MakeProvenanceReader>(new MakeFullProvenanceReader);
1738  } else if(fileFormatVersion_.perEventProductIDs()) {
1739  std::unique_ptr<EntryDescriptionMap> entryDescriptionMap(new EntryDescriptionMap);
1740  readEntryDescriptionTree(*entryDescriptionMap, inputType);
1741  return std::unique_ptr<MakeProvenanceReader>(new MakeOldProvenanceReader(std::move(entryDescriptionMap)));
1742  } else {
1743  return std::unique_ptr<MakeProvenanceReader>(new MakeDummyProvenanceReader);
1744  }
1745  }
1746 
1747  boost::shared_ptr<ProductProvenanceRetriever>
1749  if(eventProductProvenanceRetrievers_.size()<=iStreamID) {
1750  eventProductProvenanceRetrievers_.resize(iStreamID+1);
1751  }
1752  if(!eventProductProvenanceRetrievers_[iStreamID]) {
1754  }
1755  eventProductProvenanceRetrievers_[iStreamID]->reset();
1756  return eventProductProvenanceRetrievers_[iStreamID];
1757  }
1758 
1760  public:
1761  ReducedProvenanceReader(RootTree* iRootTree, std::vector<ParentageID> const& iParentageIDLookup, DaqProvenanceHelper const* daqProvenanceHelper);
1762  private:
1763  virtual void readProvenance(ProductProvenanceRetriever const& provRetriever, unsigned int) const override;
1765  TBranch* provBranch_;
1768  std::vector<ParentageID> const& parentageIDLookup_;
1771  };
1772 
1774  RootTree* iRootTree,
1775  std::vector<ParentageID> const& iParentageIDLookup,
1776  DaqProvenanceHelper const* daqProvenanceHelper) :
1778  rootTree_(iRootTree),
1779  pProvVector_(&provVector_),
1780  parentageIDLookup_(iParentageIDLookup),
1781  daqProvenanceHelper_(daqProvenanceHelper),
1782  resourceAcquirer_(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader())
1783  {
1785  }
1786 
1787  void
1788  ReducedProvenanceReader::readProvenance(ProductProvenanceRetriever const& provRetriever, unsigned int transitionIndex) const {
1789  {
1790  std::lock_guard<SharedResourcesAcquirer> guard(resourceAcquirer_);
1791  ReducedProvenanceReader* me = const_cast<ReducedProvenanceReader*>(this);
1792  me->rootTree_->fillBranchEntry(me->provBranch_, me->rootTree_->entryNumberForIndex(transitionIndex), me->pProvVector_);
1793  setRefCoreStreamer(true);
1794  }
1795  if(daqProvenanceHelper_) {
1796  for(auto const& prov : provVector_) {
1797  BranchID bid(prov.branchID_);
1799  daqProvenanceHelper_->mapParentageID(parentageIDLookup_[prov.parentageIDIndex_])));
1800  }
1801  } else {
1802  for(auto const& prov : provVector_) {
1803  if(prov.parentageIDIndex_ >= parentageIDLookup_.size()) {
1805  << "ReducedProvenanceReader::ReadProvenance\n"
1806  << "The parentage ID index value " << prov.parentageIDIndex_ << " is out of bounds. The maximum value is " << parentageIDLookup_.size()-1 << ".\n"
1807  << "This should never happen.\n"
1808  << "Please report this to the framework hypernews forum 'hn-cms-edmFramework@cern.ch'.\n";
1809  }
1810  provRetriever.insertIntoSet(ProductProvenance(BranchID(prov.branchID_), parentageIDLookup_[prov.parentageIDIndex_]));
1811  }
1812  }
1813  }
1814 
1816  public:
1817  explicit FullProvenanceReader(RootTree* rootTree, DaqProvenanceHelper const* daqProvenanceHelper);
1819  private:
1820  virtual void readProvenance(ProductProvenanceRetriever const& provRetriever, unsigned int transitionIndex) const override;
1826  };
1827 
1830  rootTree_(rootTree),
1831  infoVector_(),
1832  pInfoVector_(&infoVector_),
1833  daqProvenanceHelper_(daqProvenanceHelper),
1834  resourceAcquirer_(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader()) {
1835  }
1836 
1837  void
1838  FullProvenanceReader::readProvenance(ProductProvenanceRetriever const& provRetriever, unsigned int transitionIndex) const {
1839  {
1840  std::lock_guard<SharedResourcesAcquirer> guard(resourceAcquirer_);
1842  setRefCoreStreamer(true);
1843  }
1844  if(daqProvenanceHelper_) {
1845  for(auto const& info : infoVector_) {
1847  daqProvenanceHelper_->mapParentageID(info.parentageID())));
1848  }
1849  } else {
1850  for(auto const& info : infoVector_) {
1851  provRetriever.insertIntoSet(info);
1852  }
1853  }
1854  }
1855 
1857  public:
1858  explicit OldProvenanceReader(RootTree* rootTree, EntryDescriptionMap const& theMap, DaqProvenanceHelper const* daqProvenanceHelper);
1860  private:
1861  virtual void readProvenance(ProductProvenanceRetriever const& provRetriever, unsigned int transitionIndex) const override;
1863  std::vector<EventEntryInfo> infoVector_;
1864  mutable std::vector<EventEntryInfo> *pInfoVector_;
1868  };
1869 
1870  OldProvenanceReader::OldProvenanceReader(RootTree* rootTree, EntryDescriptionMap const& theMap, DaqProvenanceHelper const* daqProvenanceHelper) :
1872  rootTree_(rootTree),
1873  infoVector_(),
1874  pInfoVector_(&infoVector_),
1875  entryDescriptionMap_(theMap),
1876  daqProvenanceHelper_(daqProvenanceHelper),
1877  resourceAcquirer_(SharedResourcesRegistry::instance()->createAcquirerForSourceDelayedReader()) {
1878  }
1879 
1880  void
1881  OldProvenanceReader::readProvenance(ProductProvenanceRetriever const& provRetriever, unsigned int transitionIndex) const {
1882  {
1883  std::lock_guard<SharedResourcesAcquirer> guard(resourceAcquirer_);
1884  rootTree_->branchEntryInfoBranch()->SetAddress(&pInfoVector_);
1886  setRefCoreStreamer(true);
1887  }
1888  for(auto const& info : infoVector_) {
1889  EntryDescriptionMap::const_iterator iter = entryDescriptionMap_.find(info.entryDescriptionID());
1890  assert(iter != entryDescriptionMap_.end());
1891  Parentage parentage(iter->second.parents());
1892  if(daqProvenanceHelper_) {
1894  daqProvenanceHelper_->mapParentageID(parentage.id()));
1895  provRetriever.insertIntoSet(entry);
1896  } else {
1897  ProductProvenance entry(info.branchID(), parentage.id());
1898  provRetriever.insertIntoSet(entry);
1899  }
1900 
1901  }
1902  }
1903 
1905  public:
1908  private:
1909  virtual void readProvenance(ProductProvenanceRetriever const& provRetriever,unsigned int) const override;
1910  };
1911 
1914  }
1915 
1916  void
1918  // Not providing parentage!!!
1919  }
1920 
1921  std::unique_ptr<ProvenanceReaderBase>
1923  return std::unique_ptr<ProvenanceReaderBase>(new DummyProvenanceReader);
1924  }
1925 
1926  std::unique_ptr<ProvenanceReaderBase>
1927  MakeOldProvenanceReader::makeReader(RootTree& rootTree, DaqProvenanceHelper const* daqProvenanceHelper) const {
1928  return std::unique_ptr<ProvenanceReaderBase>(new OldProvenanceReader(&rootTree, *entryDescriptionMap_, daqProvenanceHelper));
1929  }
1930 
1931  std::unique_ptr<ProvenanceReaderBase>
1932  MakeFullProvenanceReader::makeReader(RootTree& rootTree, DaqProvenanceHelper const* daqProvenanceHelper) const {
1933  return std::unique_ptr<ProvenanceReaderBase>(new FullProvenanceReader(&rootTree, daqProvenanceHelper));
1934  }
1935 
1936  std::unique_ptr<ProvenanceReaderBase>
1937  MakeReducedProvenanceReader::makeReader(RootTree& rootTree, DaqProvenanceHelper const* daqProvenanceHelper) const {
1938  return std::unique_ptr<ProvenanceReaderBase>(new ReducedProvenanceReader(&rootTree, parentageIDLookup_, daqProvenanceHelper));
1939  }
1940 }
void dropOnInput(ProductRegistry &reg, ProductSelectorRules const &rules, bool dropDescendants, InputType inputType)
Definition: RootFile.cc:1667
RunNumber_t run() const
Definition: EventID.h:42
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:461
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
virtual void readProvenance(ProductProvenanceRetriever const &provRetriever, unsigned int) const override
Definition: RootFile.cc:1788
void setID(ParameterSetID const &id)
EventNumber_t event() const
Definition: EventID.h:44
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:249
std::unique_ptr< ProvenanceAdaptor > provenanceAdaptor_
Definition: RootFile.h:216
std::vector< ProcessConfiguration > ProcessConfigurationVector
int i
Definition: DBlmapReader.cc:9
std::string const & branchName() const
boost::shared_ptr< BranchChildren > branchChildren_
Definition: RootFile.h:214
StoredProductProvenanceVector provVector_
Definition: RootFile.cc:1766
bool isRealData() const
bool selected(BranchDescription const &desc) const
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:114
unsigned int const defaultNonEventLearningEntries
Definition: RootTree.h:40
boost::shared_ptr< RunAuxiliary > savedRunAuxiliary_
Definition: RootFile.h:192
std::unique_ptr< History > history_
Definition: RootFile.h:213
InputType
Definition: InputType.h:5
static const TGPicture * info(bool iBackgroundIsBlack)
void doneFileInitialization() const
Clears the temporary vector of event numbers to reduce memory usage.
static int const invalidIndex
TPRegexp parents
Definition: eve_filter.cc:24
BranchType const & branchType() const
std::string const & parentageTreeName()
Definition: BranchType.cc:158
static LuminosityBlockID firstValidLuminosityBlock()
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
std::string const & entryDescriptionBranchName()
Definition: BranchType.cc:153
bool skipEvents(int &offset)
Definition: RootFile.cc:1275
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:111
ProductProvenanceVector infoVector_
Definition: RootFile.cc:1822
static std::string const source("source")
static Timestamp invalidTimestamp()
Definition: Timestamp.h:101
ForwardSequence::const_iterator lower_bound_all(ForwardSequence const &s, Datum const &d)
wrappers for std::lower_bound
Definition: Algorithms.h:91
void readEntryDescriptionTree(EntryDescriptionMap &entryDescriptionMap, InputType inputType)
Definition: RootFile.cc:500
bool branchListIndexesUnchanged() const
Definition: RootFile.h:114
RunNumber_t run() const
Definition: RunID.h:43
std::vector< std::string > const & branchNames() const
Definition: RootTree.h:96
bool setEntryAtNextEventInLumi(RunNumber_t run, LuminosityBlockNumber_t lumi)
Definition: RootFile.cc:1594
StoredProductProvenanceVector * pProvVector_
Definition: RootFile.cc:1767
unsigned int EventNumber_t
Definition: EventID.h:30
static PFTauRenderPlugin instance
MakeOldProvenanceReader(std::unique_ptr< EntryDescriptionMap > &&entryDescriptionMap)
Definition: RootFile.cc:67
int whyNotFastClonable_
Definition: RootFile.h:195
std::vector< BranchID > & parentsForUpdate()
Definition: Parentage.h:38
ParentageID id() const
Definition: Parentage.cc:19
DaqProvenanceHelper const * daqProvenanceHelper_
Definition: RootFile.cc:1824
tuple lumi
Definition: fjr2json.py:35
std::map< std::string, std::string > newBranchToOldBranch_
Definition: RootFile.h:209
EntryNumber_t firstEventEntryThisRun() const
bool empty() const
True if no runs, lumis, or events are in the file.
std::map< BranchKey, BranchDescription > ProductList
BranchID const & mapBranchID(BranchID const &branchID) const
#define nullptr
bool registerProcessHistory(ProcessHistory const &processHistory)
bool setEntryAtRun(RunNumber_t run)
Definition: RootFile.cc:1586
void readRun_(RunPrincipal &runPrincipal)
Definition: RootFile.cc:1497
ProductProvenanceVector * pInfoVector_
Definition: RootFile.cc:1823
RootTree lumiTree_
Definition: RootFile.h:200
Timestamp const & time() const
virtual std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
Definition: RootFile.cc:1927
std::unique_ptr< MakeProvenanceReader > provenanceReaderMaker_
Definition: RootFile.h:217
EntryNumber const & entries() const
Definition: RootTree.h:93
RunNumber_t run() const
void setRefCoreStreamer(bool resetAll=false)
processConfiguration
Definition: Schedule.cc:369
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:212
IndexIntoFileItr begin(SortOrder sortOrder) const
FullProvenanceReader(RootTree *rootTree, DaqProvenanceHelper const *daqProvenanceHelper)
Definition: RootFile.cc:1828
EntryDescriptionMap const & entryDescriptionMap_
Definition: RootFile.cc:1865
std::vector< BranchID > const & parents() const
boost::shared_ptr< BranchIDLists const > branchIDLists_
Definition: RootFile.h:205
std::string const & eventSelectionsBranchName()
Definition: BranchType.cc:237
InputSource::ProcessingMode processingMode_
Definition: RootFile.h:207
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:189
bool current() const
Definition: RootTree.h:87
boost::shared_ptr< RunAuxiliary > fillRunAuxiliary()
Definition: RootFile.cc:1254
virtual std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
Definition: RootFile.cc:1922
void fillRunPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
Definition: RunPrincipal.cc:22
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
Definition: Algorithms.h:135
static RunID firstValidRun()
Definition: RunID.h:81
LuminosityBlockNumber_t lumi() const
void fillBranchEntryMeta(TBranch *branch, T *&pbuf)
Definition: RootTree.h:104
std::unique_ptr< FileBlock > createFileBlock() const
Definition: RootFile.cc:636
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:43
void trainCache(char const *branchNames)
Definition: RootTree.cc:430
bool readCurrentEvent(EventPrincipal &cache)
Definition: RootFile.cc:1400
virtual void readProvenance(ProductProvenanceRetriever const &provRetriever, unsigned int) const override
Definition: RootFile.cc:1917
virtual std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
Definition: RootFile.cc:1932
uint16_t size_type
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
virtual ~OldProvenanceReader()
Definition: RootFile.cc:1859
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
TBranch * branchEntryInfoBranch() const
Definition: RootTree.h:143
long long EntryNumber_t
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
void readImmediate() const
Definition: RunPrincipal.cc:52
bool fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1164
MakeReducedProvenanceReader(std::vector< ParentageID > const &parentageIDLookup)
Definition: RootFile.cc:78
virtual ~DummyProvenanceReader()
Definition: RootFile.cc:1907
IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
std::vector< EventSelectionID > EventSelectionIDVector
LuminosityBlockNumber_t luminosityBlock() const
FileFormatVersion fileFormatVersion_
Definition: RootFile.h:182
TTree const * metaTree() const
Definition: RootTree.h:139
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:245
void setPosition(IndexIntoFile::IndexIntoFileItr const &position)
Definition: RootFile.cc:667
tuple runs
Definition: gather_cfg.py:87
ProductList const & productList() const
U second(std::pair< T, U > const &p)
std::vector< EventProcessHistoryID >::const_iterator eventProcessHistoryIter_
Definition: RootFile.h:191
virtual void readProvenance(ProductProvenanceRetriever const &provRetriever, unsigned int transitionIndex) const override
Definition: RootFile.cc:1838
void reduceProcessHistoryIDs(ProcessHistoryRegistry const &processHistoryRegistry)
bool skipThisEntry()
Definition: RootFile.cc:672
TTree const * tree() const
Definition: RootTree.h:137
FileID fid_
Definition: RootFile.h:183
boost::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:215
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: RootFile.cc:727
virtual void readProvenance(ProductProvenanceRetriever const &provRetriever, unsigned int transitionIndex) const override
Definition: RootFile.cc:1881
void setParents(std::vector< BranchID > const &parents)
Definition: Parentage.h:39
DaqProvenanceHelper const * daqProvenanceHelper_
Definition: RootFile.cc:1769
std::string const logicalFile_
Definition: RootFile.h:177
std::vector< BranchListIndex > BranchListIndexes
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:188
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
void fillLuminosityBlockPrincipal(ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
void readParentageTree(InputType inputType)
Definition: RootFile.cc:546
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:192
std::vector< ProcessHistoryID > & setProcessHistoryIDs()
bool next()
Definition: RootTree.h:85
bool noEventSort_
Definition: RootFile.h:194
std::string const & className() const
std::unique_ptr< EntryDescriptionMap > entryDescriptionMap_
Definition: RootFile.cc:70
bool wasLastEventJustRead() const
Definition: RootFile.cc:777
void insertEntryForIndex(unsigned int index)
Definition: RootTree.cc:98
virtual std::unique_ptr< ProvenanceReaderBase > makeReader(RootTree &eventTree, DaqProvenanceHelper const *daqProvenanceHelper) const override
Definition: RootFile.cc:1937
bool setEntryAtLumi(RunNumber_t run, LuminosityBlockNumber_t lumi)
Definition: RootFile.cc:1578
std::string friendlyName(std::string const &iFullName)
static RunNumber_t const invalidRun
std::string const & entryDescriptionTreeName()
Definition: BranchType.cc:145
void close()
Definition: RootFile.cc:1133
std::string const & fid() const
Definition: FileID.h:19
RootTree const & runTree() const
Definition: RootFile.h:110
boost::shared_ptr< BranchIDListHelper > branchIDListHelper_
Definition: RootFile.h:206
bool modifiedIDs() const
Definition: RootFile.h:115
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
Definition: RootFile.h:203
void copyPosition(IndexIntoFileItr const &position)
Copy the position without modifying the pointer to the IndexIntoFile or size.
std::string const & indexIntoFileBranchName()
Definition: BranchType.cc:227
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:232
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50
EventAuxiliary const & eventAux() const
Definition: RootFile.h:103
EventSelectionIDVector eventSelectionIDs_
Definition: RootFile.h:211
bool eventHistoryTree() const
bool isEarlierRelease(std::string const &a, std::string const &b)
int whyNotFastClonable() const
Definition: RootFile.h:112
StreamID streamID() const
BranchType branchType() const
Definition: RootTree.h:151
RunNumber_t run() const
bool skipAnyEvents_
Definition: RootFile.h:193
RootTree eventTree_
Definition: RootFile.h:199
std::vector< BranchDescription const * > allBranchDescriptions() const
std::map< ParameterSetID, ParameterSetID > ParameterSetIdConverter
bool isValid() const
Definition: FileID.h:18
bool iterationWillBeInEntryOrder(SortOrder sortOrder) const
Used to determine whether or not to disable fast cloning.
std::string const & friendlyClassName() const
BranchID const & branchID() const
WrapperInterfaceBase const * getInterface() const
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch() const
Definition: RootFile.h:113
IndexIntoFile::EntryType getNextItemType(RunNumber_t &run, LuminosityBlockNumber_t &lumi, EventNumber_t &event)
Definition: RootFile.cc:732
BranchListIndexes branchListIndexes_
Definition: RootFile.h:212
std::string const & metaDataTreeName()
Definition: BranchType.cc:167
bool isDuplicateEvent()
Definition: RootFile.cc:716
LuminosityBlockNumber_t oldLuminosityBlock() const
EntryDescriptionID id() const
unsigned int offset(bool)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< boost::shared_ptr< ProductProvenanceRetriever > > eventProductProvenanceRetrievers_
Definition: RootFile.h:218
IndexIntoFile::EntryNumber_t EntryNumber
Definition: RootTree.h:41
bool wasFirstEventJustRead() const
Definition: RootFile.cc:784
std::string const & parameterSetMapBranchName()
Definition: BranchType.cc:182
Hash< ProcessHistoryType > ProcessHistoryID
std::vector< ProductProvenance > ProductProvenanceVector
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
const int drop
std::string const & processHistoryBranchName()
Definition: BranchType.cc:197
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:185
virtual ~FullProvenanceReader()
Definition: RootFile.cc:1818
void readEvent(EventPrincipal &cache)
Definition: RootFile.cc:1377
RootTree runTree_
Definition: RootFile.h:201
EntryNumber const & entryNumber() const
Definition: RootTree.h:91
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
bool goToEvent(EventID const &eventID)
Definition: RootFile.cc:1343
std::string getReleaseVersion()
void setAtEventEntry(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1428
bool storedProductProvenanceUsed() const
void fixIndexes(std::vector< ProcessHistoryID > &processHistoryIDs)
DelayedReader * rootDelayedReader() const
Definition: RootTree.cc:116
std::vector< RunOrLumiEntry > & setRunOrLumiEntries()
EntryNumber const & entryNumberForIndex(unsigned int index) const
Definition: RootTree.cc:92
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: RootFile.h:196
std::vector< EventNumber_t > & unsortedEventNumbers() const
unsigned int value() const
Definition: StreamID.h:46
static EntryNumber_t const invalidEntry
SharedResourcesAcquirer resourceAcquirer_
Definition: RootFile.cc:1867
ForwardSequence::const_iterator find_in_all(ForwardSequence const &s, Datum const &d)
wrappers for std::find
Definition: Algorithms.h:32
RootFile(std::string const &fileName, ProcessConfiguration const &processConfiguration, std::string const &logicalFileName, boost::shared_ptr< InputFile > filePtr, boost::shared_ptr< EventSkipperByID > eventSkipperByID, bool skipAnyEvents, int remainingEvents, int remainingLumis, unsigned int nStreams, unsigned int treeCacheSize, int treeMaxVirtualSize, InputSource::ProcessingMode processingMode, RunNumber_t const &forcedRunNumber, bool noEventSort, ProductSelectorRules const &productSelectorRules, InputType inputType, boost::shared_ptr< BranchIDListHelper > branchIDListHelper, boost::shared_ptr< DuplicateChecker > duplicateChecker, bool dropDescendantsOfDroppedProducts, ProcessHistoryRegistry &processHistoryRegistry, std::vector< boost::shared_ptr< IndexIntoFile > > const &indexesIntoFiles, std::vector< boost::shared_ptr< IndexIntoFile > >::size_type currentIndexIntoFile, std::vector< ProcessHistoryID > &orderedProcessHistoryIDs, bool bypassVersionCheck, bool labelRawDataLikeMC, bool usingGoToEvent, bool enablePrefetching)
Definition: RootFile.cc:138
void setIfFastClonable(int remainingEvents, int remainingLumis)
Definition: RootFile.cc:582
void fillBranchEntry(TBranch *branch, T *&pbuf)
Definition: RootTree.h:115
static LuminosityBlockNumber_t const invalidLumi
IndexIntoFileItr findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
std::map< EntryDescriptionID, EventEntryDescription > EntryDescriptionMap
Definition: RootFile.h:47
virtual EventNumber_t getEventNumberOfEntry(roottree::EntryNumber entry) const override
Definition: RootFile.cc:123
std::string const & parentageBranchName()
Definition: BranchType.cc:162
boost::shared_ptr< LuminosityBlockAuxiliary > fillLumiAuxiliary()
Definition: RootFile.cc:1230
boost::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
Definition: RootFile.cc:1514
double b
Definition: hdecay.h:120
LuminosityBlockNumber_t luminosityBlock() const
bool processHistorySameWithinRun() const
void fillEventHistory()
Definition: RootFile.cc:1174
ProcessHistoryID const & processHistoryID(int i) const
ProductList & productListUpdator()
void setProcessHistoryID(ProcessHistoryID const &phid)
unsigned int transitionIndex() const
std::vector< ParentageID > const & parentageIDLookup_
Definition: RootFile.cc:1768
bool isValid() const
Definition: RootTree.cc:104
std::vector< StoredProductProvenance > StoredProductProvenanceVector
boost::shared_ptr< ProductProvenanceRetriever > makeProductProvenanceRetriever(unsigned int iStreamIndex)
Definition: RootFile.cc:1748
std::string const & file() const
Definition: RootFile.h:99
std::string const & productDescriptionBranchName()
Definition: BranchType.cc:172
std::string const & processConfigurationBranchName()
Definition: BranchType.cc:202
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
Definition: RootFile.h:187
EntryNumber_t firstEventEntryThisLumi() const
ProcessHistoryID const & processHistoryID() const
EventID const & id() const
std::unique_ptr< DaqProvenanceHelper > daqProvenanceHelper_
Definition: RootFile.h:220
bool branchListIndexesUnchanged_
Definition: RootFile.h:197
void setEventFinder(boost::shared_ptr< EventFinder > ptr) const
void fillIndexIntoFile()
Definition: RootFile.cc:846
#define begin
Definition: vmac.h:30
SharedResourcesAcquirer resourceAcquirer_
Definition: RootFile.cc:1825
void readLuminosityBlock_(LuminosityBlockPrincipal &lumiPrincipal)
Definition: RootFile.cc:1552
std::vector< EventEntryInfo > * pInfoVector_
Definition: RootFile.cc:1864
unsigned int const defaultNonEventCacheSize
Definition: RootTree.h:38
RootTreePtrArray treePointers_
Definition: RootFile.h:202
void fillEventNumbers() const
double a
Definition: hdecay.h:121
void initialize(ProductSelectorRules const &rules, std::vector< BranchDescription const * > const &branchDescriptions)
boost::shared_ptr< ProductRegistry const > productRegistry_
Definition: RootFile.h:204
bool perEventProductIDs() const
std::string const & BranchTypeToProductProvenanceBranchName(BranchType const &BranchType)
Definition: BranchType.cc:130
std::vector< ProcessHistoryID > & orderedProcessHistoryIDs_
Definition: RootFile.h:186
std::string const & productDependenciesBranchName()
Definition: BranchType.cc:177
void setNumberOfEvents(EntryNumber_t nevents) const
void overrideRunNumber(RunID &id)
Definition: RootFile.cc:1607
std::string const & entryDescriptionIDBranchName()
Definition: BranchType.cc:149
bool useReducedProcessHistoryID() const
std::unique_ptr< MakeProvenanceReader > makeProvenanceReaderMaker(InputType inputType)
Definition: RootFile.cc:1731
boost::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:180
void initializeDuplicateChecker(std::vector< boost::shared_ptr< IndexIntoFile > > const &indexesIntoFiles, std::vector< boost::shared_ptr< IndexIntoFile > >::size_type currentIndexIntoFile)
Definition: RootFile.cc:1651
std::string const & branchIDListBranchName()
Definition: BranchType.cc:207
unsigned int RunNumber_t
Definition: EventRange.h:32
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:241
std::vector< ParentageID > parentageIDLookup_
Definition: RootFile.h:219
EventAuxiliary eventAux_
Definition: RootFile.h:198
void fillThisEventAuxiliary()
Definition: RootFile.cc:1145
void resetTraining()
Definition: RootTree.h:149
bool setEntryAtEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
Definition: RootFile.cc:1570
ProcessHistoryRegistry * processHistoryRegistry_
Definition: RootFile.h:179
volatile std::atomic< bool > shutdown_flag false
std::vector< ParentageID > const & parentageIDLookup_
Definition: RootFile.cc:81
ReducedProvenanceReader(RootTree *iRootTree, std::vector< ParentageID > const &iParentageIDLookup, DaqProvenanceHelper const *daqProvenanceHelper)
Definition: RootFile.cc:1773
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:262
static Interceptor::Registry registry("Interceptor")
RootFileEventFinder(RootTree &eventTree)
Definition: RootFile.cc:120
ParentageID const & mapParentageID(ParentageID const &phid) const
void validateFile(InputType inputType, bool usingGoToEvent)
Definition: RootFile.cc:1072
bool insertMapped(value_type const &v)
Definition: Registry.cc:37
IndexIntoFile::IndexIntoFileItr indexIntoFileIter() const
Definition: RootFile.cc:662
std::string const & newBranchToOldBranch(std::string const &newBranch) const
Definition: RootFile.cc:653
std::unique_ptr< TTreeCache > trainCache(TTree *tree, InputFile &file, unsigned int cacheSize, char const *branchNames)
Definition: RootTree.cc:485
static ParentageRegistry * instance()
OldProvenanceReader(RootTree *rootTree, EntryDescriptionMap const &theMap, DaqProvenanceHelper const *daqProvenanceHelper)
Definition: RootFile.cc:1870
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
unsigned int const defaultLearningEntries
Definition: RootTree.h:39
boost::shared_ptr< EventSkipperByID > eventSkipperByID_
Definition: RootFile.h:181
std::vector< EventEntryInfo > infoVector_
Definition: RootFile.cc:1863
TTree * eventHistoryTree_
Definition: RootFile.h:210
LuminosityBlockNumber_t peekAheadAtLumi() const
std::string const & fileIdentifierBranchName()
Definition: BranchType.cc:217
SharedResourcesAcquirer resourceAcquirer_
Definition: RootFile.cc:1770
boost::shared_ptr< ProductRegistry const > productRegistry() const
Definition: RootFile.h:100
std::string const & wrappedName() const
virtual ~RootFileEventFinder()
Definition: RootFile.cc:121
EventNumber_t event() const
std::string const & moduleDescriptionMapBranchName()
Definition: BranchType.cc:187
bool insertMapped(value_type const &v)
std::string const file_
Definition: RootFile.h:176
boost::shared_ptr< RunAuxiliary > readRunAuxiliary_()
Definition: RootFile.cc:1433
void skipEventForward(int &phIndexOfSkippedEvent, RunNumber_t &runOfSkippedEvent, LuminosityBlockNumber_t &lumiOfSkippedEvent, EntryNumber_t &skippedEventEntry)
std::vector< EventProcessHistoryID > eventProcessHistoryIDs_
Definition: RootFile.h:190
static Registry * instance()
Definition: Registry.cc:14
DaqProvenanceHelper const * daqProvenanceHelper_
Definition: RootFile.cc:1866
std::string createGlobalIdentifier()
void copyProduct(BranchDescription const &productdesc)
void readEventHistoryTree()
Definition: RootFile.cc:1638
int forcedRunOffset_
Definition: RootFile.h:208
void fillAux(T *&pAux)
Definition: RootTree.h:99
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:190
void reportOpened(std::string const &inputType)
Definition: RootFile.cc:1119
void insertIntoSet(ProductProvenance const &provenanceProduct) const