Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef IOPool_Input_EmbeddedRootSource_h
0002 #define IOPool_Input_EmbeddedRootSource_h
0003 
0004 /*----------------------------------------------------------------------
0005 
0006 EmbeddedRootSource: This is an InputSource
0007 
0008 ----------------------------------------------------------------------*/
0009 
0010 #include "FWCore/Catalog/interface/InputFileCatalog.h"
0011 #include "FWCore/Framework/interface/Frameworkfwd.h"
0012 #include "FWCore/Framework/interface/ProductSelectorRules.h"
0013 #include "FWCore/Sources/interface/VectorInputSource.h"
0014 #include "FWCore/Utilities/interface/propagate_const.h"
0015 #include "IOPool/Common/interface/RootServiceChecker.h"
0016 
0017 #include <array>
0018 #include <memory>
0019 #include <string>
0020 #include <vector>
0021 
0022 namespace CLHEP {
0023   class HepRandomEngine;
0024 }
0025 
0026 namespace edm {
0027 
0028   class ConfigurationDescriptions;
0029   class FileCatalogItem;
0030   class RunHelperBase;
0031   class RootEmbeddedFileSequence;
0032   struct VectorInputSourceDescription;
0033 
0034   class EmbeddedRootSource : public VectorInputSource {
0035   public:
0036     explicit EmbeddedRootSource(ParameterSet const& pset, VectorInputSourceDescription const& desc);
0037     ~EmbeddedRootSource() override;
0038     using VectorInputSource::processHistoryRegistryForUpdate;
0039     using VectorInputSource::productRegistryUpdate;
0040 
0041     // const accessors
0042     bool skipBadFiles() const { return skipBadFiles_; }
0043     bool bypassVersionCheck() const { return bypassVersionCheck_; }
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   private:
0052     virtual void closeFile_();
0053     void beginJob() override;
0054     void endJob() override;
0055     bool readOneEvent(EventPrincipal& cache,
0056                       size_t& fileNameHash,
0057                       CLHEP::HepRandomEngine*,
0058                       EventID const* id,
0059                       bool recycleFiles) override;
0060     void readOneSpecified(EventPrincipal& cache, size_t& fileNameHash, SecondaryEventIDAndFileInfo const& id) override;
0061     void dropUnwantedBranches_(std::vector<std::string> const& wantedBranches) override;
0062 
0063     RootServiceChecker rootServiceChecker_;
0064 
0065     unsigned int nStreams_;
0066     bool skipBadFiles_;
0067     bool bypassVersionCheck_;
0068     int const treeMaxVirtualSize_;
0069     ProductSelectorRules productSelectorRules_;
0070     std::unique_ptr<RunHelperBase> runHelper_;
0071 
0072     InputFileCatalog catalog_;
0073     edm::propagate_const<std::unique_ptr<RootEmbeddedFileSequence>> fileSequence_;
0074 
0075   };  // class EmbeddedRootSource
0076 }  // namespace edm
0077 #endif