inlib  1.2.0
Public Types | Public Member Functions | Public Attributes
inlib::histo::histo_data< TC, TN, TW > Class Template Reference
Inheritance diagram for inlib::histo::histo_data< TC, TN, TW >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef axis< TC >::bn_t bn_t
typedef unsigned int dim_t

Public Member Functions

 histo_data ()
 histo_data (const histo_data &a_from)
histo_dataoperator= (const histo_data &a_from)
virtual ~histo_data ()
void base_reset ()
TN get_entries () const
TW get_Sw () const
TW get_Sw2 () const
bool get_ith_axis_Sxw (dim_t a_axis, TC &a_value) const
bool get_ith_axis_Sx2w (dim_t a_axis, TC &a_value) const
TN get_all_entries () const
bool is_out (bn_t aOffset) const
void get_indices (bn_t aOffset, std::vector< int > &aIs) const
bool get_offset (const std::vector< int > &aIs, bn_t &a_offset) const

Public Attributes

std::string m_title
dim_t m_dimension
bn_t m_bin_number
std::vector< TN > m_bin_entries
std::vector< TW > m_bin_Sw
std::vector< TW > m_bin_Sw2
std::vector< std::vector< TC > > m_bin_Sxw
std::vector< std::vector< TC > > m_bin_Sx2w
std::vector< axis< TC > > m_axes

Detailed Description

template<class TC, class TN, class TW>
class inlib::histo::histo_data< TC, TN, TW >

Definition at line 20 of file histo_data.


Member Typedef Documentation

template<class TC, class TN, class TW>
typedef axis<TC>::bn_t inlib::histo::histo_data< TC, TN, TW >::bn_t

Definition at line 22 of file histo_data.

template<class TC, class TN, class TW>
typedef unsigned int inlib::histo::histo_data< TC, TN, TW >::dim_t

Definition at line 23 of file histo_data.


Constructor & Destructor Documentation

template<class TC, class TN, class TW>
inlib::histo::histo_data< TC, TN, TW >::histo_data ( ) [inline]

Definition at line 25 of file histo_data.

  :m_dimension(0)
  ,m_bin_number(0)
  //,m_mode(0)
  {}
template<class TC, class TN, class TW>
inlib::histo::histo_data< TC, TN, TW >::histo_data ( const histo_data< TC, TN, TW > &  a_from) [inline]

Definition at line 31 of file histo_data.

  :m_title(a_from.m_title)
  ,m_dimension(a_from.m_dimension)
  ,m_bin_number(a_from.m_bin_number)
  //,m_mode(a_from.m_mode)
  // Arrays :
  ,m_bin_entries(a_from.m_bin_entries)
  ,m_bin_Sw(a_from.m_bin_Sw)
  ,m_bin_Sw2(a_from.m_bin_Sw2)
  ,m_bin_Sxw(a_from.m_bin_Sxw)
  ,m_bin_Sx2w(a_from.m_bin_Sx2w)
  ,m_axes(a_from.m_axes)
  //,m_annotations(a_from.m_annotations)
  {}
template<class TC, class TN, class TW>
virtual inlib::histo::histo_data< TC, TN, TW >::~histo_data ( ) [inline, virtual]

Definition at line 63 of file histo_data.

{}

Member Function Documentation

template<class TC, class TN, class TW>
void inlib::histo::histo_data< TC, TN, TW >::base_reset ( ) [inline]

Definition at line 65 of file histo_data.

                    { //used in multiply,divide.
    // Reset content (different of clear that deallocate all internal things).
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      m_bin_entries[ibin] = 0;
      m_bin_Sw[ibin] = 0;
      m_bin_Sw2[ibin] = 0;
      for(dim_t iaxis=0;iaxis<m_dimension;iaxis++) {
        m_bin_Sxw[ibin][iaxis] = 0;
        m_bin_Sx2w[ibin][iaxis] = 0;
      }
    }
  }
template<class TC, class TN, class TW>
TN inlib::histo::histo_data< TC, TN, TW >::get_all_entries ( ) const [inline]

Definition at line 131 of file histo_data.

                             {
    TN number = 0;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      number += m_bin_entries[ibin];
    }
    return number;
  }
template<class TC, class TN, class TW>
TN inlib::histo::histo_data< TC, TN, TW >::get_entries ( ) const [inline]

Definition at line 80 of file histo_data.

                         {
    TN number = 0;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(!is_out(ibin)) {
        number += m_bin_entries[ibin];
      }
    }
    return number;
  }
template<class TC, class TN, class TW>
void inlib::histo::histo_data< TC, TN, TW >::get_indices ( bn_t  aOffset,
std::vector< int > &  aIs 
) const [inline]

Definition at line 151 of file histo_data.

                                                           {
    int offset = aOffset;
   {for(int iaxis=m_dimension-1;iaxis>=0;iaxis--) { 
      aIs[iaxis] = offset/m_axes[iaxis].m_offset;
      offset -= aIs[iaxis] * m_axes[iaxis].m_offset;
    }}
    for(dim_t iaxis=0;iaxis<m_dimension;iaxis++) {
      if(aIs[iaxis]==0) {
        aIs[iaxis] = axis<TC>::UNDERFLOW_BIN;
      } else if(aIs[iaxis]==int(m_axes[iaxis].m_number_of_bins)+1) {
        aIs[iaxis] = axis<TC>::OVERFLOW_BIN;
      } else {
        aIs[iaxis]--;
      }
    }
  }
template<class TC, class TN, class TW>
bool inlib::histo::histo_data< TC, TN, TW >::get_ith_axis_Sx2w ( dim_t  a_axis,
TC &  a_value 
) const [inline]

Definition at line 120 of file histo_data.

                                                         {
    a_value = 0;
    if(a_axis>=m_dimension) return false;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(!is_out(ibin)) {
        a_value += m_bin_Sx2w[ibin][a_axis];
      }
    }
    return true;
  }
template<class TC, class TN, class TW>
bool inlib::histo::histo_data< TC, TN, TW >::get_ith_axis_Sxw ( dim_t  a_axis,
TC &  a_value 
) const [inline]

Definition at line 109 of file histo_data.

                                                        {
    a_value = 0;
    if(a_axis>=m_dimension) return false;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(!is_out(ibin)) {
        a_value += m_bin_Sxw[ibin][a_axis];
      }
    }
    return true;
  }
template<class TC, class TN, class TW>
bool inlib::histo::histo_data< TC, TN, TW >::get_offset ( const std::vector< int > &  aIs,
bn_t a_offset 
) const [inline]

Definition at line 169 of file histo_data.

                                                                  {
    // aIs[iaxis] is given in in-range indexing :
    //  - [0,n[iaxis]-1] for in-range bins
    //  - UNDERFLOW_BIN for the iaxis underflow bin
    //  - OVERFLOW_BIN for the iaxis overflow bin
    a_offset = 0;
    if(!m_dimension) return false;
    bn_t ibin;
    for(dim_t iaxis=0;iaxis<m_dimension;iaxis++) { 
      if(!m_axes[iaxis].in_range_to_absolute_index(aIs[iaxis],ibin)) {
        a_offset = 0;
        return false;
      }
      a_offset += ibin * m_axes[iaxis].m_offset;
    }
    return true;
  }
template<class TC, class TN, class TW>
TW inlib::histo::histo_data< TC, TN, TW >::get_Sw ( ) const [inline]

Definition at line 89 of file histo_data.

                    {
    TW sw = 0;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(!is_out(ibin)) {
        sw += m_bin_Sw[ibin];
      }
    }
    return sw;
  }
template<class TC, class TN, class TW>
TW inlib::histo::histo_data< TC, TN, TW >::get_Sw2 ( ) const [inline]

Definition at line 99 of file histo_data.

                     {
    TW sw2 = 0;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(!is_out(ibin)) {
        sw2 += m_bin_Sw2[ibin];
      }
    }
    return sw2;
  }
template<class TC, class TN, class TW>
bool inlib::histo::histo_data< TC, TN, TW >::is_out ( bn_t  aOffset) const [inline]

Definition at line 139 of file histo_data.

                                  {
    int offset = aOffset;
    int index;
    for(int iaxis=m_dimension-1;iaxis>=0;iaxis--) { 
      index = offset/m_axes[iaxis].m_offset;
      if(index==0) return true;
      if(index==(int(m_axes[iaxis].m_number_of_bins)+1)) return true;
      offset -= index * m_axes[iaxis].m_offset;
    }
    return false;
  }
template<class TC, class TN, class TW>
histo_data& inlib::histo::histo_data< TC, TN, TW >::operator= ( const histo_data< TC, TN, TW > &  a_from) [inline]

Reimplemented in inlib::histo::profile_data< TC, TN, TW, TV >.

Definition at line 46 of file histo_data.

                                                  {
    m_title = a_from.m_title;
    m_dimension = a_from.m_dimension;
    m_bin_number = a_from.m_bin_number;
    //m_mode = a_from.m_mode;
    // Arrays :
    m_bin_entries = a_from.m_bin_entries;
    m_bin_Sw = a_from.m_bin_Sw;
    m_bin_Sw2 = a_from.m_bin_Sw2;
    m_bin_Sxw = a_from.m_bin_Sxw;
    m_bin_Sx2w = a_from.m_bin_Sx2w;
    m_axes = a_from.m_axes;
    //
    //m_annotations = a_from.m_annotations;
    return *this;
  }

Member Data Documentation

template<class TC, class TN, class TW>
std::vector< axis<TC> > inlib::histo::histo_data< TC, TN, TW >::m_axes

Definition at line 199 of file histo_data.

template<class TC, class TN, class TW>
std::vector<TN> inlib::histo::histo_data< TC, TN, TW >::m_bin_entries

Definition at line 193 of file histo_data.

template<class TC, class TN, class TW>
bn_t inlib::histo::histo_data< TC, TN, TW >::m_bin_number

Definition at line 192 of file histo_data.

template<class TC, class TN, class TW>
std::vector<TW> inlib::histo::histo_data< TC, TN, TW >::m_bin_Sw

Definition at line 194 of file histo_data.

template<class TC, class TN, class TW>
std::vector<TW> inlib::histo::histo_data< TC, TN, TW >::m_bin_Sw2

Definition at line 195 of file histo_data.

template<class TC, class TN, class TW>
std::vector< std::vector<TC> > inlib::histo::histo_data< TC, TN, TW >::m_bin_Sx2w

Definition at line 197 of file histo_data.

template<class TC, class TN, class TW>
std::vector< std::vector<TC> > inlib::histo::histo_data< TC, TN, TW >::m_bin_Sxw

Definition at line 196 of file histo_data.

template<class TC, class TN, class TW>
dim_t inlib::histo::histo_data< TC, TN, TW >::m_dimension

Definition at line 190 of file histo_data.

template<class TC, class TN, class TW>
std::string inlib::histo::histo_data< TC, TN, TW >::m_title

Definition at line 189 of file histo_data.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines