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
std::shared_ptr< ActivityRegistryactReg () const
 Accessor for Activity Registry. More...
 
std::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 (std::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...
 
std::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...
 
std::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...
 
std::shared_ptr
< LuminosityBlockAuxiliary
readLuminosityBlockAuxiliary ()
 Read next luminosity block Auxilary. More...
 
void readRun (RunPrincipal &runPrincipal, HistoryAppender &historyAppender)
 Read next run (new run) More...
 
std::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...
 
std::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
 
std::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
 
std::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 41 of file StreamerInputSource.cc.

43  :
44  RawInputSource(pset, desc),
45  tc_(getTClass(typeid(SendEvent))),
47  xbuf_(TBuffer::kRead, init_size),
48  sendEvent_(),
51  processName_(),
52  protocolVersion_(0U) {
53  }
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 55 of file StreamerInputSource.cc.

55 {}

Member Function Documentation

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

Definition at line 101 of file StreamerInputSource.cc.

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

Referenced by mergeIntoRegistry().

101  {
102  for(auto const& item : descs) {
103  //pi->init();
104  std::string const real_name = wrappedClassName(item.className());
105  FDEBUG(6) << "BuildReadData: " << real_name << std::endl;
106  doBuildRealData(real_name);
107  }
108  }
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 90 of file StreamerInputSource.cc.

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

Referenced by mergeIntoRegistry().

90  {
91  for(auto const& item : descs) {
92  //pi->init();
93  std::string const real_name = wrappedClassName(item.className());
94  FDEBUG(6) << "declare: " << real_name << std::endl;
95  loadCap(real_name);
96  }
97  }
#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 164 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().

164  {
165  std::auto_ptr<SendJobHeader> sd = deserializeRegistry(initView);
167  if (subsequent) {
169  }
170  SendJobHeader::ParameterSetMap const& psetMap = sd->processParameterSet();
171  pset::Registry& psetRegistry = *pset::Registry::instance();
172  for (auto const& item : psetMap) {
173  ParameterSet pset(item.second.pset());
174  pset.setID(item.first);
175  psetRegistry.insertMapped(pset);
176  }
177  }
static void mergeIntoRegistry(SendJobHeader const &header, ProductRegistry &, BranchIDListHelper &, bool subsequent)
std::map< ParameterSetID, ParameterSetBlob > ParameterSetMap
std::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 183 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().

183  {
184  if(eventView.code() != Header::EVENT)
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() << " "
192  << eventView.adler32_chksum() << " "
193  << eventView.eventLength() << " "
194  << eventView.eventData()
195  << std::endl;
196  // uncompress if we need to
197  // 78 was a dummy value (for no uncompressed) - should be 0 for uncompressed
198  // need to get rid of this when 090 MTCC streamers are gotten rid of
199  unsigned long origsize = eventView.origDataSize();
200  unsigned long dest_size; //(should be >= eventView.origDataSize())
201 
202  uint32_t adler32_chksum = cms::Adler32((char const*)eventView.eventData(), eventView.eventLength());
203  //std::cout << "Adler32 checksum of event = " << adler32_chksum << std::endl;
204  //std::cout << "Adler32 checksum from header = " << eventView.adler32_chksum() << " "
205  // << "host name = " << eventView.hostName() << " len = " << eventView.hostName_len() << std::endl;
206  if((uint32)adler32_chksum != eventView.adler32_chksum()) {
207  std::cerr << "Error from StreamerInputSource: checksum of event data blob failed "
208  << " chksum from event = " << adler32_chksum << " from header = "
209  << eventView.adler32_chksum() << " host name = " << eventView.hostName() << std::endl;
210  // skip event (based on option?) or throw exception?
211  }
212  if(origsize != 78 && origsize != 0) {
213  // compressed
214  dest_size = uncompressBuffer(const_cast<unsigned char*>((unsigned char const*)eventView.eventData()),
215  eventView.eventLength(), dest_, origsize);
216  } else { // not compressed
217  // we need to copy anyway the buffer as we are using dest in xbuf
218  dest_size = eventView.eventLength();
219  dest_.resize(dest_size);
220  unsigned char* pos = (unsigned char*) &dest_[0];
221  unsigned char const* from = (unsigned char const*) eventView.eventData();
222  std::copy(from,from+dest_size,pos);
223  }
224  //TBuffer xbuf(TBuffer::kRead, dest_size,
225  // (char const*) &dest[0],kFALSE);
226  //TBuffer xbuf(TBuffer::kRead, eventView.eventLength(),
227  // (char const*) eventView.eventData(),kFALSE);
228  xbuf_.Reset();
229  xbuf_.SetBuffer(&dest_[0],dest_size,kFALSE);
230  RootDebug tracer(10,10);
231 
233  sendEvent_ = std::unique_ptr<SendEvent>((SendEvent*)xbuf_.ReadObjectAny(tc_));
235 
236  if(sendEvent_.get() == nullptr) {
237  throw cms::Exception("StreamTranslation","Event deserialization error")
238  << "got a null event from input stream\n";
239  }
241 
242  FDEBUG(5) << "Got event: " << sendEvent_->aux().id() << " " << sendEvent_->products().size() << std::endl;
243  if(runAuxiliary().get() == nullptr || runAuxiliary()->run() != sendEvent_->aux().run()) {
244  RunAuxiliary* runAuxiliary = new RunAuxiliary(sendEvent_->aux().run(), sendEvent_->aux().time(), Timestamp::invalidTimestamp());
245  runAuxiliary->setProcessHistoryID(sendEvent_->processHistory().id());
246  setRunAuxiliary(runAuxiliary);
248  }
249  if(!luminosityBlockAuxiliary() || luminosityBlockAuxiliary()->luminosityBlock() != eventView.lumi()) {
250  LuminosityBlockAuxiliary* luminosityBlockAuxiliary =
251  new LuminosityBlockAuxiliary(runAuxiliary()->run(), eventView.lumi(), sendEvent_->aux().time(), Timestamp::invalidTimestamp());
252  luminosityBlockAuxiliary->setProcessHistoryID(sendEvent_->processHistory().id());
253  setLuminosityBlockAuxiliary(luminosityBlockAuxiliary);
254  }
255  setEventCached();
256  }
static Timestamp invalidTimestamp()
Definition: Timestamp.h:101
bool registerProcessHistory(ProcessHistory const &processHistory)
void setRefCoreStreamer(bool resetAll=false)
RunNumber_t run() const
Accessor for current run number.
Definition: InputSource.cc:599
#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:605
std::shared_ptr< RunAuxiliary > runAuxiliary() const
Called by the framework to merge or insert run in principal cache.
Definition: InputSource.h:259
void resetLuminosityBlockAuxiliary(bool isNewLumi=true) const
Definition: InputSource.h:362
void setRunAuxiliary(RunAuxiliary *rp)
Definition: InputSource.h:350
ProcessHistoryRegistry & processHistoryRegistryUpdate() const
Definition: InputSource.h:348
std::shared_ptr< LuminosityBlockAuxiliary > luminosityBlockAuxiliary() const
Called by the framework to merge or insert lumi in principal cache.
Definition: InputSource.h:262
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 115 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().

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

References edm::RawInputSource::fillDescription().

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

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

Definition at line 64 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().

64  {
65 
66  SendDescs const& descs = header.descs();
67 
68  FDEBUG(6) << "mergeIntoRegistry: Product List: " << std::endl;
69 
70  if (subsequent) {
71  ProductRegistry pReg;
72  pReg.updateFromInput(descs);
73  std::string mergeInfo = reg.merge(pReg, std::string(), BranchDescription::Permissive);
74  if (!mergeInfo.empty()) {
75  throw cms::Exception("MismatchedInput","RootInputFileSequence::previousEvent()") << mergeInfo;
76  }
77  branchIDListHelper.updateFromInput(header.branchIDLists());
78  } else {
79  declareStreamers(descs);
80  buildClassCache(descs);
82  if(!reg.frozen()) {
83  reg.updateFromInput(descs);
84  }
85  branchIDListHelper.updateFromInput(header.branchIDLists());
86  }
87  }
std::vector< BranchDescription > SendDescs
#define FDEBUG(lev)
Definition: DebugMacros.h:18
static void declareStreamers(SendDescs const &descs)
static void buildClassCache(SendDescs const &descs)
std::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 259 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().

259  {
261  eventPrincipal.adjustIndexesAfterProductRegistryAddition();
262  bool eventOK = eventPrincipal.adjustToNewProductRegistry(*productRegistry());
263  assert(eventOK);
265  }
266  EventSelectionIDVector ids(sendEvent_->eventSelectionIDs());
267  BranchListIndexes indexes(sendEvent_->branchListIndexes());
268  branchIDListHelper()->fixBranchListIndexes(indexes);
269  eventPrincipal.fillEventPrincipal(sendEvent_->aux(), processHistoryRegistry(), std::move(ids), std::move(indexes));
270  eventPrincipalHolder_.setEventPrincipal(&eventPrincipal);
271 
272  // no process name list handling
273 
274  SendProds& sps = sendEvent_->products();
275  for(auto& spitem : sps) {
276  FDEBUG(10) << "check prodpair" << std::endl;
277  if(spitem.desc() == nullptr)
278  throw cms::Exception("StreamTranslation","Empty Provenance");
279  FDEBUG(5) << "Prov:"
280  << " " << spitem.desc()->className()
281  << " " << spitem.desc()->productInstanceName()
282  << " " << spitem.desc()->branchID()
283  << std::endl;
284 
285  BranchDescription const branchDesc(*spitem.desc());
286  // This ProductProvenance constructor inserts into the entry description registry
287  ProductProvenance productProvenance(spitem.branchID(), *spitem.parents());
288 
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;
293  } else {
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;
297  }
298  spitem.clear();
299  }
300 
301  FDEBUG(10) << "Size = " << eventPrincipal.size() << std::endl;
302  }
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
std::shared_ptr< BranchIDListHelper > branchIDListHelper() const
Accessor for branchIDListHelper.
Definition: InputSource.h:177
std::unique_ptr< SendEvent > sendEvent_
EventPrincipalHolder eventPrincipalHolder_
std::vector< StreamedProduct > SendProds
std::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 59 of file StreamerInputSource.cc.

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

Definition at line 348 of file StreamerInputSource.cc.

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

348  {
349  // called from an online streamer source to reset after a stop command
350  // so an enable command will work
353  assert(!eventCached());
354  reset();
355  }
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 357 of file StreamerInputSource.cc.

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

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

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

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

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