CMS 3D CMS Logo

StreamerInputSource.h
Go to the documentation of this file.
1 #ifndef IOPool_Streamer_StreamerInputSource_h
2 #define IOPool_Streamer_StreamerInputSource_h
3 
11 #include "TBufferFile.h"
12 
16 
19 
20 #include <memory>
21 #include <vector>
22 
23 class InitMsgView;
24 class EventMsgView;
25 
26 namespace edm {
27  class BranchIDListHelper;
29  class ThinnedAssociationsHelper;
30 
32  public:
33  explicit StreamerInputSource(ParameterSet const& pset, InputSourceDescription const& desc);
34  ~StreamerInputSource() override;
36 
37  std::unique_ptr<SendJobHeader> deserializeRegistry(InitMsgView const& initView);
38 
39  void deserializeAndMergeWithRegistry(InitMsgView const& initView, bool subsequent = false);
40 
41  void deserializeEvent(EventMsgView const& eventView);
42 
43  static void mergeIntoRegistry(SendJobHeader const& header,
47  bool subsequent);
48 
52  bool isBufferLZMA(unsigned char const* inputBuffer, unsigned int inputSize);
53 
57  bool isBufferZSTD(unsigned char const* inputBuffer, unsigned int inputSize);
58 
67  static unsigned int uncompressBuffer(unsigned char* inputBuffer,
68  unsigned int inputSize,
69  std::vector<unsigned char>& outputBuffer,
70  unsigned int expectedFullSize);
71 
72  static unsigned int uncompressBufferLZMA(unsigned char* inputBuffer,
73  unsigned int inputSize,
74  std::vector<unsigned char>& outputBuffer,
75  unsigned int expectedFullSize,
76  bool hasHeader = true);
77 
78  static unsigned int uncompressBufferZSTD(unsigned char* inputBuffer,
79  unsigned int inputSize,
80  std::vector<unsigned char>& outputBuffer,
81  unsigned int expectedFullSize,
82  bool hasHeader = true);
83 
84  protected:
85  static void declareStreamers(SendDescs const& descs);
86  static void buildClassCache(SendDescs const& descs);
87  void resetAfterEndRun();
88 
89  private:
91  public:
93  ~EventPrincipalHolder() override;
94 
95  WrapperBase const* getIt(ProductID const& id) const override;
96  WrapperBase const* getThinnedProduct(ProductID const&, unsigned int&) const override;
97  void getThinnedProducts(ProductID const& pid,
98  std::vector<WrapperBase const*>& wrappers,
99  std::vector<unsigned int>& keys) const override;
100 
101  unsigned int transitionIndex_() const override;
102 
104 
105  private:
106  // We don't own the principal. The lifetime must be managed externally.
108  };
109 
110  void read(EventPrincipal& eventPrincipal) override;
111 
112  void setRun(RunNumber_t r) override;
113 
114  std::unique_ptr<FileBlock> readFile_() override;
115 
117  std::vector<unsigned char> dest_;
118  TBufferFile xbuf_;
121  std::vector<edm::propagate_const<std::unique_ptr<EventPrincipalHolder>>> streamToEventPrincipalHolders_;
123 
125  unsigned int protocolVersion_;
126  }; //end-of-class-def
127 } // namespace edm
128 
129 #endif
void read(EventPrincipal &eventPrincipal) override
static void fillDescription(ParameterSetDescription &description)
static void mergeIntoRegistry(SendJobHeader const &header, ProductRegistry &, BranchIDListHelper &, ThinnedAssociationsHelper &, bool subsequent)
std::vector< BranchDescription > SendDescs
bool isBufferZSTD(unsigned char const *inputBuffer, unsigned int inputSize)
bool isBufferLZMA(unsigned char const *inputBuffer, unsigned int inputSize)
std::unique_ptr< SendJobHeader > deserializeRegistry(InitMsgView const &initView)
StreamerInputSource(ParameterSet const &pset, InputSourceDescription const &desc)
void setRun(RunNumber_t r) override
std::unique_ptr< FileBlock > readFile_() override
static void declareStreamers(SendDescs const &descs)
static void buildClassCache(SendDescs const &descs)
edm::propagate_const< std::unique_ptr< EventPrincipalHolder > > eventPrincipalHolder_
void deserializeEvent(EventMsgView const &eventView)
void getThinnedProducts(ProductID const &pid, std::vector< WrapperBase const * > &wrappers, std::vector< unsigned int > &keys) const override
static unsigned int uncompressBufferLZMA(unsigned char *inputBuffer, unsigned int inputSize, std::vector< unsigned char > &outputBuffer, unsigned int expectedFullSize, bool hasHeader=true)
edm::propagate_const< std::unique_ptr< SendEvent > > sendEvent_
WrapperBase const * getThinnedProduct(ProductID const &, unsigned int &) const override
WrapperBase const * getIt(ProductID const &id) const override
edm::propagate_const< TClass * > tc_
HLT enums.
std::vector< edm::propagate_const< std::unique_ptr< EventPrincipalHolder > > > streamToEventPrincipalHolders_
unsigned int RunNumber_t
static unsigned int uncompressBufferZSTD(unsigned char *inputBuffer, unsigned int inputSize, std::vector< unsigned char > &outputBuffer, unsigned int expectedFullSize, bool hasHeader=true)
void deserializeAndMergeWithRegistry(InitMsgView const &initView, bool subsequent=false)
static unsigned int uncompressBuffer(unsigned char *inputBuffer, unsigned int inputSize, std::vector< unsigned char > &outputBuffer, unsigned int expectedFullSize)
std::vector< unsigned char > dest_