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  bool skipEvents(int offset);
64  bool goToEvent(EventID const& eventID);
65  bool skipToItem(RunNumber_t run, LuminosityBlockNumber_t lumi, EventNumber_t event, size_t fileNameHash = 0U, bool currentFileFirst = true);
68  void rewind_();
69  void readOneRandom(EventPrincipal& cache, size_t& fileNameHash, CLHEP::HepRandomEngine*);
70  bool readOneRandomWithID(EventPrincipal& cache, size_t& fileNameHash, LuminosityBlockID const& id, CLHEP::HepRandomEngine*);
71  bool readOneSequential(EventPrincipal& cache, size_t& fileNameHash);
72  bool readOneSequentialWithID(EventPrincipal& cache, size_t& fileNameHash, LuminosityBlockID const& id);
73  void readOneSpecified(EventPrincipal& cache, size_t& fileNameHash, SecondaryEventIDAndFileInfo const& id);
74 
75  void dropUnwantedBranches_(std::vector<std::string> const& wantedBranches);
76  std::shared_ptr<ProductRegistry const> fileProductRegistry() const;
77  std::shared_ptr<BranchIDListHelper const> fileBranchIDListHelper() const;
80  static void fillDescription(ParameterSetDescription & desc);
83  void initAssociationsFromSecondary(std::set<BranchID> const&);
84  private:
85  void initFile(bool skipBadFiles);
86  bool nextFile();
87  bool previousFile();
88  void rewindFile();
89  std::vector<FileCatalogItem> const& fileCatalogItems() const;
90 
91  std::shared_ptr<ProductRegistry const> productRegistry() const;
94  int remainingEvents() const;
95  int remainingLuminosityBlocks() const;
96 
102  size_t lfnHash_;
103  std::unique_ptr<std::unordered_multimap<size_t, size_t> > findFileForSpecifiedID_;
104  std::vector<FileCatalogItem>::const_iterator fileIterBegin_;
105  std::vector<FileCatalogItem>::const_iterator fileIterEnd_;
106  std::vector<FileCatalogItem>::const_iterator fileIter_;
107  std::vector<FileCatalogItem>::const_iterator fileIterLastOpened_;
110 
111  std::vector<std::shared_ptr<IndexIntoFile> > indexesIntoFiles_;
112  std::vector<ProcessHistoryID> orderedProcessHistoryIDs_;
113  std::vector<BranchID> associationsFromSecondary_;
114 
115  unsigned int nStreams_;
116  std::shared_ptr<EventSkipperByID> eventSkipperByID_;
122  unsigned int treeCacheSize_;
126  std::shared_ptr<DuplicateChecker> duplicateChecker_;
132  }; // class RootInputFileSequence
133 }
134 #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_()
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_