#ifndef HEPHBOOKHISTPROF_H #define HEPHBOOKHISTPROF_H // ---------------------------------------------------------------------- // // HepHBookHistProf.h - class declaration for HBook profile histogram // // HepHBookHistProf is the implementation of the HBook profile // histogram. It is derived from HepHistProf (the generic interface) and // HepHBookHist. It is mainly a C++ wrapper around the CERNlib HBook // Fortran histogramming libraries. // // No HepHBookHistProf objects are ever directly // instantiated by the programmer. When creating new HepHist* objects, // the manager is in charge of creating the appropriate HepHBook object. // // To use generate HBook histograms, HepHBookFileManager must be used: // // int lunit = 10; // HepFileManager* m = new HepHBookFileManager("filename.rz", lunit); // : // : // HepHistProf* h(m->histProf("Title", 100, 0.0, 23.0, 0.0, 23.0)); // float x, y, weight; // : // [gather data] // : // h->accumulate(x, y, weight); // // // Note that the constructor can take an ID number which is used by // the HBook implementation of HepHistProf. If omitted, the ID number is // generated automatically (which is recommended). The ID number is // available through the id() method. // // // Created by Bob Jacobsen to go with HepHistogram // 30-May-1997 Walter Brown Added cloning functions // 29-May-1997 Jason Luther Added comments // 04-Jun-1997 Jason Luther Rewrote comments // 09-Jun-1997 Jason Luther Added cloning constructor // 04-Aug-1998 Philippe Canal Added weight, entries, sum, etc.. // // ---------------------------------------------------------------------- #ifdef HEP_SHORT_NAMES // done early to override HepPlot #define HistProf HepHBookHistProf #endif #ifndef HEPHBOOKFILEMANAGER_H #include "HepTuple/HepHBookFileManager.h" #endif #ifndef HEPHBOOKFILEMANAGERHISTPROF_H #include "HepTuple/HepHistProf.h" #endif ZM_BEGIN_NAMESPACE( zmht ) /* namespace zmht { */ class HepHBookHistProf : public HepHistProf { friend class HepHBookFileManager; protected: // create a profile plot with the given title and binning HepHBookHistProf( HepHBookFileManager * manager , const std::string& title , const int nBins , const float lowX, const float highX , const float lowY, const float highY , const std::string& chopt , const int id_req = 0 ); HepHBookHistProf( HepHBookFileManager * manager , const std::string& title , const int nBins , const float lowX, const float highX , const float lowY, const float highY , const int id_req = 0 ); // Used for dummy construction ... // the object is then not valid ... HepHBookHistProf( ); // default constructor // Silence g++ complaints about various functions never being called void silenceCompiler(); public: virtual ~HepHBookHistProf(); virtual void accumulate( const float x , const float y , 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 getSumW( // get sum of weights for all bins float * data ) const; virtual void getSumWY( // get sum of weighted Y for all bins float * data ) const; virtual void getSumWY2( // get sum of weighted Y^2 for all bins float * data ) const; virtual void reset(); virtual int entries() const; // number of entries virtual int entries( const int binNumX) const; // number of entries in X-bin virtual float weight() const; // sum of all weight virtual float weight2() const; // sum of all weight^2 virtual float weight( const int binNumX) const; // sum of all weight in X-bin virtual float sumX() const; // retrieve weighted sum of X virtual float sumX2() const; // retrieve weighted sum of X^2 virtual float sumY() const; // retrieve weighted sum of Y virtual float sumY2() const; // retrieve weighted sum of Y^2 virtual float sumY( const int binNumX) const; // retrieve sum of Y in X-bin virtual float sumY2( const int binNumX) const; // retrieve sum of Y^2 in X-bin virtual void getStatistics( int & numEntries, float & sumW, float & sumW2, double & sumWX, double & sumWX2 ) const; virtual void getOverflows( float * numOver, float * numUnder ) const; virtual HepRawHist importHistProf( const HepHistProf & h ); virtual void setXTitle( const std::string& label ); virtual void setYTitle( const std::string& label ); virtual void setZTitle( const std::string& label ); virtual void addHistProf( const HepRawHist & h ); virtual void subtractHistProf( const HepRawHist & h ); virtual void multiplyHistProf( const HepRawHist & h ); virtual void divideHistProf( const HepRawHist & h ); virtual void removeImportedHistProf( const HepRawHist & h ); private: // forbidden operations, hence private: //HepHBookHistProf( ); // default constructor HepHBookHistProf( const HepHBookHistProf & ); // copy constructor HepHBookHistProf & operator=( const HepHBookHistProf & ); // assignment }; // HepHBookHistProf ZM_END_NAMESPACE( zmht ) /* } // namespace zmht */ #endif // HEPHBOOKHISTPROF_H