diff --git a/algo/detectors/sts/ReadoutConfig.cxx b/algo/detectors/sts/ReadoutConfig.cxx index dfec7cbcb2cbffc17d22ab11a5fee7f9e066e3b9..fa33f79c344aab481b78cd03be1ace84ed21ad39 100644 --- a/algo/detectors/sts/ReadoutConfig.cxx +++ b/algo/detectors/sts/ReadoutConfig.cxx @@ -61,6 +61,7 @@ void sts::ReadoutConfig::Init(const ReadoutSetup& config) const uint16_t numCrobPerComp = config.components.at(0).feb2module.size(); // Number of CROBs per component // const uint16_t numFebsPerCrob = config.components.at(0).feb2module.at(0).size(); // Number of FEBs per CROB const uint16_t numAsicsPerFeb = config.numAsicsPerFeb; // Number of ASICs per FEB + const uint16_t numAsicsPerMod = 2 * numAsicsPerFeb; // Number of ASICs per module const uint16_t numElinksPerCrob = config.elinks.size(); // Number of elinks per CROB // Constructing the map (equipmentId, eLink) -> (module, ASIC within module) @@ -93,8 +94,8 @@ void sts::ReadoutConfig::Init(const ReadoutSetup& config) int16_t febType = (moduleType == 0 ? moduleSide : !moduleSide); // 0 = FEB A, 1 = FEB B uint32_t asicIndex = (febType == 0 ? elink.toAsicFebA : elink.toAsicFebB); uint32_t asicInFeb = asicIndex % numAsicsPerFeb; // ASIC number within FEB - - asicInModule = (moduleSide == 1 ? asicInFeb : asicInFeb + numAsicsPerFeb); + // Asic number is counted downward from numAsicsPerMod - 1 for p side + asicInModule = (moduleSide == 1 ? asicInFeb : numAsicsPerMod - 1 - asicInFeb); } } fReadoutConfig[equipment][elinkIdx] = {moduleAddress, asicInModule, isPulser}; diff --git a/algo/detectors/sts/StsReadoutConfigLegacy.cxx b/algo/detectors/sts/StsReadoutConfigLegacy.cxx index 4802a74bc40ab606a753e820d6a6055bb7464296..1cd4078a5f860108e8e430db232bb7d918ca1012 100644 --- a/algo/detectors/sts/StsReadoutConfigLegacy.cxx +++ b/algo/detectors/sts/StsReadoutConfigLegacy.cxx @@ -79,6 +79,7 @@ namespace cbm::algo const uint16_t numCrobPerComp = 1; // Number of CROBs per component const uint16_t numFebsPerCrob = 5; // Number of FEBs per CROB const uint16_t numAsicsPerFeb = 8; // Number of ASICs per FEB + const uint16_t numAsicsPerMod = 16; // Number of ASICs per module const uint16_t numElinksPerCrob = 42; // Number of elinks per CROB // Equipment IDs for each component @@ -169,8 +170,8 @@ namespace cbm::algo 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 - - asicInModule = (moduleSide == 1 ? asicInFeb : asicInFeb + numAsicsPerFeb); + // Asic number is counted downward from numAsicsPerMod - 1 for p side + asicInModule = (moduleSide == 1 ? asicInFeb : numAsicsPerMod - 1 - asicInFeb); } } fReadoutMap[equipment][elink] = std::make_pair(moduleAddress, asicInModule); diff --git a/algo/detectors/sts/UnpackSts.cxx b/algo/detectors/sts/UnpackSts.cxx index f7d72fa3f73db5cb6ef8167df3709604c6da3a9b..ad1a586ac100d7af2590c86ea34e0b64be6437a9 100644 --- a/algo/detectors/sts/UnpackSts.cxx +++ b/algo/detectors/sts/UnpackSts.cxx @@ -105,15 +105,12 @@ namespace cbm::algo uint32_t asicNr = elinkPar.fAsicNr; // --- Hardware-to-software address - uint32_t numChansPerModule = fParams.fNumAsicsPerModule * fParams.fNumChansPerAsic; - uint32_t address = elinkPar.fAddress; - uint32_t channel = 0; - if (asicNr < fParams.fNumAsicsPerModule / 2) { // front side (n side) + uint32_t channel = 0; + if (asicNr < fParams.fNumAsicsPerModule / 2) { // front side (n side); channels counted upward channel = message.GetHitChannel() + fParams.fNumChansPerAsic * asicNr; } - else { // back side (p side) - channel = numChansPerModule - message.GetHitChannel() - - fParams.fNumChansPerAsic * (asicNr - fParams.fNumAsicsPerModule / 2) - 1; + else { // back side (p side); channels counted downward + channel = fParams.fNumChansPerAsic * (asicNr + 1) - message.GetHitChannel() - 1; } // --- Expand time stamp to time within timeslice (in clock cycle) @@ -132,7 +129,7 @@ namespace cbm::algo double charge = elinkPar.fAdcOffset + (message.GetHitAdc() - 1) * elinkPar.fAdcGain; // --- Create output digi - digiVec.emplace_back(address, channel, messageTime, charge); + digiVec.emplace_back(elinkPar.fAddress, channel, messageTime, charge); } // -------------------------------------------------------------------------- diff --git a/algo/detectors/sts/UnpackStsXpu.cxx b/algo/detectors/sts/UnpackStsXpu.cxx index 5339ccb56cd84e4ab3cbdffc3834fd3ed86524ce..bc62c0583967f7e1a45400488181a05af46b5d68 100644 --- a/algo/detectors/sts/UnpackStsXpu.cxx +++ b/algo/detectors/sts/UnpackStsXpu.cxx @@ -214,15 +214,12 @@ namespace cbm::algo uint32_t asicNr = elinkPar.fAsicNr; // --- Hardware-to-software address - uint32_t numChansPerModule = unpackPar.fNumAsicsPerModule * unpackPar.fNumChansPerAsic; - uint32_t address = elinkPar.fAddress; - uint32_t channel = 0; - if (asicNr < unpackPar.fNumAsicsPerModule / 2) { // front side (n side) + uint32_t channel = 0; + if (asicNr < unpackPar.fNumAsicsPerModule / 2) { // front side (n side); channels counted upward channel = message.GetHitChannel() + unpackPar.fNumChansPerAsic * asicNr; } - else { // back side (p side) - channel = numChansPerModule - message.GetHitChannel() - - unpackPar.fNumChansPerAsic * (asicNr - unpackPar.fNumAsicsPerModule / 2) - 1; + else { // back side (p side); channels counted downward + channel = unpackPar.fNumChansPerAsic * (asicNr + 1) - message.GetHitChannel() - 1; } // --- Expand time stamp to time within timeslice (in clock cycle) @@ -239,7 +236,7 @@ namespace cbm::algo double charge = elinkPar.fAdcOffset + (message.GetHitAdc() - 1) * elinkPar.fAdcGain; // --- Create output digi - digis[numDigis] = CbmStsDigi(address, channel, messageTime, charge); + digis[numDigis] = CbmStsDigi(elinkPar.fAddress, channel, messageTime, charge); numDigis++; } // -------------------------------------------------------------------------- diff --git a/algo/unpack/Unpack.cxx b/algo/unpack/Unpack.cxx index 8f2111e853aa72f3eebd9992ca6195d96ab504eb..b6c9b40d799b3909b7e13387954e03f8aceca2b4 100644 --- a/algo/unpack/Unpack.cxx +++ b/algo/unpack/Unpack.cxx @@ -168,13 +168,7 @@ namespace cbm::algo elinkPar.fTimeOffset = 0.; elinkPar.fAdcOffset = 1.; elinkPar.fAdcGain = 1.; - if (elinkPar.fAsicNr < numAsicsPerModuleSts / 2) { - elinkPar.fWalk = fStsConfig.WalkMap(elinkPar.fAddress, elinkPar.fAsicNr); - } - else { - elinkPar.fWalk = fStsConfig.WalkMap(elinkPar.fAddress, - numAsicsPerModuleSts - (elinkPar.fAsicNr - numAsicsPerModuleSts / 2) - 1); - } + elinkPar.fWalk = fStsConfig.WalkMap(elinkPar.fAddress, elinkPar.fAsicNr); // TODO: Add parameters for time and ADC calibration par->fElinkParams.push_back(elinkPar); }