/
githubmirror
/
cmssw
Обзор
Документация
Войти
/
githubmirror
/
cmssw
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
IOPool/Input/src/RootSecondaryFileSequence.cc
99 строк
4 KB
W. David Dagenhart
Reduce the memory usage of the InputFileCatalog
18 май 2026, 23:53
18 май 2026, 23:53
7e6433c
Код
Авторство
О чём код?
/*---------------------------------------------------------------------- ----------------------------------------------------------------------*/ #include "DuplicateChecker.h" #include "PoolSource.h" #include "InputFile.h" #include "RootFile.h" #include "RootSecondaryFileSequence.h" #include "RootTree.h" #include "DataFormats/Provenance/interface/BranchID.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" #include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/ServiceRegistry/interface/Service.h" #include "FWStorage/Catalog/interface/SiteLocalConfig.h" #include "FWStorage/StorageFactory/interface/StorageFactory.h" namespace edm { RootSecondaryFileSequence::RootSecondaryFileSequence(ParameterSet const& pset, PoolSource& input, InputFileCatalog const& catalog) : RootInputFileSequence(pset, catalog), input_(input), orderedProcessHistoryIDs_(), enablePrefetching_(false), enforceGUIDInFileName_(pset.getUntrackedParameter<bool>("enforceGUIDInFileName")) { // The SiteLocalConfig controls the TTreeCache size and the prefetching settings. Service<SiteLocalConfig> pSLC; if (pSLC.isAvailable()) { enablePrefetching_ = pSLC->enablePrefetching(); } // Prestage the files //NOTE: we do not want to stage in all secondary files since we can be given a list of // thousands of files and prestaging all those files can cause a site to fail. // So, we stage in the first secondary file only. setAtFirstFile(); storage::StorageFactory::get()->stagein(physicalFileNames()[0]); // Open the first file. for (setAtFirstFile(); !noMoreFiles(); setAtNextFile()) { initFile(input_.skipBadFiles()); if (rootFile()) break; } if (rootFile()) { std::vector<std::string> processOrder; processingOrderMerge(input_.processHistoryRegistry(), processOrder); input_.productRegistryUpdate().updateFromInput(rootFile()->productRegistry()->productList(), processOrder); } } RootSecondaryFileSequence::~RootSecondaryFileSequence() {} void RootSecondaryFileSequence::endJob() { closeFile(); } void RootSecondaryFileSequence::closeFile_() { // close the currently open file, if any, and delete the RootFile object. if (rootFile()) { rootFile()->close(); rootFile().reset(); } } void RootSecondaryFileSequence::initFile_(bool skipBadFiles) { initTheFile(skipBadFiles, false, nullptr, "secondaryFiles", InputType::SecondaryFile); } RootSecondaryFileSequence::RootFileSharedPtr RootSecondaryFileSequence::makeRootFile( std::shared_ptr<InputFile> filePtr, std::string const& physicalFileNameFirstCatalog) { size_t currentIndexIntoFile = sequenceNumberOfFile(); return std::make_shared<RootFile>( RootFile::FileOptions{.fileName = physicalFileNameFirstCatalog, .logicalFileName = logicalFileName(), .filePtr = filePtr, .bypassVersionCheck = input_.bypassVersionCheck(), .enforceGUIDInFileName = enforceGUIDInFileName_}, InputType::SecondaryFile, RootFile::ProcessingOptions{ .processingMode = input_.processingMode(), }, RootFile::TTreeOptions{.treeMaxVirtualSize = input_.treeMaxVirtualSize(), .enablePrefetching = enablePrefetching_, .promptReading = not input_.delayReadingEventProducts()}, RootFile::ProductChoices{.productSelectorRules = input_.productSelectorRules(), .dropDescendantsOfDroppedProducts = input_.dropDescendants(), .labelRawDataLikeMC = input_.labelRawDataLikeMC()}, RootFile::CrossFileInfo{.runHelper = input_.runHelper(), .branchIDListHelper = input_.branchIDListHelper(), .indexesIntoFiles = indexesIntoFiles(), .currentIndexIntoFile = currentIndexIntoFile}, input_.nStreams(), input_.processHistoryRegistryForUpdate(), orderedProcessHistoryIDs_); } } // namespace edm