Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-19 01:44:13

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     unsigned int nStreams() const { return nStreams_; }
0045     int treeMaxVirtualSize() const { return treeMaxVirtualSize_; }
0046     ProductSelectorRules const& productSelectorRules() const { return productSelectorRules_; }
0047     RunHelperBase* runHelper() { return runHelper_.get(); }
0048 
0049     static void fillDescriptions(ConfigurationDescriptions& descriptions);
0050 
0051   protected:
0052     ItemType getNextItemType() override;
0053     void readLuminosityBlock_(LuminosityBlockPrincipal& lumiPrincipal) override;
0054     std::shared_ptr<LuminosityBlockAuxiliary> readLuminosityBlockAuxiliary_() override;
0055     void readEvent_(EventPrincipal& eventPrincipal) override;
0056 
0057   private:
0058     std::shared_ptr<RunAuxiliary> readRunAuxiliary_() override;
0059     void readRun_(RunPrincipal& runPrincipal) override;
0060     void fillProcessBlockHelper_() override;
0061     bool nextProcessBlock_(ProcessBlockPrincipal&) override;
0062     void readProcessBlock_(ProcessBlockPrincipal&) override;
0063     std::shared_ptr<FileBlock> readFile_() override;
0064     void closeFile_() override;
0065     void endJob() override;
0066     bool readIt(EventID const& id, EventPrincipal& eventPrincipal, StreamContext& streamContext) override;
0067     void skip(int offset) override;
0068     bool goToEvent_(EventID const& eventID) override;
0069     void rewind_() override;
0070     bool randomAccess_() const override;
0071     ProcessingController::ForwardState forwardState_() const override;
0072     ProcessingController::ReverseState reverseState_() const override;
0073 
0074     std::pair<SharedResourcesAcquirer*, std::recursive_mutex*> resourceSharedWithDelayedReader_() override;
0075 
0076     RootServiceChecker rootServiceChecker_;
0077     InputFileCatalog catalog_;
0078     InputFileCatalog secondaryCatalog_;
0079     edm::propagate_const<std::shared_ptr<RunPrincipal>> secondaryRunPrincipal_;
0080     edm::propagate_const<std::shared_ptr<LuminosityBlockPrincipal>> secondaryLumiPrincipal_;
0081     std::vector<edm::propagate_const<std::unique_ptr<EventPrincipal>>> secondaryEventPrincipals_;
0082     std::array<std::vector<BranchID>, NumBranchTypes> branchIDsToReplace_;
0083 
0084     unsigned int nStreams_;
0085     bool skipBadFiles_;
0086     bool bypassVersionCheck_;
0087     int const treeMaxVirtualSize_;
0088     ProductSelectorRules productSelectorRules_;
0089     bool dropDescendants_;
0090     bool labelRawDataLikeMC_;
0091     bool delayReadingEventProducts_;
0092 
0093     edm::propagate_const<std::unique_ptr<RunHelperBase>> runHelper_;
0094     std::unique_ptr<SharedResourcesAcquirer>
0095         resourceSharedWithDelayedReaderPtr_;  // We do not use propagate_const because the acquirer is itself mutable.
0096     std::shared_ptr<std::recursive_mutex> mutexSharedWithDelayedReader_;
0097     edm::propagate_const<std::unique_ptr<RootPrimaryFileSequence>> primaryFileSequence_;
0098     edm::propagate_const<std::unique_ptr<RootSecondaryFileSequence>> secondaryFileSequence_;
0099   };  // class PoolSource
0100 }  // namespace edm
0101 #endif