31 serializer_(selections),
32 useCompression_(ps.getUntrackedParameter<bool>(
"use_compression")),
33 compressionAlgoStr_(ps.getUntrackedParameter<std::
string>(
"compression_algorithm")),
34 compressionLevel_(ps.getUntrackedParameter<int>(
"compression_level")),
35 lumiSectionInterval_(ps.getUntrackedParameter<int>(
"lumiSection_interval")),
38 hltTriggerSelections_(),
41 int minCompressionLevel = 1;
42 int maxCompressionLevel = 9;
46 struct timezone dummyTZ;
47 gettimeofday(&now, &dummyTZ);
48 timeInSecSinceUTC =
static_cast<double>(now.tv_sec) + (static_cast<double>(now.tv_usec) / 1000000.0);
55 minCompressionLevel = 0;
58 maxCompressionLevel = 20;
64 throw cms::Exception(
"StreamerOutputModuleCommon",
"Compression type unknown")
74 << maxCompressionLevel << std::endl;
94 uLong crc = crc32(0
L, Z_NULL, 0);
95 Bytef
const*
buf = (Bytef
const*)(moduleLabel.data());
96 crc = crc32(crc, buf, moduleLabel.length());
118 unsigned int new_size = src_size + 50000;
137 l1_names.push_back(
"t1");
138 l1_names.push_back(
"t10");
139 l1_names.push_back(
"t2");
143 auto init_message = std::make_unique<InitMsgBuilder>(&sbuf.
header_buf_[0],
158 std::copy(src, src + src_size, init_message->dataAddress());
159 init_message->setDataLength(src_size);
165 std::vector<unsigned char>& hltbits)
const {
168 std::vector<unsigned char> vHltState;
170 if (triggerResults.
isValid()) {
172 vHltState.push_back(((triggerResults->at(
i)).
state()));
182 if (!vHltState.empty()) {
183 unsigned int packInOneByte = 4;
184 unsigned int sizeOfPackage = 1 + ((vHltState.size() - 1) / packInOneByte);
186 hltbits.resize(sizeOfPackage);
187 std::fill(hltbits.begin(), hltbits.end(), 0);
190 unsigned int whichByte =
i / packInOneByte;
191 unsigned int indxWithinByte =
i % packInOneByte;
192 hltbits[whichByte] = hltbits[whichByte] | (vHltState[
i] << (indxWithinByte * 2));
214 std::vector<bool> l1bit = {
true,
true,
false};
217 std::vector<unsigned char> hltbits;
225 struct timezone dummyTZ;
226 gettimeofday(&now, &dummyTZ);
228 static_cast<double>(now.tv_sec) + (static_cast<double>(now.tv_usec) / 1000000.0) -
timeInSecSinceUTC;
240 auto msg = std::make_unique<EventMsgBuilder>(&sbuf.
header_buf_[0],
255 if (headerSize > reserve_size)
256 throw cms::Exception(
"StreamerOutputModuleCommon",
"Header Overflow")
257 <<
" header of size " << headerSize <<
"bytes is too big to fit into the reserved buffer space";
260 msg->setBufAddr(&sbuf.
comp_buf_[reserve_size - headerSize]);
265 msg->setEventLength(src_size);
267 msg->setOrigDataSize(
270 msg->setOrigDataSize(0);
276 desc.
addUntracked<
int>(
"max_event_size", 7000000)->setComment(
"Obsolete parameter.");
278 ->setComment(
"If True, compression will be used to write streamer file.");
280 ->setComment(
"Compression algorithm to use: UNCOMPRESSED, ZLIB, LZMA or ZSTD");
281 desc.
addUntracked<
int>(
"compression_level", 1)->setComment(
"Compression level to use on serialized ROOT events");
284 "If 0, use lumi section number from event.\n"
285 "If not 0, the interval in seconds between fake lumi sections.");
EventNumber_t event() const
EventID const & id() const
std::unique_ptr< EventMsgBuilder > serializeEvent(SerializeDataBuffer &sbuf, EventForOutput const &e, Handle< TriggerResults > const &triggerResults, ParameterSetID const &selectorCfg)
std::vector< BranchIDList > BranchIDLists
value_type compactForm() const
Strings hltTriggerSelections_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
EventSelector::Strings Strings
std::vector< std::pair< BranchDescription const *, EDGetToken > > SelectedProducts
unsigned int currentSpaceUsed() const
std::vector< unsigned char > comp_buf_
std::unique_ptr< SerializeDataBuffer > serializerBuffer_
StreamerOutputModuleCommon(ParameterSet const &ps, SelectedProducts const *selections, std::string const &moduleLabel)
static void fillDescription(ParameterSetDescription &desc)
static std::vector< std::string > getEventSelectionVString(edm::ParameterSet const &pset)
unsigned char const * bufferPointer() const
int serializeRegistry(SerializeDataBuffer &data_buffer, const BranchIDLists &branchIDLists, ThinnedAssociationsHelper const &thinnedAssociationsHelper)
std::string compressionAlgoStr_
std::string getReleaseVersion()
void setHltMask(EventForOutput const &e, Handle< TriggerResults > const &triggerResults, std::vector< unsigned char > &hltbits) const
void fill(std::map< std::string, TH1 * > &h, const std::string &s, double x)
std::unique_ptr< InitMsgBuilder > serializeRegistry(SerializeDataBuffer &sbuf, BranchIDLists const &branchLists, ThinnedAssociationsHelper const &helper, std::string const &processName, std::string const &moduleLabel, ParameterSetID const &toplevel, SendJobHeader::ParameterSetMap const *psetMap)
static std::string const triggerResults("TriggerResults")
int serializeEvent(SerializeDataBuffer &data_buffer, EventForOutput const &event, ParameterSetID const &selectorConfig, StreamerCompressionAlgo compressionAlgo, int compression_level, unsigned int reserveSize) const
StreamSerializer serializer_
uint32_t adler32_chksum() const
~StreamerOutputModuleCommon()
std::vector< std::string > const & getAllTriggerNames()
SerializeDataBuffer * getSerializerBuffer()
StreamerCompressionAlgo compressionAlgo_
LuminosityBlockNumber_t luminosityBlock() const
static constexpr unsigned int reserve_size
unsigned int currentEventSize() const