#include <RootInputFileSequence.h>
Definition at line 38 of file RootInputFileSequence.h.
typedef boost::shared_ptr<RootFile> edm::RootInputFileSequence::RootFileSharedPtr |
Definition at line 46 of file RootInputFileSequence.h.
edm::RootInputFileSequence::RootInputFileSequence | ( | ParameterSet const & | pset, |
PoolSource const & | input, | ||
InputFileCatalog const & | catalog, | ||
InputType::InputType | inputType | ||
) | [explicit] |
Definition at line 28 of file RootInputFileSequence.cc.
References StorageFactory::activateTimeout(), branchesMustMatch_, enablePrefetching_, tests::test_Package01::factory, fileIter_, fileIterBegin_, fileIterEnd_, reco::get(), edm::ParameterSet::getUntrackedParameter(), initFile(), initialNumberOfEventsToSkip_, inputType_, edm::Service< T >::isAvailable(), parametersMustMatch_, edm::InputType::Primary, productRegistryUpdate(), rootFile_, edm::InputType::SecondarySource, skipBadFiles_, skipEvents(), StorageFactory::stagein(), edm::BranchDescription::Strict, AlCaHLTBitMon_QueryRunRegistry::string, treeCacheSize_, and edm::ProductRegistry::updateFromInput().
: input_(input), inputType_(inputType), catalog_(catalog), firstFile_(true), lfn_("unknown"), fileIterBegin_(fileCatalogItems().begin()), fileIterEnd_(fileCatalogItems().end()), fileIter_(fileIterEnd_), fileIterLastOpened_(fileIterEnd_), rootFile_(), parametersMustMatch_(BranchDescription::Permissive), branchesMustMatch_(BranchDescription::Permissive), flatDistribution_(), indexesIntoFiles_(fileCatalogItems().size()), orderedProcessHistoryIDs_(), eventSkipperByID_(inputType == InputType::Primary ? EventSkipperByID::create(pset).release() : 0), eventsRemainingInFile_(0), // The default value provided as the second argument to the getUntrackedParameter function call // is not used when the ParameterSet has been validated and the parameters are not optional // in the description. This is currently true when PoolSource is the primary input source. // The modules that use PoolSource as a SecSource have not defined their fillDescriptions function // yet, so the ParameterSet does not get validated yet. As soon as all the modules with a SecSource // have defined descriptions, the defaults in the getUntrackedParameterSet function calls can // and should be deleted from the code. initialNumberOfEventsToSkip_(inputType == InputType::Primary ? pset.getUntrackedParameter<unsigned int>("skipEvents", 0U) : 0U), noEventSort_(inputType == InputType::Primary ? pset.getUntrackedParameter<bool>("noEventSort", true) : false), skipBadFiles_(pset.getUntrackedParameter<bool>("skipBadFiles", false)), treeCacheSize_(noEventSort_ ? pset.getUntrackedParameter<unsigned int>("cacheSize", roottree::defaultCacheSize) : 0U), treeMaxVirtualSize_(pset.getUntrackedParameter<int>("treeMaxVirtualSize", -1)), setRun_(pset.getUntrackedParameter<unsigned int>("setRunNumber", 0U)), groupSelectorRules_(pset, "inputCommands", "InputSource"), duplicateChecker_(inputType == InputType::Primary ? new DuplicateChecker(pset) : 0), dropDescendants_(pset.getUntrackedParameter<bool>("dropDescendantsOfDroppedBranches", inputType != InputType::SecondarySource)), labelRawDataLikeMC_(pset.getUntrackedParameter<bool>("labelRawDataLikeMC", true)), usingGoToEvent_(false), enablePrefetching_(false), usedFallback_(false) { // The SiteLocalConfig controls the TTreeCache size and the prefetching settings. Service<SiteLocalConfig> pSLC; if(pSLC.isAvailable()) { if(treeCacheSize_ != 0U && pSLC->sourceTTreeCacheSize()) { treeCacheSize_ = *(pSLC->sourceTTreeCacheSize()); } enablePrefetching_ = pSLC->enablePrefetching(); } if(inputType_ == InputType::Primary) { //NOTE: we do not want to stage in secondary files since we can be given a list of // thousands of files and prestaging all those files can cause a site to fail StorageFactory *factory = StorageFactory::get(); for(fileIter_ = fileIterBegin_; fileIter_ != fileIterEnd_; ++fileIter_) { factory->activateTimeout(fileIter_->fileName()); factory->stagein(fileIter_->fileName()); } } std::string parametersMustMatch = pset.getUntrackedParameter<std::string>("parametersMustMatch", std::string("permissive")); if(parametersMustMatch == std::string("strict")) parametersMustMatch_ = BranchDescription::Strict; std::string branchesMustMatch = pset.getUntrackedParameter<std::string>("branchesMustMatch", std::string("permissive")); if(branchesMustMatch == std::string("strict")) branchesMustMatch_ = BranchDescription::Strict; if(inputType != InputType::SecondarySource) { for(fileIter_ = fileIterBegin_; fileIter_ != fileIterEnd_; ++fileIter_) { initFile(skipBadFiles_); if(rootFile_) break; } if(rootFile_) { productRegistryUpdate().updateFromInput(rootFile_->productRegistry()->productList()); if(initialNumberOfEventsToSkip_ != 0) { skipEvents(initialNumberOfEventsToSkip_); } } } }
edm::RootInputFileSequence::~RootInputFileSequence | ( | ) | [virtual] |
Definition at line 347 of file RootInputFileSequence.cc.
{ }
edm::RootInputFileSequence::RootInputFileSequence | ( | RootInputFileSequence const & | ) |
void edm::RootInputFileSequence::closeFile_ | ( | ) |
Definition at line 139 of file RootInputFileSequence.cc.
References duplicateChecker_, input_, inputType_, lfn_, edm::InputType::Primary, rootFile_, edm::InputType::SecondarySource, and usedFallback_.
Referenced by endJob(), initFile(), and rewind_().
{ // close the currently open file, if any, and delete the RootFile object. if(rootFile_) { if(inputType_ != InputType::SecondarySource) { std::unique_ptr<InputSource::FileCloseSentry> sentry((inputType_ == InputType::Primary) ? new InputSource::FileCloseSentry(input_, lfn_, usedFallback_) : 0); rootFile_->close(); if(duplicateChecker_) duplicateChecker_->inputFileClosed(); } rootFile_.reset(); } }
void edm::RootInputFileSequence::dropUnwantedBranches_ | ( | std::vector< std::string > const & | wantedBranches | ) |
Definition at line 581 of file RootInputFileSequence.cc.
References edm::ParameterSet::addUntrackedParameter(), groupSelectorRules_, and cmsCodeRulesChecker::rules.
{ std::vector<std::string> rules; rules.reserve(wantedBranches.size() + 1); rules.emplace_back("drop *"); for(std::vector<std::string>::const_iterator it = wantedBranches.begin(), itEnd = wantedBranches.end(); it != itEnd; ++it) { rules.push_back("keep " + *it + "_*"); } ParameterSet pset; pset.addUntrackedParameter("inputCommands", rules); groupSelectorRules_ = GroupSelectorRules(pset, "inputCommands", "InputSource"); }
void edm::RootInputFileSequence::endJob | ( | void | ) |
boost::shared_ptr< BranchIDListHelper const > edm::RootInputFileSequence::fileBranchIDListHelper | ( | ) | const |
Definition at line 291 of file RootInputFileSequence.cc.
References rootFile_.
std::vector< FileCatalogItem > const & edm::RootInputFileSequence::fileCatalogItems | ( | ) | const [private] |
Definition at line 111 of file RootInputFileSequence.cc.
References catalog_, and edm::InputFileCatalog::fileCatalogItems().
Referenced by readOneRandom().
{ return catalog_.fileCatalogItems(); }
boost::shared_ptr< ProductRegistry const > edm::RootInputFileSequence::fileProductRegistry | ( | ) | const |
Definition at line 285 of file RootInputFileSequence.cc.
References rootFile_.
void edm::RootInputFileSequence::fillDescription | ( | ParameterSetDescription & | desc | ) | [static] |
Definition at line 739 of file RootInputFileSequence.cc.
References edm::ParameterSetDescription::addUntracked(), edm::roottree::defaultCacheSize, and AlCaHLTBitMon_QueryRunRegistry::string.
{ desc.addUntracked<unsigned int>("skipEvents", 0U) ->setComment("Skip the first 'skipEvents' events that otherwise would have been processed."); desc.addUntracked<bool>("noEventSort", true) ->setComment("True: Process runs, lumis and events in the order they appear in the file (but see notes 1 and 2).\n" "False: Process runs, lumis and events in each file in numerical order (run#, lumi#, event#) (but see note 3).\n" "Note 1: Events within the same lumi will always be processed contiguously.\n" "Note 2: Lumis within the same run will always be processed contiguously.\n" "Note 3: Any sorting occurs independently in each input file (no sorting across input files)."); desc.addUntracked<bool>("skipBadFiles", false) ->setComment("True: Ignore any missing or unopenable input file.\n" "False: Throw exception if missing or unopenable input file."); desc.addUntracked<unsigned int>("cacheSize", roottree::defaultCacheSize) ->setComment("Size of ROOT TTree prefetch cache. Affects performance."); desc.addUntracked<int>("treeMaxVirtualSize", -1) ->setComment("Size of ROOT TTree TBasket cache. Affects performance."); desc.addUntracked<unsigned int>("setRunNumber", 0U) ->setComment("If non-zero, change number of first run to this number. Apply same offset to all runs. Allowed only for simulation."); desc.addUntracked<bool>("dropDescendantsOfDroppedBranches", true) ->setComment("If True, also drop on input any descendent of any branch dropped on input."); std::string defaultString("permissive"); desc.addUntracked<std::string>("parametersMustMatch", defaultString) ->setComment("'strict': Values of tracked parameters must be unique across all input files.\n" "'permissive': Values of tracked parameters may differ across or within files."); desc.addUntracked<std::string>("branchesMustMatch", defaultString) ->setComment("'strict': Branches in each input file must match those in the first file.\n" "'permissive': Branches in each input file may be any subset of those in the first file."); desc.addUntracked<bool>("labelRawDataLikeMC", true) ->setComment("If True: replace module label for raw data to match MC. Also use 'LHC' as process."); GroupSelectorRules::fillDescription(desc, "inputCommands"); EventSkipperByID::fillDescription(desc); DuplicateChecker::fillDescription(desc); }
ProcessingController::ForwardState edm::RootInputFileSequence::forwardState | ( | ) | const |
Definition at line 775 of file RootInputFileSequence.cc.
References fileIter_, fileIterEnd_, edm::ProcessingController::kAtLastEvent, edm::ProcessingController::kEventsAheadInFile, edm::ProcessingController::kNextFileExists, edm::ProcessingController::kUnknownForward, and rootFile_.
{ if(rootFile_) { if(!rootFile_->wasLastEventJustRead()) { return ProcessingController::kEventsAheadInFile; } std::vector<FileCatalogItem>::const_iterator itr(fileIter_); if(itr != fileIterEnd_) ++itr; if(itr != fileIterEnd_) { return ProcessingController::kNextFileExists; } return ProcessingController::kAtLastEvent; } return ProcessingController::kUnknownForward; }
InputSource::ItemType edm::RootInputFileSequence::getNextItemType | ( | ) |
Definition at line 389 of file RootInputFileSequence.cc.
References fileIter_, fileIterEnd_, firstFile_, edm::InputSource::IsEvent, edm::InputSource::IsFile, edm::InputSource::IsLumi, edm::InputSource::IsRun, edm::InputSource::IsStop, edm::IndexIntoFile::kEnd, edm::IndexIntoFile::kEvent, edm::IndexIntoFile::kLumi, edm::IndexIntoFile::kRun, and rootFile_.
{ if(fileIter_ == fileIterEnd_) { return InputSource::IsStop; } if(firstFile_) { return InputSource::IsFile; } if(rootFile_) { IndexIntoFile::EntryType entryType = rootFile_->getNextEntryTypeWanted(); if(entryType == IndexIntoFile::kEvent) { return InputSource::IsEvent; } else if(entryType == IndexIntoFile::kLumi) { return InputSource::IsLumi; } else if(entryType == IndexIntoFile::kRun) { return InputSource::IsRun; } assert(entryType == IndexIntoFile::kEnd); } if(fileIter_ + 1 == fileIterEnd_) { return InputSource::IsStop; } return InputSource::IsFile; }
bool edm::RootInputFileSequence::goToEvent | ( | EventID const & | eventID | ) |
Definition at line 455 of file RootInputFileSequence.cc.
References edm::EventID::event(), fileIter_, fileIterBegin_, newFWLiteAna::found, indexesIntoFiles_, initFile(), edm::EventID::luminosityBlock(), rootFile_, edm::EventID::run(), and usingGoToEvent_.
{ usingGoToEvent_ = true; if(rootFile_) { if(rootFile_->goToEvent(eventID)) { return true; } // If only one input file, give up now, to save time. if(rootFile_ && indexesIntoFiles_.size() == 1) { return false; } // Save the current file and position so that we can restore them // if we fail to restore the desired event bool closedOriginalFile = false; std::vector<FileCatalogItem>::const_iterator originalFile = fileIter_; IndexIntoFile::IndexIntoFileItr originalPosition = rootFile_->indexIntoFileIter(); // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files. typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter; for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) { if(*it && (*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) { // We found it. Close the currently open file, and open the correct one. fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin()); initFile(false); // Now get the item from the correct file. bool found = rootFile_->goToEvent(eventID); assert (found); return true; } } // Look for item in files not yet opened. for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) { if(!*it) { fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin()); initFile(false); closedOriginalFile = true; if((*it)->containsItem(eventID.run(), eventID.luminosityBlock(), eventID.event())) { if (rootFile_->goToEvent(eventID)) { return true; } } } } if(closedOriginalFile) { fileIter_ = originalFile; initFile(false); rootFile_->setPosition(originalPosition); } } return false; }
void edm::RootInputFileSequence::initFile | ( | bool | skipBadFiles | ) | [private] |
Definition at line 152 of file RootInputFileSequence.cc.
References edm::InputSource::branchIDListHelper(), closeFile_(), dropDescendants_, duplicateChecker_, alignCSCRings::e, enablePrefetching_, eventSkipperByID_, Exception, cms::Exception::explainSelf(), edm::errors::FallbackFileOpenError, fileIter_, fileIterBegin_, fileIterEnd_, fileIterLastOpened_, edm::errors::FileOpenError, groupSelectorRules_, indexesIntoFiles_, initialNumberOfEventsToSkip_, input_, RPC_Client_on_RootFile::InputFile, inputType_, labelRawDataLikeMC_, lfn_, noEventSort_, orderedProcessHistoryIDs_, dbtoconf::out, dbtoconf::pfn, edm::InputType::Primary, processConfiguration(), edm::InputSource::processingMode(), remainingEvents(), remainingLuminosityBlocks(), edm::InputFile::reportFallbackAttempt(), edm::InputFile::reportSkippedFile(), rootFile_, edm::InputType::SecondaryFile, edm::InputType::SecondarySource, setRun_, AlCaHLTBitMon_QueryRunRegistry::string, treeCacheSize_, treeMaxVirtualSize_, usedFallback_, and usingGoToEvent_.
Referenced by goToEvent(), nextFile(), previousFile(), readFile_(), readOneRandom(), readOneSequential(), rewind_(), RootInputFileSequence(), skipToItem(), and skipToItemInNewFile().
{ // We are really going to close the open file. // If this is the primary sequence, we are not duplicate checking across files // and we are not using random access to find events, then we can delete the // IndexIntoFile for the file we are closing. If we can't delete all of it, // then we can delete the parts we do not need. if(fileIterLastOpened_ != fileIterEnd_) { size_t currentIndexIntoFile = fileIterLastOpened_ - fileIterBegin_; bool needIndexesForDuplicateChecker = duplicateChecker_ && duplicateChecker_->checkingAllFiles() && !duplicateChecker_->checkDisabled(); bool deleteIndexIntoFile = inputType_ == InputType::Primary && !needIndexesForDuplicateChecker && !usingGoToEvent_; if(deleteIndexIntoFile) { indexesIntoFiles_[currentIndexIntoFile].reset(); } else { if(indexesIntoFiles_[currentIndexIntoFile]) indexesIntoFiles_[currentIndexIntoFile]->inputFileClosed(); } fileIterLastOpened_ = fileIterEnd_; } closeFile_(); if(fileIter_ == fileIterEnd_) { // No files specified return; } // Check if the logical file name was found. if(fileIter_->fileName().empty()) { // LFN not found in catalog. InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName()); if(!skipBadFiles) { throw cms::Exception("LogicalFileNameNotFound", "RootInputFileSequence::initFile()\n") << "Logical file name '" << fileIter_->logicalFileName() << "' was not found in the file catalog.\n" << "If you wanted a local file, you forgot the 'file:' prefix\n" << "before the file name in your configuration file.\n"; } LogWarning("") << "Input logical file: " << fileIter_->logicalFileName() << " was not found in the catalog, and will be skipped.\n"; return; } lfn_ = fileIter_->logicalFileName().empty() ? fileIter_->fileName() : fileIter_->logicalFileName(); // Determine whether we have a fallback URL specified; if so, prepare it; // Only valid if it is non-empty and differs from the original filename. std::string fallbackName = fileIter_->fallbackFileName(); bool hasFallbackUrl = !fallbackName.empty() && fallbackName != fileIter_->fileName(); boost::shared_ptr<InputFile> filePtr; try { std::unique_ptr<InputSource::FileOpenSentry> sentry(inputType_ == InputType::Primary ? new InputSource::FileOpenSentry(input_) : 0); filePtr.reset(new InputFile(gSystem->ExpandPathName(fileIter_->fileName().c_str()), " Initiating request to open file ")); } catch (cms::Exception const& e) { if(!skipBadFiles) { if(hasFallbackUrl) { std::ostringstream out; out << e.explainSelf(); std::string pfn(gSystem->ExpandPathName(fallbackName.c_str())); InputFile::reportFallbackAttempt(pfn, fileIter_->logicalFileName(), out.str()); } else { InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName()); Exception ex(errors::FileOpenError, "", e); ex.addContext("Calling RootInputFileSequence::initFile()"); std::ostringstream out; out << "Input file " << fileIter_->fileName() << " could not be opened."; ex.addAdditionalInfo(out.str()); throw ex; } } } if(!filePtr && (hasFallbackUrl)) { try { std::unique_ptr<InputSource::FileOpenSentry> sentry(inputType_ == InputType::Primary ? new InputSource::FileOpenSentry(input_) : 0); filePtr.reset(new InputFile(gSystem->ExpandPathName(fallbackName.c_str()), " Fallback request to file ")); usedFallback_ = true; } catch (cms::Exception const& e) { if(!skipBadFiles) { InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName()); Exception ex(errors::FallbackFileOpenError, "", e); ex.addContext("Calling RootInputFileSequence::initFile()"); std::ostringstream out; out << "Input file " << fileIter_->fileName() << " could not be opened.\n"; out << "Fallback Input file " << fallbackName << " also could not be opened."; ex.addAdditionalInfo(out.str()); throw ex; } } } if(filePtr) { std::vector<boost::shared_ptr<IndexIntoFile> >::size_type currentIndexIntoFile = fileIter_ - fileIterBegin_; rootFile_ = RootFileSharedPtr(new RootFile(fileIter_->fileName(), processConfiguration(), fileIter_->logicalFileName(), filePtr, eventSkipperByID_, initialNumberOfEventsToSkip_ != 0, remainingEvents(), remainingLuminosityBlocks(), treeCacheSize_, treeMaxVirtualSize_, input_.processingMode(), setRun_, noEventSort_, groupSelectorRules_, inputType_, (inputType_ == InputType::SecondarySource ? boost::shared_ptr<BranchIDListHelper>(new BranchIDListHelper()) : input_.branchIDListHelper()), duplicateChecker_, dropDescendants_, indexesIntoFiles_, currentIndexIntoFile, orderedProcessHistoryIDs_, labelRawDataLikeMC_, usingGoToEvent_, enablePrefetching_)); fileIterLastOpened_ = fileIter_; indexesIntoFiles_[currentIndexIntoFile] = rootFile_->indexIntoFileSharedPtr(); char const* inputType = 0; switch(inputType_) { case InputType::Primary: inputType = "primaryFiles"; break; case InputType::SecondaryFile: inputType = "secondaryFiles"; break; case InputType::SecondarySource: inputType = "mixingFiles"; break; } rootFile_->reportOpened(inputType); } else { InputFile::reportSkippedFile(fileIter_->fileName(), fileIter_->logicalFileName()); if(!skipBadFiles) { throw Exception(errors::FileOpenError) << "RootInputFileSequence::initFile(): Input file " << fileIter_->fileName() << " was not found or could not be opened.\n"; } LogWarning("") << "Input file: " << fileIter_->fileName() << " was not found or could not be opened, and will be skipped.\n"; } }
bool edm::RootInputFileSequence::nextFile | ( | ) | [private] |
Definition at line 296 of file RootInputFileSequence.cc.
References branchesMustMatch_, Exception, fileIter_, fileIterBegin_, fileIterEnd_, initFile(), inputType_, edm::ProductRegistry::merge(), edm::errors::MismatchedInputFiles, parametersMustMatch_, edm::InputType::Primary, productRegistryUpdate(), rootFile_, skipBadFiles_, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by readFile_(), and skipEvents().
{ if(fileIter_ != fileIterEnd_) ++fileIter_; if(fileIter_ == fileIterEnd_) { if(inputType_ == InputType::Primary) { return false; } else { fileIter_ = fileIterBegin_; } } initFile(skipBadFiles_); if(inputType_ == InputType::Primary && rootFile_) { // make sure the new product registry is compatible with the main one std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(), fileIter_->fileName(), parametersMustMatch_, branchesMustMatch_); if(!mergeInfo.empty()) { throw Exception(errors::MismatchedInputFiles,"RootInputFileSequence::nextFile()") << mergeInfo; } } return true; }
RootInputFileSequence& edm::RootInputFileSequence::operator= | ( | RootInputFileSequence const & | ) |
bool edm::RootInputFileSequence::previousFile | ( | ) | [private] |
Definition at line 321 of file RootInputFileSequence.cc.
References branchesMustMatch_, Exception, fileIter_, fileIterBegin_, fileIterEnd_, initFile(), inputType_, edm::ProductRegistry::merge(), edm::errors::MismatchedInputFiles, parametersMustMatch_, edm::InputType::Primary, productRegistryUpdate(), rootFile_, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by skipEvents().
{ if(fileIter_ == fileIterBegin_) { if(inputType_ == InputType::Primary) { return false; } else { fileIter_ = fileIterEnd_; } } --fileIter_; initFile(false); if(inputType_ == InputType::Primary && rootFile_) { // make sure the new product registry is compatible to the main one std::string mergeInfo = productRegistryUpdate().merge(*rootFile_->productRegistry(), fileIter_->fileName(), parametersMustMatch_, branchesMustMatch_); if(!mergeInfo.empty()) { throw Exception(errors::MismatchedInputFiles,"RootInputFileSequence::previousEvent()") << mergeInfo; } } if(rootFile_) rootFile_->setToLastEntry(); return true; }
ProcessConfiguration const & edm::RootInputFileSequence::processConfiguration | ( | ) | const [private] |
Definition at line 556 of file RootInputFileSequence.cc.
References input_, and edm::InputSource::processConfiguration().
Referenced by initFile().
{ return input_.processConfiguration(); }
boost::shared_ptr< ProductRegistry const > edm::RootInputFileSequence::productRegistry | ( | ) | const [private] |
Definition at line 576 of file RootInputFileSequence.cc.
References input_, and edm::InputSource::productRegistry().
{ return input_.productRegistry(); }
ProductRegistry & edm::RootInputFileSequence::productRegistryUpdate | ( | ) | const [private] |
Definition at line 571 of file RootInputFileSequence.cc.
References input_, and edm::InputSource::productRegistryUpdate().
Referenced by nextFile(), previousFile(), and RootInputFileSequence().
{ return input_.productRegistryUpdate(); }
EventPrincipal * edm::RootInputFileSequence::readEvent | ( | EventPrincipal & | cache | ) |
Definition at line 384 of file RootInputFileSequence.cc.
References rootFile_.
{ return rootFile_->readEvent(eventPrincipal); }
boost::shared_ptr< FileBlock > edm::RootInputFileSequence::readFile_ | ( | ) |
Definition at line 121 of file RootInputFileSequence.cc.
References firstFile_, initFile(), nextFile(), rootFile_, and skipBadFiles_.
{ if(firstFile_) { // The first input file has already been opened. firstFile_ = false; if(!rootFile_) { initFile(skipBadFiles_); } } else { if(!nextFile()) { assert(0); } } if(!rootFile_) { return boost::shared_ptr<FileBlock>(new FileBlock); } return rootFile_->createFileBlock(); }
boost::shared_ptr< LuminosityBlockPrincipal > edm::RootInputFileSequence::readLuminosityBlock_ | ( | boost::shared_ptr< LuminosityBlockPrincipal > | lumiPrincipal | ) |
Definition at line 366 of file RootInputFileSequence.cc.
References rootFile_.
{ return rootFile_->readLumi(lumiPrincipal); }
boost::shared_ptr< LuminosityBlockAuxiliary > edm::RootInputFileSequence::readLuminosityBlockAuxiliary_ | ( | ) |
Definition at line 356 of file RootInputFileSequence.cc.
References rootFile_.
{ return rootFile_->readLuminosityBlockAuxiliary_(); }
EventPrincipal * edm::RootInputFileSequence::readOneRandom | ( | ) |
Definition at line 660 of file RootInputFileSequence.cc.
References edm::errors::Configuration, eventsRemainingInFile_, Exception, fileCatalogItems(), fileIter_, fileIterBegin_, fileIterEnd_, flatDistribution_, initFile(), edm::errors::NotFound, rootFile_, findQualityFiles::size, and skipBadFiles_.
{ if(fileIterEnd_ == fileIterBegin_) { throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandom(): no input files specified.\n"; } if(!flatDistribution_) { Service<RandomNumberGenerator> rng; CLHEP::HepRandomEngine& engine = rng->getEngine(); flatDistribution_.reset(new CLHEP::RandFlat(engine)); } skipBadFiles_ = false; unsigned int currentSeqNumber = fileIter_ - fileIterBegin_; while(eventsRemainingInFile_ == 0) { fileIter_ = fileIterBegin_ + flatDistribution_->fireInt(fileCatalogItems().size()); unsigned int newSeqNumber = fileIter_ - fileIterBegin_; if(newSeqNumber != currentSeqNumber) { initFile(false); currentSeqNumber = newSeqNumber; } eventsRemainingInFile_ = rootFile_->eventTree().entries(); if(eventsRemainingInFile_ == 0) { throw Exception(errors::NotFound) << "RootInputFileSequence::readOneRandom(): Secondary Input file " << fileIter_->fileName() << " contains no events.\n"; } rootFile_->setAtEventEntry(flatDistribution_->fireInt(eventsRemainingInFile_) - 1); } rootFile_->nextEventEntry(); EventPrincipal* ep = rootFile_->clearAndReadCurrentEvent(rootFile_->secondaryEventPrincipal()); if(ep == 0) { rootFile_->setAtEventEntry(0); ep = rootFile_->clearAndReadCurrentEvent(rootFile_->secondaryEventPrincipal()); assert(ep != 0); } --eventsRemainingInFile_; return ep; }
EventPrincipal * edm::RootInputFileSequence::readOneRandomWithID | ( | LuminosityBlockID const & | id | ) |
Definition at line 700 of file RootInputFileSequence.cc.
References edm::errors::Configuration, Exception, fileIter_, fileIterBegin_, fileIterEnd_, flatDistribution_, newFWLiteAna::found, i, rootFile_, DTTTrigCorrFirst::run, skipBadFiles_, and skipToItem().
{ if(fileIterEnd_ == fileIterBegin_) { throw Exception(errors::Configuration) << "RootInputFileSequence::readOneRandomWithID(): no input files specified.\n"; } if(!flatDistribution_) { Service<RandomNumberGenerator> rng; CLHEP::HepRandomEngine& engine = rng->getEngine(); flatDistribution_.reset(new CLHEP::RandFlat(engine)); } skipBadFiles_ = false; if(fileIter_ == fileIterEnd_ || !rootFile_ || rootFile_->indexIntoFileIter().run() != id.run() || rootFile_->indexIntoFileIter().lumi() != id.luminosityBlock()) { bool found = skipToItem(id.run(), id.luminosityBlock(), 0); if(!found) { return 0; } int eventsInLumi = 0; while(rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock())) ++eventsInLumi; found = skipToItem(id.run(), id.luminosityBlock(), 0); assert(found); int eventInLumi = flatDistribution_->fireInt(eventsInLumi); for(int i = 0; i < eventInLumi; ++i) { bool found = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock()); assert(found); } } bool nextFound = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock()); EventPrincipal* ep = (nextFound ? rootFile_->clearAndReadCurrentEvent(rootFile_->secondaryEventPrincipal()) : 0); if(ep == 0) { bool found = rootFile_->setEntryAtItem(id.run(), id.luminosityBlock(), 0); if(found) { return readOneRandomWithID(id); } } return ep; }
EventPrincipal * edm::RootInputFileSequence::readOneSequential | ( | ) |
Definition at line 595 of file RootInputFileSequence.cc.
References edm::errors::Configuration, Exception, fileIter_, fileIterBegin_, fileIterEnd_, initFile(), rootFile_, and skipBadFiles_.
{ skipBadFiles_ = false; if(fileIter_ == fileIterEnd_ || !rootFile_) { if(fileIterEnd_ == fileIterBegin_) { throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequential(): no input files specified.\n"; } fileIter_ = fileIterBegin_; initFile(false); rootFile_->setAtEventEntry(-1); } rootFile_->nextEventEntry(); EventPrincipal* ep = rootFile_->clearAndReadCurrentEvent(rootFile_->secondaryEventPrincipal()); if(ep == 0) { ++fileIter_; if(fileIter_ == fileIterEnd_) { return 0; } initFile(false); rootFile_->setAtEventEntry(-1); return readOneSequential(); } return ep; }
EventPrincipal * edm::RootInputFileSequence::readOneSequentialWithID | ( | LuminosityBlockID const & | id | ) |
Definition at line 620 of file RootInputFileSequence.cc.
References edm::errors::Configuration, Exception, fileIter_, fileIterBegin_, fileIterEnd_, newFWLiteAna::found, rootFile_, DTTTrigCorrFirst::run, skipBadFiles_, skipToItem(), and skipToItemInNewFile().
{ if(fileIterEnd_ == fileIterBegin_) { throw Exception(errors::Configuration) << "RootInputFileSequence::readOneSequentialWithID(): no input files specified.\n"; } skipBadFiles_ = false; if(fileIter_ == fileIterEnd_ || !rootFile_ || rootFile_->indexIntoFileIter().run() != id.run() || rootFile_->indexIntoFileIter().lumi() != id.luminosityBlock()) { bool found = skipToItem(id.run(), id.luminosityBlock(), 0, false); if(!found) { return 0; } } bool nextFound = rootFile_->setEntryAtNextEventInLumi(id.run(), id.luminosityBlock()); EventPrincipal* ep = (nextFound ? rootFile_->clearAndReadCurrentEvent(rootFile_->secondaryEventPrincipal()) : 0); if(ep == 0) { bool found = skipToItemInNewFile(id.run(), id.luminosityBlock(), 0); if(found) { return readOneSequentialWithID(id); } } return ep; }
EventPrincipal * edm::RootInputFileSequence::readOneSpecified | ( | EventID const & | id | ) |
Definition at line 645 of file RootInputFileSequence.cc.
References event(), Exception, fileIter_, newFWLiteAna::found, edm::errors::NotFound, rootFile_, DTTTrigCorrFirst::run, skipBadFiles_, and skipToItem().
{ skipBadFiles_ = false; bool found = skipToItem(id.run(), id.luminosityBlock(), id.event()); if(!found) { throw Exception(errors::NotFound) << "RootInputFileSequence::readOneSpecified(): Secondary Input file " << fileIter_->fileName() << " does not contain specified event:\n" << id << "\n"; } EventPrincipal* ep = rootFile_->clearAndReadCurrentEvent(rootFile_->secondaryEventPrincipal()); assert(ep != 0); return ep; }
boost::shared_ptr< RunPrincipal > edm::RootInputFileSequence::readRun_ | ( | boost::shared_ptr< RunPrincipal > | runPrincipal | ) |
Definition at line 361 of file RootInputFileSequence.cc.
References rootFile_.
{ return rootFile_->readRun_(runPrincipal); }
boost::shared_ptr< RunAuxiliary > edm::RootInputFileSequence::readRunAuxiliary_ | ( | ) |
Definition at line 351 of file RootInputFileSequence.cc.
References rootFile_.
{ return rootFile_->readRunAuxiliary_(); }
int edm::RootInputFileSequence::remainingEvents | ( | ) | const [private] |
Definition at line 561 of file RootInputFileSequence.cc.
References input_, and edm::InputSource::remainingEvents().
Referenced by initFile().
{ return input_.remainingEvents(); }
int edm::RootInputFileSequence::remainingLuminosityBlocks | ( | ) | const [private] |
Definition at line 566 of file RootInputFileSequence.cc.
References input_, and edm::InputSource::remainingLuminosityBlocks().
Referenced by initFile().
{ return input_.remainingLuminosityBlocks(); }
ProcessingController::ReverseState edm::RootInputFileSequence::reverseState | ( | ) | const |
Definition at line 791 of file RootInputFileSequence.cc.
References fileIter_, fileIterBegin_, edm::ProcessingController::kAtFirstEvent, edm::ProcessingController::kEventsBackwardsInFile, edm::ProcessingController::kPreviousFileExists, edm::ProcessingController::kUnknownReverse, and rootFile_.
{ if(rootFile_) { if(!rootFile_->wasFirstEventJustRead()) { return ProcessingController::kEventsBackwardsInFile; } if(fileIter_ != fileIterBegin_) { return ProcessingController::kPreviousFileExists; } return ProcessingController::kAtFirstEvent; } return ProcessingController::kUnknownReverse; }
void edm::RootInputFileSequence::rewind_ | ( | ) |
Definition at line 415 of file RootInputFileSequence.cc.
References closeFile_(), fileIter_, fileIterBegin_, firstFile_, initFile(), initialNumberOfEventsToSkip_, rewindFile(), rootFile_, and skipEvents().
{ if(fileIter_ != fileIterBegin_) { closeFile_(); fileIter_ = fileIterBegin_; } if(!rootFile_) { initFile(false); } rewindFile(); firstFile_ = true; if(rootFile_) { if(initialNumberOfEventsToSkip_ != 0) { skipEvents(initialNumberOfEventsToSkip_); } } }
void edm::RootInputFileSequence::rewindFile | ( | ) | [private] |
bool edm::RootInputFileSequence::skipEvents | ( | int | offset | ) |
Definition at line 440 of file RootInputFileSequence.cc.
References fileIter_, fileIterEnd_, nextFile(), previousFile(), and rootFile_.
Referenced by rewind_(), and RootInputFileSequence().
{ while(offset != 0) { bool atEnd = rootFile_->skipEvents(offset); if((offset > 0 || atEnd) && !nextFile()) { return false; } if(offset < 0 && !previousFile()) { fileIter_ = fileIterEnd_; return false; } } return true; }
bool edm::RootInputFileSequence::skipToItem | ( | RunNumber_t | run, |
LuminosityBlockNumber_t | lumi, | ||
EventNumber_t | event, | ||
bool | currentFileFirst = true |
||
) |
Definition at line 525 of file RootInputFileSequence.cc.
References fileIter_, fileIterBegin_, newFWLiteAna::found, indexesIntoFiles_, initFile(), rootFile_, and skipToItemInNewFile().
Referenced by readOneRandomWithID(), readOneSequentialWithID(), and readOneSpecified().
{ // Attempt to find item in currently open input file. bool found = currentFileFirst && rootFile_ && rootFile_->setEntryAtItem(run, lumi, event); if(!found) { // If only one input file, give up now, to save time. if(currentFileFirst && rootFile_ && indexesIntoFiles_.size() == 1) { return false; } // Look for item (run/lumi/event) in files previously opened without reopening unnecessary files. typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter; for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) { if(*it && (*it)->containsItem(run, lumi, event)) { // We found it. Close the currently open file, and open the correct one. std::vector<FileCatalogItem>::const_iterator currentIter = fileIter_; fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin()); if(fileIter_ != currentIter) { initFile(false); } // Now get the item from the correct file. found = rootFile_->setEntryAtItem(run, lumi, event); assert (found); return true; } } // Look for item in files not yet opened. return skipToItemInNewFile(run, lumi, event); } return true; }
bool edm::RootInputFileSequence::skipToItemInNewFile | ( | RunNumber_t | run, |
LuminosityBlockNumber_t | lumi, | ||
EventNumber_t | event | ||
) |
Definition at line 507 of file RootInputFileSequence.cc.
References fileIter_, fileIterBegin_, newFWLiteAna::found, indexesIntoFiles_, initFile(), and rootFile_.
Referenced by readOneSequentialWithID(), and skipToItem().
{ // Look for item in files not yet opened. typedef std::vector<boost::shared_ptr<IndexIntoFile> >::const_iterator Iter; for(Iter it = indexesIntoFiles_.begin(), itEnd = indexesIntoFiles_.end(); it != itEnd; ++it) { if(!*it) { fileIter_ = fileIterBegin_ + (it - indexesIntoFiles_.begin()); initFile(false); bool found = rootFile_->setEntryAtItem(run, lumi, event); if(found) { return true; } } } // Not found return false; }
Definition at line 97 of file RootInputFileSequence.h.
Referenced by nextFile(), previousFile(), and RootInputFileSequence().
InputFileCatalog const& edm::RootInputFileSequence::catalog_ [private] |
Definition at line 88 of file RootInputFileSequence.h.
Referenced by fileCatalogItems().
bool edm::RootInputFileSequence::dropDescendants_ [private] |
Definition at line 113 of file RootInputFileSequence.h.
Referenced by initFile().
boost::shared_ptr<DuplicateChecker> edm::RootInputFileSequence::duplicateChecker_ [private] |
Definition at line 112 of file RootInputFileSequence.h.
Referenced by closeFile_(), and initFile().
bool edm::RootInputFileSequence::enablePrefetching_ [private] |
Definition at line 116 of file RootInputFileSequence.h.
Referenced by initFile(), and RootInputFileSequence().
boost::shared_ptr<EventSkipperByID> edm::RootInputFileSequence::eventSkipperByID_ [private] |
Definition at line 103 of file RootInputFileSequence.h.
Referenced by initFile().
int edm::RootInputFileSequence::eventsRemainingInFile_ [private] |
Definition at line 104 of file RootInputFileSequence.h.
Referenced by readOneRandom().
std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIter_ [private] |
Definition at line 93 of file RootInputFileSequence.h.
Referenced by forwardState(), getNextItemType(), goToEvent(), initFile(), nextFile(), previousFile(), readOneRandom(), readOneRandomWithID(), readOneSequential(), readOneSequentialWithID(), readOneSpecified(), reverseState(), rewind_(), RootInputFileSequence(), skipEvents(), skipToItem(), and skipToItemInNewFile().
std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIterBegin_ [private] |
Definition at line 91 of file RootInputFileSequence.h.
Referenced by goToEvent(), initFile(), nextFile(), previousFile(), readOneRandom(), readOneRandomWithID(), readOneSequential(), readOneSequentialWithID(), reverseState(), rewind_(), RootInputFileSequence(), skipToItem(), and skipToItemInNewFile().
std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIterEnd_ [private] |
Definition at line 92 of file RootInputFileSequence.h.
Referenced by forwardState(), getNextItemType(), initFile(), nextFile(), previousFile(), readOneRandom(), readOneRandomWithID(), readOneSequential(), readOneSequentialWithID(), RootInputFileSequence(), and skipEvents().
std::vector<FileCatalogItem>::const_iterator edm::RootInputFileSequence::fileIterLastOpened_ [private] |
Definition at line 94 of file RootInputFileSequence.h.
Referenced by initFile().
bool edm::RootInputFileSequence::firstFile_ [private] |
Definition at line 89 of file RootInputFileSequence.h.
Referenced by getNextItemType(), readFile_(), and rewind_().
std::unique_ptr<CLHEP::RandFlat> edm::RootInputFileSequence::flatDistribution_ [private] |
Definition at line 99 of file RootInputFileSequence.h.
Referenced by readOneRandom(), and readOneRandomWithID().
Definition at line 111 of file RootInputFileSequence.h.
Referenced by dropUnwantedBranches_(), and initFile().
std::vector<boost::shared_ptr<IndexIntoFile> > edm::RootInputFileSequence::indexesIntoFiles_ [private] |
Definition at line 100 of file RootInputFileSequence.h.
Referenced by goToEvent(), initFile(), skipToItem(), and skipToItemInNewFile().
int edm::RootInputFileSequence::initialNumberOfEventsToSkip_ [private] |
Definition at line 105 of file RootInputFileSequence.h.
Referenced by initFile(), rewind_(), and RootInputFileSequence().
PoolSource const& edm::RootInputFileSequence::input_ [private] |
Definition at line 86 of file RootInputFileSequence.h.
Referenced by closeFile_(), initFile(), processConfiguration(), productRegistry(), productRegistryUpdate(), remainingEvents(), and remainingLuminosityBlocks().
Definition at line 87 of file RootInputFileSequence.h.
Referenced by closeFile_(), initFile(), nextFile(), previousFile(), and RootInputFileSequence().
bool edm::RootInputFileSequence::labelRawDataLikeMC_ [private] |
Definition at line 114 of file RootInputFileSequence.h.
Referenced by initFile().
std::string edm::RootInputFileSequence::lfn_ [private] |
Definition at line 90 of file RootInputFileSequence.h.
Referenced by closeFile_(), and initFile().
bool edm::RootInputFileSequence::noEventSort_ [private] |
Definition at line 106 of file RootInputFileSequence.h.
Referenced by initFile().
std::vector<ProcessHistoryID> edm::RootInputFileSequence::orderedProcessHistoryIDs_ [private] |
Definition at line 101 of file RootInputFileSequence.h.
Referenced by initFile().
Definition at line 96 of file RootInputFileSequence.h.
Referenced by nextFile(), previousFile(), and RootInputFileSequence().
Definition at line 95 of file RootInputFileSequence.h.
Referenced by closeFile_(), fileBranchIDListHelper(), fileProductRegistry(), forwardState(), getNextItemType(), goToEvent(), initFile(), nextFile(), previousFile(), readEvent(), readFile_(), readLuminosityBlock_(), readLuminosityBlockAuxiliary_(), readOneRandom(), readOneRandomWithID(), readOneSequential(), readOneSequentialWithID(), readOneSpecified(), readRun_(), readRunAuxiliary_(), reverseState(), rewind_(), rewindFile(), RootInputFileSequence(), skipEvents(), skipToItem(), and skipToItemInNewFile().
Definition at line 110 of file RootInputFileSequence.h.
Referenced by initFile().
bool edm::RootInputFileSequence::skipBadFiles_ [private] |
Definition at line 107 of file RootInputFileSequence.h.
Referenced by nextFile(), readFile_(), readOneRandom(), readOneRandomWithID(), readOneSequential(), readOneSequentialWithID(), readOneSpecified(), and RootInputFileSequence().
unsigned int edm::RootInputFileSequence::treeCacheSize_ [private] |
Definition at line 108 of file RootInputFileSequence.h.
Referenced by initFile(), and RootInputFileSequence().
int const edm::RootInputFileSequence::treeMaxVirtualSize_ [private] |
Definition at line 109 of file RootInputFileSequence.h.
Referenced by initFile().
bool edm::RootInputFileSequence::usedFallback_ [private] |
Definition at line 117 of file RootInputFileSequence.h.
Referenced by closeFile_(), and initFile().
bool edm::RootInputFileSequence::usingGoToEvent_ [private] |
Definition at line 115 of file RootInputFileSequence.h.
Referenced by goToEvent(), and initFile().