|
YODA - Yet more Objects for Data Analysis 2.0.2
|
Go to the documentation of this file.
29 _storedNumber += std::forward<T>(rhs);
33 _storedNumber -= std::forward<T>(rhs);
37 _storedNumber /= std::forward<T>(rhs);
41 _storedNumber *= std::forward<T>(rhs);
46 template< typename RetT = ArithmeticWrapper<T>>
48 -> std::enable_if_t<std::is_integral<T>::value, RetT&> {
49 _storedNumber %= std::forward<T>(rhs);
58 operator T() { return _storedNumber; }
63 operator const T&() const { return _storedNumber; }
79 template < typename T, typename BinningT>
80 class BinBase : public std::conditional_t<std::is_arithmetic<T>::value,
81 ArithmeticWrapper<T>, T> {
86 using isArithmetic = std::conditional_t<std::is_arithmetic<T>::value,
87 std::true_type, std::false_type>;
89 using BaseT = std::conditional_t<isArithmetic::value,
92 template < size_t axisNum>
93 using axisEdgeT = typename BinningT::template getAxisT<axisNum>::EdgeT;
112 BinBase( size_t binIndex, const BinningT& binning)
113 : _binIndex(binIndex), _binning(&binning) { }
116 BinBase( const T& storedVal, size_t binIndex, const BinningT& binning)
117 : BaseT(storedVal), _binIndex(binIndex), _binning(&binning) { }
119 BinBase(T&& storedVal, size_t binIndex, const BinningT& binning)
120 : BaseT(std::move(storedVal)), _binIndex(binIndex), _binning(&binning) { }
123 : BaseT(other), _binIndex(other._binIndex), _binning(&binning) { }
130 BaseT::operator=(std::move(rhs));
136 BaseT::operator=(rhs);
146 BaseT::operator=(rhs);
157 BaseT::operator=(std::move(rhs));
168 const T& raw() const noexcept {
178 return _binning->isMasked(_binIndex);
182 return _binning->isVisible(_binIndex);
192 return _binning->dVol(_binIndex);
206 template < size_t dimNum>
208 const auto& axis = _binning->template axis<dimNum>();
209 size_t binIdx = _binning->globalToLocalIndices(_binIndex)[dimNum];
210 return axis.width(binIdx);
216 template < size_t dimNum>
218 const auto& axis = _binning->template axis<dimNum>();
219 size_t binIdx = _binning->globalToLocalIndices(_binIndex)[dimNum];
220 return axis.max(binIdx);
226 template < size_t dimNum>
228 const auto& axis = _binning->template axis<dimNum>();
229 size_t binIdx = _binning->globalToLocalIndices(_binIndex)[dimNum];
230 return axis.min(binIdx);
236 template < size_t dimNum>
238 const auto& axis = _binning->template axis<dimNum>();
239 size_t binIdx = _binning->globalToLocalIndices(_binIndex)[dimNum];
240 return axis.mid(binIdx);
246 template < size_t dimNum>
248 const auto& axis = _binning->template axis<dimNum>();
249 size_t binIdx = _binning->globalToLocalIndices(_binIndex)[dimNum];
250 return axis.edge(binIdx);
257 const size_t _binIndex;
259 const BinningT* _binning;
264 template < size_t N, typename T, typename BinningT>
274 using BaseT::operator=;
294 double valueErr(const bool divbyvol = false) const noexcept {
295 const double scale = divbyvol? BaseT::dVol() : 1.0;
296 if constexpr (hasFillDim<T>::value) {
297 if constexpr (T::FillDim::value > N) { // profiles
298 return BaseT::stdErr(T::FillDim::value) / scale;
300 return BaseT::errW() / scale; // histograms
302 return BaseT::valueErr() / scale; // other
306 double relErr() const noexcept {
307 return value()? valueErr() / value() : std::numeric_limits<double>::quiet_NaN();
311 double density() const noexcept {
312 return value() / BaseT::dVol();
316 double densityErr() const noexcept {
317 return valueErr() / BaseT::dVol();
324 template< typename T, typename BinningT>
328 typename BinningT::template getEdgeT<0>> {
333 template < size_t axisNum>
334 using axisEdgeT = typename BinningT::template getAxisT<axisNum>::EdgeT;
339 using BaseT::operator=;
352 template< typename T, typename BinningT>
356 typename BinningT::template getEdgeT<0>>,
358 typename BinningT::template getEdgeT<1>> {
364 template < size_t axisNum>
365 using axisEdgeT = typename BinningT::template getAxisT<axisNum>::EdgeT;
370 using BaseT::operator=;
383 template< typename T, typename BinningT>
387 typename BinningT::template getEdgeT<0>>,
389 typename BinningT::template getEdgeT<1>>,
391 typename BinningT::template getEdgeT<2>> {
397 template < size_t axisNum>
398 using axisEdgeT = typename BinningT::template getAxisT<axisNum>::EdgeT;
403 using BaseT::operator=;
Bin base class consisting of mix of histogram bin content and space characteristics of this bin (widt...
BinBase & operator=(BaseT &&rhs) noexcept Assignment operator of an rvalue content type.
std::conditional_t< isArithmetic::value, ArithmeticWrapper< T >, T > BaseT
enable_if_CAxisT< axisEdgeT< dimNum > > min() const noexcept Minimum of this bin interval.
BinBase(const BinBase &rhs)=default
BinBase(T &&storedVal, size_t binIndex, const BinningT &binning)
typename BinningT::template getAxisT< axisNum >::EdgeT axisEdgeT
enable_if_DAxisT< axisEdgeT< dimNum > > edge() const noexcept Edge of this bin.
const T & raw() const noexcept return stored content
BinBase & operator=(const BaseT &rhs) noexcept Assignment operator of a content type.
std::conditional_t< std::is_arithmetic< T >::value, std::true_type, std::false_type > isArithmetic
bool isMasked() const noexcept
enable_if_CAxisT< axisEdgeT< dimNum > > width() const noexcept Width of this bin along a specific axis.
double dVol() const noexcept Differential volume of this bin (i.e. product of bin widths)
size_t index() const noexcept return stored index
BinBase(size_t binIndex, const BinningT &binning)
bool isVisible() const noexcept
BinBase(const T &storedVal, size_t binIndex, const BinningT &binning) Setting constructor.
enable_if_CAxisT< axisEdgeT< dimNum > > mid() const noexcept Middle of this bin interval.
BinBase(const BinBase &other, const BinningT &binning)
BinBase(BinBase &&rhs)=default
BinBase & operator=(const BinBase &rhs) noexcept Copy assignment operator.
BinBase & operator=(BinBase &&rhs) noexcept Move assignment operator.
enable_if_CAxisT< axisEdgeT< dimNum > > max() const noexcept Maximum of this bin interval.
double dLen() const noexcept Differential length of this bin (i.e. the bin width)
typename BinningT::template getAxisT< axisNum >::EdgeT axisEdgeT
double dArea() const noexcept Differential area of this bin (i.e. product of bin widths)
typename BinningT::template getAxisT< axisNum >::EdgeT axisEdgeT
typename BinningT::template getAxisT< axisNum >::EdgeT axisEdgeT
generic Bin version that derives from BinBase
Anonymous namespace to limit visibility.
std::enable_if_t<!std::is_floating_point< EdgeT >::value, EdgeT > enable_if_DAxisT Checks if edge type is discrete and returns edge type.
std::enable_if_t< std::is_floating_point< EdgeT >::value, EdgeT > enable_if_CAxisT Checks if edge type is continuous and returns edge type.
Arithmetic wrapper to emulate inheritance from arithmetic types.
auto operator%=(T &&rhs) -> std::enable_if_t< std::is_integral< T >::value, RetT & >
ArithmeticWrapper< T > & operator*=(T &&rhs)
ArithmeticWrapper< T > & operator/=(T &&rhs)
ArithmeticWrapper< T > & operator+=(T &&rhs)
ArithmeticWrapper< T > & operator-=(T &&rhs)
CRTP mixin introducing convenience aliases along X axis.
CRTP mixin introducing convenience aliases along Y axis.
CRTP mixin introducing convenience aliases along Z axis.
|