@@ -79,13 +79,13 @@ int RawDataDecoder::addCTPDigit(uint32_t linkCRU, uint32_t orbit, gbtword80_t& d
7979 if (mErrorIR < mErrorMax ) {
8080 LOG (error) << " Two CTP IRs with the same timestamp:" << ir.bc << " " << ir.orbit << " pld:" << pld << " dig:" << digits[ir];
8181 }
82- ret = 2 ;
82+ ret = 4 ;
8383 mErrorIR ++;
8484 mStickyError = true ;
8585 }
8686 } else {
8787 LOG (error) << " Two digits with the same timestamp:" << ir.bc << " " << ir.orbit ;
88- ret = 2 ;
88+ ret = 8 ;
8989 }
9090 } else if (linkCRU == o2::ctp::GBTLinkIDClassRec) {
9191 int32_t BCShiftCorrection = -o2::ctp::TriggerOffsetsParam::Instance ().customOffset [o2::detectors::DetID::CTP];
@@ -113,11 +113,11 @@ int RawDataDecoder::addCTPDigit(uint32_t linkCRU, uint32_t orbit, gbtword80_t& d
113113 mStickyError = true ;
114114 }
115115 mErrorTCR ++;
116- ret = 3 ;
116+ ret = 16 ;
117117 }
118118 } else {
119119 LOG (error) << " Two digits with the same timestamp:" << ir.bc << " " << ir.orbit ;
120- ret = 3 ;
120+ ret = 32 ;
121121 }
122122 } else {
123123 LOG (error) << " Unxpected CTP CRU link:" << linkCRU;
@@ -298,7 +298,10 @@ int RawDataDecoder::decodeRaw(o2::framework::InputRecord& inputs, std::vector<o2
298298 trgclassmask = mCTPConfig .getTriggerClassMask ();
299299 }
300300 // std::cout << "trgclassmask:" << std::hex << trgclassmask << std::dec << std::endl;
301- shiftInputs (digitsMap, digits, mTFOrbit , trgclassmask);
301+ ret = shiftInputs (digitsMap, digits, mTFOrbit , trgclassmask);
302+ if (mCheckConsistency ) {
303+ ret = checkReadoutConsistentncy (digits, trgclassmask);
304+ }
302305 }
303306 if (mDoDigits && !mDecodeInps ) {
304307 for (auto const & dig : digitsMap) {
@@ -615,13 +618,58 @@ int RawDataDecoder::shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digit
615618 }
616619 digits.push_back (dig.second );
617620 }
621+ int ret = 0 ;
618622 if (nTwoI) { // Trigger class wo Input
619623 LOG (error) << " LM:" << nLM << " L0:" << nL0 << " L1:" << nL1 << " TwI:" << nTwI << " Trigger classes wo input:" << nTwoI;
624+ ret = 64 ;
620625 }
621626 if (nTwoIlost) {
622627 LOG (warn) << " Trigger classes wo input from diff latency 1:" << nTwoIlost;
623628 }
624- return 0 ;
629+ return ret;
630+ }
631+ //
632+ int RawDataDecoder::checkReadoutConsistentncy (o2::pmr::vector<CTPDigit>& digits, uint64_t trgclassmask)
633+ {
634+ int ret = 0 ;
635+ int lost = 0 ;
636+ for (auto const & digit : digits) {
637+ // if class mask => inps
638+ for (int i = 0 ; i < digit.CTPClassMask .size (); i++) {
639+ if (digit.CTPClassMask [i]) {
640+ const CTPClass* cls = mCTPConfig .getCTPClassFromHWIndex (i);
641+ uint64_t clsinpmask = cls->descriptor ->getInputsMask ();
642+ uint64_t diginpmask = digit.CTPInputMask .to_ullong ();
643+ if (!((clsinpmask & diginpmask) == clsinpmask)) {
644+ LOG (error) << " CTP class:" << cls->name << " inpmask:" << clsinpmask << " not compatible with inputs mask:" << diginpmask;
645+ ret = 128 ;
646+ }
647+ }
648+ }
649+ // if inps => class mask
650+ for (auto const & cls : mCTPConfig .getCTPClasses ()) {
651+ uint64_t clsinpmask = cls.descriptor ->getInputsMask ();
652+ uint64_t diginpmask = digit.CTPInputMask .to_ullong ();
653+ uint64_t digclsmask = digit.CTPClassMask .to_ullong ();
654+ if ((clsinpmask & diginpmask) == clsinpmask) {
655+ if ((cls.classMask & digclsmask) == 0 ) {
656+ int32_t BCShiftCorrection = -o2::ctp::TriggerOffsetsParam::Instance ().customOffset [o2::detectors::DetID::CTP];
657+ int32_t offset = BCShiftCorrection + o2::ctp::TriggerOffsetsParam::Instance ().LM_L0 + o2::ctp::TriggerOffsetsParam::Instance ().L0_L1_classes - 1 ;
658+ offset = o2::constants::lhc::LHCMaxBunches - offset;
659+ if (digit.intRecord .bc < offset) {
660+ LOG (error) << " CTP class:" << cls.name << " inpmask:" << clsinpmask << " cls mask:" << cls.classMask << " not found in digit:" << digit;
661+ ret = 256 ;
662+ } else {
663+ lost++;
664+ }
665+ }
666+ }
667+ }
668+ }
669+ if (lost) {
670+ LOG (info) << " LOST classes because of shift:" << lost;
671+ }
672+ return ret;
625673}
626674//
627675int RawDataDecoder::setLumiInp (int lumiinp, std::string inp)
0 commit comments