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();
244 throw cms::Exception(
"StreamTranslation",
"Event deserialization error")
245 <<
"got a null event from input stream\n";
282 for(
auto& spitem : sps) {
283 FDEBUG(10) <<
"check prodpair" << std::endl;
284 if(spitem.desc() ==
nullptr)
287 <<
" " << spitem.desc()->className()
288 <<
" " << spitem.desc()->productInstanceName()
289 <<
" " << spitem.desc()->branchID()
296 if(spitem.prod() !=
nullptr) {
297 FDEBUG(10) <<
"addproduct next " << spitem.branchID() << std::endl;
298 eventPrincipal.
putOnRead(branchDesc, std::unique_ptr<WrapperBase>(const_cast<WrapperBase*>(spitem.prod())), productProvenance);
299 FDEBUG(10) <<
"addproduct done" << std::endl;
301 FDEBUG(10) <<
"addproduct empty next " << spitem.branchID() << std::endl;
302 eventPrincipal.
putOnRead(branchDesc, std::unique_ptr<WrapperBase>(), productProvenance);
303 FDEBUG(10) <<
"addproduct empty done" << std::endl;
308 FDEBUG(10) <<
"Size = " << eventPrincipal.
size() << std::endl;
321 unsigned int inputSize,
322 std::vector<unsigned char>& outputBuffer,
323 unsigned int expectedFullSize) {
324 unsigned long origSize = expectedFullSize;
325 unsigned long uncompressedSize = expectedFullSize*1.1;
326 FDEBUG(1) <<
"Uncompress: original size = " << origSize
327 <<
", compressed size = " << inputSize
329 outputBuffer.resize(uncompressedSize);
330 int ret = uncompress(&outputBuffer[0], &uncompressedSize,
331 inputBuffer, inputSize);
335 FDEBUG(10) <<
" original size = " << origSize <<
" final size = "
336 << uncompressedSize << std::endl;
337 if(origSize != uncompressedSize) {
338 std::cerr <<
"deserializeEvent: Problem with uncompress, original size = "
339 << origSize <<
" uncompress size = " << uncompressedSize << std::endl;
341 throw cms::Exception(
"StreamDeserialization",
"Uncompression error")
342 <<
"mismatch event lengths should be" << origSize <<
" got "
343 << uncompressedSize <<
"\n";
347 std::cerr <<
"deserializeEvent: Problem with uncompress, return value = "
349 throw cms::Exception(
"StreamDeserialization",
"Uncompression error")
350 <<
"Error code = " << ret <<
"\n ";
352 return (
unsigned int) uncompressedSize;
368 <<
"StreamerInputSource::setRun()\n"
369 <<
"Run number cannot be modified for this type of Input Source\n"
370 <<
"Contact a Storage Manager Developer\n";
379 return eventPrincipal_ ? eventPrincipal_->getIt(
id) :
nullptr;
384 return eventPrincipal_ ? eventPrincipal_->getThinnedProduct(
id, index) :
nullptr;
389 std::vector<WrapperBase const*>& wrappers,
390 std::vector<unsigned int>&
keys)
const {
391 if (eventPrincipal_) eventPrincipal_->getThinnedProducts(pid, wrappers, keys);
397 assert(eventPrincipal_ !=
nullptr);
398 return eventPrincipal_->transitionIndex();
403 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
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
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)