Anp::Bin< T > Class Template Reference

#include <Hist1d.h>

List of all members.

Public Member Functions

 Bin ()
 Bin (unsigned int bin, const T edge)
 Bin (const Bin &lhs, const Bin &rhs)
 ~Bin ()
void add ()
void add (const T &weight)
void set_bin (unsigned int bin)
void set_sum (const T &sum, const T &sum2)
void set_ent (unsigned int entries)
void reset ()
unsigned int bin () const
unsigned int entries () const
edge () const
sum () const
sum2 () const
void print (std::ostream &o=std::cout, short width=0, short precision=0) const

Private Attributes

unsigned int fBin
unsigned int fNEntry
fEdge
fSum
fSum2

Detailed Description

template<typename T>
class Anp::Bin< T >

Definition at line 31 of file Hist1d.h.


Constructor & Destructor Documentation

template<typename T >
Anp::Bin< T >::Bin (  )  [inline]

Definition at line 158 of file Hist1d.h.

00159          : fBin(), fNEntry(0), fEdge(), fSum(0), fSum2(0) {}

template<typename T >
Anp::Bin< T >::Bin ( unsigned int  bin,
const T  edge 
) [inline]

Definition at line 163 of file Hist1d.h.

00164          : fBin(bin), fNEntry(0), fEdge(edge), fSum(0), fSum2(0) {}

template<typename T >
Anp::Bin< T >::Bin ( const Bin< T > &  lhs,
const Bin< T > &  rhs 
) [inline]

Definition at line 167 of file Hist1d.h.

References Anp::Bin< T >::bin(), Anp::Bin< T >::edge(), Anp::Bin< T >::fBin, and Anp::Bin< T >::fEdge.

00167                                                 :
00168       fBin(lhs.bin()),
00169       fNEntry(lhs.entries() + rhs.entries()),
00170       fEdge(lhs.edge()),
00171       fSum(lhs.sum() + rhs.sum()),
00172       fSum2(lhs.sum2() + rhs.sum2())
00173    {
00174       if(rhs.bin() < lhs.bin())
00175       {
00176          fBin = rhs.bin();
00177       }
00178       if(rhs.edge() < lhs.edge())
00179       {
00180          fEdge = rhs.edge();
00181       }      
00182    }

template<typename T >
Anp::Bin< T >::~Bin (  )  [inline]

Definition at line 185 of file Hist1d.h.

00185 {}


Member Function Documentation

template<typename T >
void Anp::Bin< T >::add ( const T &  weight  )  [inline]

Definition at line 211 of file Hist1d.h.

References Anp::Bin< T >::fNEntry, Anp::Bin< T >::fSum, and Anp::Bin< T >::fSum2.

00212    {
00213       ++fNEntry;
00214       fSum  += weight;
00215       fSum2 += weight*weight;
00216    }

template<typename T >
void Anp::Bin< T >::add (  )  [inline]

Definition at line 203 of file Hist1d.h.

References Anp::Bin< T >::fNEntry, Anp::Bin< T >::fSum, and Anp::Bin< T >::fSum2.

Referenced by Anp::Hist1d< T >::Fill(), and Anp::Hist1d< T >::Hist1d().

00204    {
00205       ++fNEntry;
00206       ++fSum;
00207       ++fSum2;
00208    }

template<typename T >
unsigned int Anp::Bin< T >::bin (  )  const [inline]

Definition at line 188 of file Hist1d.h.

References Anp::Bin< T >::fBin.

Referenced by Anp::Bin< T >::Bin(), Anp::Hist1d< T >::Fill(), Anp::Merge(), Anp::operator==(), and Anp::Bin< T >::print().

00188 { return fBin; }

template<typename T >
T Anp::Bin< T >::edge (  )  const [inline]

Definition at line 194 of file Hist1d.h.

References Anp::Bin< T >::fEdge.

Referenced by Anp::Bin< T >::Bin(), Anp::Merge(), and Anp::Bin< T >::print().

00194 { return fEdge; }

template<typename T >
unsigned int Anp::Bin< T >::entries (  )  const [inline]

Definition at line 191 of file Hist1d.h.

References Anp::Bin< T >::fNEntry.

Referenced by Anp::Merge().

00191 { return fNEntry; }

template<typename T >
void Anp::Bin< T >::print ( std::ostream &  o = std::cout,
short  width = 0,
short  precision = 0 
) const [inline]

Definition at line 246 of file Hist1d.h.

References Anp::Bin< T >::bin(), Anp::Bin< T >::edge(), and Anp::Bin< T >::sum().

00247    {
00248       if(width == 0 || precision == 0)
00249       {
00250          o << "Bin: (bin, edge, sum) = (" 
00251            << bin() << ", " << edge()  << ", "<< sum() << ")" << std::endl;
00252       }
00253       else
00254       {
00255          o << "Bin: (bin, edge, sum) = " 
00256            << std::setw(width) << std::setprecision(precision) << bin()
00257            << ", " 
00258            << std::setw(width) << std::setprecision(precision) << edge() 
00259            << ", " 
00260            << std::setw(width) << std::setprecision(precision) << sum() 
00261            << ")" <<std::endl;
00262       }
00263    }

template<typename T >
void Anp::Bin< T >::reset (  )  [inline]

Definition at line 238 of file Hist1d.h.

References Anp::Bin< T >::fNEntry, Anp::Bin< T >::fSum, and Anp::Bin< T >::fSum2.

00239    {
00240       fNEntry = 0;
00241       fSum    = 0;
00242       fSum2   = 0;
00243    }

template<typename T >
void Anp::Bin< T >::set_bin ( unsigned int  bin  )  [inline]

Definition at line 219 of file Hist1d.h.

References Anp::Bin< T >::fBin.

Referenced by Anp::Hist1d< T >::Rebin().

00220    {
00221       fBin = bin;
00222    }

template<typename T >
void Anp::Bin< T >::set_ent ( unsigned int  entries  )  [inline]

Definition at line 232 of file Hist1d.h.

References Anp::Bin< T >::fNEntry.

Referenced by Anp::Merge().

00233    {
00234       fNEntry = entries;
00235    }

template<typename T >
void Anp::Bin< T >::set_sum ( const T &  sum,
const T &  sum2 
) [inline]

Definition at line 225 of file Hist1d.h.

References Anp::Bin< T >::fSum, and Anp::Bin< T >::fSum2.

Referenced by Anp::Merge().

00226    {
00227       fSum  = sum;
00228       fSum2 = sum2;
00229    }

template<typename T >
T Anp::Bin< T >::sum (  )  const [inline]

Definition at line 197 of file Hist1d.h.

References Anp::Bin< T >::fSum.

Referenced by Anp::Merge(), and Anp::Bin< T >::print().

00197 { return fSum; }

template<typename T >
T Anp::Bin< T >::sum2 (  )  const [inline]

Definition at line 200 of file Hist1d.h.

References Anp::Bin< T >::fSum2.

Referenced by Anp::Merge().

00200 { return fSum2; }


Member Data Documentation

template<typename T>
unsigned int Anp::Bin< T >::fBin [private]

Definition at line 59 of file Hist1d.h.

Referenced by Anp::Bin< T >::bin(), Anp::Bin< T >::Bin(), and Anp::Bin< T >::set_bin().

template<typename T>
T Anp::Bin< T >::fEdge [private]

Definition at line 62 of file Hist1d.h.

Referenced by Anp::Bin< T >::Bin(), and Anp::Bin< T >::edge().

template<typename T>
unsigned int Anp::Bin< T >::fNEntry [private]
template<typename T>
T Anp::Bin< T >::fSum [private]
template<typename T>
T Anp::Bin< T >::fSum2 [private]

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

Generated on 19 Jan 2018 for loon by  doxygen 1.6.1