#include <RootFile.h>
Definition at line 44 of file RootFile.h.
typedef boost::array<RootTree*, NumBranchTypes> edm::RootFile::RootTreePtrArray |
Definition at line 46 of file RootFile.h.
edm::RootFile::RootFile | ( | std::string const & | fileName, |
ProcessConfiguration const & | processConfiguration, | ||
std::string const & | logicalFileName, | ||
boost::shared_ptr< InputFile > | filePtr, | ||
boost::shared_ptr< EventSkipperByID > | eventSkipperByID, | ||
bool | skipAnyEvents, | ||
int | remainingEvents, | ||
int | remainingLumis, | ||
unsigned int | treeCacheSize, | ||
int | treeMaxVirtualSize, | ||
InputSource::ProcessingMode | processingMode, | ||
RunNumber_t const & | forcedRunNumber, | ||
bool | noEventSort, | ||
GroupSelectorRules const & | groupSelectorRules, | ||
bool | secondaryFile, | ||
boost::shared_ptr< DuplicateChecker > | duplicateChecker, | ||
bool | dropDescendantsOfDroppedProducts, | ||
std::vector< boost::shared_ptr< IndexIntoFile > > const & | indexesIntoFiles, | ||
std::vector< boost::shared_ptr< IndexIntoFile > >::size_type | currentIndexIntoFile, | ||
std::vector< ProcessHistoryID > & | orderedProcessHistoryIDs, | ||
bool | usingGoToEvent | ||
) |
Definition at line 102 of file RootFile.cc.
References edm::IndexIntoFile::begin(), branchChildren_, edm::poolNames::branchIDListBranchName(), branchIDLists_, branchListIndexesUnchanged_, edm::BranchDescription::branchName(), edm::BranchDescription::branchType(), edm::BranchTypeToAuxiliaryBranchName(), edm::BranchDescription::className(), 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, edm::fillProductRegistryTransients(), edm::IndexIntoFile::firstAppearanceOrder, edm::cc::forcedRunOffset(), forcedRunOffset_, edm::BranchDescription::friendlyClassName(), edm::friendlyname::friendlyName(), edm::roottree::getEntry(), hasNewlyDroppedBranch_, i, edm::poolNames::idToParameterSetBlobsBranchName(), indexIntoFile_, indexIntoFileBegin_, edm::poolNames::indexIntoFileBranchName(), indexIntoFileEnd_, indexIntoFileIter_, edm::InEvent, initializeDuplicateChecker(), edm::InLumi, edm::InRun, edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), lumiTree_, edm::poolNames::metaDataTreeName(), edm::poolNames::moduleDescriptionMapBranchName(), newBranchToOldBranch(), newBranchToOldBranch_, edm::IndexIntoFile::numericalOrder, edm::poolNames::parameterSetMapBranchName(), edm::poolNames::parameterSetsTreeName(), edm::poolNames::processConfigurationBranchName(), edm::poolNames::processHistoryBranchName(), edm::poolNames::processHistoryMapBranchName(), parseEventContent::prod, edm::poolNames::productDependenciesBranchName(), edm::poolNames::productDescriptionBranchName(), edm::ProductRegistry::productList(), productRegistry(), productRegistry_, provenanceAdaptor_, MultipleCompare::pset, readEventHistoryTree(), readParentageTree(), edm::RootTree::resetTraining(), runTree_, setIfFastClonable(), edm::setRefCoreStreamer(), edm::RootTree::trainCache(), edm::roottree::trainCache(), treePointers_, edm::errors::UnimplementedFeature, edm::BranchDescription::updateFriendlyClassName(), edm::BranchIDListHelper::updateFromInput(), validateFile(), and whyNotFastClonable_.
: file_(fileName), logicalFile_(logicalFileName), processConfiguration_(processConfiguration), filePtr_(filePtr), eventSkipperByID_(eventSkipperByID), fileFormatVersion_(), fid_(), indexIntoFileSharedPtr_(new IndexIntoFile), indexIntoFile_(*indexIntoFileSharedPtr_), orderedProcessHistoryIDs_(orderedProcessHistoryIDs), indexIntoFileBegin_(indexIntoFile_.begin(noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder)), indexIntoFileEnd_(indexIntoFileBegin_), indexIntoFileIter_(indexIntoFileBegin_), eventProcessHistoryIDs_(), eventProcessHistoryIter_(eventProcessHistoryIDs_.begin()), skipAnyEvents_(skipAnyEvents), noEventSort_(noEventSort), whyNotFastClonable_(0), hasNewlyDroppedBranch_(), branchListIndexesUnchanged_(false), eventAux_(), eventTree_(filePtr_, InEvent, treeMaxVirtualSize, treeCacheSize, roottree::defaultLearningEntries), lumiTree_(filePtr_, InLumi, treeMaxVirtualSize, roottree::defaultNonEventCacheSize, roottree::defaultNonEventLearningEntries), runTree_(filePtr_, InRun, treeMaxVirtualSize, roottree::defaultNonEventCacheSize, roottree::defaultNonEventLearningEntries), treePointers_(), lastEventEntryNumberRead_(-1LL), productRegistry_(), branchIDLists_(), processingMode_(processingMode), forcedRunOffset_(0), newBranchToOldBranch_(), eventHistoryTree_(0), eventSelectionIDs_(new EventSelectionIDVector), branchListIndexes_(new BranchListIndexes), history_(), branchChildren_(new BranchChildren), duplicateChecker_(duplicateChecker), provenanceAdaptor_() { hasNewlyDroppedBranch_.assign(false); treePointers_[InEvent] = &eventTree_; treePointers_[InLumi] = &lumiTree_; treePointers_[InRun] = &runTree_; // Read the metadata tree. TTree *metaDataTree = dynamic_cast<TTree *>(filePtr_->Get(poolNames::metaDataTreeName().c_str())); if(!metaDataTree) throw Exception(errors::FileReadError) << "Could not find tree " << poolNames::metaDataTreeName() << " in the input file.\n"; // To keep things simple, we just read in every possible branch that exists. // We don't pay attention to which branches exist in which file format versions FileFormatVersion *fftPtr = &fileFormatVersion_; if(metaDataTree->FindBranch(poolNames::fileFormatVersionBranchName().c_str()) != 0) { TBranch *fft = metaDataTree->GetBranch(poolNames::fileFormatVersionBranchName().c_str()); fft->SetAddress(&fftPtr); roottree::getEntry(fft, 0); metaDataTree->SetBranchAddress(poolNames::fileFormatVersionBranchName().c_str(), &fftPtr); } setRefCoreStreamer(0, !fileFormatVersion().splitProductIDs(), !fileFormatVersion().productIDIsInt()); // backward compatibility FileID *fidPtr = &fid_; if(metaDataTree->FindBranch(poolNames::fileIdentifierBranchName().c_str()) != 0) { metaDataTree->SetBranchAddress(poolNames::fileIdentifierBranchName().c_str(), &fidPtr); } IndexIntoFile *iifPtr = &indexIntoFile_; if(metaDataTree->FindBranch(poolNames::indexIntoFileBranchName().c_str()) != 0) { metaDataTree->SetBranchAddress(poolNames::indexIntoFileBranchName().c_str(), &iifPtr); } // Need to read to a temporary registry so we can do a translation of the BranchKeys. // This preserves backward compatibility against friendly class name algorithm changes. ProductRegistry inputProdDescReg; ProductRegistry *ppReg = &inputProdDescReg; metaDataTree->SetBranchAddress(poolNames::productDescriptionBranchName().c_str(), (&ppReg)); typedef std::map<ParameterSetID, ParameterSetBlob> PsetMap; PsetMap psetMap; PsetMap *psetMapPtr = &psetMap; if(metaDataTree->FindBranch(poolNames::parameterSetMapBranchName().c_str()) != 0) { //backward compatibility assert(!fileFormatVersion().parameterSetsTree()); metaDataTree->SetBranchAddress(poolNames::parameterSetMapBranchName().c_str(), &psetMapPtr); } else { assert(fileFormatVersion().parameterSetsTree()); TTree* psetTree = dynamic_cast<TTree *>(filePtr_->Get(poolNames::parameterSetsTreeName().c_str())); if(0 == psetTree) { throw Exception(errors::FileReadError) << "Could not find tree " << poolNames::parameterSetsTreeName() << " in the input file.\n"; } typedef std::pair<ParameterSetID, ParameterSetBlob> IdToBlobs; IdToBlobs idToBlob; IdToBlobs* pIdToBlob = &idToBlob; psetTree->SetBranchAddress(poolNames::idToParameterSetBlobsBranchName().c_str(), &pIdToBlob); std::auto_ptr<TTreeCache> psetTreeCache = roottree::trainCache(psetTree, *filePtr_, roottree::defaultNonEventCacheSize, "*"); filePtr_->SetCacheRead(psetTreeCache.get()); for(Long64_t i = 0; i != psetTree->GetEntries(); ++i) { psetTree->GetEntry(i); psetMap.insert(idToBlob); } filePtr_->SetCacheRead(0); } // backward compatibility ProcessHistoryRegistry::collection_type pHistMap; ProcessHistoryRegistry::collection_type *pHistMapPtr = &pHistMap; if(metaDataTree->FindBranch(poolNames::processHistoryMapBranchName().c_str()) != 0) { metaDataTree->SetBranchAddress(poolNames::processHistoryMapBranchName().c_str(), &pHistMapPtr); } ProcessHistoryRegistry::vector_type pHistVector; ProcessHistoryRegistry::vector_type *pHistVectorPtr = &pHistVector; if(metaDataTree->FindBranch(poolNames::processHistoryBranchName().c_str()) != 0) { metaDataTree->SetBranchAddress(poolNames::processHistoryBranchName().c_str(), &pHistVectorPtr); } ProcessConfigurationVector procConfigVector; ProcessConfigurationVector* procConfigVectorPtr = &procConfigVector; if(metaDataTree->FindBranch(poolNames::processConfigurationBranchName().c_str()) != 0) { metaDataTree->SetBranchAddress(poolNames::processConfigurationBranchName().c_str(), &procConfigVectorPtr); } std::auto_ptr<BranchIDListRegistry::collection_type> branchIDListsAPtr(new BranchIDListRegistry::collection_type); BranchIDListRegistry::collection_type *branchIDListsPtr = branchIDListsAPtr.get(); if(metaDataTree->FindBranch(poolNames::branchIDListBranchName().c_str()) != 0) { metaDataTree->SetBranchAddress(poolNames::branchIDListBranchName().c_str(), &branchIDListsPtr); } BranchChildren* branchChildrenBuffer = branchChildren_.get(); if(metaDataTree->FindBranch(poolNames::productDependenciesBranchName().c_str()) != 0) { metaDataTree->SetBranchAddress(poolNames::productDependenciesBranchName().c_str(), &branchChildrenBuffer); } // backward compatibility std::vector<EventProcessHistoryID> *eventHistoryIDsPtr = &eventProcessHistoryIDs_; if(metaDataTree->FindBranch(poolNames::eventHistoryBranchName().c_str()) != 0) { metaDataTree->SetBranchAddress(poolNames::eventHistoryBranchName().c_str(), &eventHistoryIDsPtr); } if(metaDataTree->FindBranch(poolNames::moduleDescriptionMapBranchName().c_str()) != 0) { if(metaDataTree->GetBranch(poolNames::moduleDescriptionMapBranchName().c_str())->GetSplitLevel() != 0) { metaDataTree->SetBranchStatus((poolNames::moduleDescriptionMapBranchName() + ".*").c_str(), 0); } else { metaDataTree->SetBranchStatus(poolNames::moduleDescriptionMapBranchName().c_str(), 0); } } // Here we read the metadata tree roottree::getEntry(metaDataTree, 0); eventProcessHistoryIter_ = eventProcessHistoryIDs_.begin(); // Here we read the event history tree, if we have one. readEventHistoryTree(); ParameterSetConverter::ParameterSetIdConverter psetIdConverter; if(!fileFormatVersion().triggerPathsTracked()) { ParameterSetConverter converter(psetMap, psetIdConverter, fileFormatVersion().parameterSetsByReference()); } else { // Merge into the parameter set registry. pset::Registry& psetRegistry = *pset::Registry::instance(); for(PsetMap::const_iterator i = psetMap.begin(), iEnd = psetMap.end(); i != iEnd; ++i) { ParameterSet pset(i->second.pset()); pset.setID(i->first); psetRegistry.insertMapped(pset); } } if(!fileFormatVersion().splitProductIDs()) { // Old provenance format input file. Create a provenance adaptor. provenanceAdaptor_.reset(new ProvenanceAdaptor( inputProdDescReg, pHistMap, pHistVector, procConfigVector, psetIdConverter, true)); // Fill in the branchIDLists branch from the provenance adaptor branchIDLists_ = provenanceAdaptor_->branchIDLists(); } else { if(!fileFormatVersion().triggerPathsTracked()) { // New provenance format, but change in ParameterSet Format. Create a provenance adaptor. provenanceAdaptor_.reset(new ProvenanceAdaptor( inputProdDescReg, pHistMap, pHistVector, procConfigVector, psetIdConverter, false)); } // New provenance format input file. The branchIDLists branch was read directly from the input file. if(metaDataTree->FindBranch(poolNames::branchIDListBranchName().c_str()) == 0) { throw Exception(errors::EventCorruption) << "Failed to find branchIDLists branch in metaData tree.\n"; } branchIDLists_.reset(branchIDListsAPtr.release()); } // Merge into the hashed registries. ProcessHistoryRegistry::instance()->insertCollection(pHistVector); ProcessConfigurationRegistry::instance()->insertCollection(procConfigVector); eventTree_.trainCache(BranchTypeToAuxiliaryBranchName(InEvent).c_str()); validateFile(secondaryFile, usingGoToEvent); // Read the parentage tree. Old format files are handled internally in readParentageTree(). readParentageTree(); if(eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) { whyNotFastClonable_ += FileBlock::EventsOrLumisSelectedByID; } initializeDuplicateChecker(indexesIntoFiles, currentIndexIntoFile); indexIntoFileIter_ = indexIntoFileBegin_ = indexIntoFile_.begin(noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder); indexIntoFileEnd_ = indexIntoFile_.end(noEventSort ? IndexIntoFile::firstAppearanceOrder : IndexIntoFile::numericalOrder); forcedRunOffset_ = forcedRunOffset(forcedRunNumber, indexIntoFileBegin_, indexIntoFileEnd_); eventProcessHistoryIter_ = eventProcessHistoryIDs_.begin(); // Set product presence information in the product registry. ProductRegistry::ProductList const& pList = inputProdDescReg.productList(); for(ProductRegistry::ProductList::const_iterator it = pList.begin(), itEnd = pList.end(); it != itEnd; ++it) { BranchDescription const& prod = it->second; treePointers_[prod.branchType()]->setPresence(prod); } fillProductRegistryTransients(procConfigVector, inputProdDescReg); std::auto_ptr<ProductRegistry> newReg(new ProductRegistry); // Do the translation from the old registry to the new one { ProductRegistry::ProductList const& prodList = inputProdDescReg.productList(); for(ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd; ++it) { BranchDescription const& prod = it->second; std::string newFriendlyName = friendlyname::friendlyName(prod.className()); if(newFriendlyName == prod.friendlyClassName()) { newReg->copyProduct(prod); } else { if(fileFormatVersion().splitProductIDs()) { throw Exception(errors::UnimplementedFeature) << "Cannot change friendly class name algorithm without more development work\n" << "to update BranchIDLists. Contact the framework group.\n"; } BranchDescription newBD(prod); newBD.updateFriendlyClassName(); newReg->copyProduct(newBD); newBranchToOldBranch_.insert(std::make_pair(newBD.branchName(), prod.branchName())); } } dropOnInput(*newReg, groupSelectorRules, dropDescendants, secondaryFile); // freeze the product registry newReg->setFrozen(); productRegistry_.reset(newReg.release()); } // Set up information from the product registry. ProductRegistry::ProductList const& prodList = productRegistry()->productList(); for(ProductRegistry::ProductList::const_iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd; ++it) { BranchDescription const& prod = it->second; treePointers_[prod.branchType()]->addBranch(it->first, prod, newBranchToOldBranch(prod.branchName())); } // Determine if this file is fast clonable. setIfFastClonable(remainingEvents, remainingLumis); // Update the branch id info. if(!secondaryFile) { branchListIndexesUnchanged_ = BranchIDListHelper::updateFromInput(*branchIDLists_, file_); } setRefCoreStreamer(true); // backward compatibility // We are done with our initial reading of EventAuxiliary. indexIntoFile_.doneFileInitialization(); // Tell the event tree to begin training at the next read. eventTree_.resetTraining(); // Train the run and lumi trees. runTree_.trainCache("*"); lumiTree_.trainCache("*"); } RootFile::~RootFile() { }
edm::RootFile::~RootFile | ( | ) |
BranchIDListRegistry::collection_type const& edm::RootFile::branchIDLists | ( | ) | [inline] |
bool edm::RootFile::branchListIndexesUnchanged | ( | ) | const [inline] |
Definition at line 96 of file RootFile.h.
References branchListIndexesUnchanged_.
{return branchListIndexesUnchanged_;}
void edm::RootFile::close | ( | void | ) |
Definition at line 995 of file RootFile.cc.
{ (*it)->close(); (*it) = 0; } filePtr_->Close(); filePtr_.reset(); } void RootFile::fillThisEventAuxiliary() {
boost::shared_ptr< FileBlock > edm::RootFile::createFileBlock | ( | ) | const |
Definition at line 523 of file RootFile.cc.
{
void edm::RootFile::dropOnInput | ( | ProductRegistry & | reg, |
GroupSelectorRules const & | rules, | ||
bool | dropDescendants, | ||
bool | secondaryFile | ||
) | [private] |
Definition at line 1487 of file RootFile.cc.
References branchChildren_, edm::BranchDescription::branchID(), and parseEventContent::prod.
Referenced by RootFile().
{ BranchDescription const& prod = it->second; if(!groupSelector.selected(prod)) { if(dropDescendants) { branchChildren_->appendToDescendants(prod.branchID(), branchesToDrop); } else { branchesToDrop.insert(prod.branchID()); } } } // On this pass, actually drop the branches. std::set<BranchID>::const_iterator branchesToDropEnd = branchesToDrop.end(); for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) { BranchDescription const& prod = it->second; bool drop = branchesToDrop.find(prod.branchID()) != branchesToDropEnd; if(drop) { if(groupSelector.selected(prod)) { LogWarning("RootFile") << "Branch '" << prod.branchName() << "' is being dropped from the input\n" << "of file '" << file_ << "' because it is dependent on a branch\n" << "that was explicitly dropped.\n"; } treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName())); hasNewlyDroppedBranch_[prod.branchType()] = true; ProductRegistry::ProductList::iterator icopy = it; ++it; prodList.erase(icopy); } else { ++it; } } // Drop on input mergeable run and lumi products, this needs to be invoked for secondary file input if(secondaryFile) { for(ProductRegistry::ProductList::iterator it = prodList.begin(), itEnd = prodList.end(); it != itEnd;) { BranchDescription const& prod = it->second; if(prod.branchType() != InEvent) { TClass *cp = gROOT->GetClass(prod.wrappedName().c_str()); boost::shared_ptr<EDProduct> dummy(static_cast<EDProduct *>(cp->New())); if(dummy->isMergeable()) { treePointers_[prod.branchType()]->dropBranch(newBranchToOldBranch(prod.branchName())); ProductRegistry::ProductList::iterator icopy = it; ++it; prodList.erase(icopy); } else { ++it; } } else ++it; } } } // backward compatibility
EventAuxiliary const& edm::RootFile::eventAux | ( | ) | const [inline] |
Definition at line 85 of file RootFile.h.
References eventAux_.
Referenced by eventID(), fillHistory(), initializeDuplicateChecker(), readLuminosityBlockAuxiliary_(), and readRunAuxiliary_().
{return eventAux_;}
EventID const& edm::RootFile::eventID | ( | ) | const [inline] |
Definition at line 89 of file RootFile.h.
References eventAux(), and edm::EventAuxiliary::id().
{return eventAux().id();}
RootTree const& edm::RootFile::eventTree | ( | ) | const [inline] |
std::string const& edm::RootFile::file | ( | ) | const [inline] |
FileFormatVersion edm::RootFile::fileFormatVersion | ( | ) | const [inline] |
Definition at line 93 of file RootFile.h.
References fileFormatVersion_.
Referenced by RootFile(), and ~RootFile().
{return fileFormatVersion_;}
void edm::RootFile::fillEventAuxiliary | ( | ) | [private] |
Definition at line 1026 of file RootFile.cc.
{
void edm::RootFile::fillHistory | ( | ) | [private] |
Definition at line 1032 of file RootFile.cc.
References event(), eventAux(), eventAux_, eventProcessHistoryIDs_, eventProcessHistoryIter_, edm::lower_bound_all(), DTTTrigCorrFirst::run, edm::EventAuxiliary::setProcessHistoryID(), and filterCSVwithJSON::target.
{ // Lumi block number was not in EventID for the relevant releases. EventID id(eventAux().id().run(), 0, eventAux().id().event()); if(eventProcessHistoryIter_->eventID() != id) { EventProcessHistoryID target(id, ProcessHistoryID()); eventProcessHistoryIter_ = lower_bound_all(eventProcessHistoryIDs_, target); assert(eventProcessHistoryIter_->eventID() == id); } eventAux_.setProcessHistoryID(eventProcessHistoryIter_->processHistoryID()); ++eventProcessHistoryIter_; } else if(fileFormatVersion().eventHistoryTree()) { // for backward compatibility. History* pHistory = history_.get(); TBranch* eventHistoryBranch = eventHistoryTree_->GetBranch(poolNames::eventHistoryBranchName().c_str()); if(!eventHistoryBranch) { throw Exception(errors::EventCorruption) << "Failed to find history branch in event history tree.\n"; } eventHistoryBranch->SetAddress(&pHistory); roottree::getEntry(eventHistoryTree_, eventTree_.entryNumber()); eventAux_.setProcessHistoryID(history_->processHistoryID()); eventSelectionIDs_.reset(&history_->eventSelectionIDs(), do_nothing_deleter()); branchListIndexes_.reset(&history_->branchListIndexes(), do_nothing_deleter()); } else if(fileFormatVersion().noMetaDataTrees()) { // Current format EventSelectionIDVector* pESV = eventSelectionIDs_.get(); TBranch* eventSelectionIDBranch = eventTree_.tree()->GetBranch(poolNames::eventSelectionsBranchName().c_str()); assert(eventSelectionIDBranch != 0); eventTree_.fillBranchEntry(eventSelectionIDBranch, pESV); BranchListIndexes* pBLI = branchListIndexes_.get(); TBranch* branchListIndexesBranch = eventTree_.tree()->GetBranch(poolNames::branchListIndexesBranchName().c_str()); assert(branchListIndexesBranch != 0); eventTree_.fillBranchEntry(branchListIndexesBranch, pBLI); } if(provenanceAdaptor_) { eventAux_.setProcessHistoryID(provenanceAdaptor_->convertID(eventAux().processHistoryID())); for(EventSelectionIDVector::iterator i = eventSelectionIDs_->begin(), e = eventSelectionIDs_->end(); i != e; ++i) { (*i) = provenanceAdaptor_->convertID(*i); } } if(!fileFormatVersion().splitProductIDs()) { // old format. branchListIndexes_ must be filled in from the ProvenanceAdaptor. provenanceAdaptor_->branchListIndexes(*branchListIndexes_); } } boost::shared_ptr<LuminosityBlockAuxiliary> RootFile::fillLumiAuxiliary() {
void edm::RootFile::fillIndexIntoFile | ( | ) | [private] |
Definition at line 724 of file RootFile.cc.
{ bool newRun = false; bool newLumi = false; fillThisEventAuxiliary(); fillHistory(); // Save the event numbers as we loop through the event auxiliary to avoid // having to read through the event auxiliary again later. These event numbers // are not actually used in this function, but could be needed elsewhere. indexIntoFile_.unsortedEventNumbers().push_back(eventAux().event()); if(prevPhid != eventAux().processHistoryID() || prevRun != eventAux().run()) { newRun = newLumi = true; } else if(prevLumi != eventAux().luminosityBlock()) { newLumi = true; } prevPhid = eventAux().processHistoryID(); prevRun = eventAux().run(); prevLumi = eventAux().luminosityBlock(); if(newLumi) { lumis.push_back(LumiItem(eventAux().processHistoryID(), eventAux().run(), eventAux().luminosityBlock(), eventTree_.entryNumber())); // (insert 1) runLumiSet.insert(LuminosityBlockID(eventAux().run(), eventAux().luminosityBlock())); // (insert 2) } else { LumiItem& currentLumi = lumis.back(); assert(currentLumi.lastEventEntry_ == eventTree_.entryNumber()); ++currentLumi.lastEventEntry_; } if(newRun) { // Insert run in list if it is not already there. RunItem item(eventAux().processHistoryID(), eventAux().run()); if(runItemSet.insert(item).second) { // (check 3, insert 3) runs.push_back(item); // (insert 5) runSet.insert(eventAux().run()); // (insert 4) phidMap.insert(std::make_pair(eventAux().run(), eventAux().processHistoryID())); } } } // now clean up. eventTree_.setEntryNumber(-1); eventAux_ = EventAuxiliary(); lastEventEntryNumberRead_ = -1LL; // Loop over run entries and fill information. typedef std::map<RunNumber_t, EntryNumber_t> RunMap; RunMap runMap; // (declare 11) typedef std::vector<RunItem> RunVector; RunVector emptyRuns; // (declare 12) if(runTree_.isValid()) { while(runTree_.next()) { // Note: adjacent duplicates will be skipped without an explicit check. boost::shared_ptr<RunAuxiliary> runAux = fillRunAuxiliary(); if(runSet.insert(runAux->run()).second) { // (check 4, insert 4) // This run was not assciated with any events or lumis. emptyRuns.push_back(RunItem(runAux->processHistoryID(), runAux->run())); // (insert 12) } runMap.insert(std::make_pair(runAux->run(), runTree_.entryNumber())); // (insert 11) phidMap.insert(std::make_pair(runAux->run(), runAux->processHistoryID())); } // now clean up. runTree_.setEntryNumber(-1); } // Insert the ordered empty runs into the run list. RunItemSortByRun runItemSortByRun; stable_sort_all(emptyRuns, runItemSortByRun); RunList::iterator itRuns = runs.begin(), endRuns = runs.end(); for (RunVector::const_iterator i = emptyRuns.begin(), iEnd = emptyRuns.end(); i != iEnd; ++i) { for (; itRuns != endRuns; ++itRuns) { if(runItemSortByRun(*i, *itRuns)) { break; } } runs.insert(itRuns, *i); } // Loop over luminosity block entries and fill information. typedef std::vector<LumiItem> LumiVector; LumiVector emptyLumis; // (declare 7) typedef std::map<LuminosityBlockID, EntryNumber_t> RunLumiMap; RunLumiMap runLumiMap; // (declare 6) if(lumiTree_.isValid()) { while(lumiTree_.next()) { // Note: adjacent duplicates will be skipped without an explicit check. boost::shared_ptr<LuminosityBlockAuxiliary> lumiAux = fillLumiAuxiliary(); LuminosityBlockID lumiID = LuminosityBlockID(lumiAux->run(), lumiAux->luminosityBlock()); if(runLumiSet.insert(lumiID).second) { // (check 2, insert 2) // This lumi was not associated with any events. // Use the process history ID from the corresponding run. In cases of practical // importance, this should be the correct process history ID, but it is possible // to construct files where this is not the correct process history ID ... PHIDMap::const_iterator iPhidMap = phidMap.find(lumiAux->run()); assert(iPhidMap != phidMap.end()); emptyLumis.push_back(LumiItem(iPhidMap->second, lumiAux->run(), lumiAux->luminosityBlock(), -1LL)); // (insert 7) } runLumiMap.insert(std::make_pair(lumiID, lumiTree_.entryNumber())); } // now clean up. lumiTree_.setEntryNumber(-1); } // Insert the ordered empty lumis into the lumi list. LumiItemSortByRunLumi lumiItemSortByRunLumi; stable_sort_all(emptyLumis, lumiItemSortByRunLumi); LumiList::iterator itLumis = lumis.begin(), endLumis = lumis.end(); for (LumiVector::const_iterator i = emptyLumis.begin(), iEnd = emptyLumis.end(); i != iEnd; ++i) { for (; itLumis != endLumis; ++itLumis) { if(lumiItemSortByRunLumi(*i, *itLumis)) { break; } } lumis.insert(itLumis, *i); } // Create a map of RunItems that gives the order of first appearance in the list. // Also fill in the vector of process history IDs typedef std::map<RunItem, int, RunItemSortByRunPhid> RunCountMap; RunCountMap runCountMap; // Declare (17) std::vector<ProcessHistoryID>& phids = indexIntoFile_.setProcessHistoryIDs(); assert(phids.empty()); std::vector<IndexIntoFile::RunOrLumiEntry>& entries = indexIntoFile_.setRunOrLumiEntries(); assert(entries.empty()); int rcount = 0; for (RunList::iterator it = runs.begin(), itEnd = runs.end(); it != itEnd; ++it) { RunCountMap::const_iterator countMapItem = runCountMap.find(*it); if(countMapItem == runCountMap.end()) { countMapItem = runCountMap.insert(std::make_pair(*it, rcount)).first; // Insert (17) assert(countMapItem != runCountMap.end()); ++rcount; } std::vector<ProcessHistoryID>::const_iterator phidItem = find_in_all(phids, it->phid_); if(phidItem == phids.end()) { phids.push_back(it->phid_); phidItem = phids.end() - 1; } entries.push_back(IndexIntoFile::RunOrLumiEntry( countMapItem->second, // use (17) -1LL, runMap[it->run_], // use (11) phidItem - phids.begin(), it->run_, 0U, -1LL, -1LL)); } // Create a map of LumiItems that gives the order of first appearance in the list. typedef std::map<LumiItem, int, LumiItemSortByRunLumiPhid> LumiCountMap; LumiCountMap lumiCountMap; // Declare (19) int lcount = 0; for (LumiList::iterator it = lumis.begin(), itEnd = lumis.end(); it != itEnd; ++it) { RunCountMap::const_iterator runCountMapItem = runCountMap.find(RunItem(it->phid_, it->run_)); assert(runCountMapItem != runCountMap.end()); LumiCountMap::const_iterator countMapItem = lumiCountMap.find(*it); if(countMapItem == lumiCountMap.end()) { countMapItem = lumiCountMap.insert(std::make_pair(*it, lcount)).first; // Insert (17) assert(countMapItem != lumiCountMap.end()); ++lcount; } std::vector<ProcessHistoryID>::const_iterator phidItem = find_in_all(phids, it->phid_); assert(phidItem != phids.end()); entries.push_back(IndexIntoFile::RunOrLumiEntry( runCountMapItem->second, countMapItem->second, runLumiMap[LuminosityBlockID(it->run_, it->lumi_)], phidItem - phids.begin(), it->run_, it->lumi_, it->firstEventEntry_, it->lastEventEntry_)); } stable_sort_all(entries); } void RootFile::validateFile(bool secondaryFile, bool usingGoToEvent) {
boost::shared_ptr< LuminosityBlockAuxiliary > edm::RootFile::fillLumiAuxiliary | ( | ) | [private] |
Definition at line 1084 of file RootFile.cc.
{ LuminosityBlockAux lumiAux; LuminosityBlockAux *pLumiAux = &lumiAux; lumiTree_.fillAux<LuminosityBlockAux>(pLumiAux); conversion(lumiAux, *lumiAuxiliary); } if(provenanceAdaptor_) { lumiAuxiliary->setProcessHistoryID(provenanceAdaptor_->convertID(lumiAuxiliary->processHistoryID())); } if(lumiAuxiliary->luminosityBlock() == 0 && !fileFormatVersion().runsAndLumis()) { lumiAuxiliary->id() = LuminosityBlockID(RunNumber_t(1), LuminosityBlockNumber_t(1)); } return lumiAuxiliary; } boost::shared_ptr<RunAuxiliary> RootFile::fillRunAuxiliary() {
boost::shared_ptr< RunAuxiliary > edm::RootFile::fillRunAuxiliary | ( | ) | [private] |
Definition at line 1105 of file RootFile.cc.
{ RunAux runAux; RunAux *pRunAux = &runAux; runTree_.fillAux<RunAux>(pRunAux); conversion(runAux, *runAuxiliary); } if(provenanceAdaptor_) { runAuxiliary->setProcessHistoryID(provenanceAdaptor_->convertID(runAuxiliary->processHistoryID())); } return runAuxiliary; } bool RootFile::skipEvents(int& offset) {
void edm::RootFile::fillThisEventAuxiliary | ( | ) | [private] |
Definition at line 1007 of file RootFile.cc.
Referenced by initializeDuplicateChecker(), readLuminosityBlockAuxiliary_(), readRunAuxiliary_(), and skipEvents().
{ EventAuxiliary *pEvAux = &eventAux_; eventTree_.fillAux<EventAuxiliary>(pEvAux); } else { // for backward compatibility. EventAux eventAux; EventAux *pEvAux = &eventAux; eventTree_.fillAux<EventAux>(pEvAux); conversion(eventAux, eventAux_); } lastEventEntryNumberRead_ = eventTree_.entryNumber(); } void RootFile::fillEventAuxiliary() {
IndexIntoFile::EntryType edm::RootFile::getEntryTypeWithSkipping | ( | ) | [private] |
Definition at line 602 of file RootFile.cc.
{ indexIntoFileIter_.advanceToNextLumiOrRun(); } else { ++indexIntoFileIter_; } } return indexIntoFileIter_.getEntryType(); } bool RootFile::isDuplicateEvent() {
IndexIntoFile::EntryType edm::RootFile::getNextEntryTypeWanted | ( | ) |
Definition at line 629 of file RootFile.cc.
{ return IndexIntoFile::kRun; } else if(processingMode_ == InputSource::Runs) { indexIntoFileIter_.advanceToNextRun(); return getNextEntryTypeWanted(); } if(entryType == IndexIntoFile::kLumi) { return IndexIntoFile::kLumi; } else if(processingMode_ == InputSource::RunsAndLumis) { indexIntoFileIter_.advanceToNextLumiOrRun(); return getNextEntryTypeWanted(); } if(isDuplicateEvent()) { ++indexIntoFileIter_; return getNextEntryTypeWanted(); } return IndexIntoFile::kEvent; } bool RootFile::wasLastEventJustRead() const {
bool edm::RootFile::goToEvent | ( | EventID const & | eventID | ) |
Definition at line 1194 of file RootFile.cc.
References duplicateChecker_.
{ duplicateChecker_->disable(); } IndexIntoFile::SortOrder sortOrder = IndexIntoFile::numericalOrder; if(noEventSort_) sortOrder = IndexIntoFile::firstAppearanceOrder; IndexIntoFile::IndexIntoFileItr iter = indexIntoFile_.findPosition(sortOrder, eventID.run(), eventID.luminosityBlock(), eventID.event()); if(iter == indexIntoFile_.end(sortOrder)) { return false; } indexIntoFileIter_ = iter; return true; } // readEvent() is responsible for creating, and setting up, the // EventPrincipal.
boost::array<bool, NumBranchTypes> const& edm::RootFile::hasNewlyDroppedBranch | ( | ) | const [inline] |
Definition at line 95 of file RootFile.h.
References hasNewlyDroppedBranch_.
{return hasNewlyDroppedBranch_;}
IndexIntoFile::IndexIntoFileItr edm::RootFile::indexIntoFileIter | ( | ) | const |
Definition at line 548 of file RootFile.cc.
References edm::IndexIntoFile::IndexIntoFileItr::copyPosition(), and indexIntoFileIter_.
{
boost::shared_ptr<IndexIntoFile> edm::RootFile::indexIntoFileSharedPtr | ( | ) | const [inline] |
Definition at line 120 of file RootFile.h.
References indexIntoFileSharedPtr_.
{ return indexIntoFileSharedPtr_; }
void edm::RootFile::initializeDuplicateChecker | ( | std::vector< boost::shared_ptr< IndexIntoFile > > const & | indexesIntoFiles, |
std::vector< boost::shared_ptr< IndexIntoFile > >::size_type | currentIndexIntoFile | ||
) | [private] |
Definition at line 1471 of file RootFile.cc.
References duplicateChecker_, eventAux(), eventTree_, fillThisEventAuxiliary(), indexIntoFile_, edm::RootTree::next(), and edm::RootTree::setEntryNumber().
Referenced by RootFile().
{ if(eventTree_.next()) { fillThisEventAuxiliary(); duplicateChecker_->inputFileOpened(eventAux().isRealData(), indexIntoFile_, indexesIntoFiles, currentIndexIntoFile); } eventTree_.setEntryNumber(-1); } } void RootFile::dropOnInput (ProductRegistry& reg, GroupSelectorRules const& rules, bool dropDescendants, bool secondaryFile) {
bool edm::RootFile::isDuplicateEvent | ( | ) | [private] |
Definition at line 618 of file RootFile.cc.
{
RootTree const& edm::RootFile::lumiTree | ( | ) | const [inline] |
boost::shared_ptr< BranchMapper > edm::RootFile::makeBranchMapper | ( | RootTree & | rootTree, |
BranchType const & | type | ||
) | const [private] |
Definition at line 1640 of file RootFile.cc.
{ return makeBranchMapperInRelease210(rootTree, type); } else if(fileFormatVersion().eventHistoryTree()) { return makeBranchMapperInRelease200(rootTree, type, *productRegistry_); } else { return makeBranchMapperInRelease180(rootTree, type, *productRegistry_); } } // end backward compatibility }
std::string const & edm::RootFile::newBranchToOldBranch | ( | std::string const & | newBranch | ) | const [private] |
bool edm::RootFile::nextEventEntry | ( | ) | [inline] |
Definition at line 118 of file RootFile.h.
References eventTree_, and edm::RootTree::next().
{return eventTree_.next();}
void edm::RootFile::overrideRunNumber | ( | EventID & | id, |
bool | isRealData | ||
) | [private] |
Definition at line 1443 of file RootFile.cc.
{ id = EventID(RunID::firstValidRun().run(), LuminosityBlockID::firstValidLuminosityBlock().luminosityBlock(), id.event()); } } void
void edm::RootFile::overrideRunNumber | ( | RunID & | id | ) | [private] |
Definition at line 1427 of file RootFile.cc.
Referenced by readLuminosityBlockAuxiliary_(), and readRunAuxiliary_().
{
void edm::RootFile::overrideRunNumber | ( | LuminosityBlockID & | id | ) | [private] |
Definition at line 1435 of file RootFile.cc.
{
boost::shared_ptr<ProductRegistry const> edm::RootFile::productRegistry | ( | ) | const [inline] |
Definition at line 83 of file RootFile.h.
References productRegistry_.
Referenced by RootFile().
{return productRegistry_;}
EventPrincipal * edm::RootFile::readCurrentEvent | ( | EventPrincipal & | cache, |
boost::shared_ptr< RootFile > | rootFilePtr, | ||
boost::shared_ptr< LuminosityBlockPrincipal > | lb = boost::shared_ptr<LuminosityBlockPrincipal>() |
||
) |
Definition at line 1246 of file RootFile.cc.
{ return 0; } fillThisEventAuxiliary(); if(!fileFormatVersion().lumiInEventID()) { //ugly, but will disappear when the backward compatibility is done with schema evolution. const_cast<EventID&>(eventAux_.id()).setLuminosityBlockNumber(eventAux_.oldLuminosityBlock()); eventAux_.resetObsoleteInfo(); } fillHistory(); overrideRunNumber(eventAux_.id(), eventAux().isRealData()); std::auto_ptr<EventAuxiliary> aux(new EventAuxiliary(eventAux())); // We're not done ... so prepare the EventPrincipal cache.fillEventPrincipal(aux, lb, eventSelectionIDs_, branchListIndexes_, makeBranchMapper(eventTree_, InEvent), eventTree_.makeDelayedReader(fileFormatVersion(), rootFilePtr)); // report event read from file filePtr_->eventReadFromFile(eventID().run(), eventID().event()); return &cache; } void RootFile::setAtEventEntry(IndexIntoFile::EntryNumber_t entry) {
void edm::RootFile::readEntryDescriptionTree | ( | ) | [private] |
Definition at line 411 of file RootFile.cc.
{ roottree::getEntry(entryDescriptionTree, i); if(idBuffer != entryDescriptionBuffer.id()) throw Exception(errors::EventCorruption) << "Corruption of EntryDescription tree detected.\n"; oldregistry.insertMapped(entryDescriptionBuffer); Parentage parents; parents.parents() = entryDescriptionBuffer.parents(); registry.insertMapped(parents); } entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionIDBranchName().c_str(), 0); entryDescriptionTree->SetBranchAddress(poolNames::entryDescriptionBranchName().c_str(), 0); } void RootFile::readParentageTree() {
EventPrincipal * edm::RootFile::readEvent | ( | EventPrincipal & | cache, |
boost::shared_ptr< RootFile > | rootFilePtr, | ||
boost::shared_ptr< LuminosityBlockPrincipal > | lb = boost::shared_ptr<LuminosityBlockPrincipal>() |
||
) |
Definition at line 1229 of file RootFile.cc.
void edm::RootFile::readEventHistoryTree | ( | ) | [private] |
Definition at line 1458 of file RootFile.cc.
References edm::errors::EventCorruption, and Exception.
Referenced by RootFile().
{ throw Exception(errors::EventCorruption) << "Failed to find the event history tree.\n"; } } } void RootFile::initializeDuplicateChecker(
boost::shared_ptr< LuminosityBlockPrincipal > edm::RootFile::readLumi | ( | boost::shared_ptr< LuminosityBlockPrincipal > | lbCache | ) |
Definition at line 1384 of file RootFile.cc.
References indexIntoFileIter_.
{ ++indexIntoFileIter_; return lbCache; } // End code for backward compatibility before the existence of lumi trees. lumiTree_.setEntryNumber(indexIntoFileIter_.entry()); lbCache->fillLuminosityBlockPrincipal(makeBranchMapper(lumiTree_, InLumi), lumiTree_.makeDelayedReader(fileFormatVersion())); // Read in all the products now. lbCache->readImmediate(); ++indexIntoFileIter_; return lbCache; } bool RootFile::setEntryAtEvent(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) {
boost::shared_ptr< LuminosityBlockAuxiliary > edm::RootFile::readLuminosityBlockAuxiliary_ | ( | ) |
Definition at line 1340 of file RootFile.cc.
References eventAux(), eventTree_, fillThisEventAuxiliary(), indexIntoFileIter_, edm::Timestamp::invalidTimestamp(), edm::IndexIntoFile::IndexIntoFileItr::lumi(), edm::LuminosityBlockID::luminosityBlock(), edm::RootTree::next(), overrideRunNumber(), edm::RootTree::previous(), edm::LuminosityBlockID::run(), edm::IndexIntoFile::IndexIntoFileItr::run(), and edm::EventAuxiliary::time().
{ if(eventTree_.next()) { fillThisEventAuxiliary(); // back up, so event will not be skipped. eventTree_.previous(); } LuminosityBlockID lumi = LuminosityBlockID(indexIntoFileIter_.run(), indexIntoFileIter_.lumi()); overrideRunNumber(lumi); return boost::shared_ptr<LuminosityBlockAuxiliary>(new LuminosityBlockAuxiliary(lumi.run(), lumi.luminosityBlock(), eventAux().time(), Timestamp::invalidTimestamp())); } // End code for backward compatibility before the existence of lumi trees. lumiTree_.setEntryNumber(indexIntoFileIter_.entry()); boost::shared_ptr<LuminosityBlockAuxiliary> lumiAuxiliary = fillLumiAuxiliary(); assert(lumiAuxiliary->run() == indexIntoFileIter_.run()); assert(lumiAuxiliary->luminosityBlock() == indexIntoFileIter_.lumi()); overrideRunNumber(lumiAuxiliary->id()); filePtr_->reportInputLumiSection(lumiAuxiliary->run(), lumiAuxiliary->luminosityBlock()); if(lumiAuxiliary->beginTime() == Timestamp::invalidTimestamp()) { // LuminosityBlockAuxiliary did not contain a timestamp. Take it from the next event. if(eventTree_.next()) { fillThisEventAuxiliary(); // back up, so event will not be skipped. eventTree_.previous(); } lumiAuxiliary->setBeginTime(eventAux().time()); lumiAuxiliary->setEndTime(Timestamp::invalidTimestamp()); } if(fileFormatVersion().processHistorySameWithinRun()) { ProcessHistoryID phid = indexIntoFile_.processHistoryID(indexIntoFileIter_.processHistoryIDIndex()); assert(lumiAuxiliary->processHistoryID() == phid); } else { ProcessHistoryID phid = indexIntoFile_.processHistoryID(indexIntoFileIter_.processHistoryIDIndex()); lumiAuxiliary->setProcessHistoryID(phid); } return lumiAuxiliary; } boost::shared_ptr<LuminosityBlockPrincipal> RootFile::readLumi(boost::shared_ptr<LuminosityBlockPrincipal> lbCache) {
void edm::RootFile::readParentageTree | ( | ) | [private] |
Definition at line 447 of file RootFile.cc.
Referenced by RootFile().
{ roottree::getEntry(parentageTree, i); registry.insertMapped(parentageBuffer); } parentageTree->SetBranchAddress(poolNames::parentageBranchName().c_str(), 0); } void RootFile::setIfFastClonable(int remainingEvents, int remainingLumis) {
boost::shared_ptr< RunPrincipal > edm::RootFile::readRun_ | ( | boost::shared_ptr< RunPrincipal > | rpCache | ) |
Definition at line 1323 of file RootFile.cc.
References indexIntoFileIter_.
{ ++indexIntoFileIter_; return rpCache; } // End code for backward compatibility before the existence of run trees. rpCache->fillRunPrincipal(makeBranchMapper(runTree_, InRun), runTree_.makeDelayedReader(fileFormatVersion())); // Read in all the products now. rpCache->readImmediate(); ++indexIntoFileIter_; return rpCache; } boost::shared_ptr<LuminosityBlockAuxiliary> RootFile::readLuminosityBlockAuxiliary_() {
boost::shared_ptr< RunAuxiliary > edm::RootFile::readRunAuxiliary_ | ( | ) |
Definition at line 1281 of file RootFile.cc.
References eventAux(), eventTree_, fillThisEventAuxiliary(), indexIntoFileIter_, edm::Timestamp::invalidTimestamp(), edm::RootTree::next(), overrideRunNumber(), edm::RootTree::previous(), edm::IndexIntoFile::IndexIntoFileItr::run(), edm::RunID::run(), and edm::EventAuxiliary::time().
{ // prior to the support of run trees. // RunAuxiliary did not contain a valid timestamp. Take it from the next event. if(eventTree_.next()) { fillThisEventAuxiliary(); // back up, so event will not be skipped. eventTree_.previous(); } RunID run = RunID(indexIntoFileIter_.run()); overrideRunNumber(run); return boost::shared_ptr<RunAuxiliary>(new RunAuxiliary(run.run(), eventAux().time(), Timestamp::invalidTimestamp())); } // End code for backward compatibility before the existence of run trees. runTree_.setEntryNumber(indexIntoFileIter_.entry()); boost::shared_ptr<RunAuxiliary> runAuxiliary = fillRunAuxiliary(); assert(runAuxiliary->run() == indexIntoFileIter_.run()); overrideRunNumber(runAuxiliary->id()); filePtr_->reportInputRunNumber(runAuxiliary->run()); if(runAuxiliary->beginTime() == Timestamp::invalidTimestamp()) { // RunAuxiliary did not contain a valid timestamp. Take it from the next event. if(eventTree_.next()) { fillThisEventAuxiliary(); // back up, so event will not be skipped. eventTree_.previous(); } runAuxiliary->setBeginTime(eventAux().time()); runAuxiliary->setEndTime(Timestamp::invalidTimestamp()); } ProcessHistoryID phid = indexIntoFile_.processHistoryID(indexIntoFileIter_.processHistoryIDIndex()); if(fileFormatVersion().processHistorySameWithinRun()) { assert(runAuxiliary->processHistoryID() == phid); } else { runAuxiliary->setProcessHistoryID(phid); } return runAuxiliary; } boost::shared_ptr<RunPrincipal> RootFile::readRun_(boost::shared_ptr<RunPrincipal> rpCache) {
void edm::RootFile::reportOpened | ( | std::string const & | inputType | ) |
Definition at line 981 of file RootFile.cc.
{
void edm::RootFile::rewind | ( | ) | [inline] |
Definition at line 106 of file RootFile.h.
References eventTree_, indexIntoFileBegin_, indexIntoFileIter_, lumiTree_, edm::RootTree::rewind(), and runTree_.
{ indexIntoFileIter_ = indexIntoFileBegin_; eventTree_.rewind(); lumiTree_.rewind(); runTree_.rewind(); }
RootTree const& edm::RootFile::runTree | ( | ) | const [inline] |
void edm::RootFile::setAtEventEntry | ( | IndexIntoFile::EntryNumber_t | entry | ) |
Definition at line 1276 of file RootFile.cc.
References edm::IndexIntoFile::IndexIntoFileItr::getEntryType(), indexIntoFileEnd_, indexIntoFileIter_, and edm::IndexIntoFile::kRun.
{
bool edm::RootFile::setEntryAtEvent | ( | RunNumber_t | run, |
LuminosityBlockNumber_t | lumi, | ||
EventNumber_t | event | ||
) |
bool edm::RootFile::setEntryAtItem | ( | RunNumber_t | run, |
LuminosityBlockNumber_t | lumi, | ||
EventNumber_t | event | ||
) | [inline] |
Definition at line 98 of file RootFile.h.
References setEntryAtEvent(), setEntryAtLumi(), and setEntryAtRun().
{ return event ? setEntryAtEvent(run, lumi, event) : (lumi ? setEntryAtLumi(run, lumi) : setEntryAtRun(run)); }
bool edm::RootFile::setEntryAtLumi | ( | RunNumber_t | run, |
LuminosityBlockNumber_t | lumi | ||
) |
bool edm::RootFile::setEntryAtRun | ( | RunNumber_t | run | ) |
void edm::RootFile::setIfFastClonable | ( | int | remainingEvents, |
int | remainingLumis | ||
) | [private] |
Definition at line 473 of file RootFile.cc.
Referenced by RootFile().
{ whyNotFastClonable_ += FileBlock::NotProcessingEvents; return; } // Find entry for first event in file IndexIntoFile::IndexIntoFileItr it = indexIntoFileBegin_; while(it != indexIntoFileEnd_ && it.getEntryType() != IndexIntoFile::kEvent) { ++it; } if(it == indexIntoFileEnd_) { whyNotFastClonable_ += FileBlock::NoEventsInFile; return; } // From here on, record all reasons we can't fast clone. IndexIntoFile::SortOrder sortOrder = IndexIntoFile::numericalOrder; if(noEventSort_) sortOrder = IndexIntoFile::firstAppearanceOrder; if(!indexIntoFile_.iterationWillBeInEntryOrder(sortOrder)) { whyNotFastClonable_ += FileBlock::EventsToBeSorted; } if(skipAnyEvents_) { whyNotFastClonable_ += FileBlock::InitialEventsSkipped; } if(remainingEvents >= 0 && eventTree_.entries() > remainingEvents) { whyNotFastClonable_ += FileBlock::MaxEventsTooSmall; } if(remainingLumis >= 0 && lumiTree_.entries() > remainingLumis) { whyNotFastClonable_ += FileBlock::MaxLumisTooSmall; } // We no longer fast copy the EventAuxiliary branch, so there // is no longer any need to disable fast copying because the run // number is being modified. Also, this check did not work anyway // because this function is called before forcedRunOffset_ is set. // if(forcedRunOffset_ != 0) { // whyNotFastClonable_ += FileBlock::RunNumberModified; // } if(duplicateChecker_ && !duplicateChecker_->checkDisabled() && !duplicateChecker_->noDuplicatesInFile()) { whyNotFastClonable_ += FileBlock::DuplicateEventsRemoved; } } boost::shared_ptr<FileBlock> RootFile::createFileBlock() const {
void edm::RootFile::setPosition | ( | IndexIntoFile::IndexIntoFileItr const & | position | ) |
void edm::RootFile::setToLastEntry | ( | ) | [inline] |
Definition at line 112 of file RootFile.h.
References indexIntoFileEnd_, and indexIntoFileIter_.
bool edm::RootFile::skipEvents | ( | int & | offset | ) |
Definition at line 1123 of file RootFile.cc.
References edm::EventID::event(), eventAux_, eventSkipperByID_, eventTree_, fillThisEventAuxiliary(), edm::EventAuxiliary::id(), and edm::RootTree::setEntryNumber().
{ eventTree_.setEntryNumber(skippedEventEntry); fillThisEventAuxiliary(); if(eventSkipperByID_->skipIt(runOfSkippedEvent, lumiOfSkippedEvent, eventAux_.id().event())) { continue; } } if(duplicateChecker_ && !duplicateChecker_->checkDisabled() && !duplicateChecker_->noDuplicatesInFile()) { eventTree_.setEntryNumber(skippedEventEntry); fillThisEventAuxiliary(); if(duplicateChecker_->isDuplicateAndCheckActive(phIndexOfSkippedEvent, runOfSkippedEvent, lumiOfSkippedEvent, eventAux_.id().event(), file_)) { continue; } } --offset; } while(offset < 0) { if(duplicateChecker_) { duplicateChecker_->disable(); } int phIndexOfEvent = IndexIntoFile::invalidIndex; RunNumber_t runOfEvent = IndexIntoFile::invalidRun; LuminosityBlockNumber_t lumiOfEvent = IndexIntoFile::invalidLumi; EntryNumber_t eventEntry = IndexIntoFile::invalidEntry; indexIntoFileIter_.skipEventBackward(phIndexOfEvent, runOfEvent, lumiOfEvent, eventEntry); if(eventEntry == IndexIntoFile::invalidEntry) break; if(eventSkipperByID_ && eventSkipperByID_->somethingToSkip()) { eventTree_.setEntryNumber(eventEntry); fillEventAuxiliary(); if(eventSkipperByID_->skipIt(runOfEvent, lumiOfEvent, eventAux_.id().event())) { continue; } } ++offset; } return (indexIntoFileIter_ == indexIntoFileEnd_); } bool RootFile::goToEvent(EventID const& eventID) {
bool edm::RootFile::skipThisEntry | ( | ) | [private] |
Definition at line 558 of file RootFile.cc.
{ // See first if the entire lumi or run is skipped, so we won't have to read the event Auxiliary in that case. if(eventSkipperByID_->skipIt(indexIntoFileIter_.run(), indexIntoFileIter_.lumi(), 0U)) { return true; } // The Lumi is not skipped. If this is an event, see if the event is skipped. if(indexIntoFileIter_.getEntryType() == IndexIntoFile::kEvent) { fillEventAuxiliary(); if(eventSkipperByID_->skipIt(indexIntoFileIter_.run(), indexIntoFileIter_.lumi(), eventAux_.id().event())) { return true; } } // Skip runs with no lumis if either lumisToSkip or lumisToProcess have been set to select lumis if(indexIntoFileIter_.getEntryType() == IndexIntoFile::kRun && eventSkipperByID_->skippingLumis()) { IndexIntoFile::IndexIntoFileItr iterLumi = indexIntoFileIter_; // There are no lumis in this run, not even ones we will skip if(iterLumi.peekAheadAtLumi() == IndexIntoFile::invalidLumi) { return true; } // If we get here there are lumis in the run, check to see if we are skipping all of them do { if(!eventSkipperByID_->skipIt(iterLumi.run(), iterLumi.peekAheadAtLumi(), 0U)) { return false; } } while(iterLumi.skipLumiInRun()); return true; } } return false; } IndexIntoFile::EntryType RootFile::getEntryTypeWithSkipping() {
RootTreePtrArray& edm::RootFile::treePointers | ( | ) | [inline, private] |
void edm::RootFile::validateFile | ( | bool | secondaryFile, |
bool | usingGoToEvent | ||
) | [private] |
Definition at line 943 of file RootFile.cc.
Referenced by RootFile().
{ throw Exception(errors::EventCorruption) << "'Events' tree is corrupted or not present\n" << "in the input file.\n"; } if(fileFormatVersion().hasIndexIntoFile()) { if(runTree().entries() > 0) { assert(!indexIntoFile_.empty()); } } else { assert(indexIntoFile_.empty()); fillIndexIntoFile(); } indexIntoFile_.fixIndexes(orderedProcessHistoryIDs_); indexIntoFile_.setNumberOfEvents(eventTree_.entries()); indexIntoFile_.setEventFinder(boost::shared_ptr<IndexIntoFile::EventFinder>(new RootFileEventFinder(eventTree_))); // We fill the event numbers explicitly if we need to find events in closed files, // such as for secondary files (or secondary sources) or if duplicate checking across files. bool needEventNumbers = false; bool needIndexesForDuplicateChecker = duplicateChecker_ && duplicateChecker_->checkingAllFiles() && !duplicateChecker_->checkDisabled(); if(secondaryFile || needIndexesForDuplicateChecker || usingGoToEvent) { needEventNumbers = true; } bool needEventEntries = false; if(secondaryFile || !noEventSort_) { // We need event entries for sorting or for secondary files or sources. needEventEntries = true; } indexIntoFile_.fillEventNumbersOrEntries(needEventNumbers, needEventEntries); } void RootFile::reportOpened(std::string const& inputType) {
bool edm::RootFile::wasFirstEventJustRead | ( | ) | const |
Definition at line 661 of file RootFile.cc.
{ typedef IndexIntoFile::EntryNumber_t EntryNumber_t;
bool edm::RootFile::wasLastEventJustRead | ( | ) | const |
Definition at line 654 of file RootFile.cc.
{
int edm::RootFile::whyNotFastClonable | ( | ) | const [inline] |
Definition at line 94 of file RootFile.h.
References whyNotFastClonable_.
{return whyNotFastClonable_;}
boost::shared_ptr<BranchChildren> edm::RootFile::branchChildren_ [private] |
Definition at line 190 of file RootFile.h.
Referenced by dropOnInput(), and RootFile().
boost::shared_ptr<BranchIDListRegistry::collection_type const> edm::RootFile::branchIDLists_ [private] |
Definition at line 182 of file RootFile.h.
Referenced by branchIDLists(), and RootFile().
boost::shared_ptr<BranchListIndexes> edm::RootFile::branchListIndexes_ [private] |
Definition at line 188 of file RootFile.h.
bool edm::RootFile::branchListIndexesUnchanged_ [private] |
Definition at line 174 of file RootFile.h.
Referenced by branchListIndexesUnchanged(), and RootFile().
boost::shared_ptr<DuplicateChecker> edm::RootFile::duplicateChecker_ [private] |
Definition at line 191 of file RootFile.h.
Referenced by goToEvent(), and initializeDuplicateChecker().
EventAuxiliary edm::RootFile::eventAux_ [private] |
Definition at line 175 of file RootFile.h.
Referenced by eventAux(), fillHistory(), and skipEvents().
TTree* edm::RootFile::eventHistoryTree_ [private] |
Definition at line 186 of file RootFile.h.
std::vector<EventProcessHistoryID> edm::RootFile::eventProcessHistoryIDs_ [private] |
Definition at line 168 of file RootFile.h.
Referenced by fillHistory(), and RootFile().
std::vector<EventProcessHistoryID>::const_iterator edm::RootFile::eventProcessHistoryIter_ [private] |
Definition at line 169 of file RootFile.h.
Referenced by fillHistory(), and RootFile().
boost::shared_ptr<EventSelectionIDVector> edm::RootFile::eventSelectionIDs_ [private] |
Definition at line 187 of file RootFile.h.
boost::shared_ptr<EventSkipperByID> edm::RootFile::eventSkipperByID_ [private] |
Definition at line 159 of file RootFile.h.
Referenced by RootFile(), and skipEvents().
RootTree edm::RootFile::eventTree_ [private] |
Definition at line 176 of file RootFile.h.
Referenced by eventTree(), initializeDuplicateChecker(), nextEventEntry(), readLuminosityBlockAuxiliary_(), readRunAuxiliary_(), rewind(), RootFile(), and skipEvents().
FileID edm::RootFile::fid_ [private] |
Definition at line 161 of file RootFile.h.
Referenced by RootFile().
std::string const edm::RootFile::file_ [private] |
Definition at line 155 of file RootFile.h.
Referenced by file(), and RootFile().
Definition at line 160 of file RootFile.h.
Referenced by fileFormatVersion(), and RootFile().
boost::shared_ptr<InputFile> edm::RootFile::filePtr_ [private] |
Definition at line 158 of file RootFile.h.
Referenced by RootFile().
int edm::RootFile::forcedRunOffset_ [private] |
Definition at line 184 of file RootFile.h.
Referenced by RootFile().
boost::array<bool, NumBranchTypes> edm::RootFile::hasNewlyDroppedBranch_ [private] |
Definition at line 173 of file RootFile.h.
Referenced by hasNewlyDroppedBranch(), and RootFile().
boost::shared_ptr<History> edm::RootFile::history_ [private] |
Definition at line 189 of file RootFile.h.
IndexIntoFile& edm::RootFile::indexIntoFile_ [private] |
Definition at line 163 of file RootFile.h.
Referenced by initializeDuplicateChecker(), and RootFile().
Definition at line 165 of file RootFile.h.
Referenced by rewind(), and RootFile().
Definition at line 166 of file RootFile.h.
Referenced by RootFile(), setAtEventEntry(), setPosition(), and setToLastEntry().
Definition at line 167 of file RootFile.h.
Referenced by indexIntoFileIter(), readLumi(), readLuminosityBlockAuxiliary_(), readRun_(), readRunAuxiliary_(), rewind(), RootFile(), setAtEventEntry(), setPosition(), and setToLastEntry().
boost::shared_ptr<IndexIntoFile> edm::RootFile::indexIntoFileSharedPtr_ [private] |
Definition at line 162 of file RootFile.h.
Referenced by indexIntoFileSharedPtr().
Definition at line 180 of file RootFile.h.
std::string const edm::RootFile::logicalFile_ [private] |
Definition at line 156 of file RootFile.h.
RootTree edm::RootFile::lumiTree_ [private] |
Definition at line 177 of file RootFile.h.
Referenced by lumiTree(), rewind(), and RootFile().
std::map<std::string, std::string> edm::RootFile::newBranchToOldBranch_ [private] |
Definition at line 185 of file RootFile.h.
Referenced by RootFile().
bool edm::RootFile::noEventSort_ [private] |
Definition at line 171 of file RootFile.h.
std::vector<ProcessHistoryID>& edm::RootFile::orderedProcessHistoryIDs_ [private] |
Definition at line 164 of file RootFile.h.
ProcessConfiguration const& edm::RootFile::processConfiguration_ [private] |
Definition at line 157 of file RootFile.h.
Definition at line 183 of file RootFile.h.
boost::shared_ptr<ProductRegistry const> edm::RootFile::productRegistry_ [private] |
Definition at line 181 of file RootFile.h.
Referenced by productRegistry(), and RootFile().
boost::shared_ptr<ProvenanceAdaptor> edm::RootFile::provenanceAdaptor_ [private] |
Definition at line 192 of file RootFile.h.
Referenced by RootFile().
RootTree edm::RootFile::runTree_ [private] |
Definition at line 178 of file RootFile.h.
Referenced by rewind(), RootFile(), and runTree().
bool edm::RootFile::skipAnyEvents_ [private] |
Definition at line 170 of file RootFile.h.
RootTreePtrArray edm::RootFile::treePointers_ [private] |
Definition at line 179 of file RootFile.h.
Referenced by RootFile(), and treePointers().
int edm::RootFile::whyNotFastClonable_ [private] |
Definition at line 172 of file RootFile.h.
Referenced by RootFile(), and whyNotFastClonable().