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
bool labelRawDataLikeMC() const
Definition: PoolSource.h:43
void initFile(bool skipBadFiles)
void initAssociationsFromSecondary(std::set< BranchID > const &)
std::string const & logicalFileName() const
bool skipBadFiles() const
Definition: PoolSource.h:40
ProductRegistry & productRegistryUpdate()
Definition: InputSource.h:359
std::vector< BranchID > associationsFromSecondary_
unsigned int nStreams() const
Definition: PoolSource.h:44
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Definition: InputSource.h:360
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
Accessors for thinnedAssociationsHelper.
Definition: InputSource.h:184
std::vector< std::string > const & fileNames() const
static std::string const input
Definition: EdmProvDump.cc:50
RunHelperBase * runHelper()
Definition: PoolSource.h:47
std::shared_ptr< RootFile > RootFileSharedPtr
void initFile_(bool skipBadFiles) override
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
Accessors for branchIDListHelper.
Definition: InputSource.h:172
void initTheFile(bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
RootFileSharedPtr makeRootFile(std::shared_ptr< InputFile > filePtr) override
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:223
std::shared_ptr< RootFile const > rootFile() const
void stagein(const std::string &url) const
int treeMaxVirtualSize() const
Definition: PoolSource.h:45
RootSecondaryFileSequence(ParameterSet const &pset, PoolSource &input, InputFileCatalog const &catalog)
HLT enums.
void updateFromInput(ProductList const &other)
ProductSelectorRules const & productSelectorRules() const
Definition: PoolSource.h:46
bool isAvailable() const
Definition: Service.h:40
bool bypassVersionCheck() const
Definition: PoolSource.h:42
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
static const StorageFactory * get(void)
bool dropDescendants() const
Definition: PoolSource.h:41
ProcessingMode processingMode() const
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition: InputSource.h:255
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const