CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
7 
8 ----------------------------------------------------------------------*/
9 
10 #include "InputFile.h"
14 
15 #include <memory>
16 #include <string>
17 #include <unordered_map>
18 #include <vector>
19 
20 namespace edm {
21 
22  class FileCatalogItem;
23  class IndexIntoFile;
24  class InputFileCatalog;
26  class RootFile;
27 
29  public:
30  explicit RootInputFileSequence(ParameterSet const& pset,
31  InputFileCatalog const& catalog);
32  virtual ~RootInputFileSequence();
33 
34  RootInputFileSequence(RootInputFileSequence const&) = delete; // Disallow copying and moving
35  RootInputFileSequence& operator=(RootInputFileSequence const&) = delete; // Disallow copying and moving
36 
38  void readEvent(EventPrincipal& cache);
39  std::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_();
41  std::shared_ptr<RunAuxiliary> readRunAuxiliary_();
42  void readRun_(RunPrincipal& runPrincipal);
43  bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash = 0U, bool currentFileFirst = true);
44  std::shared_ptr<ProductRegistry const> fileProductRegistry() const;
45  std::shared_ptr<BranchIDListHelper const> fileBranchIDListHelper() const;
46  protected:
47  typedef std::shared_ptr<RootFile> RootFileSharedPtr;
48  void initFile(bool skipBadFiles) {initFile_(skipBadFiles);}
49  void initTheFile(bool skipBadFiles, bool deleteIndexIntoFile, InputSource* input, char const* inputTypeName, InputType inputType);
51  bool skipToItemInNewFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash);
52 
53  bool atFirstFile() const {return fileIter_ == fileIterBegin_;}
54  bool atLastFile() const {return fileIter_ + 1 == fileIterEnd_;}
55  bool noMoreFiles() const {return fileIter_ == fileIterEnd_;}
56  bool noFiles() const {return fileIterBegin_ == fileIterEnd_;}
57  size_t sequenceNumberOfFile() const {return fileIter_ - fileIterBegin_;}
58  size_t numberOfFiles() const {return fileIterEnd_ - fileIterBegin_;}
59 
65 
66  std::string const& fileName() const {return fileIter_->fileName();}
67  std::string const& logicalFileName() const {return fileIter_->logicalFileName();}
68  std::string const& fallbackFileName() const {return fileIter_->fallbackFileName();}
69  std::string const& lfn() const {return lfn_;}
70  std::vector<FileCatalogItem> const& fileCatalogItems() const;
71 
72  std::vector<std::shared_ptr<IndexIntoFile> > const& indexesIntoFiles() const {return indexesIntoFiles_;}
73  void setIndexIntoFile(size_t index);
74  size_t lfnHash() const {return lfnHash_;}
75  bool usedFallback() const {return usedFallback_;}
76 
77  RootFileSharedPtr const& rootFile() const {return rootFile_;}
79  private:
82  size_t lfnHash_;
84  std::unique_ptr<std::unordered_multimap<size_t, size_t> > findFileForSpecifiedID_;
85  std::vector<FileCatalogItem>::const_iterator const fileIterBegin_;
86  std::vector<FileCatalogItem>::const_iterator const fileIterEnd_;
87  std::vector<FileCatalogItem>::const_iterator fileIter_;
88  std::vector<FileCatalogItem>::const_iterator fileIterLastOpened_;
90  std::vector<std::shared_ptr<IndexIntoFile> > indexesIntoFiles_;
91 
92  private:
93  virtual RootFileSharedPtr makeRootFile(std::shared_ptr<InputFile> filePtr) = 0;
94  virtual void initFile_(bool skipBadFiles) = 0;
95  virtual void closeFile_() = 0;
96 
97  }; // class RootInputFileSequence
98 }
99 #endif
std::string const & logicalFileName() const
InputType
Definition: InputType.h:5
void initFile(bool skipBadFiles)
std::string const & fileName() const
void setAtFileSequenceNumber(size_t offset)
std::vector< FileCatalogItem >::const_iterator const fileIterEnd_
std::vector< FileCatalogItem >::const_iterator fileIter_
tuple lumi
Definition: fjr2json.py:35
std::vector< FileCatalogItem >::const_iterator const fileIterBegin_
std::shared_ptr< BranchIDListHelper const > fileBranchIDListHelper() const
unsigned long long EventNumber_t
std::vector< std::shared_ptr< IndexIntoFile > > const & indexesIntoFiles() const
RootFileSharedPtr & rootFile()
unsigned int LuminosityBlockNumber_t
static std::string const input
Definition: EdmProvDump.cc:43
std::shared_ptr< RootFile > RootFileSharedPtr
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
std::vector< FileCatalogItem > const & fileCatalogItems() const
std::string const & lfn() const
void initTheFile(bool skipBadFiles, bool deleteIndexIntoFile, InputSource *input, char const *inputTypeName, InputType inputType)
RootFileSharedPtr const & rootFile() const
virtual RootFileSharedPtr makeRootFile(std::shared_ptr< InputFile > filePtr)=0
virtual void initFile_(bool skipBadFiles)=0
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
void readRun_(RunPrincipal &runPrincipal)
std::vector< std::shared_ptr< IndexIntoFile > > indexesIntoFiles_
void readLuminosityBlock_(LuminosityBlockPrincipal &lumiPrincipal)
bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash=0U, bool currentFileFirst=true)
std::unique_ptr< std::unordered_multimap< size_t, size_t > > findFileForSpecifiedID_
bool containedInCurrentFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
bool skipToItemInNewFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
std::shared_ptr< RunAuxiliary > readRunAuxiliary_()
tuple skipBadFiles
Definition: example_cfg.py:64
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
RootInputFileSequence & operator=(RootInputFileSequence const &)=delete
virtual void closeFile_()=0
RootInputFileSequence(ParameterSet const &pset, InputFileCatalog const &catalog)
unsigned int RunNumber_t
void readEvent(EventPrincipal &cache)
std::shared_ptr< ProductRegistry const > fileProductRegistry() const
std::string const & fallbackFileName() const
InputFileCatalog const & catalog_