@@ -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,11 @@ 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+ }
305+
302306 }
303307 if (mDoDigits && !mDecodeInps ) {
304308 for (auto const & dig : digitsMap) {
@@ -615,13 +619,58 @@ int RawDataDecoder::shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digit
615619 }
616620 digits.push_back (dig.second );
617621 }
622+ int ret = 0 ;
618623 if (nTwoI) { // Trigger class wo Input
619624 LOG (error) << " LM:" << nLM << " L0:" << nL0 << " L1:" << nL1 << " TwI:" << nTwI << " Trigger classes wo input:" << nTwoI;
625+ ret = 64 ;
620626 }
621627 if (nTwoIlost) {
622628 LOG (warn) << " Trigger classes wo input from diff latency 1:" << nTwoIlost;
623629 }
624- return 0 ;
630+ return ret;
631+ }
632+ //
633+ int RawDataDecoder::checkReadoutConsistentncy (o2::pmr::vector<CTPDigit>& digits, uint64_t trgclassmask)
634+ {
635+ int ret = 0 ;
636+ int lost = 0 ;
637+ for (auto const & digit: digits) {
638+ // if class mask => inps
639+ for (int i = 0 ; i < digit.CTPClassMask .size (); i++){
640+ if (digit.CTPClassMask [i]){
641+ const CTPClass *cls = mCTPConfig .getCTPClassFromHWIndex (i);
642+ uint64_t clsinpmask = cls->descriptor ->getInputsMask ();
643+ uint64_t diginpmask = digit.CTPInputMask .to_ullong ();
644+ if (!((clsinpmask & diginpmask) == clsinpmask)) {
645+ LOG (error) << " CTP class:" << cls->name << " inpmask:" << clsinpmask << " not compatible with inputs mask:" << diginpmask;
646+ ret = 128 ;
647+ }
648+ }
649+ }
650+ // if inps => class mask
651+ for (auto const & cls: mCTPConfig .getCTPClasses ()) {
652+ uint64_t clsinpmask = cls.descriptor ->getInputsMask ();
653+ uint64_t diginpmask = digit.CTPInputMask .to_ullong ();
654+ uint64_t digclsmask = digit.CTPClassMask .to_ullong ();
655+ if ((clsinpmask & diginpmask) == clsinpmask) {
656+ if ((cls.classMask & digclsmask) == 0 ) {
657+ int32_t BCShiftCorrection = -o2::ctp::TriggerOffsetsParam::Instance ().customOffset [o2::detectors::DetID::CTP];
658+ int32_t offset = BCShiftCorrection + o2::ctp::TriggerOffsetsParam::Instance ().LM_L0 + o2::ctp::TriggerOffsetsParam::Instance ().L0_L1_classes - 1 ;
659+ offset = o2::constants::lhc::LHCMaxBunches - offset;
660+ if (digit.intRecord .bc < offset) {
661+ LOG (error) << " CTP class:" << cls.name << " inpmask:" << clsinpmask << " cls mask:" << cls.classMask << " not found in digit:" << digit;
662+ ret = 256 ;
663+ } else {
664+ lost++;
665+ }
666+ }
667+ }
668+ }
669+ }
670+ if (lost) {
671+ LOG (info) << " LOST classes because of shift:" << lost;
672+ }
673+ return ret;
625674}
626675//
627676int RawDataDecoder::setLumiInp (int lumiinp, std::string inp)
0 commit comments