50 eventPrincipalHolder_(),
51 adjustEventToNewProductRegistry_(
false),
53 protocolVersion_(0U) {
59 std::unique_ptr<FileBlock>
61 return std::unique_ptr<FileBlock>(
new FileBlock);
73 FDEBUG(6) <<
"mergeIntoRegistry: Product List: " << std::endl;
79 if (!mergeInfo.empty()) {
80 throw cms::Exception(
"MismatchedInput",
"RootInputFileSequence::previousEvent()") << mergeInfo;
98 for(
auto const& item : descs) {
101 FDEBUG(6) <<
"declare: " << real_name << std::endl;
109 for(
auto const& item : descs) {
112 FDEBUG(6) <<
"BuildReadData: " << real_name << std::endl;
121 std::auto_ptr<SendJobHeader>
124 throw cms::Exception(
"StreamTranslation",
"Registry deserialization error")
125 <<
"received wrong message type: expected INIT, got "
126 << initView.
code() <<
"\n";
134 FDEBUG(10) <<
"StreamerInputSource::deserializeRegistry processName = "<<
processName_<< std::endl;
135 FDEBUG(10) <<
"StreamerInputSource::deserializeRegistry protocolVersion_= "<<
protocolVersion_<< std::endl;
144 std::cerr <<
"Error from StreamerInputSource: checksum of Init registry blob failed "
145 <<
" chksum from registry data = " << adler32_chksum <<
" from header = "
152 TBufferFile xbuf(TBuffer::kRead, initView.
descLength(),
153 const_cast<char*
>((
char const*)initView.
descData()),kFALSE);
155 std::auto_ptr<SendJobHeader>
sd((
SendJobHeader*)xbuf.ReadObjectAny(desc));
157 if(
sd.get() ==
nullptr) {
158 throw cms::Exception(
"StreamTranslation",
"Registry deserialization error")
159 <<
"Could not read the initial product registry list\n";
162 sd->initializeTransients();
179 for (
auto const& item : psetMap) {
181 pset.
setID(item.first);
192 throw cms::Exception(
"StreamTranslation",
"Event deserialization error")
193 <<
"received wrong message type: expected EVENT, got "
194 << eventView.
code() <<
"\n";
195 FDEBUG(9) <<
"Decode event: "
196 << eventView.
event() <<
" "
197 << eventView.
run() <<
" "
198 << eventView.
size() <<
" "
207 unsigned long dest_size;
214 std::cerr <<
"Error from StreamerInputSource: checksum of event data blob failed "
215 <<
" chksum from event = " << adler32_chksum <<
" from header = "
219 if(origsize != 78 && origsize != 0) {
226 dest_.resize(dest_size);
227 unsigned char* pos = (
unsigned char*) &
dest_[0];
228 unsigned char const* from = (
unsigned char const*) eventView.
eventData();
249 if(sendEvent_.get() ==
nullptr) {
250 throw cms::Exception(
"StreamTranslation",
"Event deserialization error")
251 <<
"got a null event from input stream\n";
255 FDEBUG(5) <<
"Got event: " << sendEvent_->aux().id() <<
" " << sendEvent_->products().size() << std::endl;
295 for(
auto& spitem : sps) {
296 FDEBUG(10) <<
"check prodpair" << std::endl;
297 if(spitem.desc() ==
nullptr)
300 <<
" " << spitem.desc()->className()
301 <<
" " << spitem.desc()->productInstanceName()
302 <<
" " << spitem.desc()->branchID()
309 if(spitem.prod() !=
nullptr) {
310 FDEBUG(10) <<
"addproduct next " << spitem.branchID() << std::endl;
311 eventPrincipal.
putOnRead(branchDesc, std::unique_ptr<WrapperBase>(const_cast<WrapperBase*>(spitem.prod())), productProvenance);
312 FDEBUG(10) <<
"addproduct done" << std::endl;
314 FDEBUG(10) <<
"addproduct empty next " << spitem.branchID() << std::endl;
315 eventPrincipal.
putOnRead(branchDesc, std::unique_ptr<WrapperBase>(), productProvenance);
316 FDEBUG(10) <<
"addproduct empty done" << std::endl;
321 FDEBUG(10) <<
"Size = " << eventPrincipal.
size() << std::endl;
334 unsigned int inputSize,
335 std::vector<unsigned char>& outputBuffer,
336 unsigned int expectedFullSize) {
337 unsigned long origSize = expectedFullSize;
338 unsigned long uncompressedSize = expectedFullSize*1.1;
339 FDEBUG(1) <<
"Uncompress: original size = " << origSize
340 <<
", compressed size = " << inputSize
342 outputBuffer.resize(uncompressedSize);
343 int ret = uncompress(&outputBuffer[0], &uncompressedSize,
344 inputBuffer, inputSize);
348 FDEBUG(10) <<
" original size = " << origSize <<
" final size = "
349 << uncompressedSize << std::endl;
350 if(origSize != uncompressedSize) {
351 std::cerr <<
"deserializeEvent: Problem with uncompress, original size = "
352 << origSize <<
" uncompress size = " << uncompressedSize << std::endl;
354 throw cms::Exception(
"StreamDeserialization",
"Uncompression error")
355 <<
"mismatch event lengths should be" << origSize <<
" got "
356 << uncompressedSize <<
"\n";
360 std::cerr <<
"deserializeEvent: Problem with uncompress, return value = "
362 throw cms::Exception(
"StreamDeserialization",
"Uncompression error")
363 <<
"Error code = " << ret <<
"\n ";
365 return (
unsigned int) uncompressedSize;
381 <<
"StreamerInputSource::setRun()\n"
382 <<
"Run number cannot be modified for this type of Input Source\n"
383 <<
"Contact a Storage Manager Developer\n";
392 return eventPrincipal_ ? eventPrincipal_->getIt(
id) :
nullptr;
397 return eventPrincipal_ ? eventPrincipal_->getThinnedProduct(
id, index) :
nullptr;
402 std::vector<WrapperBase const*>& wrappers,
403 std::vector<unsigned int>&
keys)
const {
404 if (eventPrincipal_) eventPrincipal_->getThinnedProducts(pid, wrappers, keys);
410 assert(eventPrincipal_ !=
nullptr);
411 return eventPrincipal_->transitionIndex();
416 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)
void updateFromInput(ThinnedAssociationsHelper const &, bool isSecondaryFile, std::vector< BranchID > const &associationsFromSecondary)
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
StreamID streamID() const
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 Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
uint32 protocolVersion() const
unsigned int value() const
std::string wrappedClassName(std::string const &iFullName)
uint32 origDataSize() const
bool updateFromInput(BranchIDLists const &bidlists)
void fillEventPrincipal(EventAuxiliary const &aux, ProcessHistoryRegistry const &processHistoryRegistry, DelayedReader *reader=0)
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)