yoda is hosted by Hepforge, IPPP Durham
YODA - Yet more Objects for Data Analysis 2.0.0
YODA Namespace Reference

Anonymous namespace to limit visibility. More...

Namespaces

namespace  YODAConcepts
 

Classes

class  AnalysisObject
 AnalysisObject is the base class for histograms and scatters. More...
 
class  AnnotationError
 Error for unfound or broken AnalysisObject annotations. More...
 
class  AOReader
 
class  AOReader< BinnedDbn< DbnN, AxisT... > >
 
class  AOReader< BinnedEstimate< AxisT... > >
 
class  AOReader< Counter >
 
class  AOReader< Estimate0D >
 
class  AOReader< ScatterND< N > >
 
class  AOReaderBase
 
struct  ArithmeticWrapper
 Arithmetic wrapper to emulate inheritance from arithmetic types. More...
 
class  Axis
 Discrete axis with edges of non-floating-point-type. More...
 
class  Axis< T, isCAxis< T > >
 Continuous axis with floating-point-type edges. More...
 
class  Bin
 generic Bin version that derives from BinBase More...
 
class  Bin< 1, T, BinningT >
 CRTP specialisation in 1D. More...
 
class  Bin< 2, T, BinningT >
 CRTP specialisation in 2D. More...
 
class  Bin< 3, T, BinningT >
 CRTP specialisation in 3D. More...
 
class  BinBase
 Bin base class consisting of mix of histogram bin content and space characteristics of this bin (widths, min, max, mid, etc...) More...
 
struct  BinEstimator
 Bin estimator. More...
 
class  BinnedDbn
 User-facing BinnedDbn class in arbitrary dimension. More...
 
class  BinnedDbn< 1, AxisT >
 Specialisation of the BinnedDbn for a 1D histogram. More...
 
class  BinnedDbn< 2, AxisT >
 Specialisation of the BinnedDbn for a 1D profile. More...
 
class  BinnedDbn< 2, AxisT1, AxisT2 >
 Specialisation of the BinnedDbn for a 2D histogram. More...
 
class  BinnedDbn< 3, AxisT1, AxisT2 >
 Specialisation of the BinnedDbn for a 2D profile. More...
 
class  BinnedDbn< 3, AxisT1, AxisT2, AxisT3 >
 Specialisation of the BinnedDbn for a 3D histogram. More...
 
class  BinnedDbn< 4, AxisT1, AxisT2, AxisT3 >
 Specialisation of the BinnedDbn for a 2D profile. More...
 
class  BinnedEstimate
 Forward declaration. More...
 
class  BinnedEstimate< AxisT >
 Specialisation of the BinnedEstimate for a 1D histogram. More...
 
class  BinnedEstimate< AxisT1, AxisT2 >
 Specialisation of the BinnedEstimate for a 2D BinnedEstimate. More...
 
class  BinnedEstimate< AxisT1, AxisT2, AxisT3 >
 Specialisation of the BinnedEstimate for a 3D BinnedEstimate. More...
 
class  BinnedStorage
 BinnedStorage, stores the bins and coordinates access to them. More...
 
class  Binning
 
class  BinningError
 Error for general binning problems. More...
 
class  BinsVecWrapper
 Vector wrapper used to interact with bins vectors. Able to hide overflow and hidden bins. More...
 
struct  CIterable
 
struct  CIterable< T, std::void_t< decltype(std::declval< typename T::const_iterator >())> >
 
struct  CmpFloats
 Functor to compare two floating point numbers and return whether they are fuzzily equivalent. More...
 
class  Counter
 A weighted counter. More...
 
class  Dbn
 User-facing Dbn class inheriting from DbnBase. More...
 
class  Dbn< 0 >
 Partial template specialisation for Dbn0D. More...
 
class  Dbn< 1 >
 Partial template specialisation with CRTP for x-methods. More...
 
class  Dbn< 2 >
 Partial template specialisation with CRTP for x- and y-methods. More...
 
class  Dbn< 3 >
 Partial template specialisation with CRTP for x-, y- and z-methods. More...
 
class  DbnBase
 A 1D distribution. More...
 
class  DbnStorage
 All histograms can be instantiated through this alias. More...
 
struct  defaultAdapter
 Type to adapter mapping used when user didn't provide type adapter. More...
 
struct  defaultAdapter< DbnN, BinT< N, Dbn< DbnN >, BinningT > >
 Default fill adapter for binned type Dbn<N> More...
 
struct  defaultAdapter< FillDim, BinT< N, double, BinningT > >
 Default fill adapter for binned type double. More...
 
struct  Derefable
 SFINAE definition of dereferenceability trait, cf. Boost has_dereference. More...
 
struct  Derefable< T, std::void_t< decltype(*std::declval< T >())> >
 
struct  DerefableToAO
 SFINAE struct to check for dereferencing to an AnalysisObject (reference) at compile time. More...
 
struct  DerefableToAO< T, typename std::conditional< std::is_base_of< AnalysisObject, typename std::decay< decltype(*std::declval< T >()) >::type >::value, AnalysisObject, void >::type >
 
class  Estimate
 A point estimate (base class for the Estimate) More...
 
class  Estimate0D
 An estimate in 0D. More...
 
class  EstimateStorage
 EstimateStorage convenience class based on BinnedStorage. More...
 
class  Exception
 Generic unspecialised YODA runtime error. More...
 
class  Fillable
 A base class for all fillable objects. More...
 
class  FillableStorage
 FillableStorage, introduces FillAdapterT on top of BinnedStorage base class. More...
 
class  GridError
 Error to throw when a slicing is requested on a non-slicable state of an object. More...
 
struct  hasFillDim
 
struct  hasFillDim< T, std::void_t< decltype(typename T::FillDim{})> >
 
struct  Iterable
 
struct  Iterable< T, std::void_t< std::decay_t< decltype(std::begin(std::declval< const T & >()))>, std::decay_t< decltype(std::end(std::declval< const T & >()))> > >
 
struct  LinBinEstimator
 Linear bin estimator. More...
 
class  LockError
 Error for modification of a data object where filling has already begun. More...
 
class  LogBinEstimator
 Logarithmic bin estimator. More...
 
class  LogicError
 Error for places where it should not have been possible to get to! More...
 
class  LowStatsError
 Errors relating to insufficient (effective) statistics. More...
 
class  Point
 Base class for all Point*Ds, providing generic access to their numerical properties. More...
 
class  PointBase
 The base for an N-dimensional data point to be contained in a Scatter<N> More...
 
class  PointND
 
class  PointND< 1 >
 A 1D data point to be contained in a Scatter1D. More...
 
class  PointND< 2 >
 A 2D data point to be contained in a Scatter2D. More...
 
class  PointND< 3 >
 A 3D data point to be contained in a Scatter3D. More...
 
struct  Pushable
 
struct  Pushable< T, VAL, std::void_t< decltype(std::declval< T >().push_back(std::declval< VAL >()))> >
 
class  RangeError
 Error for e.g. use of invalid bin ranges. More...
 
class  Reader
 Pure virtual base class for various output writers. More...
 
class  ReaderFLAT
 Persistency reader from YODA flat text data format. More...
 
class  ReadError
 Error for file reading errors. More...
 
class  ReaderYODA
 Persistency reader from YODA text data format. More...
 
class  Scatter
 A base class for common operations on scatter types (Scatter1D, etc.) More...
 
class  ScatterND
 A generic data type which is just a collection of n-dim data points with errors. More...
 
class  Transformation
 
struct  TypeID
 Returns the type ID as a character sequence. More...
 
struct  TypeID< std::string >
 Specialisation for type string. More...
 
class  UserError
 Error for problems introduced outside YODA, to put it nicely. More...
 
class  WeightError
 Errors relating to event/bin weights. More...
 
class  Weights
 A named, vectorised generalisation of an event weight. More...
 
class  WriteError
 Error for file writing errors. More...
 
class  Writer
 Pure virtual base class for various output writers. More...
 
class  WriterFLAT
 Persistency writer for flat text format. More...
 
class  WriterYODA
 Persistency writer for YODA flat text format. More...
 
class  WriterYODA1
 Persistency writer for YODA flat text format. More...
 
struct  XAxisMixin
 CRTP mixin introducing convenience aliases along X axis. More...
 
struct  XBinMixin
 CRTP mixin introducing convenience aliases along X axis. More...
 
struct  XDbnMixin
 CRTP mixin introducing convenience aliases along X axis. More...
 
struct  XDirectionMixin
 CRTP mixin introducing convenience aliases along X axis. More...
 
struct  XStatsMixin
 CRTP mixin introducing convenience aliases to access statistics along X axis. More...
 
struct  YAxisMixin
 CRTP mixin introducing convenience aliases along Y axis. More...
 
struct  YBinMixin
 CRTP mixin introducing convenience aliases along Y axis. More...
 
struct  YDbnMixin
 CRTP mixin introducing convenience aliases along Y axis. More...
 
struct  YDirectionMixin
 CRTP mixin introducing convenience aliases along Y axis. More...
 
struct  YStatsMixin
 CRTP mixin introducing convenience aliases to access statistics along Y axis. More...
 
struct  ZAxisMixin
 CRTP mixin introducing convenience aliases along Z axis. More...
 
struct  ZBinMixin
 CRTP mixin introducing convenience aliases along Z axis. More...
 
struct  ZDbnMixin
 CRTP mixin introducing convenience aliases along Z axis. More...
 
struct  ZDirectionMixin
 CRTP mixin introducing convenience aliases along Z axis. More...
 
struct  ZStatsMixin
 CRTP mixin introducing convenience aliases to access statistics along Z axis. More...
 

Typedefs

using AO = AnalysisObject
 Convenience alias.
 
using Dbn0D = Dbn< 0 >
 User-friendly aliases.
 
using Dbn1D = Dbn< 1 >
 
using Dbn2D = Dbn< 2 >
 
using Dbn3D = Dbn< 3 >
 
template<typename A1 >
using BinnedHisto1D = BinnedHisto< A1 >
 Define dimension-specific short-hands (Cython sugar)
 
template<typename A1 , typename A2 >
using BinnedHisto2D = BinnedHisto< A1, A2 >
 
template<typename A1 , typename A2 , typename A3 >
using BinnedHisto3D = BinnedHisto< A1, A2, A3 >
 
template<size_t N>
using HistoND = typename HistoMaker< std::make_index_sequence< N > >::type
 
using Histo1D = BinnedHisto< double >
 User-friendly familiar names (continuous axes only)
 
using Histo2D = BinnedHisto< double, double >
 
using Histo3D = BinnedHisto< double, double, double >
 
using Point1D = PointND< 1 >
 User-familiar alias.
 
using Point2D = PointND< 2 >
 
using Point3D = PointND< 3 >
 
using Point4D = PointND< 4 >
 
template<typename A1 >
using BinnedProfile1D = BinnedProfile< A1 >
 Define dimension-specific short-hands (Cython sugar)
 
template<typename A1 , typename A2 >
using BinnedProfile2D = BinnedProfile< A1, A2 >
 
template<typename A1 , typename A2 , typename A3 >
using BinnedProfile3D = BinnedProfile< A1, A2, A3 >
 
template<size_t N>
using ProfileND = typename ProfileMaker< std::make_index_sequence< N > >::type
 User-friendly name for the N-dimensional profile with all-continuous axes.
 
using Profile1D = BinnedProfile< double >
 User-friendly familiar names (continuous axes only)
 
using Profile2D = BinnedProfile< double, double >
 
using Profile3D = BinnedProfile< double, double, double >
 
Define dimension-specific short-hands
template<typename... AxisTypes>
using BinnedHisto = BinnedDbn< sizeof...(AxisTypes), AxisTypes... >
 
template<typename... AxisTypes>
using BinnedProfile = BinnedDbn< sizeof...(AxisTypes)+1, AxisTypes... >
 
Convenience aliases
template<typename A1 >
using BinnedEstimate1D = BinnedEstimate< A1 >
 Define dimension-specific short-hands (Cython sugar)
 
template<typename A1 , typename A2 >
using BinnedEstimate2D = BinnedEstimate< A1, A2 >
 
template<typename A1 , typename A2 , typename A3 >
using BinnedEstimate3D = BinnedEstimate< A1, A2, A3 >
 
template<size_t N>
using EstimateND = typename EstimateMaker< std::make_index_sequence< N > >::type
 
using Estimate1D = BinnedEstimate< double >
 
using Estimate2D = BinnedEstimate< double, double >
 
using Estimate3D = BinnedEstimate< double, double, double >
 
User friendly aliases
using Scatter1D = ScatterND< 1 >
 
using Scatter2D = ScatterND< 2 >
 
using Scatter3D = ScatterND< 3 >
 
using Scatter4D = ScatterND< 4 >
 
using S1D = Scatter1D
 
using S2D = Scatter2D
 
using S3D = Scatter3D
 
using S4D = Scatter4D
 
Convenient aliases
template<size_t N>
using Trf = Transformation< N >
 
Helper methods to probe continuous/discrete axis properties.
template<typename... EdgeT>
using all_CAxes = typename std::conjunction< std::is_floating_point< EdgeT >... >
 
template<typename... EdgeT>
using enable_if_all_CAxisT = std::enable_if_t< all_CAxes< EdgeT... >::value >
 Checks if all edge types are continuous.
 
template<typename EdgeT >
using enable_if_CAxisT = std::enable_if_t< std::is_floating_point< EdgeT >::value, EdgeT >
 Checks if edge type is continuous and returns edge type.
 
template<typename EdgeT >
using enable_if_DAxisT = std::enable_if_t<!std::is_floating_point< EdgeT >::value, EdgeT >
 Checks if edge type is discrete and returns edge type.
 

Enumerations

enum  Sign { MINUS = -1 , ZERO = 0 , PLUS = 1 }
 Enum for signs of numbers. More...
 

Functions

template<typename CoordT >
double nullifyIfDiscCoord (CoordT &&, std::false_type, double null=0.0)
 Nullifies coordinate if it is discrete.
 
template<typename CoordT >
double nullifyIfDiscCoord (CoordT &&coord, std::true_type, double=0.0)
 
template<typename... Args>
bool containsNan (const std::tuple< Args... > &coords)
 Checks if a coordinate tuple has a nan.
 
std::string version ()
 Namespaced version string function.
 
template<size_t N>
DbnBase< N > operator+ (DbnBase< N > first, const DbnBase< N > &second)
 Add two DbnBases.
 
template<size_t N>
DbnBase< N > operator+ (DbnBase< N > first, DbnBase< N > &&second)
 Add two DbnBases.
 
template<size_t N>
DbnBase< N > operator- (DbnBase< N > first, const DbnBase< N > &second)
 Subtract one DbnBase from another one.
 
template<size_t N>
DbnBase< N > operator- (DbnBase< N > first, DbnBase< N > &&second)
 Subtract one DbnBase from another one.
 
ReadermkReader (const std::string &format_name)
 Factory function to make a reader object by format name or a filename.
 
std::string getLibPath ()
 Get the path to the directory containing libYODA.
 
std::string getDataPath ()
 Get the path to the installed share/YODA/ data directory.
 
std::vector< std::string > getYodaDataPath ()
 YODA data paths.
 
std::ostream & operator<< (std::ostream &out, const Weights &w)
 Standard text representaion.
 
WritermkWriter (const std::string &format_name)
 Factory function to make a writer object by format name or a filename.
 
Scatter1D mkScatter (const Counter &c)
 Make a Scatter1D representation of a Histo1D.
 
Combining BinnedDbn objects: global operators
template<size_t DbnN, typename... AxisT>
BinnedDbn< DbnN, AxisT... > operator+ (BinnedDbn< DbnN, AxisT... > first, BinnedDbn< DbnN, AxisT... > &&second)
 Add two BinnedDbn objects.
 
template<size_t DbnN, typename... AxisT>
BinnedDbn< DbnN, AxisT... > operator+ (BinnedDbn< DbnN, AxisT... > first, const BinnedDbn< DbnN, AxisT... > &second)
 
template<size_t DbnN, typename... AxisT>
BinnedDbn< DbnN, AxisT... > operator- (BinnedDbn< DbnN, AxisT... > first, BinnedDbn< DbnN, AxisT... > &&second)
 Subtract one BinnedDbn object from another.
 
template<size_t DbnN, typename... AxisT>
BinnedDbn< DbnN, AxisT... > operator- (BinnedDbn< DbnN, AxisT... > first, const BinnedDbn< DbnN, AxisT... > &second)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > divide (const BinnedDbn< DbnN, AxisT... > &numer, const BinnedDbn< DbnN, AxisT... > &denom)
 Divide two BinnedDbn objects.
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator/ (const BinnedDbn< DbnN, AxisT... > &numer, const BinnedDbn< DbnN, AxisT... > &denom)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator/ (const BinnedDbn< DbnN, AxisT... > &numer, BinnedDbn< DbnN, AxisT... > &&denom)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator/ (BinnedDbn< DbnN, AxisT... > &&numer, const BinnedDbn< DbnN, AxisT... > &denom)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator/ (BinnedDbn< DbnN, AxisT... > &&numer, BinnedDbn< DbnN, AxisT... > &&denom)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > efficiency (const BinnedDbn< DbnN, AxisT... > &accepted, const BinnedDbn< DbnN, AxisT... > &total)
 Calculate a binned efficiency ratio of two BinnedDbn objects.
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > asymm (const BinnedDbn< DbnN, AxisT... > &a, const BinnedDbn< DbnN, AxisT... > &b)
 Calculate the asymmetry (a-b)/(a+b) of two BinnedDbn objects.
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > mkIntegral (const BinnedDbn< DbnN, AxisT... > &histo, const bool includeOverflows=true)
 Convert a Histo1D to a Scatter2D representing the integral of the histogram.
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > mkIntegralEff (const BinnedDbn< DbnN, AxisT... > &histo, const bool includeOverflows=true)
 Convert a Histo1D to a Scatter2D where each bin is a fraction of the total.
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > add (const BinnedDbn< DbnN, AxisT... > &dbn, const BinnedEstimate< AxisT... > &est)
 Calculate the addition of a BinnedDbn with a BinnedEstimate.
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator+ (const BinnedDbn< DbnN, AxisT... > &dbn, const BinnedEstimate< AxisT... > &est)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator+ (BinnedDbn< DbnN, AxisT... > &&dbn, const BinnedEstimate< AxisT... > &est)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator+ (const BinnedDbn< DbnN, AxisT... > &dbn, BinnedEstimate< AxisT... > &&est)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator+ (BinnedDbn< DbnN, AxisT... > &&dbn, BinnedEstimate< AxisT... > &&est)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > subtract (const BinnedDbn< DbnN, AxisT... > &dbn, const BinnedEstimate< AxisT... > &est)
 Calculate the subtraction of a BinnedEstimate from a BinnedDbn.
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator- (const BinnedDbn< DbnN, AxisT... > &dbn, const BinnedEstimate< AxisT... > &est)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator- (BinnedDbn< DbnN, AxisT... > &&dbn, const BinnedEstimate< AxisT... > &est)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator- (const BinnedDbn< DbnN, AxisT... > &dbn, BinnedEstimate< AxisT... > &&est)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator- (BinnedDbn< DbnN, AxisT... > &&dbn, BinnedEstimate< AxisT... > &&est)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > divide (const BinnedDbn< DbnN, AxisT... > &dbn, const BinnedEstimate< AxisT... > &est)
 Calculate the division of a BinnedDbn and a BinnedEstimate.
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator/ (const BinnedDbn< DbnN, AxisT... > &dbn, const BinnedEstimate< AxisT... > &est)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator/ (BinnedDbn< DbnN, AxisT... > &&dbn, const BinnedEstimate< AxisT... > &est)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator/ (const BinnedDbn< DbnN, AxisT... > &dbn, BinnedEstimate< AxisT... > &&est)
 
template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > operator/ (BinnedDbn< DbnN, AxisT... > &&dbn, BinnedEstimate< AxisT... > &&est)
 
Combining BinnedEstimates: global operators
template<typename... AxisT>
BinnedEstimate< AxisT... > operator+ (BinnedEstimate< AxisT... > first, const BinnedEstimate< AxisT... > &second)
 Add two BinnedEstimates.
 
template<typename... AxisT>
BinnedEstimate< AxisT... > operator+ (BinnedEstimate< AxisT... > first, BinnedEstimate< AxisT... > &&second)
 Add two BinnedEstimates.
 
template<typename... AxisT>
BinnedEstimate< AxisT... > operator- (BinnedEstimate< AxisT... > first, const BinnedEstimate< AxisT... > &second)
 Subtract two BinnedEstimates.
 
template<typename... AxisT>
BinnedEstimate< AxisT... > operator- (BinnedEstimate< AxisT... > first, BinnedEstimate< AxisT... > &&second)
 Subtract two BinnedEstimates.
 
template<typename... AxisT>
BinnedEstimate< AxisT... > divide (const BinnedEstimate< AxisT... > &numer, const BinnedEstimate< AxisT... > &denom, const std::string &pat_uncorr="^stat|^uncor")
 Divide two BinnedEstimates.
 
template<typename... AxisT>
BinnedEstimate< AxisT... > operator/ (const BinnedEstimate< AxisT... > &numer, const BinnedEstimate< AxisT... > &denom)
 Divide two BinnedEstimates.
 
template<typename... AxisT>
BinnedEstimate< AxisT... > operator/ (BinnedEstimate< AxisT... > &&numer, const BinnedEstimate< AxisT... > &denom)
 Divide two BinnedEstimates.
 
template<typename... AxisT>
BinnedEstimate< AxisT... > operator/ (const BinnedEstimate< AxisT... > &numer, BinnedEstimate< AxisT... > &&denom)
 Divide two BinnedEstimates.
 
template<typename... AxisT>
BinnedEstimate< AxisT... > operator/ (BinnedEstimate< AxisT... > &&numer, BinnedEstimate< AxisT... > &&denom)
 Divide two BinnedEstimates.
 
template<typename... AxisT>
BinnedEstimate< AxisT... > efficiency (const BinnedEstimate< AxisT... > &accepted, const BinnedEstimate< AxisT... > &total, const std::string &pat_uncorr="^stat|^uncor")
 Calculate a binned efficiency ratio of two BinnedEstimate objects.
 
template<typename... AxisT>
BinnedEstimate< AxisT... > asymm (const BinnedEstimate< AxisT... > &a, const BinnedEstimate< AxisT... > &b, const std::string &pat_uncorr="^stat|^uncor")
 Calculate the asymmetry (a-b)/(a+b) of two BinnedDbn objects.
 
Generalised transformations
template<typename... AxisT>
void transform (BinnedEstimate< AxisT... > &est, const Trf< 1 > &fn)
 
template<typename... AxisT, typename FN >
void transform (BinnedEstimate< AxisT... > &est, const FN &fn)
 
void transform (Estimate0D &est, const Trf< 1 > &fn)
 
template<typename FN >
void transform (Estimate0D &est, const FN &fn)
 
template<size_t N>
void transform (ScatterND< N > &s, const Trf< N > &fn, const size_t i)
 
template<size_t N, typename FN >
void transform (ScatterND< N > &s, const FN &fn, const size_t i)
 
template<size_t N, typename FN >
void transformX (ScatterND< N > &s, const FN &fn)
 
template<size_t N, typename FN >
void transformY (ScatterND< N > &s, const FN &fn)
 
template<size_t N, typename FN >
void transformZ (ScatterND< N > &s, const FN &fn)
 
Combining counters: global operators
Counter operator+ (Counter first, const Counter &second)
 Add two counters.
 
Counter operator+ (Counter first, Counter &&second)
 Add two counters.
 
Counter operator- (Counter first, const Counter &second)
 Subtract two counters.
 
Counter operator- (Counter first, Counter &&second)
 Subtract two counters.
 
Estimate0D divide (const Counter &numer, const Counter &denom)
 Divide two counters, with an uncorrelated error treatment.
 
Estimate0D operator/ (const Counter &numer, const Counter &denom)
 Divide two Counter objects.
 
Estimate0D operator/ (Counter &&numer, const Counter &denom)
 Divide two Counter objects.
 
Estimate0D operator/ (const Counter &numer, Counter &&denom)
 Divide two Counter objects.
 
Estimate0D operator/ (Counter &&numer, Counter &&denom)
 Divide two Counter objects.
 
Estimate0D efficiency (const Counter &accepted, const Counter &total)
 Calculate an efficiency ratio of two counters.
 
Global operators for Estimate objects
Estimate operator+ (Estimate lhs, const Estimate &rhs)
 Add two Estimate objects.
 
Estimate operator+ (Estimate lhs, Estimate &&rhs)
 Add two Estimate objects.
 
Estimate operator- (Estimate lhs, const Estimate &rhs)
 Subtract two Estimate objects.
 
Estimate operator- (Estimate lhs, Estimate &&rhs)
 Subtract two Estimate objects.
 
Estimate divide (const Estimate &numer, const Estimate &denom, const std::string &pat_uncorr="^stat|^uncor")
 Divide two Estimate objects.
 
Estimate operator/ (const Estimate &numer, const Estimate &denom)
 Divide two Estimate objects.
 
Estimate operator/ (Estimate &&numer, const Estimate &denom)
 Divide two Estimate objects.
 
Estimate operator/ (const Estimate &numer, Estimate &&denom)
 Divide two Estimate objects.
 
Estimate operator/ (Estimate &&numer, Estimate &&denom)
 Divide two Estimate objects.
 
Estimate efficiency (const Estimate &accepted, const Estimate &total, const std::string &pat_uncorr="^stat|^uncor")
 Divide two Estimate objects using binomial statistics.
 
Global operators for Estimate0D objects
Estimate0D operator+ (Estimate0D lhs, const Estimate0D &rhs)
 Add two Estimate0D objects.
 
Estimate0D operator+ (Estimate0D lhs, Estimate0D &&rhs)
 Add two Estimate0D objects.
 
Estimate0D operator- (Estimate0D lhs, const Estimate0D &rhs)
 Subtract two Estimate0D objects.
 
Estimate0D operator- (Estimate0D lhs, Estimate0D &&rhs)
 Subtract two Estimate0D objects.
 
Estimate0D divide (const Estimate0D &numer, const Estimate0D &denom, const std::string &pat_uncorr="^stat|^uncor")
 Divide two Estimate0D objects.
 
Estimate0D operator/ (const Estimate0D &numer, const Estimate0D &denom)
 Divide two Estimate0D objects.
 
Estimate0D operator/ (Estimate0D &&numer, const Estimate0D &denom)
 Divide two Estimate0D objects.
 
Estimate0D operator/ (const Estimate0D &numer, Estimate0D &&denom)
 Divide two Estimate0D objects.
 
Estimate0D operator/ (Estimate0D &&numer, Estimate0D &&denom)
 Divide two Estimate0D objects.
 
Estimate0D efficiency (const Estimate0D &accepted, const Estimate0D &total, const std::string &pat_uncorr="^stat|^uncor")
 Divide two Estimate0D objects using binomial statistics.
 
Writer functions to files (with automatic format detection)
void write (const std::string &filename, const AnalysisObject &ao, int precision=-1)
 Write out object ao to file filename.
 
template<typename RANGE >
void write (const std::string &filename, const RANGE &aos, int precision=-1)
 Write out a collection of objects objs to file filename.
 
template<typename AOITER >
void write (const std::string &filename, const AOITER &begin, const AOITER &end, int precision=-1)
 
Writer functions to streams (with explicit format specification)
void write (std::ostream &os, const AnalysisObject &ao, const std::string &fmt, int precision=-1)
 Write out object ao to stream os with format fmt.
 
template<typename RANGE >
void write (std::ostream &os, const RANGE &aos, const std::string &fmt, int precision=-1)
 Write out a collection of objects objs to file filename.
 
template<typename AOITER >
void write (std::ostream &os, const AOITER &begin, const AOITER &end, const std::string &fmt, int precision=-1)
 
Reader functions from files (with automatic format detection)
void read (const std::string &filename, std::vector< AnalysisObject * > &aos, const std::string &match="", const std::string &unmatch="")
 Read in a collection of objects objs from file filename.
 
std::vector< AnalysisObject * > read (const std::string &filename, const std::string &match="", const std::string &unmatch="")
 Read in a collection of objects from file filename.
 
Reader functions from streams (with explicit format specification)
void read (std::istream &is, std::vector< AnalysisObject * > &aos, const std::string &fmt, const std::string &match="", const std::string &unmatch="")
 Read in a collection of objects objs from stream is, expecting format fmt.
 
std::vector< AnalysisObject * > read (std::istream &is, const std::string &fmt, const std::string &match="", const std::string &unmatch="")
 Read in a collection of objects from stream is, expecting format fmt.
 
Comparison operators
template<size_t N>
bool operator== (const PointBase< N > &a, const PointBase< N > &b)
 Equality test.
 
template<size_t N>
bool operator!= (const PointBase< N > &a, const PointBase< N > &b)
 Inequality test.
 
template<size_t N>
bool operator< (const PointBase< N > &a, const PointBase< N > &b)
 Less-than operator used to sort points.
 
template<size_t N>
bool operator<= (const PointBase< N > &a, const PointBase< N > &b)
 Less-than-or-equals operator used to sort points.
 
template<size_t N>
bool operator> (const PointBase< N > &a, const PointBase< N > &b)
 Greater-than operator used to sort points.
 
template<size_t N>
bool operator>= (const PointBase< N > &a, const PointBase< N > &b)
 Greater-than-or-equals operator used to sort points.
 
Combining scatters by merging sets of points
template<int N>
ScatterND< N > combine (ScatterND< N > a, const ScatterND< N > &b)
 
template<int N>
ScatterND< N > combine (ScatterND< N > a, ScatterND< N > &&b)
 
template<int N>
ScatterND< N > combine (const std::vector< ScatterND< N > > &scatters)
 
template<int N>
ScatterND< N > combine (std::vector< ScatterND< N > > &&scatters)
 
Helper methods to stringify edge types
template<typename A , typename... As>
std::string mkAxisConfig ()
 Helper function to construct the axis config.
 
template<ssize_t DbnN, typename A , typename... As>
std::string mkTypeString ()
 Helper function to construct the BinnedDbn and BinnedEstimate type names.
 
template<typename A , typename... As>
std::string mkTypeString ()
 Same as above, but for non-Dbn bin contents.
 
Miscellaneous numerical helpers
template<typename NUM >
NUM sqr (NUM a)
 Named number-type squaring operation.
 
template<typename Num >
Num add_quad (Num a, Num b)
 Named number-type addition in quadrature operation.
 
template<typename Num >
Num add_quad (Num a, Num b, Num c)
 Named number-type addition in quadrature operation.
 
int sign (double val)
 Find the sign of a number.
 
int sign (int val)
 Find the sign of a number.
 
int sign (long val)
 Find the sign of a number.
 
Binning helper functions
std::vector< double > linspace (size_t nbins, double xmin, double xmax, bool include_end=true)
 Make a list of nbins + 1 values uniformly spaced between xmin and xmax inclusive.
 
std::vector< double > logspace (size_t nbins, double xmin, double xmax, bool include_end=true)
 Make a list of nbins + 1 values uniformly spaced in log(x) between xmin and xmax inclusive.
 
std::vector< double > pdfspace (size_t nbins, double xmin, double xmax, std::function< double(double)> &fn, size_t nsample=10000)
 Make a list of nbins + 1 values spaced with density ~ f(x) between xmin and end inclusive.
 
template<typename NUM >
int index_between (const NUM &val, const std::vector< NUM > &binedges)
 Return the bin index of the given value, val, given a vector of bin edges.
 
Statistics functions
double effNumEntries (const double sumW, const double sumW2)
 Calculate the effective number of entries of a sample.
 
double effNumEntries (const std::vector< double > &weights)
 Calculate the effective number of entries of a sample.
 
double mean (const std::vector< int > &sample)
 Calculate the mean of a sample.
 
double mean (const double sumWX, const double sumW)
 Calculate the weighted mean of a sample.
 
double mean (const std::vector< double > &sample, const std::vector< double > &weights)
 Calculate the weighted mean of a sample.
 
double variance (const double sumWX, const double sumW, const double sumWX2, const double sumW2)
 Calculate the weighted variance of a sample.
 
double variance (const std::vector< double > &sample, const std::vector< double > &weights)
 Calculate the weighted variance of a sample.
 
double stdDev (const double sumWX, const double sumW, const double sumWX2, const double sumW2)
 Calculate the weighted standard deviation of a sample.
 
double stdDev (const std::vector< double > &sample, const std::vector< double > &weights)
 Calculate the weighted variance of a sample.
 
double stdErr (const double sumWX, const double sumW, const double sumWX2, const double sumW2)
 Calculate the weighted standard error of a sample.
 
double stdErr (const std::vector< double > &sample, const std::vector< double > &weights)
 Calculate the weighted variance of a sample.
 
double RMS (const double sumWX2, const double sumW, const double sumW2)
 Calculate the weighted RMS of a sample.
 
double RMS (const std::vector< double > &sample, const std::vector< double > &weights)
 Calculate the weighted RMS of a sample.
 
double covariance (const std::vector< int > &sample1, const std::vector< int > &sample2)
 Calculate the covariance (variance) between two samples.
 
double correlation (const std::vector< int > &sample1, const std::vector< int > &sample2)
 Calculate the correlation strength between two samples.
 
Combining weights: global operators
Weights operator+ (const Weights &first, const Weights &second)
 Add two weights.
 
Weights operator- (const Weights &first, const Weights &second)
 Subtract two weights.
 
Weights operator* (const Weights &first, const Weights &second)
 Multiply two weights.
 
Weights operator/ (const Weights &numer, const Weights &denom)
 Divide two weights.
 
Weights operator* (double a, const Weights &w)
 Multiply by a double.
 
Weights operator* (const Weights &w, double a)
 Multiply by a double.
 
Weights operator/ (const Weights &w, double a)
 Divide by a double.
 
Weights operator/ (double a, const Weights &w)
 

Variables

const size_t SEARCH_SIZElc = 16
 
const size_t BISECT_LINEAR_THRESHOLDlc = 32
 
static const double MAXDOUBLE = DBL_MAX
 
static const double MAXINT = INT_MAX
 
static const double PI = M_PI
 A pre-defined value of $ \pi $.
 
static const double TWOPI = 2*M_PI
 A pre-defined value of $ 2\pi $.
 
static const double HALFPI = M_PI_2
 A pre-defined value of $ \pi/2 $.
 
template<typename... T>
constexpr bool isIterable = std::conjunction<Iterable<T>...>::value
 
template<typename... T>
constexpr bool isCIterable = std::conjunction<CIterable<T>...>::value
 
static const int YODA_FORMAT_VERSION = 3
 

Ranges and intervals

enum  RangeBoundary { OPEN =0 , SOFT =0 , CLOSED =1 , HARD =1 }
 
template<typename NUM >
bool inRange (NUM value, NUM low, NUM high, RangeBoundary lowbound=CLOSED, RangeBoundary highbound=OPEN)
 Determine if value is in the range low to high, for floating point numbers.
 
template<typename NUM >
bool inRange (NUM value, std::pair< NUM, NUM > lowhigh, RangeBoundary lowbound=CLOSED, RangeBoundary highbound=OPEN)
 Alternative version of inRange for doubles, which accepts a pair for the range arguments.
 
bool inRange (int value, int low, int high, RangeBoundary lowbound=CLOSED, RangeBoundary highbound=CLOSED)
 Determine if value is in the range low to high, for integer types.
 
bool inRange (int value, std::pair< int, int > lowhigh, RangeBoundary lowbound=CLOSED, RangeBoundary highbound=OPEN)
 Alternative version of inRange for ints, which accepts a pair for the range arguments.
 

Comparison functions for safe (floating point) equality tests

static std::function< bool(const double, const double)> fuzzyEqComp
 Comparator wrapper to use with STL algorithms, e.g. std::equal etc.
 
template<typename NUM >
std::enable_if_t< std::is_floating_point_v< NUM >, bool > isZero (NUM val, double tolerance=1e-8)
 Compare a number to zero.
 
template<typename NUM >
std::enable_if_t< std::is_integral_v< NUM >, bool > isZero (NUM val, double=1e-5)
 Compare a number to zero.
 
template<typename NUM >
std::enable_if_t< std::is_floating_point_v< NUM >, bool > isNaN (NUM val)
 Check if a number is NaN.
 
template<typename NUM >
std::enable_if_t< std::is_floating_point_v< NUM >, bool > notNaN (NUM val)
 Check if a number is non-NaN.
 
template<typename N1 , typename N2 >
std::enable_if_t< std::is_arithmetic_v< N1 > &&std::is_arithmetic_v< N2 > &&(std::is_floating_point_v< N1 >||std::is_floating_point_v< N2 >), bool > fuzzyEquals (N1 a, N2 b, double tolerance=1e-5)
 Compare two numbers for equality with a degree of fuzziness.
 
template<typename N1 , typename N2 >
std::enable_if_t< std::is_integral_v< N1 > &&std::is_integral_v< N2 >, bool > fuzzyEquals (N1 a, N2 b, double)
 Compare two numbers for equality with a degree of fuzziness.
 
template<typename N1 , typename N2 >
std::enable_if_t< std::is_arithmetic_v< N1 > &&std::is_arithmetic_v< N2 >, bool > fuzzyGtrEquals (N1 a, N2 b, double tolerance=1e-5)
 Compare two numbers for >= with a degree of fuzziness.
 
template<typename N1 , typename N2 >
std::enable_if_t< std::is_arithmetic_v< N1 > &&std::is_arithmetic_v< N2 >, bool > fuzzyLessEquals (N1 a, N2 b, double tolerance=1e-5)
 Compare two floating point numbers for <= with a degree of fuzziness.
 
double approx (double a, int n=5)
 Returns a number floored at the nth decimal place.
 

Detailed Description

Anonymous namespace to limit visibility.

Todo:
Add SFINAE math type stuff (see Rivet) and add inrange() and inrange_closed_closed() etc. aliases cf. MCUtils

Typedef Documentation

◆ all_CAxes

template<typename... EdgeT>
using YODA::all_CAxes = typedef typename std::conjunction<std::is_floating_point<EdgeT>...>

Definition at line 18 of file BinningUtils.h.

◆ AO

using YODA::AO = typedef AnalysisObject

Convenience alias.

Definition at line 363 of file AnalysisObject.h.

◆ BinnedEstimate1D

template<typename A1 >
using YODA::BinnedEstimate1D = typedef BinnedEstimate<A1>

Define dimension-specific short-hands (Cython sugar)

Definition at line 1221 of file BinnedEstimate.h.

◆ BinnedEstimate2D

template<typename A1 , typename A2 >
using YODA::BinnedEstimate2D = typedef BinnedEstimate<A1, A2>

Definition at line 1224 of file BinnedEstimate.h.

◆ BinnedEstimate3D

template<typename A1 , typename A2 , typename A3 >
using YODA::BinnedEstimate3D = typedef BinnedEstimate<A1, A2, A3>

Definition at line 1227 of file BinnedEstimate.h.

◆ BinnedHisto

template<typename... AxisTypes>
using YODA::BinnedHisto = typedef BinnedDbn<sizeof...(AxisTypes), AxisTypes...>

Definition at line 97 of file BinnedDbn.h.

◆ BinnedHisto1D

template<typename A1 >
using YODA::BinnedHisto1D = typedef BinnedHisto<A1>

Define dimension-specific short-hands (Cython sugar)

Definition at line 331 of file Histo.h.

◆ BinnedHisto2D

template<typename A1 , typename A2 >
using YODA::BinnedHisto2D = typedef BinnedHisto<A1, A2>

Definition at line 334 of file Histo.h.

◆ BinnedHisto3D

template<typename A1 , typename A2 , typename A3 >
using YODA::BinnedHisto3D = typedef BinnedHisto<A1, A2, A3>

Definition at line 337 of file Histo.h.

◆ BinnedProfile

template<typename... AxisTypes>
using YODA::BinnedProfile = typedef BinnedDbn<sizeof...(AxisTypes)+1, AxisTypes...>

Definition at line 100 of file BinnedDbn.h.

◆ BinnedProfile1D

template<typename A1 >
using YODA::BinnedProfile1D = typedef BinnedProfile<A1>

Define dimension-specific short-hands (Cython sugar)

Definition at line 326 of file Profile.h.

◆ BinnedProfile2D

template<typename A1 , typename A2 >
using YODA::BinnedProfile2D = typedef BinnedProfile<A1, A2>

Definition at line 329 of file Profile.h.

◆ BinnedProfile3D

template<typename A1 , typename A2 , typename A3 >
using YODA::BinnedProfile3D = typedef BinnedProfile<A1, A2, A3>

Definition at line 332 of file Profile.h.

◆ Dbn0D

using YODA::Dbn0D = typedef Dbn<0>

User-friendly aliases.

Definition at line 771 of file Dbn.h.

◆ Dbn1D

using YODA::Dbn1D = typedef Dbn<1>

Definition at line 772 of file Dbn.h.

◆ Dbn2D

using YODA::Dbn2D = typedef Dbn<2>

Definition at line 773 of file Dbn.h.

◆ Dbn3D

using YODA::Dbn3D = typedef Dbn<3>

Definition at line 774 of file Dbn.h.

◆ enable_if_all_CAxisT

template<typename... EdgeT>
using YODA::enable_if_all_CAxisT = typedef std::enable_if_t<all_CAxes<EdgeT...>::value>

Checks if all edge types are continuous.

Definition at line 22 of file BinningUtils.h.

◆ enable_if_CAxisT

template<typename EdgeT >
using YODA::enable_if_CAxisT = typedef std::enable_if_t<std::is_floating_point<EdgeT>::value, EdgeT>

Checks if edge type is continuous and returns edge type.

Definition at line 26 of file BinningUtils.h.

◆ enable_if_DAxisT

template<typename EdgeT >
using YODA::enable_if_DAxisT = typedef std::enable_if_t<!std::is_floating_point<EdgeT>::value, EdgeT>

Checks if edge type is discrete and returns edge type.

Definition at line 30 of file BinningUtils.h.

◆ Estimate1D

using YODA::Estimate1D = typedef BinnedEstimate<double>

Definition at line 1245 of file BinnedEstimate.h.

◆ Estimate2D

using YODA::Estimate2D = typedef BinnedEstimate<double,double>

Definition at line 1246 of file BinnedEstimate.h.

◆ Estimate3D

using YODA::Estimate3D = typedef BinnedEstimate<double,double,double>

Definition at line 1247 of file BinnedEstimate.h.

◆ EstimateND

template<size_t N>
using YODA::EstimateND = typedef typename EstimateMaker<std::make_index_sequence<N> >::type

Definition at line 1241 of file BinnedEstimate.h.

◆ Histo1D

using YODA::Histo1D = typedef BinnedHisto<double>

User-friendly familiar names (continuous axes only)

Definition at line 354 of file Histo.h.

◆ Histo2D

using YODA::Histo2D = typedef BinnedHisto<double,double>

Definition at line 355 of file Histo.h.

◆ Histo3D

using YODA::Histo3D = typedef BinnedHisto<double,double,double>

Definition at line 356 of file Histo.h.

◆ HistoND

template<size_t N>
using YODA::HistoND = typedef typename HistoMaker<std::make_index_sequence<N> >::type

Definition at line 351 of file Histo.h.

◆ Point1D

using YODA::Point1D = typedef PointND<1>

User-familiar alias.

Definition at line 704 of file Point.h.

◆ Point2D

using YODA::Point2D = typedef PointND<2>

Definition at line 705 of file Point.h.

◆ Point3D

using YODA::Point3D = typedef PointND<3>

Definition at line 706 of file Point.h.

◆ Point4D

using YODA::Point4D = typedef PointND<4>

Definition at line 707 of file Point.h.

◆ Profile1D

using YODA::Profile1D = typedef BinnedProfile<double>

User-friendly familiar names (continuous axes only)

Definition at line 350 of file Profile.h.

◆ Profile2D

using YODA::Profile2D = typedef BinnedProfile<double,double>

Definition at line 351 of file Profile.h.

◆ Profile3D

using YODA::Profile3D = typedef BinnedProfile<double,double,double>

Definition at line 352 of file Profile.h.

◆ ProfileND

template<size_t N>
using YODA::ProfileND = typedef typename ProfileMaker<std::make_index_sequence<N> >::type

User-friendly name for the N-dimensional profile with all-continuous axes.

Definition at line 347 of file Profile.h.

◆ S1D

using YODA::S1D = typedef Scatter1D

Definition at line 885 of file Scatter.h.

◆ S2D

using YODA::S2D = typedef Scatter2D

Definition at line 886 of file Scatter.h.

◆ S3D

using YODA::S3D = typedef Scatter3D

Definition at line 887 of file Scatter.h.

◆ S4D

using YODA::S4D = typedef Scatter4D

Definition at line 888 of file Scatter.h.

◆ Scatter1D

using YODA::Scatter1D = typedef ScatterND<1>

Definition at line 881 of file Scatter.h.

◆ Scatter2D

using YODA::Scatter2D = typedef ScatterND<2>

Definition at line 882 of file Scatter.h.

◆ Scatter3D

using YODA::Scatter3D = typedef ScatterND<3>

Definition at line 883 of file Scatter.h.

◆ Scatter4D

using YODA::Scatter4D = typedef ScatterND<4>

Definition at line 884 of file Scatter.h.

◆ Trf

template<size_t N>
using YODA::Trf = typedef Transformation<N>

Definition at line 128 of file Transformation.h.

Enumeration Type Documentation

◆ RangeBoundary

Represents whether an interval is open (non-inclusive) or closed (inclusive).

For example, the interval $ [0, \pi) $ is closed (an inclusive boundary) at 0, and open (a non-inclusive boundary) at $ \pi $.

Enumerator
OPEN 
SOFT 
CLOSED 
HARD 

Definition at line 156 of file MathUtils.h.

156{ OPEN=0, SOFT=0, CLOSED=1, HARD=1 };
@ CLOSED
Definition MathUtils.h:156
@ OPEN
Definition MathUtils.h:156
@ HARD
Definition MathUtils.h:156
@ SOFT
Definition MathUtils.h:156

◆ Sign

enum YODA::Sign

Enum for signs of numbers.

Enumerator
MINUS 
ZERO 
PLUS 

Definition at line 51 of file MathUtils.h.

51{ MINUS = -1, ZERO = 0, PLUS = 1 };
@ ZERO
Definition MathUtils.h:51
@ PLUS
Definition MathUtils.h:51
@ MINUS
Definition MathUtils.h:51

Function Documentation

◆ add()

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::add ( const BinnedDbn< DbnN, AxisT... > &  dbn,
const BinnedEstimate< AxisT... > &  est 
)
inline

Calculate the addition of a BinnedDbn with a BinnedEstimate.

Definition at line 1268 of file BinnedDbn.h.

1268 {
1269 return dbn.mkEstimate() + est;
1270 }
BinnedEstimate< AxisT... > mkEstimate(const std::string &path="", const std::string &source="", const bool divbyvol=true) const
Produce a BinnedEstimate from a DbnStorage.
Definition BinnedDbn.h:754

References YODA::DbnStorage< DbnN, AxisT >::mkEstimate().

Referenced by asymm(), operator+(), operator+(), operator+(), and operator+().

◆ add_quad() [1/2]

template<typename Num >
Num YODA::add_quad ( Num  a,
Num  b 
)
inline

Named number-type addition in quadrature operation.

Definition at line 222 of file MathUtils.h.

222 {
223 return sqrt(a*a + b*b);
224 }

Referenced by divide().

◆ add_quad() [2/2]

template<typename Num >
Num YODA::add_quad ( Num  a,
Num  b,
Num  c 
)
inline

Named number-type addition in quadrature operation.

Definition at line 228 of file MathUtils.h.

228 {
229 return sqrt(a*a + b*b + c*c);
230 }

◆ approx()

double YODA::approx ( double  a,
int  n = 5 
)
inline

Returns a number floored at the nth decimal place.

Definition at line 140 of file MathUtils.h.

140 {
141 double roundTo = pow(10.0,n);
142 a *= roundTo;
143 a = floor(a);
144 return a/roundTo;
145 }

◆ asymm() [1/2]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::asymm ( const BinnedDbn< DbnN, AxisT... > &  a,
const BinnedDbn< DbnN, AxisT... > &  b 
)
inline

Calculate the asymmetry (a-b)/(a+b) of two BinnedDbn objects.

Definition at line 1199 of file BinnedDbn.h.

1199 {
1200 return (a-b) / (a+b);
1201 }

◆ asymm() [2/2]

template<typename... AxisT>
BinnedEstimate< AxisT... > YODA::asymm ( const BinnedEstimate< AxisT... > &  a,
const BinnedEstimate< AxisT... > &  b,
const std::string &  pat_uncorr = "^stat|^uncor" 
)
inline

Calculate the asymmetry (a-b)/(a+b) of two BinnedDbn objects.

Definition at line 1188 of file BinnedEstimate.h.

1190 {
1191 return divde(subtract(a-b, pat_uncorr), add(a+b, pat_uncorr), pat_uncorr);
1192 }
BinnedEstimate< AxisT... > add(const BinnedDbn< DbnN, AxisT... > &dbn, const BinnedEstimate< AxisT... > &est)
Calculate the addition of a BinnedDbn with a BinnedEstimate.
Definition BinnedDbn.h:1268
BinnedEstimate< AxisT... > subtract(const BinnedDbn< DbnN, AxisT... > &dbn, const BinnedEstimate< AxisT... > &est)
Calculate the subtraction of a BinnedEstimate from a BinnedDbn.
Definition BinnedDbn.h:1300

References add(), and subtract().

◆ combine() [1/4]

template<int N>
ScatterND< N > YODA::combine ( const std::vector< ScatterND< N > > &  scatters)
inline

Definition at line 783 of file Scatter.h.

783 {
784 ScatterND<N> rtn;
785 rtn.combineWith(scatters);
786 return rtn;
787 }
A generic data type which is just a collection of n-dim data points with errors.
Definition Scatter.h:154
ScatterND< N > & combineWith(const ScatterND< N > &other)
Definition Scatter.h:558

References YODA::ScatterND< N >::combineWith().

◆ combine() [2/4]

template<int N>
ScatterND< N > YODA::combine ( ScatterND< N >  a,
const ScatterND< N > &  b 
)
inline

Definition at line 771 of file Scatter.h.

771 {
772 a.combineWith(b);
773 return a;
774 }

References YODA::ScatterND< N >::combineWith().

◆ combine() [3/4]

template<int N>
ScatterND< N > YODA::combine ( ScatterND< N >  a,
ScatterND< N > &&  b 
)
inline

Definition at line 777 of file Scatter.h.

777 {
778 a.combineWith(std::move(b));
779 return a;
780 }

References YODA::ScatterND< N >::combineWith().

◆ combine() [4/4]

template<int N>
ScatterND< N > YODA::combine ( std::vector< ScatterND< N > > &&  scatters)
inline

Definition at line 790 of file Scatter.h.

790 {
791 ScatterND<N> rtn;
792 rtn.combineWith(std::move(scatters));
793 return rtn;
794 }

References YODA::ScatterND< N >::combineWith().

◆ containsNan()

template<typename... Args>
bool YODA::containsNan ( const std::tuple< Args... > &  coords)
inline

Checks if a coordinate tuple has a nan.

Definition at line 30 of file Binning.h.

30 {
31 std::array<size_t, sizeof...(Args)> hasNan{};
32 auto checkCoords = [&hasNan, &coords](auto I) {
33 using isContinuous = typename std::is_floating_point<typename std::tuple_element_t<I, std::tuple<Args...>>>;
34
35 hasNan[I] = size_t(std::isnan(nullifyIfDiscCoord(std::move(std::get<I>(coords)),
36 std::integral_constant<bool,
37 isContinuous::value>{})));
38 };
39
40 MetaUtils::staticFor<sizeof...(Args)>(checkCoords);
41
42 return std::any_of(hasNan.begin(), hasNan.end(), [ ](const bool i) { return i; } );
43 }
constexpr void staticFor(Func &&f)
Used to apply functor on tuple. Calls lambda with integral constant, which can be used to query tuple...
Definition MetaUtils.h:34

References nullifyIfDiscCoord(), and MetaUtils::staticFor().

Referenced by YODA::FillableStorage< FillDim, BinContentT, AxisT >::fill().

◆ correlation()

double YODA::correlation ( const std::vector< int > &  sample1,
const std::vector< int > &  sample2 
)
inline

Calculate the correlation strength between two samples.

Definition at line 527 of file MathUtils.h.

527 {
528 const double cov = covariance(sample1, sample2);
529 const double var1 = covariance(sample1, sample1);
530 const double var2 = covariance(sample2, sample2);
531 const double correlation = cov/sqrt(var1*var2);
532 const double corr_strength = correlation*sqrt(var2/var1);
533 return corr_strength;
534 }
double covariance(const std::vector< int > &sample1, const std::vector< int > &sample2)
Calculate the covariance (variance) between two samples.
Definition MathUtils.h:512
double correlation(const std::vector< int > &sample1, const std::vector< int > &sample2)
Calculate the correlation strength between two samples.
Definition MathUtils.h:527

References correlation(), and covariance().

Referenced by correlation().

◆ covariance()

double YODA::covariance ( const std::vector< int > &  sample1,
const std::vector< int > &  sample2 
)
inline

Calculate the covariance (variance) between two samples.

Definition at line 512 of file MathUtils.h.

512 {
513 const double mean1 = mean(sample1);
514 const double mean2 = mean(sample2);
515 const size_t N = sample1.size();
516 double cov = 0.0;
517 for (size_t i = 0; i < N; i++) {
518 const double cov_i = (sample1[i] - mean1)*(sample2[i] - mean2);
519 cov += cov_i;
520 }
521 if (N > 1) return cov/(N-1);
522 else return 0.0;
523 }
double mean(const std::vector< int > &sample)
Calculate the mean of a sample.
Definition MathUtils.h:391

References mean().

Referenced by correlation().

◆ divide() [1/6]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::divide ( const BinnedDbn< DbnN, AxisT... > &  dbn,
const BinnedEstimate< AxisT... > &  est 
)
inline

Calculate the division of a BinnedDbn and a BinnedEstimate.

Definition at line 1332 of file BinnedDbn.h.

1332 {
1333 return dbn.mkEstimate() / est;
1334 }

References YODA::DbnStorage< DbnN, AxisT >::mkEstimate().

◆ divide() [2/6]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::divide ( const BinnedDbn< DbnN, AxisT... > &  numer,
const BinnedDbn< DbnN, AxisT... > &  denom 
)
inline

Divide two BinnedDbn objects.

Definition at line 1090 of file BinnedDbn.h.

1090 {
1091
1092 if (numer != denom) {
1093 throw BinningError("Arithmetic operation requires compatible binning!");
1094 }
1095
1096 BinnedEstimate<AxisT...> rtn = numer.mkEstimate();
1097 if (numer.path() == denom.path()) rtn.setPath(numer.path());
1098 if (rtn.hasAnnotation("ScaledBy")) rtn.rmAnnotation("ScaledBy");
1099
1100 for (const auto& b_num : numer.bins(true, true)) {
1101 const size_t idx = b_num.index();
1102 const auto& b_den = denom.bin(idx);
1103 double v, e;
1104 if (!b_den.effNumEntries()) {
1105 v = std::numeric_limits<double>::quiet_NaN();
1106 e = std::numeric_limits<double>::quiet_NaN();
1107 }
1108 else {
1109 if constexpr(DbnN > sizeof...(AxisT)) {
1110 v = b_num.mean(DbnN) / b_den.mean(DbnN);
1111 const double e_num = b_num.effNumEntries()? b_num.relStdErr(DbnN) : 0;
1112 const double e_den = b_den.effNumEntries()? b_den.relStdErr(DbnN) : 0;
1113 e = fabs(v) * sqrt(sqr(e_num) + sqr(e_den));
1114 }
1115 else {
1116 v = b_num.sumW() / b_den.sumW();
1117 const double e_num = b_num.sumW()? b_num.relErrW() : 0;
1118 const double e_den = b_den.sumW()? b_den.relErrW() : 0;
1119 e = fabs(v) * sqrt(sqr(e_num) + sqr(e_den));
1120 }
1121 }
1122 rtn.bin(idx).set(v, {-e, e}); // @todo put "stats" as source?
1123 }
1124 rtn.maskBins(denom.maskedBins(), true);
1125
1126 return rtn;
1127 }
const std::string path() const
Get the AO path.
BinT & bin(size_t idx) noexcept
Returns reference to the bin at idx.
std::vector< size_t > maskedBins() const noexcept
Error for general binning problems.
Definition Exceptions.h:27
NUM sqr(NUM a)
Named number-type squaring operation.
Definition MathUtils.h:216

References YODA::BinnedStorage< BinContentT, AxisT >::bin(), YODA::BinnedStorage< BinContentT, AxisT >::bins(), YODA::BinnedStorage< BinContentT, AxisT >::maskedBins(), YODA::DbnStorage< DbnN, AxisT >::mkEstimate(), YODA::AnalysisObject::path(), and sqr().

Referenced by divide(), divide(), efficiency(), efficiency(), efficiency(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), operator/(), and operator/().

◆ divide() [3/6]

template<typename... AxisT>
BinnedEstimate< AxisT... > YODA::divide ( const BinnedEstimate< AxisT... > &  numer,
const BinnedEstimate< AxisT... > &  denom,
const std::string &  pat_uncorr = "^stat|^uncor" 
)
inline

Divide two BinnedEstimates.

Definition at line 1108 of file BinnedEstimate.h.

1109 {
1110 if (numer != denom) {
1111 throw BinningError("Arithmetic operation requires compatible binning!");
1112 }
1113
1114 BinnedEstimate<AxisT...> rtn(numer.binning());
1115 if (numer.path() == denom.path()) rtn.setPath(numer.path());
1116 if (rtn.hasAnnotation("ScaledBy")) rtn.rmAnnotation("ScaledBy");
1117
1118 for (const auto& b_num : numer.bins(true, true)) {
1119 const size_t idx = b_num.index();
1120 rtn.bin(idx) = divide(b_num, denom.bin(idx), pat_uncorr);
1121 }
1122 rtn.maskBins(denom.maskedBins(), true);
1123
1124 return rtn;
1125 }
const BinningT & binning() const noexcept
Returns dimension underlying binning object reference.

References YODA::BinnedStorage< BinContentT, AxisT >::bin(), YODA::BinnedStorage< BinContentT, AxisT >::binning(), YODA::BinnedStorage< BinContentT, AxisT >::bins(), divide(), YODA::BinnedStorage< BinContentT, AxisT >::maskedBins(), and YODA::AnalysisObject::path().

◆ divide() [4/6]

Estimate0D YODA::divide ( const Counter numer,
const Counter denom 
)

Divide two counters, with an uncorrelated error treatment.

Todo:
Add skipnullpts extra optional arg

Definition at line 19 of file Counter.cc.

19 {
20 Estimate0D rtn;
21 if (numer.path() == denom.path()) rtn.setPath(numer.path());
22 if (rtn.hasAnnotation("ScaledBy")) rtn.rmAnnotation("ScaledBy");
23 if (denom.val() != 0) {
24 const double val = numer.val() / denom.val();
25 const double err = val * add_quad(numer.relErr(), denom.relErr());
26 rtn.set(val, {-err, err});
27 }
28 return rtn;
29 }
void setPath(const std::string &path)
void rmAnnotation(const std::string &name)
Delete an annotation by name.
bool hasAnnotation(const std::string &name) const
Check if an annotation is defined.
double relErr() const
Definition Counter.h:198
double val(bool=false) const
Get the value.
Definition Counter.h:189
An estimate in 0D.
Definition Estimate0D.h:24
void set(const double val, const std::pair< double, double > &err, const std::string source="")
Set both central value and uncertainty component.
Definition Estimate.h:181
Num add_quad(Num a, Num b)
Named number-type addition in quadrature operation.
Definition MathUtils.h:222

References add_quad(), YODA::AnalysisObject::hasAnnotation(), YODA::AnalysisObject::path(), YODA::Counter::relErr(), YODA::AnalysisObject::rmAnnotation(), YODA::Estimate::set(), YODA::AnalysisObject::setPath(), and YODA::Counter::val().

◆ divide() [5/6]

Estimate YODA::divide ( const Estimate numer,
const Estimate denom,
const std::string &  pat_uncorr = "^stat|^uncor" 
)
inline

Divide two Estimate objects.

Definition at line 600 of file Estimate.h.

601 {
602
603 Estimate rtn;
604 if (denom.val()) rtn.setVal(numer.val() / denom.val());
605 const double newVal = rtn.val();
606
607 // get error sources
608 std::vector<std::string> sources = numer.sources();
609 std::vector<std::string> tmp = denom.sources();
610 sources.insert(std::end(sources),
611 std::make_move_iterator(std::begin(tmp)),
612 std::make_move_iterator(std::end(tmp)));
613 sources.erase( std::unique(sources.begin(), sources.end()), sources.end() );
614
615 std::smatch match;
616 const std::regex re(pat_uncorr);
617 for (const std::string& src : sources) {
618 if (std::regex_search(src, match, re)) {
619 // treat as uncorrelated between AOs:
620 // add relative errors in quadrature
621 double n_dn = 0.0, n_up = 0.0;
622 if (numer.hasSource(src)) {
623 n_dn = numer.relErrDown(src);
624 n_up = numer.relErrUp(src);
625 }
626 double d_dn = 0.0, d_up = 0.0;
627 if (denom.hasSource(src)) {
628 d_dn = denom.relErrDown(src);
629 d_up = denom.relErrUp(src);
630 }
631 const double new_dn = fabs(newVal) * std::sqrt(n_dn*n_dn + d_dn*d_dn);
632 const double new_up = fabs(newVal) * std::sqrt(n_up*n_up + d_up*d_up);
633 rtn.setErr({-new_dn,new_up}, src);
634 }
635 else {
636 // treat as correlated between AOs:
637 // work out correlated ratio: R+dR = (N+dN)/(D+dD)
638 double n_dn = numer.val(), n_up = numer.val();
639 if (numer.hasSource(src)) {
640 n_dn += numer.errDown(src);
641 n_up += numer.errUp(src);
642 }
643 double d_dn = denom.val(), d_up = denom.val();
644 if (denom.hasSource(src)) {
645 d_dn += denom.errDown(src);
646 d_up += denom.errUp(src);
647 }
648 double new_dn = std::numeric_limits<double>::quiet_NaN();
649 double new_up = std::numeric_limits<double>::quiet_NaN();
650 if (d_dn) new_dn = n_dn / d_dn - newVal;
651 if (d_up) new_up = n_up / d_up - newVal;
652 rtn.setErr({new_dn, new_up}, src);
653 }
654 }
655
656 return rtn;
657 }
A point estimate (base class for the Estimate)
Definition Estimate.h:29
void setErr(const std::pair< double, double > &err, const std::string &source="")
Set a signed uncertainty component.
Definition Estimate.h:165
std::vector< std::string > sources() const noexcept
Definition Estimate.h:408
double errDown(const std::string &source="") const
The signed error due to the systematic downward variation.
Definition Estimate.h:272
double relErrUp(const std::string &source="") const
The relative positive on the central value.
Definition Estimate.h:305
double errUp(const std::string &source="") const
The signed error due to the systematic upward variation.
Definition Estimate.h:277
double val() const noexcept
The central value.
Definition Estimate.h:238
void setVal(const double val) noexcept
Alias for setValue.
Definition Estimate.h:162
double relErrDown(const std::string &source="") const
The relative negative on the central value.
Definition Estimate.h:300
bool hasSource(const std::string &key) const noexcept
Definition Estimate.h:414

References YODA::Estimate::errDown(), YODA::Estimate::errUp(), YODA::Estimate::hasSource(), YODA::Estimate::relErrDown(), YODA::Estimate::relErrUp(), YODA::Estimate::setErr(), YODA::Estimate::setVal(), YODA::Estimate::sources(), and YODA::Estimate::val().

◆ divide() [6/6]

Estimate0D YODA::divide ( const Estimate0D numer,
const Estimate0D denom,
const std::string &  pat_uncorr = "^stat|^uncor" 
)
inline

Divide two Estimate0D objects.

Definition at line 325 of file Estimate0D.h.

326 {
327 Estimate0D rtn = divide(static_cast<const Estimate&>(numer),
328 static_cast<const Estimate&>(denom), pat_uncorr);
329 if (rtn.hasAnnotation("ScaledBy")) rtn.rmAnnotation("ScaledBy");
330 if (numer.path() == denom.path()) rtn.setPath(numer.path());
331 return rtn;
332 }
BinnedEstimate< AxisT... > divide(const BinnedDbn< DbnN, AxisT... > &numer, const BinnedDbn< DbnN, AxisT... > &denom)
Divide two BinnedDbn objects.
Definition BinnedDbn.h:1090

References divide(), YODA::AnalysisObject::hasAnnotation(), YODA::AnalysisObject::path(), YODA::AnalysisObject::rmAnnotation(), and YODA::AnalysisObject::setPath().

◆ efficiency() [1/5]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::efficiency ( const BinnedDbn< DbnN, AxisT... > &  accepted,
const BinnedDbn< DbnN, AxisT... > &  total 
)
inline

Calculate a binned efficiency ratio of two BinnedDbn objects.

Note
An efficiency is not the same thing as a standard division of two BinnedDbn objects: the errors are treated as correlated via binomial statistics.
Note
Neither effNumEntries nor sumW are guaranteed to satisfy num <= den for general weights!

Definition at line 1160 of file BinnedDbn.h.

1160 {
1161
1162 if (accepted != total) {
1163 throw BinningError("Arithmetic operation requires compatible binning!");
1164 }
1165
1166 BinnedEstimate<AxisT...> rtn = divide(accepted, total);
1167
1168 for (const auto& b_acc : accepted.bins(true, true)) {
1169 const auto& b_tot = total.bin(b_acc.index());
1170 auto& b_rtn = rtn.bin(b_acc.index());
1171
1172 // Check that the numerator is consistent with being a subset of the denominator
1174 if (b_acc.numEntries() > b_tot.numEntries())
1175 throw UserError("Attempt to calculate an efficiency when the numerator is not a subset of the denominator: "
1176 + Utils::toStr(b_acc.numEntries()) + " entries / " + Utils::toStr(b_tot.numEntries()) + " entries");
1177
1178 // If no entries on the denominator, set eff = err = 0 and move to the next bin
1179 double eff = std::numeric_limits<double>::quiet_NaN();
1180 double err = std::numeric_limits<double>::quiet_NaN();
1181 try {
1182 if (b_tot.sumW()) {
1183 eff = b_rtn.val();
1184 err = sqrt(abs( ((1-2*eff)*b_acc.sumW2() + sqr(eff)*b_tot.sumW2()) / sqr(b_tot.sumW()) ));
1185 }
1186 } catch (const LowStatsError& e) {
1187 //
1188 }
1189
1190 b_rtn.setErr({-err, err}); // @todo put "stats" as source?
1191 }
1192 return rtn;
1193 }

References YODA::BinnedStorage< BinContentT, AxisT >::bin(), YODA::BinnedStorage< BinContentT, AxisT >::bins(), divide(), and sqr().

Referenced by efficiency(), and efficiency().

◆ efficiency() [2/5]

template<typename... AxisT>
BinnedEstimate< AxisT... > YODA::efficiency ( const BinnedEstimate< AxisT... > &  accepted,
const BinnedEstimate< AxisT... > &  total,
const std::string &  pat_uncorr = "^stat|^uncor" 
)
inline

Calculate a binned efficiency ratio of two BinnedEstimate objects.

Note
An efficiency is not the same thing as a standard division of two BinnedEstimate objects: the errors are treated as correlated via binomial statistics.

Definition at line 1162 of file BinnedEstimate.h.

1163 {
1164
1165 if (accepted != total) {
1166 throw BinningError("Arithmetic operation requires compatible binning!");
1167 }
1168
1169 BinnedEstimate<AxisT...> rtn(accepted.binning());
1170
1171 for (const auto& b_acc : accepted.bins(true, true)) {
1172 Estimate est;
1173 const size_t idx = b_acc.index();
1174 try {
1175 est = efficiency(b_acc, total.bin(idx), pat_uncorr);
1176 } catch (const UserError& e) {
1177 //
1178 }
1179 rtn.bin(idx).set(est);
1180 }
1181 return rtn;
1182 }

References YODA::BinnedStorage< BinContentT, AxisT >::bin(), YODA::BinnedStorage< BinContentT, AxisT >::binning(), YODA::BinnedStorage< BinContentT, AxisT >::bins(), and efficiency().

◆ efficiency() [3/5]

Estimate0D YODA::efficiency ( const Counter accepted,
const Counter total 
)

Calculate an efficiency ratio of two counters.

Todo:
Add divide functions/operators on pointers

Note that an efficiency is not the same thing as a standard division of two histograms: the errors must be treated as correlated

Todo:
Add skipnullpts extra optional arg
Todo:
Provide optional alt behaviours to fill with NaN or remove the invalid point, or...
Todo:
Todo:
Or throw a LowStatsError exception if h.effNumEntries() (or sumW()?) == 0?
Todo:
Provide optional alt behaviours to fill with NaN or remove the invalid point, or...
Todo:
Todo:
Or throw a LowStatsError exception if h.effNumEntries() (or sumW()?) == 0?

Definition at line 34 of file Counter.cc.

34 {
35 Estimate0D tmp = divide(accepted, total);
36
37 // Check that the numerator is consistent with being a subset of the denominator (NOT effNumEntries here!)
38 if (accepted.numEntries() > total.numEntries() || accepted.sumW() > total.sumW())
39 throw UserError("Attempt to calculate an efficiency when the numerator is not a subset of the denominator");
40
41 // If no entries on the denominator, set eff = err = 0 and move to the next bin
44 double eff = std::numeric_limits<double>::quiet_NaN();
45 double err = std::numeric_limits<double>::quiet_NaN();
46 if (total.sumW() != 0) {
47 eff = accepted.sumW() / total.sumW(); //< Actually this is already calculated by the division...
48 err = sqrt(abs( ((1-2*eff)*accepted.sumW2() + sqr(eff)*total.sumW2()) / sqr(total.sumW()) ));
49 }
50
51 tmp.set(eff, {-err, err});
52 return tmp;
53 }
double sumW2(bool=false) const
Get the sum of squared weights.
Definition Counter.h:186
double numEntries(bool=false) const
Get the number of fills.
Definition Counter.h:177
double sumW(bool=false) const
Get the sum of weights.
Definition Counter.h:183
Error for problems introduced outside YODA, to put it nicely.
Definition Exceptions.h:100

References divide(), YODA::Counter::numEntries(), YODA::Estimate::set(), sqr(), YODA::Counter::sumW(), and YODA::Counter::sumW2().

◆ efficiency() [4/5]

Estimate YODA::efficiency ( const Estimate accepted,
const Estimate total,
const std::string &  pat_uncorr = "^stat|^uncor" 
)
inline

Divide two Estimate objects using binomial statistics.

Check that the numerator is consistent with being a subset of the denominator

Todo:
Need to check that bins are all positive? Integral could be zero due to large +ve/-ve in different bins :O

Definition at line 680 of file Estimate.h.

681 {
682
686 const double acc_val = accepted.val();
687 const double tot_val = total.val();
688 if (acc_val > tot_val)
689 throw UserError("Attempt to calculate an efficiency when the numerator is not a subset of the denominator: "
690 + Utils::toStr(acc_val) + " / " + Utils::toStr(tot_val));
691
692 Estimate rtn = divide(accepted, total, pat_uncorr);
693
694 // get error sources
695 std::vector<std::string> sources = accepted.sources();
696 std::vector<std::string> tmp = total.sources();
697 sources.insert(std::end(sources),
698 std::make_move_iterator(std::begin(tmp)),
699 std::make_move_iterator(std::end(tmp)));
700 sources.erase( std::unique(sources.begin(), sources.end()), sources.end() );
701
702 // set binomial error for uncorrelated error sources
703 std::smatch match;
704 const double eff = rtn.val();
705 const std::regex re(pat_uncorr);
706 for (const std::string& src : sources) {
707 double err = std::numeric_limits<double>::quiet_NaN();
708 if (!tot_val) {
709 rtn.setErr({-err,err}, src);
710 continue;
711 }
712 else if (std::regex_search(src, match, re)) {
713 const double acc_err = accepted.relTotalErrAvg();
714 const double tot_err = total.totalErrAvg();
715 err = sqrt(std::abs( ((1-2*eff)*sqr(acc_err) + sqr(eff)*sqr(tot_err)) / sqr(tot_val) ));
716 rtn.setErr({-err,err}, src);
717 continue;
718 }
719 }
720
721 return rtn;
722 }
double totalErrAvg() const
The average total uncertainty.
Definition Estimate.h:376
double relTotalErrAvg() const noexcept
The average uncertainty component.
Definition Estimate.h:404

References divide(), YODA::Estimate::relTotalErrAvg(), YODA::Estimate::setErr(), YODA::Estimate::sources(), sqr(), YODA::Estimate::totalErrAvg(), and YODA::Estimate::val().

◆ efficiency() [5/5]

Estimate0D YODA::efficiency ( const Estimate0D accepted,
const Estimate0D total,
const std::string &  pat_uncorr = "^stat|^uncor" 
)
inline

Divide two Estimate0D objects using binomial statistics.

Definition at line 355 of file Estimate0D.h.

356 {
357 Estimate0D rtn = efficiency(static_cast<const Estimate&>(accepted),
358 static_cast<const Estimate&>(total), pat_uncorr);
359 if (rtn.hasAnnotation("ScaledBy")) rtn.rmAnnotation("ScaledBy");
360 if (accepted.path() == total.path()) rtn.setPath(total.path());
361 return rtn;
362 }
BinnedEstimate< AxisT... > efficiency(const BinnedDbn< DbnN, AxisT... > &accepted, const BinnedDbn< DbnN, AxisT... > &total)
Calculate a binned efficiency ratio of two BinnedDbn objects.
Definition BinnedDbn.h:1160

References efficiency(), YODA::AnalysisObject::hasAnnotation(), YODA::AnalysisObject::path(), YODA::AnalysisObject::rmAnnotation(), and YODA::AnalysisObject::setPath().

◆ effNumEntries() [1/2]

double YODA::effNumEntries ( const double  sumW,
const double  sumW2 
)
inline

Calculate the effective number of entries of a sample.

Definition at line 375 of file MathUtils.h.

375 {
376 if (isZero(sumW2)) return 0;
377 return sqr(sumW) / sumW2;
378 }
std::enable_if_t< std::is_floating_point_v< NUM >, bool > isZero(NUM val, double tolerance=1e-8)
Compare a number to zero.
Definition MathUtils.h:63

References isZero(), and sqr().

Referenced by effNumEntries(), YODA::DbnBase< N >::relErrW(), YODA::DbnBase< N >::relStdErr(), RMS(), stdErr(), stdErr(), and variance().

◆ effNumEntries() [2/2]

double YODA::effNumEntries ( const std::vector< double > &  weights)
inline

Calculate the effective number of entries of a sample.

Definition at line 381 of file MathUtils.h.

381 {
382 double sumW = 0.0, sumW2 = 0.0;
383 for (size_t i = 0; i < weights.size(); ++i) {
384 sumW += weights[i];
385 sumW2 += sqr(weights[i]);
386 }
387 return effNumEntries(sumW, sumW2);
388 }

References effNumEntries(), and sqr().

◆ fuzzyEquals() [1/2]

template<typename N1 , typename N2 >
std::enable_if_t< std::is_arithmetic_v< N1 > &&std::is_arithmetic_v< N2 > &&(std::is_floating_point_v< N1 >||std::is_floating_point_v< N2 >), bool > YODA::fuzzyEquals ( N1  a,
N2  b,
double  tolerance = 1e-5 
)
inline

Compare two numbers for equality with a degree of fuzziness.

This version for floating point types (if any argument is FP) has a degree of fuzziness expressed by the fractional tolerance parameter, for floating point safety.

Definition at line 96 of file MathUtils.h.

96 {
97 const double absavg = (std::abs(a) + std::abs(b))/2.0;
98 const double absdiff = std::abs(a - b);
99 const bool rtn = (isZero(a) && isZero(b)) || absdiff < tolerance*absavg;
100 return rtn;
101 }

References isZero().

Referenced by YODA::Axis< T, isCAxis< T > >::Axis(), fuzzyGtrEquals(), fuzzyLessEquals(), YODA::Axis< T, isCAxis< T > >::hasSameEdges(), and operator==().

◆ fuzzyEquals() [2/2]

template<typename N1 , typename N2 >
std::enable_if_t< std::is_integral_v< N1 > &&std::is_integral_v< N2 >, bool > YODA::fuzzyEquals ( N1  a,
N2  b,
double   
)
inline

Compare two numbers for equality with a degree of fuzziness.

Simpler SFINAE template specialisation for integers, since there is no FP precision issue.

Definition at line 110 of file MathUtils.h.

110 { //< NB. unused tolerance parameter for ints, still needs a default value!
111 return a == b;
112 }

◆ fuzzyGtrEquals()

template<typename N1 , typename N2 >
std::enable_if_t< std::is_arithmetic_v< N1 > &&std::is_arithmetic_v< N2 >, bool > YODA::fuzzyGtrEquals ( N1  a,
N2  b,
double  tolerance = 1e-5 
)
inline

Compare two numbers for >= with a degree of fuzziness.

The tolerance parameter on the equality test is as for fuzzyEquals.

Definition at line 125 of file MathUtils.h.

125 {
126 return a > b || fuzzyEquals(a, b, tolerance);
127 }
std::enable_if_t< std::is_arithmetic_v< N1 > &&std::is_arithmetic_v< N2 > &&(std::is_floating_point_v< N1 >||std::is_floating_point_v< N2 >), bool > fuzzyEquals(N1 a, N2 b, double tolerance=1e-5)
Compare two numbers for equality with a degree of fuzziness.
Definition MathUtils.h:96

References fuzzyEquals().

Referenced by YODA::Axis< T, isCAxis< T > >::Axis().

◆ fuzzyLessEquals()

template<typename N1 , typename N2 >
std::enable_if_t< std::is_arithmetic_v< N1 > &&std::is_arithmetic_v< N2 >, bool > YODA::fuzzyLessEquals ( N1  a,
N2  b,
double  tolerance = 1e-5 
)
inline

Compare two floating point numbers for <= with a degree of fuzziness.

The tolerance parameter on the equality test is as for fuzzyEquals.

Definition at line 135 of file MathUtils.h.

135 {
136 return a < b || fuzzyEquals(a, b, tolerance);
137 }

References fuzzyEquals().

Referenced by variance().

◆ getDataPath()

string YODA::getDataPath ( )

Get the path to the installed share/YODA/ data directory.

Definition at line 26 of file Paths.cc.

26 {
27 BrInitError error;
28 br_init_lib(&error);
29 char* temp = br_find_data_dir(DEFAULTDATADIR);
30 const string sharedir(temp);
31 free(temp);
32 return sharedir + "/YODA";
33 }
#define br_find_data_dir
Definition binreloc.h:47
BrInitError
Definition binreloc.h:22
#define br_init_lib
Definition binreloc.h:41

References br_find_data_dir, and br_init_lib.

Referenced by getYodaDataPath().

◆ getLibPath()

string YODA::getLibPath ( )

Get the path to the directory containing libYODA.

Definition at line 17 of file Paths.cc.

17 {
18 BrInitError error;
19 br_init_lib(&error);
20 char* temp = br_find_lib_dir(DEFAULTLIBDIR);
21 const string libdir(temp);
22 free(temp);
23 return libdir;
24 }
#define br_find_lib_dir
Definition binreloc.h:49

References br_find_lib_dir, and br_init_lib.

◆ getYodaDataPath()

vector< string > YODA::getYodaDataPath ( )

YODA data paths.

Definition at line 35 of file Paths.cc.

35 {
36 vector<string> dirs;
37 // Use the YODA data path variable if set...
38 const char* env = getenv("YODA_DATA_PATH");
39 if (env) dirs = Utils::pathsplit(env);
40 // ... then, unless the path ends in :: ...
41 if (!env || strlen(env) < 2 || string(env).substr(strlen(env)-2) != "::") {
42 // ... fall back to the YODA data install path
43 dirs.push_back(getDataPath());
44 }
45 return dirs;
46 }
std::string getDataPath()
Get the path to the installed share/YODA/ data directory.
Definition Paths.cc:26

References getDataPath().

◆ index_between()

template<typename NUM >
int YODA::index_between ( const NUM &  val,
const std::vector< NUM > &  binedges 
)
inline

Return the bin index of the given value, val, given a vector of bin edges.

NB. The binedges vector must be sorted

Definition at line 355 of file MathUtils.h.

355 {
356 if (!inRange(val, binedges.front(), binedges.back())) return -1; //< Out of histo range
357 int index = -1;
358 for (size_t i = 1; i < binedges.size(); ++i) {
359 if (val < binedges[i]) {
360 index = i-1;
361 break;
362 }
363 }
364 assert(inRange(index, -1, binedges.size()-1));
365 return index;
366 }
bool inRange(NUM value, NUM low, NUM high, RangeBoundary lowbound=CLOSED, RangeBoundary highbound=OPEN)
Determine if value is in the range low to high, for floating point numbers.
Definition MathUtils.h:164

References inRange().

◆ inRange() [1/4]

bool YODA::inRange ( int  value,
int  low,
int  high,
RangeBoundary  lowbound = CLOSED,
RangeBoundary  highbound = CLOSED 
)
inline

Determine if value is in the range low to high, for integer types.

Interval boundary types are defined by lowbound and highbound.

Todo:
Optimise to one-line at compile time?

Definition at line 189 of file MathUtils.h.

190 {
191 if (lowbound == OPEN && highbound == OPEN) {
192 return (value > low && value < high);
193 } else if (lowbound == OPEN && highbound == CLOSED) {
194 return (value > low && value <= high);
195 } else if (lowbound == CLOSED && highbound == OPEN) {
196 return (value >= low && value < high);
197 } else { // if (lowbound == CLOSED && highbound == CLOSED) {
198 return (value >= low && value <= high);
199 }
200 }

References CLOSED, and OPEN.

◆ inRange() [2/4]

bool YODA::inRange ( int  value,
std::pair< int, int >  lowhigh,
RangeBoundary  lowbound = CLOSED,
RangeBoundary  highbound = OPEN 
)
inline

Alternative version of inRange for ints, which accepts a pair for the range arguments.

Definition at line 203 of file MathUtils.h.

204 {
205 return inRange(value, lowhigh.first, lowhigh.second, lowbound, highbound);
206 }

References inRange().

◆ inRange() [3/4]

template<typename NUM >
bool YODA::inRange ( NUM  value,
NUM  low,
NUM  high,
RangeBoundary  lowbound = CLOSED,
RangeBoundary  highbound = OPEN 
)
inline

Determine if value is in the range low to high, for floating point numbers.

Interval boundary types are defined by lowbound and highbound.

Todo:
Optimise to one-line at compile time?

Definition at line 164 of file MathUtils.h.

165 {
166 if (lowbound == OPEN && highbound == OPEN) {
167 return (value > low && value < high);
168 } else if (lowbound == OPEN && highbound == CLOSED) {
169 return (value > low && value <= high);
170 } else if (lowbound == CLOSED && highbound == OPEN) {
171 return (value >= low && value < high);
172 } else { // if (lowbound == CLOSED && highbound == CLOSED) {
173 return (value >= low && value <= high);
174 }
175 }

References CLOSED, and OPEN.

Referenced by index_between(), inRange(), and inRange().

◆ inRange() [4/4]

template<typename NUM >
bool YODA::inRange ( NUM  value,
std::pair< NUM, NUM >  lowhigh,
RangeBoundary  lowbound = CLOSED,
RangeBoundary  highbound = OPEN 
)
inline

Alternative version of inRange for doubles, which accepts a pair for the range arguments.

Definition at line 179 of file MathUtils.h.

180 {
181 return inRange(value, lowhigh.first, lowhigh.second, lowbound, highbound);
182 }

References inRange().

◆ isNaN()

template<typename NUM >
std::enable_if_t< std::is_floating_point_v< NUM >, bool > YODA::isNaN ( NUM  val)
inline

Check if a number is NaN.

Definition at line 80 of file MathUtils.h.

80{ return std::isnan(val); }

◆ isZero() [1/2]

template<typename NUM >
std::enable_if_t< std::is_floating_point_v< NUM >, bool > YODA::isZero ( NUM  val,
double  tolerance = 1e-8 
)
inline

Compare a number to zero.

This version for floating point types has a degree of fuzziness expressed by the absolute tolerance parameter, for floating point safety.

Definition at line 63 of file MathUtils.h.

63 {
64 return fabs(val) < tolerance;
65 }

Referenced by effNumEntries(), fuzzyEquals(), and sign().

◆ isZero() [2/2]

template<typename NUM >
std::enable_if_t< std::is_integral_v< NUM >, bool > YODA::isZero ( NUM  val,
double  = 1e-5 
)
inline

Compare a number to zero.

SFINAE template specialisation for integers, since there is no FP precision issue.

Definition at line 73 of file MathUtils.h.

73 {
74 return val==0;
75 }

◆ linspace()

std::vector< double > YODA::linspace ( size_t  nbins,
double  xmin,
double  xmax,
bool  include_end = true 
)
inline

Make a list of nbins + 1 values uniformly spaced between xmin and xmax inclusive.

Note
The arg ordering and the meaning of the nbins variable is "histogram-like", as opposed to the Numpy/Matlab version.

Definition at line 261 of file MathUtils.h.

261 {
262 if (xmax < xmin) throw RangeError("xmax should not be smaller than xmin!");
263 if (nbins == 0) throw RangeError("Requested number of bins is 0!");
264 std::vector<double> rtn;
265 const double interval = (xmax-xmin)/static_cast<double>(nbins);
266 for (size_t i = 0; i < nbins; ++i) {
267 rtn.push_back(xmin + i*interval);
268 }
269 assert(rtn.size() == nbins);
270 if (include_end) rtn.push_back(xmax); // exact xmax, not result of n * interval
271 return rtn;
272 }
Error for e.g. use of invalid bin ranges.
Definition Exceptions.h:34

Referenced by logspace(), and pdfspace().

◆ logspace()

std::vector< double > YODA::logspace ( size_t  nbins,
double  xmin,
double  xmax,
bool  include_end = true 
)
inline

Make a list of nbins + 1 values uniformly spaced in log(x) between xmin and xmax inclusive.

Note
The arg ordering and the meaning of the nbins variable is "histogram-like", as opposed to the Numpy/Matlab version, and the xmin and xmax arguments are expressed in "normal" space, rather than as the logarithms of the xmin/xmax values as in Numpy/Matlab.

Definition at line 280 of file MathUtils.h.

280 {
281 if (xmax < xmin) throw RangeError("xmax should not be smaller than xmin!");
282 if (xmin < 0) throw RangeError("xmin should not be negative!");
283 if (nbins == 0) throw RangeError("Requested number of bins is 0!");
284 const double logxmin = std::log(xmin);
285 const double logxmax = std::log(xmax);
286 const std::vector<double> logvals = linspace(nbins, logxmin, logxmax);
287 assert(logvals.size() == nbins+1);
288 std::vector<double> rtn; rtn.reserve(logvals.size());
289 rtn.push_back(xmin);
290 for (size_t i = 1; i < logvals.size()-1; ++i) {
291 rtn.push_back(std::exp(logvals[i]));
292 }
293 assert(rtn.size() == nbins);
294 if (include_end) rtn.push_back(xmax);
295 return rtn;
296 }
std::vector< double > linspace(size_t nbins, double xmin, double xmax, bool include_end=true)
Make a list of nbins + 1 values uniformly spaced between xmin and xmax inclusive.
Definition MathUtils.h:261

References linspace().

◆ mean() [1/3]

double YODA::mean ( const double  sumWX,
const double  sumW 
)
inline

Calculate the weighted mean of a sample.

Definition at line 400 of file MathUtils.h.

400 {
401 return sumW? sumWX / sumW : std::numeric_limits<double>::quiet_NaN();
402 }

◆ mean() [2/3]

double YODA::mean ( const std::vector< double > &  sample,
const std::vector< double > &  weights 
)
inline

Calculate the weighted mean of a sample.

Definition at line 405 of file MathUtils.h.

406 {
407 if (sample.size() != weights.size()) throw RangeError("Inputs should have equal length!");
408 double sumWX = 0., sumW = 0.;
409 for (size_t i = 0; i < sample.size(); ++i) {
410 sumW += weights[i];
411 sumWX += weights[i]*sample[i];
412 }
413 return mean(sumWX, sumW);
414 }

References mean().

◆ mean() [3/3]

double YODA::mean ( const std::vector< int > &  sample)
inline

Calculate the mean of a sample.

Definition at line 391 of file MathUtils.h.

391 {
392 double mean = 0.0;
393 for (size_t i=0; i<sample.size(); ++i) {
394 mean += sample[i];
395 }
396 return mean/sample.size();
397 }

References mean().

Referenced by covariance(), YODA::DbnBase< N >::mean(), mean(), mean(), YODA::DbnBase< N >::relStdErr(), YODA::XDbnMixin< Derived >::xMean(), YODA::XStatsMixin< Derived >::xMean(), YODA::YDbnMixin< Derived >::yMean(), YODA::YStatsMixin< Derived >::yMean(), YODA::ZDbnMixin< Derived >::zMean(), and YODA::ZStatsMixin< Derived >::zMean().

◆ mkAxisConfig()

template<typename A , typename... As>
std::string YODA::mkAxisConfig ( )

Helper function to construct the axis config.

Definition at line 58 of file BinningUtils.h.

58 {
59 return (std::string(TypeID<A>::name()) + ... + TypeID<As>::name());
60 }
Returns the type ID as a character sequence.

◆ mkIntegral()

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::mkIntegral ( const BinnedDbn< DbnN, AxisT... > &  histo,
const bool  includeOverflows = true 
)
inline

Convert a Histo1D to a Scatter2D representing the integral of the histogram.

Note
The integral histo errors are calculated as sqrt(binvalue), as if they are uncorrelated. This is not in general true for integral histograms, so if you need accurate errors you should explicitly monitor bin-to-bin correlations.

The includeunderflow param chooses whether the underflow bin is included in the integral numbers as an offset.

Definition at line 1214 of file BinnedDbn.h.

1214 {
1215
1216 BinnedEstimate<AxisT...> rtn = histo.mkEstimate();
1217
1218 double sumW = 0.0, sumW2 = 0.0;
1219 for (const auto& b : histo.bins(includeOverflows)) {
1220 sumW += b.sumW();
1221 sumW2 += b.sumW2();
1222 const double e = sqrt(sumW2);
1223 rtn.bin(b.index()).set(sumW, {-e, e});
1224 }
1225
1226 return rtn;
1227 }
Forward declaration.

References YODA::BinnedStorage< BinContentT, AxisT >::bins(), and YODA::DbnStorage< DbnN, AxisT >::mkEstimate().

Referenced by mkIntegralEff().

◆ mkIntegralEff()

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::mkIntegralEff ( const BinnedDbn< DbnN, AxisT... > &  histo,
const bool  includeOverflows = true 
)
inline

Convert a Histo1D to a Scatter2D where each bin is a fraction of the total.

Note
This sounds weird: let's explain a bit more! Sometimes we want to take a histo h, make an integral histogram H from it, and then divide H by the total integral of h, such that every bin in H represents the cumulative efficiency of that bin as a fraction of the total. I.e. an integral histo, scaled by 1/total_integral and with binomial errors.

The includeunderflow param behaves as for toIntegral, and applies to both the initial integration and the integral used for the scaling. The includeoverflow param applies only to obtaining the scaling factor.

Todo:
Or throw a LowStatsError exception if h.effNumEntries() == 0?
Todo:
Todo:
Provide optional alt behaviours
Todo:
Todo:
Need to check that bins are all positive? Integral could be zero due to large +ve/-ve in different bins :O

Definition at line 1243 of file BinnedDbn.h.

1243 {
1244
1245 BinnedEstimate<AxisT...> rtn = mkIntegral(histo, includeOverflows);
1246 const double integral = histo.integral(includeOverflows);
1247
1248 // If the integral is empty, the (integrated) efficiency values may as well all be zero, so return here
1252 if (!integral) return rtn;
1253
1254 const double integral_err = histo.integralError(includeOverflows);
1255 for (const auto& b : rtn.bins(includeOverflows)) {
1256 const double eff = b.val() / integral;
1257 const double err = sqrt(std::abs( ((1-2*eff)*sqr(b.relTotalErrAvg()) + sqr(eff)*sqr(integral_err)) / sqr(integral) ));
1258 b.set(eff, {-err,err});
1259 }
1260
1261 return rtn;
1262 }
double integralError(const bool includeOverflows=true) const noexcept
Get the total volume error of the histogram.
Definition BinnedDbn.h:468
double integral(const bool includeOverflows=true) const noexcept
Get the total volume of the histogram.
Definition BinnedDbn.h:463
BinnedEstimate< AxisT... > mkIntegral(const BinnedDbn< DbnN, AxisT... > &histo, const bool includeOverflows=true)
Convert a Histo1D to a Scatter2D representing the integral of the histogram.
Definition BinnedDbn.h:1214

References YODA::DbnStorage< DbnN, AxisT >::integral(), YODA::DbnStorage< DbnN, AxisT >::integralError(), mkIntegral(), and sqr().

◆ mkReader()

Reader & YODA::mkReader ( const std::string &  format_name)

Factory function to make a reader object by format name or a filename.

<

Todo:
Improve/remove... .ydat?

<

Todo:
Improve/remove... .ydat?

Definition at line 15 of file Reader.cc.

15 {
16 // Determine the format from the string (a file or file extension)
17 const size_t lastdot = name.find_last_of(".");
18 string fmt = Utils::toLower(lastdot == string::npos ? name : name.substr(lastdot+1));
19 if (fmt == "gz") {
20 #ifndef HAVE_LIBZ
21 throw UserError("YODA was compiled without zlib support: can't read " + name);
22 #endif
23 const size_t lastbutonedot = (lastdot == string::npos) ? string::npos : name.find_last_of(".", lastdot-1);
24 fmt = Utils::toLower(lastbutonedot == string::npos ? name : name.substr(lastbutonedot+1));
25 }
26 // Create the appropriate Reader
27 if (Utils::startswith(fmt, "yoda")) return ReaderYODA::create();
28 if (Utils::startswith(fmt, "dat" )) return ReaderFLAT::create();
29 if (Utils::startswith(fmt, "flat")) return ReaderFLAT::create();
30 throw UserError("Format cannot be identified from string '" + name + "'");
31 }

References YODA::ReaderFLAT::create(), and YODA::ReaderYODA::create().

Referenced by read(), and read().

◆ mkScatter()

Scatter1D YODA::mkScatter ( const Counter c)

Make a Scatter1D representation of a Histo1D.

Definition at line 8 of file Scatter.cc.

8 {
9 Scatter1D rtn;
10 for (const std::string& a : c.annotations())
11 rtn.setAnnotation(a, c.annotation(a));
12 rtn.setAnnotation("Type", c.type()); // might override the copied ones
13 Point1D pt(c.val(), c.err());
14 rtn.addPoint(pt);
15 return rtn;
16 }
virtual std::string type() const
Get name of the analysis object type.
void setAnnotation(const std::string &name, const T &value)
Add or set an annotation by name (templated for remaining types)
double err() const
Definition Counter.h:193
A 1D data point to be contained in a Scatter1D.
Definition Point.h:544
ScatterND< N > & addPoint(const PointND< N > &pt)
Insert a new point.
Definition Scatter.h:369

References YODA::ScatterND< N >::addPoint(), YODA::AnalysisObject::annotation(), YODA::AnalysisObject::annotations(), YODA::Counter::err(), YODA::AnalysisObject::setAnnotation(), YODA::AnalysisObject::type(), and YODA::Counter::val().

◆ mkTypeString() [1/2]

template<ssize_t DbnN, typename A , typename... As>
std::string YODA::mkTypeString ( )

Helper function to construct the BinnedDbn and BinnedEstimate type names.

Definition at line 65 of file BinningUtils.h.

65 {
66
67 constexpr size_t N = sizeof...(As)+1;
68
69 if constexpr (all_CAxes<A, As...>::value) {
70 if constexpr (DbnN < 0) {
71 return "Estimate"+std::to_string(N)+"D";
72 }
73 if constexpr (DbnN == N+1) {
74 return "Profile"+std::to_string(N)+"D";
75 }
76 if constexpr (DbnN == N) {
77 return "Histo"+std::to_string(N)+"D";
78 }
79 }
80
81 std::string type = "Binned";
82 if (DbnN < 0) type += "Estimate";
83 else if (DbnN == N) type += "Histo";
84 else if (DbnN == N+1) type += "Profile";
85 else type += "Dbn" + std::to_string(DbnN);
86
87 std::string axes = (TypeID<A>::name() + ... + (std::string{","} + TypeID<As>::name()));
88
89 return (type + "<" + axes + ">");
90 }
typename std::conjunction< std::is_floating_point< EdgeT >... > all_CAxes

References YODA::TypeID< T >::name().

Referenced by mkTypeString().

◆ mkTypeString() [2/2]

template<typename A , typename... As>
std::string YODA::mkTypeString ( )

Same as above, but for non-Dbn bin contents.

Definition at line 94 of file BinningUtils.h.

94{ return mkTypeString<-1, A, As...>(); }
std::string mkTypeString()
Helper function to construct the BinnedDbn and BinnedEstimate type names.

References mkTypeString().

◆ mkWriter()

Writer & YODA::mkWriter ( const std::string &  format_name)

Factory function to make a writer object by format name or a filename.

<

Todo:
Improve/remove... .ydat?

<

Todo:
Improve/remove... .ydat?

Definition at line 25 of file Writer.cc.

25 {
26 // Determine the format from the string (a file or file extension)
27 const size_t lastdot = name.find_last_of(".");
28 string fmt = Utils::toLower(lastdot == string::npos ? name : name.substr(lastdot+1));
29 const bool compress = (fmt == "gz");
30 //cout << "***" << compress << endl;
31 if (compress) {
32 #ifndef HAVE_LIBZ
33 throw UserError("YODA was compiled without zlib support: can't write " + name);
34 #endif
35 const size_t lastbutonedot = (lastdot == string::npos) ? string::npos : name.find_last_of(".", lastdot-1);
36 fmt = Utils::toLower(lastbutonedot == string::npos ? name : name.substr(lastbutonedot+1));
37 }
38 // Create the appropriate Writer
39 Writer* w = nullptr;
40 if (Utils::startswith(fmt, "yoda")) w = &WriterYODA::create();
41 if (Utils::startswith(fmt, "dat" )) w = &WriterFLAT::create();
42 if (Utils::startswith(fmt, "flat")) w = &WriterFLAT::create();
43 if (!w) throw UserError("Format cannot be identified from string '" + name + "'");
44 w->useCompression(compress);
45 return *w;
46 }

References YODA::WriterFLAT::create(), YODA::WriterYODA::create(), and YODA::Writer::useCompression().

Referenced by write(), write(), write(), write(), write(), and write().

◆ notNaN()

template<typename NUM >
std::enable_if_t< std::is_floating_point_v< NUM >, bool > YODA::notNaN ( NUM  val)
inline

Check if a number is non-NaN.

Definition at line 85 of file MathUtils.h.

85{ return !std::isnan(val); }

◆ nullifyIfDiscCoord() [1/2]

template<typename CoordT >
double YODA::nullifyIfDiscCoord ( CoordT &&  ,
std::false_type  ,
double  null = 0.0 
)

Nullifies coordinate if it is discrete.

Definition at line 19 of file Binning.h.

19 {
20 return null;
21 }

Referenced by containsNan().

◆ nullifyIfDiscCoord() [2/2]

template<typename CoordT >
double YODA::nullifyIfDiscCoord ( CoordT &&  coord,
std::true_type  ,
double  = 0.0 
)

Definition at line 24 of file Binning.h.

24 {
25 return std::forward<CoordT>(coord);
26 }

◆ operator!=()

template<size_t N>
bool YODA::operator!= ( const PointBase< N > &  a,
const PointBase< N > &  b 
)
inline

Inequality test.

Definition at line 494 of file Point.h.

494 {
495 return !(a == b);
496 }

◆ operator*() [1/3]

Weights YODA::operator* ( const Weights first,
const Weights second 
)
inline

Multiply two weights.

Definition at line 268 of file Weights.h.

268 {
269 Weights tmp = first;
270 tmp *= second;
271 return tmp;
272 }
A named, vectorised generalisation of an event weight.
Definition Weights.h:22

◆ operator*() [2/3]

Weights YODA::operator* ( const Weights w,
double  a 
)
inline

Multiply by a double.

Definition at line 290 of file Weights.h.

290 {
291 return a * w;
292 }

◆ operator*() [3/3]

Weights YODA::operator* ( double  a,
const Weights w 
)
inline

Multiply by a double.

Definition at line 283 of file Weights.h.

283 {
284 Weights tmp = w;
285 tmp *= a;
286 return tmp;
287 }

◆ operator+() [1/17]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator+ ( BinnedDbn< DbnN, AxisT... > &&  dbn,
BinnedEstimate< AxisT... > &&  est 
)
inline

Definition at line 1292 of file BinnedDbn.h.

1292 {
1293 return add(std::move(dbn), std::move(est));
1294 }

References add().

◆ operator+() [2/17]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator+ ( BinnedDbn< DbnN, AxisT... > &&  dbn,
const BinnedEstimate< AxisT... > &  est 
)
inline

Definition at line 1280 of file BinnedDbn.h.

1280 {
1281 return add(std::move(dbn), est);
1282 }

References add().

◆ operator+() [3/17]

template<size_t DbnN, typename... AxisT>
BinnedDbn< DbnN, AxisT... > YODA::operator+ ( BinnedDbn< DbnN, AxisT... >  first,
BinnedDbn< DbnN, AxisT... > &&  second 
)
inline

Add two BinnedDbn objects.

Definition at line 1058 of file BinnedDbn.h.

1058 {
1059 first += std::move(second);
1060 return first;
1061 }

◆ operator+() [4/17]

template<size_t DbnN, typename... AxisT>
BinnedDbn< DbnN, AxisT... > YODA::operator+ ( BinnedDbn< DbnN, AxisT... >  first,
const BinnedDbn< DbnN, AxisT... > &  second 
)
inline

Definition at line 1065 of file BinnedDbn.h.

1065 {
1066 first += second;
1067 return first;
1068 }

◆ operator+() [5/17]

template<typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator+ ( BinnedEstimate< AxisT... >  first,
BinnedEstimate< AxisT... > &&  second 
)
inline

Add two BinnedEstimates.

Definition at line 1083 of file BinnedEstimate.h.

1083 {
1084 first += std::move(second);
1085 return first;
1086 }

◆ operator+() [6/17]

template<typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator+ ( BinnedEstimate< AxisT... >  first,
const BinnedEstimate< AxisT... > &  second 
)
inline

Add two BinnedEstimates.

Definition at line 1074 of file BinnedEstimate.h.

1074 {
1075 first += second;
1076 return first;
1077 }

◆ operator+() [7/17]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator+ ( const BinnedDbn< DbnN, AxisT... > &  dbn,
BinnedEstimate< AxisT... > &&  est 
)
inline

Definition at line 1286 of file BinnedDbn.h.

1286 {
1287 return add(dbn, std::move(est));
1288 }

References add().

◆ operator+() [8/17]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator+ ( const BinnedDbn< DbnN, AxisT... > &  dbn,
const BinnedEstimate< AxisT... > &  est 
)
inline

Definition at line 1274 of file BinnedDbn.h.

1274 {
1275 return add(dbn, est);
1276 }

References add().

◆ operator+() [9/17]

Weights YODA::operator+ ( const Weights first,
const Weights second 
)
inline

Add two weights.

Definition at line 254 of file Weights.h.

254 {
255 Weights tmp = first;
256 tmp += second;
257 return tmp;
258 }

◆ operator+() [10/17]

Counter YODA::operator+ ( Counter  first,
const Counter second 
)
inline

Add two counters.

Definition at line 363 of file Counter.h.

363 {
364 first += second;
365 return first;
366 }

◆ operator+() [11/17]

Counter YODA::operator+ ( Counter  first,
Counter &&  second 
)
inline

Add two counters.

Definition at line 369 of file Counter.h.

369 {
370 first += std::move(second);
371 return first;
372 }

◆ operator+() [12/17]

template<size_t N>
DbnBase< N > YODA::operator+ ( DbnBase< N >  first,
const DbnBase< N > &  second 
)
inline

Add two DbnBases.

Definition at line 608 of file Dbn.h.

608 {
609 first += second;
610 return first;
611 }

◆ operator+() [13/17]

template<size_t N>
DbnBase< N > YODA::operator+ ( DbnBase< N >  first,
DbnBase< N > &&  second 
)
inline

Add two DbnBases.

Definition at line 615 of file Dbn.h.

615 {
616 first += std::move(second);
617 return first;
618 }

◆ operator+() [14/17]

Estimate YODA::operator+ ( Estimate  lhs,
const Estimate rhs 
)
inline

Add two Estimate objects.

Definition at line 576 of file Estimate.h.

576 {
577 lhs += rhs;
578 return lhs;
579 }

◆ operator+() [15/17]

Estimate YODA::operator+ ( Estimate  lhs,
Estimate &&  rhs 
)
inline

Add two Estimate objects.

Definition at line 582 of file Estimate.h.

582 {
583 lhs += std::move(rhs);
584 return lhs;
585 }

◆ operator+() [16/17]

Estimate0D YODA::operator+ ( Estimate0D  lhs,
const Estimate0D rhs 
)
inline

Add two Estimate0D objects.

Definition at line 301 of file Estimate0D.h.

301 {
302 lhs += rhs;
303 return lhs;
304 }

◆ operator+() [17/17]

Estimate0D YODA::operator+ ( Estimate0D  lhs,
Estimate0D &&  rhs 
)
inline

Add two Estimate0D objects.

Definition at line 307 of file Estimate0D.h.

307 {
308 lhs += std::move(rhs);
309 return lhs;
310 }

◆ operator-() [1/17]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator- ( BinnedDbn< DbnN, AxisT... > &&  dbn,
BinnedEstimate< AxisT... > &&  est 
)
inline

Definition at line 1324 of file BinnedDbn.h.

1324 {
1325 return subtract(std::move(dbn), std::move(est));
1326 }

References subtract().

◆ operator-() [2/17]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator- ( BinnedDbn< DbnN, AxisT... > &&  dbn,
const BinnedEstimate< AxisT... > &  est 
)
inline

Definition at line 1312 of file BinnedDbn.h.

1312 {
1313 return subtract(std::move(dbn), est);
1314 }

References subtract().

◆ operator-() [3/17]

template<size_t DbnN, typename... AxisT>
BinnedDbn< DbnN, AxisT... > YODA::operator- ( BinnedDbn< DbnN, AxisT... >  first,
BinnedDbn< DbnN, AxisT... > &&  second 
)
inline

Subtract one BinnedDbn object from another.

Definition at line 1074 of file BinnedDbn.h.

1074 {
1075 first -= std::move(second);
1076 return first;
1077 }

◆ operator-() [4/17]

template<size_t DbnN, typename... AxisT>
BinnedDbn< DbnN, AxisT... > YODA::operator- ( BinnedDbn< DbnN, AxisT... >  first,
const BinnedDbn< DbnN, AxisT... > &  second 
)
inline

Definition at line 1081 of file BinnedDbn.h.

1081 {
1082 first -= second;
1083 return first;
1084 }

◆ operator-() [5/17]

template<typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator- ( BinnedEstimate< AxisT... >  first,
BinnedEstimate< AxisT... > &&  second 
)
inline

Subtract two BinnedEstimates.

Definition at line 1100 of file BinnedEstimate.h.

1100 {
1101 first -= std::move(second);
1102 return first;
1103 }

◆ operator-() [6/17]

template<typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator- ( BinnedEstimate< AxisT... >  first,
const BinnedEstimate< AxisT... > &  second 
)
inline

Subtract two BinnedEstimates.

Definition at line 1092 of file BinnedEstimate.h.

1092 {
1093 first -= second;
1094 return first;
1095 }

◆ operator-() [7/17]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator- ( const BinnedDbn< DbnN, AxisT... > &  dbn,
BinnedEstimate< AxisT... > &&  est 
)
inline

Definition at line 1318 of file BinnedDbn.h.

1318 {
1319 return subtract(dbn, std::move(est));
1320 }

References subtract().

◆ operator-() [8/17]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator- ( const BinnedDbn< DbnN, AxisT... > &  dbn,
const BinnedEstimate< AxisT... > &  est 
)
inline

Definition at line 1306 of file BinnedDbn.h.

1306 {
1307 return subtract(dbn, est);
1308 }

References subtract().

◆ operator-() [9/17]

Weights YODA::operator- ( const Weights first,
const Weights second 
)
inline

Subtract two weights.

Definition at line 261 of file Weights.h.

261 {
262 Weights tmp = first;
263 tmp -= second;
264 return tmp;
265 }

◆ operator-() [10/17]

Counter YODA::operator- ( Counter  first,
const Counter second 
)
inline

Subtract two counters.

Definition at line 375 of file Counter.h.

375 {
376 first -= second;
377 return first;
378 }

◆ operator-() [11/17]

Counter YODA::operator- ( Counter  first,
Counter &&  second 
)
inline

Subtract two counters.

Definition at line 381 of file Counter.h.

381 {
382 first -= std::move(second);
383 return first;
384 }

◆ operator-() [12/17]

template<size_t N>
DbnBase< N > YODA::operator- ( DbnBase< N >  first,
const DbnBase< N > &  second 
)
inline

Subtract one DbnBase from another one.

Definition at line 622 of file Dbn.h.

622 {
623 first -= second;
624 return first;
625 }

◆ operator-() [13/17]

template<size_t N>
DbnBase< N > YODA::operator- ( DbnBase< N >  first,
DbnBase< N > &&  second 
)
inline

Subtract one DbnBase from another one.

Definition at line 629 of file Dbn.h.

629 {
630 first -= std::move(second);
631 return first;
632 }

◆ operator-() [14/17]

Estimate YODA::operator- ( Estimate  lhs,
const Estimate rhs 
)
inline

Subtract two Estimate objects.

Definition at line 588 of file Estimate.h.

588 {
589 lhs -= rhs;
590 return lhs;
591 }

◆ operator-() [15/17]

Estimate YODA::operator- ( Estimate  lhs,
Estimate &&  rhs 
)
inline

Subtract two Estimate objects.

Definition at line 594 of file Estimate.h.

594 {
595 lhs -= std::move(rhs);
596 return lhs;
597 }

◆ operator-() [16/17]

Estimate0D YODA::operator- ( Estimate0D  lhs,
const Estimate0D rhs 
)
inline

Subtract two Estimate0D objects.

Definition at line 313 of file Estimate0D.h.

313 {
314 lhs -= rhs;
315 return lhs;
316 }

◆ operator-() [17/17]

Estimate0D YODA::operator- ( Estimate0D  lhs,
Estimate0D &&  rhs 
)
inline

Subtract two Estimate0D objects.

Definition at line 319 of file Estimate0D.h.

319 {
320 lhs -= std::move(rhs);
321 return lhs;
322 }

◆ operator/() [1/27]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( BinnedDbn< DbnN, AxisT... > &&  dbn,
BinnedEstimate< AxisT... > &&  est 
)
inline

Definition at line 1356 of file BinnedDbn.h.

1356 {
1357 return divide(std::move(dbn), std::move(est));
1358 }

References divide().

◆ operator/() [2/27]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( BinnedDbn< DbnN, AxisT... > &&  dbn,
const BinnedEstimate< AxisT... > &  est 
)
inline

Definition at line 1344 of file BinnedDbn.h.

1344 {
1345 return divide(std::move(dbn), est);
1346 }

References divide().

◆ operator/() [3/27]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( BinnedDbn< DbnN, AxisT... > &&  numer,
BinnedDbn< DbnN, AxisT... > &&  denom 
)
inline

Definition at line 1149 of file BinnedDbn.h.

1149 {
1150 return divide(std::move(numer), std::move(denom));
1151 }

References divide().

◆ operator/() [4/27]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( BinnedDbn< DbnN, AxisT... > &&  numer,
const BinnedDbn< DbnN, AxisT... > &  denom 
)
inline

Definition at line 1143 of file BinnedDbn.h.

1143 {
1144 return divide(std::move(numer), denom);
1145 }

References divide().

◆ operator/() [5/27]

template<typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( BinnedEstimate< AxisT... > &&  numer,
BinnedEstimate< AxisT... > &&  denom 
)
inline

Divide two BinnedEstimates.

Definition at line 1151 of file BinnedEstimate.h.

1151 {
1152 return divide(std::move(numer), std::move(denom));
1153 }

References divide().

◆ operator/() [6/27]

template<typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( BinnedEstimate< AxisT... > &&  numer,
const BinnedEstimate< AxisT... > &  denom 
)
inline

Divide two BinnedEstimates.

Definition at line 1137 of file BinnedEstimate.h.

1137 {
1138 return divide(std::move(numer), denom);
1139 }

References divide().

◆ operator/() [7/27]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( const BinnedDbn< DbnN, AxisT... > &  dbn,
BinnedEstimate< AxisT... > &&  est 
)
inline

Definition at line 1350 of file BinnedDbn.h.

1350 {
1351 return divide(dbn, std::move(est));
1352 }

References divide().

◆ operator/() [8/27]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( const BinnedDbn< DbnN, AxisT... > &  dbn,
const BinnedEstimate< AxisT... > &  est 
)
inline

Definition at line 1338 of file BinnedDbn.h.

1338 {
1339 return divide(dbn, est);
1340 }

References divide().

◆ operator/() [9/27]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( const BinnedDbn< DbnN, AxisT... > &  numer,
BinnedDbn< DbnN, AxisT... > &&  denom 
)
inline

Definition at line 1137 of file BinnedDbn.h.

1137 {
1138 return divide(numer, std::move(denom));
1139 }

References divide().

◆ operator/() [10/27]

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( const BinnedDbn< DbnN, AxisT... > &  numer,
const BinnedDbn< DbnN, AxisT... > &  denom 
)
inline

Definition at line 1131 of file BinnedDbn.h.

1131 {
1132 return divide(numer, denom);
1133 }

References divide().

◆ operator/() [11/27]

template<typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( const BinnedEstimate< AxisT... > &  numer,
BinnedEstimate< AxisT... > &&  denom 
)
inline

Divide two BinnedEstimates.

Definition at line 1144 of file BinnedEstimate.h.

1144 {
1145 return divide(numer, std::move(denom));
1146 }

References divide().

◆ operator/() [12/27]

template<typename... AxisT>
BinnedEstimate< AxisT... > YODA::operator/ ( const BinnedEstimate< AxisT... > &  numer,
const BinnedEstimate< AxisT... > &  denom 
)
inline

Divide two BinnedEstimates.

Definition at line 1130 of file BinnedEstimate.h.

1130 {
1131 return divide(numer, denom);
1132 }

References divide().

◆ operator/() [13/27]

Estimate0D YODA::operator/ ( const Counter numer,
const Counter denom 
)
inline

Divide two Counter objects.

Definition at line 390 of file Counter.h.

390 {
391 return divide(numer, denom);
392 }

References divide().

◆ operator/() [14/27]

Estimate0D YODA::operator/ ( const Counter numer,
Counter &&  denom 
)
inline

Divide two Counter objects.

Definition at line 400 of file Counter.h.

400 {
401 return divide(numer, std::move(denom));
402 }

References divide().

◆ operator/() [15/27]

Estimate YODA::operator/ ( const Estimate numer,
const Estimate denom 
)
inline

Divide two Estimate objects.

Definition at line 660 of file Estimate.h.

660 {
661 return divide(numer, denom);
662 }

References divide().

◆ operator/() [16/27]

Estimate YODA::operator/ ( const Estimate numer,
Estimate &&  denom 
)
inline

Divide two Estimate objects.

Definition at line 670 of file Estimate.h.

670 {
671 return divide(numer, std::move(denom));
672 }

References divide().

◆ operator/() [17/27]

Estimate0D YODA::operator/ ( const Estimate0D numer,
const Estimate0D denom 
)
inline

Divide two Estimate0D objects.

Definition at line 335 of file Estimate0D.h.

335 {
336 return divide(numer, denom);
337 }

References divide().

◆ operator/() [18/27]

Estimate0D YODA::operator/ ( const Estimate0D numer,
Estimate0D &&  denom 
)
inline

Divide two Estimate0D objects.

Definition at line 345 of file Estimate0D.h.

345 {
346 return divide(numer, std::move(denom));
347 }

References divide().

◆ operator/() [19/27]

Weights YODA::operator/ ( const Weights numer,
const Weights denom 
)
inline

Divide two weights.

Definition at line 275 of file Weights.h.

275 {
276 Weights tmp = numer;
277 tmp /= denom;
278 return tmp;
279 }

◆ operator/() [20/27]

Weights YODA::operator/ ( const Weights w,
double  a 
)
inline

Divide by a double.

Definition at line 295 of file Weights.h.

295 {
296 Weights tmp = w;
297 tmp /= a;
298 return tmp;
299 }

◆ operator/() [21/27]

Estimate0D YODA::operator/ ( Counter &&  numer,
const Counter denom 
)
inline

Divide two Counter objects.

Definition at line 395 of file Counter.h.

395 {
396 return divide(std::move(numer), denom);
397 }

References divide().

◆ operator/() [22/27]

Estimate0D YODA::operator/ ( Counter &&  numer,
Counter &&  denom 
)
inline

Divide two Counter objects.

Definition at line 405 of file Counter.h.

405 {
406 return divide(std::move(numer), std::move(denom));
407 }

References divide().

◆ operator/() [23/27]

Weights YODA::operator/ ( double  a,
const Weights w 
)
inline

Divide a double by a Weights

Todo:
Is this really needed?

Definition at line 303 of file Weights.h.

303 {
304 Weights tmp(w.keys(), a);
305 tmp /= w;
306 return tmp;
307 }
std::vector< std::string > keys() const
Sorted list of weight keys.
Definition Weights.h:111

References YODA::Weights::keys().

◆ operator/() [24/27]

Estimate YODA::operator/ ( Estimate &&  numer,
const Estimate denom 
)
inline

Divide two Estimate objects.

Definition at line 665 of file Estimate.h.

665 {
666 return divide(std::move(numer), denom);
667 }

References divide().

◆ operator/() [25/27]

Estimate YODA::operator/ ( Estimate &&  numer,
Estimate &&  denom 
)
inline

Divide two Estimate objects.

Definition at line 675 of file Estimate.h.

675 {
676 return divide(std::move(numer), std::move(denom));
677 }

References divide().

◆ operator/() [26/27]

Estimate0D YODA::operator/ ( Estimate0D &&  numer,
const Estimate0D denom 
)
inline

Divide two Estimate0D objects.

Definition at line 340 of file Estimate0D.h.

340 {
341 return divide(std::move(numer), denom);
342 }

References divide().

◆ operator/() [27/27]

Estimate0D YODA::operator/ ( Estimate0D &&  numer,
Estimate0D &&  denom 
)
inline

Divide two Estimate0D objects.

Definition at line 350 of file Estimate0D.h.

350 {
351 return divide(std::move(numer), std::move(denom));
352 }

References divide().

◆ operator<()

template<size_t N>
bool YODA::operator< ( const PointBase< N > &  a,
const PointBase< N > &  b 
)
inline

Less-than operator used to sort points.

Definition at line 501 of file Point.h.

501 {
502 #define LT_IF_NOT_EQ(a,b) { if (!fuzzyEquals(a, b)) return a < b; }
503 for (size_t i = 0; i < N; ++i) {
504 LT_IF_NOT_EQ(a.vals()[i], b.vals()[i]);
505 LT_IF_NOT_EQ(a.errs()[i].first, b.errs()[i].first);
506 LT_IF_NOT_EQ(a.errs()[i].second, b.errs()[i].second);
507 }
508 #undef LT_IF_NOT_EQ
509 return false;
510 }
#define LT_IF_NOT_EQ(a, b)
NdValPair & errs()
Get error values.
Definition Point.h:297
NdVal & vals()
Get the coordinate vector.
Definition Point.h:268

References YODA::PointBase< N >::errs(), LT_IF_NOT_EQ, and YODA::PointBase< N >::vals().

◆ operator<<()

std::ostream & YODA::operator<< ( std::ostream &  out,
const Weights w 
)
inline

Standard text representaion.

Definition at line 313 of file Weights.h.

313 {
314 out << "{ ";
315 for (Weights::const_iterator i = w.begin(); i != w.end(); ++i) {
316 if (i != w.begin()) out << ", ";
317 out << i->first << ": " << i->second;
318 }
319 out << "}";
320 return out;
321 }
std::map< std::string, double >::const_iterator const_iterator
Definition Weights.h:72
iterator end()
Definition Weights.h:75
iterator begin()
Definition Weights.h:73

References YODA::Weights::begin(), and YODA::Weights::end().

◆ operator<=()

template<size_t N>
bool YODA::operator<= ( const PointBase< N > &  a,
const PointBase< N > &  b 
)
inline

Less-than-or-equals operator used to sort points.

Definition at line 514 of file Point.h.

514 {
515 if (a == b) return true;
516 return a < b;
517 }

◆ operator==()

template<size_t N>
bool YODA::operator== ( const PointBase< N > &  a,
const PointBase< N > &  b 
)
inline

Equality test.

Definition at line 482 of file Point.h.

482 {
483 // Compare valitions
484 for (size_t i = 0; i < N; ++i) {
485 if ( !fuzzyEquals(a.vals()[i], b.vals()[i]) ) return false;
486 if ( !fuzzyEquals(a.errs()[i].first, b.errs()[i].first)) return false;
487 if ( !fuzzyEquals(a.errs()[i].second, b.errs()[i].second)) return false;
488 }
489 return true;
490 }

References YODA::PointBase< N >::errs(), fuzzyEquals(), and YODA::PointBase< N >::vals().

◆ operator>()

template<size_t N>
bool YODA::operator> ( const PointBase< N > &  a,
const PointBase< N > &  b 
)
inline

Greater-than operator used to sort points.

Definition at line 521 of file Point.h.

521 {
522 return !(a <= b);
523 }

◆ operator>=()

template<size_t N>
bool YODA::operator>= ( const PointBase< N > &  a,
const PointBase< N > &  b 
)
inline

Greater-than-or-equals operator used to sort points.

Definition at line 527 of file Point.h.

527 {
528 return !(a < b);
529 }

◆ pdfspace()

std::vector< double > YODA::pdfspace ( size_t  nbins,
double  xmin,
double  xmax,
std::function< double(double)> &  fn,
size_t  nsample = 10000 
)
inline

Make a list of nbins + 1 values spaced with density ~ f(x) between xmin and end inclusive.

Todo:
fspace() for uniform sampling from f(x); requires ability to invert fn... how, in general?

The density function fn will be evaluated at nsample uniformly distributed points between xmin and xmax, its integral approximated via the Trapezium Rule and used to normalize the distribution, and nbins + 1 edges then selected to (approximately) divide into bins each containing fraction 1/nbins of the integral.

Note
The function fn does not need to be a normalized pdf, but it should be non-negative. Any negative values returned by fn(x) will be truncated to zero and contribute nothing to the estimated integral and binning density.
The arg ordering and the meaning of the nbins variable is "histogram-like", as opposed to the Numpy/Matlab version, and the xmin and xmax arguments are expressed in "normal" space, rather than in the function-mapped space as with Numpy/Matlab.
The naming of this function differs from the other, Matlab-inspired ones: the bin spacing is uniform in the CDF of the density function given, rather than in the function itself. For most use-cases this is more intuitive.

Definition at line 322 of file MathUtils.h.

322 {
323 const double dx = (xmax-xmin)/(double)nsample;
324 const std::vector<double> xs = linspace(nsample, xmin, xmax);
325 std::vector<double> ys(0, nsample);
326 auto posfn = [&](double x){return std::max(fn(x), 0.0);};
327 std::transform(xs.begin(), xs.end(), ys.begin(), posfn);
328 std::vector<double> areas; areas.reserve(nsample);
329 double areasum = 0;
330 for (size_t i = 0; i < ys.size()-1; ++i) {
331 const double area = (ys[i] + ys[i+1])*dx/2.0;
332 areas[i] = area;
333 areasum += area;
334 }
335 const double df = areasum/(double)nbins;
336 std::vector<double> xedges{xmin}; xedges.reserve(nbins+1);
337 double fsum = 0;
338 for (size_t i = 0; i < nsample-1; ++i) {
339 fsum += areas[i];
340 if (fsum > df) {
341 fsum = 0;
342 xedges.push_back(xs[i+1]);
343 }
344 }
345 xedges.push_back(xmax);
346 assert(xedges.size() == nbins+1);
347 return xedges;
348 }

References linspace().

◆ read() [1/4]

std::vector< AnalysisObject * > YODA::read ( const std::string &  filename,
const std::string &  match = "",
const std::string &  unmatch = "" 
)
inline

Read in a collection of objects from file filename.

This version returns a vector by value, involving copying, and is hence less CPU efficient than the alternative version where a vector is filled by reference. The appropriate format reader will be determined from the filename.

Definition at line 98 of file IO.h.

100 {
101 std::vector<AnalysisObject*> rtn;
102 read(filename, rtn, match, unmatch);
103 return rtn;
104 }
void read(const std::string &filename, std::vector< AnalysisObject * > &aos, const std::string &match="", const std::string &unmatch="")
Read in a collection of objects objs from file filename.
Definition IO.h:85

References read().

◆ read() [2/4]

void YODA::read ( const std::string &  filename,
std::vector< AnalysisObject * > &  aos,
const std::string &  match = "",
const std::string &  unmatch = "" 
)
inline

Read in a collection of objects objs from file filename.

This version fills (actually, appends to) a supplied vector, avoiding copying, and is hence CPU efficient. The appropriate format reader will be determined from the filename.

Todo:
Use SFINAE magic to allow ~arbitrary collection<AnalysisObject*> (with push_back()?) to be passed

Definition at line 85 of file IO.h.

87 {
88 Reader& r = mkReader(filename);
89 r.read(filename, aos, match, unmatch);
90 }
Pure virtual base class for various output writers.
Definition Reader.h:23
std::enable_if_t< YODA::Pushable< CONT, AnalysisObject * >::value > read(std::istream &stream, CONT &aos, const std::string &match="", const std::string &unmatch="")
Read in a collection of objects objs from output stream stream.
Definition Reader.h:50
Reader & mkReader(const std::string &format_name)
Factory function to make a reader object by format name or a filename.
Definition Reader.cc:15

References mkReader(), and YODA::Reader::read().

Referenced by read(), and read().

◆ read() [3/4]

std::vector< AnalysisObject * > YODA::read ( std::istream &  is,
const std::string &  fmt,
const std::string &  match = "",
const std::string &  unmatch = "" 
)
inline

Read in a collection of objects from stream is, expecting format fmt.

This version returns a vector by value, involving copying, and is hence less CPU efficient than the alternative version where a vector is filled by reference.

Definition at line 129 of file IO.h.

131 {
132 std::vector<AnalysisObject*> rtn;
133 read(is, rtn, fmt, match, unmatch);
134 return rtn;
135 }

References read().

◆ read() [4/4]

void YODA::read ( std::istream &  is,
std::vector< AnalysisObject * > &  aos,
const std::string &  fmt,
const std::string &  match = "",
const std::string &  unmatch = "" 
)
inline

Read in a collection of objects objs from stream is, expecting format fmt.

This version fills (actually, appends to) a supplied vector, avoiding copying, and is hence CPU efficient.

Todo:
Use SFINAE magic to allow ~arbitrary collection<AnalysisObject*> (with push_back()?) to be passed

Definition at line 118 of file IO.h.

119 {
120 Reader& r = mkReader(fmt);
121 r.read(is, aos, match, unmatch);
122 }

References mkReader(), and YODA::Reader::read().

◆ RMS() [1/2]

double YODA::RMS ( const double  sumWX2,
const double  sumW,
const double  sumW2 
)
inline

Calculate the weighted RMS of a sample.

Definition at line 489 of file MathUtils.h.

489 {
490 // Weighted RMS defined as
491 // rms = sqrt(sum{w x^2} / sum{w})
492 const double effN = effNumEntries(sumW, sumW2);
493 if (effN == 0) return std::numeric_limits<double>::quiet_NaN();
494 const double meanSq = sumWX2 / sumW;
495 return std::sqrt(meanSq);
496 }
double effNumEntries(const double sumW, const double sumW2)
Calculate the effective number of entries of a sample.
Definition MathUtils.h:375

References effNumEntries().

Referenced by YODA::DbnBase< N >::RMS(), RMS(), YODA::XDbnMixin< Derived >::xRMS(), YODA::YDbnMixin< Derived >::yRMS(), and YODA::ZDbnMixin< Derived >::zRMS().

◆ RMS() [2/2]

double YODA::RMS ( const std::vector< double > &  sample,
const std::vector< double > &  weights 
)
inline

Calculate the weighted RMS of a sample.

Definition at line 499 of file MathUtils.h.

500 {
501 if (sample.size() != weights.size()) throw RangeError("Inputs should have equal length!");
502 double sumWX2 = 0., sumW = 0., sumW2 = 0.;
503 for (size_t i = 0; i < sample.size(); ++i) {
504 sumW += weights[i];
505 sumW2 += sqr(weights[i]);
506 sumWX2 += weights[i]*sqr(sample[i]);
507 }
508 return RMS(sumWX2, sumW, sumW2);
509 }

References RMS(), and sqr().

◆ sign() [1/3]

int YODA::sign ( double  val)
inline

Find the sign of a number.

Definition at line 233 of file MathUtils.h.

233 {
234 if (isZero(val)) return ZERO;
235 const int valsign = (val > 0) ? PLUS : MINUS;
236 return valsign;
237 }

References isZero(), MINUS, PLUS, and ZERO.

◆ sign() [2/3]

int YODA::sign ( int  val)
inline

Find the sign of a number.

Definition at line 240 of file MathUtils.h.

240 {
241 if (val == 0) return ZERO;
242 return (val > 0) ? PLUS : MINUS;
243 }

References MINUS, PLUS, and ZERO.

◆ sign() [3/3]

int YODA::sign ( long  val)
inline

Find the sign of a number.

Definition at line 246 of file MathUtils.h.

246 {
247 if (val == 0) return ZERO;
248 return (val > 0) ? PLUS : MINUS;
249 }

References MINUS, PLUS, and ZERO.

◆ sqr()

◆ stdDev() [1/2]

double YODA::stdDev ( const double  sumWX,
const double  sumW,
const double  sumWX2,
const double  sumW2 
)
inline

Calculate the weighted standard deviation of a sample.

Definition at line 458 of file MathUtils.h.

459 {
460 return std::sqrt(variance(sumWX, sumW, sumWX2, sumW2));
461 }
double variance(const double sumWX, const double sumW, const double sumWX2, const double sumW2)
Calculate the weighted variance of a sample.
Definition MathUtils.h:421

References variance().

Referenced by YODA::XDbnMixin< Derived >::xStdDev(), YODA::XStatsMixin< Derived >::xStdDev(), YODA::YDbnMixin< Derived >::yStdDev(), YODA::YStatsMixin< Derived >::yStdDev(), YODA::ZDbnMixin< Derived >::zStdDev(), and YODA::ZStatsMixin< Derived >::zStdDev().

◆ stdDev() [2/2]

double YODA::stdDev ( const std::vector< double > &  sample,
const std::vector< double > &  weights 
)
inline

Calculate the weighted variance of a sample.

Definition at line 464 of file MathUtils.h.

465 {
466 return std::sqrt(variance(sample, weights));
467 }

References variance().

◆ stdErr() [1/2]

double YODA::stdErr ( const double  sumWX,
const double  sumW,
const double  sumWX2,
const double  sumW2 
)
inline

Calculate the weighted standard error of a sample.

Definition at line 470 of file MathUtils.h.

471 {
472 const double effN = effNumEntries(sumW, sumW2);
473 if (effN == 0) return std::numeric_limits<double>::quiet_NaN();
474 const double var = variance(sumWX, sumW, sumWX2, sumW2);
475 return std::sqrt(var / effN);
476 }

References effNumEntries(), and variance().

Referenced by YODA::DbnBase< N >::relStdErr(), YODA::DbnBase< N >::stdErr(), YODA::XDbnMixin< Derived >::xStdErr(), YODA::XStatsMixin< Derived >::xStdErr(), YODA::YDbnMixin< Derived >::yStdErr(), YODA::YStatsMixin< Derived >::yStdErr(), YODA::ZDbnMixin< Derived >::zStdErr(), and YODA::ZStatsMixin< Derived >::zStdErr().

◆ stdErr() [2/2]

double YODA::stdErr ( const std::vector< double > &  sample,
const std::vector< double > &  weights 
)
inline

Calculate the weighted variance of a sample.

Definition at line 479 of file MathUtils.h.

480 {
481 if (sample.size() != weights.size()) throw RangeError("Inputs should have equal length!");
482 const double effN = effNumEntries(weights);
483 if (effN == 0) return std::numeric_limits<double>::quiet_NaN();
484 const double var = variance(sample, weights);
485 return std::sqrt(var / effN);
486 }

References effNumEntries(), and variance().

◆ subtract()

template<size_t DbnN, typename... AxisT>
BinnedEstimate< AxisT... > YODA::subtract ( const BinnedDbn< DbnN, AxisT... > &  dbn,
const BinnedEstimate< AxisT... > &  est 
)
inline

Calculate the subtraction of a BinnedEstimate from a BinnedDbn.

Definition at line 1300 of file BinnedDbn.h.

1300 {
1301 return dbn.mkEstimate() - est;
1302 }

References YODA::DbnStorage< DbnN, AxisT >::mkEstimate().

Referenced by asymm(), operator-(), operator-(), operator-(), and operator-().

◆ transform() [1/6]

template<typename... AxisT, typename FN >
void YODA::transform ( BinnedEstimate< AxisT... > &  est,
const FN &  fn 
)
inline

Definition at line 1209 of file BinnedEstimate.h.

1209 {
1210 transform(est, Trf<1>(fn));
1211 }
void transform(BinnedEstimate< AxisT... > &est, const Trf< 1 > &fn)

References transform().

◆ transform() [2/6]

template<typename... AxisT>
void YODA::transform ( BinnedEstimate< AxisT... > &  est,
const Trf< 1 > &  fn 
)
inline

Definition at line 1202 of file BinnedEstimate.h.

1202 {
1203 for (auto& b : est.bins(true, true)) {
1204 b.transform(fn);
1205 }
1206 }

References YODA::BinnedStorage< BinContentT, AxisT >::bins().

Referenced by transform(), transform(), transform(), transformX(), transformY(), and transformZ().

◆ transform() [3/6]

template<typename FN >
void YODA::transform ( Estimate0D est,
const FN &  fn 
)
inline

Definition at line 290 of file Estimate0D.h.

290 {
291 transform(est, Trf<1>(fn));
292 }

References transform().

◆ transform() [4/6]

void YODA::transform ( Estimate0D est,
const Trf< 1 > &  fn 
)
inline

Definition at line 285 of file Estimate0D.h.

285 {
286 est.transform(fn);
287 }
void transform(const Trf< 1 > &trf)
Generalised transformations with functors.
Definition Estimate.h:214

References YODA::Estimate::transform().

◆ transform() [5/6]

template<size_t N, typename FN >
void YODA::transform ( ScatterND< N > &  s,
const FN &  fn,
const size_t  i 
)
inline

Definition at line 857 of file Scatter.h.

857 {
858 transform(s, Trf<N>(fn), i);
859 }

References transform().

◆ transform() [6/6]

template<size_t N>
void YODA::transform ( ScatterND< N > &  s,
const Trf< N > &  fn,
const size_t  i 
)
inline

Definition at line 850 of file Scatter.h.

850 {
851 for (auto& p : s.points()) {
852 p.transform(i, fn);
853 }
854 }

References YODA::ScatterND< N >::points().

◆ transformX()

template<size_t N, typename FN >
void YODA::transformX ( ScatterND< N > &  s,
const FN &  fn 
)
inline

Definition at line 862 of file Scatter.h.

862 {
863 transform(s, fn, 0);
864 }

References transform().

◆ transformY()

template<size_t N, typename FN >
void YODA::transformY ( ScatterND< N > &  s,
const FN &  fn 
)
inline

Definition at line 867 of file Scatter.h.

867 {
868 transform(s, fn, 1);
869 }

References transform().

◆ transformZ()

template<size_t N, typename FN >
void YODA::transformZ ( ScatterND< N > &  s,
const FN &  fn 
)
inline

Definition at line 872 of file Scatter.h.

872 {
873 transform(s, fn, 2);
874 }

References transform().

◆ variance() [1/2]

double YODA::variance ( const double  sumWX,
const double  sumW,
const double  sumWX2,
const double  sumW2 
)
inline

Calculate the weighted variance of a sample.

Weighted variance defined as sig2 = ( sum(wx**2) * sum(w) - sum(wx)**2 ) / ( sum(w)**2 - sum(w**2) ) see http://en.wikipedia.org/wiki/Weighted_mean

Todo:
Isn't this sensitive to the overall scale of the weights? Shouldn't it check if den is bigger then num by a set number of orders of magnitude and vice versa?

We take the modulus of the weighted variance since the ratio can be negative with weighted means

Todo:
Is this the correct approach? There is no information online other than "weights are non-negative"...

Definition at line 421 of file MathUtils.h.

422 {
423 const double num = sumWX2*sumW - sqr(sumWX);
424 const double den = sqr(sumW) - sumW2;
428 // if (fabs(num) < 1e-10 && fabs(den) < 1e-10) {
429 // return std::numeric_limits<double>::quiet_NaN();
430 // }
435 return den? fabs(num/den): std::numeric_limits<double>::quiet_NaN();
436 }

References sqr().

Referenced by stdDev(), stdDev(), stdErr(), stdErr(), YODA::DbnBase< N >::variance(), variance(), YODA::XDbnMixin< Derived >::xVariance(), YODA::XStatsMixin< Derived >::xVariance(), YODA::YDbnMixin< Derived >::yVariance(), YODA::YStatsMixin< Derived >::yVariance(), YODA::ZDbnMixin< Derived >::zVariance(), and YODA::ZStatsMixin< Derived >::zVariance().

◆ variance() [2/2]

double YODA::variance ( const std::vector< double > &  sample,
const std::vector< double > &  weights 
)
inline

Calculate the weighted variance of a sample.

Definition at line 439 of file MathUtils.h.

440 {
441 if (sample.size() != weights.size()) throw RangeError("Inputs should have equal length!");
442 if (fuzzyLessEquals(effNumEntries(weights), 1.0)) {
443 //throw LowStatsError("Requested variance of a distribution with only one effective entry");
444 return std::numeric_limits<double>::quiet_NaN();
445 }
446 double sumWX = 0., sumW = 0.;
447 double sumWX2 = 0., sumW2 = 0.;
448 for (size_t i = 0; i < sample.size(); ++i) {
449 sumW += weights[i];
450 sumWX += weights[i]*sample[i];
451 sumW2 += sqr(weights[i]);
452 sumWX2 += weights[i]*sqr(sample[i]);
453 }
454 return variance(sumWX, sumW, sumWX2, sumW2);
455 }
std::enable_if_t< std::is_arithmetic_v< N1 > &&std::is_arithmetic_v< N2 >, bool > fuzzyLessEquals(N1 a, N2 b, double tolerance=1e-5)
Compare two floating point numbers for <= with a degree of fuzziness.
Definition MathUtils.h:135

References effNumEntries(), fuzzyLessEquals(), sqr(), and variance().

◆ version()

std::string YODA::version ( )
inline

Namespaced version string function.

Definition at line 25 of file YodaConfig.h.

25 {
26 return YODA_VERSION;
27 }
#define YODA_VERSION
Definition YodaConfig.h:19

References YODA_VERSION.

◆ write() [1/6]

void YODA::write ( const std::string &  filename,
const AnalysisObject ao,
int  precision = -1 
)
inline

Write out object ao to file filename.

Definition at line 19 of file IO.h.

19 {
20 Writer& w = mkWriter(filename);
21 if (precision > 0) w.setPrecision(precision);
22 w.write(filename, ao);
23 }
Pure virtual base class for various output writers.
Definition Writer.h:19
void write(const std::string &filename, const AnalysisObject &ao)
Write out object ao to file filename.
Definition Writer.cc:49
void setPrecision(int precision)
Set precision of numerical quantities in this writer's output.
Definition Writer.h:143
Writer & mkWriter(const std::string &format_name)
Factory function to make a writer object by format name or a filename.
Definition Writer.cc:25

References mkWriter(), YODA::Writer::setPrecision(), and YODA::Writer::write().

◆ write() [2/6]

template<typename AOITER >
void YODA::write ( const std::string &  filename,
const AOITER &  begin,
const AOITER &  end,
int  precision = -1 
)
inline

Write out the objects specified by start iterator begin and end iterator end to file filename.

Definition at line 36 of file IO.h.

36 {
37 Writer& w = mkWriter(filename);
38 if (precision > 0) w.setPrecision(precision);
39 w.write(filename, begin, end);
40 }

References mkWriter(), YODA::Writer::setPrecision(), and YODA::Writer::write().

◆ write() [3/6]

template<typename RANGE >
void YODA::write ( const std::string &  filename,
const RANGE &  aos,
int  precision = -1 
)
inline

Write out a collection of objects objs to file filename.

Definition at line 27 of file IO.h.

27 {
28 Writer& w = mkWriter(filename);
29 if (precision > 0) w.setPrecision(precision);
30 w.write(filename, aos);
31 }

References mkWriter(), YODA::Writer::setPrecision(), and YODA::Writer::write().

◆ write() [4/6]

void YODA::write ( std::ostream &  os,
const AnalysisObject ao,
const std::string &  fmt,
int  precision = -1 
)
inline

Write out object ao to stream os with format fmt.

Definition at line 49 of file IO.h.

49 {
50 Writer& w = mkWriter(fmt);
51 if (precision > 0) w.setPrecision(precision);
52 w.write(os, ao);
53 }

References mkWriter(), YODA::Writer::setPrecision(), and YODA::Writer::write().

◆ write() [5/6]

template<typename AOITER >
void YODA::write ( std::ostream &  os,
const AOITER &  begin,
const AOITER &  end,
const std::string &  fmt,
int  precision = -1 
)
inline

Write out the objects specified by start iterator begin and end iterator end to file filename.

Definition at line 66 of file IO.h.

66 {
67 Writer& w = mkWriter(fmt);
68 if (precision > 0) w.setPrecision(precision);
69 w.write(os, begin, end);
70 }

References mkWriter(), YODA::Writer::setPrecision(), and YODA::Writer::write().

◆ write() [6/6]

template<typename RANGE >
void YODA::write ( std::ostream &  os,
const RANGE &  aos,
const std::string &  fmt,
int  precision = -1 
)
inline

Write out a collection of objects objs to file filename.

Definition at line 57 of file IO.h.

57 {
58 Writer& w = mkWriter(fmt);
59 if (precision > 0) w.setPrecision(precision);
60 w.write(os, aos);
61 }

References mkWriter(), YODA::Writer::setPrecision(), and YODA::Writer::write().

Variable Documentation

◆ BISECT_LINEAR_THRESHOLDlc

const size_t YODA::BISECT_LINEAR_THRESHOLDlc = 32

Definition at line 29 of file BinnedAxis.h.

◆ fuzzyEqComp

std::function<bool(const double, const double)> YODA::fuzzyEqComp
static
Initial value:
=
[](const double& lhs, const double& rhs) { return fuzzyEquals(lhs, rhs); }

Comparator wrapper to use with STL algorithms, e.g. std::equal etc.

Definition at line 115 of file MathUtils.h.

116 { return fuzzyEquals(lhs, rhs); };

◆ HALFPI

const double YODA::HALFPI = M_PI_2
static

A pre-defined value of $ \pi/2 $.

Definition at line 48 of file MathUtils.h.

◆ isCIterable

template<typename... T>
constexpr bool YODA::isCIterable = std::conjunction<CIterable<T>...>::value
inlineconstexpr

Definition at line 54 of file Traits.h.

◆ isIterable

template<typename... T>
constexpr bool YODA::isIterable = std::conjunction<Iterable<T>...>::value
inlineconstexpr

Definition at line 44 of file Traits.h.

◆ MAXDOUBLE

const double YODA::MAXDOUBLE = DBL_MAX
static

Pre-defined numeric type limits

Deprecated:
Prefer the standard DBL/INT_MAX

Definition at line 38 of file MathUtils.h.

◆ MAXINT

const double YODA::MAXINT = INT_MAX
static

Definition at line 39 of file MathUtils.h.

◆ PI

const double YODA::PI = M_PI
static

A pre-defined value of $ \pi $.

Definition at line 42 of file MathUtils.h.

◆ SEARCH_SIZElc

const size_t YODA::SEARCH_SIZElc = 16

Definition at line 28 of file BinnedAxis.h.

Referenced by YODA::Axis< T, isCAxis< T > >::index().

◆ TWOPI

const double YODA::TWOPI = 2*M_PI
static

A pre-defined value of $ 2\pi $.

Definition at line 45 of file MathUtils.h.

◆ YODA_FORMAT_VERSION

const int YODA::YODA_FORMAT_VERSION = 3
static

YODA text-format version

  • V1/empty = make-plots annotations style
  • V2 = YAML annotations
  • V3 = YODA2 types

Definition at line 33 of file WriterYODA.cc.