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