49 eventPrincipalHolder_(),
50 adjustEventToNewProductRegistry_(
false),
52 protocolVersion_(0U) {
58 std::unique_ptr<FileBlock>
60 return std::unique_ptr<FileBlock>(
new FileBlock);
68 FDEBUG(6) <<
"mergeIntoRegistry: Product List: " << std::endl;
74 if (!mergeInfo.empty()) {
75 throw cms::Exception(
"MismatchedInput",
"RootInputFileSequence::previousEvent()") << mergeInfo;
91 for(
auto const& item : descs) {
94 FDEBUG(6) <<
"declare: " << real_name << std::endl;
102 for(
auto const& item : descs) {
105 FDEBUG(6) <<
"BuildReadData: " << real_name << std::endl;
114 std::auto_ptr<SendJobHeader>
117 throw cms::Exception(
"StreamTranslation",
"Registry deserialization error")
118 <<
"received wrong message type: expected INIT, got "
119 << initView.
code() <<
"\n";
127 FDEBUG(10) <<
"StreamerInputSource::deserializeRegistry processName = "<<
processName_<< std::endl;
128 FDEBUG(10) <<
"StreamerInputSource::deserializeRegistry protocolVersion_= "<<
protocolVersion_<< std::endl;
137 std::cerr <<
"Error from StreamerInputSource: checksum of Init registry blob failed "
138 <<
" chksum from registry data = " << adler32_chksum <<
" from header = "
145 TBufferFile xbuf(TBuffer::kRead, initView.
descLength(),
146 const_cast<char*
>((
char const*)initView.
descData()),kFALSE);
148 std::auto_ptr<SendJobHeader>
sd((
SendJobHeader*)xbuf.ReadObjectAny(desc));
150 if(
sd.get() ==
nullptr) {
151 throw cms::Exception(
"StreamTranslation",
"Registry deserialization error")
152 <<
"Could not read the initial product registry list\n";
155 sd->initializeTransients();
172 for (
auto const& item : psetMap) {
174 pset.
setID(item.first);
185 throw cms::Exception(
"StreamTranslation",
"Event deserialization error")
186 <<
"received wrong message type: expected EVENT, got "
187 << eventView.
code() <<
"\n";
188 FDEBUG(9) <<
"Decode event: "
189 << eventView.
event() <<
" "
190 << eventView.
run() <<
" "
191 << eventView.
size() <<
" "
200 unsigned long dest_size;
207 std::cerr <<
"Error from StreamerInputSource: checksum of event data blob failed "
208 <<
" chksum from event = " << adler32_chksum <<
" from header = "
212 if(origsize != 78 && origsize != 0) {
219 dest_.resize(dest_size);
220 unsigned char* pos = (
unsigned char*) &
dest_[0];
221 unsigned char const* from = (
unsigned char const*) eventView.
eventData();
237 throw cms::Exception(
"StreamTranslation",
"Event deserialization error")
238 <<
"got a null event from input stream\n";
275 for(
auto& spitem : sps) {
276 FDEBUG(10) <<
"check prodpair" << std::endl;
277 if(spitem.desc() ==
nullptr)
280 <<
" " << spitem.desc()->className()
281 <<
" " << spitem.desc()->productInstanceName()
282 <<
" " << spitem.desc()->branchID()
289 if(spitem.prod() !=
nullptr) {
290 FDEBUG(10) <<
"addproduct next " << spitem.branchID() << std::endl;
291 eventPrincipal.
putOnRead(branchDesc, std::unique_ptr<WrapperBase>(const_cast<WrapperBase*>(spitem.prod())), productProvenance);
292 FDEBUG(10) <<
"addproduct done" << std::endl;
294 FDEBUG(10) <<
"addproduct empty next " << spitem.branchID() << std::endl;
295 eventPrincipal.
putOnRead(branchDesc, std::unique_ptr<WrapperBase>(), productProvenance);
296 FDEBUG(10) <<
"addproduct empty done" << std::endl;
301 FDEBUG(10) <<
"Size = " << eventPrincipal.
size() << std::endl;
314 unsigned int inputSize,
315 std::vector<unsigned char>& outputBuffer,
316 unsigned int expectedFullSize) {
317 unsigned long origSize = expectedFullSize;
318 unsigned long uncompressedSize = expectedFullSize*1.1;
319 FDEBUG(1) <<
"Uncompress: original size = " << origSize
320 <<
", compressed size = " << inputSize
322 outputBuffer.resize(uncompressedSize);
323 int ret = uncompress(&outputBuffer[0], &uncompressedSize,
324 inputBuffer, inputSize);
328 FDEBUG(10) <<
" original size = " << origSize <<
" final size = "
329 << uncompressedSize << std::endl;
330 if(origSize != uncompressedSize) {
331 std::cerr <<
"deserializeEvent: Problem with uncompress, original size = "
332 << origSize <<
" uncompress size = " << uncompressedSize << std::endl;
334 throw cms::Exception(
"StreamDeserialization",
"Uncompression error")
335 <<
"mismatch event lengths should be" << origSize <<
" got "
336 << uncompressedSize <<
"\n";
340 std::cerr <<
"deserializeEvent: Problem with uncompress, return value = "
342 throw cms::Exception(
"StreamDeserialization",
"Uncompression error")
343 <<
"Error code = " << ret <<
"\n ";
345 return (
unsigned int) uncompressedSize;
361 <<
"StreamerInputSource::setRun()\n"
362 <<
"Run number cannot be modified for this type of Input Source\n"
363 <<
"Contact a Storage Manager Developer\n";
372 return eventPrincipal_ ? eventPrincipal_->getIt(
id) :
nullptr;
377 assert(eventPrincipal_ !=
nullptr);
378 return eventPrincipal_->transitionIndex();
383 eventPrincipal_ = ep;
void setID(ParameterSetID const &id)
static Timestamp invalidTimestamp()
const uint8 * eventData() const
const uint8 * descData() const
std::string hostName() const
std::vector< BranchDescription > SendDescs
void doBuildRealData(const std::string &name)
bool registerProcessHistory(ProcessHistory const &processHistory)
void setRefCoreStreamer(bool resetAll=false)
void putOnRead(BranchDescription const &bd, std::unique_ptr< WrapperBase > edp, ProductProvenance const &productProvenance)
TClass * getTClass(const std::type_info &ti)
std::vector< EventSelectionID > EventSelectionIDVector
uint32 adler32_chksum() const
uint32 eventLength() const
uint32 adler32_chksum() const
std::vector< BranchListIndex > BranchListIndexes
std::string hostName() const
std::string merge(ProductRegistry const &other, std::string const &fileName, BranchDescription::MatchMode branchesMustMatch=BranchDescription::Permissive)
void setProcessHistoryID(ProcessHistoryID const &phid)
std::vector< StreamedProduct > SendProds
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=nullptr)
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
uint32 protocolVersion() const
std::string wrappedClassName(std::string const &iFullName)
uint32 origDataSize() const
bool updateFromInput(BranchIDLists const &bidlists)
bool adjustToNewProductRegistry(ProductRegistry const ®)
std::string processName() const
void updateFromInput(ProductList const &other)
void setProcessHistoryID(ProcessHistoryID const &phid)
void adjustIndexesAfterProductRegistryAddition()
uint32 descLength() const
volatile std::atomic< bool > shutdown_flag false
bool insertMapped(value_type const &v)
static Registry * instance()
void loadCap(const std::string &name)