diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.cxx b/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.cxx index 126f5ad9954572b84b1d6fede177c21eeb4866bd..188bffb546b1988f58d706ea48e9c58efdd1b284 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.cxx +++ b/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.cxx @@ -43,10 +43,7 @@ CbmTrdUnpackFaspAlgo::CbmTrdFaspMessage::CbmTrdFaspMessage(uint8_t c, uint8_t ty { } -CbmTrdUnpackFaspAlgo::CbmTrdUnpackFaspAlgo() - : CbmRecoUnpackAlgo("CbmTrdUnpackFaspAlgo") -{ -} +CbmTrdUnpackFaspAlgo::CbmTrdUnpackFaspAlgo() : CbmRecoUnpackAlgo("CbmTrdUnpackFaspAlgo") {} //_________________________________________________________________________________ CbmTrdUnpackFaspAlgo::~CbmTrdUnpackFaspAlgo() {} @@ -223,12 +220,10 @@ void CbmTrdUnpackFaspAlgo::mess_prt(CbmTrdFaspMessage* mess) bool CbmTrdUnpackFaspAlgo::pushDigis(std::vector<CbmTrdUnpackFaspAlgo::CbmTrdFaspMessage> messes) { UChar_t lFasp(0xff); - UShort_t lchR, lchT; Double_t r, t; - Int_t dt, dtime, ch, pad; - ULong64_t lTime, tdaqOffset(0); + Int_t dt; + ULong64_t tdaqOffset(0); CbmTrdParFasp* faspPar(nullptr); - const CbmTrdParFaspChannel* chCalib(nullptr); CbmTrdParModDigi* digiPar(nullptr); for (auto imess : messes) { @@ -247,30 +242,22 @@ bool CbmTrdUnpackFaspAlgo::pushDigis(std::vector<CbmTrdUnpackFaspAlgo::CbmTrdFas // TODO temporary add DAQ time calibration for FASPRO. // Should be absorbed in the ASIC parameter definition if (digiPar->GetPadRow(faspPar->GetPadAddress(imess.ch)) % 2 == 0) tdaqOffset = 3; - - if (VERBOSE) faspPar->Print(); } - if (VERBOSE) mess_prt(&imess); - - pad = faspPar->GetPadAddress(imess.ch); - chCalib = faspPar->GetChannel(imess.ch); - ch = 2 * pad + chCalib->HasPairingR(); - lTime = fTime + tdaqOffset + imess.tlab; - lchR = 0; - lchT = 0; + + Int_t pad = faspPar->GetPadAddress(imess.ch); + const CbmTrdParFaspChannel* chCalib = faspPar->GetChannel(imess.ch); + ULong64_t lTime = fTime + tdaqOffset + imess.tlab; + UShort_t lchR = 0; + UShort_t lchT = 0; if (chCalib->HasPairingR()) lchR = imess.data; else lchT = imess.data; - if (VERBOSE) - printf("fasp[%2d] ch[%4d / %2d] pad[%4d] row[%2d] col[%2d] %c[%4d]\n", lFasp, ch, imess.ch, pad, - digiPar->GetPadRow(pad), digiPar->GetPadColumn(pad), (chCalib->HasPairingT() ? 'T' : 'R'), - lchT > 0 ? lchT : lchR); if (fDigiBuffer[fCrob][pad].size()) { // check if last digi has both R/T message components. Update if not and is within time window auto id = fDigiBuffer[fCrob][pad].rbegin(); // Should always be valid here. // No need to extra check - dtime = (*id).GetTimeDAQ() - lTime; + Int_t dtime = (*id).GetTimeDAQ() - lTime; bool use(false); if (TMath::Abs(dtime) < 5) { // test message part of (last) digi r = (*id).GetCharge(t, dt); @@ -374,13 +361,9 @@ void CbmTrdUnpackFaspAlgo::FinalizeComponent() // ---- unpack ---- bool CbmTrdUnpackFaspAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp, UInt_t imslice) { - if (VERBOSE) printf("CbmTrdUnpackFaspAlgo::unpack 0x%04x %d\n", icomp, imslice); - // LOG(info) << "Component " << icomp << " connected to config CbmTrdUnpackConfig2D. Slice "<<imslice; - uint8_t crob_id = 0; uint16_t eq_id; - bool unpackOk = true; - //Double_t fdMsSizeInNs = 1.28e6; + bool unpackOk = true; auto msdesc = ts->descriptor(icomp, imslice); // Cast required to silence a warning on macos (there a uint64_t is a llu) @@ -401,18 +384,12 @@ bool CbmTrdUnpackFaspAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp // buffer module configuration if (fMod == 0xffff || fMod != mod_id) { fMod = mod_id; - if (!init()) { - LOG(error) << GetName() << "::unpack - init mod_id=" << mod_id << " failed."; - return false; - } + if (!init()) { return false; } } mapped = true; break; } - if (!mapped) { - LOG(error) << GetName() << "::unpack - CROB eq_id=" << eq_id << " not registered in the unpacker."; - return false; - } + if (!mapped) { return false; } if (fCrob == 0xffff) fCrob = icomp; // Get the µslice size in bytes to calculate the number of completed words @@ -432,33 +409,18 @@ bool CbmTrdUnpackFaspAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp UChar_t lFaspOld(0xff); vector<CbmTrdFaspMessage> vMess; for (uint64_t j = 0; j < nwords; j++, wd++) { - // // Select the appropriate conversion type of the word according to the message type - // switch(mess_type(*wd)){ - // case CbmTrdFaspMessageType::kData: - // mess_readDW(*wd, &mess); - // break; - // case CbmTrdFaspMessageType::kEpoch: - // mess_readEW(*wd, &mess); - // break; - // } uint32_t w = *wd; uint8_t ch_id = w & 0xf; uint8_t isaux = (w >> 4) & 0x1; uint8_t slice = (w >> 5) & 0x7f; uint16_t data = (w >> 12) & 0x3fff; - uint32_t epoch = (w >> 5) & 0x1fffff; uint8_t fasp_id = ((w >> 26) & 0x3f) + crob_id * NFASPCROB; - // std::cout<<"fasp_id="<<static_cast<unsigned int>(fasp_id)<<" ch_id="<<static_cast<unsigned int>(ch_id)<<" isaux="<<static_cast<unsigned int>(isaux)<<std::endl; if (isaux) { if (!ch_id) { // clear buffer if (vMess.size()) { pushDigis(vMess); } vMess.clear(); - if (VERBOSE) - cout << boost::format(" EE : fasp_id=%02d ch_id=%02d epoch=%03d\n") % static_cast<unsigned int>(fasp_id) - % static_cast<unsigned int>(ch_id) % static_cast<unsigned int>(epoch); - lFaspOld = 0xff; fTime += FASP_EPOCH_LENGTH; } @@ -475,21 +437,10 @@ bool CbmTrdUnpackFaspAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp vMess.clear(); lFaspOld = fasp_id; } - if (data & 0x1) { - LOG(warn) << GetName() << "::unpack - Data corrupted : detect end bit set."; - continue; - } - if (VERBOSE) - cout << boost::format(" DD : fasp_id=%02d ch_id=%02d slice=%03d data=%4d\n") - % static_cast<unsigned int>(fasp_id) % static_cast<unsigned int>(ch_id) - % static_cast<unsigned int>(slice) % static_cast<unsigned int>(data >> 1); - if (data & 0x2000) { - LOG(debug) << GetName() << "::unpack - Self-triggered data."; - data &= 0x1fff; - } + if (data & 0x1) { continue; } + if (data & 0x2000) { data &= 0x1fff; } vMess.emplace_back(ch_id, kData, slice, data >> 1, crob_id, lFaspOld); } - //prt_wd(*wd); } return unpackOk; }