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.17 2011/03/08 16:01:50 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 do_droppedEventsCount();
682 }
683 
685 {
686  do_setDroppedEventsCount(count);
687 }
688 
690 {
691  return ( i2oMessageCode_ == I2O_EVM_LUMISECTION );
692 }
693 
694 bool
695 detail::ChainData::validateDataLocation(toolbox::mem::Reference* ref,
696  BitMasksForFaulty maskToUse)
697 {
698  I2O_PRIVATE_MESSAGE_FRAME *pvtMsg =
699  (I2O_PRIVATE_MESSAGE_FRAME*) ref->getDataLocation();
700  if (!pvtMsg)
701  {
702  faultyBits_ |= maskToUse;
703  return false;
704  }
705  return true;
706 }
707 
708 bool
709 detail::ChainData::validateMessageSize(toolbox::mem::Reference* ref,
710  BitMasksForFaulty maskToUse)
711 {
712  I2O_PRIVATE_MESSAGE_FRAME *pvtMsg =
713  (I2O_PRIVATE_MESSAGE_FRAME*) ref->getDataLocation();
714  if ((size_t)(pvtMsg->StdMessageFrame.MessageSize*4) <
716  {
717  faultyBits_ |= maskToUse;
718  return false;
719  }
720  return true;
721 }
722 
723 bool
725  BitMasksForFaulty maskToUse)
726 {
728  (I2O_SM_MULTIPART_MESSAGE_FRAME*) ref->getDataLocation();
729  if (smMsg->numFrames < 1 || smMsg->frameCount >= smMsg->numFrames)
730  {
731  faultyBits_ |= maskToUse;
732  return false;
733  }
734  return true;
735 }
736 
737 bool
739  BitMasksForFaulty maskToUse)
740 {
742  (I2O_SM_MULTIPART_MESSAGE_FRAME*) ref->getDataLocation();
743  if (smMsg->numFrames != expectedNumberOfFragments_)
744  {
745  faultyBits_ |= maskToUse;
746  return false;
747  }
748  return true;
749 }
750 
751 bool
752 detail::ChainData::validateFragmentOrder(toolbox::mem::Reference* ref,
753  int& indexValue)
754 {
755  int problemCount = 0;
757  (I2O_SM_MULTIPART_MESSAGE_FRAME*) ref->getDataLocation();
758  int thisIndex = static_cast<int>(smMsg->frameCount);
759  if (thisIndex == indexValue)
760  {
761  faultyBits_ |= DUPLICATE_FRAGMENT;
762  ++problemCount;
763  }
764  else if (thisIndex < indexValue)
765  {
766  faultyBits_ |= FRAGMENTS_OUT_OF_ORDER;
767  ++problemCount;
768  }
769  indexValue = thisIndex;
770  return (problemCount == 0);
771 }
772 
773 bool
774 detail::ChainData::validateMessageCode(toolbox::mem::Reference* ref,
775  unsigned short expectedI2OMessageCode)
776 {
777  I2O_PRIVATE_MESSAGE_FRAME *pvtMsg =
778  (I2O_PRIVATE_MESSAGE_FRAME*) ref->getDataLocation();
779  if (pvtMsg->XFunctionCode != expectedI2OMessageCode)
780  {
781  faultyBits_ |= CORRUPT_SECONDARY_HEADER;
782  return false;
783  }
784  return true;
785 }
786 
788 {
789  if ( !complete() || !headerOkay() ) return false;
790 
791  const uint32_t expected = adler32Checksum();
792  if (expected == 0) return false; // Adler32 not available
793 
794  const uint32_t calculated = calculateAdler32();
795 
796  if ( calculated != expected )
797  {
798  faultyBits_ |= WRONG_CHECKSUM;
799  return false;
800  }
801  return true;
802 }
803 
805 {
806  uint32_t adler = adler32(0L, 0, 0);
807 
808  toolbox::mem::Reference* curRef = ref_;
809 
811  (I2O_SM_MULTIPART_MESSAGE_FRAME*) curRef->getDataLocation();
812 
813  //skip event header in first fragment
814  const unsigned long headerSize = do_headerSize();
815  unsigned long offset = 0;
816 
817  const unsigned long payloadSize = curRef->getDataSize() - do_i2oFrameSize();
818  if ( headerSize > payloadSize )
819  {
820  // Header continues into next fragment
821  offset = headerSize - payloadSize;
822  }
823  else
824  {
825  const unsigned char* dataLocation =
826  do_fragmentLocation((unsigned char*)curRef->getDataLocation()) + headerSize;
827  adler = adler32(adler, dataLocation, smMsg->dataSize - headerSize);
828  }
829 
830  curRef = curRef->getNextReference();
831 
832  while (curRef)
833  {
834  smMsg = (I2O_SM_MULTIPART_MESSAGE_FRAME*) curRef->getDataLocation();
835 
836  const unsigned long payloadSize = curRef->getDataSize() - do_i2oFrameSize();
837  if ( offset > payloadSize )
838  {
839  offset -= payloadSize;
840  }
841  else
842  {
843  const unsigned char* dataLocation =
844  do_fragmentLocation((unsigned char*)curRef->getDataLocation()) + offset;
845  adler = adler32(adler, dataLocation, smMsg->dataSize - offset);
846  offset = 0;
847  }
848 
849  curRef = curRef->getNextReference();
850  }
851 
852  return adler;
853 }
854 
856 {
857  std::stringstream msg;
858  msg << "An output module ID is only available from a valid, ";
859  msg << "complete INIT or Event message.";
860  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
861 }
862 
864 {
865  std::stringstream msg;
866  msg << "An output module label is only available from a valid, ";
867  msg << "complete INIT message.";
868  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
869 }
870 
872 {
873  std::stringstream msg;
874  msg << "A top folder name is only available from a valid, ";
875  msg << "complete DQM event message.";
876  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
877 }
878 
880 {
881  std::stringstream msg;
882  msg << "The DQM key is only available from a valid, ";
883  msg << "complete DQM event message.";
884  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
885 }
886 
888 {
889  std::stringstream msg;
890  msg << "The HLT trigger names are only available from a valid, ";
891  msg << "complete INIT message.";
892  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
893 }
894 
896 {
897  std::stringstream msg;
898  msg << "The HLT trigger selections are only available from a valid, ";
899  msg << "complete INIT message.";
900  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
901 }
902 
904 {
905  std::stringstream msg;
906  msg << "The L1 trigger names are only available from a valid, ";
907  msg << "complete INIT message.";
908  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
909 }
910 
912 {
913  std::stringstream msg;
914  msg << "An HLT trigger count is only available from a valid, ";
915  msg << "complete Event message.";
916  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
917 }
918 
919 void
920 detail::ChainData::do_hltTriggerBits(std::vector<unsigned char>& bitList) const
921 {
922  std::stringstream msg;
923  msg << "The HLT trigger bits are only available from a valid, ";
924  msg << "complete Event message.";
925  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
926 }
927 
928 unsigned int
930 {
931  std::stringstream msg;
932  msg << "Dropped events count can only be retrieved from a valid, ";
933  msg << "complete Event message.";
934  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
935 }
936 
937 void
939 {
940  std::stringstream msg;
941  msg << "Dropped events count can only be added to a valid, ";
942  msg << "complete Event message.";
943  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
944 }
945 
947 {
948  std::stringstream msg;
949  msg << "A run number is only available from a valid, ";
950  msg << "complete EVENT or ERROR_EVENT message.";
951  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
952 }
953 
955 {
956  std::stringstream msg;
957  msg << "A luminosity section is only available from a valid, ";
958  msg << "complete EVENT or ERROR_EVENT message.";
959  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
960 }
961 
963 {
964  std::stringstream msg;
965  msg << "An event number is only available from a valid, ";
966  msg << "complete EVENT or ERROR_EVENT message.";
967  XCEPT_RAISE(stor::exception::WrongI2OMessageType, msg.str());
968 }
969 
970 
TimePoint_t getCurrentTime()
Definition: Utils.h:158
virtual void do_hltTriggerSelections(Strings &nameList) const
Definition: ChainData.cc:895
bool validateFragmentIndexAndCount(toolbox::mem::Reference *ref, BitMasksForFaulty maskToUse)
Definition: ChainData.cc:724
size_t memoryUsed() const
Definition: ChainData.cc:391
unsigned char * dataLocation(int fragmentIndex) const
Definition: ChainData.cc:450
unsigned short i2oMessageCode_
Definition: ChainData.h:158
std::vector< StreamID > const & getStreamTags() const
Definition: ChainData.cc:664
virtual uint32_t do_lumiSection() const
Definition: ChainData.cc:954
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:903
bool validateMessageSize(toolbox::mem::Reference *ref, BitMasksForFaulty maskToUse)
Definition: ChainData.cc:709
void hltTriggerNames(Strings &nameList) const
Definition: ChainData.cc:598
toolbox::mem::Reference * ref_
Definition: ChainData.h:152
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:139
utils::TimePoint_t creationTime_
Definition: ChainData.h:143
void addFirstFragment(toolbox::mem::Reference *)
Definition: ChainData.cc:116
virtual uint32_t do_outputModuleId() const
Definition: ChainData.cc:855
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:887
void addToChain(ChainData const &)
Definition: ChainData.cc:180
unsigned int getFragmentID(int fragmentIndex) const
Definition: ChainData.cc:469
unsigned int expectedNumberOfFragments_
Definition: ChainData.h:161
bool parsable() const
Definition: ChainData.cc:104
void setDroppedEventsCount(unsigned int)
Definition: ChainData.cc:684
utils::TimePoint_t lastFragmentTime_
Definition: ChainData.h:144
bool validateDataLocation(toolbox::mem::Reference *ref, BitMasksForFaulty maskToUse)
Definition: ChainData.cc:695
virtual uint32_t do_eventNumber() const
Definition: ChainData.cc:962
ChainData(unsigned short i2oMessageCode=0x9999, unsigned int messageCode=Header::INVALID)
Definition: ChainData.cc:27
virtual unsigned int do_droppedEventsCount() const
Definition: ChainData.cc:929
unsigned int copyFragmentsIntoBuffer(std::vector< unsigned char > &buff) const
Definition: ChainData.cc:490
void swap(ChainData &other)
Definition: ChainData.cc:373
virtual void do_setDroppedEventsCount(unsigned int)
Definition: ChainData.cc:938
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:738
QueueIDs const & getEventConsumerTags() const
Definition: ChainData.cc:669
unsigned int faultyBits_
Definition: ChainData.h:155
bool isEndOfLumiSectionMessage() const
Definition: ChainData.cc:689
virtual void do_hltTriggerBits(std::vector< unsigned char > &bitList) const
Definition: ChainData.cc:920
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:911
virtual DQMKey do_dqmKey() const
Definition: ChainData.cc:879
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:160
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:804
virtual std::string do_outputModuleLabel() const
Definition: ChainData.cc:863
bool validateMessageCode(toolbox::mem::Reference *ref, unsigned short expectedI2OMessageCode)
Definition: ChainData.cc:774
unsigned long dataSize(int fragmentIndex) const
Definition: ChainData.cc:427
bool faulty() const
Definition: ChainData.cc:91
unsigned int droppedEventsCount() const
Definition: ChainData.cc:679
QueueIDs eventConsumerTags_
Definition: ChainData.h:140
char hltURL[MAX_I2O_SM_URLCHARS]
Definition: i2oEvfMsgs.h:64
virtual std::string do_topFolderName() const
Definition: ChainData.cc:871
char hltClassName[MAX_I2O_SM_URLCHARS]
Definition: i2oEvfMsgs.h:65
void tagForStream(StreamID)
Definition: ChainData.cc:649
unsigned int messageCode_
Definition: ChainData.h:157
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:946
std::string outputModuleLabel() const
Definition: ChainData.cc:583
QueueIDs dqmEventConsumerTags_
Definition: ChainData.h:141
bool validateFragmentOrder(toolbox::mem::Reference *ref, int &indexValue)
Definition: ChainData.cc:752
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:145
void l1TriggerNames(Strings &nameList) const
Definition: ChainData.cc:608