Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:07

0001 #ifndef IOPool_Input_RootPrimaryFileSequence_h
0002 #define IOPool_Input_RootPrimaryFileSequence_h
0003 
0004 /*----------------------------------------------------------------------
0005 
0006 RootPrimaryFileSequence: This is an InputSource
0007 
0008 ----------------------------------------------------------------------*/
0009 
0010 #include "RootInputFileSequence.h"
0011 #include "FWCore/Framework/interface/Frameworkfwd.h"
0012 #include "FWCore/Framework/interface/InputSource.h"
0013 #include "FWCore/Framework/interface/ProductSelectorRules.h"
0014 #include "FWCore/Framework/interface/ProcessingController.h"
0015 #include "FWCore/Sources/interface/EventSkipperByID.h"
0016 #include "FWCore/Utilities/interface/get_underlying_safe.h"
0017 #include "DataFormats/Provenance/interface/BranchDescription.h"
0018 #include "DataFormats/Provenance/interface/ProcessHistoryID.h"
0019 
0020 #include <memory>
0021 #include <string>
0022 #include <vector>
0023 
0024 namespace edm {
0025 
0026   class BranchID;
0027   class DuplicateChecker;
0028   class FileCatalogItem;
0029   class InputFileCatalog;
0030   class ParameterSetDescription;
0031   class PoolSource;
0032   class RootFile;
0033 
0034   class RootPrimaryFileSequence : public RootInputFileSequence {
0035   public:
0036     explicit RootPrimaryFileSequence(ParameterSet const& pset, PoolSource& input, InputFileCatalog const& catalog);
0037     ~RootPrimaryFileSequence() override;
0038 
0039     RootPrimaryFileSequence(RootPrimaryFileSequence const&) = delete;             // Disallow copying and moving
0040     RootPrimaryFileSequence& operator=(RootPrimaryFileSequence const&) = delete;  // Disallow copying and moving
0041 
0042     std::shared_ptr<FileBlock> readFile_();
0043     void endJob();
0044     InputSource::ItemTypeInfo getNextItemType(RunNumber_t& run, LuminosityBlockNumber_t& lumi, EventNumber_t& event);
0045     void skipEventsAtBeginning(int offset);
0046     void skipEvents(int offset);
0047     bool goToEvent(EventID const& eventID);
0048     void rewind_();
0049     static void fillDescription(ParameterSetDescription& desc);
0050     ProcessingController::ForwardState forwardState() const;
0051     ProcessingController::ReverseState reverseState() const;
0052 
0053   private:
0054     void initFile_(bool skipBadFiles) override;
0055     RootFileSharedPtr makeRootFile(std::shared_ptr<InputFile> filePtr) override;
0056     bool nextFile();
0057     bool previousFile();
0058     void rewindFile();
0059     void closeFile_() override;
0060 
0061     int remainingEvents() const;
0062     int remainingLuminosityBlocks() const;
0063 
0064     PoolSource& input_;
0065     bool firstFile_;
0066     BranchDescription::MatchMode branchesMustMatch_;
0067     std::vector<ProcessHistoryID> orderedProcessHistoryIDs_;
0068 
0069     std::shared_ptr<EventSkipperByID const> eventSkipperByID() const { return get_underlying_safe(eventSkipperByID_); }
0070     std::shared_ptr<EventSkipperByID>& eventSkipperByID() { return get_underlying_safe(eventSkipperByID_); }
0071     std::shared_ptr<DuplicateChecker const> duplicateChecker() const { return get_underlying_safe(duplicateChecker_); }
0072     std::shared_ptr<DuplicateChecker>& duplicateChecker() { return get_underlying_safe(duplicateChecker_); }
0073 
0074     edm::propagate_const<std::shared_ptr<FileBlock>> fb_;
0075     edm::propagate_const<std::shared_ptr<EventSkipperByID>> eventSkipperByID_;
0076     int initialNumberOfEventsToSkip_;
0077     bool noRunLumiSort_;
0078     bool noEventSort_;
0079     unsigned int treeCacheSize_;
0080     edm::propagate_const<std::shared_ptr<DuplicateChecker>> duplicateChecker_;
0081     bool usingGoToEvent_;
0082     bool goToEventInNewFile_ = false;
0083     size_t goToFileSequenceOffset_ = 0;
0084     EventID goToEventID_;
0085     bool skipToStop_ = false;
0086     bool skipIntoNewFile_ = false;
0087     size_t skipToFileSequenceNumber_ = 0;
0088     int skipToOffsetInFinalFile_ = 0;
0089     bool enablePrefetching_;
0090     bool enforceGUIDInFileName_;
0091   };  // class RootPrimaryFileSequence
0092 }  // namespace edm
0093 #endif