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