Anaphe Home Page Reference Documentation

Main Page     Namespaces     Classes     Source Code    

AIDAHistogram2D.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 // 
00004 // Copyright (C) CERN, Geneva 
00005 // 
00006 
00007 #ifndef AIDAHISTOGRAM2D_H
00008 #define AIDAHISTOGRAM2D_H
00009 
00010 
00011 
00012 #ifdef __i386__
00013 # include <strstream>
00014 #else
00015 # include <sstream>
00016 #endif
00017 #include "Interfaces/IHistogram2D.h"
00018 #ifdef AIDA_STD
00019 # undef AIDA_STD
00020 #endif
00021 #ifdef AIDA_NOT_USE_STD
00022 # define AIDA_STD
00023 #else
00024 # define AIDA_STD std
00025 #endif
00026 
00027 
00028 
00029 
00030 namespace Anaphe {
00031 
00032   class CHBookHisto2;
00033 
00034   class IAxis;
00035   class IAnnotation;
00036   class IHistogramFactory;
00037 
00038   class HistoParameters2D;
00039 
00040   namespace AIDA_HBook {
00041 
00042     class AIDAAxis;
00043 
00044 
00045     //------------------------------------------------------------------------------
00046     //
00047     // ClassName:   AIDAHistogram2D 
00048     //  
00049     // Description: Definition of general 2D histogram
00050     //              The class is templated with the concrete 2D histogram type
00051     //
00052     //              It implements functions from the interface IHistogram2D
00053     // 
00054     //              It implements functions from IHistoBase
00055     //              - print functions, which convert the histogram
00056     //                into ASCII graphical representation
00057     //              - operator<< , which calls internally the print() function
00058     //              - write functions, which convert the histogram
00059     //                into ASCI table (containing numbers with e.g. bin height)
00060     //
00061     //              HTL offers only single std::string to keep
00062     //              the textual information about a histogram.
00063     //              We divide it into two fields :
00064     //              - histogram identifier - can be any string (but if using HBOOK
00065     //                for histogram persistency, the identifier has to be a number)
00066     //              - histogram title - any string (apears on the histogram plot)
00067     //              The function title() of IHistogram1D returns
00068     //              a single std::string with both fields
00069     //
00070     // Author:      Pavel Binko
00071     //
00072     //------------------------------------------------------------------------------
00073 
00074 
00075     class AIDAHistogram2D : virtual public IHistogram2D
00076     {
00077     public:
00078 
00082 
00083       AIDAHistogram2D(const char* name   = " ", 
00084                       const int& nBinsX  = 2, 
00085                       const double& lowX = 0.0, const double& highX = 1.0,
00086                       const int& nBinsY  = 2, 
00087                       const double& lowY = 0.0, const double& highY = 1.0,
00088                       const Anaphe::IAnnotation* = 0, 
00089                       const Anaphe::IHistogramFactory* = 0);
00090 
00091       AIDAHistogram2D(const CHBookHisto2*, const Anaphe::IHistogramFactory* = 0);
00092 
00093       AIDAHistogram2D(const HistoParameters2D & hp, const Anaphe::IAnnotation* = 0, const Anaphe::IHistogramFactory* = 0);
00094 
00098 
00099       virtual ~AIDAHistogram2D();
00100 
00101     public:
00102   
00103 
00107 
00108 
00112 
00116       virtual AIDA_STD::string title() const;
00117 
00118       virtual void setTitle(const AIDA_STD::string& value);
00119 
00121       virtual Anaphe::IAnnotation* annotation();
00122 
00124       virtual int dimensions() const;
00125 
00127       virtual void reset();
00128 
00129 
00133 
00135       virtual int entries() const;
00136 
00139       virtual int allEntries() const;
00140 
00142       virtual int extraEntries() const;
00143 
00146       virtual double equivalentBinEntries() const;
00147 
00151 
00153       virtual double sumBinHeights() const;
00154 
00156       virtual double sumAllBinHeights() const;
00157 
00159       virtual double sumExtraBinHeights() const;
00160 
00164 
00165 
00169 
00171       virtual void fill( double x, double y, double weight = 1 );
00172 
00173 
00187 
00189       virtual int binEntries( int indexX, int indexY ) const;
00190 
00193       virtual int binEntriesX( int indexX ) const;
00194 
00197       virtual int binEntriesY( int indexY ) const;
00198 
00200       virtual double binHeight( int indexX, int indexY ) const;
00201 
00204       virtual double binHeightX( int indexX ) const;
00205 
00208       virtual double binHeightY( int indexY ) const;
00209 
00211       virtual double binError( int indexX, int indexY ) const;
00212 
00213     public:
00214 
00218 
00221       virtual double meanX() const;
00222 
00225       virtual double meanY() const;
00226 
00229       virtual double rmsX() const;
00230 
00233       virtual double rmsY() const;
00234 
00235 
00239 
00241       virtual double minBinHeight() const;
00242 
00244       virtual int minBinX() const;
00245 
00247       virtual int minBinY() const;
00248 
00250       virtual double maxBinHeight() const;
00251 
00253       virtual int maxBinX() const;
00254 
00256       virtual int maxBinY() const;
00257 
00258     public:
00259 
00263 
00265       virtual Anaphe::IAxis* xAxis() const;
00266 
00268       virtual Anaphe::IAxis* yAxis() const;
00269 
00273 
00275       virtual int coordToIndexX( double coordX ) const;
00276 
00278       virtual int coordToIndexY( double coordY ) const;
00279 
00283 
00286       virtual Anaphe::IHistogram1D* projectionX() const;
00287 
00290       virtual Anaphe::IHistogram1D* projectionY() const;
00291 
00292 
00296 
00299       virtual Anaphe::IHistogram1D* sliceX( int indexY ) const;
00300 
00303       virtual Anaphe::IHistogram1D* sliceY( int indexX ) const;
00304 
00306       virtual Anaphe::IHistogram1D* sliceX( int /*indexY1*/, int /*indexY2*/ ) const;
00307 
00309       virtual Anaphe::IHistogram1D* sliceY( int /*indexX1*/, int /*indexX2*/ ) const;
00310 
00314 
00317   
00319       virtual AIDA_STD::ostream& print( AIDA_STD::ostream& s ) const;
00320 
00323 
00325       virtual AIDA_STD::ostream& write( AIDA_STD::ostream& s ) const;
00326 
00328       virtual int write( const char* file_name ) const;
00329 
00331 
00333       const CHBookHisto2 * representation() const;
00334 
00335 
00336     private:
00338       virtual int calcIndex( double coord, int part ) const;
00339   
00343 
00346       virtual int checkIndexX( int indexX ) const;
00347 
00350       virtual int checkIndexY( int indexY ) const;
00351       virtual int getIntFromString(const AIDA_STD::string&) const;
00352       virtual AIDA_STD::string getStringFromInt(const int&) const;
00353       virtual Anaphe::IHistogram1D* slice(const int& low, const int& hi, 
00354                                   const int& axis) const;
00355       virtual bool goodIndices(const int& i, const int& j,
00356                                const int& axis) const;
00357       virtual AIDA_STD::string binname(const int&) const;
00358 
00359     private:
00360       void notYetMessage(const AIDA_STD::string& featureName) const;
00361       void crisisMessage(const AIDA_STD::string& featureName) const;
00362 
00363     private:
00364       Anaphe::IAxis*             xaxis;
00365       Anaphe::IAxis*             yaxis;
00366       Anaphe::IAnnotation*       ann;
00367       Anaphe::IHistogramFactory* factory;
00368       CHBookHisto2*      rep;
00369       bool               ownsRep;
00370 
00371     };
00372 
00373 
00374   } // end namespace AIDA_HTL 
00375 
00376 } // end namespace Anaphe
00377 
00378 #endif // AIDAHIST2D_H


Anaphe documentation generated by Doxygen (www.doxygen.org)