Skip to content

Commit 62a384b

Browse files
authored
Merge pull request #21 from alibuild/alibot-cleanup-13178
Please consider the following formatting changes to #13178
2 parents c075eb0 + 7d479b9 commit 62a384b

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

PWGLF/DataModel/LFResonanceTables.h

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -351,21 +351,26 @@ struct PidNSigma {
351351
/// @brief Encode 0.2 sigma interval to 0~10 range
352352
static uint8_t encodeNSigma(float nSigma)
353353
{
354-
const float x = std::abs(nSigma);
355-
if (x <= 1.5) return 0; // Return 0 when absolute nSigma is smaller than 1.5
356-
float t = (x - 1.5) / 0.2;
357-
int encoded = static_cast<int>(std::ceil(t)); // (1.5,1.7]->1, ..., (3.3,3.5]->10
358-
if (encoded < 1) encoded = 1;
359-
if (encoded > 10) encoded = 10;
360-
return static_cast<uint8_t>(encoded);
354+
const float x = std::abs(nSigma);
355+
if (x <= 1.5)
356+
return 0; // Return 0 when absolute nSigma is smaller than 1.5
357+
float t = (x - 1.5) / 0.2;
358+
int encoded = static_cast<int>(std::ceil(t)); // (1.5,1.7]->1, ..., (3.3,3.5]->10
359+
if (encoded < 1)
360+
encoded = 1;
361+
if (encoded > 10)
362+
encoded = 10;
363+
return static_cast<uint8_t>(encoded);
361364
}
362365

363366
/// @brief Decode 0~10 value to original 1.5~3.5 sigma range
364367
static float decodeNSigma(uint8_t encoded)
365368
{
366-
if (encoded == 0) return 1.5;
367-
if (encoded > 10) encoded = 10;
368-
return 1.5 + static_cast<float>(encoded) * 0.2;
369+
if (encoded == 0)
370+
return 1.5;
371+
if (encoded > 10)
372+
encoded = 10;
373+
return 1.5 + static_cast<float>(encoded) * 0.2;
369374
}
370375

371376
/// @brief Check if TOF info is available
@@ -424,12 +429,15 @@ struct ResoMicroTrackSelFlag {
424429
/// @brief Convert DCA to 1~15 steps (|DCA|<0.1 is saved in 0)
425430
static uint8_t encodeDCA(float DCA)
426431
{
427-
float x = std::fabs(DCA);
428-
if (x < 0.1) return 0;
429-
int encoded = static_cast<int>(std::ceil((x - 0.1) / 0.1)); // (0.1, 0.2] -> 1, ..., (1.4, 1.5] -> 14
430-
if (encoded < 1) encoded = 1;
431-
if (encoded > 14) encoded = 15;
432-
return static_cast<uint8_t>(encoded);
432+
float x = std::fabs(DCA);
433+
if (x < 0.1)
434+
return 0;
435+
int encoded = static_cast<int>(std::ceil((x - 0.1) / 0.1)); // (0.1, 0.2] -> 1, ..., (1.4, 1.5] -> 14
436+
if (encoded < 1)
437+
encoded = 1;
438+
if (encoded > 14)
439+
encoded = 15;
440+
return static_cast<uint8_t>(encoded);
433441
}
434442

435443
/// @brief Operator to convert to `uint8_t` (for SOA storage)

0 commit comments

Comments
 (0)