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:
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  std::optional<std::tuple<edm::WrapperBase const*, unsigned int>> getThinnedProduct(ProductID const&,
97  unsigned int) const override;
98  void getThinnedProducts(ProductID const& pid,
99  std::vector<WrapperBase const*>& wrappers,
100  std::vector<unsigned int>& keys) const override;
101  OptionalThinnedKey getThinnedKeyFrom(ProductID const&, unsigned int, ProductID const&) const override;
102 
103  unsigned int transitionIndex_() const override;
104 
106 
107  private:
108  // We don't own the principal. The lifetime must be managed externally.
110  };
111 
112  void read(EventPrincipal& eventPrincipal) override;
113 
114  void setRun(RunNumber_t r) 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)
OptionalThinnedKey getThinnedKeyFrom(ProductID const &, unsigned int, ProductID const &) const override
std::variant< unsigned int, detail::GetThinnedKeyFromExceptionFactory, std::monostate > OptionalThinnedKey
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
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)
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_
edm::propagate_const< TClass * > tc_
HLT enums.
std::vector< edm::propagate_const< std::unique_ptr< EventPrincipalHolder > > > streamToEventPrincipalHolders_
void getThinnedProducts(ProductID const &pid, std::vector< WrapperBase const *> &wrappers, std::vector< unsigned int > &keys) const override
std::optional< std::tuple< edm::WrapperBase const *, unsigned int > > getThinnedProduct(ProductID const &, unsigned int) const override
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)
WrapperBase const * getIt(ProductID const &id) const override
static unsigned int uncompressBuffer(unsigned char *inputBuffer, unsigned int inputSize, std::vector< unsigned char > &outputBuffer, unsigned int expectedFullSize)
std::vector< unsigned char > dest_