From 5d675a0fdaa4920dfb4bb2708cbd6a15a0e08ca8 Mon Sep 17 00:00:00 2001 From: Volker Friese <v.friese@gsi.de> Date: Sat, 5 Mar 2022 08:15:50 +0100 Subject: [PATCH] Added missing include (cassert); removed duplicated code from the task which was implmeneted in the separate class StsReadoutConfig. --- algo/detectors/sts/StsReadoutConfig.cxx | 1 + macro/reco/reco_unpack.C | 4 +- reco/tasks/CbmTaskUnpack.cxx | 133 ------------------------ reco/tasks/CbmTaskUnpack.h | 10 -- 4 files changed, 3 insertions(+), 145 deletions(-) diff --git a/algo/detectors/sts/StsReadoutConfig.cxx b/algo/detectors/sts/StsReadoutConfig.cxx index 4a2c74655d..c9f808a7f0 100644 --- a/algo/detectors/sts/StsReadoutConfig.cxx +++ b/algo/detectors/sts/StsReadoutConfig.cxx @@ -6,6 +6,7 @@ #include "CbmStsAddress.h" +#include <cassert> #include <iomanip> using std::pair; diff --git a/macro/reco/reco_unpack.C b/macro/reco/reco_unpack.C index 8e9af23753..84638a1cf6 100644 --- a/macro/reco/reco_unpack.C +++ b/macro/reco/reco_unpack.C @@ -39,8 +39,8 @@ void reco_unpack(TString tsaFile = "", TString outFile = "") // In general, the following parts need not be touched // ======================================================================== - //tsaFile = "/Users/vfriese/Cbmroot/data/1588_node8_1_0000"; Used for testing - //outFile = "test"; + tsaFile = "/Users/vfriese/Cbmroot/data/1588_node8_1_0000"; + outFile = "test"; // ----- Default file names --------------------------------------------- if (tsaFile.IsNull()) tsaFile = srcDir + "/input/mcbm_run399_first20Ts"; diff --git a/reco/tasks/CbmTaskUnpack.cxx b/reco/tasks/CbmTaskUnpack.cxx index 4927255e38..32a6c7693b 100644 --- a/reco/tasks/CbmTaskUnpack.cxx +++ b/reco/tasks/CbmTaskUnpack.cxx @@ -138,7 +138,6 @@ void CbmTaskUnpack::Exec(Option_t*) // ----- End-of-run action ------------------------------------------------ void CbmTaskUnpack::Finish() { - std::cout << std::endl; LOG(info) << "====================================="; LOG(info) << GetName() << ": Run summary"; @@ -221,136 +220,4 @@ InitStatus CbmTaskUnpack::Init() // ---------------------------------------------------------------------------- -// ----- Set the STS readout configuration -------------------------------- -void CbmTaskUnpack::InitStsConfig() -{ - - // This here refers to the mCBM 2021 setup. (from macro/beamtime/mcbm2021/mStsPar.par) - // I have to confess that this is among the weirdest things I ever came across. - - // Constants - const uint16_t numModules = 13; // Number of modules in the setup - const uint16_t numElinksPerCrob = 42; // Number of elinks per CROB - const uint16_t numAsicsPerFeb = 8; // Number of ASICs per FEB - - // Module addresses and types - // Type 0 means connector at the right side, type 1 has connector at the left - int32_t modAddress[numModules]; - modAddress[0] = 0x10008002; - modAddress[1] = 0x10018002; - modAddress[2] = 0x10008402; - modAddress[3] = 0x10018402; - modAddress[4] = 0x10107C02; - modAddress[5] = 0x10008412; - modAddress[6] = 0x10018412; - modAddress[7] = 0x101FFC02; - modAddress[8] = 0x10008012; - modAddress[9] = 0x10018012; - modAddress[10] = 0x10008812; - modAddress[11] = 0x10018812; - modAddress[12] = 0x10028812; - bool modType[numModules] = {0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1}; - - // Mapping of eLink to ASIC for FEB A - const uint32_t elink2AsicFebA[numElinksPerCrob] = { - 0x0021, 0x0023, 0x0025, 0x0020, 0x0022, 0x0018, 0x001A, 0x001C, 0x0024, 0x0027, 0xFFFF, 0xFFFF, 0x0026, 0x001E, - 0x0010, 0x0012, 0x0019, 0x001B, 0x001F, 0x000E, 0x0011, 0x0013, 0x000C, 0x0015, 0x0017, 0x0016, 0x001D, 0x0014, - 0x0009, 0x000D, 0x000F, 0x0008, 0x000A, 0x0002, 0x0004, 0x0006, 0x000B, 0x0005, 0x0000, 0x0003, 0x0007, 0x0001, - }; - - // Mapping of eLink to ASIC for FEB B - const uint32_t elink2AsicFebB[numElinksPerCrob] = { - 0x0027, 0x0025, 0x0023, 0x0026, 0x0024, 0x001E, 0x001C, 0x001A, 0x0022, 0x0021, 0xFFFF, 0xFFFF, 0x0020, 0x0018, - 0x0016, 0x0014, 0x001F, 0x001D, 0x0019, 0x0008, 0x0017, 0x0015, 0x000A, 0x0013, 0x0011, 0x0010, 0x001B, 0x0012, - 0x000F, 0x000B, 0x0009, 0x000E, 0x000C, 0x0004, 0x0002, 0x0000, 0x000D, 0x0003, 0x0006, 0x0005, 0x0001, 0x0007}; - - // Mapping of eLink to FEB number within CROB. If -1, elink not used. - const int16_t elink2Feb[numElinksPerCrob] = {4, 4, 4, 4, 4, 3, 3, 3, 4, 4, -1, -1, 4, 3, 2, 2, 3, 3, 3, 1, 2, - 2, 1, 2, 2, 2, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0}; - - - // The readout hierarchy is: DPB (component) - CROB - FEB - const uint16_t numComp = 5; // Number of components - const uint16_t numCrob = 1; // Number of CROBs per component - const uint16_t numFebs = 5; // FEBs per CROB - - // Mapping of component to equipment ID - uint16_t eqId[numComp] = {0x1003, 0x1002, 0x1006, 0x1005, 0x1004}; - - // Mapping of FEB to module index (-1 = inactive) - int16_t feb2module[numComp][numCrob][numFebs] = { - {{-1, 1, 1, 0, 0}}, // component 0 - {{4, 3, 3, 2, 2}}, // component 1 - {{7, 6, 6, 5, 5}}, // component 2 - {{10, 9, 9, 8, 8}}, // component 3 - {{12, 12, 11, 11, 10}} // component 4 - }; - - // Mapping of FEB to module side (0 = p side, 1 = n side, -1 = inactive) - int16_t feb2moduleSide[numComp][numCrob][numFebs] = { - {{-1, 1, 0, 1, 0}}, // component 0 - {{1, 1, 0, 1, 0}}, // component 1 - {{1, 1, 0, 1, 0}}, // component 2 - {{0, 1, 0, 1, 0}}, // component 3 - {{1, 0, 1, 0, 1}} // component 4 - }; - - // Map (component, CROB, eLink) -> (module, ASIC within module) - LOG(info) << "STS readout mapping: "; - for (uint16_t comp = 0; comp < numComp; comp++) { - uint16_t equipment = eqId[comp]; - for (uint16_t crob = 0; crob < numCrob; crob++) { - for (uint16_t elink = 0; elink < numElinksPerCrob; elink++) { - - int32_t moduleAddress = -1; - uint16_t asicInModule = 0; - - uint16_t elinkId = numElinksPerCrob * crob + elink; // elink within component - int16_t feb = elink2Feb[elinkId]; // FEB within CROB - if (feb != -1) { - int16_t module = feb2module[comp][crob][feb]; // Module index - if (module != -1) { - assert(module < numModules); - bool moduleType = modType[module]; // 0 or 1 - int16_t moduleSide = feb2moduleSide[comp][crob][feb]; // 0 or 1, -1 is inactive - int16_t febType = (moduleType == 0 ? moduleSide : !moduleSide); // 0 = FEB A, 1 = FEB B - uint32_t asicIndex = (febType == 0 ? elink2AsicFebA[elinkId] : elink2AsicFebB[elinkId]); - uint32_t asicInFeb = asicIndex % numAsicsPerFeb; // ASIC number within FEB - - moduleAddress = modAddress[module]; - asicInModule = (moduleSide == 0 ? asicInFeb : asicInFeb + numAsicsPerFeb); - } - } - fStsMap[equipment][elink] = std::make_pair(moduleAddress, asicInModule); - - } //# elink - } //# CROB - } //# component -} -// ---------------------------------------------------------------------------- - - -// ----- Print readout map ------------------------------------------------ -std::string CbmTaskUnpack::PrintReadoutMap() -{ - - std::stringstream ss; - for (auto& stsComp : fStsMap) { - for (auto& stsElink : stsComp.second) { - auto comp = stsComp.first; - auto elink = stsElink.first; - auto address = stsElink.second.first; - auto asic = stsElink.second.second; - ss << "\n Component " << comp << " elink " << setw(2) << elink; - ss << " ASIC " << setw(2) << asic << " module " << address; - ss << " Unit " << setw(2) << CbmStsAddress::GetElementId(address, kStsUnit); - ss << " Ladd " << setw(2) << CbmStsAddress::GetElementId(address, kStsLadder); - ss << " Hlad " << setw(2) << CbmStsAddress::GetElementId(address, kStsHalfLadder); - ss << " Modu " << setw(2) << CbmStsAddress::GetElementId(address, kStsModule); - } //# elink - } //# component - return ss.str(); -} -// ---------------------------------------------------------------------------- - ClassImp(CbmTaskUnpack) diff --git a/reco/tasks/CbmTaskUnpack.h b/reco/tasks/CbmTaskUnpack.h index 5a673735fc..12c9e2fa31 100644 --- a/reco/tasks/CbmTaskUnpack.h +++ b/reco/tasks/CbmTaskUnpack.h @@ -66,9 +66,6 @@ private: // methods virtual InitStatus Init(); - void InitStsConfig(); - - private: // members CbmSourceTs* fSource = nullptr; std::vector<cbm::algo::UnpackSts> fAlgoSts = {}; //! @@ -79,13 +76,6 @@ private: // members double fTime = 0.; CbmDigiTimeslice* fTimeslice = nullptr; ///< Output data - // --- STS readout configuration; temporary in this class, will be moved later. - // --- Map index: (component, elink), map value: (module address, ASIC number in module - std::map<uint16_t, std::map<uint16_t, std::pair<int32_t, uint16_t>>> fStsMap = {}; //! - -private: // methods - std::string PrintReadoutMap(); - ClassDef(CbmTaskUnpack, 1); }; -- GitLab