#ifndef HEPROOTHIST1D_H #define HEPROOTHIST1D_H // ---------------------------------------------------------------------- // // HepRootHist1D.h - class declaration for Histo one-dimensional histogram // // HepRootHist1D is the implementation of the Histo one-dimensional // histogram. It is derived from HepHist1D (the generic interface) and // HepRootHist. It is mainly a C++ wrapper around the Histoscope // histogramming libraries. // // No HepRootHist1D objects are ever directly // instantiated by the programmer. When creating new HepHist* objects, // the manager is in charge of creating the appropriate HepRoot object. // // To use generate Histo histograms, HepRootFileManager must be used: // // int lunit = 10; // HepFileManager* m = new HepRootFileManager("filename.rz", lunit); // : // : // HepHist1D* h(m->hist1D("Title", 100, 0.0, 23.0)); // float x, weight; // : // [gather data] // : // h->accumulate(x, weight); // // // History: // 26-Aug-1998 Philippe Canal Initial draft // // ---------------------------------------------------------------------- #ifndef HEPROOTFILEMANAGER_H #include "HepTuple/HepRootFileManager.h" #endif #ifndef HEPHIST1D_H #include "HepTuple/HepHist1D.h" #endif #ifndef HEPROOTOBJ_H #include "HepTuple/HepRootObj.h" #endif class TH1; class HepRawHist; ZM_BEGIN_NAMESPACE( zmht ) /* namespace zmht { */ class HepRootHist1D : public HepHist1D, public HepRootObj { friend class HepRootFileManager; protected: // create a 1D histogram the given an existing root TH1 HepRootHist1D( HepRootFileManager * manager, TH1* histo ); // create a 1D histogram with the given title and binning HepRootHist1D( HepRootFileManager * manager , const std::string& title , int nBins, float low, float high , int id_req = 0 ); // Used for dummy construction ... // the object is then not valid ... HepRootHist1D( ); // default constructor public: virtual ~HepRootHist1D(); // clone an existing 1D histogram HepRootHist1D( HepRootHist1D * original , const std::string& title , const int id_req = 0 ); virtual void accumulate( const float x , const float weight = 1.0 ); virtual float bin( const int binNum ) const; virtual float binError( // retrieve error for specified bin const int binNum ) const; virtual void getContents( // get contents of all in-range bins float * values ) const; virtual void putContents( // set contents for all in-range bins float * values ) const; virtual void getErrors( // get errors of all in-range bins float * errors ) const; virtual void putErrors( // set errors for all in-range bins float * errors ) const; virtual void getStatistics( int & numEntries, float & sumW, float & sumW2, double & sumWX, double & sumWX2 ) const; virtual void getOverflows( float * numOver, float * numUnder ) const; virtual HepRawHist importHist1D( const HepHist1D & h ); virtual void setXTitle( const std::string& label ); virtual void setYTitle( const std::string& label ); virtual void setZTitle( const std::string& label ); virtual void setTitle ( const std::string& label ); virtual void addHist1D( const HepRawHist & h ); virtual void multiplyHist1D( const HepRawHist & h ); virtual void subtractHist1D( const HepRawHist & h ); virtual void divideHist1D( const HepRawHist & h ); 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 virtual float sum() const; // retrieve weighted sum virtual float sum2() const; // retrieve weighted sum of square (X^2) private: // forbidden operations, hence private: //HepRootHist1D( ); // default constructor HepRootHist1D( const HepRootHist1D & ); // copy constructor HepRootHist1D & operator=( const HepRootHist1D & ); // assignment }; // HepHistoHist1D ZM_END_NAMESPACE( zmht ) /* } // namespace zmht */ #endif // HEPHISTOHIST1D_H