diff --git a/algo/detectors/trd2d/ReadoutConfig.cxx b/algo/detectors/trd2d/ReadoutConfig.cxx index faeb1cb9cccdc9d2b8993549a60f0a9ee985db33..a65ca1e2c05b08085fe9ed80dcd1fb274f92ea95 100644 --- a/algo/detectors/trd2d/ReadoutConfig.cxx +++ b/algo/detectors/trd2d/ReadoutConfig.cxx @@ -119,7 +119,8 @@ namespace cbm::algo::trd2d // --- Initialise the mapping structure -------------------------------------------- void ReadoutSetup::InitChannelMap( - const std::map<size_t, std::map<size_t, std::map<size_t, std::tuple<int32_t, bool, int8_t, uint16_t>>>>& channelMap) + const std::map<size_t, std::map<size_t, std::map<size_t, std::tuple<int32_t, bool, int16_t, uint16_t>>>>& + channelMap) { // Constructing the map (equipId, asicId, chanId) -> (pad address, mask flag, daq offset) for (auto compMap : channelMap) { diff --git a/algo/detectors/trd2d/ReadoutConfig.h b/algo/detectors/trd2d/ReadoutConfig.h index fe590915be7554e24d0ff223e08b3a7e1aa3483f..673b55f876c9bcebd5ed15cd832a18b35882ffd4 100644 --- a/algo/detectors/trd2d/ReadoutConfig.h +++ b/algo/detectors/trd2d/ReadoutConfig.h @@ -116,7 +116,7 @@ namespace cbm::algo::trd2d /** @brief Initialisation of channel map **/ void InitChannelMap( - const std::map<size_t, std::map<size_t, std::map<size_t, std::tuple<int32_t, bool, int8_t, uint16_t>>>>& + const std::map<size_t, std::map<size_t, std::map<size_t, std::tuple<int32_t, bool, int16_t, uint16_t>>>>& channelMap); /** @brief Get system time offset **/ @@ -149,8 +149,8 @@ namespace cbm::algo::trd2d public: struct ChanNoise { - uint8_t tDelay; /// time [clk] delay wrt to causing primary signal - uint8_t tWindow; /// time [clk] window to search for noisy signal + uint16_t tDelay; /// time [clk] delay wrt to causing primary signal + uint16_t tWindow; /// time [clk] window to search for noisy signal uint16_t lDThres; /// Threshold [ADU] for dynamic channel noise uint16_t lSThres; /// threshold [ADU] for static channel noise (happens independently) diff --git a/algo/detectors/trd2d/UnpackMS.cxx b/algo/detectors/trd2d/UnpackMS.cxx index 64060dd3fbc4806518b03543b42392a864f9affc..b143ea98cbd904037deace010190a169ee2ce220 100644 --- a/algo/detectors/trd2d/UnpackMS.cxx +++ b/algo/detectors/trd2d/UnpackMS.cxx @@ -499,7 +499,7 @@ namespace cbm::algo::trd2d double r, t; int32_t dt; const int32_t dtime = id.GetTime() - lTime; - bool use(false); + bool use(false), noise(false); if (abs(dtime) < 5) { // test message part of (last) digi r = id.GetCharge(t, dt); if (lchR && r < 0.1) { // set R charge on an empty slot @@ -513,8 +513,20 @@ namespace cbm::algo::trd2d } } + // check if signal can be flagged as dynamic noise + if (!use && calPar.noise.tWindow > 0) { + if (lchR) { + if (lchR < calPar.noise.lThreshold && std::abs(-dtime * 12.5 - calPar.noise.tDelay) < calPar.noise.tWindow) + noise = true; + } + else { + if (lchT < calPar.noise.lThreshold && std::abs(-dtime * 12.5 - calPar.noise.tDelay) < calPar.noise.tWindow) + noise = true; + } + } + // build digi for message when update failed - if (!use) { + if (!use && !noise) { digiBuffer.emplace_back(pad, lchT, lchR, lTime); digiBuffer.back().SetAddressModule(fParams.fModId); } diff --git a/algo/detectors/trd2d/UnpackMS.h b/algo/detectors/trd2d/UnpackMS.h index 7989bdd1771d8619005dec551517ae402be40ab9..9696671b6ad792e4da97a19987d68770354d65c9 100644 --- a/algo/detectors/trd2d/UnpackMS.h +++ b/algo/detectors/trd2d/UnpackMS.h @@ -138,8 +138,8 @@ namespace cbm::algo::trd2d ** @brief TRD2D noise parameters for one Asic channel **/ struct NoiseChannelPar { - uint8_t tDelay = 0; /// time [clk] delay wrt to causing primary signal - uint8_t tWindow = 0; /// time [clk] window to search for noisy signal + uint16_t tDelay = 0; /// time [clk] delay wrt to causing primary signal + uint16_t tWindow = 0; /// time [clk] window to search for noisy signal uint16_t lThreshold = 0; ///< Signal threshold for induced - dynamic noise uint16_t fSignalThres = 0; ///< Signal threshold for independent - static noise }; diff --git a/reco/tasks/CbmTaskTrdUnpackParWrite.cxx b/reco/tasks/CbmTaskTrdUnpackParWrite.cxx index 92e14baf53ac9549651669391b09bb7c27fb6f43..6679dc59958d92b6a44e010ad992276a813e980f 100644 --- a/reco/tasks/CbmTaskTrdUnpackParWrite.cxx +++ b/reco/tasks/CbmTaskTrdUnpackParWrite.cxx @@ -39,7 +39,7 @@ InitStatus CbmTaskTrdUnpackParWrite::Init() // Map (moduleId) -> (array of crobId) std::map<uint32_t, std::vector<uint16_t>> crobMap; // Map (equipId, asicId, chanId) -> (pad address, mask flag, daq offset [FASP clk]) - std::map<size_t, std::map<size_t, std::map<size_t, std::tuple<int32_t, bool, int8_t, uint16_t>>>> channelMap; + std::map<size_t, std::map<size_t, std::map<size_t, std::tuple<int32_t, bool, int16_t, uint16_t>>>> channelMap; // Loop through a list of module IDs from the .digi file (can in principle contradict crob_map). for (auto entry : digiparset.GetModuleMap()) {