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 
19 
20 #include <memory>
21 #include <set>
22 #include <string>
23 #include <unordered_map>
24 #include <vector>
25 
26 namespace CLHEP {
27  class HepRandomEngine;
28 }
29 
30 namespace edm {
31 
32  class BranchID;
33  class DuplicateChecker;
34  class FileCatalogItem;
35  class InputFileCatalog;
37  class PoolSource;
38  class RootFile;
39 
41  public:
42  explicit RootInputFileSequence(ParameterSet const& pset,
45  unsigned int nStreams,
46  InputType inputType);
47  virtual ~RootInputFileSequence();
48 
49  RootInputFileSequence(RootInputFileSequence const&) = delete; // Disallow copying and moving
50  RootInputFileSequence& operator=(RootInputFileSequence const&) = delete; // Disallow copying and moving
51 
52  typedef std::shared_ptr<RootFile> RootFileSharedPtr;
53  void readEvent(EventPrincipal& cache);
54  std::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_();
56  std::shared_ptr<RunAuxiliary> readRunAuxiliary_();
57  void readRun_(RunPrincipal& runPrincipal);
58  std::unique_ptr<FileBlock> readFile_();
59  void closeFile_();
60  void endJob();
63  void skipEntries(unsigned int offset);
64  bool skipEvents(int offset);
65  bool goToEvent(EventID const& eventID);
66  bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash = 0U, bool currentFileFirst = true);
69  void rewind_();
70  void readOneRandom(EventPrincipal& cache, size_t& fileNameHash, CLHEP::HepRandomEngine*);
71  bool readOneRandomWithID(EventPrincipal& cache, size_t& fileNameHash, LuminosityBlockID const& id, CLHEP::HepRandomEngine*);
72  bool readOneSequential(EventPrincipal& cache, size_t& fileNameHash);
73  bool readOneSequentialWithID(EventPrincipal& cache, size_t& fileNameHash, LuminosityBlockID const& id);
74  void readOneSpecified(EventPrincipal& cache, size_t& fileNameHash, SecondaryEventIDAndFileInfo const& id);
75 
76  void dropUnwantedBranches_(std::vector<std::string> const& wantedBranches);
77  std::shared_ptr<ProductRegistry const> fileProductRegistry() const;
78  std::shared_ptr<BranchIDListHelper const> fileBranchIDListHelper() const;
81  static void fillDescription(ParameterSetDescription & desc);
84  void initAssociationsFromSecondary(std::set<BranchID> const&);
85  private:
86  void initFile(bool skipBadFiles);
87  bool nextFile();
88  bool previousFile();
89  void rewindFile();
90  std::vector<FileCatalogItem> const& fileCatalogItems() const;
91 
92  std::shared_ptr<ProductRegistry const> productRegistry() const;
95  int remainingEvents() const;
96  int remainingLuminosityBlocks() const;
97 
103  size_t lfnHash_;
104  std::unique_ptr<std::unordered_multimap<size_t, size_t> > findFileForSpecifiedID_;
105  std::vector<FileCatalogItem>::const_iterator fileIterBegin_;
106  std::vector<FileCatalogItem>::const_iterator fileIterEnd_;
107  std::vector<FileCatalogItem>::const_iterator fileIter_;
108  std::vector<FileCatalogItem>::const_iterator fileIterLastOpened_;
111 
112  std::vector<std::shared_ptr<IndexIntoFile> > indexesIntoFiles_;
113  std::vector<ProcessHistoryID> orderedProcessHistoryIDs_;
114  std::vector<BranchID> associationsFromSecondary_;
115 
116  unsigned int nStreams_;
117  std::shared_ptr<EventSkipperByID> eventSkipperByID_;
123  unsigned int treeCacheSize_;
127  std::shared_ptr<DuplicateChecker> duplicateChecker_;
133  }; // class RootInputFileSequence
134 }
135 #endif
ProcessingController::ForwardState forwardState() const
InputType
Definition: InputType.h:5
void initFile(bool skipBadFiles)
bool goToEvent(EventID const &eventID)
ProductSelectorRules productSelectorRules_
ProcessConfiguration const & processConfiguration() const
std::vector< FileCatalogItem >::const_iterator fileIter_
tuple lumi
Definition: fjr2json.py:35
std::shared_ptr< EventSkipperByID > eventSkipperByID_
ProductRegistry & productRegistryUpdate() const
void initAssociationsFromSecondary(std::set< BranchID > const &)
std::shared_ptr< BranchIDListHelper const > fileBranchIDListHelper() const
unsigned long long EventNumber_t
unsigned int LuminosityBlockNumber_t
static void fillDescription(ParameterSetDescription &desc)
static std::string const input
Definition: EdmProvDump.cc:43
std::shared_ptr< RootFile > RootFileSharedPtr
std::vector< BranchID > associationsFromSecondary_
bool readOneRandomWithID(EventPrincipal &cache, size_t &fileNameHash, LuminosityBlockID const &id, CLHEP::HepRandomEngine *)
std::shared_ptr< DuplicateChecker > duplicateChecker_
std::vector< FileCatalogItem >::const_iterator fileIterLastOpened_
std::vector< FileCatalogItem > const & fileCatalogItems() const
ProcessHistoryRegistry const & processHistoryRegistry() const
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 dropUnwantedBranches_(std::vector< std::string > const &wantedBranches)
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_
std::vector< ProcessHistoryID > orderedProcessHistoryIDs_
void readOneRandom(EventPrincipal &cache, size_t &fileNameHash, CLHEP::HepRandomEngine *)
bool containedInCurrentFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event) const
bool skipToItemInNewFile(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event)
std::unique_ptr< FileBlock > readFile_()
bool readOneSequential(EventPrincipal &cache, size_t &fileNameHash)
std::shared_ptr< RunAuxiliary > readRunAuxiliary_()
void skipEntries(unsigned int offset)
InputSource::ItemType getNextItemType(RunNumber_t &run, LuminosityBlockNumber_t &lumi, EventNumber_t &event)
RootInputFileSequence(ParameterSet const &pset, PoolSource &input, InputFileCatalog const &catalog, unsigned int nStreams, InputType inputType)
std::vector< FileCatalogItem >::const_iterator fileIterBegin_
tuple skipBadFiles
Definition: example_cfg.py:64
void readOneSpecified(EventPrincipal &cache, size_t &fileNameHash, SecondaryEventIDAndFileInfo const &id)
std::shared_ptr< LuminosityBlockAuxiliary > readLuminosityBlockAuxiliary_()
RootInputFileSequence & operator=(RootInputFileSequence const &)=delete
bool readOneSequentialWithID(EventPrincipal &cache, size_t &fileNameHash, LuminosityBlockID const &id)
ProcessHistoryRegistry & processHistoryRegistryForUpdate()
std::vector< FileCatalogItem >::const_iterator fileIterEnd_
unsigned int RunNumber_t
BranchDescription::MatchMode branchesMustMatch_
void readEvent(EventPrincipal &cache)
std::shared_ptr< ProductRegistry const > fileProductRegistry() const
ProcessingController::ReverseState reverseState() const
std::shared_ptr< ProductRegistry const > productRegistry() const
InputFileCatalog const & catalog_