Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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< JBin2D< JAbscissa_t, JOrdinate_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...
 
JBin2D< JAbscissa_t,
JOrdinate_t > & 
mul (const JNullType &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 349 of file JElement.hh.

Member Typedef Documentation

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

Definition at line 354 of file JElement.hh.

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

Definition at line 355 of file JElement.hh.

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

Definition at line 356 of file JElement.hh.

Constructor & Destructor Documentation

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

Default constructor.

Definition at line 362 of file JElement.hh.

362  :
363  element_type(),
364  __z (getZero<ordinate_type>()),
365  __w2(getZero<ordinate_type>())
366  {}
ordinate_type __z
Definition: JElement.hh:483
JElement2D< JAbscissa_t, JOrdinate_t > element_type
Definition: JElement.hh:354
ordinate_type __w2
Definition: JElement.hh:484
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 375 of file JElement.hh.

376  :
377  element_type(x,y),
378  __z (getZero<ordinate_type>()),
379  __w2(getZero<ordinate_type>())
380  {}
ordinate_type __z
Definition: JElement.hh:483
JElement2D< JAbscissa_t, JOrdinate_t > element_type
Definition: JElement.hh:354
ordinate_type __w2
Definition: JElement.hh:484

Member Function Documentation

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 389 of file JElement.hh.

391  {
392  this->__y += w;
393  this->__z += w * x;
394  this->__w2 += w * w;
395  }
data_type w[N+1][M+1]
Definition: JPolint.hh:708
ordinate_type __z
Definition: JElement.hh:483
ordinate_type __w2
Definition: JElement.hh:484
ordinate_type __y
Definition: JElement.hh:139
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 403 of file JElement.hh.

404  {
405  if (this->__y != 0)
406  return this->__z / this->__y;
407  else
408  return this->__x;
409  }
ordinate_type __z
Definition: JElement.hh:483
ordinate_type __y
Definition: JElement.hh:139
abscissa_type __x
Definition: JElement.hh:138
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 417 of file JElement.hh.

418  {
419  return this->__y;
420  }
ordinate_type __y
Definition: JElement.hh:139
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 428 of file JElement.hh.

429  {
430  return sqrt(this->__w2);
431  }
ordinate_type __w2
Definition: JElement.hh:484
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 440 of file JElement.hh.

441  {
442  this->__y += bin.__y;
443  this->__z += bin.__zl;
444  this->__w2 += bin.__w2;
445 
446  return *this;
447  }
ordinate_type __z
Definition: JElement.hh:483
ordinate_type __w2
Definition: JElement.hh:484
ordinate_type __y
Definition: JElement.hh:139
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 456 of file JElement.hh.

457  {
458  this->__y *= value;
459  this->__z *= value;
460  this->__w2 *= value*value;
461 
462  return *this;
463  }
ordinate_type __z
Definition: JElement.hh:483
ordinate_type __w2
Definition: JElement.hh:484
ordinate_type __y
Definition: JElement.hh:139
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 472 of file JElement.hh.

473  {
474  this->__y /= value;
475  this->__z /= value;
476  this->__w2 /= value*value;
477 
478  return *this;
479  }
ordinate_type __z
Definition: JElement.hh:483
ordinate_type __w2
Definition: JElement.hh:484
ordinate_type __y
Definition: JElement.hh:139
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 77 of file JElement.hh.

78  {
79  return __x;
80  }
abscissa_type __x
Definition: JElement.hh:138
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 88 of file JElement.hh.

89  {
90  return __y;
91  }
ordinate_type __y
Definition: JElement.hh:139
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 99 of file JElement.hh.

100  {
101  return __y;
102  }
ordinate_type __y
Definition: JElement.hh:139
JBin2D< JAbscissa_t, JOrdinate_t > & JMATH::JMath< JBin2D< JAbscissa_t, JOrdinate_t > , JNullType >::mul ( const JNullType object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18

Member Data Documentation

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

Definition at line 483 of file JElement.hh.

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

Definition at line 484 of file JElement.hh.

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

Definition at line 138 of file JElement.hh.

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

Definition at line 139 of file JElement.hh.


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