CMS 3D CMS Logo

RootInputFileSequence.h
Go to the documentation of this file.
1 #ifndef IOPool_Input_RootInputFileSequence_h
2 #define IOPool_Input_RootInputFileSequence_h
3 
4 /*----------------------------------------------------------------------
5 
6 RootInputFileSequence: This is an InputSource. initTheFile tries to open a file using a list of PFN names constructed from multiple data catalogs in site-local-config.xml. These are accessed via FileCatalogItem iterator fileIter_.
7 
8 ----------------------------------------------------------------------*/
9 
10 #include "InputFile.h"
15 
16 #include <memory>
17 #include <string>
18 #include <unordered_map>
19 #include <vector>
20 
21 namespace edm {
22 
23  class FileCatalogItem;
24  class IndexIntoFile;
25  class InputFileCatalog;
27  class RootFile;
28 
30  public:
32  virtual ~RootInputFileSequence();
33 
34  RootInputFileSequence(RootInputFileSequence const&) = delete; // Disallow copying and moving
35  RootInputFileSequence& operator=(RootInputFileSequence const&) = delete; // Disallow copying and moving
36 
39  std::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_();
41  std::shared_ptr<RunAuxiliary> readRunAuxiliary_();
42  void readRun_(RunPrincipal& runPrincipal);
46  size_t fileNameHash = 0U,
47  bool currentFileFirst = true);
48  std::shared_ptr<ProductRegistry const> fileProductRegistry() const;
49  std::shared_ptr<BranchIDListHelper const> fileBranchIDListHelper() const;
50 
51  protected:
52  typedef std::shared_ptr<RootFile> RootFileSharedPtr;
54  void initTheFile(bool skipBadFiles,
55  bool deleteIndexIntoFile,
57  char const* inputTypeName,
58  InputType inputType);
59 
62 
63  bool atFirstFile() const { return fileIter_ == fileIterBegin_; }
64  bool atLastFile() const { return fileIter_ + 1 == fileIterEnd_; }
65  bool noMoreFiles() const { return fileIter_ == fileIterEnd_; }
66  bool noFiles() const { return fileIterBegin_ == fileIterEnd_; }
67  size_t sequenceNumberOfFile() const { return fileIter_ - fileIterBegin_; }
68  size_t numberOfFiles() const { return fileIterEnd_ - fileIterBegin_; }
69 
73  void setAtNextFile() { ++fileIter_; }
75 
76  std::vector<std::string> const& fileNames() const { return fileIter_->fileNames(); }
77 
78  std::string const& logicalFileName() const { return fileIter_->logicalFileName(); }
79  std::string const& lfn() const { return lfn_; }
80  std::vector<FileCatalogItem> const& fileCatalogItems() const;
81 
82  std::vector<std::shared_ptr<IndexIntoFile>> const& indexesIntoFiles() const { return indexesIntoFiles_; }
83  void setIndexIntoFile(size_t index);
84  size_t lfnHash() const { return lfnHash_; }
85  bool usedFallback() const { return usedFallback_; }
86 
87  std::shared_ptr<RootFile const> rootFile() const { return get_underlying_safe(rootFile_); }
88  std::shared_ptr<RootFile>& rootFile() { return get_underlying_safe(rootFile_); }
89 
90  private:
93  size_t lfnHash_;
96  std::vector<FileCatalogItem>::const_iterator const fileIterBegin_;
97  std::vector<FileCatalogItem>::const_iterator const fileIterEnd_;
98  std::vector<FileCatalogItem>::const_iterator fileIter_;
99  std::vector<FileCatalogItem>::const_iterator fileIterLastOpened_;
101  std::vector<std::shared_ptr<IndexIntoFile>> indexesIntoFiles_;
102 
103  private:
104  virtual RootFileSharedPtr makeRootFile(std::shared_ptr<InputFile> filePtr) = 0;
105  virtual void initFile_(bool skipBadFiles) = 0;
106  virtual void closeFile_() = 0;
107 
108  }; // class RootInputFileSequence
109 } // namespace edm
110 #endif
edm::RootInputFileSequence::noMoreFiles
bool noMoreFiles() const
Definition: RootInputFileSequence.h:65
edm::RootInputFileSequence::findFileForSpecifiedID_
edm::propagate_const< std::unique_ptr< std::unordered_multimap< size_t, size_t > > > findFileForSpecifiedID_
Definition: RootInputFileSequence.h:95
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
edm::RootInputFileSequence::fileProductRegistry
std::shared_ptr< ProductRegistry const > fileProductRegistry() const
Definition: RootInputFileSequence.cc:39
input
static const std::string input
Definition: EdmProvDump.cc:48
edm::RootInputFileSequence::setAtFirstFile
void setAtFirstFile()
Definition: RootInputFileSequence.h:70
edm::RootInputFileSequence::setAtFileSequenceNumber
void setAtFileSequenceNumber(size_t offset)
Definition: RootInputFileSequence.h:71
getEcalConditions_orcoffint2r_cff.catalog
catalog
Definition: getEcalConditions_orcoffint2r_cff.py:40
edm::RootInputFileSequence::closeFile_
virtual void closeFile_()=0
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::RootInputFileSequence::atFirstFile
bool atFirstFile() const
Definition: RootInputFileSequence.h:63
edm::RootInputFileSequence::lfnHash_
size_t lfnHash_
Definition: RootInputFileSequence.h:93
edm::RootInputFileSequence::makeRootFile
virtual RootFileSharedPtr makeRootFile(std::shared_ptr< InputFile > filePtr)=0
edm::LuminosityBlockPrincipal
Definition: LuminosityBlockPrincipal.h:31
edm::RootInputFileSequence::lfnHash
size_t lfnHash() const
Definition: RootInputFileSequence.h:84
edm::InputFileCatalog
Definition: InputFileCatalog.h:32
InputFileCatalog.h
edm::RootInputFileSequence::indexesIntoFiles_
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
Definition: RootInputFileSequence.h:101
remoteMonitoring_LED_IterMethod_cfg.skipBadFiles
skipBadFiles
Definition: remoteMonitoring_LED_IterMethod_cfg.py:24
edm::RootInputFileSequence::logicalFileName
std::string const & logicalFileName() const
Definition: RootInputFileSequence.h:78
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
edm::InputType
InputType
Definition: InputType.h:5
edm::RootInputFileSequence::initFile
void initFile(bool skipBadFiles)
Definition: RootInputFileSequence.h:53
edm::RootInputFileSequence::setIndexIntoFile
void setIndexIntoFile(size_t index)
Definition: RootInputFileSequence.cc:275
edm::RootInputFileSequence::lfn_
std::string lfn_
Definition: RootInputFileSequence.h:92
edm::RootInputFileSequence::RootFileSharedPtr
std::shared_ptr< RootFile > RootFileSharedPtr
Definition: RootInputFileSequence.h:52
edm::propagate_const
Definition: propagate_const.h:32
edm::EventPrincipal
Definition: EventPrincipal.h:46
edm::RootInputFileSequence::fileIterBegin_
const std::vector< FileCatalogItem >::const_iterator fileIterBegin_
Definition: RootInputFileSequence.h:96
edm::RootInputFileSequence::fileIter_
std::vector< FileCatalogItem >::const_iterator fileIter_
Definition: RootInputFileSequence.h:98
edm::RootInputFileSequence::setAtNextFile
void setAtNextFile()
Definition: RootInputFileSequence.h:73
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
edm::RootInputFileSequence::atLastFile
bool atLastFile() const
Definition: RootInputFileSequence.h:64
edm::RootInputFileSequence::usedFallback_
bool usedFallback_
Definition: RootInputFileSequence.h:94
edm::RootInputFileSequence::readLuminosityBlockAuxiliary_
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
Definition: RootInputFileSequence.cc:56
edm::RootInputFileSequence::readRun_
void readRun_(RunPrincipal &runPrincipal)
Definition: RootInputFileSequence.cc:61
utilities.cache
def cache(function)
Definition: utilities.py:3
mitigatedMETSequence_cff.U
U
Definition: mitigatedMETSequence_cff.py:36
InputType.h
edm::RootInputFileSequence::RootInputFileSequence
RootInputFileSequence(ParameterSet const &pset, InputFileCatalog const &catalog)
Definition: RootInputFileSequence.cc:22
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::get_underlying_safe
std::shared_ptr< T > & get_underlying_safe(propagate_const< std::shared_ptr< T >> &iP)
Definition: get_underlying_safe.h:40
edm::RootInputFileSequence::initFile_
virtual void initFile_(bool skipBadFiles)=0
edm::RootInputFileSequence
Definition: RootInputFileSequence.h:29
edm::ParameterSet
Definition: ParameterSet.h:36
edm::RootInputFileSequence::operator=
RootInputFileSequence & operator=(RootInputFileSequence const &)=delete
edm::RootInputFileSequence::fileIterLastOpened_
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
Definition: RootInputFileSequence.h:99
edm::RootInputFileSequence::skipToItemInNewFile
bool skipToItemInNewFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
Definition: RootInputFileSequence.cc:132
edm::RootInputFileSequence::noFiles
bool noFiles() const
Definition: RootInputFileSequence.h:66
edm::RootInputFileSequence::rootFile
std::shared_ptr< RootFile const > rootFile() const
Definition: RootInputFileSequence.h:87
edm::RootInputFileSequence::readEvent
void readEvent(EventPrincipal &cache)
Definition: RootInputFileSequence.cc:84
edm::RootInputFileSequence::containedInCurrentFile
bool containedInCurrentFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
Definition: RootInputFileSequence.cc:89
edm::RootInputFileSequence::rootFile_
edm::propagate_const< RootFileSharedPtr > rootFile_
Definition: RootInputFileSequence.h:100
InputFile.h
edm::RootInputFileSequence::~RootInputFileSequence
virtual ~RootInputFileSequence()
Definition: RootInputFileSequence.cc:49
edm::RootInputFileSequence::lfn
std::string const & lfn() const
Definition: RootInputFileSequence.h:79
edm::RootInputFileSequence::catalog_
InputFileCatalog const & catalog_
Definition: RootInputFileSequence.h:91
edm::RootInputFileSequence::fileBranchIDListHelper
std::shared_ptr< BranchIDListHelper const > fileBranchIDListHelper() const
Definition: RootInputFileSequence.cc:44
writedatasetfile.run
run
Definition: writedatasetfile.py:27
edm::RootInputFileSequence::fileIterEnd_
const std::vector< FileCatalogItem >::const_iterator fileIterEnd_
Definition: RootInputFileSequence.h:97
Frameworkfwd.h
ParameterSetDescription
edm::RootInputFileSequence::rootFile
std::shared_ptr< RootFile > & rootFile()
Definition: RootInputFileSequence.h:88
edm::RootInputFileSequence::readRunAuxiliary_
std::shared_ptr< RunAuxiliary > readRunAuxiliary_()
Definition: RootInputFileSequence.cc:51
edm::RootInputFileSequence::setNoMoreFiles
void setNoMoreFiles()
Definition: RootInputFileSequence.h:72
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::RootInputFileSequence::initTheFile
void initTheFile(bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
Definition: RootInputFileSequence.cc:182
edm::RootInputFileSequence::usedFallback
bool usedFallback() const
Definition: RootInputFileSequence.h:85
edm::RootInputFileSequence::setAtPreviousFile
void setAtPreviousFile()
Definition: RootInputFileSequence.h:74
edm::RootInputFileSequence::indexesIntoFiles
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const
Definition: RootInputFileSequence.h:82
edm::InputSource
Definition: InputSource.h:76
edm::RootInputFileSequence::numberOfFiles
size_t numberOfFiles() const
Definition: RootInputFileSequence.h:68
edm::RunPrincipal
Definition: RunPrincipal.h:34
event
Definition: event.py:1
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
get_underlying_safe.h
lumi
Definition: LumiSectionData.h:20
edm::RootInputFileSequence::sequenceNumberOfFile
size_t sequenceNumberOfFile() const
Definition: RootInputFileSequence.h:67
edm::RootInputFileSequence::fileNames
std::vector< std::string > const & fileNames() const
Definition: RootInputFileSequence.h:76
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
edm::RootInputFileSequence::readLuminosityBlock_
void readLuminosityBlock_(LuminosityBlockPrincipal &lumiPrincipal)
Definition: RootInputFileSequence.cc:66
edm::RootInputFileSequence::skipToItem
bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash=0U, bool currentFileFirst=true)
Definition: RootInputFileSequence.cc:150
edm::RootInputFileSequence::fileCatalogItems
std::vector< FileCatalogItem > const & fileCatalogItems() const
Definition: RootInputFileSequence.cc:35