#ifndef REALSPARSEHIST1D_HEADER #define REALSPARSEHIST1D_HEADER 1 //////////////////////////////////////////////////// //! rcsid="$Id: RealSparHist1d.hh,v 1.5 2000/07/07 12:57:03 ees1cg Exp $" //! file="amma/Statist/SparHist/RealSparHist1d.hh" //! lib=SparHist //! docentry="Statistics.Histograms" //! author="Charles Galambos" //! date="10/05/99" #include "amma/StdType.hh" #include "amma/RealBinTable1d.hh" #include "amma/IntC.hh" #include "amma/MeanCo1d.hh" class RealSparseHist1dIterC; //////////////////////////////// //! userlevel=Normal //: Sparse 1d histogram. class RealSparseHist1dC : public RealBinTable1dC { public: RealSparseHist1dC(RealT binsize = 1) : RealBinTable1dC(binsize) {} //: Default Constructor. RealSparseHist1dC Copy() const { return RealSparseHist1dC(RealBinTable1dC::Copy()); } //: Make a copy of the table. IntT Vote(RealT bin) { return ++RealBinTable1dC::operator[](bin); } //: Increment bin in accumulator. IntT Unvote(RealT bin) { return --RealBinTable1dC::operator[](bin); } //: Decrement bin in accumulator. RealT N() const; //: Total number of votes. RealT Mean() const; //: Calculate mean of histogram. RealT Variance() const; //: Calculate variance of histogram. MeanCovariance1dC MeanCo() const; //: Calculate mean and co-variance for histogram. BooleanT WriteTable(ostream &out) const; //: Write sorted table of results. // the table will be key, count, sorted on key. // this will return false if out stream in bad. // if the table is empty and 0 0 will be written. protected: RealSparseHist1dC(const RealBinTable1dC &dat) : RealBinTable1dC(dat) {} //: Constructor. void Dummy(); // Dummy func to help compiler. }; ostream &operator<<(ostream &out,const RealSparseHist1dC &rhist); //: Out histogram to stream. //////////////////////////////// //! userlevel=Normal //: Sparse 1d histogram iterator. class RealSparseHist1dIterC : public RealBinTable1dIterC { public: RealSparseHist1dIterC(RealSparseHist1dC &hist) : RealBinTable1dIterC(hist) {} //: Constructor. protected: void Dummy(); //: Dummy function to put in library }; #endif