Jpp  master_rocky
the software that should make you happy
Public Types | Public Member Functions | Protected Attributes | List of all members
JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t > Struct Template Reference

2D Binned element. More...

#include <JElement.hh>

Inheritance diagram for JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >:
JTOOLS::JElement2D< JAbscissa_t, JOrdinate_t > JMATH::JMath< JFirst_t, JSecond_t >

Public Types

typedef JElement2D< JAbscissa_t, JOrdinate_t > element_type
 
typedef element_type::abscissa_type abscissa_type
 
typedef element_type::ordinate_type ordinate_type
 

Public Member Functions

 JBin2D ()
 Default constructor. More...
 
 JBin2D (typename JLANG::JClass< abscissa_type >::argument_type x, typename JLANG::JClass< ordinate_type >::argument_type y)
 Constructor. More...
 
void fill (typename JLANG::JClass< abscissa_type >::argument_type x, typename JLANG::JClass< ordinate_type >::argument_type w)
 Add abscissa value. More...
 
abscissa_type getBinCenter () const
 Get bin center. More...
 
ordinate_type getBinContent () const
 Get bin content. More...
 
ordinate_type getBinError () const
 Get bin error. More...
 
JBin2Dadd (const JBin2D &bin)
 Add bin. More...
 
JBin2Dmul (const double value)
 Scale contents. More...
 
JBin2Ddiv (const double value)
 Scale contents. More...
 
abscissa_type getX () const
 Get abscissa value. More...
 
const ordinate_typegetY () const
 Get ordinate value. More...
 
ordinate_typegetY ()
 Get ordinate value. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 

Protected Attributes

ordinate_type __z
 
ordinate_type __w2
 
abscissa_type __x
 
ordinate_type __y
 

Detailed Description

template<class JAbscissa_t, class JOrdinate_t>
struct JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >

2D Binned element.

Note that the internal data members needed for the calculation of the bin center are not subject to I/O, i.e. the I/O of this class is identical to that of the JElement2D class.

Definition at line 351 of file JElement.hh.

Member Typedef Documentation

◆ element_type

template<class JAbscissa_t , class JOrdinate_t >
typedef JElement2D<JAbscissa_t, JOrdinate_t> JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::element_type

Definition at line 356 of file JElement.hh.

◆ abscissa_type

template<class JAbscissa_t , class JOrdinate_t >
typedef element_type::abscissa_type JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::abscissa_type

Definition at line 357 of file JElement.hh.

◆ ordinate_type

template<class JAbscissa_t , class JOrdinate_t >
typedef element_type::ordinate_type JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::ordinate_type

Definition at line 358 of file JElement.hh.

Constructor & Destructor Documentation

◆ JBin2D() [1/2]

template<class JAbscissa_t , class JOrdinate_t >
JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::JBin2D ( )
inline

Default constructor.

Definition at line 364 of file JElement.hh.

364  :
365  element_type(),
366  __z (getZero<ordinate_type>()),
367  __w2(getZero<ordinate_type>())
368  {}
JElement2D< JAbscissa_t, JOrdinate_t > element_type
Definition: JElement.hh:356
ordinate_type __w2
Definition: JElement.hh:486
ordinate_type __z
Definition: JElement.hh:485

◆ JBin2D() [2/2]

template<class JAbscissa_t , class JOrdinate_t >
JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::JBin2D ( typename JLANG::JClass< abscissa_type >::argument_type  x,
typename JLANG::JClass< ordinate_type >::argument_type  y 
)
inline

Constructor.

Parameters
xabscissa value
yordinate value

Definition at line 377 of file JElement.hh.

378  :
379  element_type(x,y),
380  __z (getZero<ordinate_type>()),
381  __w2(getZero<ordinate_type>())
382  {}

Member Function Documentation

◆ fill()

template<class JAbscissa_t , class JOrdinate_t >
void JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::fill ( typename JLANG::JClass< abscissa_type >::argument_type  x,
typename JLANG::JClass< ordinate_type >::argument_type  w 
)
inline

Add abscissa value.

Parameters
xabscissa value
wweight

Definition at line 391 of file JElement.hh.

393  {
394  this->__y += w;
395  this->__z += w * x;
396  this->__w2 += w * w;
397  }
data_type w[N+1][M+1]
Definition: JPolint.hh:867
ordinate_type __y
Definition: JElement.hh:141

◆ getBinCenter()

template<class JAbscissa_t , class JOrdinate_t >
abscissa_type JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::getBinCenter ( ) const
inline

Get bin center.

Returns
center

Definition at line 405 of file JElement.hh.

406  {
407  if (this->__y != 0)
408  return this->__z / this->__y;
409  else
410  return this->__x;
411  }
abscissa_type __x
Definition: JElement.hh:140

◆ getBinContent()

template<class JAbscissa_t , class JOrdinate_t >
ordinate_type JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::getBinContent ( ) const
inline

Get bin content.

Returns
content

Definition at line 419 of file JElement.hh.

420  {
421  return this->__y;
422  }

◆ getBinError()

template<class JAbscissa_t , class JOrdinate_t >
ordinate_type JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::getBinError ( ) const
inline

Get bin error.

Returns
error

Definition at line 430 of file JElement.hh.

431  {
432  return sqrt(this->__w2);
433  }

◆ add()

template<class JAbscissa_t , class JOrdinate_t >
JBin2D& JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::add ( const JBin2D< JAbscissa_t, JOrdinate_t > &  bin)
inline

Add bin.

Parameters
binbin
Returns
this bin

Definition at line 442 of file JElement.hh.

443  {
444  this->__y += bin.__y;
445  this->__z += bin.__zl;
446  this->__w2 += bin.__w2;
447 
448  return *this;
449  }

◆ mul() [1/2]

template<class JAbscissa_t , class JOrdinate_t >
JBin2D& JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::mul ( const double  value)
inline

Scale contents.

Parameters
valuemultiplication factor
Returns
this bin

Definition at line 458 of file JElement.hh.

459  {
460  this->__y *= value;
461  this->__z *= value;
462  this->__w2 *= value*value;
463 
464  return *this;
465  }

◆ div()

template<class JAbscissa_t , class JOrdinate_t >
JBin2D& JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::div ( const double  value)
inline

Scale contents.

Parameters
valuedivision factor
Returns
this bin

Definition at line 474 of file JElement.hh.

475  {
476  this->__y /= value;
477  this->__z /= value;
478  this->__w2 /= value*value;
479 
480  return *this;
481  }

◆ getX()

template<class JAbscissa_t , class JOrdinate_t >
abscissa_type JTOOLS::JElement2D< JAbscissa_t, JOrdinate_t >::getX ( ) const
inlineinherited

Get abscissa value.

Returns
abscissa value

Definition at line 79 of file JElement.hh.

80  {
81  return __x;
82  }

◆ getY() [1/2]

template<class JAbscissa_t , class JOrdinate_t >
const ordinate_type& JTOOLS::JElement2D< JAbscissa_t, JOrdinate_t >::getY ( ) const
inlineinherited

Get ordinate value.

Returns
ordinate value

Definition at line 90 of file JElement.hh.

91  {
92  return __y;
93  }

◆ getY() [2/2]

template<class JAbscissa_t , class JOrdinate_t >
ordinate_type& JTOOLS::JElement2D< JAbscissa_t, JOrdinate_t >::getY ( )
inlineinherited

Get ordinate value.

Returns
ordinate value

Definition at line 101 of file JElement.hh.

102  {
103  return __y;
104  }

◆ mul() [2/2]

template<class JFirst_t , class JSecond_t >
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355  {
356  return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357  }

Member Data Documentation

◆ __z

template<class JAbscissa_t , class JOrdinate_t >
ordinate_type JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::__z
protected

Definition at line 485 of file JElement.hh.

◆ __w2

template<class JAbscissa_t , class JOrdinate_t >
ordinate_type JTOOLS::JBin2D< JAbscissa_t, JOrdinate_t >::__w2
protected

Definition at line 486 of file JElement.hh.

◆ __x

template<class JAbscissa_t , class JOrdinate_t >
abscissa_type JTOOLS::JElement2D< JAbscissa_t, JOrdinate_t >::__x
protectedinherited

Definition at line 140 of file JElement.hh.

◆ __y

template<class JAbscissa_t , class JOrdinate_t >
ordinate_type JTOOLS::JElement2D< JAbscissa_t, JOrdinate_t >::__y
protectedinherited

Definition at line 141 of file JElement.hh.


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