#ifndef HEPHISTOHIST1D_H #define HEPHISTOHIST1D_H // ---------------------------------------------------------------------- // // HepHistoHist1D.h - class declaration for Histo one-dimensional histogram // // HepHistoHist1D is the implementation of the Histo one-dimensional // histogram. It is derived from HepHist1D (the generic interface) and // HepHistoHist. It is mainly a C++ wrapper around the Histoscope // histogramming libraries. // // No HepHistoHist1D objects are ever directly // instantiated by the programmer. When creating new HepHist* objects, // the manager is in charge of creating the appropriate HepHisto object. // // To use generate Histo histograms, HepHistoFileManager must be used: // // int lunit = 10; // HepFileManager* m = new HepHistoFileManager("filename.rz", lunit); // : // : // HepHist1D* h(m->hist1D("Title", 100, 0.0, 23.0)); // float x, weight; // : // [gather data] // : // h->accumulate(x, weight); // // // Note that the constructor can take an ID number which is used by // the Histo implementation of HepHist1D. If omitted, the ID number is // generated automatically (which is recommended). The ID number is // available through the id() method. // // // History: // 26-Aug-1998 Philippe Canal Initial draft // // ---------------------------------------------------------------------- #ifndef HEPHISTOFILEMANAGER_H #include "HepTuple/HepHistoFileManager.h" #endif #ifndef HEPHIST1D_H #include "HepTuple/HepHist1D.h" #endif ZM_BEGIN_NAMESPACE( zmht ) /* namespace zmht { */ class HepHistoHist1D : public HepHist1D { friend class HepHistoFileManager; protected: // create a 1D histogram with the given title and binning HepHistoHist1D( HepHistoFileManager * manager , const std::string& title , const int nBins, const float low, const float high , const int id_req = 0 ); // create a 1D histogram with the given title and binning HepHistoHist1D( HepHistoFileManager * manager , const std::string& title , const int nBins, const float low, const float high , const int id_req , const int histo_id ); // Used for dummy construction ... // the object is then not valid ... HepHistoHist1D( ); // default constructor public: virtual ~HepHistoHist1D(); // clone an existing 1D histogram HepHistoHist1D( HepHist1D * original , const std::string& title , const int id_req = 0 ); virtual void accumulate( const float x , const float weight = 1.0 ); virtual float bin( // retrieve contents of specified bin const int binNum ) const; virtual float binError( // retrieve error for specified bin const int binNum ) const; virtual void getContents( // get contents of all bins float * data ) const; virtual void getErrors( // get errors of all bins float * data ) const; virtual void getStatistics( int & numEntries, float & sumW, float & sumW2, double & sumWX, double & sumWX2 ) const; virtual void getOverflows( float * numOver, float * numUnder ) const; virtual void setXTitle( const std::string& label ); virtual void setYTitle( const std::string& label ); virtual void setZTitle( const std::string& label ); virtual HepRawHist importHist1D( const HepHist1D & h ); virtual void addHist1D( const HepRawHist & h ); virtual void subtractHist1D( const HepRawHist & h ); virtual void multiplyHist1D( const HepRawHist & h ); virtual void divideHist1D( const HepRawHist & h ); virtual void removeImportedHist1D( const HepRawHist & h ); virtual void reset(); virtual int entries() const; // number of entries virtual float weight() const; // sum of all weight virtual float weight2() const; // sum of all weight^2 virtual float sum() const; // retrieve weighted sum virtual float sum2() const; // retrieve weighted sum of square (X^2) private: // forbidden operations, hence private: //HepHistoHist1D( ); // default constructor HepHistoHist1D( const HepHistoHist1D & ); // copy constructor HepHistoHist1D & operator=( const HepHistoHist1D & ); // assignment // remember the Histoscope id for quick reference int histo_id_; float *values_; // array of dimensions binNum to copy the data for quick ref }; // HepHistoHist1D ZM_END_NAMESPACE( zmht ) /* } // namespace zmht */ #endif // HEPHISTOHIST1D_H