Skip to content

Commit 1967d3d

Browse files
authored
Fix o2 compilation issue
1 parent 6523666 commit 1967d3d

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

PWGCF/TwoParticleCorrelations/DataModel/LongRangeDerived.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,33 +184,34 @@ inline float unPackSymmetric(const typename binningType::binned_t& b)
184184
namespace binning
185185
{
186186

187-
template <typename T, float Min, float Max>
187+
template <std::pair<float, float> lim, typename binVariable = int8_t>
188188
struct binningParent {
189189
public:
190-
using binned_t = T;
190+
typedef binVariable binned_t;
191191

192192
// Reserve two bins: one for overflow and one for underflow
193193
static constexpr int nbins = (1 << (8 * sizeof(binned_t))) - 2;
194194
static constexpr binned_t overflowBin = nbins;
195195
static constexpr binned_t underflowBin = -1;
196-
static constexpr float binned_min = static_cast<float>(Min);
197-
static constexpr float binned_max = static_cast<float>(Max);
196+
static constexpr float binned_min = lim.first;
197+
static constexpr float binned_max = lim.second;
198198
static constexpr float binned_center = 0.5 * (binned_min + binned_max);
199199
static constexpr float bin_width = (binned_max - binned_min) / static_cast<float>(nbins);
200200
static constexpr float inv_bin_width = 1. / bin_width;
201+
static_assert(binned_min < binned_max, "Invalid binning range");
201202
static void print()
202203
{
203204
LOG(info) << "Binning: " << binned_min << " - " << binned_max << " with " << nbins << " bins, width = "
204205
<< bin_width << ". Overflow bin " << static_cast<int>(overflowBin) << " Underflow bin " << static_cast<int>(underflowBin);
205206
}
206207
};
207208

208-
using trkdca_v0 = binningParent<int8_t, -2.0f, 2.0f>;
209-
using trkphi_v0 = binningParent<uint16_t, 0.0f, o2::constants::math::TwoPI>;
210-
using trkamp_v0 = binningParent<uint16_t, 0.0f, 5000.0f>;
211-
using trkpt_v0 = binningParent<uint16_t, 0.0f, 20.0f>;
212-
using trketa_v0 = binningParent<int16_t, -5.0f, 5.0f>;
213-
using trkchi2_v0 = binningParent<int8_t, 0.0f, 10.0f>;
209+
using trkdca_v0 = binningParent<std::pair<float, float>(-2.0f, 2.0f), int8_t>;
210+
using trkphi_v0 = binningParent<std::pair<float, float>(0.0f, o2::constants::math::TwoPI), uint16_t>;
211+
using trkamp_v0 = binningParent<std::pair<float, float>(0.0f, 5000.0f), uint16_t>;
212+
using trkpt_v0 = binningParent<std::pair<float, float>(0.0f, 10.0f), uint16_t>;
213+
using trketa_v0 = binningParent<std::pair<float, float>(-5.0f, 5.0f), int16_t>;
214+
using trkchi2_v0 = binningParent<std::pair<float, float>(0.0f, 10.0f), int8_t>;
214215

215216
using trkdca = trkdca_v0;
216217
using trkchi2 = trkchi2_v0;

0 commit comments

Comments
 (0)