CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
edm::RootFile Class Reference

#include <RootFile.h>

Public Types

typedef std::array< RootTree
*, NumBranchTypes
RootTreePtrArray
 

Public Member Functions

std::shared_ptr
< BranchIDListHelper const > 
branchIDListHelper () const
 
bool branchListIndexesUnchanged () const
 
void close ()
 
bool containsItem (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
 
std::unique_ptr< FileBlockcreateFileBlock () const
 
EventAuxiliary const & eventAux () const
 
EventID const & eventID () const
 
RootTree const & eventTree () const
 
std::string const & file () const
 
FileFormatVersion fileFormatVersion () const
 
IndexIntoFile::EntryType getNextItemType (RunNumber_t &run, LuminosityBlockNumber_t &lumi, EventNumber_t &event)
 
bool goToEvent (EventID const &eventID)
 
std::array< bool,
NumBranchTypes > const & 
hasNewlyDroppedBranch () const
 
IndexIntoFile::IndexIntoFileItr indexIntoFileIter () const
 
std::shared_ptr< IndexIntoFileindexIntoFileSharedPtr () const
 
void initAssociationsFromSecondary (std::vector< BranchID > const &)
 
RootTree const & lumiTree () const
 
bool modifiedIDs () const
 
bool nextEventEntry ()
 
RootFileoperator= (RootFile const &)=delete
 
std::shared_ptr
< ProductRegistry const > 
productRegistry () const
 
bool readCurrentEvent (EventPrincipal &cache)
 
void readEvent (EventPrincipal &cache)
 
void readLuminosityBlock_ (LuminosityBlockPrincipal &lumiPrincipal)
 
std::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary_ ()
 
void readRun_ (RunPrincipal &runPrincipal)
 
std::shared_ptr< RunAuxiliaryreadRunAuxiliary_ ()
 
void reportOpened (std::string const &inputType)
 
void rewind ()
 
 RootFile (std::string const &fileName, ProcessConfiguration const &processConfiguration, std::string const &logicalFileName, std::shared_ptr< InputFile > filePtr, std::shared_ptr< EventSkipperByID > eventSkipperByID, bool skipAnyEvents, int remainingEvents, int remainingLumis, unsigned int nStreams, unsigned int treeCacheSize, int treeMaxVirtualSize, InputSource::ProcessingMode processingMode, RunNumber_t const &forcedRunNumber, bool noEventSort, ProductSelectorRules const &productSelectorRules, InputType inputType, std::shared_ptr< BranchIDListHelper > branchIDListHelper, std::shared_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper, std::vector< BranchID > const &associationsFromSecondary, std::shared_ptr< DuplicateChecker > duplicateChecker, bool dropDescendantsOfDroppedProducts, ProcessHistoryRegistry &processHistoryRegistry, std::vector< std::shared_ptr< IndexIntoFile > > const &indexesIntoFiles, std::vector< std::shared_ptr< IndexIntoFile > >::size_type currentIndexIntoFile, std::vector< ProcessHistoryID > &orderedProcessHistoryIDs, bool bypassVersionCheck, bool labelRawDataLikeMC, bool usingGoToEvent, bool enablePrefetching)
 
 RootFile (RootFile const &)=delete
 
RootTree const & runTree () const
 
void setAtEventEntry (IndexIntoFile::EntryNumber_t entry)
 
bool setEntryAtEvent (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
 
bool setEntryAtItem (RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
 
bool setEntryAtLumi (RunNumber_t run, LuminosityBlockNumber_t lumi)
 
bool setEntryAtNextEventInLumi (RunNumber_t run, LuminosityBlockNumber_t lumi)
 
bool setEntryAtRun (RunNumber_t run)
 
void setPosition (IndexIntoFile::IndexIntoFileItr const &position)
 
void setToLastEntry ()
 
bool skipEntries (unsigned int &offset)
 
bool skipEvents (int &offset)
 
bool wasFirstEventJustRead () const
 
bool wasLastEventJustRead () const
 
int whyNotFastClonable () const
 
 ~RootFile ()
 

Private Member Functions

void dropOnInput (ProductRegistry &reg, ProductSelectorRules const &rules, bool dropDescendants, InputType inputType)
 
bool fillEventAuxiliary (IndexIntoFile::EntryNumber_t entry)
 
void fillEventHistory ()
 
void fillIndexIntoFile ()
 
std::shared_ptr
< LuminosityBlockAuxiliary
fillLumiAuxiliary ()
 
std::shared_ptr< RunAuxiliaryfillRunAuxiliary ()
 
void fillThisEventAuxiliary ()
 
void initializeDuplicateChecker (std::vector< std::shared_ptr< IndexIntoFile > > const &indexesIntoFiles, std::vector< std::shared_ptr< IndexIntoFile > >::size_type currentIndexIntoFile)
 
bool isDuplicateEvent ()
 
std::shared_ptr
< ProductProvenanceRetriever
makeProductProvenanceRetriever (unsigned int iStreamIndex)
 
std::unique_ptr
< MakeProvenanceReader
makeProvenanceReaderMaker (InputType inputType)
 
void markBranchToBeDropped (bool dropDescendants, BranchID const &branchID, std::set< BranchID > &branchesToDrop) const
 
std::string const & newBranchToOldBranch (std::string const &newBranch) const
 
void overrideRunNumber (RunID &id)
 
void overrideRunNumber (LuminosityBlockID &id)
 
void overrideRunNumber (EventID &id, bool isRealData)
 
void readEntryDescriptionTree (EntryDescriptionMap &entryDescriptionMap, InputType inputType)
 
void readEventHistoryTree ()
 
void readParentageTree (InputType inputType)
 
void setIfFastClonable (int remainingEvents, int remainingLumis)
 
bool skipThisEntry ()
 
RootTreePtrArraytreePointers ()
 
void validateFile (InputType inputType, bool usingGoToEvent)
 

Private Attributes

std::shared_ptr< BranchChildrenbranchChildren_
 
std::shared_ptr
< BranchIDListHelper
branchIDListHelper_
 
std::shared_ptr< BranchIDLists
const > 
branchIDLists_
 
BranchListIndexes branchListIndexes_
 
bool branchListIndexesUnchanged_
 
std::unique_ptr
< DaqProvenanceHelper
daqProvenanceHelper_
 
std::shared_ptr< DuplicateCheckerduplicateChecker_
 
TClass * edProductClass_
 
EventAuxiliary eventAux_
 
TTree * eventHistoryTree_
 
std::vector
< EventProcessHistoryID
eventProcessHistoryIDs_
 
std::vector
< EventProcessHistoryID >
::const_iterator 
eventProcessHistoryIter_
 
std::vector< std::shared_ptr
< ProductProvenanceRetriever > > 
eventProductProvenanceRetrievers_
 
EventSelectionIDVector eventSelectionIDs_
 
std::shared_ptr< EventSkipperByIDeventSkipperByID_
 
RootTree eventTree_
 
FileID fid_
 
std::string const file_
 
FileFormatVersion fileFormatVersion_
 
std::shared_ptr< InputFilefilePtr_
 
std::unique_ptr
< ThinnedAssociationsHelper
fileThinnedAssociationsHelper_
 
int forcedRunOffset_
 
std::array< bool, NumBranchTypeshasNewlyDroppedBranch_
 
std::unique_ptr< Historyhistory_
 
IndexIntoFileindexIntoFile_
 
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
 
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
 
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
 
std::shared_ptr< IndexIntoFileindexIntoFileSharedPtr_
 
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
 
std::string const logicalFile_
 
RootTree lumiTree_
 
std::map< std::string,
std::string > 
newBranchToOldBranch_
 
bool noEventSort_
 
std::vector< ProcessHistoryID > & orderedProcessHistoryIDs_
 
std::vector< ParentageIDparentageIDLookup_
 
ProcessConfiguration const & processConfiguration_
 
ProcessHistoryRegistryprocessHistoryRegistry_
 
InputSource::ProcessingMode processingMode_
 
std::shared_ptr
< ProductRegistry const > 
productRegistry_
 
std::unique_ptr
< ProvenanceAdaptor
provenanceAdaptor_
 
std::unique_ptr
< MakeProvenanceReader
provenanceReaderMaker_
 
RootTree runTree_
 
std::shared_ptr< RunAuxiliarysavedRunAuxiliary_
 
bool skipAnyEvents_
 
std::shared_ptr
< ThinnedAssociationsHelper
thinnedAssociationsHelper_
 
RootTreePtrArray treePointers_
 
int whyNotFastClonable_
 

Detailed Description

Definition at line 58 of file RootFile.h.

Member Typedef Documentation

Definition at line 60 of file RootFile.h.

Constructor & Destructor Documentation

edm::RootFile::RootFile ( std::string const &  fileName,
ProcessConfiguration const &  processConfiguration,
std::string const &  logicalFileName,
std::shared_ptr< InputFile filePtr,
std::shared_ptr< EventSkipperByID eventSkipperByID,
bool  skipAnyEvents,
int  remainingEvents,
int  remainingLumis,
unsigned int  nStreams,
unsigned int  treeCacheSize,
int  treeMaxVirtualSize,
InputSource::ProcessingMode  processingMode,
RunNumber_t const &  forcedRunNumber,
bool  noEventSort,
ProductSelectorRules const &  productSelectorRules,
InputType  inputType,
std::shared_ptr< BranchIDListHelper branchIDListHelper,
std::shared_ptr< ThinnedAssociationsHelper thinnedAssociationsHelper,
std::vector< BranchID > const &  associationsFromSecondary,
std::shared_ptr< DuplicateChecker duplicateChecker,
bool  dropDescendantsOfDroppedProducts,
ProcessHistoryRegistry processHistoryRegistry,
std::vector< std::shared_ptr< IndexIntoFile > > const &  indexesIntoFiles,
std::vector< std::shared_ptr< IndexIntoFile > >::size_type  currentIndexIntoFile,
std::vector< ProcessHistoryID > &  orderedProcessHistoryIDs,
bool  bypassVersionCheck,
bool  labelRawDataLikeMC,
bool  usingGoToEvent,
bool  enablePrefetching 
)

Definition at line 139 of file RootFile.cc.

References assert(), edm::IndexIntoFile::begin(), branchChildren_, edm::poolNames::branchIDListBranchName(), branchIDListHelper_, branchIDLists_, branchListIndexesUnchanged_, edm::BranchDescription::branchName(), edm::BranchDescription::branchType(), edm::BranchTypeToAuxiliaryBranchName(), edm::BranchDescription::className(), edm::ProductRegistry::copyProduct(), daqProvenanceHelper_, edm::roottree::defaultNonEventCacheSize, edm::IndexIntoFile::doneFileInitialization(), dropOnInput(), edm::IndexIntoFile::end(), edm::errors::EventCorruption, edm::poolNames::eventHistoryBranchName(), eventProcessHistoryIDs_, eventProcessHistoryIter_, eventSkipperByID_, edm::FileBlock::EventsOrLumisSelectedByID, eventTree_, Exception, fid_, file(), fileFormatVersion(), fileFormatVersion_, edm::poolNames::fileFormatVersionBranchName(), edm::poolNames::fileIdentifierBranchName(), filePtr_, edm::errors::FileReadError, fileThinnedAssociationsHelper_, edm::IndexIntoFile::firstAppearanceOrder, forcedRunOffset_, edm::BranchDescription::friendlyClassName(), edm::friendlyname::friendlyName(), edm::roottree::getEntry(), hasNewlyDroppedBranch_, edm::FileFormatVersion::hasThinnedAssociations(), i, edm::poolNames::idToParameterSetBlobsBranchName(), indexIntoFile_, indexIntoFileBegin_, edm::poolNames::indexIntoFileBranchName(), indexIntoFileEnd_, indexIntoFileIter_, edm::InEvent, edm::BranchDescription::init(), initializeDuplicateChecker(), edm::InLumi, edm::InRun, edm::pset::Registry::insertMapped(), edm::pset::Registry::instance(), lumiTree_, makeProvenanceReaderMaker(), edm::poolNames::metaDataTreeName(), edm::poolNames::moduleDescriptionMapBranchName(), newBranchToOldBranch(), newBranchToOldBranch_, edm::IndexIntoFile::numericalOrder, edm::poolNames::parameterSetMapBranchName(), edm::poolNames::parameterSetsTreeName(), edm::Primary, edm::poolNames::processConfigurationBranchName(), edm::poolNames::processHistoryBranchName(), edm::poolNames::processHistoryMapBranchName(), parseEventContent::prod, edm::poolNames::productDependenciesBranchName(), edm::poolNames::productDescriptionBranchName(), edm::ProductRegistry::productList(), edm::ProductRegistry::productListUpdator(), productRegistry(), productRegistry_, provenanceAdaptor_, provenanceReaderMaker_, readEventHistoryTree(), edm::ProcessHistoryRegistry::registerProcessHistory(), fetchall_from_DQM_v2::release, edm::RootTree::resetTraining(), runTree_, edm::SecondaryFile, edm::SecondarySource, edm::ParameterSet::setID(), setIfFastClonable(), edm::setRefCoreStreamer(), edm::source(), AlCaHLTBitMon_QueryRunRegistry::string, edm::poolNames::thinnedAssociationsHelperBranchName(), edm::RootTree::trainCache(), edm::roottree::trainCache(), treePointers_, edm::errors::UnimplementedFeature, edm::BranchDescription::updateFriendlyClassName(), validateFile(), and whyNotFastClonable_.

167  :
168  file_(fileName),
169  logicalFile_(logicalFileName),
171  processHistoryRegistry_(&processHistoryRegistry),
172  filePtr_(filePtr),
173  eventSkipperByID_(eventSkipperByID),
175  fid_(),
176  indexIntoFileSharedPtr_(new IndexIntoFile),
178  orderedProcessHistoryIDs_(orderedProcessHistoryIDs),
185  skipAnyEvents_(skipAnyEvents),
190  eventAux_(),
191  eventTree_(filePtr_, InEvent, nStreams, treeMaxVirtualSize, treeCacheSize, roottree::defaultLearningEntries, enablePrefetching, inputType),
192  lumiTree_(filePtr_, InLumi, 1, treeMaxVirtualSize, roottree::defaultNonEventCacheSize, roottree::defaultNonEventLearningEntries, enablePrefetching, inputType),
193  runTree_(filePtr_, InRun, 1, treeMaxVirtualSize, roottree::defaultNonEventCacheSize, roottree::defaultNonEventLearningEntries, enablePrefetching, inputType),
194  treePointers_(),
197  branchIDLists_(),
200  thinnedAssociationsHelper_(thinnedAssociationsHelper),
202  forcedRunOffset_(0),
204  eventHistoryTree_(nullptr),
207  history_(),
208  branchChildren_(new BranchChildren),
209  duplicateChecker_(duplicateChecker),
215  edProductClass_(TClass::GetClass("edm::WrapperBase")) {
216 
217  hasNewlyDroppedBranch_.fill(false);
218 
222 
223  // Read the metadata tree.
224  // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
225  std::unique_ptr<TTree> metaDataTree(dynamic_cast<TTree *>(filePtr_->Get(poolNames::metaDataTreeName().c_str())));
226  if(nullptr == metaDataTree.get()) {
227  throw Exception(errors::FileReadError) << "Could not find tree " << poolNames::metaDataTreeName()
228  << " in the input file.\n";
229  }
230 
231  // To keep things simple, we just read in every possible branch that exists.
232  // We don't pay attention to which branches exist in which file format versions
233 
234  FileFormatVersion *fftPtr = &fileFormatVersion_;
235  if(metaDataTree->FindBranch(poolNames::fileFormatVersionBranchName().c_str()) != nullptr) {
236  TBranch *fft = metaDataTree->GetBranch(poolNames::fileFormatVersionBranchName().c_str());
237  fft->SetAddress(&fftPtr);
238  roottree::getEntry(fft, 0);
239  metaDataTree->SetBranchAddress(poolNames::fileFormatVersionBranchName().c_str(), &fftPtr);
240  }
241 
242  FileID *fidPtr = &fid_;
243  if(metaDataTree->FindBranch(poolNames::fileIdentifierBranchName().c_str()) != nullptr) {
244  metaDataTree->SetBranchAddress(poolNames::fileIdentifierBranchName().c_str(), &fidPtr);
245  }
246 
247  IndexIntoFile *iifPtr = &indexIntoFile_;
248  if(metaDataTree->FindBranch(poolNames::indexIntoFileBranchName().c_str()) != nullptr) {
249  metaDataTree->SetBranchAddress(poolNames::indexIntoFileBranchName().c_str(), &iifPtr);
250  }
251 
252  // Need to read to a temporary registry so we can do a translation of the BranchKeys.
253  // This preserves backward compatibility against friendly class name algorithm changes.
254  ProductRegistry inputProdDescReg;
255  ProductRegistry *ppReg = &inputProdDescReg;
256  metaDataTree->SetBranchAddress(poolNames::productDescriptionBranchName().c_str(), (&ppReg));
257 
258  typedef std::map<ParameterSetID, ParameterSetBlob> PsetMap;
259  PsetMap psetMap;
260  PsetMap *psetMapPtr = &psetMap;
261  if(metaDataTree->FindBranch(poolNames::parameterSetMapBranchName().c_str()) != nullptr) {
262  //backward compatibility
263  assert(!fileFormatVersion().parameterSetsTree());
264  metaDataTree->SetBranchAddress(poolNames::parameterSetMapBranchName().c_str(), &psetMapPtr);
265  } else {
266  assert(fileFormatVersion().parameterSetsTree());
267  // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
268  std::unique_ptr<TTree> psetTree(dynamic_cast<TTree *>(filePtr_->Get(poolNames::parameterSetsTreeName().c_str())));
269  if(nullptr == psetTree.get()) {
270  throw Exception(errors::FileReadError) << "Could not find tree " << poolNames::parameterSetsTreeName()
271  << " in the input file.\n";
272  }
273 
274  typedef std::pair<ParameterSetID, ParameterSetBlob> IdToBlobs;
275  IdToBlobs idToBlob;
276  IdToBlobs* pIdToBlob = &idToBlob;
277  psetTree->SetBranchAddress(poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob);
278 
279  std::unique_ptr<TTreeCache> psetTreeCache = roottree::trainCache(psetTree.get(), *filePtr_, roottree::defaultNonEventCacheSize, "*");
280  psetTreeCache->SetEnablePrefetching(false);
281  filePtr_->SetCacheRead(psetTreeCache.get());
282  for(Long64_t i = 0; i != psetTree->GetEntries(); ++i) {
283  psetTree->GetEntry(i);
284  psetMap.insert(idToBlob);
285  }
286  filePtr_->SetCacheRead(0);
287  }
288 
289  // backward compatibility
291  ProcessHistoryRegistry::collection_type *pHistMapPtr = &pHistMap;
292  if(metaDataTree->FindBranch(poolNames::processHistoryMapBranchName().c_str()) != nullptr) {
293  metaDataTree->SetBranchAddress(poolNames::processHistoryMapBranchName().c_str(), &pHistMapPtr);
294  }
295 
297  ProcessHistoryRegistry::vector_type *pHistVectorPtr = &pHistVector;
298  if(metaDataTree->FindBranch(poolNames::processHistoryBranchName().c_str()) != nullptr) {
299  metaDataTree->SetBranchAddress(poolNames::processHistoryBranchName().c_str(), &pHistVectorPtr);
300  }
301 
302  // backward compatibility
303  ProcessConfigurationVector processConfigurations;
304  ProcessConfigurationVector* procConfigVectorPtr = &processConfigurations;
305  if(metaDataTree->FindBranch(poolNames::processConfigurationBranchName().c_str()) != nullptr) {
306  metaDataTree->SetBranchAddress(poolNames::processConfigurationBranchName().c_str(), &procConfigVectorPtr);
307  }
308 
309  std::unique_ptr<BranchIDLists> branchIDListsAPtr(new BranchIDLists);
310  BranchIDLists* branchIDListsPtr = branchIDListsAPtr.get();
311  if(metaDataTree->FindBranch(poolNames::branchIDListBranchName().c_str()) != nullptr) {
312  metaDataTree->SetBranchAddress(poolNames::branchIDListBranchName().c_str(), &branchIDListsPtr);
313  }
314 
315  if(inputType != InputType::SecondarySource) {
316  fileThinnedAssociationsHelper_.reset(new ThinnedAssociationsHelper);
317  ThinnedAssociationsHelper* thinnedAssociationsHelperPtr = fileThinnedAssociationsHelper_.get();
318  if(metaDataTree->FindBranch(poolNames::thinnedAssociationsHelperBranchName().c_str()) != nullptr) {
319  metaDataTree->SetBranchAddress(poolNames::thinnedAssociationsHelperBranchName().c_str(), &thinnedAssociationsHelperPtr);
320  }
321  }
322 
323  BranchChildren* branchChildrenBuffer = branchChildren_.get();
324  if(metaDataTree->FindBranch(poolNames::productDependenciesBranchName().c_str()) != nullptr) {
325  metaDataTree->SetBranchAddress(poolNames::productDependenciesBranchName().c_str(), &branchChildrenBuffer);
326  }
327 
328  // backward compatibility
329  std::vector<EventProcessHistoryID> *eventHistoryIDsPtr = &eventProcessHistoryIDs_;
330  if(metaDataTree->FindBranch(poolNames::eventHistoryBranchName().c_str()) != nullptr) {
331  metaDataTree->SetBranchAddress(poolNames::eventHistoryBranchName().c_str(), &eventHistoryIDsPtr);
332  }
333 
334  if(metaDataTree->FindBranch(poolNames::moduleDescriptionMapBranchName().c_str()) != nullptr) {
335  if(metaDataTree->GetBranch(poolNames::moduleDescriptionMapBranchName().c_str())->GetSplitLevel() != 0) {
336  metaDataTree->SetBranchStatus((poolNames::moduleDescriptionMapBranchName() + ".*").c_str(), 0);
337  } else {
338  metaDataTree->SetBranchStatus(poolNames::moduleDescriptionMapBranchName().c_str(), 0);
339  }
340  }
341 
342  // Here we read the metadata tree
343  roottree::getEntry(metaDataTree.get(), 0);
344 
346 
347  // Here we read the event history tree, if we have one.
349 
351  if(!fileFormatVersion().triggerPathsTracked()) {
352  ParameterSetConverter converter(psetMap, psetIdConverter, fileFormatVersion().parameterSetsByReference());
353  } else {
354  // Merge into the parameter set registry.
355  pset::Registry& psetRegistry = *pset::Registry::instance();
356  for(auto const& psetEntry : psetMap) {
357  ParameterSet pset(psetEntry.second.pset());
358  pset.setID(psetEntry.first);
359  // For thread safety, don't update global registries when a secondary source opens a file.
360  if(inputType != InputType::SecondarySource) {
361  psetRegistry.insertMapped(pset);
362  }
363  }
364  }
365  if(!fileFormatVersion().splitProductIDs()) {
366  // Old provenance format input file. Create a provenance adaptor.
367  provenanceAdaptor_.reset(new ProvenanceAdaptor(
368  inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter, true));
369  // Fill in the branchIDLists branch from the provenance adaptor
370  branchIDLists_ = provenanceAdaptor_->branchIDLists();
371  } else {
372  if(!fileFormatVersion().triggerPathsTracked()) {
373  // New provenance format, but change in ParameterSet Format. Create a provenance adaptor.
374  provenanceAdaptor_.reset(new ProvenanceAdaptor(
375  inputProdDescReg, pHistMap, pHistVector, processConfigurations, psetIdConverter, false));
376  }
377  // New provenance format input file. The branchIDLists branch was read directly from the input file.
378  if(metaDataTree->FindBranch(poolNames::branchIDListBranchName().c_str()) == nullptr) {
380  << "Failed to find branchIDLists branch in metaData tree.\n";
381  }
382  branchIDLists_.reset(branchIDListsAPtr.release());
383  }
384 
386  if(metaDataTree->FindBranch(poolNames::thinnedAssociationsHelperBranchName().c_str()) == nullptr) {
388  << "Failed to find thinnedAssociationsHelper branch in metaData tree.\n";
389  }
390  }
391 
392  if(!bypassVersionCheck) {
393  checkReleaseVersion(pHistVector, file());
394  }
395 
396  if(labelRawDataLikeMC) {
397  std::string const rawData("FEDRawDataCollection");
398  std::string const source("source");
399  ProductRegistry::ProductList& pList = inputProdDescReg.productListUpdator();
400  BranchKey finder(rawData, source, "", "");
401  ProductRegistry::ProductList::iterator it = pList.lower_bound(finder);
402  if(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() == source) {
403  // We found raw data with a module label of source.
404  // We need to change the module label and process name.
405  // Create helper.
406  it->second.init();
407  daqProvenanceHelper_.reset(new DaqProvenanceHelper(it->second.unwrappedTypeID()));
408  // Create the new branch description
409  BranchDescription const& newBD = daqProvenanceHelper_->branchDescription();
410  // Save info from the old and new branch descriptions
411  daqProvenanceHelper_->saveInfo(it->second, newBD);
412  // Map the new branch name to the old branch name.
413  newBranchToOldBranch_.insert(std::make_pair(newBD.branchName(), it->second.branchName()));
414  // Remove the old branch description from the product Registry.
415  pList.erase(it);
416  // Check that there was only one.
417  it = pList.lower_bound(finder);
418  assert(!(it != pList.end() && it->first.friendlyClassName() == rawData && it->first.moduleLabel() == source));
419  // Insert the new branch description into the product registry.
420  inputProdDescReg.copyProduct(newBD);
421  // Fix up other per file metadata.
422  daqProvenanceHelper_->fixMetaData(processConfigurations, pHistVector);
423  daqProvenanceHelper_->fixMetaData(*branchIDLists_);
424  daqProvenanceHelper_->fixMetaData(*branchChildren_);
425  }
426  }
427 
428  for(auto const& history : pHistVector) {
429  processHistoryRegistry.registerProcessHistory(history);
430  }
431 
433 
434  // Update the branch id info. This has to be done before validateFile since
435  // depending on the file format, the branchIDListHelper_ may have its fixBranchListIndexes call made
436  if(inputType == InputType::Primary || inputType == InputType::SecondarySource) {
438  }
439 
440  validateFile(inputType, usingGoToEvent);
441 
442  // Here, we make the class that will make the ProvenanceReader
443  // It reads whatever trees it needs.
445 
446  // Merge into the hashed registries.
447  if(eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
449  }
450 
451  initializeDuplicateChecker(indexesIntoFiles, currentIndexIntoFile);
454  forcedRunOffset_ = forcedRunOffset(forcedRunNumber, indexIntoFileBegin_, indexIntoFileEnd_);
455  eventProcessHistoryIter_ = eventProcessHistoryIDs_.begin();
456 
457  // Set product presence information in the product registry.
458  ProductRegistry::ProductList& pList = inputProdDescReg.productListUpdator();
459  for(auto& product : pList) {
460  BranchDescription& prod = product.second;
461  prod.init();
462  treePointers_[prod.branchType()]->setPresence(prod, newBranchToOldBranch(prod.branchName()));
463  }
464 
465  std::unique_ptr<ProductRegistry> newReg(new ProductRegistry);
466 
467  // Do the translation from the old registry to the new one
468  {
469  ProductRegistry::ProductList const& prodList = inputProdDescReg.productList();
470  for(auto const& product : prodList) {
471  BranchDescription const& prod = product.second;
472  std::string newFriendlyName = friendlyname::friendlyName(prod.className());
473  if(newFriendlyName == prod.friendlyClassName()) {
474  newReg->copyProduct(prod);
475  } else {
476  if(fileFormatVersion().splitProductIDs()) {
478  << "Cannot change friendly class name algorithm without more development work\n"
479  << "to update BranchIDLists and ThinnedAssociationsHelper. Contact the framework group.\n";
480  }
481  BranchDescription newBD(prod);
482  newBD.updateFriendlyClassName();
483  newReg->copyProduct(newBD);
484  newBranchToOldBranch_.insert(std::make_pair(newBD.branchName(), prod.branchName()));
485  }
486  }
487  dropOnInput(*newReg, productSelectorRules, dropDescendants, inputType);
488  if(inputType != InputType::SecondarySource) {
489  thinnedAssociationsHelper->updateFromInput(*fileThinnedAssociationsHelper_,
490  inputType == InputType::SecondaryFile,
491  associationsFromSecondary);
492  }
493  // freeze the product registry
494  newReg->setFrozen(inputType != InputType::Primary);
495  productRegistry_.reset(newReg.release());
496  }
497 
498  // Set up information from the product registry.
499  ProductRegistry::ProductList const& prodList = productRegistry()->productList();
500  for(auto const& product : prodList) {
501  BranchDescription const& prod = product.second;
502  treePointers_[prod.branchType()]->addBranch(product.first, prod,
503  newBranchToOldBranch(prod.branchName()));
504  }
505 
506  // Determine if this file is fast clonable.
507  setIfFastClonable(remainingEvents, remainingLumis);
508 
509  setRefCoreStreamer(true); // backward compatibility
510 
511  // We are done with our initial reading of EventAuxiliary.
513 
514  // Tell the event tree to begin training at the next read.
516 
517  // Train the run and lumi trees.
518  runTree_.trainCache("*");
519  lumiTree_.trainCache("*");
520  }
void dropOnInput(ProductRegistry &reg, ProductSelectorRules const &rules, bool dropDescendants, InputType inputType)
Definition: RootFile.cc:1707
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:477
std::shared_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
Definition: RootFile.h:215
std::string const & idToParameterSetBlobsBranchName()
Definition: BranchType.cc:255
std::unique_ptr< ProvenanceAdaptor > provenanceAdaptor_
Definition: RootFile.h:225
std::vector< ProcessConfiguration > ProcessConfigurationVector
int i
Definition: DBlmapReader.cc:9
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const &branchType)
Definition: BranchType.cc:115
unsigned int const defaultNonEventLearningEntries
Definition: RootTree.h:40
std::unique_ptr< History > history_
Definition: RootFile.h:222
void doneFileInitialization() const
Clears the temporary vector of event numbers to reduce memory usage.
std::vector< BranchIDList > BranchIDLists
Definition: BranchIDList.h:19
std::shared_ptr< BranchIDLists const > branchIDLists_
Definition: RootFile.h:212
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
Definition: RootFile.h:106
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
static std::string const source("source")
int whyNotFastClonable_
Definition: RootFile.h:202
std::map< std::string, std::string > newBranchToOldBranch_
Definition: RootFile.h:218
std::map< BranchKey, BranchDescription > ProductList
assert(m_qm.get())
RootTree lumiTree_
Definition: RootFile.h:207
std::unique_ptr< MakeProvenanceReader > provenanceReaderMaker_
Definition: RootFile.h:226
void setRefCoreStreamer(bool resetAll=false)
processConfiguration
Definition: Schedule.cc:370
std::string const & fileFormatVersionBranchName()
Definition: BranchType.cc:218
IndexIntoFileItr begin(SortOrder sortOrder) const
InputSource::ProcessingMode processingMode_
Definition: RootFile.h:216
TClass * edProductClass_
Definition: RootFile.h:230
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
void trainCache(char const *branchNames)
Definition: RootTree.cc:446
std::shared_ptr< ProductRegistry const > productRegistry() const
Definition: RootFile.h:105
FileFormatVersion fileFormatVersion_
Definition: RootFile.h:189
std::string const & parameterSetsTreeName()
Definition: BranchType.cc:251
std::vector< EventProcessHistoryID >::const_iterator eventProcessHistoryIter_
Definition: RootFile.h:198
FileID fid_
Definition: RootFile.h:190
std::string const logicalFile_
Definition: RootFile.h:184
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
std::string const & processHistoryMapBranchName()
Definition: BranchType.cc:193
bool noEventSort_
Definition: RootFile.h:201
std::string friendlyName(std::string const &iFullName)
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
Definition: RootFile.h:210
std::shared_ptr< BranchIDListHelper > branchIDListHelper_
Definition: RootFile.h:213
std::string const & indexIntoFileBranchName()
Definition: BranchType.cc:233
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:238
EventSelectionIDVector eventSelectionIDs_
Definition: RootFile.h:220
bool skipAnyEvents_
Definition: RootFile.h:200
std::vector< std::shared_ptr< ProductProvenanceRetriever > > eventProductProvenanceRetrievers_
Definition: RootFile.h:227
RootTree eventTree_
Definition: RootFile.h:206
std::map< ParameterSetID, ParameterSetID > ParameterSetIdConverter
BranchListIndexes branchListIndexes_
Definition: RootFile.h:221
std::string const & metaDataTreeName()
Definition: BranchType.cc:168
std::string const & parameterSetMapBranchName()
Definition: BranchType.cc:183
std::string const & processHistoryBranchName()
Definition: BranchType.cc:198
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:192
std::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:187
RootTree runTree_
Definition: RootFile.h:208
std::unique_ptr< ThinnedAssociationsHelper > fileThinnedAssociationsHelper_
Definition: RootFile.h:214
std::shared_ptr< EventSkipperByID > eventSkipperByID_
Definition: RootFile.h:188
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: RootFile.h:203
static EntryNumber_t const invalidEntry
ProcessConfiguration const & processConfiguration_
Definition: RootFile.h:185
std::shared_ptr< ProductRegistry const > productRegistry_
Definition: RootFile.h:211
void setIfFastClonable(int remainingEvents, int remainingLumis)
Definition: RootFile.cc:608
std::shared_ptr< BranchChildren > branchChildren_
Definition: RootFile.h:223
std::string const & file() const
Definition: RootFile.h:104
std::string const & productDescriptionBranchName()
Definition: BranchType.cc:173
std::string const & processConfigurationBranchName()
Definition: BranchType.cc:203
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
Definition: RootFile.h:194
std::unique_ptr< DaqProvenanceHelper > daqProvenanceHelper_
Definition: RootFile.h:229
bool branchListIndexesUnchanged_
Definition: RootFile.h:204
unsigned int const defaultNonEventCacheSize
Definition: RootTree.h:38
RootTreePtrArray treePointers_
Definition: RootFile.h:209
void initializeDuplicateChecker(std::vector< std::shared_ptr< IndexIntoFile > > const &indexesIntoFiles, std::vector< std::shared_ptr< IndexIntoFile > >::size_type currentIndexIntoFile)
Definition: RootFile.cc:1682
std::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:224
std::vector< ProcessHistoryID > & orderedProcessHistoryIDs_
Definition: RootFile.h:193
std::string const & productDependenciesBranchName()
Definition: BranchType.cc:178
std::string const & thinnedAssociationsHelperBranchName()
Definition: BranchType.cc:213
std::unique_ptr< MakeProvenanceReader > makeProvenanceReaderMaker(InputType inputType)
Definition: RootFile.cc:1821
std::string const & branchIDListBranchName()
Definition: BranchType.cc:208
std::vector< ParentageID > parentageIDLookup_
Definition: RootFile.h:228
EventAuxiliary eventAux_
Definition: RootFile.h:205
void resetTraining()
Definition: RootTree.h:152
ProcessHistoryRegistry * processHistoryRegistry_
Definition: RootFile.h:186
void validateFile(InputType inputType, bool usingGoToEvent)
Definition: RootFile.cc:1103
std::shared_ptr< IndexIntoFile > indexIntoFileSharedPtr_
Definition: RootFile.h:191
std::string const & newBranchToOldBranch(std::string const &newBranch) const
Definition: RootFile.cc:679
std::unique_ptr< TTreeCache > trainCache(TTree *tree, InputFile &file, unsigned int cacheSize, char const *branchNames)
Definition: RootTree.cc:501
unsigned int const defaultLearningEntries
Definition: RootTree.h:39
TTree * eventHistoryTree_
Definition: RootFile.h:219
bool hasThinnedAssociations() const
std::string const & fileIdentifierBranchName()
Definition: BranchType.cc:223
std::shared_ptr< RunAuxiliary > savedRunAuxiliary_
Definition: RootFile.h:199
std::string const & moduleDescriptionMapBranchName()
Definition: BranchType.cc:188
std::string const file_
Definition: RootFile.h:183
std::vector< EventProcessHistoryID > eventProcessHistoryIDs_
Definition: RootFile.h:197
static Registry * instance()
Definition: Registry.cc:16
void readEventHistoryTree()
Definition: RootFile.cc:1669
int forcedRunOffset_
Definition: RootFile.h:217
edm::RootFile::~RootFile ( )

Definition at line 522 of file RootFile.cc.

522  {
523  }
edm::RootFile::RootFile ( RootFile const &  )
delete

Member Function Documentation

std::shared_ptr<BranchIDListHelper const> edm::RootFile::branchIDListHelper ( ) const
inline

Definition at line 106 of file RootFile.h.

References branchIDListHelper_.

106 {return branchIDListHelper_;}
std::shared_ptr< BranchIDListHelper > branchIDListHelper_
Definition: RootFile.h:213
bool edm::RootFile::branchListIndexesUnchanged ( ) const
inline

Definition at line 118 of file RootFile.h.

References branchListIndexesUnchanged_.

Referenced by createFileBlock().

bool branchListIndexesUnchanged_
Definition: RootFile.h:204
void edm::RootFile::close ( void  )

Definition at line 1164 of file RootFile.cc.

References eventHistoryTree_, filePtr_, and treePointers_.

Referenced by lumiQTWidget.ApplicationWindow::fileQuit(), esMonitoring.AsyncLineReaderMixin::handle_close(), esMonitoring.FDJsonServer::handle_close(), Vispa.Gui.BoxContentDialog.BoxContentDialog::keyPressEvent(), and Vispa.Gui.FindDialog.FindDialog::keyPressEvent().

1164  {
1165  // Just to play it safe, zero all pointers to objects in the InputFile to be closed.
1166  eventHistoryTree_ = nullptr;
1167  for(auto& treePointer : treePointers_) {
1168  treePointer->close();
1169  treePointer = nullptr;
1170  }
1171  filePtr_->Close();
1172  filePtr_.reset();
1173  }
std::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:187
RootTreePtrArray treePointers_
Definition: RootFile.h:209
TTree * eventHistoryTree_
Definition: RootFile.h:219
bool edm::RootFile::containsItem ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
) const

Definition at line 758 of file RootFile.cc.

References edm::IndexIntoFile::containsItem(), and indexIntoFile_.

758  {
760  }
tuple lumi
Definition: fjr2json.py:35
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 & indexIntoFile_
Definition: RootFile.h:192
bool containsItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
std::unique_ptr< FileBlock > edm::RootFile::createFileBlock ( ) const

Definition at line 662 of file RootFile.cc.

References branchChildren_, branchListIndexesUnchanged(), eventTree_, file_, fileFormatVersion(), hasNewlyDroppedBranch(), lumiTree_, edm::RootTree::metaTree(), modifiedIDs(), runTree_, edm::RootTree::tree(), and whyNotFastClonable().

662  {
663  return std::unique_ptr<FileBlock>(new FileBlock(fileFormatVersion(),
664  eventTree_.tree(),
666  lumiTree_.tree(),
668  runTree_.tree(),
669  runTree_.metaTree(),
672  file_,
674  modifiedIDs(),
675  branchChildren_));
676  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
bool branchListIndexesUnchanged() const
Definition: RootFile.h:118
RootTree lumiTree_
Definition: RootFile.h:207
TTree const * metaTree() const
Definition: RootTree.h:142
TTree const * tree() const
Definition: RootTree.h:140
bool modifiedIDs() const
Definition: RootFile.h:119
int whyNotFastClonable() const
Definition: RootFile.h:116
RootTree eventTree_
Definition: RootFile.h:206
std::array< bool, NumBranchTypes > const & hasNewlyDroppedBranch() const
Definition: RootFile.h:117
RootTree runTree_
Definition: RootFile.h:208
std::shared_ptr< BranchChildren > branchChildren_
Definition: RootFile.h:223
std::string const file_
Definition: RootFile.h:183
void edm::RootFile::dropOnInput ( ProductRegistry reg,
ProductSelectorRules const &  rules,
bool  dropDescendants,
InputType  inputType 
)
private

Definition at line 1707 of file RootFile.cc.

References edm::ProductRegistry::allBranchDescriptions(), edm::BranchDescription::branchID(), edm::BranchDescription::branchName(), edm::BranchDescription::branchType(), CommonMethods::cp(), drop, edProductClass_, file_, fileThinnedAssociationsHelper_, edm::getWrapperBasePtr(), hasNewlyDroppedBranch_, edm::InEvent, edm::ProductSelector::initialize(), getDQMSummary::iter, markBranchToBeDropped(), newBranchToOldBranch(), hltrates_dqm_sourceclient-live_cfg::offset, AlCaHLTBitMon_ParallelJobs::p, edm::BranchDescription::present(), parseEventContent::prod, edm::ProductRegistry::productListUpdator(), edm::SecondaryFile, edm::SecondarySource, edm::ProductSelector::selected(), groupFilesInBlocks::temp, treePointers_, edm::BranchDescription::unwrappedType(), and edm::BranchDescription::wrappedName().

Referenced by RootFile().

1707  {
1708 
1709  // This is the selector for drop on input.
1710  ProductSelector productSelector;
1711  productSelector.initialize(rules, reg.allBranchDescriptions());
1712 
1713  std::vector<BranchDescription const*> associationDescriptions;
1714 
1715  ProductRegistry::ProductList& prodList = reg.productListUpdator();
1716  // Do drop on input. On the first pass, just fill in a set of branches to be dropped.
1717  std::set<BranchID> branchesToDrop;
1718  for(auto const& product : prodList) {
1719  BranchDescription const& prod = product.second;
1720  // Special handling for ThinnedAssociations
1721  if(prod.unwrappedType() == typeid(ThinnedAssociation) && prod.present()) {
1722  if(inputType != InputType::SecondarySource) {
1723  associationDescriptions.push_back(&prod);
1724  } else {
1725  markBranchToBeDropped(dropDescendants, prod.branchID(), branchesToDrop);
1726  }
1727  } else if(!productSelector.selected(prod)) {
1728  markBranchToBeDropped(dropDescendants, prod.branchID(), branchesToDrop);
1729  }
1730  }
1731 
1732  if(inputType != InputType::SecondarySource) {
1733 
1734  // Decide whether to keep the thinned associations and corresponding
1735  // entries in the helper. For secondary source they are all dropped,
1736  // but in other cases we look for thinned collections the associations
1737  // redirect a Ref or Ptr to when dereferencing them.
1738 
1739  // Need a list of kept products in order to determine which thinned associations
1740  // are kept.
1741  std::set<BranchID> keptProductsInEvent;
1742  for(auto const& product : prodList) {
1743  BranchDescription const& prod = product.second;
1744  if( branchesToDrop.find(prod.branchID()) == branchesToDrop.end() &&
1745  prod.present() &&
1746  prod.branchType() == InEvent) {
1747  keptProductsInEvent.insert(prod.branchID());
1748  }
1749  }
1750 
1751  // Decide which ThinnedAssociations to keep and store the decision in keepAssociation
1752  std::map<BranchID, bool> keepAssociation;
1753  fileThinnedAssociationsHelper_->selectAssociationProducts(associationDescriptions,
1754  keptProductsInEvent,
1755  keepAssociation);
1756 
1757  for(auto association : associationDescriptions) {
1758  if(!keepAssociation[association->branchID()]) {
1759  markBranchToBeDropped(dropDescendants, association->branchID(), branchesToDrop);
1760  }
1761  }
1762 
1763  // Also delete the dropped associations from the ThinnedAssociationsHelper
1764  std::unique_ptr<ThinnedAssociationsHelper> temp(new ThinnedAssociationsHelper);
1765  for(auto const& associationBranches : fileThinnedAssociationsHelper_->data()) {
1766  auto iter = keepAssociation.find(associationBranches.association());
1767  if(iter != keepAssociation.end() && iter->second) {
1768  temp->addAssociation(associationBranches);
1769  }
1770  }
1771  fileThinnedAssociationsHelper_.reset(temp.release());
1772  }
1773 
1774  // On this pass, actually drop the branches.
1775  std::set<BranchID>::const_iterator branchesToDropEnd = branchesToDrop.end();
1776  for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1777  BranchDescription const& prod = it->second;
1778  bool drop = branchesToDrop.find(prod.branchID()) != branchesToDropEnd;
1779  if(drop) {
1780  if(productSelector.selected(prod) && prod.unwrappedType() != typeid(ThinnedAssociation)) {
1781  LogWarning("RootFile")
1782  << "Branch '" << prod.branchName() << "' is being dropped from the input\n"
1783  << "of file '" << file_ << "' because it is dependent on a branch\n"
1784  << "that was explicitly dropped.\n";
1785  }
1786  treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName()));
1787  hasNewlyDroppedBranch_[prod.branchType()] = true;
1788  ProductRegistry::ProductList::iterator icopy = it;
1789  ++it;
1790  prodList.erase(icopy);
1791  } else {
1792  ++it;
1793  }
1794  }
1795 
1796  // Drop on input mergeable run and lumi products, this needs to be invoked for secondary file input
1797  if(inputType == InputType::SecondaryFile) {
1798  TString tString;
1799  for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) {
1800  BranchDescription const& prod = it->second;
1801  if(prod.branchType() != InEvent) {
1802  TClass* cp = TClass::GetClass(prod.wrappedName().c_str());
1803  void* p = cp->New();
1804  int offset = cp->GetBaseClassOffset(edProductClass_);
1805  std::unique_ptr<WrapperBase> edp = getWrapperBasePtr(p, offset);
1806  if(edp->isMergeable()) {
1807  treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName()));
1808  ProductRegistry::ProductList::iterator icopy = it;
1809  ++it;
1810  prodList.erase(icopy);
1811  } else {
1812  ++it;
1813  }
1814  }
1815  else ++it;
1816  }
1817  }
1818  }
std::map< BranchKey, BranchDescription > ProductList
TClass * edProductClass_
Definition: RootFile.h:230
const int drop
std::unique_ptr< ThinnedAssociationsHelper > fileThinnedAssociationsHelper_
Definition: RootFile.h:214
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: RootFile.h:203
RootTreePtrArray treePointers_
Definition: RootFile.h:209
std::unique_ptr< WrapperBase > getWrapperBasePtr(void *p, int offset)
void markBranchToBeDropped(bool dropDescendants, BranchID const &branchID, std::set< BranchID > &branchesToDrop) const
Definition: RootFile.cc:1698
std::string const & newBranchToOldBranch(std::string const &newBranch) const
Definition: RootFile.cc:679
std::string const file_
Definition: RootFile.h:183
EventAuxiliary const& edm::RootFile::eventAux ( ) const
inline
EventID const& edm::RootFile::eventID ( ) const
inline

Definition at line 111 of file RootFile.h.

References eventAux(), and edm::EventAuxiliary::id().

111 {return eventAux().id();}
EventAuxiliary const & eventAux() const
Definition: RootFile.h:107
EventID const & id() const
RootTree const& edm::RootFile::eventTree ( ) const
inline

Definition at line 112 of file RootFile.h.

References eventTree_.

112 {return eventTree_;}
RootTree eventTree_
Definition: RootFile.h:206
std::string const& edm::RootFile::file ( ) const
inline

Definition at line 104 of file RootFile.h.

References file_.

Referenced by RootFile().

104 {return file_;}
std::string const file_
Definition: RootFile.h:183
FileFormatVersion edm::RootFile::fileFormatVersion ( ) const
inline
bool edm::RootFile::fillEventAuxiliary ( IndexIntoFile::EntryNumber_t  entry)
private

Definition at line 1195 of file RootFile.cc.

References edm::RootTree::current(), eventTree_, fillThisEventAuxiliary(), and edm::RootTree::setEntryNumber().

Referenced by getNextItemType(), isDuplicateEvent(), readEvent(), readLuminosityBlockAuxiliary_(), readRunAuxiliary_(), setEntryAtNextEventInLumi(), skipEvents(), and skipThisEntry().

1195  {
1196  if(!eventTree_.current(entry)) {
1197  return false;
1198  }
1199  eventTree_.setEntryNumber(entry);
1201  return true;
1202  }
bool current() const
Definition: RootTree.h:89
RootTree eventTree_
Definition: RootFile.h:206
void fillThisEventAuxiliary()
Definition: RootFile.cc:1176
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:190
void edm::RootFile::fillEventHistory ( )
private

Definition at line 1205 of file RootFile.cc.

References assert(), branchIDListHelper_, branchListIndexes_, edm::poolNames::branchListIndexesBranchName(), daqProvenanceHelper_, edm::RootTree::entryNumber(), event(), eventAux(), eventAux_, edm::errors::EventCorruption, edm::poolNames::eventHistoryBranchName(), edm::FileFormatVersion::eventHistoryTree(), eventHistoryTree_, eventProcessHistoryIDs_, eventProcessHistoryIter_, eventSelectionIDs_, edm::poolNames::eventSelectionsBranchName(), eventTree_, Exception, fileFormatVersion(), edm::RootTree::fillBranchEntry(), edm::roottree::getEntry(), history_, edm::lower_bound_all(), edm::FileFormatVersion::noMetaDataTrees(), edm::EventAuxiliary::processHistoryID(), provenanceAdaptor_, DTTTrigCorrFirst::run, edm::EventAuxiliary::setProcessHistoryID(), edm::FileFormatVersion::splitProductIDs(), filterCSVwithJSON::target, and edm::RootTree::tree().

Referenced by fillIndexIntoFile(), readCurrentEvent(), and readRunAuxiliary_().

1205  {
1206  // We could consider doing delayed reading, but because we have to
1207  // store this History object in a different tree than the event
1208  // data tree, this is too hard to do in this first version.
1209 
1210  if(fileFormatVersion().eventHistoryBranch()) {
1211  // Lumi block number was not in EventID for the relevant releases.
1212  EventID id(eventAux().id().run(), 0, eventAux().id().event());
1213  if(eventProcessHistoryIter_->eventID() != id) {
1214  EventProcessHistoryID target(id, ProcessHistoryID());
1216  assert(eventProcessHistoryIter_->eventID() == id);
1217  }
1220  } else if(fileFormatVersion().eventHistoryTree()) {
1221  // for backward compatibility.
1222  History* pHistory = history_.get();
1223  TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(poolNames::eventHistoryBranchName().c_str());
1224  if(!eventHistoryBranch) {
1226  << "Failed to find history branch in event history tree.\n";
1227  }
1228  eventHistoryBranch->SetAddress(&pHistory);
1230  eventAux_.setProcessHistoryID(history_->processHistoryID());
1231  eventSelectionIDs_.swap(history_->eventSelectionIDs());
1232  branchListIndexes_.swap(history_->branchListIndexes());
1233  } else if(fileFormatVersion().noMetaDataTrees()) {
1234  // Current format
1236  TBranch* eventSelectionIDBranch = eventTree_.tree()->GetBranch(poolNames::eventSelectionsBranchName().c_str());
1237  assert(eventSelectionIDBranch != nullptr);
1238  eventTree_.fillBranchEntry(eventSelectionIDBranch, pESV);
1240  TBranch* branchListIndexesBranch = eventTree_.tree()->GetBranch(poolNames::branchListIndexesBranchName().c_str());
1241  assert(branchListIndexesBranch != nullptr);
1242  eventTree_.fillBranchEntry(branchListIndexesBranch, pBLI);
1243  }
1244  if(provenanceAdaptor_) {
1245  eventAux_.setProcessHistoryID(provenanceAdaptor_->convertID(eventAux().processHistoryID()));
1246  for(auto& esID : eventSelectionIDs_) {
1247  esID = provenanceAdaptor_->convertID(esID);
1248  }
1249  }
1250  if(daqProvenanceHelper_) {
1252  }
1254  // old format. branchListIndexes_ must be filled in from the ProvenanceAdaptor.
1255  provenanceAdaptor_->branchListIndexes(branchListIndexes_);
1256  }
1257  branchIDListHelper_->fixBranchListIndexes(branchListIndexes_);
1258  }
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:477
std::unique_ptr< ProvenanceAdaptor > provenanceAdaptor_
Definition: RootFile.h:225
std::unique_ptr< History > history_
Definition: RootFile.h:222
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
ForwardSequence::const_iterator lower_bound_all(ForwardSequence const &s, Datum const &d)
wrappers for std::lower_bound
Definition: Algorithms.h:91
assert(m_qm.get())
std::string const & eventSelectionsBranchName()
Definition: BranchType.cc:243
std::vector< EventSelectionID > EventSelectionIDVector
std::vector< EventProcessHistoryID >::const_iterator eventProcessHistoryIter_
Definition: RootFile.h:198
TTree const * tree() const
Definition: RootTree.h:140
std::vector< BranchListIndex > BranchListIndexes
std::shared_ptr< BranchIDListHelper > branchIDListHelper_
Definition: RootFile.h:213
std::string const & eventHistoryBranchName()
Definition: BranchType.cc:238
EventAuxiliary const & eventAux() const
Definition: RootFile.h:107
EventSelectionIDVector eventSelectionIDs_
Definition: RootFile.h:220
bool eventHistoryTree() const
RootTree eventTree_
Definition: RootFile.h:206
BranchListIndexes branchListIndexes_
Definition: RootFile.h:221
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
Hash< ProcessHistoryType > ProcessHistoryID
EntryNumber const & entryNumber() const
Definition: RootTree.h:94
void fillBranchEntry(TBranch *branch, T *&pbuf)
Definition: RootTree.h:118
void setProcessHistoryID(ProcessHistoryID const &phid)
ProcessHistoryID const & processHistoryID() const
std::unique_ptr< DaqProvenanceHelper > daqProvenanceHelper_
Definition: RootFile.h:229
std::string const & branchListIndexesBranchName()
Definition: BranchType.cc:247
EventAuxiliary eventAux_
Definition: RootFile.h:205
TTree * eventHistoryTree_
Definition: RootFile.h:219
std::vector< EventProcessHistoryID > eventProcessHistoryIDs_
Definition: RootFile.h:197
void edm::RootFile::fillIndexIntoFile ( )
private

Definition at line 877 of file RootFile.cc.

References assert(), edm::RootTree::entries(), python.tagInventory::entries, edm::RootTree::entryNumber(), event(), eventAux(), eventAux_, eventTree_, fileFormatVersion(), fillEventHistory(), fillLumiAuxiliary(), fillRunAuxiliary(), fillThisEventAuxiliary(), edm::find_in_all(), indexIntoFile_, edm::IndexIntoFile::invalidEntry, edm::RootTree::isValid(), lastEventEntryNumberRead_, summaryLumi::lcount, fjr2json::lumi, edm::EventAuxiliary::luminosityBlock(), edmLumisInFiles::lumis, lumiTree_, eostools::move(), edm::RootTree::next(), processHistoryRegistry_, edm::ProcessHistoryRegistry::reducedProcessHistoryID(), DTTTrigCorrFirst::run, edm::EventAuxiliary::run(), gather_cfg::runs, runTree_, edm::second(), edm::RootTree::setEntryNumber(), edm::IndexIntoFile::setProcessHistoryIDs(), edm::IndexIntoFile::setRunOrLumiEntries(), edm::stable_sort_all(), and edm::IndexIntoFile::unsortedEventNumbers().

Referenced by validateFile().

877  {
878  // This function is for backward compatibility.
879  // If reading a current format file, indexIntoFile_ is read from the input
880  // file and should always be there. Note that the algorithm below will work
881  // sometimes but often fail with the new format introduced in release 3_8_0.
882  // If it ever becomes necessary to rebuild IndexIntoFile from the new format,
883  // probably a separate function should be written to deal with the task.
884  // This is possible just not implemented yet.
885  assert(!fileFormatVersion().hasIndexIntoFile());
886 
887  typedef std::list<LumiItem> LumiList;
888  LumiList lumis; // (declare 1)
889 
890  typedef std::set<LuminosityBlockID> RunLumiSet;
891  RunLumiSet runLumiSet; // (declare 2)
892 
893  typedef std::list<RunItem> RunList;
894  RunList runs; // (declare 5)
895 
896  typedef std::set<RunNumber_t> RunSet;
897  RunSet runSet; // (declare 4)
898 
899  typedef std::set<RunItem, RunItemSortByRunPhid> RunItemSet;
900  RunItemSet runItemSet; // (declare 3)
901 
902  typedef std::map<RunNumber_t, ProcessHistoryID> PHIDMap;
903  PHIDMap phidMap;
904 
905  RunNumber_t prevRun = 0;
906  LuminosityBlockNumber_t prevLumi = 0;
907  ProcessHistoryID prevPhid;
908  bool iFirst = true;
909 
910  indexIntoFile_.unsortedEventNumbers().clear(); // should already be empty, just being careful
912 
913  // First, loop through the event tree.
914  while(eventTree_.next()) {
915  bool newRun = false;
916  bool newLumi = false;
919 
920  // Save the event numbers as we loop through the event auxiliary to avoid
921  // having to read through the event auxiliary again later. These event numbers
922  // are not actually used in this function, but could be needed elsewhere.
924 
925  ProcessHistoryID reducedPHID = processHistoryRegistry_->reducedProcessHistoryID(eventAux().processHistoryID());
926 
927  if(iFirst || prevPhid != reducedPHID || prevRun != eventAux().run()) {
928  iFirst = false;
929  newRun = newLumi = true;
930  } else if(prevLumi != eventAux().luminosityBlock()) {
931  newLumi = true;
932  }
933  prevPhid = reducedPHID;
934  prevRun = eventAux().run();
935  prevLumi = eventAux().luminosityBlock();
936  if(newLumi) {
937  lumis.emplace_back(reducedPHID,
938  eventAux().run(), eventAux().luminosityBlock(), eventTree_.entryNumber()); // (insert 1)
939  runLumiSet.insert(LuminosityBlockID(eventAux().run(), eventAux().luminosityBlock())); // (insert 2)
940  } else {
941  LumiItem& currentLumi = lumis.back();
942  assert(currentLumi.lastEventEntry_ == eventTree_.entryNumber());
943  ++currentLumi.lastEventEntry_;
944  }
945  if(newRun) {
946  // Insert run in list if it is not already there.
947  RunItem item(reducedPHID, eventAux().run());
948  if(runItemSet.insert(item).second) { // (check 3, insert 3)
949  runs.push_back(std::move(item)); // (insert 5)
950  runSet.insert(eventAux().run()); // (insert 4)
951  phidMap.insert(std::make_pair(eventAux().run(), reducedPHID));
952  }
953  }
954  }
955  // now clean up.
957  eventAux_ = EventAuxiliary();
959 
960  // Loop over run entries and fill information.
961 
962  typedef std::map<RunNumber_t, IndexIntoFile::EntryNumber_t> RunMap;
963  RunMap runMap; // (declare 11)
964 
965  typedef std::vector<RunItem> RunVector;
966  RunVector emptyRuns; // (declare 12)
967 
968  if(runTree_.isValid()) {
969  while(runTree_.next()) {
970  // Note: adjacent duplicates will be skipped without an explicit check.
971 
972  std::shared_ptr<RunAuxiliary> runAux = fillRunAuxiliary();
973  ProcessHistoryID reducedPHID = processHistoryRegistry_->reducedProcessHistoryID(runAux->processHistoryID());
974 
975  if(runSet.insert(runAux->run()).second) { // (check 4, insert 4)
976  // This run was not associated with any events.
977  emptyRuns.emplace_back(reducedPHID, runAux->run()); // (insert 12)
978  }
979  runMap.insert(std::make_pair(runAux->run(), runTree_.entryNumber())); // (insert 11)
980  phidMap.insert(std::make_pair(runAux->run(), reducedPHID));
981  }
982  // now clean up.
984  }
985 
986  // Insert the ordered empty runs into the run list.
987  RunItemSortByRun runItemSortByRun;
988  stable_sort_all(emptyRuns, runItemSortByRun);
989 
990  RunList::iterator itRuns = runs.begin(), endRuns = runs.end();
991  for(auto const& emptyRun : emptyRuns) {
992  for(; itRuns != endRuns; ++itRuns) {
993  if(runItemSortByRun(emptyRun, *itRuns)) {
994  break;
995  }
996  }
997  runs.insert(itRuns, emptyRun);
998  }
999 
1000  // Loop over luminosity block entries and fill information.
1001 
1002  typedef std::vector<LumiItem> LumiVector;
1003  LumiVector emptyLumis; // (declare 7)
1004 
1005  typedef std::map<LuminosityBlockID, IndexIntoFile::EntryNumber_t> RunLumiMap;
1006  RunLumiMap runLumiMap; // (declare 6)
1007 
1008  if(lumiTree_.isValid()) {
1009  while(lumiTree_.next()) {
1010  // Note: adjacent duplicates will be skipped without an explicit check.
1011  std::shared_ptr<LuminosityBlockAuxiliary> lumiAux = fillLumiAuxiliary();
1012  LuminosityBlockID lumiID = LuminosityBlockID(lumiAux->run(), lumiAux->luminosityBlock());
1013  if(runLumiSet.insert(lumiID).second) { // (check 2, insert 2)
1014  // This lumi was not associated with any events.
1015  // Use the process history ID from the corresponding run. In cases of practical
1016  // importance, this should be the correct process history ID, but it is possible
1017  // to construct files where this is not the correct process history ID ...
1018  PHIDMap::const_iterator iPhidMap = phidMap.find(lumiAux->run());
1019  assert(iPhidMap != phidMap.end());
1020  emptyLumis.emplace_back(iPhidMap->second, lumiAux->run(), lumiAux->luminosityBlock(), IndexIntoFile::invalidEntry); // (insert 7)
1021  }
1022  runLumiMap.insert(std::make_pair(lumiID, lumiTree_.entryNumber()));
1023  }
1024  // now clean up.
1026  }
1027 
1028  // Insert the ordered empty lumis into the lumi list.
1029  LumiItemSortByRunLumi lumiItemSortByRunLumi;
1030  stable_sort_all(emptyLumis, lumiItemSortByRunLumi);
1031 
1032  LumiList::iterator itLumis = lumis.begin(), endLumis = lumis.end();
1033  for(auto const& emptyLumi : emptyLumis) {
1034  for(; itLumis != endLumis; ++itLumis) {
1035  if(lumiItemSortByRunLumi(emptyLumi, *itLumis)) {
1036  break;
1037  }
1038  }
1039  lumis.insert(itLumis, emptyLumi);
1040  }
1041 
1042  // Create a map of RunItems that gives the order of first appearance in the list.
1043  // Also fill in the vector of process history IDs
1044  typedef std::map<RunItem, int, RunItemSortByRunPhid> RunCountMap;
1045  RunCountMap runCountMap; // Declare (17)
1046  std::vector<ProcessHistoryID>& phids = indexIntoFile_.setProcessHistoryIDs();
1047  assert(phids.empty());
1048  std::vector<IndexIntoFile::RunOrLumiEntry>& entries = indexIntoFile_.setRunOrLumiEntries();
1049  assert(entries.empty());
1050  int rcount = 0;
1051  for(auto& run : runs) {
1052  RunCountMap::const_iterator countMapItem = runCountMap.find(run);
1053  if(countMapItem == runCountMap.end()) {
1054  countMapItem = runCountMap.insert(std::make_pair(run, rcount)).first; // Insert (17)
1055  assert(countMapItem != runCountMap.end());
1056  ++rcount;
1057  }
1058  std::vector<ProcessHistoryID>::const_iterator phidItem = find_in_all(phids, run.phid_);
1059  if(phidItem == phids.end()) {
1060  phids.push_back(run.phid_);
1061  phidItem = phids.end() - 1;
1062  }
1063  entries.emplace_back(
1064  countMapItem->second, // use (17)
1066  runMap[run.run_], // use (11)
1067  phidItem - phids.begin(),
1068  run.run_,
1069  0U,
1072  }
1073 
1074  // Create a map of LumiItems that gives the order of first appearance in the list.
1075  typedef std::map<LumiItem, int, LumiItemSortByRunLumiPhid> LumiCountMap;
1076  LumiCountMap lumiCountMap; // Declare (19)
1077  int lcount = 0;
1078  for(auto& lumi : lumis) {
1079  RunCountMap::const_iterator runCountMapItem = runCountMap.find(RunItem(lumi.phid_, lumi.run_));
1080  assert(runCountMapItem != runCountMap.end());
1081  LumiCountMap::const_iterator countMapItem = lumiCountMap.find(lumi);
1082  if(countMapItem == lumiCountMap.end()) {
1083  countMapItem = lumiCountMap.insert(std::make_pair(lumi, lcount)).first; // Insert (17)
1084  assert(countMapItem != lumiCountMap.end());
1085  ++lcount;
1086  }
1087  std::vector<ProcessHistoryID>::const_iterator phidItem = find_in_all(phids, lumi.phid_);
1088  assert(phidItem != phids.end());
1089  entries.emplace_back(
1090  runCountMapItem->second,
1091  countMapItem->second,
1092  runLumiMap[LuminosityBlockID(lumi.run_, lumi.lumi_)],
1093  phidItem - phids.begin(),
1094  lumi.run_,
1095  lumi.lumi_,
1096  lumi.firstEventEntry_,
1097  lumi.lastEventEntry_);
1098  }
1099  stable_sort_all(entries);
1100  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
std::shared_ptr< LuminosityBlockAuxiliary > fillLumiAuxiliary()
Definition: RootFile.cc:1261
tuple lumi
Definition: fjr2json.py:35
assert(m_qm.get())
RootTree lumiTree_
Definition: RootFile.h:207
EntryNumber const & entries() const
Definition: RootTree.h:96
RunNumber_t run() const
void stable_sort_all(RandomAccessSequence &s)
wrappers for std::stable_sort
Definition: Algorithms.h:135
unsigned int LuminosityBlockNumber_t
LuminosityBlockNumber_t luminosityBlock() const
tuple runs
Definition: gather_cfg.py:87
U second(std::pair< T, U > const &p)
std::vector< ProcessHistoryID > & setProcessHistoryIDs()
bool next()
Definition: RootTree.h:87
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
Definition: RootFile.h:210
EventAuxiliary const & eventAux() const
Definition: RootFile.h:107
def move
Definition: eostools.py:508
std::shared_ptr< RunAuxiliary > fillRunAuxiliary()
Definition: RootFile.cc:1285
RootTree eventTree_
Definition: RootFile.h:206
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
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
Hash< ProcessHistoryType > ProcessHistoryID
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:192
RootTree runTree_
Definition: RootFile.h:208
EntryNumber const & entryNumber() const
Definition: RootTree.h:94
std::vector< RunOrLumiEntry > & setRunOrLumiEntries()
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
void fillEventHistory()
Definition: RootFile.cc:1205
bool isValid() const
Definition: RootTree.cc:104
unsigned int RunNumber_t
EventAuxiliary eventAux_
Definition: RootFile.h:205
void fillThisEventAuxiliary()
Definition: RootFile.cc:1176
ProcessHistoryRegistry * processHistoryRegistry_
Definition: RootFile.h:186
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:190
std::shared_ptr< LuminosityBlockAuxiliary > edm::RootFile::fillLumiAuxiliary ( )
private

Definition at line 1261 of file RootFile.cc.

References edm::conversion(), daqProvenanceHelper_, fileFormatVersion(), edm::RootTree::fillAux(), lumiTree_, edm::FileFormatVersion::newAuxiliary(), provenanceAdaptor_, and edm::FileFormatVersion::runsAndLumis().

Referenced by fillIndexIntoFile(), and readLuminosityBlockAuxiliary_().

1261  {
1262  auto lumiAuxiliary = std::make_shared<LuminosityBlockAuxiliary>();
1264  LuminosityBlockAuxiliary *pLumiAux = lumiAuxiliary.get();
1265  lumiTree_.fillAux<LuminosityBlockAuxiliary>(pLumiAux);
1266  } else {
1267  LuminosityBlockAux lumiAux;
1268  LuminosityBlockAux *pLumiAux = &lumiAux;
1269  lumiTree_.fillAux<LuminosityBlockAux>(pLumiAux);
1270  conversion(lumiAux, *lumiAuxiliary);
1271  }
1272  if(provenanceAdaptor_) {
1273  lumiAuxiliary->setProcessHistoryID(provenanceAdaptor_->convertID(lumiAuxiliary->processHistoryID()));
1274  }
1275  if(daqProvenanceHelper_) {
1276  lumiAuxiliary->setProcessHistoryID(daqProvenanceHelper_->mapProcessHistoryID(lumiAuxiliary->processHistoryID()));
1277  }
1278  if(lumiAuxiliary->luminosityBlock() == 0 && !fileFormatVersion().runsAndLumis()) {
1279  lumiAuxiliary->id() = LuminosityBlockID(RunNumber_t(1), LuminosityBlockNumber_t(1));
1280  }
1281  return lumiAuxiliary;
1282  }
std::unique_ptr< ProvenanceAdaptor > provenanceAdaptor_
Definition: RootFile.h:225
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
RootTree lumiTree_
Definition: RootFile.h:207
unsigned int LuminosityBlockNumber_t
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
std::unique_ptr< DaqProvenanceHelper > daqProvenanceHelper_
Definition: RootFile.h:229
unsigned int RunNumber_t
void fillAux(T *&pAux)
Definition: RootTree.h:102
std::shared_ptr< RunAuxiliary > edm::RootFile::fillRunAuxiliary ( )
private

Definition at line 1285 of file RootFile.cc.

References edm::conversion(), daqProvenanceHelper_, fileFormatVersion(), edm::RootTree::fillAux(), edm::FileFormatVersion::newAuxiliary(), provenanceAdaptor_, and runTree_.

Referenced by fillIndexIntoFile(), and readRunAuxiliary_().

1285  {
1286  auto runAuxiliary = std::make_shared<RunAuxiliary>();
1288  RunAuxiliary *pRunAux = runAuxiliary.get();
1289  runTree_.fillAux<RunAuxiliary>(pRunAux);
1290  } else {
1291  RunAux runAux;
1292  RunAux *pRunAux = &runAux;
1293  runTree_.fillAux<RunAux>(pRunAux);
1294  conversion(runAux, *runAuxiliary);
1295  }
1296  if(provenanceAdaptor_) {
1297  runAuxiliary->setProcessHistoryID(provenanceAdaptor_->convertID(runAuxiliary->processHistoryID()));
1298  }
1299  if(daqProvenanceHelper_) {
1300  runAuxiliary->setProcessHistoryID(daqProvenanceHelper_->mapProcessHistoryID(runAuxiliary->processHistoryID()));
1301  }
1302  return runAuxiliary;
1303  }
std::unique_ptr< ProvenanceAdaptor > provenanceAdaptor_
Definition: RootFile.h:225
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
RootTree runTree_
Definition: RootFile.h:208
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
std::unique_ptr< DaqProvenanceHelper > daqProvenanceHelper_
Definition: RootFile.h:229
void fillAux(T *&pAux)
Definition: RootTree.h:102
void edm::RootFile::fillThisEventAuxiliary ( )
private

Definition at line 1176 of file RootFile.cc.

References edm::conversion(), edm::RootTree::entryNumber(), eventAux(), eventAux_, eventTree_, fileFormatVersion(), edm::RootTree::fillAux(), lastEventEntryNumberRead_, and edm::FileFormatVersion::newAuxiliary().

Referenced by fillEventAuxiliary(), fillIndexIntoFile(), initializeDuplicateChecker(), and readCurrentEvent().

1176  {
1178  // Already read.
1179  return;
1180  }
1182  EventAuxiliary *pEvAux = &eventAux_;
1183  eventTree_.fillAux<EventAuxiliary>(pEvAux);
1184  } else {
1185  // for backward compatibility.
1186  EventAux eventAux;
1187  EventAux *pEvAux = &eventAux;
1188  eventTree_.fillAux<EventAux>(pEvAux);
1189  conversion(eventAux, eventAux_);
1190  }
1192  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
IndexIntoFile::EntryNumber_t lastEventEntryNumberRead_
Definition: RootFile.h:210
EventAuxiliary const & eventAux() const
Definition: RootFile.h:107
RootTree eventTree_
Definition: RootFile.h:206
EntryNumber const & entryNumber() const
Definition: RootTree.h:94
void conversion(EventAux const &from, EventAuxiliary &to)
Definition: EventAux.cc:9
EventAuxiliary eventAux_
Definition: RootFile.h:205
void fillAux(T *&pAux)
Definition: RootTree.h:102
IndexIntoFile::EntryType edm::RootFile::getNextItemType ( RunNumber_t run,
LuminosityBlockNumber_t lumi,
EventNumber_t event 
)

Definition at line 763 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::advanceToNextLumiOrRun(), edm::IndexIntoFile::IndexIntoFileItr::advanceToNextRun(), edm::IndexIntoFile::IndexIntoFileItr::entry(), edm::EventAuxiliary::event(), eventAux_, fillEventAuxiliary(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileIter_, isDuplicateEvent(), edm::IndexIntoFile::kEnd, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::kLumi, edm::IndexIntoFile::kRun, edm::IndexIntoFile::IndexIntoFileItr::lumi(), processingMode_, edm::IndexIntoFile::IndexIntoFileItr::run(), edm::InputSource::Runs, edm::InputSource::RunsAndLumis, and skipThisEntry().

763  {
764  // First, account for consecutive skipped entries.
765  while(skipThisEntry()) {
768  }
771  }
772  else {
774  }
775  }
776  // OK, we have an entry that is not skipped.
778  if(entryType == IndexIntoFile::kEnd) {
779  return IndexIntoFile::kEnd;
780  }
781  if(entryType == IndexIntoFile::kRun) {
783  return IndexIntoFile::kRun;
784  } else if(processingMode_ == InputSource::Runs) {
786  return getNextItemType(run, lumi, event);
787  }
788  if(entryType == IndexIntoFile::kLumi) {
791  return IndexIntoFile::kLumi;
794  return getNextItemType(run, lumi, event);
795  }
796  if(isDuplicateEvent()) {
798  return getNextItemType(run, lumi, event);
799  }
803  event = eventAux_.event();
804  return IndexIntoFile::kEvent;
805  }
tuple lumi
Definition: fjr2json.py:35
InputSource::ProcessingMode processingMode_
Definition: RootFile.h:216
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
LuminosityBlockNumber_t lumi() const
bool fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1195
bool skipThisEntry()
Definition: RootFile.cc:703
IndexIntoFile::EntryType getNextItemType(RunNumber_t &run, LuminosityBlockNumber_t &lumi, EventNumber_t &event)
Definition: RootFile.cc:763
bool isDuplicateEvent()
Definition: RootFile.cc:747
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
EventAuxiliary eventAux_
Definition: RootFile.h:205
EventNumber_t event() const
bool edm::RootFile::goToEvent ( EventID const &  eventID)

Definition at line 1374 of file RootFile.cc.

References duplicateChecker_, edm::IndexIntoFile::end(), edm::EventID::event(), edm::IndexIntoFile::fillEventNumbers(), edm::IndexIntoFile::findPosition(), edm::IndexIntoFile::firstAppearanceOrder, indexIntoFile_, indexIntoFileIter_, getDQMSummary::iter, edm::EventID::luminosityBlock(), noEventSort_, edm::IndexIntoFile::numericalOrder, and edm::EventID::run().

1374  {
1375 
1377 
1378  if(duplicateChecker_) {
1379  duplicateChecker_->disable();
1380  }
1381 
1384 
1385  IndexIntoFile::IndexIntoFileItr iter =
1387 
1388  if(iter == indexIntoFile_.end(sortOrder)) {
1389  return false;
1390  }
1392  return true;
1393  }
RunNumber_t run() const
Definition: EventID.h:39
EventID const & eventID() const
Definition: RootFile.h:111
EventNumber_t event() const
Definition: EventID.h:41
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:40
IndexIntoFileItr findPosition(RunNumber_t run, LuminosityBlockNumber_t lumi=0U, EventNumber_t event=0U) const
bool noEventSort_
Definition: RootFile.h:201
IndexIntoFileItr end(SortOrder sortOrder) const
Used to end an iteration over the Runs, Lumis, and Events in a file.
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:192
void fillEventNumbers() const
std::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:224
std::array<bool, NumBranchTypes> const& edm::RootFile::hasNewlyDroppedBranch ( ) const
inline

Definition at line 117 of file RootFile.h.

References hasNewlyDroppedBranch_.

Referenced by createFileBlock().

117 {return hasNewlyDroppedBranch_;}
std::array< bool, NumBranchTypes > hasNewlyDroppedBranch_
Definition: RootFile.h:203
IndexIntoFile::IndexIntoFileItr edm::RootFile::indexIntoFileIter ( ) const

Definition at line 688 of file RootFile.cc.

References indexIntoFileIter_.

688  {
689  return indexIntoFileIter_;
690  }
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
std::shared_ptr<IndexIntoFile> edm::RootFile::indexIntoFileSharedPtr ( ) const
inline

Definition at line 146 of file RootFile.h.

References indexIntoFileSharedPtr_.

146  {
148  }
std::shared_ptr< IndexIntoFile > indexIntoFileSharedPtr_
Definition: RootFile.h:191
void edm::RootFile::initAssociationsFromSecondary ( std::vector< BranchID > const &  associationsFromSecondary)

Definition at line 698 of file RootFile.cc.

References fileThinnedAssociationsHelper_, and thinnedAssociationsHelper_.

698  {
699  thinnedAssociationsHelper_->initAssociationsFromSecondary(associationsFromSecondary, *fileThinnedAssociationsHelper_);
700  }
std::shared_ptr< ThinnedAssociationsHelper > thinnedAssociationsHelper_
Definition: RootFile.h:215
std::unique_ptr< ThinnedAssociationsHelper > fileThinnedAssociationsHelper_
Definition: RootFile.h:214
void edm::RootFile::initializeDuplicateChecker ( std::vector< std::shared_ptr< IndexIntoFile > > const &  indexesIntoFiles,
std::vector< std::shared_ptr< IndexIntoFile > >::size_type  currentIndexIntoFile 
)
private

Definition at line 1682 of file RootFile.cc.

References duplicateChecker_, eventAux(), eventTree_, fillThisEventAuxiliary(), indexIntoFile_, edm::IndexIntoFile::invalidEntry, edm::RootTree::next(), and edm::RootTree::setEntryNumber().

Referenced by RootFile().

1684  {
1685  if(duplicateChecker_) {
1686  if(eventTree_.next()) {
1688  duplicateChecker_->inputFileOpened(eventAux().isRealData(),
1690  indexesIntoFiles,
1691  currentIndexIntoFile);
1692  }
1694  }
1695  }
bool next()
Definition: RootTree.h:87
EventAuxiliary const & eventAux() const
Definition: RootFile.h:107
RootTree eventTree_
Definition: RootFile.h:206
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:192
static EntryNumber_t const invalidEntry
std::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:224
void fillThisEventAuxiliary()
Definition: RootFile.cc:1176
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:190
bool edm::RootFile::isDuplicateEvent ( )
private

Definition at line 747 of file RootFile.cc.

References assert(), duplicateChecker_, edm::IndexIntoFile::IndexIntoFileItr::entry(), edm::EventID::event(), eventAux_, file_, fillEventAuxiliary(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), edm::EventAuxiliary::id(), indexIntoFileIter_, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::IndexIntoFileItr::lumi(), edm::IndexIntoFile::IndexIntoFileItr::processHistoryIDIndex(), and edm::IndexIntoFile::IndexIntoFileItr::run().

Referenced by getNextItemType().

747  {
749  if(duplicateChecker_.get() == nullptr) {
750  return false;
751  }
753  return duplicateChecker_->isDuplicateAndCheckActive(indexIntoFileIter_.processHistoryIDIndex(),
755  }
EventNumber_t event() const
Definition: EventID.h:41
assert(m_qm.get())
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
LuminosityBlockNumber_t lumi() const
bool fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1195
EventID const & id() const
std::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:224
EventAuxiliary eventAux_
Definition: RootFile.h:205
std::string const file_
Definition: RootFile.h:183
RootTree const& edm::RootFile::lumiTree ( ) const
inline

Definition at line 113 of file RootFile.h.

References lumiTree_.

113 {return lumiTree_;}
RootTree lumiTree_
Definition: RootFile.h:207
std::shared_ptr< ProductProvenanceRetriever > edm::RootFile::makeProductProvenanceRetriever ( unsigned int  iStreamIndex)
private

Definition at line 1838 of file RootFile.cc.

References daqProvenanceHelper_, eventProductProvenanceRetrievers_, eventTree_, and provenanceReaderMaker_.

Referenced by readCurrentEvent().

1838  {
1839  if(eventProductProvenanceRetrievers_.size()<=iStreamID) {
1840  eventProductProvenanceRetrievers_.resize(iStreamID+1);
1841  }
1842  if(!eventProductProvenanceRetrievers_[iStreamID]) {
1843  eventProductProvenanceRetrievers_[iStreamID].reset(new ProductProvenanceRetriever(provenanceReaderMaker_->makeReader(eventTree_, daqProvenanceHelper_.get())));
1844  }
1845  eventProductProvenanceRetrievers_[iStreamID]->reset();
1846  return eventProductProvenanceRetrievers_[iStreamID];
1847  }
std::unique_ptr< MakeProvenanceReader > provenanceReaderMaker_
Definition: RootFile.h:226
std::vector< std::shared_ptr< ProductProvenanceRetriever > > eventProductProvenanceRetrievers_
Definition: RootFile.h:227
RootTree eventTree_
Definition: RootFile.h:206
std::unique_ptr< DaqProvenanceHelper > daqProvenanceHelper_
Definition: RootFile.h:229
std::unique_ptr< MakeProvenanceReader > edm::RootFile::makeProvenanceReaderMaker ( InputType  inputType)
private

Definition at line 1821 of file RootFile.cc.

References fileFormatVersion_, eostools::move(), parentageIDLookup_, edm::FileFormatVersion::perEventProductIDs(), readEntryDescriptionTree(), readParentageTree(), edm::FileFormatVersion::splitProductIDs(), and edm::FileFormatVersion::storedProductProvenanceUsed().

Referenced by RootFile().

1821  {
1823  readParentageTree(inputType);
1824  return std::unique_ptr<MakeProvenanceReader>(new MakeReducedProvenanceReader(parentageIDLookup_));
1825  } else if(fileFormatVersion_.splitProductIDs()) {
1826  readParentageTree(inputType);
1827  return std::unique_ptr<MakeProvenanceReader>(new MakeFullProvenanceReader);
1828  } else if(fileFormatVersion_.perEventProductIDs()) {
1829  std::unique_ptr<EntryDescriptionMap> entryDescriptionMap(new EntryDescriptionMap);
1830  readEntryDescriptionTree(*entryDescriptionMap, inputType);
1831  return std::unique_ptr<MakeProvenanceReader>(new MakeOldProvenanceReader(std::move(entryDescriptionMap)));
1832  } else {
1833  return std::unique_ptr<MakeProvenanceReader>(new MakeDummyProvenanceReader);
1834  }
1835  }
void readEntryDescriptionTree(EntryDescriptionMap &entryDescriptionMap, InputType inputType)
Definition: RootFile.cc:526
FileFormatVersion fileFormatVersion_
Definition: RootFile.h:189
void readParentageTree(InputType inputType)
Definition: RootFile.cc:572
def move
Definition: eostools.py:508
bool storedProductProvenanceUsed() const
std::map< EntryDescriptionID, EventEntryDescription > EntryDescriptionMap
Definition: RootFile.h:49
bool perEventProductIDs() const
std::vector< ParentageID > parentageIDLookup_
Definition: RootFile.h:228
void edm::RootFile::markBranchToBeDropped ( bool  dropDescendants,
BranchID const &  branchID,
std::set< BranchID > &  branchesToDrop 
) const
private

Definition at line 1698 of file RootFile.cc.

References branchChildren_.

Referenced by dropOnInput().

1698  {
1699  if(dropDescendants) {
1700  branchChildren_->appendToDescendants(branchID, branchesToDrop);
1701  } else {
1702  branchesToDrop.insert(branchID);
1703  }
1704  }
std::shared_ptr< BranchChildren > branchChildren_
Definition: RootFile.h:223
bool edm::RootFile::modifiedIDs ( ) const
inline

Definition at line 119 of file RootFile.h.

References daqProvenanceHelper_.

Referenced by createFileBlock().

119 {return daqProvenanceHelper_.get() != 0;}
std::unique_ptr< DaqProvenanceHelper > daqProvenanceHelper_
Definition: RootFile.h:229
std::string const & edm::RootFile::newBranchToOldBranch ( std::string const &  newBranch) const
private

Definition at line 679 of file RootFile.cc.

References newBranchToOldBranch_.

Referenced by dropOnInput(), and RootFile().

679  {
680  std::map<std::string, std::string>::const_iterator it = newBranchToOldBranch_.find(newBranch);
681  if(it != newBranchToOldBranch_.end()) {
682  return it->second;
683  }
684  return newBranch;
685  }
std::map< std::string, std::string > newBranchToOldBranch_
Definition: RootFile.h:218
bool edm::RootFile::nextEventEntry ( )
inline

Definition at line 144 of file RootFile.h.

References eventTree_, and edm::RootTree::next().

144 {return eventTree_.next();}
bool next()
Definition: RootTree.h:87
RootTree eventTree_
Definition: RootFile.h:206
RootFile& edm::RootFile::operator= ( RootFile const &  )
delete
void edm::RootFile::overrideRunNumber ( RunID id)
private

Definition at line 1638 of file RootFile.cc.

References edm::RunID::firstValidRun(), forcedRunOffset_, and DTTTrigCorrFirst::run.

Referenced by readCurrentEvent(), readLuminosityBlockAuxiliary_(), and readRunAuxiliary_().

1638  {
1639  if(forcedRunOffset_ != 0) {
1640  id = RunID(id.run() + forcedRunOffset_);
1641  }
1642  if(id < RunID::firstValidRun()) id = RunID::firstValidRun();
1643  }
static RunID firstValidRun()
Definition: RunID.h:77
int forcedRunOffset_
Definition: RootFile.h:217
void edm::RootFile::overrideRunNumber ( LuminosityBlockID id)
private

Definition at line 1646 of file RootFile.cc.

References edm::RunID::firstValidRun(), forcedRunOffset_, and DTTTrigCorrFirst::run.

1646  {
1647  if(forcedRunOffset_ != 0) {
1648  id = LuminosityBlockID(id.run() + forcedRunOffset_, id.luminosityBlock());
1649  }
1650  if(RunID(id.run()) < RunID::firstValidRun()) id = LuminosityBlockID(RunID::firstValidRun().run(), id.luminosityBlock());
1651  }
static RunID firstValidRun()
Definition: RunID.h:77
int forcedRunOffset_
Definition: RootFile.h:217
void edm::RootFile::overrideRunNumber ( EventID id,
bool  isRealData 
)
private

Definition at line 1654 of file RootFile.cc.

References edm::errors::Configuration, event(), Exception, edm::LuminosityBlockID::firstValidLuminosityBlock(), edm::RunID::firstValidRun(), forcedRunOffset_, and DTTTrigCorrFirst::run.

1654  {
1655  if(forcedRunOffset_ != 0) {
1656  if(isRealData) {
1657  throw Exception(errors::Configuration, "RootFile::RootFile()")
1658  << "The 'setRunNumber' parameter of PoolSource cannot be used with real data.\n";
1659  }
1660  id = EventID(id.run() + forcedRunOffset_, id.luminosityBlock(), id.event());
1661  }
1662  if(RunID(id.run()) < RunID::firstValidRun()) {
1663  id = EventID(RunID::firstValidRun().run(), LuminosityBlockID::firstValidLuminosityBlock().luminosityBlock(), id.event());
1664  }
1665  }
static LuminosityBlockID firstValidLuminosityBlock()
static RunID firstValidRun()
Definition: RunID.h:77
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
int forcedRunOffset_
Definition: RootFile.h:217
std::shared_ptr<ProductRegistry const> edm::RootFile::productRegistry ( ) const
inline

Definition at line 105 of file RootFile.h.

References productRegistry_.

Referenced by RootFile().

105 {return productRegistry_;}
std::shared_ptr< ProductRegistry const > productRegistry_
Definition: RootFile.h:211
bool edm::RootFile::readCurrentEvent ( EventPrincipal cache)

Definition at line 1431 of file RootFile.cc.

References branchListIndexes_, edm::RootTree::current(), eventAux(), eventAux_, eventSelectionIDs_, eventTree_, fileFormatVersion(), filePtr_, fillEventHistory(), edm::EventPrincipal::fillEventPrincipal(), fillThisEventAuxiliary(), edm::EventAuxiliary::id(), edm::RootTree::insertEntryForIndex(), edm::EventAuxiliary::isRealData(), makeProductProvenanceRetriever(), eostools::move(), edm::EventAuxiliary::oldLuminosityBlock(), overrideRunNumber(), processHistoryRegistry_, edm::EventAuxiliary::resetObsoleteInfo(), edm::RootTree::rootDelayedReader(), edm::EventPrincipal::streamID(), edm::EDProductGetter::transitionIndex(), and edm::StreamID::value().

Referenced by readEvent().

1431  {
1432  if(!eventTree_.current()) {
1433  return false;
1434  }
1436  if(!fileFormatVersion().lumiInEventID()) {
1437  //ugly, but will disappear when the backward compatibility is done with schema evolution.
1438  const_cast<EventID&>(eventAux_.id()).setLuminosityBlockNumber(eventAux_.oldLuminosityBlock());
1440  }
1441  fillEventHistory();
1443 
1444  // We're not done ... so prepare the EventPrincipal
1445  eventTree_.insertEntryForIndex(principal.transitionIndex());
1446  principal.fillEventPrincipal(eventAux(),
1450  *(makeProductProvenanceRetriever(principal.streamID().value())),
1452 
1453  // report event read from file
1454  filePtr_->eventReadFromFile();
1455  return true;
1456  }
bool isRealData() const
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
bool current() const
Definition: RootTree.h:89
void insertEntryForIndex(unsigned int index)
Definition: RootTree.cc:98
EventAuxiliary const & eventAux() const
Definition: RootFile.h:107
EventSelectionIDVector eventSelectionIDs_
Definition: RootFile.h:220
def move
Definition: eostools.py:508
RootTree eventTree_
Definition: RootFile.h:206
BranchListIndexes branchListIndexes_
Definition: RootFile.h:221
LuminosityBlockNumber_t oldLuminosityBlock() const
std::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:187
DelayedReader * rootDelayedReader() const
Definition: RootTree.cc:116
void fillEventHistory()
Definition: RootFile.cc:1205
std::shared_ptr< ProductProvenanceRetriever > makeProductProvenanceRetriever(unsigned int iStreamIndex)
Definition: RootFile.cc:1838
EventID const & id() const
void overrideRunNumber(RunID &id)
Definition: RootFile.cc:1638
EventAuxiliary eventAux_
Definition: RootFile.h:205
void fillThisEventAuxiliary()
Definition: RootFile.cc:1176
ProcessHistoryRegistry * processHistoryRegistry_
Definition: RootFile.h:186
void edm::RootFile::readEntryDescriptionTree ( EntryDescriptionMap entryDescriptionMap,
InputType  inputType 
)
private

Definition at line 526 of file RootFile.cc.

References daqProvenanceHelper_, edm::poolNames::entryDescriptionBranchName(), edm::poolNames::entryDescriptionIDBranchName(), edm::poolNames::entryDescriptionTreeName(), edm::errors::EventCorruption, Exception, filePtr_, edm::errors::FileReadError, edm::roottree::getEntry(), i, edm::Parentage::id(), edm::EventEntryDescription::id(), edm::ParentageRegistry::insertMapped(), edm::ParentageRegistry::instance(), edm::numEntries(), parents, edm::EventEntryDescription::parents(), edm::Parentage::parentsForUpdate(), PhysicsTools::registry, edm::SecondarySource, and edm::Parentage::setParents().

Referenced by makeProvenanceReaderMaker().

526  {
527  // Called only for old format files.
528  // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
529  std::unique_ptr<TTree> entryDescriptionTree(dynamic_cast<TTree*>(filePtr_->Get(poolNames::entryDescriptionTreeName().c_str())));
530  if(nullptr == entryDescriptionTree.get()) {
531  throw Exception(errors::FileReadError) << "Could not find tree " << poolNames::entryDescriptionTreeName()
532  << " in the input file.\n";
533  }
534 
535  EntryDescriptionID idBuffer;
536  EntryDescriptionID* pidBuffer = &idBuffer;
537  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionIDBranchName().c_str(), &pidBuffer);
538 
539  EventEntryDescription entryDescriptionBuffer;
540  EventEntryDescription *pEntryDescriptionBuffer = &entryDescriptionBuffer;
541  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionBranchName().c_str(), &pEntryDescriptionBuffer);
542 
543  // Fill in the parentage registry.
544  ParentageRegistry& registry = *ParentageRegistry::instance();
545 
546  for(Long64_t i = 0, numEntries = entryDescriptionTree->GetEntries(); i < numEntries; ++i) {
547  roottree::getEntry(entryDescriptionTree.get(), i);
548  if(idBuffer != entryDescriptionBuffer.id()) {
549  throw Exception(errors::EventCorruption) << "Corruption of EntryDescription tree detected.\n";
550  }
551  entryDescriptionMap.insert(std::make_pair(entryDescriptionBuffer.id(),entryDescriptionBuffer));
552  Parentage parents;
553  parents.setParents(entryDescriptionBuffer.parents());
555  ParentageID const oldID = parents.id();
556  daqProvenanceHelper_->fixMetaData(parents.parentsForUpdate());
557  ParentageID newID = parents.id();
558  if(newID != oldID) {
559  daqProvenanceHelper_->setOldParentageIDToNew(oldID,newID);
560  }
561  }
562  // For thread safety, don't update global registries when a secondary source opens a file.
563  if(inputType != InputType::SecondarySource) {
564  registry.insertMapped(parents);
565  }
566  }
567  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionIDBranchName().c_str(), nullptr);
568  entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionBranchName().c_str(), nullptr);
569  }
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:477
int i
Definition: DBlmapReader.cc:9
TPRegexp parents
Definition: eve_filter.cc:24
std::string const & entryDescriptionBranchName()
Definition: BranchType.cc:154
Hash< EntryDescriptionType > EntryDescriptionID
std::string const & entryDescriptionTreeName()
Definition: BranchType.cc:146
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50
std::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:187
std::unique_ptr< DaqProvenanceHelper > daqProvenanceHelper_
Definition: RootFile.h:229
std::string const & entryDescriptionIDBranchName()
Definition: BranchType.cc:150
static Interceptor::Registry registry("Interceptor")
static ParentageRegistry * instance()
Hash< ParentageType > ParentageID
Definition: ParentageID.h:9
void edm::RootFile::readEvent ( EventPrincipal cache)

Definition at line 1408 of file RootFile.cc.

References assert(), daqProvenanceHelper_, edm::IndexIntoFile::IndexIntoFileItr::entry(), eventAux(), fileFormatVersion(), fillEventAuxiliary(), forcedRunOffset_, edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFile_, indexIntoFileEnd_, indexIntoFileIter_, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::IndexIntoFileItr::lumi(), edm::EventAuxiliary::processHistoryID(), edm::IndexIntoFile::processHistoryID(), edm::IndexIntoFile::IndexIntoFileItr::processHistoryIDIndex(), processHistoryRegistry_, readCurrentEvent(), edm::ProcessHistoryRegistry::reducedProcessHistoryID(), DTTTrigCorrFirst::run, edm::IndexIntoFile::IndexIntoFileItr::run(), and edm::FileFormatVersion::useReducedProcessHistoryID().

1408  {
1411  // read the event auxiliary if not alrady read.
1413 
1414  // read the event
1416 
1418  assert(eventAux().luminosityBlock() == indexIntoFileIter_.lumi());
1419 
1420  // If this next assert shows up in performance profiling or significantly affects memory, then these three lines should be deleted.
1421  // The IndexIntoFile should guarantee that it never fails.
1423  ProcessHistoryID const& reducedPHID = processHistoryRegistry_->reducedProcessHistoryID(idToCheck);
1425 
1427  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
assert(m_qm.get())
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
LuminosityBlockNumber_t lumi() const
bool readCurrentEvent(EventPrincipal &cache)
Definition: RootFile.cc:1431
bool fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1195
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
EventAuxiliary const & eventAux() const
Definition: RootFile.h:107
ProcessHistoryID const & reducedProcessHistoryID(ProcessHistoryID const &fullID) const
Hash< ProcessHistoryType > ProcessHistoryID
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:192
ProcessHistoryID const & processHistoryID(int i) const
ProcessHistoryID const & processHistoryID() const
std::unique_ptr< DaqProvenanceHelper > daqProvenanceHelper_
Definition: RootFile.h:229
bool useReducedProcessHistoryID() const
ProcessHistoryRegistry * processHistoryRegistry_
Definition: RootFile.h:186
int forcedRunOffset_
Definition: RootFile.h:217
void edm::RootFile::readEventHistoryTree ( )
private

Definition at line 1669 of file RootFile.cc.

References edm::errors::EventCorruption, eventHistoryTree_, edm::poolNames::eventHistoryTreeName(), Exception, fileFormatVersion(), filePtr_, and history_.

Referenced by RootFile().

1669  {
1670  // Read in the event history tree, if we have one...
1671  if(fileFormatVersion().eventHistoryTree()) {
1672  history_.reset(new History);
1673  eventHistoryTree_ = dynamic_cast<TTree*>(filePtr_->Get(poolNames::eventHistoryTreeName().c_str()));
1674  if(!eventHistoryTree_) {
1676  << "Failed to find the event history tree.\n";
1677  }
1678  }
1679  }
std::unique_ptr< History > history_
Definition: RootFile.h:222
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
std::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:187
std::string const & eventHistoryTreeName()
Definition: BranchType.cc:268
TTree * eventHistoryTree_
Definition: RootFile.h:219
void edm::RootFile::readLuminosityBlock_ ( LuminosityBlockPrincipal lumiPrincipal)

Definition at line 1583 of file RootFile.cc.

References assert(), edm::IndexIntoFile::IndexIntoFileItr::entry(), edm::LuminosityBlockPrincipal::fillLuminosityBlockPrincipal(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileEnd_, indexIntoFileIter_, edm::RootTree::insertEntryForIndex(), edm::RootTree::isValid(), edm::IndexIntoFile::kLumi, lumiTree_, processHistoryRegistry_, edm::LuminosityBlockPrincipal::readImmediate(), edm::RootTree::rootDelayedReader(), edm::RootTree::setEntryNumber(), and edm::EDProductGetter::transitionIndex().

1583  {
1586  // Begin code for backward compatibility before the existence of lumi trees.
1587  if(!lumiTree_.isValid()) {
1589  return;
1590  }
1591  // End code for backward compatibility before the existence of lumi trees.
1593  lumiTree_.insertEntryForIndex(lumiPrincipal.transitionIndex());
1594  lumiPrincipal.fillLuminosityBlockPrincipal(*processHistoryRegistry_, lumiTree_.rootDelayedReader());
1595  // Read in all the products now.
1596  lumiPrincipal.readImmediate();
1598  }
assert(m_qm.get())
RootTree lumiTree_
Definition: RootFile.h:207
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
void insertEntryForIndex(unsigned int index)
Definition: RootTree.cc:98
DelayedReader * rootDelayedReader() const
Definition: RootTree.cc:116
bool isValid() const
Definition: RootTree.cc:104
ProcessHistoryRegistry * processHistoryRegistry_
Definition: RootFile.h:186
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:190
std::shared_ptr< LuminosityBlockAuxiliary > edm::RootFile::readLuminosityBlockAuxiliary_ ( )

Definition at line 1545 of file RootFile.cc.

References assert(), edm::RootTree::current(), edm::IndexIntoFile::IndexIntoFileItr::entry(), eventAux(), eventTree_, fileFormatVersion(), filePtr_, fillEventAuxiliary(), fillLumiAuxiliary(), edm::IndexIntoFile::IndexIntoFileItr::firstEventEntryThisLumi(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileEnd_, indexIntoFileIter_, edm::IndexIntoFile::invalidEntry, edm::Timestamp::invalidTimestamp(), edm::RootTree::isValid(), edm::IndexIntoFile::kLumi, fjr2json::lumi, edm::IndexIntoFile::IndexIntoFileItr::lumi(), edm::LuminosityBlockID::luminosityBlock(), lumiTree_, overrideRunNumber(), edm::LuminosityBlockID::run(), edm::IndexIntoFile::IndexIntoFileItr::run(), savedRunAuxiliary_, edm::RootTree::setEntryNumber(), cond::rpcobgas::time, and edm::EventAuxiliary::time().

1545  {
1548  // Begin code for backward compatibility before the existence of lumi trees.
1549  if(!lumiTree_.isValid()) {
1551  assert(eventEntry != IndexIntoFile::invalidEntry);
1552  assert(eventTree_.current(eventEntry));
1553  fillEventAuxiliary(eventEntry);
1554 
1555  LuminosityBlockID lumi = LuminosityBlockID(indexIntoFileIter_.run(), indexIntoFileIter_.lumi());
1556  overrideRunNumber(lumi);
1557  return std::make_shared<LuminosityBlockAuxiliary>(lumi.run(), lumi.luminosityBlock(), eventAux().time(), Timestamp::invalidTimestamp());
1558  }
1559  // End code for backward compatibility before the existence of lumi trees.
1561  std::shared_ptr<LuminosityBlockAuxiliary> lumiAuxiliary = fillLumiAuxiliary();
1562  assert(lumiAuxiliary->run() == indexIntoFileIter_.run());
1563  assert(lumiAuxiliary->luminosityBlock() == indexIntoFileIter_.lumi());
1564  overrideRunNumber(lumiAuxiliary->id());
1565  filePtr_->reportInputLumiSection(lumiAuxiliary->run(), lumiAuxiliary->luminosityBlock());
1566  if(lumiAuxiliary->beginTime() == Timestamp::invalidTimestamp()) {
1568  if(eventEntry != IndexIntoFile::invalidEntry) {
1569  assert(eventTree_.current(eventEntry));
1570  fillEventAuxiliary(eventEntry);
1571 
1572  lumiAuxiliary->setBeginTime(eventAux().time());
1573  }
1574  lumiAuxiliary->setEndTime(Timestamp::invalidTimestamp());
1575  }
1576  if(!fileFormatVersion().processHistorySameWithinRun() && savedRunAuxiliary_) {
1577  lumiAuxiliary->setProcessHistoryID(savedRunAuxiliary_->processHistoryID());
1578  }
1579  return lumiAuxiliary;
1580  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
std::shared_ptr< LuminosityBlockAuxiliary > fillLumiAuxiliary()
Definition: RootFile.cc:1261
static Timestamp invalidTimestamp()
Definition: Timestamp.h:101
tuple lumi
Definition: fjr2json.py:35
assert(m_qm.get())
RootTree lumiTree_
Definition: RootFile.h:207
Timestamp const & time() const
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
bool current() const
Definition: RootTree.h:89
LuminosityBlockNumber_t lumi() const
long long EntryNumber_t
bool fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1195
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
EventAuxiliary const & eventAux() const
Definition: RootFile.h:107
RootTree eventTree_
Definition: RootFile.h:206
std::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:187
static EntryNumber_t const invalidEntry
bool isValid() const
Definition: RootTree.cc:104
EntryNumber_t firstEventEntryThisLumi() const
void overrideRunNumber(RunID &id)
Definition: RootFile.cc:1638
std::shared_ptr< RunAuxiliary > savedRunAuxiliary_
Definition: RootFile.h:199
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:190
void edm::RootFile::readParentageTree ( InputType  inputType)
private

Definition at line 572 of file RootFile.cc.

References daqProvenanceHelper_, Exception, filePtr_, edm::errors::FileReadError, edm::roottree::getEntry(), i, edm::Parentage::id(), edm::ParentageRegistry::insertMapped(), edm::ParentageRegistry::instance(), edm::numEntries(), edm::poolNames::parentageBranchName(), parentageIDLookup_, edm::poolNames::parentageTreeName(), parents, edm::Parentage::parentsForUpdate(), PhysicsTools::registry, and edm::SecondarySource.

Referenced by makeProvenanceReaderMaker().

572  {
573  // New format file
574  // We use a smart pointer so the tree will be deleted after use, and not kept for the life of the file.
575  std::unique_ptr<TTree> parentageTree(dynamic_cast<TTree*>(filePtr_->Get(poolNames::parentageTreeName().c_str())));
576  if(nullptr == parentageTree.get()) {
577  throw Exception(errors::FileReadError) << "Could not find tree " << poolNames::parentageTreeName()
578  << " in the input file.\n";
579  }
580 
581  Parentage parents;
582  Parentage *pParentageBuffer = &parents;
583  parentageTree->SetBranchAddress(poolNames::parentageBranchName().c_str(), &pParentageBuffer);
584 
585  ParentageRegistry& registry = *ParentageRegistry::instance();
586 
587  parentageIDLookup_.reserve(parentageTree->GetEntries());
588  for(Long64_t i = 0, numEntries = parentageTree->GetEntries(); i < numEntries; ++i) {
589  roottree::getEntry(parentageTree.get(), i);
591  ParentageID const oldID = parents.id();
592  daqProvenanceHelper_->fixMetaData(parents.parentsForUpdate());
593  ParentageID newID = parents.id();
594  if(newID != oldID) {
595  daqProvenanceHelper_->setOldParentageIDToNew(oldID,newID);
596  }
597  }
598  // For thread safety, don't update global registries when a secondary source opens a file.
599  if(inputType != InputType::SecondarySource) {
600  registry.insertMapped(parents);
601  }
602  parentageIDLookup_.push_back(parents.id());
603  }
604  parentageTree->SetBranchAddress(poolNames::parentageBranchName().c_str(), nullptr);
605  }
Int_t getEntry(TBranch *branch, EntryNumber entryNumber)
Definition: RootTree.cc:477
int i
Definition: DBlmapReader.cc:9
TPRegexp parents
Definition: eve_filter.cc:24
std::string const & parentageTreeName()
Definition: BranchType.cc:159
Long64_t numEntries(TFile *hdl, std::string const &trname)
Definition: CollUtil.cc:50
std::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:187
std::string const & parentageBranchName()
Definition: BranchType.cc:163
std::unique_ptr< DaqProvenanceHelper > daqProvenanceHelper_
Definition: RootFile.h:229
std::vector< ParentageID > parentageIDLookup_
Definition: RootFile.h:228
static Interceptor::Registry registry("Interceptor")
static ParentageRegistry * instance()
Hash< ParentageType > ParentageID
Definition: ParentageID.h:9
void edm::RootFile::readRun_ ( RunPrincipal runPrincipal)

Definition at line 1528 of file RootFile.cc.

References assert(), edm::RunPrincipal::fillRunPrincipal(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileEnd_, indexIntoFileIter_, edm::RootTree::insertEntryForIndex(), edm::RootTree::isValid(), edm::IndexIntoFile::kRun, processHistoryRegistry_, edm::RunPrincipal::readImmediate(), edm::RootTree::rootDelayedReader(), runTree_, and edm::EDProductGetter::transitionIndex().

1528  {
1531  // Begin code for backward compatibility before the existence of run trees.
1532  if(!runTree_.isValid()) {
1534  return;
1535  }
1536  // End code for backward compatibility before the existence of run trees.
1537  runTree_.insertEntryForIndex(runPrincipal.transitionIndex());
1538  runPrincipal.fillRunPrincipal(*processHistoryRegistry_, runTree_.rootDelayedReader());
1539  // Read in all the products now.
1540  runPrincipal.readImmediate();
1542  }
assert(m_qm.get())
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
void insertEntryForIndex(unsigned int index)
Definition: RootTree.cc:98
RootTree runTree_
Definition: RootFile.h:208
DelayedReader * rootDelayedReader() const
Definition: RootTree.cc:116
bool isValid() const
Definition: RootTree.cc:104
ProcessHistoryRegistry * processHistoryRegistry_
Definition: RootFile.h:186
std::shared_ptr< RunAuxiliary > edm::RootFile::readRunAuxiliary_ ( )

Definition at line 1464 of file RootFile.cc.

References assert(), edm::RootTree::current(), edm::IndexIntoFile::IndexIntoFileItr::entry(), eventAux(), eventTree_, fileFormatVersion(), filePtr_, fillEventAuxiliary(), fillEventHistory(), fillRunAuxiliary(), edm::IndexIntoFile::IndexIntoFileItr::firstEventEntryThisRun(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileEnd_, indexIntoFileIter_, edm::IndexIntoFile::invalidEntry, edm::Timestamp::invalidTimestamp(), edm::RootTree::isValid(), edm::IndexIntoFile::kRun, overrideRunNumber(), edm::FileFormatVersion::processHistorySameWithinRun(), edm::RunID::run(), DTTTrigCorrFirst::run, edm::IndexIntoFile::IndexIntoFileItr::run(), runTree_, savedRunAuxiliary_, edm::RootTree::setEntryNumber(), cond::rpcobgas::time, and edm::EventAuxiliary::time().

1464  {
1467 
1468  // Begin code for backward compatibility before the existence of run trees.
1469  if(!runTree_.isValid()) {
1470 
1471  // prior to the support of run trees.
1472  // RunAuxiliary did not contain a valid timestamp. Take it from the next event.
1474  assert(eventEntry != IndexIntoFile::invalidEntry);
1475  assert(eventTree_.current(eventEntry));
1476  fillEventAuxiliary(eventEntry);
1477 
1478  RunID run = RunID(indexIntoFileIter_.run());
1479  overrideRunNumber(run);
1480  return std::make_shared<RunAuxiliary>(run.run(), eventAux().time(), Timestamp::invalidTimestamp());
1481  }
1482  // End code for backward compatibility before the existence of run trees.
1484  std::shared_ptr<RunAuxiliary> runAuxiliary = fillRunAuxiliary();
1485  assert(runAuxiliary->run() == indexIntoFileIter_.run());
1486  overrideRunNumber(runAuxiliary->id());
1487  filePtr_->reportInputRunNumber(runAuxiliary->run());
1488  // If RunAuxiliary did not contain a valid begin timestamp, invalidate any end timestamp.
1489  if(runAuxiliary->beginTime() == Timestamp::invalidTimestamp()) {
1490  runAuxiliary->setEndTime(Timestamp::invalidTimestamp());
1491  }
1492 
1493  // If RunAuxiliary did not contain a valid timestamp, or if this an old format file from
1494  // when the Run's ProcessHistory included only processes where products were added to the Run itself,
1495  // we attempt to read the first event in the run to get appropriate info.
1496  if(runAuxiliary->beginTime() == Timestamp::invalidTimestamp() ||
1498 
1500  // If we have a valid event, use its information.
1501  if(eventEntry != IndexIntoFile::invalidEntry) {
1502  assert(eventTree_.current(eventEntry));
1503  fillEventAuxiliary(eventEntry);
1504 
1505  // RunAuxiliary did not contain a valid timestamp. Take it from the next event in this run if there is one.
1506  if(runAuxiliary->beginTime() == Timestamp::invalidTimestamp()) {
1507  runAuxiliary->setBeginTime(eventAux().time());
1508  }
1509 
1510  // For backwards compatibility when the Run's ProcessHistory included only processes where products were added to the
1511  // Run, and then the Run and Event auxiliaries could be different. Use the event ProcessHistoryID if there is one. It should
1512  // almost always be correct by the current definition (processes included if any products are added. This makes the run, lumi,
1513  // and event ProcessHistory's always be the same if no file merging occurs).
1514  if(!fileFormatVersion().processHistorySameWithinRun()) {
1515  fillEventHistory();
1516  runAuxiliary->setProcessHistoryID(eventAux().processHistoryID());
1517  savedRunAuxiliary_ = runAuxiliary;
1518  }
1519  } else {
1520  // No valid event, just use what is there, because it is the best we can do.
1521  savedRunAuxiliary_ = runAuxiliary;
1522  }
1523  }
1524  return runAuxiliary;
1525  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
static Timestamp invalidTimestamp()
Definition: Timestamp.h:101
EntryNumber_t firstEventEntryThisRun() const
assert(m_qm.get())
Timestamp const & time() const
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
bool current() const
Definition: RootTree.h:89
long long EntryNumber_t
bool fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1195
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
EventAuxiliary const & eventAux() const
Definition: RootFile.h:107
std::shared_ptr< RunAuxiliary > fillRunAuxiliary()
Definition: RootFile.cc:1285
RootTree eventTree_
Definition: RootFile.h:206
std::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:187
RootTree runTree_
Definition: RootFile.h:208
static EntryNumber_t const invalidEntry
bool processHistorySameWithinRun() const
void fillEventHistory()
Definition: RootFile.cc:1205
bool isValid() const
Definition: RootTree.cc:104
void overrideRunNumber(RunID &id)
Definition: RootFile.cc:1638
std::shared_ptr< RunAuxiliary > savedRunAuxiliary_
Definition: RootFile.h:199
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:190
void edm::RootFile::reportOpened ( std::string const &  inputType)

Definition at line 1150 of file RootFile.cc.

References edm::RootTree::branchNames(), eventTree_, edm::FileID::fid(), fid_, filePtr_, diffTwoXMLs::label, logicalFile_, edm::moduleName(), and AlCaHLTBitMon_QueryRunRegistry::string.

1150  {
1151  // Report file opened.
1152  std::string const label = "source";
1153  std::string moduleName = "PoolSource";
1154  filePtr_->inputFileOpened(
1155  logicalFile_,
1156  inputType,
1157  moduleName,
1158  label,
1159  fid_.fid(),
1161  }
std::vector< std::string > const & branchNames() const
Definition: RootTree.h:99
FileID fid_
Definition: RootFile.h:190
std::string const logicalFile_
Definition: RootFile.h:184
std::string moduleName(Provenance const &provenance)
Definition: Provenance.cc:27
std::string const & fid() const
Definition: FileID.h:19
RootTree eventTree_
Definition: RootFile.h:206
std::shared_ptr< InputFile > filePtr_
Definition: RootFile.h:187
void edm::RootFile::rewind ( )
inline

Definition at line 131 of file RootFile.h.

References eventTree_, indexIntoFileBegin_, indexIntoFileIter_, lumiTree_, edm::RootTree::rewind(), and runTree_.

131  {
133  eventTree_.rewind();
134  lumiTree_.rewind();
135  runTree_.rewind();
136  }
RootTree lumiTree_
Definition: RootFile.h:207
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
RootTree eventTree_
Definition: RootFile.h:206
RootTree runTree_
Definition: RootFile.h:208
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
Definition: RootFile.h:194
void rewind()
Definition: RootTree.h:91
RootTree const& edm::RootFile::runTree ( ) const
inline

Definition at line 114 of file RootFile.h.

References runTree_.

Referenced by validateFile().

114 {return runTree_;}
RootTree runTree_
Definition: RootFile.h:208
void edm::RootFile::setAtEventEntry ( IndexIntoFile::EntryNumber_t  entry)

Definition at line 1459 of file RootFile.cc.

References eventTree_, and edm::RootTree::setEntryNumber().

1459  {
1460  eventTree_.setEntryNumber(entry);
1461  }
RootTree eventTree_
Definition: RootFile.h:206
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:190
bool edm::RootFile::setEntryAtEvent ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
)

Definition at line 1601 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), eventTree_, edm::IndexIntoFile::findEventPosition(), indexIntoFile_, indexIntoFileEnd_, indexIntoFileIter_, and edm::RootTree::setEntryNumber().

Referenced by setEntryAtItem().

1601  {
1603  if(indexIntoFileIter_ == indexIntoFileEnd_) return false;
1605  return true;
1606  }
tuple lumi
Definition: fjr2json.py:35
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
RootTree eventTree_
Definition: RootFile.h:206
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 & indexIntoFile_
Definition: RootFile.h:192
IndexIntoFileItr findEventPosition(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:190
bool edm::RootFile::setEntryAtItem ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi,
EventNumber_t  event 
)
inline

Definition at line 121 of file RootFile.h.

References setEntryAtEvent(), setEntryAtLumi(), and setEntryAtRun().

121  {
123  }
tuple lumi
Definition: fjr2json.py:35
bool setEntryAtRun(RunNumber_t run)
Definition: RootFile.cc:1617
bool setEntryAtLumi(RunNumber_t run, LuminosityBlockNumber_t lumi)
Definition: RootFile.cc:1609
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
bool setEntryAtEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
Definition: RootFile.cc:1601
bool edm::RootFile::setEntryAtLumi ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
)

Definition at line 1609 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), edm::IndexIntoFile::findLumiPosition(), indexIntoFile_, indexIntoFileEnd_, indexIntoFileIter_, lumiTree_, and edm::RootTree::setEntryNumber().

Referenced by setEntryAtItem().

1609  {
1611  if(indexIntoFileIter_ == indexIntoFileEnd_) return false;
1613  return true;
1614  }
tuple lumi
Definition: fjr2json.py:35
RootTree lumiTree_
Definition: RootFile.h:207
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:192
IndexIntoFileItr findLumiPosition(RunNumber_t run, LuminosityBlockNumber_t lumi) const
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:190
bool edm::RootFile::setEntryAtNextEventInLumi ( RunNumber_t  run,
LuminosityBlockNumber_t  lumi 
)

Definition at line 1625 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::advanceToEvent(), edm::IndexIntoFile::IndexIntoFileItr::entry(), fillEventAuxiliary(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileIter_, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::IndexIntoFileItr::lumi(), and edm::IndexIntoFile::IndexIntoFileItr::run().

1625  {
1628  }
1631  if(run != indexIntoFileIter_.run()) return false;
1632  if(lumi != indexIntoFileIter_.lumi()) return false;
1634  return true;
1635  }
tuple lumi
Definition: fjr2json.py:35
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
LuminosityBlockNumber_t lumi() const
bool fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1195
bool edm::RootFile::setEntryAtRun ( RunNumber_t  run)

Definition at line 1617 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), edm::IndexIntoFile::findRunPosition(), indexIntoFile_, indexIntoFileEnd_, indexIntoFileIter_, runTree_, and edm::RootTree::setEntryNumber().

Referenced by setEntryAtItem().

1617  {
1619  if(indexIntoFileIter_ == indexIntoFileEnd_) return false;
1621  return true;
1622  }
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
IndexIntoFileItr findRunPosition(RunNumber_t run) const
Same as findPosition.
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:192
RootTree runTree_
Definition: RootFile.h:208
void setEntryNumber(EntryNumber theEntryNumber)
Definition: RootTree.cc:190
void edm::RootFile::setIfFastClonable ( int  remainingEvents,
int  remainingLumis 
)
private

Definition at line 608 of file RootFile.cc.

References duplicateChecker_, edm::FileBlock::DuplicateEventsRemoved, edm::RootTree::entries(), edm::FileBlock::EventsToBeSorted, eventTree_, fileFormatVersion(), edm::FileBlock::FileTooOld, edm::IndexIntoFile::firstAppearanceOrder, edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFile_, indexIntoFileBegin_, indexIntoFileEnd_, edm::FileBlock::InitialEventsSkipped, edm::IndexIntoFile::iterationWillBeInEntryOrder(), edm::IndexIntoFile::kEvent, lumiTree_, edm::FileBlock::MaxEventsTooSmall, edm::FileBlock::MaxLumisTooSmall, edm::FileBlock::NoEventsInFile, noEventSort_, edm::FileBlock::NotProcessingEvents, edm::IndexIntoFile::numericalOrder, processingMode_, edm::FileBlock::RunOrLumiNotContiguous, edm::InputSource::RunsLumisAndEvents, skipAnyEvents_, and whyNotFastClonable_.

Referenced by RootFile().

608  {
609  if(fileFormatVersion().noMetaDataTrees() and !fileFormatVersion().storedProductProvenanceUsed()) {
610  //we must avoid copying the old branch which stored the per product per event provenance
612  return;
613  }
614  if(!fileFormatVersion().splitProductIDs()) {
616  return;
617  }
620  return;
621  }
622  // Find entry for first event in file
623  IndexIntoFile::IndexIntoFileItr it = indexIntoFileBegin_;
624  while(it != indexIntoFileEnd_ && it.getEntryType() != IndexIntoFile::kEvent) {
625  ++it;
626  }
627  if(it == indexIntoFileEnd_) {
629  return;
630  }
631 
632  // From here on, record all reasons we can't fast clone.
636  }
637  if(skipAnyEvents_) {
639  }
640  if(remainingEvents >= 0 && eventTree_.entries() > remainingEvents) {
642  }
643  if(remainingLumis >= 0 && lumiTree_.entries() > remainingLumis) {
645  }
646  // We no longer fast copy the EventAuxiliary branch, so there
647  // is no longer any need to disable fast copying because the run
648  // number is being modified. Also, this check did not work anyway
649  // because this function is called before forcedRunOffset_ is set.
650 
651  // if(forcedRunOffset_ != 0) {
652  // whyNotFastClonable_ += FileBlock::RunNumberModified;
653  // }
654  if(duplicateChecker_ &&
655  !duplicateChecker_->checkDisabled() &&
656  !duplicateChecker_->noDuplicatesInFile()) {
658  }
659  }
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
int whyNotFastClonable_
Definition: RootFile.h:202
RootTree lumiTree_
Definition: RootFile.h:207
EntryNumber const & entries() const
Definition: RootTree.h:96
InputSource::ProcessingMode processingMode_
Definition: RootFile.h:216
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
bool noEventSort_
Definition: RootFile.h:201
bool skipAnyEvents_
Definition: RootFile.h:200
RootTree eventTree_
Definition: RootFile.h:206
bool iterationWillBeInEntryOrder(SortOrder sortOrder) const
Used to determine whether or not to disable fast cloning.
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:192
IndexIntoFile::IndexIntoFileItr indexIntoFileBegin_
Definition: RootFile.h:194
std::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:224
void edm::RootFile::setPosition ( IndexIntoFile::IndexIntoFileItr const &  position)

Definition at line 693 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::copyPosition(), and indexIntoFileIter_.

693  {
695  }
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
void copyPosition(IndexIntoFileItr const &position)
Copy the position without modifying the pointer to the IndexIntoFile or size.
static int position[264][3]
Definition: ReadPGInfo.cc:509
void edm::RootFile::setToLastEntry ( )
inline

Definition at line 137 of file RootFile.h.

References indexIntoFileEnd_, and indexIntoFileIter_.

137  {
139  }
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
bool edm::RootFile::skipEntries ( unsigned int &  offset)
inline

Definition at line 141 of file RootFile.h.

References eventTree_, and edm::RootTree::skipEntries().

141 {return eventTree_.skipEntries(offset);}
RootTree eventTree_
Definition: RootFile.h:206
bool skipEntries(unsigned int &offset)
Definition: RootTree.cc:372
bool edm::RootFile::skipEvents ( int &  offset)

Definition at line 1306 of file RootFile.cc.

References duplicateChecker_, edm::EventID::event(), eventAux_, eventSkipperByID_, file_, fillEventAuxiliary(), edm::EventAuxiliary::id(), indexIntoFileEnd_, indexIntoFileIter_, edm::IndexIntoFile::invalidEntry, edm::IndexIntoFile::invalidIndex, edm::IndexIntoFile::invalidLumi, edm::IndexIntoFile::invalidRun, hltrates_dqm_sourceclient-live_cfg::offset, edm::IndexIntoFile::IndexIntoFileItr::skipEventBackward(), and edm::IndexIntoFile::IndexIntoFileItr::skipEventForward().

1306  {
1307  while(offset > 0 && indexIntoFileIter_ != indexIntoFileEnd_) {
1308 
1309  int phIndexOfSkippedEvent = IndexIntoFile::invalidIndex;
1310  RunNumber_t runOfSkippedEvent = IndexIntoFile::invalidRun;
1313 
1314  indexIntoFileIter_.skipEventForward(phIndexOfSkippedEvent,
1315  runOfSkippedEvent,
1316  lumiOfSkippedEvent,
1317  skippedEventEntry);
1318 
1319  // At the end of the file and there were no more events to skip
1320  if(skippedEventEntry == IndexIntoFile::invalidEntry) break;
1321 
1322  if(eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
1323  fillEventAuxiliary(skippedEventEntry);
1324  if(eventSkipperByID_->skipIt(runOfSkippedEvent, lumiOfSkippedEvent, eventAux_.id().event())) {
1325  continue;
1326  }
1327  }
1328  if(duplicateChecker_ &&
1329  !duplicateChecker_->checkDisabled() &&
1330  !duplicateChecker_->noDuplicatesInFile()) {
1331 
1332  fillEventAuxiliary(skippedEventEntry);
1333  if(duplicateChecker_->isDuplicateAndCheckActive(phIndexOfSkippedEvent,
1334  runOfSkippedEvent,
1335  lumiOfSkippedEvent,
1336  eventAux_.id().event(),
1337  file_)) {
1338  continue;
1339  }
1340  }
1341  --offset;
1342  }
1343 
1344  while(offset < 0) {
1345 
1346  if(duplicateChecker_) {
1347  duplicateChecker_->disable();
1348  }
1349 
1350  int phIndexOfEvent = IndexIntoFile::invalidIndex;
1354 
1355  indexIntoFileIter_.skipEventBackward(phIndexOfEvent,
1356  runOfEvent,
1357  lumiOfEvent,
1358  eventEntry);
1359 
1360  if(eventEntry == IndexIntoFile::invalidEntry) break;
1361 
1362  if(eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
1363  fillEventAuxiliary(eventEntry);
1364  if(eventSkipperByID_->skipIt(runOfEvent, lumiOfEvent, eventAux_.id().event())) {
1365  continue;
1366  }
1367  }
1368  ++offset;
1369  }
1371  }
EventNumber_t event() const
Definition: EventID.h:41
static int const invalidIndex
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
unsigned int LuminosityBlockNumber_t
long long EntryNumber_t
bool fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1195
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
static RunNumber_t const invalidRun
void skipEventBackward(int &phIndexOfEvent, RunNumber_t &runOfEvent, LuminosityBlockNumber_t &lumiOfEvent, EntryNumber_t &eventEntry)
std::shared_ptr< EventSkipperByID > eventSkipperByID_
Definition: RootFile.h:188
static EntryNumber_t const invalidEntry
static LuminosityBlockNumber_t const invalidLumi
EventID const & id() const
std::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:224
unsigned int RunNumber_t
EventAuxiliary eventAux_
Definition: RootFile.h:205
std::string const file_
Definition: RootFile.h:183
void skipEventForward(int &phIndexOfSkippedEvent, RunNumber_t &runOfSkippedEvent, LuminosityBlockNumber_t &lumiOfSkippedEvent, EntryNumber_t &skippedEventEntry)
bool edm::RootFile::skipThisEntry ( )
private

Definition at line 703 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::entry(), edm::EventID::event(), eventAux_, eventSkipperByID_, fillEventAuxiliary(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), edm::EventAuxiliary::id(), indexIntoFileEnd_, indexIntoFileIter_, edm::IndexIntoFile::invalidLumi, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::kRun, edm::IndexIntoFile::IndexIntoFileItr::lumi(), edm::IndexIntoFile::IndexIntoFileItr::peekAheadAtLumi(), edm::IndexIntoFile::IndexIntoFileItr::run(), and edm::IndexIntoFile::IndexIntoFileItr::skipLumiInRun().

Referenced by getNextItemType().

703  {
705  return false;
706  }
707  if(eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) {
708 
709  // See first if the entire lumi or run is skipped, so we won't have to read the event Auxiliary in that case.
711  return true;
712  }
713 
714  // The Lumi is not skipped. If this is an event, see if the event is skipped.
719  eventAux_.id().event())) {
720  return true;
721  }
722  }
723 
724  // Skip runs with no lumis if either lumisToSkip or lumisToProcess have been set to select lumis
726  eventSkipperByID_->skippingLumis()) {
727  IndexIntoFile::IndexIntoFileItr iterLumi = indexIntoFileIter_;
728 
729  // There are no lumis in this run, not even ones we will skip
730  if(iterLumi.peekAheadAtLumi() == IndexIntoFile::invalidLumi) {
731  return true;
732  }
733  // If we get here there are lumis in the run, check to see if we are skipping all of them
734  do {
735  if(!eventSkipperByID_->skipIt(iterLumi.run(), iterLumi.peekAheadAtLumi(), 0U)) {
736  return false;
737  }
738  }
739  while(iterLumi.skipLumiInRun());
740  return true;
741  }
742  }
743  return false;
744  }
EventNumber_t event() const
Definition: EventID.h:41
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
LuminosityBlockNumber_t lumi() const
bool fillEventAuxiliary(IndexIntoFile::EntryNumber_t entry)
Definition: RootFile.cc:1195
IndexIntoFile::IndexIntoFileItr indexIntoFileEnd_
Definition: RootFile.h:195
std::shared_ptr< EventSkipperByID > eventSkipperByID_
Definition: RootFile.h:188
static LuminosityBlockNumber_t const invalidLumi
EventID const & id() const
EventAuxiliary eventAux_
Definition: RootFile.h:205
RootTreePtrArray& edm::RootFile::treePointers ( )
inlineprivate

Definition at line 156 of file RootFile.h.

References treePointers_.

156 {return treePointers_;}
RootTreePtrArray treePointers_
Definition: RootFile.h:209
void edm::RootFile::validateFile ( InputType  inputType,
bool  usingGoToEvent 
)
private

Definition at line 1103 of file RootFile.cc.

References assert(), edm::createGlobalIdentifier(), daqProvenanceHelper_, duplicateChecker_, edm::IndexIntoFile::empty(), edm::RootTree::entries(), python.tagInventory::entries, edm::errors::EventCorruption, eventTree_, Exception, fid_, fileFormatVersion(), edm::IndexIntoFile::fillEventNumbersOrEntries(), fillIndexIntoFile(), edm::IndexIntoFile::fixIndexes(), indexIntoFile_, edm::FileID::isValid(), edm::RootTree::isValid(), noEventSort_, orderedProcessHistoryIDs_, edm::Primary, processHistoryRegistry_, edm::IndexIntoFile::reduceProcessHistoryIDs(), runTree(), edm::IndexIntoFile::setEventFinder(), edm::IndexIntoFile::setNumberOfEvents(), edm::IndexIntoFile::setProcessHistoryIDs(), and edm::FileFormatVersion::useReducedProcessHistoryID().

Referenced by RootFile().

1103  {
1104  if(!fid_.isValid()) {
1105  fid_ = FileID(createGlobalIdentifier());
1106  }
1107  if(!eventTree_.isValid()) {
1109  "'Events' tree is corrupted or not present\n" << "in the input file.\n";
1110  }
1111 
1112  if(fileFormatVersion().hasIndexIntoFile()) {
1113  if(runTree().entries() > 0) {
1115  }
1117  if(daqProvenanceHelper_) {
1118  std::vector<ProcessHistoryID>& phidVec = indexIntoFile_.setProcessHistoryIDs();
1119  for(auto& phid : phidVec) {
1120  phid = daqProvenanceHelper_->mapProcessHistoryID(phid);
1121  }
1122  }
1124  }
1125  }
1126  else {
1129  }
1130 
1133  indexIntoFile_.setEventFinder(std::shared_ptr<IndexIntoFile::EventFinder>(std::make_shared<RootFileEventFinder>(eventTree_)));
1134  // We fill the event numbers explicitly if we need to find events in closed files,
1135  // such as for secondary files (or secondary sources) or if duplicate checking across files.
1136  bool needEventNumbers = false;
1137  bool needIndexesForDuplicateChecker = duplicateChecker_ && duplicateChecker_->checkingAllFiles() && !duplicateChecker_->checkDisabled();
1138  if(inputType != InputType::Primary || needIndexesForDuplicateChecker || usingGoToEvent) {
1139  needEventNumbers = true;
1140  }
1141  bool needEventEntries = false;
1142  if(inputType != InputType::Primary || !noEventSort_) {
1143  // We need event entries for sorting or for secondary files or sources.
1144  needEventEntries = true;
1145  }
1146  indexIntoFile_.fillEventNumbersOrEntries(needEventNumbers, needEventEntries);
1147  }
void fillEventNumbersOrEntries(bool needEventNumbers, bool needEventEntries) const
void setEventFinder(std::shared_ptr< EventFinder > ptr) const
FileFormatVersion fileFormatVersion() const
Definition: RootFile.h:115
bool empty() const
True if no runs, lumis, or events are in the file.
assert(m_qm.get())
EntryNumber const & entries() const
Definition: RootTree.h:96
void reduceProcessHistoryIDs(ProcessHistoryRegistry const &processHistoryRegistry)
FileID fid_
Definition: RootFile.h:190
std::vector< ProcessHistoryID > & setProcessHistoryIDs()
bool noEventSort_
Definition: RootFile.h:201
RootTree const & runTree() const
Definition: RootFile.h:114
RootTree eventTree_
Definition: RootFile.h:206
bool isValid() const
Definition: FileID.h:18
IndexIntoFile & indexIntoFile_
Definition: RootFile.h:192
void fixIndexes(std::vector< ProcessHistoryID > &processHistoryIDs)
bool isValid() const
Definition: RootTree.cc:104
std::unique_ptr< DaqProvenanceHelper > daqProvenanceHelper_
Definition: RootFile.h:229
void fillIndexIntoFile()
Definition: RootFile.cc:877
std::shared_ptr< DuplicateChecker > duplicateChecker_
Definition: RootFile.h:224
std::vector< ProcessHistoryID > & orderedProcessHistoryIDs_
Definition: RootFile.h:193
void setNumberOfEvents(EntryNumber_t nevents) const
bool useReducedProcessHistoryID() const
ProcessHistoryRegistry * processHistoryRegistry_
Definition: RootFile.h:186
std::string createGlobalIdentifier()
bool edm::RootFile::wasFirstEventJustRead ( ) const

Definition at line 815 of file RootFile.cc.

References indexIntoFileIter_, edm::IndexIntoFile::invalidEntry, fjr2json::lumi, DTTTrigCorrFirst::run, and edm::IndexIntoFile::IndexIntoFileItr::skipEventBackward().

815  {
816  IndexIntoFile::IndexIntoFileItr itr(indexIntoFileIter_);
817  int phIndex;
820  IndexIntoFile::EntryNumber_t eventEntry;
821  itr.skipEventBackward(phIndex,
822  run,
823  lumi,
824  eventEntry);
825  itr.skipEventBackward(phIndex,
826  run,
827  lumi,
828  eventEntry);
829  return eventEntry == IndexIntoFile::invalidEntry;
830  }
tuple lumi
Definition: fjr2json.py:35
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
unsigned int LuminosityBlockNumber_t
long long EntryNumber_t
static EntryNumber_t const invalidEntry
unsigned int RunNumber_t
bool edm::RootFile::wasLastEventJustRead ( ) const

Definition at line 808 of file RootFile.cc.

References edm::IndexIntoFile::IndexIntoFileItr::advanceToEvent(), edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileIter_, and edm::IndexIntoFile::kEnd.

808  {
809  IndexIntoFile::IndexIntoFileItr itr(indexIntoFileIter_);
810  itr.advanceToEvent();
811  return itr.getEntryType() == IndexIntoFile::kEnd;
812  }
IndexIntoFile::IndexIntoFileItr indexIntoFileIter_
Definition: RootFile.h:196
int edm::RootFile::whyNotFastClonable ( ) const
inline

Definition at line 116 of file RootFile.h.

References whyNotFastClonable_.

Referenced by createFileBlock().

116 {return whyNotFastClonable_;}
int whyNotFastClonable_
Definition: RootFile.h:202

Member Data Documentation

std::shared_ptr<BranchChildren> edm::RootFile::branchChildren_
private

Definition at line 223 of file RootFile.h.

Referenced by createFileBlock(), markBranchToBeDropped(), and RootFile().

std::shared_ptr<BranchIDListHelper> edm::RootFile::branchIDListHelper_
private

Definition at line 213 of file RootFile.h.

Referenced by branchIDListHelper(), fillEventHistory(), and RootFile().

std::shared_ptr<BranchIDLists const> edm::RootFile::branchIDLists_
private

Definition at line 212 of file RootFile.h.

Referenced by RootFile().

BranchListIndexes edm::RootFile::branchListIndexes_
private

Definition at line 221 of file RootFile.h.

Referenced by fillEventHistory(), and readCurrentEvent().

bool edm::RootFile::branchListIndexesUnchanged_
private

Definition at line 204 of file RootFile.h.

Referenced by branchListIndexesUnchanged(), and RootFile().

std::unique_ptr<DaqProvenanceHelper> edm::RootFile::daqProvenanceHelper_
private
std::shared_ptr<DuplicateChecker> edm::RootFile::duplicateChecker_
private
TClass* edm::RootFile::edProductClass_
private

Definition at line 230 of file RootFile.h.

Referenced by dropOnInput().

EventAuxiliary edm::RootFile::eventAux_
private
TTree* edm::RootFile::eventHistoryTree_
private

Definition at line 219 of file RootFile.h.

Referenced by close(), fillEventHistory(), and readEventHistoryTree().

std::vector<EventProcessHistoryID> edm::RootFile::eventProcessHistoryIDs_
private

Definition at line 197 of file RootFile.h.

Referenced by fillEventHistory(), and RootFile().

std::vector<EventProcessHistoryID>::const_iterator edm::RootFile::eventProcessHistoryIter_
private

Definition at line 198 of file RootFile.h.

Referenced by fillEventHistory(), and RootFile().

std::vector<std::shared_ptr<ProductProvenanceRetriever> > edm::RootFile::eventProductProvenanceRetrievers_
mutableprivate

Definition at line 227 of file RootFile.h.

Referenced by makeProductProvenanceRetriever().

EventSelectionIDVector edm::RootFile::eventSelectionIDs_
private

Definition at line 220 of file RootFile.h.

Referenced by fillEventHistory(), and readCurrentEvent().

std::shared_ptr<EventSkipperByID> edm::RootFile::eventSkipperByID_
private

Definition at line 188 of file RootFile.h.

Referenced by RootFile(), skipEvents(), and skipThisEntry().

RootTree edm::RootFile::eventTree_
private
FileID edm::RootFile::fid_
private

Definition at line 190 of file RootFile.h.

Referenced by reportOpened(), RootFile(), and validateFile().

std::string const edm::RootFile::file_
private

Definition at line 183 of file RootFile.h.

Referenced by createFileBlock(), dropOnInput(), file(), isDuplicateEvent(), and skipEvents().

FileFormatVersion edm::RootFile::fileFormatVersion_
private

Definition at line 189 of file RootFile.h.

Referenced by fileFormatVersion(), makeProvenanceReaderMaker(), and RootFile().

std::shared_ptr<InputFile> edm::RootFile::filePtr_
private
std::unique_ptr<ThinnedAssociationsHelper> edm::RootFile::fileThinnedAssociationsHelper_
private

Definition at line 214 of file RootFile.h.

Referenced by dropOnInput(), initAssociationsFromSecondary(), and RootFile().

int edm::RootFile::forcedRunOffset_
private

Definition at line 217 of file RootFile.h.

Referenced by overrideRunNumber(), readEvent(), and RootFile().

std::array<bool, NumBranchTypes> edm::RootFile::hasNewlyDroppedBranch_
private

Definition at line 203 of file RootFile.h.

Referenced by dropOnInput(), hasNewlyDroppedBranch(), and RootFile().

std::unique_ptr<History> edm::RootFile::history_
private

Definition at line 222 of file RootFile.h.

Referenced by fillEventHistory(), and readEventHistoryTree().

IndexIntoFile& edm::RootFile::indexIntoFile_
private
IndexIntoFile::IndexIntoFileItr edm::RootFile::indexIntoFileBegin_
private

Definition at line 194 of file RootFile.h.

Referenced by rewind(), RootFile(), and setIfFastClonable().

IndexIntoFile::IndexIntoFileItr edm::RootFile::indexIntoFileEnd_
private
IndexIntoFile::IndexIntoFileItr edm::RootFile::indexIntoFileIter_
private
std::shared_ptr<IndexIntoFile> edm::RootFile::indexIntoFileSharedPtr_
private

Definition at line 191 of file RootFile.h.

Referenced by indexIntoFileSharedPtr().

IndexIntoFile::EntryNumber_t edm::RootFile::lastEventEntryNumberRead_
private

Definition at line 210 of file RootFile.h.

Referenced by fillIndexIntoFile(), and fillThisEventAuxiliary().

std::string const edm::RootFile::logicalFile_
private

Definition at line 184 of file RootFile.h.

Referenced by reportOpened().

RootTree edm::RootFile::lumiTree_
private
std::map<std::string, std::string> edm::RootFile::newBranchToOldBranch_
private

Definition at line 218 of file RootFile.h.

Referenced by newBranchToOldBranch(), and RootFile().

bool edm::RootFile::noEventSort_
private

Definition at line 201 of file RootFile.h.

Referenced by goToEvent(), setIfFastClonable(), and validateFile().

std::vector<ProcessHistoryID>& edm::RootFile::orderedProcessHistoryIDs_
private

Definition at line 193 of file RootFile.h.

Referenced by validateFile().

std::vector<ParentageID> edm::RootFile::parentageIDLookup_
private

Definition at line 228 of file RootFile.h.

Referenced by makeProvenanceReaderMaker(), and readParentageTree().

ProcessConfiguration const& edm::RootFile::processConfiguration_
private

Definition at line 185 of file RootFile.h.

ProcessHistoryRegistry* edm::RootFile::processHistoryRegistry_
private
InputSource::ProcessingMode edm::RootFile::processingMode_
private

Definition at line 216 of file RootFile.h.

Referenced by getNextItemType(), and setIfFastClonable().

std::shared_ptr<ProductRegistry const> edm::RootFile::productRegistry_
private

Definition at line 211 of file RootFile.h.

Referenced by productRegistry(), and RootFile().

std::unique_ptr<ProvenanceAdaptor> edm::RootFile::provenanceAdaptor_
private

Definition at line 225 of file RootFile.h.

Referenced by fillEventHistory(), fillLumiAuxiliary(), fillRunAuxiliary(), and RootFile().

std::unique_ptr<MakeProvenanceReader> edm::RootFile::provenanceReaderMaker_
private

Definition at line 226 of file RootFile.h.

Referenced by makeProductProvenanceRetriever(), and RootFile().

RootTree edm::RootFile::runTree_
private
std::shared_ptr<RunAuxiliary> edm::RootFile::savedRunAuxiliary_
private

Definition at line 199 of file RootFile.h.

Referenced by readLuminosityBlockAuxiliary_(), and readRunAuxiliary_().

bool edm::RootFile::skipAnyEvents_
private

Definition at line 200 of file RootFile.h.

Referenced by setIfFastClonable().

std::shared_ptr<ThinnedAssociationsHelper> edm::RootFile::thinnedAssociationsHelper_
private

Definition at line 215 of file RootFile.h.

Referenced by initAssociationsFromSecondary().

RootTreePtrArray edm::RootFile::treePointers_
private

Definition at line 209 of file RootFile.h.

Referenced by close(), dropOnInput(), RootFile(), and treePointers().

int edm::RootFile::whyNotFastClonable_
private

Definition at line 202 of file RootFile.h.

Referenced by RootFile(), setIfFastClonable(), and whyNotFastClonable().