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 > Class 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>
class 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 353 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 360 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 361 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 362 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 368 of file JElement.hh.

368  :
369  element_type(),
370  __z (getZero<ordinate_type>()),
371  __w2(getZero<ordinate_type>())
372  {}
ordinate_type __z
Definition: JElement.hh:489
JElement2D< JAbscissa_t, JOrdinate_t > element_type
Definition: JElement.hh:360
ordinate_type __w2
Definition: JElement.hh:490
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 381 of file JElement.hh.

382  :
383  element_type(x,y),
384  __z (getZero<ordinate_type>()),
385  __w2(getZero<ordinate_type>())
386  {}
ordinate_type __z
Definition: JElement.hh:489
JElement2D< JAbscissa_t, JOrdinate_t > element_type
Definition: JElement.hh:360
ordinate_type __w2
Definition: JElement.hh:490

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

397  {
398  this->__y += w;
399  this->__z += w * x;
400  this->__w2 += w * w;
401  }
ordinate_type __z
Definition: JElement.hh:489
ordinate_type __y
Definition: JElement.hh:140
ordinate_type __w2
Definition: JElement.hh:490
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 409 of file JElement.hh.

410  {
411  if (this->__y != 0)
412  return this->__z / this->__y;
413  else
414  return this->__x;
415  }
ordinate_type __z
Definition: JElement.hh:489
ordinate_type __y
Definition: JElement.hh:140
abscissa_type __x
Definition: JElement.hh:139
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 423 of file JElement.hh.

424  {
425  return this->__y;
426  }
ordinate_type __y
Definition: JElement.hh:140
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 434 of file JElement.hh.

435  {
436  return sqrt(this->__w2);
437  }
ordinate_type __w2
Definition: JElement.hh:490
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 446 of file JElement.hh.

447  {
448  this->__y += bin.__y;
449  this->__z += bin.__zl;
450  this->__w2 += bin.__w2;
451 
452  return *this;
453  }
ordinate_type __z
Definition: JElement.hh:489
ordinate_type __y
Definition: JElement.hh:140
ordinate_type __w2
Definition: JElement.hh:490
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 462 of file JElement.hh.

463  {
464  this->__y *= value;
465  this->__z *= value;
466  this->__w2 *= value*value;
467 
468  return *this;
469  }
ordinate_type __z
Definition: JElement.hh:489
ordinate_type __y
Definition: JElement.hh:140
ordinate_type __w2
Definition: JElement.hh:490
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 478 of file JElement.hh.

479  {
480  this->__y /= value;
481  this->__z /= value;
482  this->__w2 /= value*value;
483 
484  return *this;
485  }
ordinate_type __z
Definition: JElement.hh:489
ordinate_type __y
Definition: JElement.hh:140
ordinate_type __w2
Definition: JElement.hh:490
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 78 of file JElement.hh.

79  {
80  return __x;
81  }
abscissa_type __x
Definition: JElement.hh:139
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 89 of file JElement.hh.

90  {
91  return __y;
92  }
ordinate_type __y
Definition: JElement.hh:140
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 100 of file JElement.hh.

101  {
102  return __y;
103  }
ordinate_type __y
Definition: JElement.hh:140
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 product evaluation of 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 489 of file JElement.hh.

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

Definition at line 490 of file JElement.hh.

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

Definition at line 139 of file JElement.hh.

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

Definition at line 140 of file JElement.hh.


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