CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Member Functions | Private Attributes
edm::StreamerInputSource Class Reference

#include <StreamerInputSource.h>

Inheritance diagram for edm::StreamerInputSource:
edm::RawInputSource edm::InputSource edm::ProductRegistryHelper dqmservices::DQMStreamerReader edm::StreamerFileReader edm::StreamerInputModule< Producer >

Classes

class  EventPrincipalHolder
 

Public Member Functions

void deserializeAndMergeWithRegistry (InitMsgView const &initView, bool subsequent=false)
 
void deserializeEvent (EventMsgView const &eventView)
 
std::auto_ptr< SendJobHeaderdeserializeRegistry (InitMsgView const &initView)
 
 StreamerInputSource (ParameterSet const &pset, InputSourceDescription const &desc)
 
virtual ~StreamerInputSource ()
 
- Public Member Functions inherited from edm::RawInputSource
 RawInputSource (ParameterSet const &pset, InputSourceDescription const &desc)
 
virtual ~RawInputSource ()
 
- Public Member Functions inherited from edm::InputSource
boost::shared_ptr
< ActivityRegistry
actReg () const
 Accessor for Activity Registry. More...
 
boost::shared_ptr
< BranchIDListHelper
branchIDListHelper () const
 Accessor for branchIDListHelper. More...
 
void closeFile (FileBlock *, bool cleaningUpAfterException)
 close current file More...
 
void doBeginJob ()
 Called by framework at beginning of job. More...
 
void doBeginLumi (LuminosityBlockPrincipal &lbp, ProcessContext const *)
 Called by framework at beginning of lumi block. More...
 
void doBeginRun (RunPrincipal &rp, ProcessContext const *)
 Called by framework at beginning of run. More...
 
void doEndJob ()
 Called by framework at end of job. More...
 
void doEndLumi (LuminosityBlockPrincipal &lbp, bool cleaningUpAfterException, ProcessContext const *)
 Called by framework at end of lumi block. More...
 
void doEndRun (RunPrincipal &rp, bool cleaningUpAfterException, ProcessContext const *)
 Called by framework at end of run. More...
 
void doPostForkReacquireResources (boost::shared_ptr< multicore::MessageReceiverForSource >)
 
void doPreForkReleaseResources ()
 Called by the framework before forking the process. More...
 
ProcessingController::ForwardState forwardState () const
 
bool goToEvent (EventID const &eventID)
 
 InputSource (ParameterSet const &, InputSourceDescription const &)
 Constructor. More...
 
 InputSource (InputSource const &)=delete
 
void issueReports (EventID const &eventID)
 issue an event report More...
 
LuminosityBlockNumber_t luminosityBlock () const
 Accessor for current luminosity block number. More...
 
boost::shared_ptr
< LuminosityBlockAuxiliary
luminosityBlockAuxiliary () const
 Called by the framework to merge or insert lumi in principal cache. More...
 
int maxEvents () const
 
int maxLuminosityBlocks () const
 
ModuleDescription const & moduleDescription () const
 Accessor for 'module' description. More...
 
ItemType nextItemType ()
 Advances the source to the next item. More...
 
InputSourceoperator= (InputSource const &)=delete
 
bool primary () const
 Accessor for primary input source flag. More...
 
ProcessConfiguration const & processConfiguration () const
 Accessor for Process Configuration. More...
 
std::string const & processGUID () const
 Accessor for global process identifier. More...
 
ProcessHistoryRegistry const & processHistoryRegistry () const
 Const accessor for process history registry. More...
 
ProcessHistoryRegistryprocessHistoryRegistryForUpdate ()
 Non-const accessor for process history registry. More...
 
ProcessingMode processingMode () const
 RunsLumisAndEvents (default), RunsAndLumis, or Runs. More...
 
boost::shared_ptr
< ProductRegistry const > 
productRegistry () const
 Accessor for product registry. More...
 
bool randomAccess () const
 
void readAndMergeLumi (LuminosityBlockPrincipal &lbp)
 Read next luminosity block (same as a prior lumi) More...
 
void readAndMergeRun (RunPrincipal &rp)
 Read next run (same as a prior run) More...
 
void readEvent (EventPrincipal &ep, StreamContext &)
 Read next event. More...
 
bool readEvent (EventPrincipal &ep, EventID const &, StreamContext &)
 Read a specific event. More...
 
std::unique_ptr< FileBlockreadFile ()
 Read next file. More...
 
void readLuminosityBlock (LuminosityBlockPrincipal &lumiPrincipal, HistoryAppender &historyAppender)
 Read next luminosity block (new lumi) More...
 
boost::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary ()
 Read next luminosity block Auxilary. More...
 
void readRun (RunPrincipal &runPrincipal, HistoryAppender &historyAppender)
 Read next run (new run) More...
 
boost::shared_ptr< RunAuxiliaryreadRunAuxiliary ()
 Read next run Auxiliary. More...
 
ProcessHistoryID const & reducedProcessHistoryID () const
 
void registerProducts ()
 Register any produced products. More...
 
int remainingEvents () const
 
int remainingLuminosityBlocks () const
 
void repeat ()
 Reset the remaining number of events/lumis to the maximum number. More...
 
SharedResourcesAcquirerresourceSharedWithDelayedReader () const
 Returns nullptr if no resource shared between the Source and a DelayedReader. More...
 
ProcessingController::ReverseState reverseState () const
 
void rewind ()
 Begin again at the first event. More...
 
RunNumber_t run () const
 Accessor for current run number. More...
 
boost::shared_ptr< RunAuxiliaryrunAuxiliary () const
 Called by the framework to merge or insert run in principal cache. More...
 
void setLuminosityBlockNumber_t (LuminosityBlockNumber_t lb)
 Set the luminosity block ID. More...
 
void setRunNumber (RunNumber_t r)
 Set the run number. More...
 
void skipEvents (int offset)
 
bool skipForForking ()
 
Timestamp const & timestamp () const
 Accessor for the current time, as seen by the input source. More...
 
virtual ~InputSource ()
 Destructor. More...
 

Static Public Member Functions

static void fillDescription (ParameterSetDescription &description)
 
static void mergeIntoRegistry (SendJobHeader const &header, ProductRegistry &, BranchIDListHelper &, bool subsequent)
 
static unsigned int uncompressBuffer (unsigned char *inputBuffer, unsigned int inputSize, std::vector< unsigned char > &outputBuffer, unsigned int expectedFullSize)
 
- Static Public Member Functions inherited from edm::RawInputSource
static void fillDescription (ParameterSetDescription &description)
 
- Static Public Member Functions inherited from edm::InputSource
static const std::string & baseType ()
 
static void fillDescription (ParameterSetDescription &desc)
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Protected Member Functions

void resetAfterEndRun ()
 
- Protected Member Functions inherited from edm::RawInputSource
virtual bool checkNextEvent ()=0
 
void makeEvent (EventPrincipal &eventPrincipal, EventAuxiliary const &eventAuxiliary)
 
void setInputFileTransitionsEachEvent ()
 
- Protected Member Functions inherited from edm::InputSource
void decreaseRemainingEventsBy (int iSkipped)
 
bool eventCached () const
 
boost::shared_ptr
< LuminosityBlockPrincipal >
const 
luminosityBlockPrincipal () const
 
bool newLumi () const
 
bool newRun () const
 
ProcessHistoryRegistryprocessHistoryRegistryUpdate () const
 
ProductRegistryproductRegistryUpdate () const
 
void reset () const
 
void resetEventCached ()
 
void resetLuminosityBlockAuxiliary (bool isNewLumi=true) const
 
void resetNewLumi ()
 
void resetNewRun ()
 
void resetRunAuxiliary (bool isNewRun=true) const
 
boost::shared_ptr
< RunPrincipal > const 
runPrincipal () const
 
void setEventCached ()
 Called by the framework to merge or ached() const {return eventCached_;}. More...
 
void setLuminosityBlockAuxiliary (LuminosityBlockAuxiliary *lbp)
 
void setNewLumi ()
 
void setNewRun ()
 
void setRunAuxiliary (RunAuxiliary *rp)
 
void setTimestamp (Timestamp const &theTime)
 To set the current time, as seen by the input source. More...
 
virtual void skip (int offset)
 
ItemType state () const
 

Static Protected Member Functions

static void buildClassCache (SendDescs const &descs)
 
static void declareStreamers (SendDescs const &descs)
 

Private Member Functions

virtual void read (EventPrincipal &eventPrincipal)
 
virtual std::unique_ptr
< FileBlock
readFile_ ()
 
virtual void setRun (RunNumber_t r)
 

Private Attributes

bool adjustEventToNewProductRegistry_
 
std::vector< unsigned char > dest_
 
EventPrincipalHolder eventPrincipalHolder_
 
std::string processName_
 
unsigned int protocolVersion_
 
std::unique_ptr< SendEventsendEvent_
 
TClass * tc_
 
TBufferFile xbuf_
 

Additional Inherited Members

- Public Types inherited from edm::InputSource
enum  ItemType {
  IsInvalid, IsStop, IsFile, IsRun,
  IsLumi, IsEvent, IsRepeat, IsSynchronize
}
 
enum  ProcessingMode { Runs, RunsAndLumis, RunsLumisAndEvents }
 
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 

Detailed Description

Definition at line 29 of file StreamerInputSource.h.

Constructor & Destructor Documentation

edm::StreamerInputSource::StreamerInputSource ( ParameterSet const &  pset,
InputSourceDescription const &  desc 
)
explicit

Definition at line 42 of file StreamerInputSource.cc.

44  :
45  RawInputSource(pset, desc),
46  tc_(getTClass(typeid(SendEvent))),
48  xbuf_(TBuffer::kRead, init_size),
49  sendEvent_(),
52  processName_(),
53  protocolVersion_(0U) {
54  }
RawInputSource(ParameterSet const &pset, InputSourceDescription const &desc)
TClass * getTClass(const std::type_info &ti)
Definition: ClassFiller.cc:78
const int init_size
std::unique_ptr< SendEvent > sendEvent_
EventPrincipalHolder eventPrincipalHolder_
std::vector< unsigned char > dest_
edm::StreamerInputSource::~StreamerInputSource ( )
virtual

Definition at line 56 of file StreamerInputSource.cc.

56 {}

Member Function Documentation

void edm::StreamerInputSource::buildClassCache ( SendDescs const &  descs)
staticprotected

Definition at line 102 of file StreamerInputSource.cc.

References edm::doBuildRealData(), FDEBUG, AlCaHLTBitMon_QueryRunRegistry::string, and edm::wrappedClassName().

Referenced by mergeIntoRegistry().

102  {
103  for(auto const& item : descs) {
104  //pi->init();
105  std::string const real_name = wrappedClassName(item.className());
106  FDEBUG(6) << "BuildReadData: " << real_name << std::endl;
107  doBuildRealData(real_name);
108  }
109  }
void doBuildRealData(const std::string &name)
Definition: ClassFiller.cc:31
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::string wrappedClassName(std::string const &iFullName)
void edm::StreamerInputSource::declareStreamers ( SendDescs const &  descs)
staticprotected

Definition at line 91 of file StreamerInputSource.cc.

References FDEBUG, edm::loadCap(), AlCaHLTBitMon_QueryRunRegistry::string, and edm::wrappedClassName().

Referenced by mergeIntoRegistry().

91  {
92  for(auto const& item : descs) {
93  //pi->init();
94  std::string const real_name = wrappedClassName(item.className());
95  FDEBUG(6) << "declare: " << real_name << std::endl;
96  loadCap(real_name);
97  }
98  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::string wrappedClassName(std::string const &iFullName)
void loadCap(const std::string &name)
Definition: ClassFiller.cc:20
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 165 of file StreamerInputSource.cc.

References adjustEventToNewProductRegistry_, edm::InputSource::branchIDListHelper(), deserializeRegistry(), edm::pset::Registry::insertMapped(), edm::pset::Registry::instance(), mergeIntoRegistry(), edm::InputSource::productRegistryUpdate(), sd, and edm::ParameterSet::setID().

Referenced by edm::StreamerFileReader::checkNextEvent(), dqmservices::DQMStreamerReader::checkNextEvent(), dqmservices::DQMStreamerReader::openFile_(), edm::StreamerFileReader::reset_(), and edm::StreamerInputModule< Producer >::StreamerInputModule().

165  {
166  std::auto_ptr<SendJobHeader> sd = deserializeRegistry(initView);
168  if (subsequent) {
170  }
171  SendJobHeader::ParameterSetMap const& psetMap = sd->processParameterSet();
172  pset::Registry& psetRegistry = *pset::Registry::instance();
173  for (auto const& item : psetMap) {
174  ParameterSet pset(item.second.pset());
175  pset.setID(item.first);
176  psetRegistry.insertMapped(pset);
177  }
178  }
static void mergeIntoRegistry(SendJobHeader const &header, ProductRegistry &, BranchIDListHelper &, bool subsequent)
std::map< ParameterSetID, ParameterSetBlob > ParameterSetMap
boost::shared_ptr< BranchIDListHelper > branchIDListHelper() const
Accessor for branchIDListHelper.
Definition: InputSource.h:177
double sd
ProductRegistry & productRegistryUpdate() const
Definition: InputSource.h:347
std::auto_ptr< SendJobHeader > deserializeRegistry(InitMsgView const &initView)
static Registry * instance()
Definition: Registry.cc:14
void edm::StreamerInputSource::deserializeEvent ( EventMsgView const &  eventView)

Deserializes the specified event message.

Definition at line 184 of file StreamerInputSource.cc.

References cms::Adler32(), EventMsgView::adler32_chksum(), dtNoiseDBValidation_cfg::cerr, EventMsgView::code(), filterCSVwithJSON::copy, dest_, Header::EVENT, EventMsgView::event(), EventMsgView::eventData(), EventMsgView::eventLength(), eventPrincipalHolder_, edm::hlt::Exception, FDEBUG, EventMsgView::hostName(), edm::Timestamp::invalidTimestamp(), EventMsgView::lumi(), edm::InputSource::luminosityBlock(), edm::InputSource::luminosityBlockAuxiliary(), EventMsgView::origDataSize(), edm::InputSource::processHistoryRegistryUpdate(), edm::ProcessHistoryRegistry::registerProcessHistory(), edm::InputSource::resetLuminosityBlockAuxiliary(), EventMsgView::run(), edm::InputSource::run(), edm::InputSource::runAuxiliary(), sendEvent_, edm::InputSource::setEventCached(), edm::InputSource::setLuminosityBlockAuxiliary(), edm::RunAuxiliary::setProcessHistoryID(), edm::LuminosityBlockAuxiliary::setProcessHistoryID(), edm::setRefCoreStreamer(), edm::InputSource::setRunAuxiliary(), EventMsgView::size(), tc_, uncompressBuffer(), and xbuf_.

Referenced by edm::StreamerFileReader::checkNextEvent(), and dqmservices::DQMStreamerReader::checkNextEvent().

184  {
185  if(eventView.code() != Header::EVENT)
186  throw cms::Exception("StreamTranslation","Event deserialization error")
187  << "received wrong message type: expected EVENT, got "
188  << eventView.code() << "\n";
189  FDEBUG(9) << "Decode event: "
190  << eventView.event() << " "
191  << eventView.run() << " "
192  << eventView.size() << " "
193  << eventView.adler32_chksum() << " "
194  << eventView.eventLength() << " "
195  << eventView.eventData()
196  << std::endl;
197  // uncompress if we need to
198  // 78 was a dummy value (for no uncompressed) - should be 0 for uncompressed
199  // need to get rid of this when 090 MTCC streamers are gotten rid of
200  unsigned long origsize = eventView.origDataSize();
201  unsigned long dest_size; //(should be >= eventView.origDataSize())
202 
203  uint32_t adler32_chksum = cms::Adler32((char const*)eventView.eventData(), eventView.eventLength());
204  //std::cout << "Adler32 checksum of event = " << adler32_chksum << std::endl;
205  //std::cout << "Adler32 checksum from header = " << eventView.adler32_chksum() << " "
206  // << "host name = " << eventView.hostName() << " len = " << eventView.hostName_len() << std::endl;
207  if((uint32)adler32_chksum != eventView.adler32_chksum()) {
208  std::cerr << "Error from StreamerInputSource: checksum of event data blob failed "
209  << " chksum from event = " << adler32_chksum << " from header = "
210  << eventView.adler32_chksum() << " host name = " << eventView.hostName() << std::endl;
211  // skip event (based on option?) or throw exception?
212  }
213  if(origsize != 78 && origsize != 0) {
214  // compressed
215  dest_size = uncompressBuffer(const_cast<unsigned char*>((unsigned char const*)eventView.eventData()),
216  eventView.eventLength(), dest_, origsize);
217  } else { // not compressed
218  // we need to copy anyway the buffer as we are using dest in xbuf
219  dest_size = eventView.eventLength();
220  dest_.resize(dest_size);
221  unsigned char* pos = (unsigned char*) &dest_[0];
222  unsigned char const* from = (unsigned char const*) eventView.eventData();
223  std::copy(from,from+dest_size,pos);
224  }
225  //TBuffer xbuf(TBuffer::kRead, dest_size,
226  // (char const*) &dest[0],kFALSE);
227  //TBuffer xbuf(TBuffer::kRead, eventView.eventLength(),
228  // (char const*) eventView.eventData(),kFALSE);
229  xbuf_.Reset();
230  xbuf_.SetBuffer(&dest_[0],dest_size,kFALSE);
231  RootDebug tracer(10,10);
232 
234  sendEvent_ = std::unique_ptr<SendEvent>((SendEvent*)xbuf_.ReadObjectAny(tc_));
236 
237  if(sendEvent_.get() == nullptr) {
238  throw cms::Exception("StreamTranslation","Event deserialization error")
239  << "got a null event from input stream\n";
240  }
242 
243  FDEBUG(5) << "Got event: " << sendEvent_->aux().id() << " " << sendEvent_->products().size() << std::endl;
244  if(runAuxiliary().get() == nullptr || runAuxiliary()->run() != sendEvent_->aux().run()) {
245  RunAuxiliary* runAuxiliary = new RunAuxiliary(sendEvent_->aux().run(), sendEvent_->aux().time(), Timestamp::invalidTimestamp());
246  runAuxiliary->setProcessHistoryID(sendEvent_->processHistory().id());
247  setRunAuxiliary(runAuxiliary);
249  }
250  if(!luminosityBlockAuxiliary() || luminosityBlockAuxiliary()->luminosityBlock() != eventView.lumi()) {
251  LuminosityBlockAuxiliary* luminosityBlockAuxiliary =
252  new LuminosityBlockAuxiliary(runAuxiliary()->run(), eventView.lumi(), sendEvent_->aux().time(), Timestamp::invalidTimestamp());
253  luminosityBlockAuxiliary->setProcessHistoryID(sendEvent_->processHistory().id());
254  setLuminosityBlockAuxiliary(luminosityBlockAuxiliary);
255  }
256  setEventCached();
257  }
static Timestamp invalidTimestamp()
Definition: Timestamp.h:101
bool registerProcessHistory(ProcessHistory const &processHistory)
void setRefCoreStreamer(bool resetAll=false)
boost::shared_ptr< LuminosityBlockAuxiliary > luminosityBlockAuxiliary() const
Called by the framework to merge or insert lumi in principal cache.
Definition: InputSource.h:262
RunNumber_t run() const
Accessor for current run number.
Definition: InputSource.cc:595
#define FDEBUG(lev)
Definition: DebugMacros.h:18
void setLuminosityBlockAuxiliary(LuminosityBlockAuxiliary *lbp)
Definition: InputSource.h:354
std::unique_ptr< SendEvent > sendEvent_
EventPrincipalHolder eventPrincipalHolder_
unsigned int uint32
Definition: MsgTools.h:13
void setEventCached()
Called by the framework to merge or ached() const {return eventCached_;}.
Definition: InputSource.h:381
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
LuminosityBlockNumber_t luminosityBlock() const
Accessor for current luminosity block number.
Definition: InputSource.cc:601
void resetLuminosityBlockAuxiliary(bool isNewLumi=true) const
Definition: InputSource.h:362
boost::shared_ptr< RunAuxiliary > runAuxiliary() const
Called by the framework to merge or insert run in principal cache.
Definition: InputSource.h:259
void setRunAuxiliary(RunAuxiliary *rp)
Definition: InputSource.h:350
ProcessHistoryRegistry & processHistoryRegistryUpdate() const
Definition: InputSource.h:348
static unsigned int uncompressBuffer(unsigned char *inputBuffer, unsigned int inputSize, std::vector< unsigned char > &outputBuffer, unsigned int expectedFullSize)
std::vector< unsigned char > dest_
std::auto_ptr< SendJobHeader > edm::StreamerInputSource::deserializeRegistry ( InitMsgView const &  initView)

Deserializes the specified init message into a SendJobHeader object (which is related to the product registry).

Definition at line 116 of file StreamerInputSource.cc.

References cms::Adler32(), InitMsgView::adler32_chksum(), dtNoiseDBValidation_cfg::cerr, InitMsgView::code(), InitMsgView::descData(), InitMsgView::descLength(), edm::hlt::Exception, FDEBUG, edm::getTClass(), InitMsgView::hostName(), Header::INIT, InitMsgView::processName(), processName_, InitMsgView::protocolVersion(), protocolVersion_, and sd.

Referenced by deserializeAndMergeWithRegistry().

116  {
117  if(initView.code() != Header::INIT)
118  throw cms::Exception("StreamTranslation","Registry deserialization error")
119  << "received wrong message type: expected INIT, got "
120  << initView.code() << "\n";
121 
122  //Get the process name and store if for Protocol version 4 and above.
123  if (initView.protocolVersion() > 3) {
124 
125  processName_ = initView.processName();
126  protocolVersion_ = initView.protocolVersion();
127 
128  FDEBUG(10) << "StreamerInputSource::deserializeRegistry processName = "<< processName_<< std::endl;
129  FDEBUG(10) << "StreamerInputSource::deserializeRegistry protocolVersion_= "<< protocolVersion_<< std::endl;
130  }
131 
132  // calculate the adler32 checksum
133  uint32_t adler32_chksum = cms::Adler32((char const*)initView.descData(),initView.descLength());
134  //std::cout << "Adler32 checksum of init message = " << adler32_chksum << std::endl;
135  //std::cout << "Adler32 checksum of init messsage from header = " << initView.adler32_chksum() << " "
136  // << "host name = " << initView.hostName() << " len = " << initView.hostName_len() << std::endl;
137  if((uint32)adler32_chksum != initView.adler32_chksum()) {
138  std::cerr << "Error from StreamerInputSource: checksum of Init registry blob failed "
139  << " chksum from registry data = " << adler32_chksum << " from header = "
140  << initView.adler32_chksum() << " host name = " << initView.hostName() << std::endl;
141  // skip event (based on option?) or throw exception?
142  }
143 
144  TClass* desc = getTClass(typeid(SendJobHeader));
145 
146  TBufferFile xbuf(TBuffer::kRead, initView.descLength(),
147  const_cast<char*>((char const*)initView.descData()),kFALSE);
148  RootDebug tracer(10,10);
149  std::auto_ptr<SendJobHeader> sd((SendJobHeader*)xbuf.ReadObjectAny(desc));
150 
151  if(sd.get() == nullptr) {
152  throw cms::Exception("StreamTranslation","Registry deserialization error")
153  << "Could not read the initial product registry list\n";
154  }
155 
156  sd->initializeTransients();
157  return sd;
158  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18
TClass * getTClass(const std::type_info &ti)
Definition: ClassFiller.cc:78
unsigned int uint32
Definition: MsgTools.h:13
void Adler32(char const *data, size_t len, uint32_t &a, uint32_t &b)
double sd
void edm::StreamerInputSource::fillDescription ( ParameterSetDescription description)
static

Definition at line 388 of file StreamerInputSource.cc.

References edm::RawInputSource::fillDescription().

Referenced by edm::StreamerFileReader::fillDescriptions(), and dqmservices::DQMStreamerReader::fillDescriptions().

388  {
390  }
static void fillDescription(ParameterSetDescription &description)
void edm::StreamerInputSource::mergeIntoRegistry ( SendJobHeader const &  header,
ProductRegistry reg,
BranchIDListHelper branchIDListHelper,
bool  subsequent 
)
static

Definition at line 65 of file StreamerInputSource.cc.

References edm::SendJobHeader::branchIDLists(), buildClassCache(), declareStreamers(), edm::SendJobHeader::descs(), edm::hlt::Exception, FDEBUG, edm::ProductRegistry::frozen(), edm::loadExtraClasses(), edm::ProductRegistry::merge(), edm::BranchDescription::Permissive, AlCaHLTBitMon_QueryRunRegistry::string, edm::BranchIDListHelper::updateFromInput(), and edm::ProductRegistry::updateFromInput().

Referenced by deserializeAndMergeWithRegistry().

65  {
66 
67  SendDescs const& descs = header.descs();
68 
69  FDEBUG(6) << "mergeIntoRegistry: Product List: " << std::endl;
70 
71  if (subsequent) {
72  ProductRegistry pReg;
73  pReg.updateFromInput(descs);
74  std::string mergeInfo = reg.merge(pReg, std::string(), BranchDescription::Permissive);
75  if (!mergeInfo.empty()) {
76  throw cms::Exception("MismatchedInput","RootInputFileSequence::previousEvent()") << mergeInfo;
77  }
78  branchIDListHelper.updateFromInput(header.branchIDLists());
79  } else {
80  declareStreamers(descs);
81  buildClassCache(descs);
83  if(!reg.frozen()) {
84  reg.updateFromInput(descs);
85  }
86  branchIDListHelper.updateFromInput(header.branchIDLists());
87  }
88  }
std::vector< BranchDescription > SendDescs
#define FDEBUG(lev)
Definition: DebugMacros.h:18
static void declareStreamers(SendDescs const &descs)
static void buildClassCache(SendDescs const &descs)
boost::shared_ptr< BranchIDListHelper > branchIDListHelper() const
Accessor for branchIDListHelper.
Definition: InputSource.h:177
void loadExtraClasses()
Definition: ClassFiller.cc:43
void edm::StreamerInputSource::read ( EventPrincipal eventPrincipal)
privatevirtual

Implements edm::RawInputSource.

Definition at line 260 of file StreamerInputSource.cc.

References adjustEventToNewProductRegistry_, edm::Principal::adjustIndexesAfterProductRegistryAddition(), edm::Principal::adjustToNewProductRegistry(), edm::InputSource::branchIDListHelper(), eventPrincipalHolder_, FDEBUG, edm::EventPrincipal::fillEventPrincipal(), edm::InputSource::processHistoryRegistry(), edm::InputSource::productRegistry(), edm::EventPrincipal::putOnRead(), sendEvent_, edm::StreamerInputSource::EventPrincipalHolder::setEventPrincipal(), and edm::Principal::size().

260  {
262  eventPrincipal.adjustIndexesAfterProductRegistryAddition();
263  bool eventOK = eventPrincipal.adjustToNewProductRegistry(*productRegistry());
264  assert(eventOK);
266  }
267  EventSelectionIDVector ids(sendEvent_->eventSelectionIDs());
268  BranchListIndexes indexes(sendEvent_->branchListIndexes());
269  branchIDListHelper()->fixBranchListIndexes(indexes);
270  eventPrincipal.fillEventPrincipal(sendEvent_->aux(), processHistoryRegistry(), std::move(ids), std::move(indexes));
271  eventPrincipalHolder_.setEventPrincipal(&eventPrincipal);
272 
273  // no process name list handling
274 
275  SendProds& sps = sendEvent_->products();
276  for(auto& spitem : sps) {
277  FDEBUG(10) << "check prodpair" << std::endl;
278  if(spitem.desc() == nullptr)
279  throw cms::Exception("StreamTranslation","Empty Provenance");
280  FDEBUG(5) << "Prov:"
281  << " " << spitem.desc()->className()
282  << " " << spitem.desc()->productInstanceName()
283  << " " << spitem.desc()->branchID()
284  << std::endl;
285 
286  BranchDescription const branchDesc(*spitem.desc());
287  // This ProductProvenance constructor inserts into the entry description registry
288  ProductProvenance productProvenance(spitem.branchID(), *spitem.parents());
289 
290  if(spitem.prod() != nullptr) {
291  FDEBUG(10) << "addproduct next " << spitem.branchID() << std::endl;
292  eventPrincipal.putOnRead(branchDesc, spitem.prod(), productProvenance);
293  FDEBUG(10) << "addproduct done" << std::endl;
294  } else {
295  FDEBUG(10) << "addproduct empty next " << spitem.branchID() << std::endl;
296  eventPrincipal.putOnRead(branchDesc, spitem.prod(), productProvenance);
297  FDEBUG(10) << "addproduct empty done" << std::endl;
298  }
299  spitem.clear();
300  }
301 
302  FDEBUG(10) << "Size = " << eventPrincipal.size() << std::endl;
303  }
ProcessHistoryRegistry const & processHistoryRegistry() const
Const accessor for process history registry.
Definition: InputSource.h:171
#define FDEBUG(lev)
Definition: DebugMacros.h:18
std::vector< EventSelectionID > EventSelectionIDVector
std::vector< BranchListIndex > BranchListIndexes
boost::shared_ptr< BranchIDListHelper > branchIDListHelper() const
Accessor for branchIDListHelper.
Definition: InputSource.h:177
std::unique_ptr< SendEvent > sendEvent_
EventPrincipalHolder eventPrincipalHolder_
std::vector< StreamedProduct > SendProds
boost::shared_ptr< ProductRegistry const > productRegistry() const
Accessor for product registry.
Definition: InputSource.h:168
std::unique_ptr< FileBlock > edm::StreamerInputSource::readFile_ ( )
privatevirtual

Reimplemented from edm::InputSource.

Definition at line 60 of file StreamerInputSource.cc.

60  {
61  return std::unique_ptr<FileBlock>(new FileBlock);
62  }
void edm::StreamerInputSource::resetAfterEndRun ( )
protected

Definition at line 349 of file StreamerInputSource.cc.

References edm::InputSource::eventCached(), edm::InputSource::reset(), edm::InputSource::resetLuminosityBlockAuxiliary(), and edm::InputSource::resetRunAuxiliary().

349  {
350  // called from an online streamer source to reset after a stop command
351  // so an enable command will work
354  assert(!eventCached());
355  reset();
356  }
void resetRunAuxiliary(bool isNewRun=true) const
Definition: InputSource.h:358
void resetLuminosityBlockAuxiliary(bool isNewLumi=true) const
Definition: InputSource.h:362
void reset() const
Definition: InputSource.h:366
bool eventCached() const
Definition: InputSource.h:379
void edm::StreamerInputSource::setRun ( RunNumber_t  r)
privatevirtual

Reimplemented from edm::InputSource.

Definition at line 358 of file StreamerInputSource.cc.

References edm::hlt::Exception, and edm::errors::LogicError.

358  {
359  // Need to define a dummy setRun here or else the InputSource::setRun is called
360  // if we have a source inheriting from this and wants to define a setRun method
362  << "StreamerInputSource::setRun()\n"
363  << "Run number cannot be modified for this type of Input Source\n"
364  << "Contact a Storage Manager Developer\n";
365  }
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 314 of file StreamerInputSource.cc.

References dtNoiseDBValidation_cfg::cerr, edm::hlt::Exception, FDEBUG, and run_regression::ret.

Referenced by edm::StreamDQMDeserializer::deserializeDQMEvent(), and deserializeEvent().

317  {
318  unsigned long origSize = expectedFullSize;
319  unsigned long uncompressedSize = expectedFullSize*1.1;
320  FDEBUG(1) << "Uncompress: original size = " << origSize
321  << ", compressed size = " << inputSize
322  << std::endl;
323  outputBuffer.resize(uncompressedSize);
324  int ret = uncompress(&outputBuffer[0], &uncompressedSize,
325  inputBuffer, inputSize); // do not need compression level
326  //std::cout << "unCompress Return value: " << ret << " Okay = " << Z_OK << std::endl;
327  if(ret == Z_OK) {
328  // check the length against original uncompressed length
329  FDEBUG(10) << " original size = " << origSize << " final size = "
330  << uncompressedSize << std::endl;
331  if(origSize != uncompressedSize) {
332  std::cerr << "deserializeEvent: Problem with uncompress, original size = "
333  << origSize << " uncompress size = " << uncompressedSize << std::endl;
334  // we throw an error and return without event! null pointer
335  throw cms::Exception("StreamDeserialization","Uncompression error")
336  << "mismatch event lengths should be" << origSize << " got "
337  << uncompressedSize << "\n";
338  }
339  } else {
340  // we throw an error and return without event! null pointer
341  std::cerr << "deserializeEvent: Problem with uncompress, return value = "
342  << ret << std::endl;
343  throw cms::Exception("StreamDeserialization","Uncompression error")
344  << "Error code = " << ret << "\n ";
345  }
346  return (unsigned int) uncompressedSize;
347  }
#define FDEBUG(lev)
Definition: DebugMacros.h:18

Member Data Documentation

bool edm::StreamerInputSource::adjustEventToNewProductRegistry_
private

Definition at line 91 of file StreamerInputSource.h.

Referenced by deserializeAndMergeWithRegistry(), and read().

std::vector<unsigned char> edm::StreamerInputSource::dest_
private

Definition at line 87 of file StreamerInputSource.h.

Referenced by deserializeEvent().

EventPrincipalHolder edm::StreamerInputSource::eventPrincipalHolder_
private

Definition at line 90 of file StreamerInputSource.h.

Referenced by deserializeEvent(), and read().

std::string edm::StreamerInputSource::processName_
private

Definition at line 93 of file StreamerInputSource.h.

Referenced by deserializeRegistry().

unsigned int edm::StreamerInputSource::protocolVersion_
private

Definition at line 94 of file StreamerInputSource.h.

Referenced by deserializeRegistry().

std::unique_ptr<SendEvent> edm::StreamerInputSource::sendEvent_
private

Definition at line 89 of file StreamerInputSource.h.

Referenced by deserializeEvent(), and read().

TClass* edm::StreamerInputSource::tc_
private

Definition at line 86 of file StreamerInputSource.h.

Referenced by deserializeEvent().

TBufferFile edm::StreamerInputSource::xbuf_
private

Definition at line 88 of file StreamerInputSource.h.

Referenced by deserializeEvent().