LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
lar::util::details::SimplePolyFitterDataBase< T, D > Class Template Reference

Base class providing data collection for the simple polynomial fitters. More...

#include "SimpleFits.h"

Inheritance diagram for lar::util::details::SimplePolyFitterDataBase< T, D >:
lar::util::details::SimplePolyFitterBase< T, D > lar::util::details::SimplePolyFitterBase< T, 1U > lar::util::details::SimplePolyFitterBase< T, 2U > lar::util::LinearFit< T > lar::util::QuadraticFit< T >

Public Types

using Data_t = typename Collector_t::Data_t
 type of the data More...
 
using Measurement_t = typename Collector_t::Measurement_t
 type of measurement without uncertainty More...
 
using MeasurementAndUncertainty_t = typename Collector_t::MeasurementAndUncertainty_t
 type of measurement with uncertainty More...
 

Public Member Functions

void clear ()
 Clears all the statistics. More...
 
template<typename Stream >
void PrintStats (Stream &out) const
 Prints the collected statistics into a stream. More...
 
Add elements
bool add (Data_t x, Data_t y, Data_t sy=Data_t(1.0))
 
bool add (Measurement_t value, Data_t sy=Data_t(1.0))
 
bool add (MeasurementAndUncertainty_t value)
 
template<typename Iter >
void add_without_uncertainty (Iter begin, Iter end)
 
template<typename Iter , typename Pred >
void add_without_uncertainty (Iter begin, Iter end, Pred extractor)
 
template<typename Cont , typename Pred >
void add_without_uncertainty (Cont cont, Pred extractor)
 
template<typename Cont >
void add_without_uncertainty (Cont cont)
 
template<typename VIter , typename UIter , typename VPred , typename UPred = identity>
unsigned int add_with_uncertainty (VIter begin_value, VIter end_value, UIter begin_uncertainty, VPred value_extractor, UPred uncertainty_extractor=UPred())
 
template<typename Iter >
unsigned int add_with_uncertainty (Iter begin, Iter end)
 
template<typename Cont >
unsigned int add_with_uncertainty (Cont cont)
 
Statistic retrieval
int N () const
 
Data_t AverageUncertainty () const
 

Static Public Member Functions

template<typename V >
static constexpr V sqr (V const &v)
 Returns the square of the specified value. More...
 

Static Public Attributes

static constexpr unsigned int Degree = Collector_t::Degree
 Degree of the fit. More...
 

Protected Member Functions

Data_t XN (unsigned int n) const
 Returns the weighted sum of x^n. More...
 
Data_t XNY (unsigned int n) const
 Returns the weighted sum of x^n y. More...
 

Protected Attributes

Collector_t stats
 statistics collected from fit data input More...
 

Private Types

using Collector_t = FitDataCollector< T, D >
 class storing input More...
 

Detailed Description

template<typename T, unsigned int D>
class lar::util::details::SimplePolyFitterDataBase< T, D >

Base class providing data collection for the simple polynomial fitters.

Definition at line 342 of file SimpleFits.h.

Member Typedef Documentation

template<typename T , unsigned int D>
using lar::util::details::SimplePolyFitterDataBase< T, D >::Collector_t = FitDataCollector<T, D>
private

class storing input

Definition at line 343 of file SimpleFits.h.

template<typename T , unsigned int D>
using lar::util::details::SimplePolyFitterDataBase< T, D >::Data_t = typename Collector_t::Data_t

type of the data

Definition at line 349 of file SimpleFits.h.

template<typename T , unsigned int D>
using lar::util::details::SimplePolyFitterDataBase< T, D >::Measurement_t = typename Collector_t::Measurement_t

type of measurement without uncertainty

Definition at line 352 of file SimpleFits.h.

type of measurement with uncertainty

Definition at line 355 of file SimpleFits.h.

Member Function Documentation

template<typename T , unsigned int D>
bool lar::util::details::SimplePolyFitterDataBase< T, D >::add ( Data_t  x,
Data_t  y,
Data_t  sy = Data_t(1.0) 
)
inline

Definition at line 363 of file SimpleFits.h.

Referenced by cluster::ClusterParamsAlg::IntegrateFitCharge().

363 { return stats.add(x, y, sy); }
Float_t x
Definition: compare.C:6
Float_t y
Definition: compare.C:6
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
bool add(Data_t x, Data_t y, Data_t sy=Data_t(1.0))
Adds one entry with specified x, y and uncertainty.
Definition: SimpleFits.h:1412
template<typename T , unsigned int D>
bool lar::util::details::SimplePolyFitterDataBase< T, D >::add ( Measurement_t  value,
Data_t  sy = Data_t(1.0) 
)
inline

Definition at line 365 of file SimpleFits.h.

365 { return stats.add(value, sy); }
double value
Definition: spectrum.C:18
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
bool add(Data_t x, Data_t y, Data_t sy=Data_t(1.0))
Adds one entry with specified x, y and uncertainty.
Definition: SimpleFits.h:1412
template<typename T , unsigned int D>
bool lar::util::details::SimplePolyFitterDataBase< T, D >::add ( MeasurementAndUncertainty_t  value)
inline

Definition at line 367 of file SimpleFits.h.

367 { return stats.add(value); }
double value
Definition: spectrum.C:18
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
bool add(Data_t x, Data_t y, Data_t sy=Data_t(1.0))
Adds one entry with specified x, y and uncertainty.
Definition: SimpleFits.h:1412
template<typename T , unsigned int D>
template<typename VIter , typename UIter , typename VPred , typename UPred = identity>
unsigned int lar::util::details::SimplePolyFitterDataBase< T, D >::add_with_uncertainty ( VIter  begin_value,
VIter  end_value,
UIter  begin_uncertainty,
VPred  value_extractor,
UPred  uncertainty_extractor = UPred() 
)
inline

Definition at line 394 of file SimpleFits.h.

399  {
401  begin_value, end_value, begin_uncertainty, value_extractor, uncertainty_extractor);
402  }
unsigned int add_with_uncertainty(VIter begin_value, VIter end_value, UIter begin_uncertainty, VPred value_extractor, UPred uncertainty_extractor=UPred())
Adds measurements with uncertainties from a sequence.
Definition: SimpleFits.h:1442
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
template<typename Iter >
unsigned int lar::util::details::SimplePolyFitterDataBase< T, D >::add_with_uncertainty ( Iter  begin,
Iter  end 
)
inline

Definition at line 405 of file SimpleFits.h.

406  {
408  }
unsigned int add_with_uncertainty(VIter begin_value, VIter end_value, UIter begin_uncertainty, VPred value_extractor, UPred uncertainty_extractor=UPred())
Adds measurements with uncertainties from a sequence.
Definition: SimpleFits.h:1442
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
template<typename Cont >
unsigned int lar::util::details::SimplePolyFitterDataBase< T, D >::add_with_uncertainty ( Cont  cont)
inline

Definition at line 411 of file SimpleFits.h.

412  {
413  return stats.add_with_uncertainty(cont);
414  }
unsigned int add_with_uncertainty(VIter begin_value, VIter end_value, UIter begin_uncertainty, VPred value_extractor, UPred uncertainty_extractor=UPred())
Adds measurements with uncertainties from a sequence.
Definition: SimpleFits.h:1442
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
template<typename Iter >
void lar::util::details::SimplePolyFitterDataBase< T, D >::add_without_uncertainty ( Iter  begin,
Iter  end 
)
inline

Definition at line 370 of file SimpleFits.h.

371  {
373  }
void add_without_uncertainty(Iter begin, Iter end)
Adds measurements from a sequence, with no uncertainty.
Definition: SimpleFits.h:136
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
template<typename Iter , typename Pred >
void lar::util::details::SimplePolyFitterDataBase< T, D >::add_without_uncertainty ( Iter  begin,
Iter  end,
Pred  extractor 
)
inline

Definition at line 376 of file SimpleFits.h.

377  {
378  stats.add_without_uncertainty(begin, end, extractor);
379  }
void add_without_uncertainty(Iter begin, Iter end)
Adds measurements from a sequence, with no uncertainty.
Definition: SimpleFits.h:136
decltype(auto) constexpr end(T &&obj)
ADL-aware version of std::end.
Definition: StdUtils.h:77
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:69
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
template<typename Cont , typename Pred >
void lar::util::details::SimplePolyFitterDataBase< T, D >::add_without_uncertainty ( Cont  cont,
Pred  extractor 
)
inline

Definition at line 382 of file SimpleFits.h.

383  {
384  stats.add_without_uncertainty(cont, extractor);
385  }
void add_without_uncertainty(Iter begin, Iter end)
Adds measurements from a sequence, with no uncertainty.
Definition: SimpleFits.h:136
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
template<typename Cont >
void lar::util::details::SimplePolyFitterDataBase< T, D >::add_without_uncertainty ( Cont  cont)
inline

Definition at line 388 of file SimpleFits.h.

389  {
391  }
void add_without_uncertainty(Iter begin, Iter end)
Adds measurements from a sequence, with no uncertainty.
Definition: SimpleFits.h:136
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
Data_t lar::util::details::SimplePolyFitterDataBase< T, D >::AverageUncertainty ( ) const
inline

Definition at line 427 of file SimpleFits.h.

427 { return stats.AverageUncertainty(); }
Data_t AverageUncertainty() const
Returns an average of the uncertainties.
Definition: SimpleFits.h:280
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
void lar::util::details::SimplePolyFitterDataBase< T, D >::clear ( )
inline

Clears all the statistics.

Definition at line 419 of file SimpleFits.h.

419 { stats.clear(); }
void clear()
Clears all the statistics.
Definition: SimpleFits.h:1469
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
int lar::util::details::SimplePolyFitterDataBase< T, D >::N ( ) const
inline

Definition at line 425 of file SimpleFits.h.

425 { return stats.N(); }
int N() const
Returns the number of entries added.
Definition: SimpleFits.h:269
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
template<typename Stream >
void lar::util::details::SimplePolyFitterDataBase< T, D >::PrintStats ( Stream &  out) const
inline

Prints the collected statistics into a stream.

Definition at line 433 of file SimpleFits.h.

434  {
435  stats.Print(out);
436  }
void Print(Stream &out) const
Prints the statistics into a stream.
Definition: SimpleFits.h:1480
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
template<typename V >
static constexpr V lar::util::details::SimplePolyFitterDataBase< T, D >::sqr ( V const &  v)
inlinestatic

Returns the square of the specified value.

Definition at line 440 of file SimpleFits.h.

References sqr().

441  {
442  return Collector_t::sqr(v);
443  }
static constexpr V sqr(V const &v)
Returns the square of the specified value.
Definition: SimpleFits.h:284
template<typename T , unsigned int D>
Data_t lar::util::details::SimplePolyFitterDataBase< T, D >::XN ( unsigned int  n) const
inlineprotected

Returns the weighted sum of x^n.

Definition at line 449 of file SimpleFits.h.

References lar::util::details::FitDataCollector< T, D >::XN().

449 { return stats.XN(n); }
Data_t XN(unsigned int n) const
Returns the weighted sum of x^n.
Definition: SimpleFits.h:290
Char_t n[5]
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446
template<typename T , unsigned int D>
Data_t lar::util::details::SimplePolyFitterDataBase< T, D >::XNY ( unsigned int  n) const
inlineprotected

Returns the weighted sum of x^n y.

Definition at line 452 of file SimpleFits.h.

References lar::util::details::FitDataCollector< T, D >::XNY().

452 { return stats.XNY(n); }
Data_t XNY(unsigned int n) const
Returns the weighted sum of x^n y.
Definition: SimpleFits.h:293
Char_t n[5]
Collector_t stats
statistics collected from fit data input
Definition: SimpleFits.h:446

Member Data Documentation

template<typename T , unsigned int D>
constexpr unsigned int lar::util::details::SimplePolyFitterDataBase< T, D >::Degree = Collector_t::Degree
static

Degree of the fit.

Definition at line 347 of file SimpleFits.h.

template<typename T , unsigned int D>
Collector_t lar::util::details::SimplePolyFitterDataBase< T, D >::stats
protected

statistics collected from fit data input

Definition at line 446 of file SimpleFits.h.


The documentation for this class was generated from the following file: