#include <IOPool/Streamer/interface/StreamerInputSource.h>
Public Member Functions | |
void | deserializeAndMergeWithRegistry (InitMsgView const &initView, bool subsequent=false) |
Deserializes the specified init message into a SendJobHeader object and merges registries. | |
std::auto_ptr< EventPrincipal > | deserializeEvent (EventMsgView const &eventView) |
Deserializes the specified event message into an EventPrincipal object. | |
StreamerInputSource (ParameterSet const &pset, InputSourceDescription const &desc) | |
virtual | ~StreamerInputSource () |
Static Public Member Functions | |
static std::auto_ptr < SendJobHeader > | deserializeRegistry (InitMsgView const &initView) |
Deserializes the specified init message into a SendJobHeader object (which is related to the product registry). | |
static void | mergeIntoRegistry (SendJobHeader const &header, ProductRegistry &, bool subsequent) |
static unsigned int | uncompressBuffer (unsigned char *inputBuffer, unsigned int inputSize, std::vector< unsigned char > &outputBuffer, unsigned int expectedFullSize) |
Uncompresses the data in the specified input buffer into the specified output buffer. | |
Protected Member Functions | |
void | resetAfterEndRun () |
void | saveTriggerNames (InitMsgView const *header) |
void | setEndRun () |
Static Protected Member Functions | |
static void | buildClassCache (SendDescs const &descs) |
static void | declareStreamers (SendDescs const &descs) |
Protected Attributes | |
bool | inputFileTransitionsEachEvent_ |
Private Member Functions | |
virtual ItemType | getNextItemType () |
virtual std::auto_ptr < EventPrincipal > | read ()=0 |
virtual std::auto_ptr < EventPrincipal > | readEvent_ () |
virtual boost::shared_ptr < FileBlock > | readFile_ () |
virtual boost::shared_ptr < LuminosityBlockPrincipal > | readLuminosityBlock_ () |
virtual boost::shared_ptr < RunPrincipal > | readRun_ () |
virtual void | setRun (RunNumber_t r) |
Private Attributes | |
std::vector< unsigned char > | dest_ |
std::auto_ptr< EventPrincipal > | ep_ |
bool | newLumi_ |
bool | newRun_ |
ProductGetter | productGetter_ |
bool | runEndingFlag_ |
TClass * | tc_ |
RootBuffer | xbuf_ |
Static Private Attributes | |
static std::string | processName_ |
static unsigned int | protocolVersion_ |
Classes | |
class | ProductGetter |
Definition at line 34 of file StreamerInputSource.h.
edm::StreamerInputSource::StreamerInputSource | ( | ParameterSet const & | pset, | |
InputSourceDescription const & | desc | |||
) | [explicit] |
Definition at line 49 of file StreamerInputSource.cc.
00051 : 00052 InputSource(pset, desc), 00053 // The value for the following parameter gets overwritten in at least one derived class 00054 // where it has a different default value. 00055 inputFileTransitionsEachEvent_( 00056 pset.getUntrackedParameter<bool>("inputFileTransitionsEachEvent", false)), 00057 newRun_(true), 00058 newLumi_(true), 00059 ep_(), 00060 tc_(getTClass(typeid(SendEvent))), 00061 dest_(init_size), 00062 xbuf_(TBuffer::kRead, init_size), 00063 runEndingFlag_(false), 00064 productGetter_() 00065 { 00066 }
edm::StreamerInputSource::~StreamerInputSource | ( | ) | [virtual] |
Definition at line 125 of file StreamerInputSource.cc.
References edm::doBuildRealData(), e, lat::endl(), FDEBUG, i, and edm::wrappedClassName().
Referenced by mergeIntoRegistry().
00125 { 00126 SendDescs::const_iterator i(descs.begin()), e(descs.end()); 00127 00128 for(; i != e; ++i) { 00129 //pi->init(); 00130 std::string const real_name = wrappedClassName(i->className()); 00131 FDEBUG(6) << "BuildReadData: " << real_name << std::endl; 00132 doBuildRealData(real_name); 00133 } 00134 }
Definition at line 112 of file StreamerInputSource.cc.
References e, lat::endl(), FDEBUG, i, edm::loadCap(), and edm::wrappedClassName().
Referenced by mergeIntoRegistry().
00112 { 00113 SendDescs::const_iterator i(descs.begin()), e(descs.end()); 00114 00115 for(; i != e; ++i) { 00116 //pi->init(); 00117 std::string const real_name = wrappedClassName(i->className()); 00118 FDEBUG(6) << "declare: " << real_name << std::endl; 00119 loadCap(real_name); 00120 } 00121 }
void edm::StreamerInputSource::deserializeAndMergeWithRegistry | ( | InitMsgView const & | initView, | |
bool | subsequent = false | |||
) |
Deserializes the specified init message into a SendJobHeader object and merges registries.
Definition at line 250 of file StreamerInputSource.cc.
References deserializeRegistry(), i, edm::detail::ThreadSafeRegistry< KEY, T, E >::insertMapped(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), k, mergeIntoRegistry(), and edm::InputSource::productRegistryUpdate().
Referenced by edm::StreamerInputModule< Producer >::read(), edm::EventStreamHttpReader::readHeader(), edm::OnlineHttpReader::readHeader(), and edm::StreamerInputModule< Producer >::StreamerInputModule().
00251 { 00252 std::auto_ptr<SendJobHeader> sd = deserializeRegistry(initView); 00253 mergeIntoRegistry(*sd, productRegistryUpdate(), subsequent); 00254 ModuleDescriptionRegistry & moduleDescriptionRegistry = *ModuleDescriptionRegistry::instance(); 00255 ModuleDescriptionMap const& mdMap = sd->moduleDescriptionMap(); 00256 for (ModuleDescriptionMap::const_iterator k = mdMap.begin(), kEnd = mdMap.end(); k != kEnd; ++k) { 00257 moduleDescriptionRegistry.insertMapped(k->second); 00258 } 00259 SendJobHeader::ParameterSetMap const & psetMap = sd->processParameterSet(); 00260 pset::Registry& psetRegistry = *pset::Registry::instance(); 00261 for (SendJobHeader::ParameterSetMap::const_iterator i = psetMap.begin(), iEnd = psetMap.end(); i != iEnd; ++i) { 00262 psetRegistry.insertMapped(ParameterSet(i->second.pset_)); 00263 } 00264 }
std::auto_ptr< EventPrincipal > edm::StreamerInputSource::deserializeEvent | ( | EventMsgView const & | eventView | ) |
Deserializes the specified event message into an EventPrincipal object.
Definition at line 270 of file StreamerInputSource.cc.
References EventMsgView::code(), edmNew::copy(), dest_, lat::endl(), EventMsgView::event(), Header::EVENT, EventMsgView::eventData(), EventMsgView::eventLength(), Exception, FDEBUG, Capri::details::from(), edm::ProcessConfiguration::id(), edm::ProductID::id(), edm::detail::ThreadSafeRegistry< KEY, T, E >::instance(), edm::Timestamp::invalidTimestamp(), EventMsgView::lumi(), edm::lumiAux, edm::InputSource::luminosityBlock(), edm::InputSource::luminosityBlockPrincipal(), newLumi_, newRun_, EventMsgView::origDataSize(), edm::InputSource::processConfiguration(), productGetter_, edm::InputSource::productRegistry(), edm::InputSource::productRegistryUpdate(), edm::InputSource::resetLuminosityBlockPrincipal(), edm::InputSource::run(), EventMsgView::run(), edm::runAux, edm::InputSource::runPrincipal(), edm::StreamerInputSource::ProductGetter::setEventPrincipal(), edm::InputSource::setLuminosityBlockPrincipal(), edm::ProductRegistry::setNextID(), edm::ProductRegistry::setProductIDs(), edm::setRefCoreStreamer(), edm::InputSource::setRunPrincipal(), EventMsgView::size(), tc_, uncompressBuffer(), and xbuf_.
Referenced by edm::OnlineHttpReader::getOneEvent(), edm::EventStreamHttpReader::getOneEvent(), and edm::StreamerInputModule< Producer >::read().
00271 { 00272 if(eventView.code() != Header::EVENT) 00273 throw cms::Exception("StreamTranslation","Event deserialization error") 00274 << "received wrong message type: expected EVENT, got " 00275 << eventView.code() << "\n"; 00276 FDEBUG(9) << "Decode event: " 00277 << eventView.event() << " " 00278 << eventView.run() << " " 00279 << eventView.size() << " " 00280 << eventView.eventLength() << " " 00281 << eventView.eventData() 00282 << std::endl; 00283 EventSourceSentry(*this); 00284 // uncompress if we need to 00285 // 78 was a dummy value (for no uncompressed) - should be 0 for uncompressed 00286 // need to get rid of this when 090 MTCC streamers are gotten rid of 00287 unsigned long origsize = eventView.origDataSize(); 00288 unsigned long dest_size; //(should be >= eventView.origDataSize() ) 00289 00290 if(origsize != 78 && origsize != 0) 00291 { 00292 // compressed 00293 dest_size = uncompressBuffer((unsigned char*)eventView.eventData(), 00294 eventView.eventLength(), dest_, origsize); 00295 } 00296 else // not compressed 00297 { 00298 // we need to copy anyway the buffer as we are using dest in xbuf 00299 dest_size = eventView.eventLength(); 00300 dest_.resize(dest_size); 00301 unsigned char* pos = (unsigned char*) &dest_[0]; 00302 unsigned char* from = (unsigned char*) eventView.eventData(); 00303 std::copy(from,from+dest_size,pos); 00304 } 00305 //TBuffer xbuf(TBuffer::kRead, dest_size, 00306 // (char*) &dest[0],kFALSE); 00307 //TBuffer xbuf(TBuffer::kRead, eventView.eventLength(), 00308 // (char*) eventView.eventData(),kFALSE); 00309 xbuf_.Reset(); 00310 xbuf_.SetBuffer(&dest_[0],dest_size,kFALSE); 00311 RootDebug tracer(10,10); 00312 00313 setRefCoreStreamer(&productGetter_); 00314 std::auto_ptr<SendEvent> sd((SendEvent*)xbuf_.ReadObjectAny(tc_)); 00315 00316 if(sd.get()==0) { 00317 throw cms::Exception("StreamTranslation","Event deserialization error") 00318 << "got a null event from input stream\n"; 00319 } 00320 sd->processHistory().setDefaultTransients(); 00321 ProcessHistoryRegistry::instance()->insertMapped(sd->processHistory()); 00322 00323 FDEBUG(5) << "Got event: " << sd->aux().id() << " " << sd->products().size() << std::endl; 00324 if(!runPrincipal() || runPrincipal()->run() != sd->aux().run()) { 00325 newRun_ = newLumi_ = true; 00326 RunAuxiliary runAux(sd->aux().run(), sd->aux().time(), Timestamp::invalidTimestamp()); 00327 setRunPrincipal(boost::shared_ptr<RunPrincipal>( 00328 new RunPrincipal(runAux, 00329 productRegistry(), 00330 processConfiguration()))); 00331 resetLuminosityBlockPrincipal(); 00332 } 00333 if(!luminosityBlockPrincipal() || luminosityBlockPrincipal()->luminosityBlock() != eventView.lumi()) { 00334 00335 LuminosityBlockAuxiliary lumiAux(runPrincipal()->run(), eventView.lumi(), sd->aux().time(), Timestamp::invalidTimestamp()); 00336 setLuminosityBlockPrincipal(boost::shared_ptr<LuminosityBlockPrincipal>( 00337 new LuminosityBlockPrincipal(lumiAux, 00338 productRegistry(), 00339 processConfiguration()))); 00340 newLumi_ = true; 00341 } 00342 00343 std::auto_ptr<EventPrincipal> ep(new EventPrincipal(sd->aux(), 00344 productRegistry(), 00345 processConfiguration(), 00346 sd->processHistory().id())); 00347 productGetter_.setEventPrincipal(ep.get()); 00348 00349 // no process name list handling 00350 00351 ProductID largestID; 00352 SendProds & sps = sd->products(); 00353 for(SendProds::iterator spi = sps.begin(), spe = sps.end(); spi != spe; ++spi) { 00354 FDEBUG(10) << "check prodpair" << std::endl; 00355 if(spi->desc() == 0) 00356 throw cms::Exception("StreamTranslation","Empty Provenance"); 00357 FDEBUG(5) << "Prov:" 00358 << " " << spi->desc()->className() 00359 << " " << spi->desc()->productInstanceName() 00360 << " " << spi->desc()->branchID() 00361 << std::endl; 00362 00363 ConstBranchDescription branchDesc(*spi->desc()); 00364 // This EventEntryInfo constructor inserts into the entry description registry 00365 boost::shared_ptr<EventEntryInfo> eventEntryDesc( 00366 new EventEntryInfo(spi->branchID(), 00367 spi->status(), 00368 spi->mod(), 00369 spi->productID(), 00370 *spi->parents())); 00371 00372 ep->branchMapperPtr()->insert(*eventEntryDesc); 00373 if(spi->productID() > largestID) { 00374 largestID = spi->productID(); 00375 } 00376 if(spi->prod() != 0) { 00377 std::auto_ptr<EDProduct> aprod(const_cast<EDProduct*>(spi->prod())); 00378 FDEBUG(10) << "addgroup next " << spi->branchID() << std::endl; 00379 ep->addGroup(aprod, branchDesc, eventEntryDesc); 00380 FDEBUG(10) << "addgroup done" << std::endl; 00381 } else { 00382 FDEBUG(10) << "addgroup empty next " << spi->branchID() << std::endl; 00383 ep->addGroup(branchDesc, eventEntryDesc); 00384 FDEBUG(10) << "addgroup empty done" << std::endl; 00385 } 00386 spi->clear(); 00387 } 00388 00389 if(largestID.id() >= productRegistry()->nextID()) { 00390 edm::LogError("MetaDataError")<<"The input file has a critical problem, the 'nextID' for the ProductRegistry (" 00391 <<productRegistry()->nextID() 00392 <<")\n is less than the largest ProductID (" 00393 <<largestID.id() 00394 <<") used in a previous process.\n" 00395 " Will modify the ProductRegistry to attempt to correct the problem,\n" 00396 " although it is possible that edm::Ref*'s or edm::Ptr's may still fail.\n" 00397 " Please contact StreamerOutputModule developers."; 00398 //NOTE: this works since only EDProducers get their ProductIDs for the event from 00399 // the ProductRegistry and they do not do that until they 'put' their data 00400 // so at this point no one has tried to use the ProductIDs yet 00401 productRegistryUpdate().setNextID(largestID.id()+1); 00402 productRegistryUpdate().setProductIDs(largestID.id()+1); 00403 } 00404 FDEBUG(10) << "Size = " << ep->size() << std::endl; 00405 00406 return ep; 00407 }
std::auto_ptr< SendJobHeader > edm::StreamerInputSource::deserializeRegistry | ( | InitMsgView const & | initView | ) | [static] |
Deserializes the specified init message into a SendJobHeader object (which is related to the product registry).
Definition at line 213 of file StreamerInputSource.cc.
References InitMsgView::code(), InitMsgView::descData(), InitMsgView::descLength(), lat::endl(), Exception, FDEBUG, edm::getTClass(), Header::INIT, InitMsgView::processName(), processName_, InitMsgView::protocolVersion(), and protocolVersion_.
Referenced by deserializeAndMergeWithRegistry(), and edm::readHeaderFromStream().
00214 { 00215 if(initView.code() != Header::INIT) 00216 throw cms::Exception("StreamTranslation","Registry deserialization error") 00217 << "received wrong message type: expected INIT, got " 00218 << initView.code() << "\n"; 00219 00220 //Get the process name and store if for Protocol version 4 and above. 00221 if (initView.protocolVersion() > 3) { 00222 00223 processName_ = initView.processName(); 00224 protocolVersion_ = initView.protocolVersion(); 00225 00226 FDEBUG(10) << "StreamerInputSource::deserializeRegistry processName = "<< processName_<< std::endl; 00227 FDEBUG(10) << "StreamerInputSource::deserializeRegistry protocolVersion_= "<< protocolVersion_<< std::endl; 00228 } 00229 00230 TClass* desc = getTClass(typeid(SendJobHeader)); 00231 00232 RootBuffer xbuf(TBuffer::kRead, initView.descLength(), 00233 (char*)initView.descData(),kFALSE); 00234 RootDebug tracer(10,10); 00235 std::auto_ptr<SendJobHeader> sd((SendJobHeader*)xbuf.ReadObjectAny(desc)); 00236 00237 if(sd.get()==0) { 00238 throw cms::Exception("StreamTranslation","Registry deserialization error") 00239 << "Could not read the initial product registry list\n"; 00240 } 00241 00242 return sd; 00243 }
InputSource::ItemType edm::StreamerInputSource::getNextItemType | ( | ) | [private, virtual] |
Implements edm::InputSource.
Definition at line 174 of file StreamerInputSource.cc.
References ep_, inputFileTransitionsEachEvent_, edm::InputSource::IsEvent, edm::InputSource::IsFile, edm::InputSource::IsLumi, edm::InputSource::IsRun, edm::InputSource::IsStop, edm::InputSource::luminosityBlockPrincipal(), newLumi_, newRun_, read(), edm::InputSource::resetLuminosityBlockPrincipal(), edm::InputSource::resetRunPrincipal(), runEndingFlag_, and edm::InputSource::runPrincipal().
00174 { 00175 if (runEndingFlag_) { 00176 return IsStop; 00177 } 00178 if(newRun_ && runPrincipal()) { 00179 return IsRun; 00180 } 00181 if(newLumi_ && luminosityBlockPrincipal()) { 00182 return IsLumi; 00183 } 00184 if (ep_.get() != 0) { 00185 return IsEvent; 00186 } 00187 if (inputFileTransitionsEachEvent_) { 00188 resetRunPrincipal(); 00189 resetLuminosityBlockPrincipal(); 00190 } 00191 ep_ = read(); 00192 if (ep_.get() == 0) { 00193 return IsStop; 00194 } else { 00195 runEndingFlag_ = false; 00196 if (inputFileTransitionsEachEvent_) { 00197 return IsFile; 00198 } 00199 } 00200 if(newRun_) { 00201 return IsRun; 00202 } else if(newLumi_) { 00203 return IsLumi; 00204 } 00205 return IsEvent; 00206 }
void edm::StreamerInputSource::mergeIntoRegistry | ( | SendJobHeader const & | header, | |
ProductRegistry & | reg, | |||
bool | subsequent | |||
) | [static] |
Definition at line 78 of file StreamerInputSource.cc.
References buildClassCache(), edm::ProductRegistry::copyProduct(), declareStreamers(), edm::SendJobHeader::descs(), e, lat::endl(), Exception, FDEBUG, i, edm::loadExtraClasses(), edm::ProductRegistry::merge(), edm::SendJobHeader::nextID(), edm::BranchDescription::Permissive, and edm::ProductRegistry::setNextID().
Referenced by deserializeAndMergeWithRegistry(), and edm::getRegFromFile().
00079 { 00080 00081 SendDescs const& descs = header.descs(); 00082 00083 SendDescs::const_iterator i(descs.begin()), e(descs.end()); 00084 00085 FDEBUG(6) << "mergeIntoRegistry: Product List: " << std::endl; 00086 00087 if (subsequent) { 00088 ProductRegistry pReg; 00089 for(; i != e; ++i) { 00090 pReg.copyProduct(*i); 00091 FDEBUG(6) << "StreamInput prod = " << i->className() << std::endl; 00092 } 00093 std::string mergeInfo = reg.merge(pReg, std::string(), BranchDescription::Permissive); 00094 if (!mergeInfo.empty()) { 00095 throw cms::Exception("MismatchedInput","RootInputFileSequence::previousEvent()") << mergeInfo; 00096 } 00097 } else { 00098 declareStreamers(descs); 00099 buildClassCache(descs); 00100 loadExtraClasses(); 00101 for(; i != e; ++i) { 00102 i->setDefaultTransients(); 00103 i->init(); 00104 reg.copyProduct(*i); 00105 FDEBUG(6) << "StreamInput prod = " << i->className() << std::endl; 00106 } 00107 } 00108 reg.setNextID(header.nextID()); 00109 }
virtual std::auto_ptr<EventPrincipal> edm::StreamerInputSource::read | ( | ) | [private, pure virtual] |
Implemented in edm::EventStreamHttpReader, edm::OnlineHttpReader, and edm::StreamerInputModule< Producer >.
Referenced by getNextItemType().
std::auto_ptr< EventPrincipal > edm::StreamerInputSource::readEvent_ | ( | ) | [private, virtual] |
Implements edm::InputSource.
Definition at line 165 of file StreamerInputSource.cc.
References ep_, newLumi_, and newRun_.
00165 { 00166 assert(!newRun_); 00167 assert(!newLumi_); 00168 assert(ep_.get() != 0); 00169 // This copy resets ep_. 00170 return ep_; 00171 }
boost::shared_ptr< FileBlock > edm::StreamerInputSource::readFile_ | ( | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Definition at line 72 of file StreamerInputSource.cc.
References edm::InputSource::productRegistry(), edm::InputSource::productRegistryUpdate(), and edm::ProductRegistry::setProductIDs().
00072 { 00073 productRegistryUpdate().setProductIDs(productRegistry()->nextID()); 00074 return boost::shared_ptr<FileBlock>(new FileBlock); 00075 }
boost::shared_ptr< LuminosityBlockPrincipal > edm::StreamerInputSource::readLuminosityBlock_ | ( | ) | [private, virtual] |
Implements edm::InputSource.
Definition at line 156 of file StreamerInputSource.cc.
References edm::InputSource::luminosityBlockPrincipal(), newLumi_, and newRun_.
00156 { 00157 assert(!newRun_); 00158 assert(newLumi_); 00159 assert(luminosityBlockPrincipal()); 00160 newLumi_ = false; 00161 return luminosityBlockPrincipal(); 00162 }
boost::shared_ptr< RunPrincipal > edm::StreamerInputSource::readRun_ | ( | ) | [private, virtual] |
Implements edm::InputSource.
Definition at line 148 of file StreamerInputSource.cc.
References newRun_, and edm::InputSource::runPrincipal().
00148 { 00149 assert(newRun_); 00150 assert(runPrincipal()); 00151 newRun_ = false; 00152 return runPrincipal(); 00153 }
void edm::StreamerInputSource::resetAfterEndRun | ( | ) | [protected] |
Definition at line 455 of file StreamerInputSource.cc.
References ep_, edm::InputSource::reset(), and runEndingFlag_.
Referenced by edm::OnlineHttpReader::setRun().
00456 { 00457 // called from an online streamer source to reset after a stop command 00458 // so an enable command will work 00459 assert(ep_.get() == 0); 00460 reset(); 00461 runEndingFlag_ = false; 00462 }
void edm::StreamerInputSource::saveTriggerNames | ( | InitMsgView const * | header | ) | [protected] |
Definition at line 137 of file StreamerInputSource.cc.
References edm::ParameterSet::addParameter(), InitMsgView::hltTriggerNames(), and edm::detail::ThreadSafeRegistry< KEY, T, E >::instance().
Referenced by edm::StreamerInputModule< Producer >::read(), and edm::StreamerInputModule< Producer >::StreamerInputModule().
00137 { 00138 00139 ParameterSet trigger_pset; 00140 std::vector<std::string> paths; 00141 header->hltTriggerNames(paths); 00142 trigger_pset.addParameter<Strings>("@trigger_paths", paths); 00143 pset::Registry* psetRegistry = pset::Registry::instance(); 00144 psetRegistry->insertMapped(trigger_pset); 00145 }
void edm::StreamerInputSource::setEndRun | ( | ) | [inline, protected] |
Definition at line 66 of file StreamerInputSource.h.
Referenced by edm::OnlineHttpReader::getOneEvent(), and edm::EventStreamHttpReader::getOneEvent().
00067 {runEndingFlag_ = true;}
void edm::StreamerInputSource::setRun | ( | RunNumber_t | r | ) | [private, virtual] |
Reimplemented from edm::InputSource.
Reimplemented in edm::OnlineHttpReader.
Definition at line 464 of file StreamerInputSource.cc.
References edm::errors::LogicError.
00465 { 00466 // Need to define a dummy setRun here or else the InputSource::setRun is called 00467 // if we have a source inheriting from this and wants to define a setRun method 00468 throw edm::Exception(edm::errors::LogicError) 00469 << "StreamerInputSource::setRun()\n" 00470 << "Run number cannot be modified for this type of Input Source\n" 00471 << "Contact a Storage Manager Developer\n"; 00472 }
unsigned int edm::StreamerInputSource::uncompressBuffer | ( | unsigned char * | inputBuffer, | |
unsigned int | inputSize, | |||
std::vector< unsigned char > & | outputBuffer, | |||
unsigned int | expectedFullSize | |||
) | [static] |
Uncompresses the data in the specified input buffer into the specified output buffer.
The inputSize should be set to the size of the compressed data in the inputBuffer. The expectedFullSize should be set to the original size of the data (before compression). Returns the actual size of the uncompressed data. Errors are reported by throwing exceptions.
Definition at line 418 of file StreamerInputSource.cc.
References TestMuL1L2Filter_cff::cerr, lat::endl(), Exception, and FDEBUG.
Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and deserializeEvent().
00422 { 00423 unsigned long origSize = expectedFullSize; 00424 unsigned long uncompressedSize = expectedFullSize; 00425 FDEBUG(1) << "Uncompress: original size = " << origSize 00426 << ", compressed size = " << inputSize 00427 << std::endl; 00428 outputBuffer.resize(origSize); 00429 int ret = uncompress(&outputBuffer[0], &uncompressedSize, 00430 inputBuffer, inputSize); // do not need compression level 00431 //std::cout << "unCompress Return value: " << ret << " Okay = " << Z_OK << std::endl; 00432 if(ret == Z_OK) { 00433 // check the length against original uncompressed length 00434 FDEBUG(10) << " original size = " << origSize << " final size = " 00435 << uncompressedSize << std::endl; 00436 if(origSize != uncompressedSize) { 00437 std::cerr << "deserializeEvent: Problem with uncompress, original size = " 00438 << origSize << " uncompress size = " << uncompressedSize << std::endl; 00439 // we throw an error and return without event! null pointer 00440 throw cms::Exception("StreamDeserialization","Uncompression error") 00441 << "mismatch event lengths should be" << origSize << " got " 00442 << uncompressedSize << "\n"; 00443 } 00444 } else { 00445 // we throw an error and return without event! null pointer 00446 std::cerr << "deserializeEvent: Problem with uncompress, return value = " 00447 << ret << std::endl; 00448 throw cms::Exception("StreamDeserialization","Uncompression error") 00449 << "Error code = " << ret << "\n "; 00450 } 00451 00452 return (unsigned int) uncompressedSize; 00453 }
std::vector<unsigned char> edm::StreamerInputSource::dest_ [private] |
std::auto_ptr<EventPrincipal> edm::StreamerInputSource::ep_ [private] |
Definition at line 104 of file StreamerInputSource.h.
Referenced by getNextItemType(), readEvent_(), and resetAfterEndRun().
Definition at line 69 of file StreamerInputSource.h.
Referenced by edm::EventStreamHttpReader::EventStreamHttpReader(), and getNextItemType().
bool edm::StreamerInputSource::newLumi_ [private] |
Definition at line 103 of file StreamerInputSource.h.
Referenced by deserializeEvent(), getNextItemType(), readEvent_(), and readLuminosityBlock_().
bool edm::StreamerInputSource::newRun_ [private] |
Definition at line 102 of file StreamerInputSource.h.
Referenced by deserializeEvent(), getNextItemType(), readEvent_(), readLuminosityBlock_(), and readRun_().
std::string edm::StreamerInputSource::processName_ [static, private] |
unsigned int edm::StreamerInputSource::protocolVersion_ [static, private] |
bool edm::StreamerInputSource::runEndingFlag_ [private] |
Definition at line 109 of file StreamerInputSource.h.
Referenced by getNextItemType(), and resetAfterEndRun().
TClass* edm::StreamerInputSource::tc_ [private] |
RootBuffer edm::StreamerInputSource::xbuf_ [private] |