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