CMS 3D CMS Logo

RootSecondaryFileSequence.cc
Go to the documentation of this file.
1 /*----------------------------------------------------------------------
2 ----------------------------------------------------------------------*/
3 #include "DuplicateChecker.h"
4 #include "PoolSource.h"
5 #include "InputFile.h"
6 #include "RootFile.h"
8 #include "RootTree.h"
9 
19 
20 namespace edm {
25  input_(input),
26  orderedProcessHistoryIDs_(),
27  enablePrefetching_(false),
28  enforceGUIDInFileName_(pset.getUntrackedParameter<bool>("enforceGUIDInFileName")) {
29  // The SiteLocalConfig controls the TTreeCache size and the prefetching settings.
31  if (pSLC.isAvailable()) {
32  enablePrefetching_ = pSLC->enablePrefetching();
33  }
34 
35  // Prestage the files
36  //NOTE: we do not want to stage in all secondary files since we can be given a list of
37  // thousands of files and prestaging all those files can cause a site to fail.
38  // So, we stage in the first secondary file only.
41 
42  // Open the first file.
45  if (rootFile())
46  break;
47  }
48  if (rootFile()) {
49  input_.productRegistryUpdate().updateFromInput(rootFile()->productRegistry()->productList());
50  }
51  }
52 
54 
56 
58  // close the currently open file, if any, and delete the RootFile object.
59  if (rootFile()) {
60  rootFile()->close();
61  rootFile().reset();
62  }
63  }
64 
66  initTheFile(skipBadFiles, false, nullptr, "secondaryFiles", InputType::SecondaryFile);
67  }
68 
70  std::shared_ptr<InputFile> filePtr) {
71  size_t currentIndexIntoFile = sequenceNumberOfFile();
72  return std::make_shared<RootFile>(fileNames()[0],
75  filePtr,
76  input_.nStreams(),
79  input_.runHelper(),
88  currentIndexIntoFile,
94  }
95 
96  void RootSecondaryFileSequence::initAssociationsFromSecondary(std::set<BranchID> const& associationsFromSecondary) {
97  for (auto const& branchID : associationsFromSecondary) {
98  associationsFromSecondary_.push_back(branchID);
99  }
100  rootFile()->initAssociationsFromSecondary(associationsFromSecondary_);
101  }
102 } // namespace edm
edm::RootInputFileSequence::noMoreFiles
bool noMoreFiles() const
Definition: RootInputFileSequence.h:68
edm::RootSecondaryFileSequence::closeFile_
void closeFile_() override
Definition: RootSecondaryFileSequence.cc:57
electrons_cff.bool
bool
Definition: electrons_cff.py:366
edm::RootSecondaryFileSequence::endJob
void endJob()
Definition: RootSecondaryFileSequence.cc:55
edm::PoolSource
Definition: PoolSource.h:32
DuplicateChecker.h
input
static const std::string input
Definition: EdmProvDump.cc:48
edm::RootInputFileSequence::setAtFirstFile
void setAtFirstFile()
Definition: RootInputFileSequence.h:73
MessageLogger.h
edm::RootSecondaryFileSequence::associationsFromSecondary_
std::vector< BranchID > associationsFromSecondary_
Definition: RootSecondaryFileSequence.h:45
funct::false
false
Definition: Factorize.h:29
edm::PoolSource::labelRawDataLikeMC
bool labelRawDataLikeMC() const
Definition: PoolSource.h:43
edm::PoolSource::productRegistryUpdate
ProductRegistry & productRegistryUpdate()
Definition: InputSource.h:329
getEcalConditions_orcoffint2r_cff.catalog
catalog
Definition: getEcalConditions_orcoffint2r_cff.py:40
edm::InputSource::thinnedAssociationsHelper
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
Accessors for thinnedAssociationsHelper.
Definition: InputSource.h:168
edm
HLT enums.
Definition: AlignableModifier.h:19
BranchID.h
edm::ProductRegistry::updateFromInput
void updateFromInput(ProductList const &other)
Definition: ProductRegistry.cc:209
RootTree.h
edm::InputType::SecondaryFile
edm::InputFileCatalog
Definition: InputFileCatalog.h:32
ProductRegistry.h
InputFileCatalog.h
edm::PoolSource::nStreams
unsigned int nStreams() const
Definition: PoolSource.h:44
remoteMonitoring_LED_IterMethod_cfg.skipBadFiles
skipBadFiles
Definition: remoteMonitoring_LED_IterMethod_cfg.py:24
edm::RootInputFileSequence::logicalFileName
std::string const & logicalFileName() const
Definition: RootInputFileSequence.h:81
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
edm::RootSecondaryFileSequence::initAssociationsFromSecondary
void initAssociationsFromSecondary(std::set< BranchID > const &)
Definition: RootSecondaryFileSequence.cc:96
edm::PoolSource::skipBadFiles
bool skipBadFiles() const
Definition: PoolSource.h:40
PoolSource.h
edm::RootInputFileSequence::initFile
void initFile(bool skipBadFiles)
Definition: RootInputFileSequence.h:56
edm::RootSecondaryFileSequence::orderedProcessHistoryIDs_
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
Definition: RootSecondaryFileSequence.h:46
edm::RootInputFileSequence::RootFileSharedPtr
std::shared_ptr< RootFile > RootFileSharedPtr
Definition: RootInputFileSequence.h:55
edm::PoolSource::processHistoryRegistryForUpdate
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Definition: InputSource.h:330
edm::RootSecondaryFileSequence::input_
PoolSource & input_
Definition: RootSecondaryFileSequence.h:44
Service.h
edm::PoolSource::runHelper
RunHelperBase * runHelper()
Definition: PoolSource.h:47
StorageFactory::get
static const StorageFactory * get(void)
Definition: StorageFactory.cc:28
edm::RootInputFileSequence::setAtNextFile
void setAtNextFile()
Definition: RootInputFileSequence.h:76
StorageFactory::stagein
void stagein(const std::string &url) const
Definition: StorageFactory.cc:159
ParameterSetDescription.h
edm::RootSecondaryFileSequence::~RootSecondaryFileSequence
~RootSecondaryFileSequence() override
Definition: RootSecondaryFileSequence.cc:53
edm::InputSource::processingMode
ProcessingMode processingMode() const
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition: InputSource.h:236
edm::RootInputFileSequence
Definition: RootInputFileSequence.h:32
edm::ParameterSet
Definition: ParameterSet.h:47
edm::RootSecondaryFileSequence::enforceGUIDInFileName_
bool enforceGUIDInFileName_
Definition: RootSecondaryFileSequence.h:48
edm::PoolSource::treeMaxVirtualSize
int treeMaxVirtualSize() const
Definition: PoolSource.h:45
edm::RootSecondaryFileSequence::enablePrefetching_
bool enablePrefetching_
Definition: RootSecondaryFileSequence.h:47
edm::RootSecondaryFileSequence::initFile_
void initFile_(bool skipBadFiles) override
Definition: RootSecondaryFileSequence.cc:65
edm::RootInputFileSequence::rootFile
std::shared_ptr< RootFile const > rootFile() const
Definition: RootInputFileSequence.h:90
StorageFactory.h
edm::Service
Definition: Service.h:30
RootFile.h
InputFile.h
RootSecondaryFileSequence.h
edm::InputSource::branchIDListHelper
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
Accessors for branchIDListHelper.
Definition: InputSource.h:162
edm::InputSource::processConfiguration
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:204
edm::PoolSource::dropDescendants
bool dropDescendants() const
Definition: PoolSource.h:41
edm::RootSecondaryFileSequence::RootSecondaryFileSequence
RootSecondaryFileSequence(ParameterSet const &pset, PoolSource &input, InputFileCatalog const &catalog)
Definition: RootSecondaryFileSequence.cc:21
edm::RootInputFileSequence::initTheFile
void initTheFile(bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
Definition: RootInputFileSequence.cc:182
edm::RootSecondaryFileSequence::makeRootFile
RootFileSharedPtr makeRootFile(std::shared_ptr< InputFile > filePtr) override
Definition: RootSecondaryFileSequence.cc:69
edm::RootInputFileSequence::indexesIntoFiles
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const
Definition: RootInputFileSequence.h:85
ParameterSet.h
edm::PoolSource::productSelectorRules
ProductSelectorRules const & productSelectorRules() const
Definition: PoolSource.h:46
edm::PoolSource::bypassVersionCheck
bool bypassVersionCheck() const
Definition: PoolSource.h:42
edm::RootInputFileSequence::sequenceNumberOfFile
size_t sequenceNumberOfFile() const
Definition: RootInputFileSequence.h:70
edm::RootInputFileSequence::fileNames
std::vector< std::string > const & fileNames() const
Definition: RootInputFileSequence.h:79
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
SiteLocalConfig.h