diff --git a/algo/detectors/sts/StsReadoutConfigLegacy.cxx b/algo/detectors/sts/StsReadoutConfigLegacy.cxx index 12ff10f26548b8f3d9486fa75b9d185da1dd9c18..3f16d49dbc4e3e3539639d94136b366a5fccb93b 100644 --- a/algo/detectors/sts/StsReadoutConfigLegacy.cxx +++ b/algo/detectors/sts/StsReadoutConfigLegacy.cxx @@ -149,6 +149,9 @@ namespace cbm::algo std::map<size_t, std::unordered_set<uint16_t>> maskedchans = BuildMaskSet(); + // map from feb ID to adc cut + std::map<size_t, uint32_t> febAdcCuts = {{1, 1}, {2, 1}, {3, 1}, {4, 1}}; + // Constructing the map (equipmentId, eLink) -> (module, ASIC within module) uint16_t numElinksPerComp = numCrobPerComp * numElinksPerCrob; for (uint16_t comp = 0; comp < numComp; comp++) { @@ -191,6 +194,10 @@ namespace cbm::algo } } } + + // Set min adc cut + auto febIt = febAdcCuts.find(febId); + if (febIt != febAdcCuts.end()) { fAdcCutMap[equipment][elink] = febIt->second; } } } fReadoutMap[equipment][elink] = std::make_pair(moduleAddress, asicInModule); @@ -244,6 +251,21 @@ namespace cbm::algo // ------------------------------------------------------------------------------------ + // --- Mapping (equimentId, elink) -> adc cut --------------------------------------- + uint32_t StsReadoutConfigLegacy::AdcCutMap(uint16_t equipmentId, uint16_t elinkId) + { + uint32_t result = 0; + auto equipIter = fAdcCutMap.find(equipmentId); + if (equipIter != fAdcCutMap.end()) { + auto elinkMap = equipIter->second; + auto elinkIter = elinkMap.find(elinkId); + if (elinkIter != elinkMap.end()) { result = elinkIter->second; } + } + return result; + } + // ------------------------------------------------------------------------------------ + + // ----- Print readout map ------------------------------------------------ std::string StsReadoutConfigLegacy::PrintReadoutMap() { diff --git a/algo/detectors/sts/StsReadoutConfigLegacy.h b/algo/detectors/sts/StsReadoutConfigLegacy.h index 932e25b55f17d3639d2f80265154368dc94ce1b7..6691ff01fbb0061df24416d2b213abea0917370b 100644 --- a/algo/detectors/sts/StsReadoutConfigLegacy.h +++ b/algo/detectors/sts/StsReadoutConfigLegacy.h @@ -74,6 +74,7 @@ namespace cbm::algo */ std::vector<double> WalkMap(int32_t modAddress, uint16_t asic); + /** @brief API: Mapping from component and elink to address and ASIC number ** @param equipId Equipment identifier (component) ** @param elink Elink number within component @@ -82,6 +83,14 @@ namespace cbm::algo std::pair<int32_t, uint16_t> Map(uint16_t equipId, uint16_t elink); + /** @brief API: Mapping from component and elink to minimum adc cut + ** @param equipId Equipment identifier (component) + ** @param elink Elink number within component + ** @return adc cut + */ + uint32_t AdcCutMap(uint16_t equipId, uint16_t elink); + + /** @brief Debug output of readout map **/ std::string PrintReadoutMap(); @@ -95,10 +104,14 @@ namespace cbm::algo // --- Map index: (module address, ASIC number in module, ADC value), map value: (walk coefficient) std::map<int32_t, std::vector<std::vector<double>>> fWalkMap; - // --- STS channel mask map + // --- STS channel mask map // --- Map index: (equipment, elink), map value: (vector of mask flags for channels per asic) std::map<uint16_t, std::map<size_t, std::vector<bool>>> fMaskMap = {}; //! + // --- STS adc cut map + // --- Map index: (equipment, elink), map value: adc cut + std::map<uint16_t, std::map<size_t, uint32_t>> fAdcCutMap = {}; //! + /** @brief Initialisation of readout map **/ void Init(); diff --git a/algo/detectors/sts/UnpackSts.cxx b/algo/detectors/sts/UnpackSts.cxx index 7ceb4cca1abbb7b9845ef888535061920685ed7d..c340d932ca9bdce1fca04952b3226211b9e16848 100644 --- a/algo/detectors/sts/UnpackSts.cxx +++ b/algo/detectors/sts/UnpackSts.cxx @@ -108,6 +108,9 @@ namespace cbm::algo const UnpackStsElinkPar& elinkPar = fParams.fElinkParams.at(elink); uint32_t asicNr = elinkPar.fAsicNr; + // --- Check minimum adc cut + if (message.GetHitAdc() <= elinkPar.fAdcMinCut) { return; } + // --- Check for masked channel if (!elinkPar.fChanMask.empty() && elinkPar.fChanMask[message.GetHitChannel()] == true) { return; } diff --git a/algo/detectors/sts/UnpackSts.h b/algo/detectors/sts/UnpackSts.h index 0be3abda746250c9fe495e6e817d2293daf04b0c..63183224071933c8c6e124a595b71a70d02fcc8c 100644 --- a/algo/detectors/sts/UnpackSts.h +++ b/algo/detectors/sts/UnpackSts.h @@ -34,6 +34,7 @@ namespace cbm::algo uint64_t fTimeOffset = 0.; ///< Time calibration parameter double fAdcOffset = 0.; ///< Charge calibration parameter double fAdcGain = 0.; ///< Charge calibration parameter + uint32_t fAdcMinCut = 0.; ///< Minimum Acd cut std::vector<double> fWalk; ///< Walk correction coefficients std::vector<bool> fChanMask; ///< Channel masking flags }; @@ -137,8 +138,8 @@ namespace cbm::algo void ProcessTsmsbMessage(const stsxyter::Message& message, TimeSpec& time) const; - private: // members - UnpackStsPar fParams = {}; ///< Parameter container + private: // members + UnpackStsPar fParams = {}; ///< Parameter container /** Number of TS_MSB epochs per cycle **/ static constexpr uint64_t fkEpochsPerCycle = stsxyter::kuTsMsbNbTsBinsBinning; diff --git a/algo/unpack/Unpack.cxx b/algo/unpack/Unpack.cxx index 2ee774e3600edfeefea8eb1ad3812af41b6be835..98543ee91fa21f6f41665ad4312235e273bad266 100644 --- a/algo/unpack/Unpack.cxx +++ b/algo/unpack/Unpack.cxx @@ -250,6 +250,7 @@ namespace cbm::algo elinkPar.fAddress = mapEntry.first; // Module address for this elink elinkPar.fAsicNr = mapEntry.second; // ASIC number within module elinkPar.fTimeOffset = fSystemTimeOffset[Subsystem::STS]; + elinkPar.fAdcMinCut = fStsConfig.AdcCutMap(equip, elink); elinkPar.fAdcOffset = 1.; elinkPar.fAdcGain = 1.; if (fApplyWalkCorrection) elinkPar.fWalk = fStsConfig.WalkMap(elinkPar.fAddress, elinkPar.fAsicNr);