Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2025-05-23 02:05:06

0001 #ifndef IOPool_Input_PoolSource_h
0002 #define IOPool_Input_PoolSource_h
0003 
0004 /*----------------------------------------------------------------------
0005 
0006 PoolSource: This is an InputSource
0007 
0008 ----------------------------------------------------------------------*/
0009 
0010 #include "DataFormats/Provenance/interface/BranchType.h"
0011 #include "FWCore/Catalog/interface/InputFileCatalog.h"
0012 #include "FWCore/Framework/interface/Frameworkfwd.h"
0013 #include "FWCore/Framework/interface/ProcessingController.h"
0014 #include "FWCore/Framework/interface/ProductSelectorRules.h"
0015 #include "FWCore/Framework/interface/InputSource.h"
0016 #include "FWCore/Utilities/interface/propagate_const.h"
0017 #include "IOPool/Common/interface/RootServiceChecker.h"
0018 
0019 #include <array>
0020 #include <memory>
0021 #include <string>
0022 #include <vector>
0023 
0024 namespace edm {
0025 
0026   class ConfigurationDescriptions;
0027   class FileCatalogItem;
0028   class RootPrimaryFileSequence;
0029   class RootSecondaryFileSequence;
0030   class RunHelperBase;
0031 
0032   class PoolSource : public InputSource {
0033   public:
0034     explicit PoolSource(ParameterSet const& pset, InputSourceDescription const& desc);
0035     ~PoolSource() override;
0036     using InputSource::processHistoryRegistryForUpdate;
0037     using InputSource::productRegistryUpdate;
0038 
0039     // const accessors
0040     bool skipBadFiles() const { return skipBadFiles_; }
0041     bool dropDescendants() const { return dropDescendants_; }
0042     bool bypassVersionCheck() const { return bypassVersionCheck_; }
0043     bool labelRawDataLikeMC() const { return labelRawDataLikeMC_; }
0044     bool delayReadingEventProducts() const { return delayReadingEventProducts_; }
0045     unsigned int nStreams() const { return nStreams_; }
0046     int treeMaxVirtualSize() const { return treeMaxVirtualSize_; }
0047     ProductSelectorRules const& productSelectorRules() const { return productSelectorRules_; }
0048     RunHelperBase* runHelper() { return runHelper_.get(); }
0049 
0050     static void fillDescriptions(ConfigurationDescriptions& descriptions);
0051 
0052   protected:
0053     ItemTypeInfo getNextItemType() override;
0054     void readLuminosityBlock_(LuminosityBlockPrincipal& lumiPrincipal) override;
0055     std::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_() override;
0056     void readEvent_(EventPrincipal& eventPrincipal) override;
0057 
0058   private:
0059     std::shared_ptr<RunAuxiliary> readRunAuxiliary_() override;
0060     void readRun_(RunPrincipal& runPrincipal) override;
0061     void fillProcessBlockHelper_() override;
0062     bool nextProcessBlock_(ProcessBlockPrincipal&) override;
0063     void readProcessBlock_(ProcessBlockPrincipal&) override;
0064     std::shared_ptr<FileBlock> readFile_() override;
0065     void closeFile_() override;
0066     void endJob() override;
0067     bool readIt(EventID const& id, EventPrincipal& eventPrincipal, StreamContext& streamContext) override;
0068     void skip(int offset) override;
0069     bool goToEvent_(EventID const& eventID) override;
0070     void rewind_() override;
0071     bool randomAccess_() const override;
0072     ProcessingController::ForwardState forwardState_() const override;
0073     ProcessingController::ReverseState reverseState_() const override;
0074 
0075     std::pair<SharedResourcesAcquirer*, std::recursive_mutex*> resourceSharedWithDelayedReader_() override;
0076 
0077     RootServiceChecker rootServiceChecker_;
0078     InputFileCatalog catalog_;
0079     InputFileCatalog secondaryCatalog_;
0080     edm::propagate_const<std::shared_ptr<RunPrincipal>> secondaryRunPrincipal_;
0081     edm::propagate_const<std::shared_ptr<LuminosityBlockPrincipal>> secondaryLumiPrincipal_;
0082     std::vector<edm::propagate_const<std::unique_ptr<EventPrincipal>>> secondaryEventPrincipals_;
0083     std::array<std::vector<BranchID>, NumBranchTypes> branchIDsToReplace_;
0084 
0085     unsigned int nStreams_;
0086     bool skipBadFiles_;
0087     bool bypassVersionCheck_;
0088     int const treeMaxVirtualSize_;
0089     ProductSelectorRules productSelectorRules_;
0090     bool dropDescendants_;
0091     bool labelRawDataLikeMC_;
0092     bool delayReadingEventProducts_;
0093 
0094     edm::propagate_const<std::unique_ptr<RunHelperBase>> runHelper_;
0095     std::unique_ptr<SharedResourcesAcquirer>
0096         resourceSharedWithDelayedReaderPtr_;  // We do not use propagate_const because the acquirer is itself mutable.
0097     std::shared_ptr<std::recursive_mutex> mutexSharedWithDelayedReader_;
0098     edm::propagate_const<std::unique_ptr<RootPrimaryFileSequence>> primaryFileSequence_;
0099     edm::propagate_const<std::unique_ptr<RootSecondaryFileSequence>> secondaryFileSequence_;
0100   };  // class PoolSource
0101 }  // namespace edm
0102 #endif