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

List of all members.

Public Types

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

Public Member Functions

const std::string & title () const
std::string title ()
bool set_title (const std::string &a_title)
dim_t dimension () const
TN entries () const
TN all_entries () const
TN extra_entries () const
TW equivalent_bin_entries () const
TH sum_bin_heights () const
TH sum_all_bin_heights () const
TH sum_extra_bin_heights () const
TH min_bin_height () const
TH max_bin_height () const
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
void get_indices (bn_t aOffset, std::vector< int > &aIs) const
bool is_out (bn_t aOffset) const
bool get_offset (const std::vector< int > &aIs, bn_t &a_offset) const
const std::vector< TN > & bins_entries () const
const std::vector< TW > & bins_sum_w () const
const std::vector< TW > & bins_sum_w2 () const
const std::vector< std::vector
< TC > > & 
bins_sum_xw () const
const std::vector< std::vector
< TC > > & 
bins_sum_x2w () const
const axis< TC > & get_axis (int aIndex) const
bn_t get_bins () const
const std::string & get_title () const
dim_t get_dimension () const
bool is_valid () const

Protected Types

enum  { AxisX = 0, AxisY = 1, AxisZ = 2 }

Protected Member Functions

virtual TH get_bin_height (int) const =0
void base_from_data (const histo_data< TC, TN, TW > &a_from)
histo_data< TC, TN, TW > base_get_data () const
 base_histo ()
virtual ~base_histo ()
 base_histo (const base_histo &a_from)
base_histooperator= (const base_histo &a_from)
bool configure (dim_t a_dim, const std::vector< bn_t > &aNumbers, const std::vector< TC > &aMins, const std::vector< TC > &aMaxs)
bool configure (dim_t a_dim, const std::vector< std::vector< TC > > &aEdges)
void base_reset ()
void base_allocate ()
bool is_compatible (const base_histo &a_histo)
void base_add (const base_histo &a_histo)
void base_subtract (const base_histo &a_histo)
bool base_multiply (const base_histo &a_histo)
bool base_divide (const base_histo &a_histo)
bool base_multiply (TW aFactor)
bool get_ith_axis_mean (dim_t a_axis, TC &a_value) const
bool get_ith_axis_rms (dim_t a_axis, TC &a_value) const
TN get_bin_entries (const std::vector< int > &aIs) const

Protected 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 TH>
class inlib::histo::base_histo< TC, TN, TW, TH >

Definition at line 24 of file base_histo.


Member Typedef Documentation

template<class TC, class TN, class TW, class TH>
typedef axis<TC>::bn_t inlib::histo::base_histo< TC, TN, TW, TH >::bn_t
template<class TC, class TN, class TW, class TH>
typedef unsigned int inlib::histo::base_histo< TC, TN, TW, TH >::dim_t

Definition at line 31 of file base_histo.


Member Enumeration Documentation

template<class TC, class TN, class TW, class TH>
anonymous enum [protected]
Enumerator:
AxisX 
AxisY 
AxisZ 

Definition at line 211 of file base_histo.

{AxisX=0,AxisY=1,AxisZ=2};

Constructor & Destructor Documentation

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

Definition at line 64 of file base_histo.

  :m_dimension(0)
  ,m_bin_number(0)
  {
#ifdef INLIB_MEM
    mem::increment(s_class().c_str());
#endif
  }
template<class TC, class TN, class TW, class TH>
virtual inlib::histo::base_histo< TC, TN, TW, TH >::~base_histo ( ) [inline, protected, virtual]

Definition at line 73 of file base_histo.

                       {
#ifdef INLIB_MEM
    mem::decrement(s_class().c_str());
#endif
  }
template<class TC, class TN, class TW, class TH>
inlib::histo::base_histo< TC, TN, TW, TH >::base_histo ( const base_histo< TC, TN, TW, TH > &  a_from) [inline, protected]

Definition at line 79 of file base_histo.

  :m_title(a_from.m_title)
  ,m_dimension(a_from.m_dimension)
  ,m_bin_number(a_from.m_bin_number)
  // 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)
  {
#ifdef INLIB_MEM
    mem::increment(s_class().c_str());
#endif
  }

Member Function Documentation

template<class TC, class TN, class TW, class TH>
TN inlib::histo::base_histo< TC, TN, TW, TH >::all_entries ( ) const [inline]

Definition at line 119 of file base_histo.

                         {
    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, class TH>
void inlib::histo::base_histo< TC, TN, TW, TH >::base_add ( const base_histo< TC, TN, TW, TH > &  a_histo) [inline, protected]

Definition at line 466 of file base_histo.

                                          {
    // The only histogram operation that makes sense.
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      m_bin_entries[ibin] += a_histo.m_bin_entries[ibin];      
      m_bin_Sw[ibin] += a_histo.m_bin_Sw[ibin];      
      m_bin_Sw2[ibin] += a_histo.m_bin_Sw2[ibin];      
      for(dim_t iaxis=0;iaxis<m_dimension;iaxis++) {
        m_bin_Sxw[ibin][iaxis] += a_histo.m_bin_Sxw[ibin][iaxis];
        m_bin_Sx2w[ibin][iaxis] += a_histo.m_bin_Sx2w[ibin][iaxis];
      }
    }
  }
template<class TC, class TN, class TW, class TH>
void inlib::histo::base_histo< TC, TN, TW, TH >::base_allocate ( ) [inline, protected]

Definition at line 293 of file base_histo.

                       {
    dim_t iaxis;
    // Add two bins for the [under,out]flow data.
    bn_t n_bin = 1;
    for(iaxis=0;iaxis<m_dimension;iaxis++) {
      n_bin *= (m_axes[iaxis].bins() + 2);
    }
  
    m_bin_entries.resize(n_bin,0);
    m_bin_Sw.resize(n_bin,0);
    m_bin_Sw2.resize(n_bin,0);

    std::vector<TC> empty;
    empty.resize(m_dimension,0);
    m_bin_Sxw.resize(n_bin,empty);
    m_bin_Sx2w.resize(n_bin,empty);
    
    m_bin_number = n_bin; // All bins : [in-range, underflow, outflow] bins.
  
    m_axes[0].m_offset = 1;
    for(iaxis=1;iaxis<m_dimension;iaxis++) {
      m_axes[iaxis].m_offset = 
        m_axes[iaxis-1].m_offset * (m_axes[iaxis-1].bins()+2);
    }
    
  }
template<class TC, class TN, class TW, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::base_divide ( const base_histo< TC, TN, TW, TH > &  a_histo) [inline, protected]

Definition at line 525 of file base_histo.

                                              {
    //ill-defined operation. We keep that because of the "ill-defined past".
  
    // We build a new histo with one entry in each bin of weight : 
    //   this.w / a_histo.w
    // The current histo is overriden with this new histo.
    // The m_bin_Sw2 computation is consistent with FreeHEP and ROOT.
  
    if(!is_compatible(a_histo)) return false;

    std::vector<int> is(m_dimension);
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      get_indices(ibin,is);
      TW swa = m_bin_Sw[ibin];
      TW swb = a_histo.m_bin_Sw[ibin];
      TW sw2a = m_bin_Sw2[ibin];
      TW sw2b = a_histo.m_bin_Sw2[ibin];
      if(swb!=0) {
        m_bin_entries[ibin] = 1;
        TW sw = swa / swb;
        m_bin_Sw[ibin] = sw;
        TW swb2 = swb * swb;
        m_bin_Sw2[ibin] = sw2a / swb2 + sw2b * swa * swa /(swb2*swb2);
        for(dim_t iaxis=0;iaxis<m_dimension;iaxis++) {
          TC x = m_axes[iaxis].bin_center(is[iaxis]);
          m_bin_Sxw[ibin][iaxis] = x * sw;
          m_bin_Sx2w[ibin][iaxis] = x * x * sw;
        }
      } else {
        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;
        }
      }
    }
    return true;
  }
template<class TC, class TN, class TW, class TH>
void inlib::histo::base_histo< TC, TN, TW, TH >::base_from_data ( const histo_data< TC, TN, TW > &  a_from) [inline, protected]

Definition at line 35 of file base_histo.

                                                          {
    m_title = a_from.m_title;
    m_dimension = a_from.m_dimension;
    m_bin_number = a_from.m_bin_number;
    // 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, class TH>
histo_data<TC,TN,TW> inlib::histo::base_histo< TC, TN, TW, TH >::base_get_data ( ) const [inline, protected]

Definition at line 48 of file base_histo.

                                             {
    histo_data<TC,TN,TW> hd;
    hd.m_title = m_title;
    hd.m_dimension = m_dimension;
    hd.m_bin_number = m_bin_number;
    // Arrays :
    hd.m_bin_entries = m_bin_entries;
    hd.m_bin_Sw = m_bin_Sw;
    hd.m_bin_Sw2 = m_bin_Sw2;
    hd.m_bin_Sxw = m_bin_Sxw;
    hd.m_bin_Sx2w = m_bin_Sx2w;
    hd.m_axes = m_axes;
    //hd.m_annotations = m_annotations;
    return hd;
  }
template<class TC, class TN, class TW, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::base_multiply ( const base_histo< TC, TN, TW, TH > &  a_histo) [inline, protected]

Definition at line 495 of file base_histo.

                                                {  
    //ill-defined operation. We keep that because of the "ill-defined past".

    // We build a new histo with one entry in each bin of weight : 
    //   this.w * a_histo.w
    // The current histo is overriden with this new histo.
    // The m_bin_Sw2 computation is consistent with FreeHEP and ROOT.
  
    if(!is_compatible(a_histo)) return false;

    std::vector<int> is(m_dimension);
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      TW swa = m_bin_Sw[ibin];
      TW sw2a = m_bin_Sw2[ibin];
      TW swb = a_histo.m_bin_Sw[ibin];
      TW sw2b = a_histo.m_bin_Sw2[ibin];
      TW sw = swa * swb;
      m_bin_entries[ibin] = 1;
      m_bin_Sw[ibin] = sw;
      m_bin_Sw2[ibin] = sw2a * swb * swb + sw2b * swa * swa;
      get_indices(ibin,is);
      for(dim_t iaxis=0;iaxis<m_dimension;iaxis++) {
        TC x = m_axes[iaxis].bin_center(is[iaxis]);
        m_bin_Sxw[ibin][iaxis] = x * sw;
        m_bin_Sx2w[ibin][iaxis] = x * x * sw;
      }
    }
    return true;
  }
template<class TC, class TN, class TW, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::base_multiply ( TW  aFactor) [inline, protected]

Definition at line 566 of file base_histo.

                                 {
    if(aFactor<0) return false;
    TW factor2 = aFactor * aFactor;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      m_bin_Sw[ibin] *= aFactor;
      m_bin_Sw2[ibin] *= factor2;
      for(dim_t iaxis=0;iaxis<m_dimension;iaxis++) {
        m_bin_Sxw[ibin][iaxis] *= aFactor;
        m_bin_Sx2w[ibin][iaxis] *= aFactor;
      }
    }
    return true;
  }
template<class TC, class TN, class TW, class TH>
void inlib::histo::base_histo< TC, TN, TW, TH >::base_reset ( ) [inline, protected]

Definition at line 278 of file base_histo.

                    {
    // 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;
      }
    }
    //profile not done here.
  }
template<class TC, class TN, class TW, class TH>
void inlib::histo::base_histo< TC, TN, TW, TH >::base_subtract ( const base_histo< TC, TN, TW, TH > &  a_histo) [inline, protected]

Definition at line 479 of file base_histo.

                                                {
    //ill-defined operation. We keep that because of the "ill-defined past".
    // We build a new histo with one entry in each bin.
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      m_bin_entries[ibin] = 1;

      m_bin_Sw[ibin] -= a_histo.m_bin_Sw[ibin];      
      // Yes, it is a += in the below.
      m_bin_Sw2[ibin] += a_histo.m_bin_Sw2[ibin];
      for(dim_t iaxis=0;iaxis<m_dimension;iaxis++) {
        m_bin_Sxw[ibin][iaxis] -= a_histo.m_bin_Sxw[ibin][iaxis];
        m_bin_Sx2w[ibin][iaxis] -= a_histo.m_bin_Sx2w[ibin][iaxis];
      }
    }
  }
template<class TC, class TN, class TW, class TH>
const std::vector<TN>& inlib::histo::base_histo< TC, TN, TW, TH >::bins_entries ( ) const [inline]

Definition at line 429 of file base_histo.

{return m_bin_entries;}
template<class TC, class TN, class TW, class TH>
const std::vector<TW>& inlib::histo::base_histo< TC, TN, TW, TH >::bins_sum_w ( ) const [inline]

Definition at line 430 of file base_histo.

{return m_bin_Sw;}
template<class TC, class TN, class TW, class TH>
const std::vector<TW>& inlib::histo::base_histo< TC, TN, TW, TH >::bins_sum_w2 ( ) const [inline]

Definition at line 431 of file base_histo.

{return m_bin_Sw2;}
template<class TC, class TN, class TW, class TH>
const std::vector< std::vector<TC> >& inlib::histo::base_histo< TC, TN, TW, TH >::bins_sum_x2w ( ) const [inline]

Definition at line 433 of file base_histo.

{return m_bin_Sx2w;}
template<class TC, class TN, class TW, class TH>
const std::vector< std::vector<TC> >& inlib::histo::base_histo< TC, TN, TW, TH >::bins_sum_xw ( ) const [inline]

Definition at line 432 of file base_histo.

{return m_bin_Sxw;}
template<class TC, class TN, class TW, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::configure ( dim_t  a_dim,
const std::vector< bn_t > &  aNumbers,
const std::vector< TC > &  aMins,
const std::vector< TC > &  aMaxs 
) [inline, protected]

Definition at line 213 of file base_histo.

                                                                                                                    {
    // Clear :
    m_bin_entries.clear();
    m_bin_Sw.clear();
    m_bin_Sw2.clear();
    m_bin_Sxw.clear();
    m_bin_Sx2w.clear();
    m_axes.clear();
    m_bin_number = 0;
    m_dimension = 0;
    //m_annotations.clear();
    
    // Some checks :
    if(!a_dim) return false;
    m_axes.resize(a_dim);
    // Setup axes :
    for(dim_t iaxis=0;iaxis<a_dim;iaxis++) { 
      if(!m_axes[iaxis].configure(aNumbers[iaxis],aMins[iaxis],aMaxs[iaxis])) {
        // do not do :
        //   m_axes.clear()
        // so that :
        //   b1::axis(),b2::axis_[x,y]()
        // do not crash in case of a bad booking.
        //m_axes.clear();
        return false;
      }
    }
  
    m_dimension = a_dim;

    base_allocate(); //set m_bin_number.

    return true;
  }
template<class TC, class TN, class TW, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::configure ( dim_t  a_dim,
const std::vector< std::vector< TC > > &  aEdges 
) [inline, protected]

Definition at line 248 of file base_histo.

                                                                       {
    // Clear :
    m_bin_entries.clear();
    m_bin_Sw.clear();
    m_bin_Sw2.clear();
    m_bin_Sxw.clear();
    m_bin_Sx2w.clear();
    m_axes.clear();
    m_bin_number = 0;
    m_dimension = 0;
    //m_annotations.clear();

    // Some checks :
    if(!a_dim) return false;
    m_axes.resize(a_dim);
    // Setup axes :
    for(dim_t iaxis=0;iaxis<a_dim;iaxis++) { 
      if(!m_axes[iaxis].configure(aEdges[iaxis])) {
        //m_axes.clear();
        return false;
      }
    }
  
    m_dimension = a_dim;

    base_allocate(); //set m_bin_number.

    return true;
  }
template<class TC, class TN, class TW, class TH>
dim_t inlib::histo::base_histo< TC, TN, TW, TH >::dimension ( ) const [inline]

Definition at line 116 of file base_histo.

{return m_dimension;}
template<class TC, class TN, class TW, class TH>
TN inlib::histo::base_histo< TC, TN, TW, TH >::entries ( ) const [inline]

Definition at line 118 of file base_histo.

{ return get_entries();}
template<class TC, class TN, class TW, class TH>
TW inlib::histo::base_histo< TC, TN, TW, TH >::equivalent_bin_entries ( ) const [inline]

Definition at line 135 of file base_histo.

                                    {
    TW sw = 0;
    TW sw2 = 0;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(!is_out(ibin)) {
        sw += m_bin_Sw[ibin];
        sw2 += m_bin_Sw2[ibin];
      }
    }
    if(sw2==0) return 0;
    return (sw * sw)/sw2;
  }
template<class TC, class TN, class TW, class TH>
TN inlib::histo::base_histo< TC, TN, TW, TH >::extra_entries ( ) const [inline]

Definition at line 126 of file base_histo.

                           {
    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, class TH>
TN inlib::histo::base_histo< TC, TN, TW, TH >::get_all_entries ( ) const [inline]

Definition at line 373 of file base_histo.

                             {
    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, class TH>
const axis<TC>& inlib::histo::base_histo< TC, TN, TW, TH >::get_axis ( int  aIndex) const [inline]

Definition at line 436 of file base_histo.

{return m_axes[aIndex];}
template<class TC, class TN, class TW, class TH>
TN inlib::histo::base_histo< TC, TN, TW, TH >::get_bin_entries ( const std::vector< int > &  aIs) const [inline, protected]

Definition at line 615 of file base_histo.

                                                      {
    if(m_bin_number==0) return 0;
    bn_t offset;
    if(!get_offset(aIs,offset)) return 0;
    return m_bin_entries[offset];
  }
template<class TC, class TN, class TW, class TH>
virtual TH inlib::histo::base_histo< TC, TN, TW, TH >::get_bin_height ( int  ) const [protected, pure virtual]
template<class TC, class TN, class TW, class TH>
bn_t inlib::histo::base_histo< TC, TN, TW, TH >::get_bins ( ) const [inline]

Definition at line 437 of file base_histo.

{return m_bin_number;}
template<class TC, class TN, class TW, class TH>
dim_t inlib::histo::base_histo< TC, TN, TW, TH >::get_dimension ( ) const [inline]

Definition at line 439 of file base_histo.

{return m_dimension;}
template<class TC, class TN, class TW, class TH>
TN inlib::histo::base_histo< TC, TN, TW, TH >::get_entries ( ) const [inline]

Definition at line 322 of file base_histo.

                         {
    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, class TH>
void inlib::histo::base_histo< TC, TN, TW, TH >::get_indices ( bn_t  aOffset,
std::vector< int > &  aIs 
) const [inline]

Definition at line 381 of file base_histo.

                                                           {
    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(unsigned iaxis=0;iaxis<m_dimension;iaxis++) {
      if(aIs[iaxis]==0) {
        aIs[iaxis] = axis<TC>::UNDERFLOW_BIN;
      } else if(aIs[iaxis]==m_axes[iaxis].m_number_of_bins+1) {
        aIs[iaxis] = axis<TC>::OVERFLOW_BIN;
      } else {
        aIs[iaxis]--;
      }
    }
  }
template<class TC, class TN, class TW, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::get_ith_axis_mean ( dim_t  a_axis,
TC &  a_value 
) const [inline, protected]

Definition at line 580 of file base_histo.

                                                         {
    a_value = 0;
    if(a_axis>=m_dimension) return false;
    TW sw = 0;
    TC sxw = 0;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(!is_out(ibin)) {
        sw += m_bin_Sw[ibin];
        sxw += m_bin_Sxw[ibin][a_axis];
      }
    }
    if(sw==0) return false;
    a_value = sxw/sw;
    return true;
  }
template<class TC, class TN, class TW, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::get_ith_axis_rms ( dim_t  a_axis,
TC &  a_value 
) const [inline, protected]

Definition at line 596 of file base_histo.

                                                        {
    a_value = 0;
    if(a_axis>=m_dimension) return false;
    TW sw = 0;
    TC sxw = 0;
    TC sx2w = 0;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(!is_out(ibin)) {
        sw += m_bin_Sw[ibin];
        sxw += m_bin_Sxw[ibin][a_axis];
        sx2w += m_bin_Sx2w[ibin][a_axis];
      }
    }
    if(sw==0) return false;
    TC mean = sxw/sw;
    a_value = ::sqrt(::fabs((sx2w / sw) - mean * mean));
    return true;
  }
template<class TC, class TN, class TW, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::get_ith_axis_Sx2w ( dim_t  a_axis,
TC &  a_value 
) const [inline]

Definition at line 362 of file base_histo.

                                                         {
    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, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::get_ith_axis_Sxw ( dim_t  a_axis,
TC &  a_value 
) const [inline]

Definition at line 351 of file base_histo.

                                                        {
    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, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::get_offset ( const std::vector< int > &  aIs,
bn_t a_offset 
) const [inline]

Definition at line 410 of file base_histo.

                                                                  {
    // 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, class TH>
TW inlib::histo::base_histo< TC, TN, TW, TH >::get_Sw ( ) const [inline]

Definition at line 331 of file base_histo.

                    {
    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, class TH>
TW inlib::histo::base_histo< TC, TN, TW, TH >::get_Sw2 ( ) const [inline]

Definition at line 341 of file base_histo.

                     {
    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, class TH>
const std::string& inlib::histo::base_histo< TC, TN, TW, TH >::get_title ( ) const [inline]

Definition at line 438 of file base_histo.

{return m_title;}
template<class TC, class TN, class TW, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::is_compatible ( const base_histo< TC, TN, TW, TH > &  a_histo) [inline, protected]

Definition at line 458 of file base_histo.

                                               {
    if(m_dimension!=a_histo.m_dimension) return false;
    for(dim_t iaxis=0;iaxis<m_dimension;iaxis++) { 
      if(!m_axes[iaxis].is_compatible(a_histo.m_axes[iaxis])) return false;
    }
    return true;
  }
template<class TC, class TN, class TW, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::is_out ( bn_t  aOffset) const [inline]

Definition at line 398 of file base_histo.

                                  {
    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, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::is_valid ( ) const [inline]

Definition at line 440 of file base_histo.

{return (m_dimension?true:false);}
template<class TC, class TN, class TW, class TH>
TH inlib::histo::base_histo< TC, TN, TW, TH >::max_bin_height ( ) const [inline]

Definition at line 193 of file base_histo.

                            {
    TH value = 0;
    bool first = true;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(!is_out(ibin)) {
        TH vbin = get_bin_height(ibin);
        if(first) {
          first = false;
          value = vbin;
        } else {
          if(vbin>=value) value = vbin;
        }
      }
    }
    return value;
  }
template<class TC, class TN, class TW, class TH>
TH inlib::histo::base_histo< TC, TN, TW, TH >::min_bin_height ( ) const [inline]

Definition at line 176 of file base_histo.

                            {
    TH value = 0;
    bool first = true;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(!is_out(ibin)) {
        TH vbin = get_bin_height(ibin);
        if(first) {
          first = false;
          value = vbin;
        } else {
          if(vbin<=value) value = vbin;
        }
      }
    }
    return value;
  }
template<class TC, class TN, class TW, class TH>
base_histo& inlib::histo::base_histo< TC, TN, TW, TH >::operator= ( const base_histo< TC, TN, TW, TH > &  a_from) [inline, protected]

Definition at line 97 of file base_histo.

                                                  {
    m_title = a_from.m_title;
    m_dimension = a_from.m_dimension;
    m_bin_number = a_from.m_bin_number;
    // 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;
  }
template<class TC, class TN, class TW, class TH>
bool inlib::histo::base_histo< TC, TN, TW, TH >::set_title ( const std::string &  a_title) [inline]

Definition at line 115 of file base_histo.

{m_title = a_title;return true;}
template<class TC, class TN, class TW, class TH>
TH inlib::histo::base_histo< TC, TN, TW, TH >::sum_all_bin_heights ( ) const [inline]

Definition at line 158 of file base_histo.

                                 {
    TH sh = 0;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      sh += get_bin_height(ibin);
    }
    return sh;
  }
template<class TC, class TN, class TW, class TH>
TH inlib::histo::base_histo< TC, TN, TW, TH >::sum_bin_heights ( ) const [inline]

Definition at line 148 of file base_histo.

                             {
    TH sh = 0;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(!is_out(ibin)) {
        sh += get_bin_height(ibin);
      }
    }
    return sh;
  }
template<class TC, class TN, class TW, class TH>
TH inlib::histo::base_histo< TC, TN, TW, TH >::sum_extra_bin_heights ( ) const [inline]

Definition at line 166 of file base_histo.

                                   {
    TH sh = 0;
    for(bn_t ibin=0;ibin<m_bin_number;ibin++) {
      if(is_out(ibin)) {
        sh += get_bin_height(ibin);
      }
    }
    return sh;
  }
template<class TC, class TN, class TW, class TH>
const std::string& inlib::histo::base_histo< TC, TN, TW, TH >::title ( ) const [inline]

Definition at line 113 of file base_histo.

{return m_title;}
template<class TC, class TN, class TW, class TH>
std::string inlib::histo::base_histo< TC, TN, TW, TH >::title ( ) [inline]

Definition at line 114 of file base_histo.

{return m_title;}

Member Data Documentation

template<class TC, class TN, class TW, class TH>
std::vector< axis<TC> > inlib::histo::base_histo< TC, TN, TW, TH >::m_axes [protected]

Definition at line 634 of file base_histo.

template<class TC, class TN, class TW, class TH>
std::vector<TN> inlib::histo::base_histo< TC, TN, TW, TH >::m_bin_entries [protected]

Definition at line 628 of file base_histo.

template<class TC, class TN, class TW, class TH>
bn_t inlib::histo::base_histo< TC, TN, TW, TH >::m_bin_number [protected]

Definition at line 627 of file base_histo.

template<class TC, class TN, class TW, class TH>
std::vector<TW> inlib::histo::base_histo< TC, TN, TW, TH >::m_bin_Sw [protected]

Definition at line 629 of file base_histo.

template<class TC, class TN, class TW, class TH>
std::vector<TW> inlib::histo::base_histo< TC, TN, TW, TH >::m_bin_Sw2 [protected]

Definition at line 630 of file base_histo.

template<class TC, class TN, class TW, class TH>
std::vector< std::vector<TC> > inlib::histo::base_histo< TC, TN, TW, TH >::m_bin_Sx2w [protected]

Definition at line 632 of file base_histo.

template<class TC, class TN, class TW, class TH>
std::vector< std::vector<TC> > inlib::histo::base_histo< TC, TN, TW, TH >::m_bin_Sxw [protected]

Definition at line 631 of file base_histo.

template<class TC, class TN, class TW, class TH>
dim_t inlib::histo::base_histo< TC, TN, TW, TH >::m_dimension [protected]

Definition at line 625 of file base_histo.

template<class TC, class TN, class TW, class TH>
std::string inlib::histo::base_histo< TC, TN, TW, TH >::m_title [protected]

Definition at line 624 of file base_histo.


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