From 7b96ee1a1454051bc1dacbc5dce0a93905c7cee5 Mon Sep 17 00:00:00 2001 From: Alexandru Bercuci <abercuci@niham.nipne.ro> Date: Fri, 12 May 2023 09:14:10 +0300 Subject: [PATCH] remove FASP to Module geo mapping. Moved internally to the generation of ASIC pars. This is to propagate the correct mapping for all levels of data processing (unpack, monitor, reco, tracking) --- core/detectors/trd/CbmTrdParFasp.cxx | 6 ++-- .../trd/unpack/CbmTrdUnpackFaspAlgo.cxx | 34 ++----------------- .../trd/unpack/CbmTrdUnpackFaspAlgo.h | 7 ++-- .../trd/unpack/CbmTrdUnpackFaspConfig.cxx | 10 +----- .../trd/unpack/CbmTrdUnpackFaspConfig.h | 6 ---- 5 files changed, 9 insertions(+), 54 deletions(-) diff --git a/core/detectors/trd/CbmTrdParFasp.cxx b/core/detectors/trd/CbmTrdParFasp.cxx index 2889db58d2..1583ec3da9 100644 --- a/core/detectors/trd/CbmTrdParFasp.cxx +++ b/core/detectors/trd/CbmTrdParFasp.cxx @@ -48,12 +48,12 @@ bool CbmTrdParFasp::IsChannelMasked(int ch_address) const //___________________________________________________________________ void CbmTrdParFasp::LoadParams(FairParamList* l) { - printf("CbmTrdParFasp::LoadParams(FairParamList*)\n"); + // printf("CbmTrdParFasp::LoadParams(FairParamList*)\n"); TArrayI value(NFASPCH); if (l->fill(Form("%dCHS", fAddress), &value)) { for (Int_t ich(0); ich < NFASPCH; ich++) { Int_t pair = ich % 2; - printf(" ch[%2d] pair[%d] value[%d] ChAddress=%d\n", ich, pair, value[ich], 2 * value[ich] + pair); + // printf(" ch[%2d] pair[%d] value[%d] ChAddress=%d\n", ich, pair, value[ich], 2 * value[ich] + pair); SetChannelAddress(2 * value[ich] + pair); fCalib[ich].SetPairing(pair); } @@ -72,7 +72,7 @@ void CbmTrdParFasp::LoadParams(FairParamList* l) //___________________________________________________________________ void CbmTrdParFasp::LoadParams(int* valArray) { - printf("CbmTrdParFasp::LoadParams(%d)\n", fAddress); + // printf("CbmTrdParFasp::LoadParams(%d)\n", fAddress); int offset(0); SetChannelMask(valArray[offset++]); for (Int_t ich(0); ich < NFASPCH; ich++) { diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.cxx b/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.cxx index 7bd65e2e4e..9b0dd3273b 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.cxx +++ b/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.cxx @@ -127,16 +127,6 @@ CbmTrdUnpackFaspAlgo::GetParContainerRequest(std::string geoTag, std::uint32_t r return &fParContVec; } -//_________________________________________________________________________________ -void CbmTrdUnpackFaspAlgo::SetAsicMapping(const std::map<uint32_t, uint8_t[NFASPMOD]>& asicMap) -{ - if (!fFaspMap) fFaspMap = new std::map<uint32_t, uint8_t[NFASPMOD]>(asicMap); - else { - delete fFaspMap; - fFaspMap = new std::map<uint32_t, uint8_t[NFASPMOD]>(asicMap); - } -} - //_________________________________________________________________________________ void CbmTrdUnpackFaspAlgo::SetCrobMapping(const std::map<uint32_t, uint16_t[NCROBMOD]>& map) { @@ -152,25 +142,6 @@ void CbmTrdUnpackFaspAlgo::SetCrobMapping(const std::map<uint32_t, uint16_t[NCRO } } -//_________________________________________________________________________________ -void CbmTrdUnpackFaspAlgo::PrintAsicMapping() -{ - if (!fFaspMap) { - LOG(info) << GetName() << "No asic mapping loaded."; - return; - } - LOG(info) << GetName() << "Fasp Asic mapping on modules:"; - for (auto imod : (*fFaspMap)) { - printf("Mod [%6d] :", imod.first); - for (int ifasp(0); ifasp < NFASPMOD; ifasp++) { - if (ifasp % 9 == 0) printf("\n"); - int jfasp = imod.second[ifasp]; - printf("%3d ", (jfasp == 0xff ? -1 : jfasp)); - } - printf("\n"); - } -} - //_________________________________________________________________________________ CbmTrdUnpackFaspAlgo::CbmTrdFaspMessageType CbmTrdUnpackFaspAlgo::mess_type(uint32_t wd) { @@ -251,6 +222,9 @@ bool CbmTrdUnpackFaspAlgo::pushDigis(std::vector<CbmTrdUnpackFaspAlgo::CbmTrdFas for (auto imess : messes) { const Int_t pad = faspPar->GetPadAddress(imess.ch); const CbmTrdParFaspChannel* chCalib = faspPar->GetChannel(imess.ch); + if (chCalib->IsMasked()) { + LOG(warn) << GetName() << "::pushDigis - FASP par " << mod_id * 1000 + lFasp << " ch " << int(imess.ch) << " masked but have data. Masks need attention."; + } const ULong64_t lTime = fTime + tdaqOffset + imess.tlab; const UShort_t lchR = chCalib->HasPairingR() ? imess.data : 0; const UShort_t lchT = chCalib->HasPairingR() ? 0 : imess.data; @@ -449,8 +423,6 @@ bool CbmTrdUnpackFaspAlgo::unpack(const fles::Timeslice* ts, std::uint16_t icomp continue; } - if (fFaspMap) fasp_id = ((*fFaspMap)[mod_id])[fasp_id]; - if (lFaspOld != fasp_id) { // push if (vMess.size()) { pushDigis(vMess, mod_id); } diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.h b/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.h index 7ace5f1405..bff7160f9d 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.h +++ b/reco/detectors/trd/unpack/CbmTrdUnpackFaspAlgo.h @@ -100,7 +100,8 @@ public: uint8_t crob = 0; ///< CROB id in the module uint8_t fasp = 0; ///< FASP id in the module }; - + /** Access the asic parameter list, read-only*/ + virtual const CbmTrdParSetAsic* GetAsicPar() const { return &fAsicPar; } /** * @brief Get the requested parameter containers. * Return the required parameter containers together with the paths to the ascii @@ -112,10 +113,7 @@ public: */ virtual std::vector<std::pair<std::string, std::shared_ptr<FairParGenericSet>>>* GetParContainerRequest(std::string geoTag, std::uint32_t runId); - void PrintAsicMapping(); - /** @brief Introduce fasp index mapping*/ - void SetAsicMapping(const std::map<uint32_t, uint8_t[NFASPMOD]>& map); /** @brief Initialize CROB mapping for all modules*/ void SetCrobMapping(const std::map<uint32_t, uint16_t[NCROBMOD]>& map); /** @brief Set a predefined monitor @@ -202,7 +200,6 @@ protected: private: void prt_wd(uint32_t w); - std::map<uint32_t, uint8_t[NFASPMOD]>* fFaspMap = nullptr; ///> FASP mapping update wrt the default setting std::map<uint16_t, std::pair<uint16_t, uint16_t>>* fCompMap = nullptr; ///> Map eq_id -> (mod_id, crob_id) std::array<std::vector<CbmTrdDigi>, NFASPMOD* NFASPCH> fDigiBuffer = { {}}; ///> Buffered digi for each pad in CROB component diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackFaspConfig.cxx b/reco/detectors/trd/unpack/CbmTrdUnpackFaspConfig.cxx index 9220aeef74..61bee84553 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackFaspConfig.cxx +++ b/reco/detectors/trd/unpack/CbmTrdUnpackFaspConfig.cxx @@ -6,7 +6,6 @@ CbmTrdUnpackFaspConfig::CbmTrdUnpackFaspConfig(std::string detGeoSetupTag, UInt_t runid) : CbmRecoUnpackConfig("CbmTrdUnpackFaspConfig", detGeoSetupTag, runid) - , fFaspMap() { } @@ -43,9 +42,7 @@ void CbmTrdUnpackFaspConfig::reset() void CbmTrdUnpackFaspConfig::InitAlgo() { if (fDoLog) LOG(info) << fName << "::InitAlgo - Setup Fasp mapping"; - fAlgo->SetAsicMapping(fFaspMap); fAlgo->SetCrobMapping(fCrobMap); - /*if (fDoLog) */ fAlgo->PrintAsicMapping(); // If we have a monitor in the config add it to the algo if (fMonitor) fAlgo->SetMonitor(fMonitor); @@ -57,15 +54,10 @@ void CbmTrdUnpackFaspConfig::InitAlgo() if (fMonitor) { /*if (fDoLog)*/ LOG(info) << fName << "::InitAlgo - Setup monitoring task"; fMonitor->Init(); + fMonitor->MapMaskedChannels(fAlgo->GetAsicPar()); } } -//_____________________________________________________________________ -void CbmTrdUnpackFaspConfig::SetFaspMapping(int modAddress, uint8_t faspMap[NFASPMOD]) -{ - memcpy(fFaspMap[modAddress], faspMap, NFASPMOD * sizeof(uint8_t)); -} - //_____________________________________________________________________ void CbmTrdUnpackFaspConfig::SetCrobMapping(int modAddress, uint16_t crobMap[NCROBMOD]) { diff --git a/reco/detectors/trd/unpack/CbmTrdUnpackFaspConfig.h b/reco/detectors/trd/unpack/CbmTrdUnpackFaspConfig.h index bd3888642a..c113962944 100644 --- a/reco/detectors/trd/unpack/CbmTrdUnpackFaspConfig.h +++ b/reco/detectors/trd/unpack/CbmTrdUnpackFaspConfig.h @@ -64,11 +64,6 @@ public: /** @brief Initialize the algorithm, include all calibration for Trd FASP.*/ void InitAlgo(); - /** @brief define fasp mapping for each module - * @param modAddress module address according to geometry - * @param faspMap mapped ids of FASP ASICs for module - */ - void SetFaspMapping(int modAddress, uint8_t faspMap[NFASPMOD]); /** @brief define crob id mapping for each module * @param modAddress module address according to geometry * @param crobMap mapped ids of CROBs eq_id for module @@ -91,7 +86,6 @@ protected: virtual void reset(); private: - std::map<uint32_t, uint8_t[NFASPMOD]> fFaspMap; ///> Module address to FASP id mapping std::map<uint32_t, uint16_t[NCROBMOD]> fCrobMap; ///> Module address to CROB id mapping /** @brief pointer to the monitor object */ std::shared_ptr<CbmTrdUnpackFaspMonitor> fMonitor = nullptr; -- GitLab