// $Id$ // // File: DHistogram.h // Created: Mon Aug 1 08:56:58 EDT 2011 // Creator: davidl (on Linux ifarm1102 2.6.18-128.7.1.el5 x86_64) // #ifndef _DHistogram_ #define _DHistogram_ #include #include class DHistogram{ public: DHistogram(int Nbins, double lowEdge, double highEdge); virtual ~DHistogram(); void Add(const DHistogram *h); double Fill(double x, double weight=1.0); int FindBin(double x) const; int FindFirstBinAbove(double val) const; int GetNbins(void) const; double GetBinLowEdge(int bin) const; double GetBinCenter(int bin) const; double GetBinContent(int bin) const; double GetBinWidth(void) const; double Integral(void) const; TH1D* MakeTH1D(string name, string title) const; void Reset(void); void Scale(double scale); void SetBinContent(int bin, double val); protected: private: DHistogram(); // prevent default constructor usage int Nbins; double lowEdge; double highEdge; double binWidth; double half_binWidth; double *content; double *xvals; // bin center }; #endif // _DHistogram_