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 {
22  ParameterSet const& pset,
24  InputFileCatalog const& catalog) :
25  RootInputFileSequence(pset, catalog),
26  input_(input),
27  orderedProcessHistoryIDs_(),
28  enablePrefetching_(false),
29  enforceGUIDInFileName_(pset.getUntrackedParameter<bool>("enforceGUIDInFileName")) {
30 
31  // The SiteLocalConfig controls the TTreeCache size and the prefetching settings.
33  if(pSLC.isAvailable()) {
34  enablePrefetching_ = pSLC->enablePrefetching();
35  }
36 
37  // Prestage the files
38  //NOTE: we do not want to stage in all secondary files since we can be given a list of
39  // thousands of files and prestaging all those files can cause a site to fail.
40  // So, we stage in the first secondary file only.
43 
44  // Open the first file.
47  if(rootFile()) break;
48  }
49  if(rootFile()) {
50  input_.productRegistryUpdate().updateFromInput(rootFile()->productRegistry()->productList());
51  }
52  }
53 
55  }
56 
57  void
59  closeFile_();
60  }
61 
62  void
64  // close the currently open file, if any, and delete the RootFile object.
65  if(rootFile()) {
66  rootFile()->close();
67  rootFile().reset();
68  }
69  }
70 
72  initTheFile(skipBadFiles, false, nullptr, "secondaryFiles", InputType::SecondaryFile);
73  }
74 
76  RootSecondaryFileSequence::makeRootFile(std::shared_ptr<InputFile> filePtr) {
77  size_t currentIndexIntoFile = sequenceNumberOfFile();
78  return std::make_shared<RootFile>(
79  fileName(),
82  filePtr,
83  input_.nStreams(),
86  input_.runHelper(),
95  currentIndexIntoFile,
101  }
102 
103  void
104  RootSecondaryFileSequence::initAssociationsFromSecondary(std::set<BranchID> const& associationsFromSecondary) {
105  for(auto const& branchID : associationsFromSecondary) {
106  associationsFromSecondary_.push_back(branchID);
107  }
108  rootFile()->initAssociationsFromSecondary(associationsFromSecondary_);
109  }
110 }
std::string const & logicalFileName() const
void initFile(bool skipBadFiles)
void initAssociationsFromSecondary(std::set< BranchID > const &)
ProductRegistry & productRegistryUpdate()
Definition: InputSource.h:334
std::string const & fileName() const
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const
ProcessingMode processingMode() const
RunsLumisAndEvents (default), RunsAndLumis, or Runs.
Definition: InputSource.h:240
std::vector< BranchID > associationsFromSecondary_
static std::string const input
Definition: EdmProvDump.cc:44
RunHelperBase * runHelper()
Definition: PoolSource.h:47
std::shared_ptr< RootFile > RootFileSharedPtr
void initFile_(bool skipBadFiles) override
static const StorageFactory * get(void)
void stagein(const std::string &url) const
void initTheFile(bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
bool isAvailable() const
Definition: Service.h:46
RootFileSharedPtr makeRootFile(std::shared_ptr< InputFile > filePtr) override
unsigned int nStreams() const
Definition: PoolSource.h:44
bool dropDescendants() const
Definition: PoolSource.h:41
bool bypassVersionCheck() const
Definition: PoolSource.h:42
std::shared_ptr< RootFile const > rootFile() const
int treeMaxVirtualSize() const
Definition: PoolSource.h:45
bool skipBadFiles() const
Definition: PoolSource.h:40
std::shared_ptr< BranchIDListHelper const > branchIDListHelper() const
Accessors for branchIDListHelper.
Definition: InputSource.h:172
bool labelRawDataLikeMC() const
Definition: PoolSource.h:43
RootSecondaryFileSequence(ParameterSet const &pset, PoolSource &input, InputFileCatalog const &catalog)
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
Definition: InputSource.h:335
HLT enums.
std::shared_ptr< ThinnedAssociationsHelper const > thinnedAssociationsHelper() const
Accessors for thinnedAssociationsHelper.
Definition: InputSource.h:176
void updateFromInput(ProductList const &other)
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
ProcessConfiguration const & processConfiguration() const
Accessor for Process Configuration.
Definition: InputSource.h:208
ProductSelectorRules const & productSelectorRules() const
Definition: PoolSource.h:46