1 #ifndef RecoTracker_MkFitCore_interface_binnor_h
2 #define RecoTracker_MkFitCore_interface_binnor_h
21 template <
typename R,
typename I,
unsigned M,
unsigned N>
23 static_assert(M >=
N);
28 static constexpr
unsigned c_M = M;
29 static constexpr
unsigned c_N =
N;
74 template <
typename R,
typename I,
unsigned M,
unsigned N>
76 static constexpr
unsigned c_M_end = 1 << M;
89 template <
typename R,
typename I,
unsigned M,
unsigned N>
112 template <
typename R,
typename I,
unsigned M,
unsigned N>
119 template <
typename R,
typename I,
unsigned M = 8 * sizeof(I),
unsigned N = 8 * sizeof(I)>
129 R extent = max -
min;
130 unsigned n_bins =
std::ceil(extent / bin_width);
131 R extra = (n_bins * bin_width - extent) / 2;
133 axis(min - extra, max + extra, n_bins);
157 template <
typename C,
typename A1,
typename A2,
unsigned NB_first = 8 * sizeof(C),
unsigned NB_count = 8 * sizeof(C)>
159 static_assert(std::is_same<typename A1::real_t, typename A2::real_t>());
160 static_assert(A1::c_M + A2::c_M <= 32);
162 static constexpr
unsigned int c_A1_mask = (1 << A1::c_M) - 1;
163 static constexpr
unsigned int c_A2_Mout_mask = ~(((1 << A2::c_M2N_shift) - 1) << A1::c_M);
200 return {
m_a1.from_M_bin_to_N_bin(m_bin.
bin1()),
m_a2.from_M_bin_to_N_bin(m_bin.
bin2())};
203 B_pair get_n_bin(
typename A1::index_t n1,
typename A2::index_t n2)
const {
return {n1, n2}; }
206 return {
m_a1.from_R_to_N_bin(r1),
m_a2.from_R_to_N_bin(r2)};
232 m_cons.push_back({
m_a1.from_R_to_M_bin(r1),
m_a2.from_R_to_M_bin(r2)});
236 m_cons.push_back({
m_a1.from_R_to_M_bin_safe(r1),
m_a2.from_R_to_M_bin_safe(r2)});
255 if (c_bin.
count == 0)
constexpr int32_t ceil(float num)
I from_R_to_M_bin(R r) const
const unsigned m_num_M_bins
C_pair get_content(typename A1::real_t r1, typename A2::real_t r2) const
axis(R min, R max, R bin_width)
const edm::EventSetup & c
static constexpr unsigned c_M_end
I from_R_to_N_bin_safe(R r) const
I from_M_bin_to_N_bin(I m) const
C_pair get_content(typename A1::index_t n1, typename A2::index_t n2) const
static constexpr unsigned c_M
unsigned size_of_M() const
I next_N_bin(I bin) const
axis_base(R min, R max, unsigned M_size, unsigned N_size)
I_pair from_R_minmax_to_N_bins(R rmin, R rmax) const
unsigned size_of_M() const
axis_base< R, I, M, N >::I_pair from_R_rdr_to_N_bins(R r, R dr) const
axis_pow2_base(R min, R max)
std::vector< B_pair > m_cons
std::vector< C_pair > m_bins
unsigned int mask_A2_M_bins() const
unsigned size_of_N() const
void finalize_registration()
void register_entry(typename A1::real_t r1, typename A2::real_t r2)
axis_pow2_u1(R min, R max)
axis_base< R, I, M, N >::I_pair from_R_minmax_to_N_bins(R rmin, R rmax) const
I_pair from_R_rdr_to_N_bins(R r, R dr) const
binnor(const A1 &a1, const A2 &a2)
static constexpr unsigned c_N_end
void register_entry_safe(typename A1::real_t r1, typename A2::real_t r2)
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
C_pair get_content(B_pair n_bin) const
const std::complex< double > I
void register_m_bins(typename A1::index_t m1, typename A2::index_t m2)
void begin_registration(C n_items)
B_pair get_n_bin(typename A1::index_t n1, typename A2::index_t n2) const
axis(R min, R max, unsigned n_bins)
static constexpr unsigned c_M2N_shift
static constexpr unsigned int c_A2_Mout_mask
B_pair(typename A1::index_t i1, typename A2::index_t i2)
static constexpr unsigned int c_A1_mask
static constexpr I c_M_mask
unsigned int packed_value
const unsigned m_num_N_bins
I from_R_to_M_bin_safe(R r) const
I from_R_to_M_bin_safe(R r) const
static constexpr unsigned c_N
static constexpr I c_N_mask
I from_R_to_N_bin(R r) const
B_pair get_n_bin(typename A1::real_t r1, typename A2::real_t r2) const
I from_R_to_N_bin_safe(R r) const
I next_N_bin(I bin) const
unsigned size_of_N() const
B_pair m_bin_to_n_bin(B_pair m_bin)
C_pair & ref_content(B_pair n_bin)