CMS 3D CMS Logo

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

#include <I2OChain.h>

Public Member Functions

void addToChain (I2OChain &newpart)
 
void addToStaleWindowStartTime (const utils::Duration_t)
 
uint32_t adler32Checksum () const
 
void assertRunNumber (uint32_t runNumber)
 
bool complete () const
 
unsigned int copyFragmentsIntoBuffer (std::vector< unsigned char > &buff) const
 
utils::TimePoint_t creationTime () const
 
unsigned char * dataLocation (int fragmentIndex) const
 
unsigned long dataSize (int fragmentIndex) const
 
DQMKey dqmKey () const
 
unsigned int droppedEventsCount () const
 
bool empty () const
 
uint32_t eventNumber () const
 
bool faulty () const
 
unsigned int faultyBits () const
 
unsigned int fragmentCount () const
 
FragKey fragmentKey () const
 
unsigned int fuGuid () const
 
unsigned int fuProcessId () const
 
unsigned long * getBufferData () const
 
QueueIDs getDQMEventConsumerTags () const
 
QueueIDs getEventConsumerTags () const
 
unsigned int getFragmentID (int fragmentIndex) const
 
std::vector< StreamIDgetStreamTags () const
 
unsigned char * headerLocation () const
 
unsigned long headerSize () const
 
std::string hltClassName () const
 
unsigned int hltInstance () const
 
unsigned int hltLocalId () const
 
unsigned int hltTid () const
 
void hltTriggerBits (std::vector< unsigned char > &bitList) const
 
uint32_t hltTriggerCount () const
 
void hltTriggerNames (Strings &nameList) const
 
void hltTriggerSelections (Strings &nameList) const
 
std::string hltURL () const
 
 I2OChain ()
 
 I2OChain (toolbox::mem::Reference *pRef)
 
 I2OChain (I2OChain const &other)
 
unsigned short i2oMessageCode () const
 
bool isEndOfLumiSectionMessage () const
 
bool isTaggedForAnyDQMEventConsumer () const
 
bool isTaggedForAnyEventConsumer () const
 
bool isTaggedForAnyStream () const
 
void l1TriggerNames (Strings &nameList) const
 
utils::TimePoint_t lastFragmentTime () const
 
uint32_t lumiSection () const
 
void markFaulty ()
 
size_t memoryUsed () const
 
unsigned int messageCode () const
 
uint32_t nExpectedEPs () const
 
I2OChainoperator= (I2OChain const &rhs)
 
uint32_t outputModuleId () const
 
std::string outputModuleLabel () const
 
unsigned int rbBufferId () const
 
void release ()
 
void resetStaleWindowStartTime ()
 
uint32_t runNumber () const
 
void setDroppedEventsCount (unsigned int)
 
utils::TimePoint_t staleWindowStartTime () const
 
void swap (I2OChain &other)
 
void tagForDQMEventConsumer (QueueID)
 
void tagForEventConsumer (QueueID)
 
void tagForStream (StreamID)
 
std::string topFolderName () const
 
unsigned long totalDataSize () const
 
 ~I2OChain ()
 

Private Attributes

boost::shared_ptr
< detail::ChainData
data_
 

Detailed Description

Definition at line 43 of file I2OChain.h.

Constructor & Destructor Documentation

stor::I2OChain::I2OChain ( )

A default-constructed I2OChain manages no Reference.

Definition at line 26 of file I2OChain.cc.

Referenced by release().

26  :
27  data_()
28  {}
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
stor::I2OChain::I2OChain ( toolbox::mem::Reference *  pRef)
explicit

Create an I2OChain that will manage the Reference at address pRef, and assure that release is called on it only once, regardless of how many copies of the I2OChain object have been made. NOTE that if the message fragment contained in the XDAQ buffer is corrupted in some way, the chain will be marked "faulty" and should not be used in normal fragment processing.

Definition at line 30 of file I2OChain.cc.

References data_, I2O_SM_DATA, I2O_SM_DQM, I2O_SM_ERROR, I2O_SM_PREAMBLE, and i2oMessageCode().

31  {
32  if (pRef)
33  {
34  I2O_PRIVATE_MESSAGE_FRAME *pvtMsg =
35  (I2O_PRIVATE_MESSAGE_FRAME*) pRef->getDataLocation();
36  if (!pvtMsg)
37  {
38  data_.reset(new detail::ChainData());
39  data_->addFirstFragment(pRef);
40  return;
41  }
42 
43  unsigned short i2oMessageCode = pvtMsg->XFunctionCode;
44  switch (i2oMessageCode)
45  {
46 
47  case I2O_SM_PREAMBLE:
48  {
49  data_.reset(new detail::InitMsgData(pRef));
50  break;
51  }
52 
53  case I2O_SM_DATA:
54  {
55  data_.reset(new detail::EventMsgData(pRef));
56  break;
57  }
58 
59  case I2O_SM_DQM:
60  {
61  data_.reset(new detail::DQMEventMsgData(pRef));
62  break;
63  }
64 
65  case I2O_EVM_LUMISECTION:
66  {
67  data_.reset(new detail::EndLumiSectMsgData(pRef));
68  break;
69  }
70 
71  case I2O_SM_ERROR:
72  {
73  data_.reset(new detail::ErrorEventMsgData(pRef));
74  break;
75  }
76 
77  default:
78  {
79  data_.reset(new detail::ChainData());
80  data_->addFirstFragment(pRef);
81  data_->markCorrupt();
82  break;
83  }
84 
85  }
86  }
87  }
#define I2O_SM_ERROR
Definition: i2oEvfMsgs.h:23
#define I2O_SM_DQM
Definition: i2oEvfMsgs.h:25
#define I2O_SM_PREAMBLE
Definition: i2oEvfMsgs.h:21
unsigned short i2oMessageCode() const
Definition: I2OChain.cc:224
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
#define I2O_SM_DATA
Definition: i2oEvfMsgs.h:22
stor::I2OChain::I2OChain ( I2OChain const &  other)

A copy of an I2OChain shares management of the underlying Reference. We avoid calling Reference::duplicate.

Definition at line 89 of file I2OChain.cc.

89  :
90  data_(other.data_)
91  { }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
stor::I2OChain::~I2OChain ( )

Destroying an I2OChain does not release the managed Reference, unless that I2OChain is the last one managing that Reference.

Definition at line 93 of file I2OChain.cc.

94  { }

Member Function Documentation

void stor::I2OChain::addToChain ( I2OChain newpart)

Adds fragments from another chain to the current chain taking care that all fragments are chained in the right order. This destructively modifies newpart so that it no longer is part of managing any Reference: newpart is made empty.

If newpart contains chain elements that do not have the same fragment key (FragKey) as the current chain, an exception is thrown.

If newpart contains chain elements that already appear to exist in the current chain (e.g. fragment number 3 is added a second time), no exceptions are thrown and newpart is made empty, but the current chain is marked as faulty.

Definition at line 139 of file I2OChain.cc.

References stor::FragKey::code_, complete(), data_, empty(), stor::FragKey::event_, fragmentKey(), lumiQueryAPI::msg, stor::FragKey::originatorGuid_, stor::FragKey::originatorPid_, release(), stor::FragKey::run_, and stor::FragKey::secondaryId_.

140  {
141  // fragments can not be added to empty, complete, or faulty chains.
142  if (empty())
143  {
144  XCEPT_RAISE(stor::exception::I2OChain,
145  "A fragment may not be added to an empty chain.");
146  }
147  if (complete())
148  {
149  XCEPT_RAISE(stor::exception::I2OChain,
150  "A fragment may not be added to a complete chain.");
151  }
152 
153  // empty, complete, or faulty new parts can not be added to chains
154  if (newpart.empty())
155  {
156  XCEPT_RAISE(stor::exception::I2OChain,
157  "An empty chain may not be added to an existing chain.");
158  }
159  if (newpart.complete())
160  {
161  XCEPT_RAISE(stor::exception::I2OChain,
162  "A complete chain may not be added to an existing chain.");
163  }
164 
165  // require the new part and this chain to have the same fragment key
166  FragKey thisKey = fragmentKey();
167  FragKey thatKey = newpart.fragmentKey();
168  // should change this to != once we implement that operator in FragKey
169  if (thisKey < thatKey || thatKey < thisKey)
170  {
171  std::stringstream msg;
172  msg << "A fragment key mismatch was detected when trying to add "
173  << "a chain link to an existing chain. "
174  << "Existing key values = ("
175  << ((int)thisKey.code_) << "," << thisKey.run_ << ","
176  << thisKey.event_ << "," << thisKey.secondaryId_ << ","
177  << thisKey.originatorPid_ << "," << thisKey.originatorGuid_
178  << "), new key values = ("
179  << ((int)thatKey.code_) << "," << thatKey.run_ << ","
180  << thatKey.event_ << "," << thatKey.secondaryId_ << ","
181  << thatKey.originatorPid_ << "," << thatKey.originatorGuid_
182  << ").";
183  XCEPT_RAISE(stor::exception::I2OChain, msg.str());
184  }
185 
186  // add the fragment to the current chain
187  data_->addToChain(*(newpart.data_));
188  newpart.release();
189  }
bool complete() const
Definition: I2OChain.cc:118
bool empty() const
Definition: I2OChain.cc:110
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
FragKey fragmentKey() const
Definition: I2OChain.cc:278
void stor::I2OChain::addToStaleWindowStartTime ( const utils::Duration_t  duration)

Add the Duration_t in seconds to the stale window start time

Definition at line 308 of file I2OChain.cc.

References data_.

309  {
310  if (!data_) return;
311  data_->addToStaleWindowStartTime(duration);
312  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
uint32_t stor::I2OChain::adler32Checksum ( ) const

Returns the adler32 checksum as found in the message if available. Otherwise 0 is returned.

Definition at line 615 of file I2OChain.cc.

References data_.

616  {
617  if (!data_)
618  {
619  XCEPT_RAISE(stor::exception::I2OChain,
620  "The adler32 checksum can not be determined from an empty I2OChain.");
621  }
622  return data_->adler32Checksum();
623  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::assertRunNumber ( uint32_t  runNumber)

Checks that the run number found in the I2OChain header corresponds to the run number given as argument. It throws stor::exception::RunNumberMismatch if it is not the case. For error events, the given run number will be used by the StorageManager, but it will not be changed in the I2O header.

Definition at line 575 of file I2OChain.cc.

References data_.

Referenced by stor::Processing::do_processI2OFragment().

576  {
577  if (!data_)
578  {
579  XCEPT_RAISE(stor::exception::I2OChain,
580  "The run number can not be checked for an empty I2OChain.");
581  }
582  return data_->assertRunNumber(runNumber);
583  }
uint32_t runNumber() const
Definition: I2OChain.cc:585
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
bool stor::I2OChain::complete ( ) const
unsigned int stor::I2OChain::copyFragmentsIntoBuffer ( std::vector< unsigned char > &  buff) const

Copies the internally managed fragments to the specified vector in one contiguous set. Note that NO tests are done by this method - it can be run on empty, incomplete, faulty, and complete chains - and the result could be an incomplete or faulty storage manager message or worse. If the I2O fragments in the chain are corrupt, the data copied into the buffer could be the raw I2O messages, including headers. Returns the number of bytes copied.

Definition at line 469 of file I2OChain.cc.

References data_.

Referenced by stor::InitMsgCollection::addIfUnique(), and stor::DQMEventStore< EventType, ConnectionType, StateMachineType >::getDQMEventView().

470  {
471  if (!data_) return 0;
472  return data_->copyFragmentsIntoBuffer(targetBuffer);
473  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
utils::TimePoint_t stor::I2OChain::creationTime ( ) const

Returns the time when the I2OChain was created. This time corresponds to the time when the first fragment of the I2OChain was added.

The value corresponds to the number of seconds since the epoch (including a fractional part good to the microsecond level). A negative value indicates that an error occurred when fetching the time from the operating system.

Definition at line 290 of file I2OChain.cc.

References data_.

291  {
292  if (!data_) return boost::posix_time::not_a_date_time;
293  return data_->creationTime();
294  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned char * stor::I2OChain::dataLocation ( int  fragmentIndex) const

Returns the start address of the specified message fragment (indexed from 0 to N-1, where N is the total number of fragments). For complete chains, this method returns pointers to the actual INIT, EVENT, DQM_EVENT, or ERROR_EVENT message fragments. If the chain has been marked as "faulty", this method will still return a valid data location for all fragment indices. However, in that case, the data may not correspond to an underlying INIT, EVENT, etc. message.

Definition at line 444 of file I2OChain.cc.

References data_.

Referenced by stor::FRDFileHandler::do_writeEvent(), stor::EventFileHandler::do_writeEvent(), and stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeConsumerEvent().

445  {
446  if (!data_) return 0UL;
447  return data_->dataLocation(fragmentIndex);
448  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned long stor::I2OChain::dataSize ( int  fragmentIndex) const

Returns the size of the specified message fragment (indexed from 0 to N-1, where N is the total number of fragments). For complete chains, this method returns the sizes of the actual INIT, EVENT, ERROR_EVENT, or DQM_EVENT message fragments. If the chain has been marked as "faulty", this method will still return a valid data size for all fragment indices. However, in that case, the sizes may not correspond to the underlying INIT, EVENT, etc. message.

Definition at line 438 of file I2OChain.cc.

References data_.

Referenced by stor::FRDFileHandler::do_writeEvent(), and stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeConsumerEvent().

439  {
440  if (!data_) return 0UL;
441  return data_->dataSize(fragmentIndex);
442  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
DQMKey stor::I2OChain::dqmKey ( ) const

Returns the DQM key constructed from the message, if and only if, the message is a DQM event message. Otherwise, an exception is thrown. The DQM key uniquely identifies DQM events to be collated.

Definition at line 485 of file I2OChain.cc.

References data_.

486  {
487  if( !data_ )
488  {
489  XCEPT_RAISE( stor::exception::I2OChain,
490  "The DQM key can not be determined from an empty I2OChain." );
491  }
492  return data_->dqmKey();
493  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned int stor::I2OChain::droppedEventsCount ( ) const

Return the number of dropped events found in the EventHeader

Definition at line 404 of file I2OChain.cc.

References data_, and lumiQueryAPI::msg.

405  {
406  if (!data_)
407  {
408  std::stringstream msg;
409  msg << "A dropped event count cannot be retrieved from an empty chain";
410  XCEPT_RAISE(stor::exception::I2OChain, msg.str());
411  }
412  return data_->droppedEventsCount();
413  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
bool stor::I2OChain::empty ( void  ) const

Returns true if there is no Reference managed by *this.

Definition at line 110 of file I2OChain.cc.

References data_.

Referenced by addToChain(), Vispa.Gui.VispaWidget.TextField::setAutosizeFont(), and Vispa.Gui.VispaWidget.TextField::setAutotruncate().

111  {
112  // We're empty if we have no ChainData, or if the ChainData object
113  // we have is empty.
114  return !data_ || data_->empty();
115  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
uint32_t stor::I2OChain::eventNumber ( ) const

Returns the event number of the message, if and only if, the message is an Event or ErrorEvent message. Otherwise an exception is thrown.

Definition at line 605 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::addEventSample(), stor::RunMonitorCollection::addUnwantedEvent(), Vispa.Plugins.EdmBrowser.EdmDataAccessor.EdmDataAccessor::setFilterBranches(), and stor::EventDistributor::tagCompleteEventForQueues().

606  {
607  if (!data_)
608  {
609  XCEPT_RAISE(stor::exception::I2OChain,
610  "The event number can not be determined from an empty I2OChain.");
611  }
612  return data_->eventNumber();
613  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
bool stor::I2OChain::faulty ( ) const

Returns true if the chain has been marked faulty (the internal data does not represent a valid message fragment or the fragments in the chain do not represent a complete, valid message).

Definition at line 125 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), stor::RunMonitorCollection::addUnwantedEvent(), and stor::DiskWriter::processEndOfLumiSection().

126  {
127  if (!data_) return false;
128  return data_->faulty();
129  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned int stor::I2OChain::faultyBits ( ) const

Returns a bitmask containing the faulty bits.

Definition at line 132 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues().

133  {
134  if (!data_) return 0;
135  return data_->faultyBits();
136  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned int stor::I2OChain::fragmentCount ( ) const

Returns the number of frames currently contained in the chain. NOTE that this will be less than the total number of expected frames before the chain is complete and equal to the total number of expected frames after the chain is complete. And it can be zero if the chain is empty. If the chain is faulty, this method still returns the number of fragments contained in the chain, but those fragments may not correspond to a valid I2O message.

Definition at line 284 of file I2OChain.cc.

References data_.

Referenced by stor::FRDFileHandler::do_writeEvent(), and stor::ConsumerUtils< Configuration_t, EventQueueCollection_t >::writeConsumerEvent().

285  {
286  if (!data_) return 0;
287  return data_->fragmentCount();
288  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
FragKey stor::I2OChain::fragmentKey ( ) const

Returns the fragment key for the chain. The fragment key is the entity that uniquely identifies all of the fragments from a particular event.

Definition at line 278 of file I2OChain.cc.

References data_, and Header::INVALID.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), stor::FragmentStore::addFragment(), and addToChain().

279  {
280  if (!data_) return FragKey(Header::INVALID,0,0,0,0,0);
281  return data_->fragmentKey();
282  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned int stor::I2OChain::fuGuid ( ) const

Returns the filter unit GUID from the contained message. If no valid GUID can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 272 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::FilterUnitKey::FilterUnitKey().

273  {
274  if (!data_) return 0;
275  return data_->fuGuid();
276  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned int stor::I2OChain::fuProcessId ( ) const

Returns the filter unit process ID from the contained message. If no valid process ID can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 266 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::FilterUnitKey::FilterUnitKey().

267  {
268  if (!data_) return 0;
269  return data_->fuProcessId();
270  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned long * stor::I2OChain::getBufferData ( ) const

Return the address at which the data in buffer managed by the Reference begins. If the chain is empty, a null pointer is returned.

Definition at line 205 of file I2OChain.cc.

References data_.

206  {
207  return data_ ? data_->getBufferData() : 0UL;
208  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
QueueIDs stor::I2OChain::getDQMEventConsumerTags ( ) const

Returns the list of DQM event consumers (queue IDs) that this chain has been tagged for. An empty list is returned if the chain is empty. NOTE that this method returns a copy of the list, so it should only be used for testing which consumers have been tagged, not* for for modifying the list of tags.

Definition at line 394 of file I2OChain.cc.

References data_.

395  {
396  if (!data_)
397  {
398  QueueIDs tmpList;
399  return tmpList;
400  }
401  return data_->getDQMEventConsumerTags();
402  }
std::vector< QueueID > QueueIDs
Definition: QueueID.h:80
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
QueueIDs stor::I2OChain::getEventConsumerTags ( ) const

Returns the list of event consumers (queue IDs) that this chain has been tagged for. An empty list is returned if the chain is empty. NOTE that this method returns a copy of the list, so it should only be used for testing which consumers have been tagged, not* for for modifying the list of tags.

Definition at line 384 of file I2OChain.cc.

References data_.

385  {
386  if (!data_)
387  {
388  QueueIDs tmpList;
389  return tmpList;
390  }
391  return data_->getEventConsumerTags();
392  }
std::vector< QueueID > QueueIDs
Definition: QueueID.h:80
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned int stor::I2OChain::getFragmentID ( int  fragmentIndex) const

Returns the fragmentID of the specified message fragment (indexed from 0 to N-1, where N is the total number of fragments). This value varies from 0 to N-1 and should match the fragment index, so this method is probably only useful for testing.

Definition at line 450 of file I2OChain.cc.

References data_.

451  {
452  if (!data_) return 0;
453  return data_->getFragmentID(fragmentIndex);
454  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
std::vector< StreamID > stor::I2OChain::getStreamTags ( ) const

Returns the list of disk streams (stream IDs) that this chain has been tagged for. An empty list is returned if the chain is empty. NOTE that this method returns a copy of the list, so it should only be used for testing which streams have been tagged, not* for for modifying the list of tags.

Definition at line 374 of file I2OChain.cc.

References data_.

375  {
376  if (!data_)
377  {
378  std::vector<StreamID> tmpList;
379  return tmpList;
380  }
381  return data_->getStreamTags();
382  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned char * stor::I2OChain::headerLocation ( ) const

Returns the start address of the header part of the message that is contained in the chain. For complete chains of type INIT, EVENT, and DQM_EVENT, this method returns the true pointer to the message header. For other types of chains, and for chains that have been marked "faulty", this method will return a NULL pointer.

Definition at line 462 of file I2OChain.cc.

References data_.

Referenced by stor::EventFileHandler::do_writeEvent().

463  {
464  if (!data_) return 0UL;
465  return data_->headerLocation();
466  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned long stor::I2OChain::headerSize ( ) const

Returns the size of the header part of the message that is contained in the chain. For complete chains of type INIT, EVENT, and DQM_EVENT, this method returns the true size of the message header. For other types of chains, and for chains that have been marked "faulty", this method will return a size of zero.

Definition at line 456 of file I2OChain.cc.

References data_.

457  {
458  if (!data_) return 0UL;
459  return data_->headerSize();
460  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
std::string stor::I2OChain::hltClassName ( ) const

Returns the HLT class name from the contained message. If no valid class name can be determined, an empty string is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 260 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::ResourceBrokerKey::ResourceBrokerKey(), and stor::DiscardManager::sendDiscardMessage().

261  {
262  if (!data_) return "";
263  return data_->hltClassName();
264  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned int stor::I2OChain::hltInstance ( ) const

Returns the HLT instance number from the contained message. If no valid instance number can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 242 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::ResourceBrokerKey::ResourceBrokerKey(), and stor::DiscardManager::sendDiscardMessage().

243  {
244  if (!data_) return 0;
245  return data_->hltInstance();
246  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned int stor::I2OChain::hltLocalId ( ) const

Returns the HLT local ID from the contained message. If no valid local ID can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 236 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::ResourceBrokerKey::ResourceBrokerKey().

237  {
238  if (!data_) return 0;
239  return data_->hltLocalId();
240  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned int stor::I2OChain::hltTid ( ) const

Returns the HLT TID from the contained message. If no valid TID can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 248 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::ResourceBrokerKey::ResourceBrokerKey().

249  {
250  if (!data_) return 0;
251  return data_->hltTid();
252  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::hltTriggerBits ( std::vector< unsigned char > &  bitList) const

Copies the HLT trigger bits into the specified vector, if and only if, the message is an Event message. Otherwise, an exception is thrown. The vector will be resized so that it contains the full number of HLT bits (given by the hltCount() method) with two bits per HLT trigger.

Definition at line 565 of file I2OChain.cc.

References data_.

Referenced by stor::EventStreamSelector::acceptEvent(), stor::EventConsumerSelector::acceptEvent(), and stor::RunMonitorCollection::UnwantedEvent::UnwantedEvent().

566  {
567  if (!data_)
568  {
569  XCEPT_RAISE(stor::exception::I2OChain,
570  "HLT trigger bits can not be determined from an empty I2OChain.");
571  }
572  data_->hltTriggerBits(bitList);
573  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
uint32_t stor::I2OChain::hltTriggerCount ( ) const

Returns the number HLT trigger bits contained in the message, if and only if, the message is an Event message. Otherwise, an exception is thrown.

Definition at line 555 of file I2OChain.cc.

References data_.

Referenced by stor::EventStreamSelector::acceptEvent(), stor::EventConsumerSelector::acceptEvent(), and stor::RunMonitorCollection::UnwantedEvent::UnwantedEvent().

556  {
557  if (!data_)
558  {
559  XCEPT_RAISE(stor::exception::I2OChain,
560  "The number of HLT trigger bits can not be determined from an empty I2OChain.");
561  }
562  return data_->hltTriggerCount();
563  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::hltTriggerNames ( Strings nameList) const

Copies the HLT trigger names into the specified vector, if and only if, the message is an INIT message. Otherwise, an exception is thrown.

Definition at line 525 of file I2OChain.cc.

References data_.

526  {
527  if (!data_)
528  {
529  XCEPT_RAISE(stor::exception::I2OChain,
530  "HLT trigger names can not be determined from an empty I2OChain.");
531  }
532  data_->hltTriggerNames(nameList);
533  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::hltTriggerSelections ( Strings nameList) const

Copies the HLT trigger names into the specified vector, if and only if, the message is an INIT message. Otherwise, an exception is thrown.

Definition at line 535 of file I2OChain.cc.

References data_.

536  {
537  if (!data_)
538  {
539  XCEPT_RAISE(stor::exception::I2OChain,
540  "HLT trigger selections can not be determined from an empty I2OChain.");
541  }
542  data_->hltTriggerSelections(nameList);
543  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
std::string stor::I2OChain::hltURL ( ) const

Returns the HLT URL from the contained message. If no valid URL can be determined, an empty string is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 254 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), and stor::DataSenderMonitorCollection::ResourceBrokerKey::ResourceBrokerKey().

255  {
256  if (!data_) return "";
257  return data_->hltURL();
258  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned short stor::I2OChain::i2oMessageCode ( ) const

Returns the I2O function code for the chain. Valid values are defined in interface/shared/i2oXFunctionCodes.h. If now chain is found, 0xffff is returned.

Definition at line 224 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), and I2OChain().

225  {
226  if (!data_) return 0xffff;
227  return data_->i2oMessageCode();
228  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
bool stor::I2OChain::isEndOfLumiSectionMessage ( ) const

Returns true if the I2O function code indicates that the message represents an end-of-lumi-section signal.

Definition at line 625 of file I2OChain.cc.

References data_.

Referenced by stor::DiskWriter::writeNextEvent().

626  {
627  if (!data_) return false;
628  return data_->isEndOfLumiSectionMessage();
629  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
bool stor::I2OChain::isTaggedForAnyDQMEventConsumer ( ) const

Returns true if the chain has been tagged for any DQM event consumer and false otherwise.

Definition at line 368 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::tagCompleteEventForQueues().

369  {
370  if (!data_) return false;
371  return data_->isTaggedForAnyDQMEventConsumer();
372  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
bool stor::I2OChain::isTaggedForAnyEventConsumer ( ) const

Returns true if the chain has been tagged for any event consumer and false otherwise.

Definition at line 362 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues().

363  {
364  if (!data_) return false;
365  return data_->isTaggedForAnyEventConsumer();
366  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
bool stor::I2OChain::isTaggedForAnyStream ( ) const

Returns true if the chain has been tagged for any disk stream and false otherwise.

Definition at line 356 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues().

357  {
358  if (!data_) return false;
359  return data_->isTaggedForAnyStream();
360  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::l1TriggerNames ( Strings nameList) const

Copies the L1 trigger names into the specified vector, if and only if, the message is an INIT message. Otherwise, an exception is thrown.

Definition at line 545 of file I2OChain.cc.

References data_.

546  {
547  if (!data_)
548  {
549  XCEPT_RAISE(stor::exception::I2OChain,
550  "L1 trigger names can not be determined from an empty I2OChain.");
551  }
552  data_->l1TriggerNames(nameList);
553  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
utils::TimePoint_t stor::I2OChain::lastFragmentTime ( ) const

Returns the time when the last fragment was added to the I2OChain.

The value corresponds to the number of seconds since the epoch (including a fractional part good to the microsecond level). A negative value indicates that an error occurred when fetching the time from the operating system.

Definition at line 296 of file I2OChain.cc.

References data_.

297  {
298  if (!data_) return boost::posix_time::not_a_date_time;
299  return data_->lastFragmentTime();
300  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
uint32_t stor::I2OChain::lumiSection ( ) const

Returns the luminosity section of the message, if and only if, the message is an Event or ErrorEvent message. Otherwise an exception is thrown.

Definition at line 595 of file I2OChain.cc.

References data_.

Referenced by stor::DiskWriter::processEndOfLumiSection(), stor::StorageManager::receiveEndOfLumiSectionMessage(), and stor::EventDistributor::tagCompleteEventForQueues().

596  {
597  if (!data_)
598  {
599  XCEPT_RAISE(stor::exception::I2OChain,
600  "The luminosity section can not be determined from an empty I2OChain.");
601  }
602  return data_->lumiSection();
603  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::markFaulty ( )

Mark this chain as known to be complete. Mark this chain as known to be faulty. The failure modes that result in a chain being marked faulty include chains that have duplicate fragments and chains that never become complete after a timeout interval.

Definition at line 198 of file I2OChain.cc.

References data_.

Referenced by stor::FragmentStore::getStaleEvent().

199  {
200  // TODO:: Should we throw an exception if data_ is null? If so, what
201  // type? Right now, we do nothing if data_ is null.
202  if (data_) data_->markFaulty();
203  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
size_t stor::I2OChain::memoryUsed ( ) const

Returns the total memory occupied by all message fragments in the chain. This includes all I2O headers and

Definition at line 426 of file I2OChain.cc.

References data_.

Referenced by stor::FragmentStore::addFragment(), stor::FragmentStore::getStaleEvent(), stor::FragmentProcessor::processOneFragment(), and stor::DiskWriter::writeNextEvent().

427  {
428  if (!data_) return 0;
429  return data_->memoryUsed();
430  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned int stor::I2OChain::messageCode ( ) const
uint32_t stor::I2OChain::nExpectedEPs ( ) const

Returns the number of slave EPs reported in the message, if and only if, the message is an INIT message. Otherwise, an exception is thrown.

Definition at line 515 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::addInitSample().

516  {
517  if (!data_)
518  {
519  XCEPT_RAISE(stor::exception::I2OChain,
520  "The slave EP count can not be determined from an empty I2OChain.");
521  }
522  return data_->nExpectedEPs();
523  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
I2OChain & stor::I2OChain::operator= ( I2OChain const &  rhs)

Assigning to an I2OChain causes the left-hand side of the assignment to relinquish management of any Reference it might have had. If the left-hand side was the only chain managing that Reference, it will be released. After the assignment, the left-hand side shares management of the underlying Reference of the right-hand side.

Definition at line 96 of file I2OChain.cc.

References swap(), and groupFilesInBlocks::temp.

97  {
98  // This is the standard copy/swap algorithm, to obtain the strong
99  // exception safety guarantee.
100  I2OChain temp(rhs);
101  swap(temp);
102  return *this;
103  }
void swap(I2OChain &other)
Definition: I2OChain.cc:105
uint32_t stor::I2OChain::outputModuleId ( ) const

Returns the output module ID contained in the message, if and only if, the message is an INIT or an Event message. Otherwise, an exception is thrown.

Definition at line 505 of file I2OChain.cc.

References data_.

Referenced by stor::EventStreamSelector::acceptEvent(), stor::EventConsumerSelector::acceptEvent(), stor::InitMsgCollection::addIfUnique(), stor::RunMonitorCollection::addUnwantedEvent(), stor::DataSenderMonitorCollection::getAllNeededPointers(), stor::EventStreamHandler::newFileHandler(), and stor::FaultyEventStreamHandler::newFileHandler().

506  {
507  if (!data_)
508  {
509  XCEPT_RAISE(stor::exception::I2OChain,
510  "The output module ID can not be determined from an empty I2OChain.");
511  }
512  return data_->outputModuleId();
513  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
std::string stor::I2OChain::outputModuleLabel ( ) const

Returns the output module label contained in the message, if and only if, the message is an INIT message. Otherwise, an exception is thrown.

Definition at line 495 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::addInitSample().

496  {
497  if (!data_)
498  {
499  XCEPT_RAISE(stor::exception::I2OChain,
500  "The output module label can not be determined from an empty I2OChain.");
501  }
502  return data_->outputModuleLabel();
503  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned int stor::I2OChain::rbBufferId ( ) const

Returns the resource broker buffer ID from the contained message. If no valid buffer ID can be determined, zero is returned. NOTE that you must test if messageCode() != Header::INVALID to determine that the returned value is valid.

Definition at line 230 of file I2OChain.cc.

References data_.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), and stor::DiscardManager::sendDiscardMessage().

231  {
232  if (!data_) return 0;
233  return data_->rbBufferId();
234  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::release ( )

Abandon management of the managed Reference, if there is one. After this call, *this will be in the same state as if it had been default-constructed.

Definition at line 210 of file I2OChain.cc.

References I2OChain().

Referenced by cuy.ValElement::__init__(), stor::FragmentStore::addFragment(), addToChain(), and stor::FragmentStore::getStaleEvent().

211  {
212  // A default-constructed chain controls no resources; we can
213  // relinquish our control over any controlled Reference by
214  // becoming like a default-constructed chain.
215  I2OChain().swap(*this);
216  }
void stor::I2OChain::resetStaleWindowStartTime ( )

Sets the stale window start time to "now".

Definition at line 314 of file I2OChain.cc.

References data_.

Referenced by stor::FragmentStore::addFragment().

315  {
316  if (!data_) return;
317  data_->resetStaleWindowStartTime();
318  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
uint32_t stor::I2OChain::runNumber ( ) const

Returns the run number of the message, if and only if, the message is an Event or ErrorEvent message. Otherwise an exception is thrown.

Definition at line 585 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::addEventSample(), stor::DiskWriter::processEndOfLumiSection(), and stor::EventDistributor::tagCompleteEventForQueues().

586  {
587  if (!data_)
588  {
589  XCEPT_RAISE(stor::exception::I2OChain,
590  "The run number can not be determined from an empty I2OChain.");
591  }
592  return data_->runNumber();
593  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::setDroppedEventsCount ( unsigned int  count)

Add the number of dropped (skipped) events to the EVENT message header.

Definition at line 415 of file I2OChain.cc.

References data_, and lumiQueryAPI::msg.

416  {
417  if (!data_)
418  {
419  std::stringstream msg;
420  msg << "A dropped event count cannot be added to an empty chain";
421  XCEPT_RAISE(stor::exception::I2OChain, msg.str());
422  }
423  data_->setDroppedEventsCount(count);
424  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
utils::TimePoint_t stor::I2OChain::staleWindowStartTime ( ) const

Returns the stale window start time. This is the time that should be used when checking if a chain has become stale.

The value corresponds to the number of seconds since the epoch (including a fractional part good to the microsecond level). A negative value indicates that an error occurred when fetching the time from the operating system.

Definition at line 302 of file I2OChain.cc.

References data_.

303  {
304  if (!data_) return boost::posix_time::not_a_date_time;
305  return data_->staleWindowStartTime();
306  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::swap ( I2OChain other)

Standard swap.

Definition at line 105 of file I2OChain.cc.

References data_.

Referenced by operator=().

106  {
107  data_.swap(other.data_);
108  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::tagForDQMEventConsumer ( QueueID  queueId)

Tags the chain with the specified DQM event consumer queue ID. This means that the data in the chain should be sent to the specified DQM event consumer queue.

Definition at line 344 of file I2OChain.cc.

References data_, and lumiQueryAPI::msg.

Referenced by stor::EventDistributor::tagCompleteEventForQueues().

345  {
346  if (!data_)
347  {
348  std::stringstream msg;
349  msg << "An empty chain can not be tagged for a specific ";
350  msg << "DQM event consumer.";
351  XCEPT_RAISE(stor::exception::I2OChain, msg.str());
352  }
353  data_->tagForDQMEventConsumer(queueId);
354  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::tagForEventConsumer ( QueueID  queueId)

Tags the chain with the specified event consumer queue ID. This means that the data in the chain should be sent to the specified event consumer queue.

Definition at line 332 of file I2OChain.cc.

References data_, and lumiQueryAPI::msg.

Referenced by stor::EventDistributor::tagCompleteEventForQueues().

333  {
334  if (!data_)
335  {
336  std::stringstream msg;
337  msg << "An empty chain can not be tagged for a specific ";
338  msg << "event consumer.";
339  XCEPT_RAISE(stor::exception::I2OChain, msg.str());
340  }
341  data_->tagForEventConsumer(queueId);
342  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
void stor::I2OChain::tagForStream ( StreamID  streamId)

Tags the chain with the specified disk writing stream ID. This means that the data in the chain should be sent to the specified disk stream.

Definition at line 320 of file I2OChain.cc.

References data_, and lumiQueryAPI::msg.

Referenced by stor::EventDistributor::addEventToRelevantQueues(), and stor::EventDistributor::tagCompleteEventForQueues().

321  {
322  if (!data_)
323  {
324  std::stringstream msg;
325  msg << "An empty chain can not be tagged for a specific ";
326  msg << "event stream.";
327  XCEPT_RAISE(stor::exception::I2OChain, msg.str());
328  }
329  data_->tagForStream(streamId);
330  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
std::string stor::I2OChain::topFolderName ( ) const

Returns the top folder contained in the message, if and only if, the message is a DQM event message. Otherwise, an exception is thrown.

Definition at line 475 of file I2OChain.cc.

References data_.

Referenced by stor::DQMEventSelector::acceptEvent().

476  {
477  if( !data_ )
478  {
479  XCEPT_RAISE( stor::exception::I2OChain,
480  "The top folder name can not be determined from an empty I2OChain." );
481  }
482  return data_->topFolderName();
483  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574
unsigned long stor::I2OChain::totalDataSize ( ) const

Returns the total size of all of the contained message fragments. For chains that are marked complete, this is the size of the actual INIT, EVENT, DQM_EVENT, or ERROR_EVENT message contained in the chain. For incomplete chains, this method will return an invalid value. If the chain has been marked as "faulty", this method will return the total size of the data that will be returned from the dataSize() method on each of the fragments, even though those fragments may not correspond to actual storage manager messages.

Definition at line 432 of file I2OChain.cc.

References data_.

Referenced by stor::DataSenderMonitorCollection::addDQMEventSample(), stor::DataSenderMonitorCollection::addErrorEventSample(), stor::DataSenderMonitorCollection::addEventSample(), stor::DataSenderMonitorCollection::addFaultyEventSample(), stor::InitMsgCollection::addIfUnique(), stor::DataSenderMonitorCollection::addInitSample(), stor::StreamHandler::getFileHandler(), stor::StorageManager::receiveDataMessage(), stor::StorageManager::receiveDQMMessage(), stor::StorageManager::receiveEndOfLumiSectionMessage(), stor::StorageManager::receiveErrorDataMessage(), stor::StorageManager::receiveRegistryMessage(), and stor::StreamHandler::writeEvent().

433  {
434  if (!data_) return 0UL;
435  return data_->totalDataSize();
436  }
boost::shared_ptr< detail::ChainData > data_
Definition: I2OChain.h:574

Member Data Documentation

boost::shared_ptr<detail::ChainData> stor::I2OChain::data_
private