diff --git a/PWGLF/DataModel/LFResonanceTables.h b/PWGLF/DataModel/LFResonanceTables.h index 0ecde07c23e..b8f60a6fc7a 100644 --- a/PWGLF/DataModel/LFResonanceTables.h +++ b/PWGLF/DataModel/LFResonanceTables.h @@ -351,21 +351,26 @@ struct PidNSigma { /// @brief Encode 0.2 sigma interval to 0~10 range static uint8_t encodeNSigma(float nSigma) { - const float x = std::abs(nSigma); - if (x <= 1.5) return 0; // Return 0 when absolute nSigma is smaller than 1.5 - float t = (x - 1.5) / 0.2; - int encoded = static_cast(std::ceil(t)); // (1.5,1.7]->1, ..., (3.3,3.5]->10 - if (encoded < 1) encoded = 1; - if (encoded > 10) encoded = 10; - return static_cast(encoded); + const float x = std::abs(nSigma); + if (x <= 1.5) + return 0; // Return 0 when absolute nSigma is smaller than 1.5 + float t = (x - 1.5) / 0.2; + int encoded = static_cast(std::ceil(t)); // (1.5,1.7]->1, ..., (3.3,3.5]->10 + if (encoded < 1) + encoded = 1; + if (encoded > 10) + encoded = 10; + return static_cast(encoded); } /// @brief Decode 0~10 value to original 1.5~3.5 sigma range static float decodeNSigma(uint8_t encoded) { - if (encoded == 0) return 1.5; - if (encoded > 10) encoded = 10; - return 1.5 + static_cast(encoded) * 0.2; + if (encoded == 0) + return 1.5; + if (encoded > 10) + encoded = 10; + return 1.5 + static_cast(encoded) * 0.2; } /// @brief Check if TOF info is available @@ -424,12 +429,15 @@ struct ResoMicroTrackSelFlag { /// @brief Convert DCA to 1~15 steps (|DCA|<0.1 is saved in 0) static uint8_t encodeDCA(float DCA) { - float x = std::fabs(DCA); - if (x < 0.1) return 0; - int encoded = static_cast(std::ceil((x - 0.1) / 0.1)); // (0.1, 0.2] -> 1, ..., (1.4, 1.5] -> 14 - if (encoded < 1) encoded = 1; - if (encoded > 14) encoded = 15; - return static_cast(encoded); + float x = std::fabs(DCA); + if (x < 0.1) + return 0; + int encoded = static_cast(std::ceil((x - 0.1) / 0.1)); // (0.1, 0.2] -> 1, ..., (1.4, 1.5] -> 14 + if (encoded < 1) + encoded = 1; + if (encoded > 14) + encoded = 15; + return static_cast(encoded); } /// @brief Operator to convert to `uint8_t` (for SOA storage)