CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ChainData.cc
Go to the documentation of this file.
1 // $Id: ChainData.cc,v 1.14.2.2 2011/02/28 17:56:05 mommsen Exp $
3 
6 
8 
14 
16 
17 #include "interface/shared/i2oXFunctionCodes.h"
18 #include "interface/shared/version.h"
19 
20 #include <stdlib.h>
21 #include "zlib.h"
22 
23 
24 using namespace stor;
25 
26 // A ChainData object may or may not contain a Reference.
27 detail::ChainData::ChainData(const unsigned short i2oMessageCode,
28  const unsigned int messageCode) :
29  streamTags_(),
30  eventConsumerTags_(),
31  dqmEventConsumerTags_(),
32  ref_(0),
33  complete_(false),
34  faultyBits_(INCOMPLETE_MESSAGE),
35  messageCode_(messageCode),
36  i2oMessageCode_(i2oMessageCode),
37  fragKey_(Header::INVALID,0,0,0,0,0),
38  fragmentCount_(0),
39  expectedNumberOfFragments_(0),
40  rbBufferId_(0),
41  hltLocalId_(0),
42  hltInstance_(0),
43  hltTid_(0),
44  fuProcessId_(0),
45  fuGuid_(0)
46 {
47  #ifdef STOR_DEBUG_CORRUPT_MESSAGES
48  double r = rand()/static_cast<double>(RAND_MAX);
49  if (r < 0.001)
50  {
51  // std::cout << "Simulating corrupt I2O message" << std::endl;
52  // markCorrupt();
53  }
54  else if (r < 0.02)
55  {
56  std::cout << "Simulating faulty I2O message" << std::endl;
57  markFaulty();
58  }
59  #endif // STOR_DEBUG_CORRUPT_MESSAGES
60 }
61 
62 // A ChainData that has a Reference is in charge of releasing
63 // it. Because releasing a Reference can throw an exception, we have
64 // to be prepared to swallow the exception. This is fairly gross,
65 // because we lose any exception information. But allowing an
66 // exception to escape from a destructor is even worse, so we must
67 // do what we must do.
68 //
70 {
71  if (ref_)
72  {
73  //std::cout << std::endl << std::endl << std::hex
74  // << "### releasing 0x" << ((int) ref_)
75  // << std::dec << std::endl << std::endl;
76  try { ref_->release(); }
77  catch (...) { /* swallow any exception. */ }
78  }
79 }
80 
82 {
83  return !ref_;
84 }
85 
87 {
88  return complete_;
89 }
90 
92 {
93  if (complete_)
94  return (faultyBits_ != 0);
95  else
96  return (faultyBits_ != INCOMPLETE_MESSAGE);
97 }
98 
99 unsigned int detail::ChainData::faultyBits() const
100 {
101  return faultyBits_;
102 }
103 
105 {
106  return (ref_) &&
107  ((faultyBits_ & INVALID_INITIAL_REFERENCE & ~INCOMPLETE_MESSAGE) == 0) &&
108  ((faultyBits_ & CORRUPT_INITIAL_HEADER & ~INCOMPLETE_MESSAGE) == 0);
109 }
110 
112 {
113  return ( (faultyBits_ & ~WRONG_CHECKSUM) == 0);
114 }
115 
116 void detail::ChainData::addFirstFragment(toolbox::mem::Reference* pRef)
117 {
118  if (ref_)
119  {
120  XCEPT_RAISE(stor::exception::I2OChain, "Cannot add a first fragment to a non-empty I2OChain.");
121  }
122  ref_ = pRef;
123 
124  // Avoid the situation in which all unparsable chains
125  // have the same fragment key. We do this by providing a
126  // variable default value for one of the fragKey fields.
127  if (pRef)
128  {
129  fragKey_.secondaryId_ = static_cast<uint32_t>(
130  (uintptr_t)pRef->getDataLocation()
131  );
132  }
133  else
134  {
135  fragKey_.secondaryId_ = static_cast<uint32_t>( time(0) );
136  }
137 
138  if (pRef)
139  {
140  creationTime_ = utils::getCurrentTime();
141  lastFragmentTime_ = creationTime_;
142  staleWindowStartTime_ = creationTime_;
143 
144  // first fragment in Reference chain
145  ++fragmentCount_;
146  int workingIndex = -1;
147 
148  if (validateDataLocation(pRef, INVALID_INITIAL_REFERENCE) &&
149  validateMessageSize(pRef, CORRUPT_INITIAL_HEADER) &&
150  validateFragmentIndexAndCount(pRef, CORRUPT_INITIAL_HEADER))
151  {
153  (I2O_SM_MULTIPART_MESSAGE_FRAME*) pRef->getDataLocation();
154  expectedNumberOfFragments_ = smMsg->numFrames;
155  validateFragmentOrder(pRef, workingIndex);
156  }
157 
158  // subsequent fragments in Reference chain
159  toolbox::mem::Reference* curRef = pRef->getNextReference();
160  while (curRef)
161  {
162  ++fragmentCount_;
163 
164  if (validateDataLocation(curRef, INVALID_SECONDARY_REFERENCE) &&
165  validateMessageSize(curRef, CORRUPT_SECONDARY_HEADER) &&
166  validateFragmentIndexAndCount(curRef, CORRUPT_SECONDARY_HEADER))
167  {
168  validateExpectedFragmentCount(curRef, TOTAL_COUNT_MISMATCH);
169  validateFragmentOrder(curRef, workingIndex);
170  validateMessageCode(curRef, i2oMessageCode_);
171  }
172 
173  curRef = curRef->getNextReference();
174  }
175  }
176 
177  checkForCompleteness();
178 }
179 
181 {
182  if ( this->empty() )
183  {
184  addFirstFragment(newpart.ref_);
185  return;
186  }
187 
188  if (parsable() && newpart.parsable())
189  {
190  // loop over the fragments in the new part
191  toolbox::mem::Reference* newRef = newpart.ref_;
192  while (newRef)
193  {
194  // unlink the next element in the new chain from that chain
195  toolbox::mem::Reference* nextNewRef = newRef->getNextReference();
196  newRef->setNextReference(0);
197 
198  // if the new fragment that we're working with is the first one
199  // in its chain, we need to duplicate it (now that it is unlinked)
200  // This is necessary since it is still being managed by an I2OChain
201  // somewhere. The subsequent fragments in the new part do not
202  // need to be duplicated since we explicitly unlinked them from
203  // the first one.
204  if (newRef == newpart.ref_) {newRef = newpart.ref_->duplicate();}
205 
206  // we want to track whether the fragment was added (it *always* should be)
207  bool fragmentWasAdded = false;
208 
209  // determine the index of the new fragment
211  (I2O_SM_MULTIPART_MESSAGE_FRAME*) newRef->getDataLocation();
212  unsigned int newIndex = thatMsg->frameCount;
213  //std::cout << "newIndex = " << newIndex << std::endl;
214 
215  // verify that the total fragment counts match
216  unsigned int newFragmentTotalCount = thatMsg->numFrames;
217  if (newFragmentTotalCount != expectedNumberOfFragments_)
218  {
219  faultyBits_ |= TOTAL_COUNT_MISMATCH;
220  }
221 
222  // if the new fragment goes at the head of the chain, handle that here
224  (I2O_SM_MULTIPART_MESSAGE_FRAME*) ref_->getDataLocation();
225  unsigned int firstIndex = fragMsg->frameCount;
226  //std::cout << "firstIndex = " << firstIndex << std::endl;
227  if (newIndex < firstIndex)
228  {
229  newRef->setNextReference(ref_);
230  ref_ = newRef;
231  fragmentWasAdded = true;
232  }
233 
234  else
235  {
236  // loop over the existing fragments and insert the new one
237  // in the correct place
238  toolbox::mem::Reference* curRef = ref_;
239  for (unsigned int idx = 0; idx < fragmentCount_; ++idx)
240  {
241  // if we have a duplicate fragment, add it after the existing
242  // one and indicate the error
244  (I2O_SM_MULTIPART_MESSAGE_FRAME*) curRef->getDataLocation();
245  unsigned int curIndex = curMsg->frameCount;
246  //std::cout << "curIndex = " << curIndex << std::endl;
247  if (newIndex == curIndex)
248  {
249  faultyBits_ |= DUPLICATE_FRAGMENT;
250  newRef->setNextReference(curRef->getNextReference());
251  curRef->setNextReference(newRef);
252  fragmentWasAdded = true;
253  break;
254  }
255 
256  // if we have reached the end of the chain, add the
257  // new fragment to the end
258  //std::cout << "nextRef = " << ((int) nextRef) << std::endl;
259  toolbox::mem::Reference* nextRef = curRef->getNextReference();
260  if (nextRef == 0)
261  {
262  curRef->setNextReference(newRef);
263  fragmentWasAdded = true;
264  break;
265  }
266 
268  (I2O_SM_MULTIPART_MESSAGE_FRAME*) nextRef->getDataLocation();
269  unsigned int nextIndex = nextMsg->frameCount;
270  //std::cout << "nextIndex = " << nextIndex << std::endl;
271  if (newIndex > curIndex && newIndex < nextIndex)
272  {
273  newRef->setNextReference(curRef->getNextReference());
274  curRef->setNextReference(newRef);
275  fragmentWasAdded = true;
276  break;
277  }
278 
279  curRef = nextRef;
280  }
281  }
282 
283  // update the fragment count and check if the chain is now complete
284  if (!fragmentWasAdded)
285  {
286  // this should never happen - if it does, there is a logic
287  // error in the loop above
288  XCEPT_RAISE(stor::exception::I2OChain,
289  "A fragment was unable to be added to a chain.");
290  }
291  ++fragmentCount_;
292 
293  newRef = nextNewRef;
294  }
295  }
296  else
297  {
298  // if either the current chain or the newpart are nor parsable,
299  // we simply append the new stuff to the end of the existing chain
300 
301  // update our fragment count to include the new fragments
302  toolbox::mem::Reference* curRef = newpart.ref_;
303  while (curRef) {
304  ++fragmentCount_;
305  curRef = curRef->getNextReference();
306  }
307 
308  // append the new fragments to the end of the existing chain
309  toolbox::mem::Reference* lastRef = ref_;
310  curRef = ref_->getNextReference();
311  while (curRef) {
312  lastRef = curRef;
313  curRef = curRef->getNextReference();
314  }
315  lastRef->setNextReference(newpart.ref_->duplicate());
316 
317  // update the time stamps
318  lastFragmentTime_ = utils::getCurrentTime();
319  staleWindowStartTime_ = lastFragmentTime_;
320  if (newpart.creationTime() < creationTime_)
321  {
322  creationTime_ = newpart.creationTime();
323  }
324 
325  return;
326  }
327 
328  // merge the faulty flags from the new part into the existing flags
329  faultyBits_ |= newpart.faultyBits_;
330 
331  // update the time stamps
332  lastFragmentTime_ = utils::getCurrentTime();
333  staleWindowStartTime_ = lastFragmentTime_;
334  if (newpart.creationTime() < creationTime_)
335  {
336  creationTime_ = newpart.creationTime();
337  }
338 
339  checkForCompleteness();
340 }
341 
343 {
344  if ((fragmentCount_ == expectedNumberOfFragments_) &&
345  ((faultyBits_ & (TOTAL_COUNT_MISMATCH | FRAGMENTS_OUT_OF_ORDER | DUPLICATE_FRAGMENT)) == 0))
346  markComplete();
347 }
348 
350 {
351  faultyBits_ &= ~INCOMPLETE_MESSAGE; // reset incomplete bit
352  complete_ = true;
353  validateAdler32Checksum();
354 }
355 
357 {
358  faultyBits_ |= EXTERNALLY_REQUESTED;
359 }
360 
362 {
363  faultyBits_ |= CORRUPT_INITIAL_HEADER;
364 }
365 
366 unsigned long* detail::ChainData::getBufferData() const
367 {
368  return ref_
369  ? static_cast<unsigned long*>(ref_->getDataLocation())
370  : 0UL;
371 }
372 
374 {
375  streamTags_.swap(other.streamTags_);
376  eventConsumerTags_.swap(other.eventConsumerTags_);
377  dqmEventConsumerTags_.swap(other.dqmEventConsumerTags_);
378  std::swap(ref_, other.ref_);
379  std::swap(complete_, other.complete_);
380  std::swap(faultyBits_, other.faultyBits_);
381  std::swap(messageCode_, other.messageCode_);
382  std::swap(i2oMessageCode_, other.i2oMessageCode_);
383  std::swap(fragKey_, other.fragKey_);
384  std::swap(fragmentCount_, other.fragmentCount_);
385  std::swap(expectedNumberOfFragments_, other.expectedNumberOfFragments_);
386  std::swap(creationTime_, other.creationTime_);
387  std::swap(lastFragmentTime_, other.lastFragmentTime_);
388  std::swap(staleWindowStartTime_, other.staleWindowStartTime_);
389 }
390 
392 {
393  size_t memoryUsed = 0;
394  toolbox::mem::Reference* curRef = ref_;
395  while (curRef)
396  {
397  memoryUsed += curRef->getDataSize();
398  curRef = curRef->getNextReference();
399  }
400  return memoryUsed;
401 }
402 
403 unsigned long detail::ChainData::totalDataSize() const
404 {
405  unsigned long totalSize = 0;
406  toolbox::mem::Reference* curRef = ref_;
407  for (unsigned int idx = 0; idx < fragmentCount_; ++idx)
408  {
409  I2O_MESSAGE_FRAME *i2oMsg =
410  (I2O_MESSAGE_FRAME*) curRef->getDataLocation();
411  if (!faulty())
412  {
415  totalSize += smMsg->dataSize;
416  }
417  else if (i2oMsg)
418  {
419  totalSize += (i2oMsg->MessageSize*4);
420  }
421 
422  curRef = curRef->getNextReference();
423  }
424  return totalSize;
425 }
426 
427 unsigned long detail::ChainData::dataSize(int fragmentIndex) const
428 {
429  toolbox::mem::Reference* curRef = ref_;
430  for (int idx = 0; idx < fragmentIndex; ++idx)
431  {
432  curRef = curRef->getNextReference();
433  }
434 
435  I2O_MESSAGE_FRAME *i2oMsg =
436  (I2O_MESSAGE_FRAME*) curRef->getDataLocation();
437  if (!faulty())
438  {
441  return smMsg->dataSize;
442  }
443  else if (i2oMsg)
444  {
445  return (i2oMsg->MessageSize*4);
446  }
447  return 0;
448 }
449 
450 unsigned char* detail::ChainData::dataLocation(int fragmentIndex) const
451 {
452  toolbox::mem::Reference* curRef = ref_;
453  for (int idx = 0; idx < fragmentIndex; ++idx)
454  {
455  curRef = curRef->getNextReference();
456  }
457 
458  if (!faulty())
459  {
460  return do_fragmentLocation(static_cast<unsigned char*>
461  (curRef->getDataLocation()));
462  }
463  else
464  {
465  return static_cast<unsigned char*>(curRef->getDataLocation());
466  }
467 }
468 
469 unsigned int detail::ChainData::getFragmentID(int fragmentIndex) const
470 {
471  toolbox::mem::Reference* curRef = ref_;
472  for (int idx = 0; idx < fragmentIndex; ++idx)
473  {
474  curRef = curRef->getNextReference();
475  }
476 
477  if (parsable())
478  {
480  (I2O_SM_MULTIPART_MESSAGE_FRAME*) curRef->getDataLocation();
481  return smMsg->frameCount;
482  }
483  else
484  {
485  return 0;
486  }
487 }
488 
489 unsigned int detail::ChainData::
490 copyFragmentsIntoBuffer(std::vector<unsigned char>& targetBuffer) const
491 {
492  unsigned long fullSize = totalDataSize();
493  if (targetBuffer.capacity() < fullSize)
494  {
495  targetBuffer.resize(fullSize);
496  }
497  unsigned char* targetLoc = (unsigned char*)&targetBuffer[0];
498 
499  toolbox::mem::Reference* curRef = ref_;
500  while (curRef)
501  {
502  unsigned char* fragmentLoc =
503  (unsigned char*) curRef->getDataLocation();
504  unsigned long sourceSize = 0;
505  unsigned char* sourceLoc = 0;
506 
507  if (!faulty())
508  {
510  (I2O_SM_MULTIPART_MESSAGE_FRAME*) fragmentLoc;
511  sourceSize = smMsg->dataSize;
512  sourceLoc = do_fragmentLocation(fragmentLoc);
513  }
514  else if (fragmentLoc)
515  {
516  I2O_MESSAGE_FRAME *i2oMsg = (I2O_MESSAGE_FRAME*) fragmentLoc;
517  sourceSize = i2oMsg->MessageSize * 4;
518  sourceLoc = fragmentLoc;
519  }
520 
521  if (sourceSize > 0)
522  {
523  std::copy(sourceLoc, sourceLoc+sourceSize, targetLoc);
524  targetLoc += sourceSize;
525  }
526 
527  curRef = curRef->getNextReference();
528  }
529 
530  return static_cast<unsigned int>(fullSize);
531 }
532 
533 unsigned long detail::ChainData::headerSize() const
534 {
535  return do_headerSize();
536 }
537 
538 unsigned char* detail::ChainData::headerLocation() const
539 {
540  return do_headerLocation();
541 }
542 
543 std::string detail::ChainData::hltURL() const
544 {
545  if (parsable())
546  {
548  (I2O_SM_MULTIPART_MESSAGE_FRAME*) ref_->getDataLocation();
549  size_t size = std::min(strlen(smMsg->hltURL),
550  (size_t) MAX_I2O_SM_URLCHARS);
551  std::string URL(smMsg->hltURL, size);
552  return URL;
553  }
554  else
555  {
556  return "unavailable";
557  }
558 }
559 
561 {
562  if (parsable())
563  {
565  (I2O_SM_MULTIPART_MESSAGE_FRAME*) ref_->getDataLocation();
566  size_t size = std::min(strlen(smMsg->hltClassName),
567  (size_t) MAX_I2O_SM_URLCHARS);
568  std::string className(smMsg->hltClassName, size);
569  return className;
570  }
571  else
572  {
573  return "unavailable";
574  }
575 }
576 
578 {
579  return do_outputModuleId();
580 }
581 
582 
584 {
585  return do_outputModuleLabel();
586 }
587 
589 {
590  return do_topFolderName();
591 }
592 
594 {
595  return do_dqmKey();
596 }
597 
599 {
600  do_hltTriggerNames(nameList);
601 }
602 
604 {
605  do_hltTriggerSelections(nameList);
606 }
607 
609 {
610  do_l1TriggerNames(nameList);
611 }
612 
614 {
615  return do_hltTriggerCount();
616 }
617 
618 void
619 detail::ChainData::hltTriggerBits(std::vector<unsigned char>& bitList) const
620 {
621  do_hltTriggerBits(bitList);
622 }
623 
625 {
626  do_assertRunNumber(runNumber);
627 }
628 
630 {
631  return do_runNumber();
632 }
633 
635 {
636  return do_lumiSection();
637 }
638 
640 {
641  return do_eventNumber();
642 }
643 
645 {
646  return do_adler32Checksum();
647 }
648 
650 {
651  streamTags_.push_back(streamId);
652 }
653 
655 {
656  eventConsumerTags_.push_back(queueId);
657 }
658 
660 {
661  dqmEventConsumerTags_.push_back(queueId);
662 }
663 
664 std::vector<StreamID> const& detail::ChainData::getStreamTags() const
665 {
666  return streamTags_;
667 }
668 
670 {
671  return eventConsumerTags_;
672 }
673 
675 {
676  return dqmEventConsumerTags_;
677 }
678 
680 {
681  return ( i2oMessageCode_ == I2O_EVM_LUMISECTION );
682 }
683 
684 bool
685 detail::ChainData::validateDataLocation(toolbox::mem::Reference* ref,
686  BitMasksForFaulty maskToUse)
687 {
688  I2O_PRIVATE_MESSAGE_FRAME *pvtMsg =
689  (I2O_PRIVATE_MESSAGE_FRAME*) ref->getDataLocation();
690  if (!pvtMsg)
691  {
692  faultyBits_ |= maskToUse;
693  return false;
694  }
695  return true;
696 }
697 
698 bool
699 detail::ChainData::validateMessageSize(toolbox::mem::Reference* ref,
700  BitMasksForFaulty maskToUse)
701 {
702  I2O_PRIVATE_MESSAGE_FRAME *pvtMsg =
703  (I2O_PRIVATE_MESSAGE_FRAME*) ref->getDataLocation();
704  if ((size_t)(pvtMsg->StdMessageFrame.MessageSize*4) <
706  {
707  faultyBits_ |= maskToUse;
708  return false;
709  }
710  return true;
711 }
712 
713 bool
715  BitMasksForFaulty maskToUse)
716 {
718  (I2O_SM_MULTIPART_MESSAGE_FRAME*) ref->getDataLocation();
719  if (smMsg->numFrames < 1 || smMsg->frameCount >= smMsg->numFrames)
720  {
721  faultyBits_ |= maskToUse;
722  return false;
723  }
724  return true;
725 }
726 
727 bool
729  BitMasksForFaulty maskToUse)
730 {
732  (I2O_SM_MULTIPART_MESSAGE_FRAME*) ref->getDataLocation();
733  if (smMsg->numFrames != expectedNumberOfFragments_)
734  {
735  faultyBits_ |= maskToUse;
736  return false;
737  }
738  return true;
739 }
740 
741 bool
742 detail::ChainData::validateFragmentOrder(toolbox::mem::Reference* ref,
743  int& indexValue)
744 {
745  int problemCount = 0;
747  (I2O_SM_MULTIPART_MESSAGE_FRAME*) ref->getDataLocation();
748  int thisIndex = static_cast<int>(smMsg->frameCount);
749  if (thisIndex == indexValue)
750  {
751  faultyBits_ |= DUPLICATE_FRAGMENT;
752  ++problemCount;
753  }
754  else if (thisIndex < indexValue)
755  {
756  faultyBits_ |= FRAGMENTS_OUT_OF_ORDER;
757  ++problemCount;
758  }
759  indexValue = thisIndex;
760  return (problemCount == 0);
761 }
762 
763 bool
764 detail::ChainData::validateMessageCode(toolbox::mem::Reference* ref,
765  unsigned short expectedI2OMessageCode)
766 {
767  I2O_PRIVATE_MESSAGE_FRAME *pvtMsg =
768  (I2O_PRIVATE_MESSAGE_FRAME*) ref->getDataLocation();
769  if (pvtMsg->XFunctionCode != expectedI2OMessageCode)
770  {
771  faultyBits_ |= CORRUPT_SECONDARY_HEADER;
772  return false;
773  }
774  return true;
775 }
776 
778 {
779  if ( !complete() || !headerOkay() ) return false;
780 
781  const uint32_t expected = adler32Checksum();
782  if (expected == 0) return false; // Adler32 not available
783 
784  const uint32_t calculated = calculateAdler32();
785 
786  if ( calculated != expected )
787  {
788  faultyBits_ |= WRONG_CHECKSUM;
789  return false;
790  }
791  return true;
792 }
793 
795 {
796  uint32_t adler = adler32(0L, 0, 0);
797 
798  toolbox::mem::Reference* curRef = ref_;
799 
801  (I2O_SM_MULTIPART_MESSAGE_FRAME*) curRef->getDataLocation();
802 
803  //skip event header in first fragment
804  const unsigned long headerSize = do_headerSize();
805  unsigned long offset = 0;
806 
807  const unsigned long payloadSize = curRef->getDataSize() - do_i2oFrameSize();
808  if ( headerSize > payloadSize )
809  {
810  // Header continues into next fragment
811  offset = headerSize - payloadSize;
812  }
813  else
814  {
815  const unsigned char* dataLocation =
816  do_fragmentLocation((unsigned char*)curRef->getDataLocation()) + headerSize;
817  adler = adler32(adler, dataLocation, smMsg->dataSize - headerSize);
818  }
819 
820  curRef = curRef->getNextReference();
821 
822  while (curRef)
823  {
824  smMsg = (I2O_SM_MULTIPART_MESSAGE_FRAME*) curRef->getDataLocation();
825 
826  const unsigned long payloadSize = curRef->getDataSize() - do_i2oFrameSize();
827  if ( offset > payloadSize )
828  {
829  offset -= payloadSize;
830  }
831  else
832  {
833  const unsigned char* dataLocation =
834  do_fragmentLocation((unsigned char*)curRef->getDataLocation()) + offset;
835  adler = adler32(adler, dataLocation, smMsg->dataSize - offset);
836  offset = 0;
837  }
838 
839  curRef = curRef->getNextReference();
840  }
841 
842  return adler;
843 }
844 
846 {
847  std::stringstream msg;
848  msg << "An output module ID is only available from a valid, ";
849  msg << "complete INIT or Event message.";
850  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
851 }
852 
854 {
855  std::stringstream msg;
856  msg << "An output module label is only available from a valid, ";
857  msg << "complete INIT message.";
858  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
859 }
860 
862 {
863  std::stringstream msg;
864  msg << "A top folder name is only available from a valid, ";
865  msg << "complete DQM event message.";
866  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
867 }
868 
870 {
871  std::stringstream msg;
872  msg << "The DQM key is only available from a valid, ";
873  msg << "complete DQM event message.";
874  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
875 }
876 
878 {
879  std::stringstream msg;
880  msg << "The HLT trigger names are only available from a valid, ";
881  msg << "complete INIT message.";
882  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
883 }
884 
886 {
887  std::stringstream msg;
888  msg << "The HLT trigger selections are only available from a valid, ";
889  msg << "complete INIT message.";
890  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
891 }
892 
894 {
895  std::stringstream msg;
896  msg << "The L1 trigger names are only available from a valid, ";
897  msg << "complete INIT message.";
898  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
899 }
900 
902 {
903  std::stringstream msg;
904  msg << "An HLT trigger count is only available from a valid, ";
905  msg << "complete Event message.";
906  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
907 }
908 
909 void
910 detail::ChainData::do_hltTriggerBits(std::vector<unsigned char>& bitList) const
911 {
912  std::stringstream msg;
913  msg << "The HLT trigger bits are only available from a valid, ";
914  msg << "complete Event message.";
915  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
916 }
917 
919 {
920  std::stringstream msg;
921  msg << "A run number is only available from a valid, ";
922  msg << "complete EVENT or ERROR_EVENT message.";
923  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
924 }
925 
927 {
928  std::stringstream msg;
929  msg << "A luminosity section is only available from a valid, ";
930  msg << "complete EVENT or ERROR_EVENT message.";
931  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
932 }
933 
935 {
936  std::stringstream msg;
937  msg << "An event number is only available from a valid, ";
938  msg << "complete EVENT or ERROR_EVENT message.";
939  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
940 }
941 
942 
TimePoint_t getCurrentTime()
Definition: Utils.h:158
virtual void do_hltTriggerSelections(Strings &nameList) const
Definition: ChainData.cc:885
bool validateFragmentIndexAndCount(toolbox::mem::Reference *ref, BitMasksForFaulty maskToUse)
Definition: ChainData.cc:714
size_t memoryUsed() const
Definition: ChainData.cc:391
unsigned char * dataLocation(int fragmentIndex) const
Definition: ChainData.cc:450
unsigned short i2oMessageCode_
Definition: ChainData.h:156
std::vector< StreamID > const & getStreamTags() const
Definition: ChainData.cc:664
virtual uint32_t do_lumiSection() const
Definition: ChainData.cc:926
unsigned long headerSize() const
Definition: ChainData.cc:533
uint32_t runNumber() const
Definition: ChainData.cc:629
unsigned char * headerLocation() const
Definition: ChainData.cc:538
virtual void do_l1TriggerNames(Strings &nameList) const
Definition: ChainData.cc:893
bool validateMessageSize(toolbox::mem::Reference *ref, BitMasksForFaulty maskToUse)
Definition: ChainData.cc:699
void hltTriggerNames(Strings &nameList) const
Definition: ChainData.cc:598
toolbox::mem::Reference * ref_
Definition: ChainData.h:150
std::vector< QueueID > QueueIDs
Definition: QueueID.h:80
std::vector< std::string > Strings
Definition: MsgTools.h:18
DQMKey dqmKey() const
Definition: ChainData.cc:593
unsigned long * getBufferData() const
Definition: ChainData.cc:366
#define min(a, b)
Definition: mlp_lapack.h:161
std::string hltURL() const
Definition: ChainData.cc:543
uint32_t adler32Checksum() const
Definition: ChainData.cc:644
std::vector< StreamID > streamTags_
Definition: ChainData.h:137
utils::TimePoint_t creationTime_
Definition: ChainData.h:141
void addFirstFragment(toolbox::mem::Reference *)
Definition: ChainData.cc:116
virtual uint32_t do_outputModuleId() const
Definition: ChainData.cc:845
void assertRunNumber(uint32_t runNumber)
Definition: ChainData.cc:624
uint32_t outputModuleId() const
Definition: ChainData.cc:577
virtual void do_hltTriggerNames(Strings &nameList) const
Definition: ChainData.cc:877
void addToChain(ChainData const &)
Definition: ChainData.cc:180
unsigned int getFragmentID(int fragmentIndex) const
Definition: ChainData.cc:469
unsigned int expectedNumberOfFragments_
Definition: ChainData.h:159
bool parsable() const
Definition: ChainData.cc:104
utils::TimePoint_t lastFragmentTime_
Definition: ChainData.h:142
bool validateDataLocation(toolbox::mem::Reference *ref, BitMasksForFaulty maskToUse)
Definition: ChainData.cc:685
virtual uint32_t do_eventNumber() const
Definition: ChainData.cc:934
ChainData(unsigned short i2oMessageCode=0x9999, unsigned int messageCode=Header::INVALID)
Definition: ChainData.cc:27
unsigned int copyFragmentsIntoBuffer(std::vector< unsigned char > &buff) const
Definition: ChainData.cc:490
void swap(ChainData &other)
Definition: ChainData.cc:373
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
#define INVALID
Definition: myFilter.cc:40
uint32_t eventNumber() const
Definition: ChainData.cc:639
bool validateExpectedFragmentCount(toolbox::mem::Reference *ref, BitMasksForFaulty maskToUse)
Definition: ChainData.cc:728
QueueIDs const & getEventConsumerTags() const
Definition: ChainData.cc:669
unsigned int faultyBits_
Definition: ChainData.h:153
bool isEndOfLumiSectionMessage() const
Definition: ChainData.cc:679
virtual void do_hltTriggerBits(std::vector< unsigned char > &bitList) const
Definition: ChainData.cc:910
unsigned int offset(bool)
utils::TimePoint_t creationTime() const
Definition: ChainData.h:83
uint32_t lumiSection() const
Definition: ChainData.cc:634
void hltTriggerSelections(Strings &nameList) const
Definition: ChainData.cc:603
virtual uint32_t do_hltTriggerCount() const
Definition: ChainData.cc:901
virtual DQMKey do_dqmKey() const
Definition: ChainData.cc:869
unsigned long totalDataSize() const
Definition: ChainData.cc:403
void tagForDQMEventConsumer(QueueID)
Definition: ChainData.cc:659
uint32_t hltTriggerCount() const
Definition: ChainData.cc:613
void tagForEventConsumer(QueueID)
Definition: ChainData.cc:654
size_t StreamID
Definition: StreamID.h:19
unsigned int fragmentCount_
Definition: ChainData.h:158
void hltTriggerBits(std::vector< unsigned char > &bitList) const
Definition: ChainData.cc:619
std::string topFolderName() const
Definition: ChainData.cc:588
bool complete() const
Definition: ChainData.cc:86
QueueIDs const & getDQMEventConsumerTags() const
Definition: ChainData.cc:674
uint32_t calculateAdler32() const
Definition: ChainData.cc:794
virtual std::string do_outputModuleLabel() const
Definition: ChainData.cc:853
bool validateMessageCode(toolbox::mem::Reference *ref, unsigned short expectedI2OMessageCode)
Definition: ChainData.cc:764
unsigned long dataSize(int fragmentIndex) const
Definition: ChainData.cc:427
bool faulty() const
Definition: ChainData.cc:91
QueueIDs eventConsumerTags_
Definition: ChainData.h:138
char hltURL[MAX_I2O_SM_URLCHARS]
Definition: i2oEvfMsgs.h:64
virtual std::string do_topFolderName() const
Definition: ChainData.cc:861
char hltClassName[MAX_I2O_SM_URLCHARS]
Definition: i2oEvfMsgs.h:65
void tagForStream(StreamID)
Definition: ChainData.cc:649
unsigned int messageCode_
Definition: ChainData.h:155
Signal rand(Signal arg)
Definition: vlib.cc:442
std::string hltClassName() const
Definition: ChainData.cc:560
#define MAX_I2O_SM_URLCHARS
Definition: i2oEvfMsgs.h:53
tuple cout
Definition: gather_cfg.py:41
bool headerOkay() const
Definition: ChainData.cc:111
virtual uint32_t do_runNumber() const
Definition: ChainData.cc:918
std::string outputModuleLabel() const
Definition: ChainData.cc:583
QueueIDs dqmEventConsumerTags_
Definition: ChainData.h:139
bool validateFragmentOrder(toolbox::mem::Reference *ref, int &indexValue)
Definition: ChainData.cc:742
tuple size
Write out results.
std::string className(const T &t)
Definition: ClassName.h:30
bool empty() const
Definition: ChainData.cc:81
unsigned int faultyBits() const
Definition: ChainData.cc:99
utils::TimePoint_t staleWindowStartTime_
Definition: ChainData.h:143
void l1TriggerNames(Strings &nameList) const
Definition: ChainData.cc:608