00001
00002 #ifndef ANAPHE_AIDACLOUD2D
00003 #define ANAPHE_AIDACLOUD2D 1
00004
00005 #include "AIDA_BaseHistogram.h"
00006 #include "AIDA_Dev/IDevCloud2D.h"
00007 #include <vector>
00008
00009
00010 namespace AIDA {
00011 class IHistogram2D;
00012 }
00013
00014 namespace Anaphe {
00015 namespace AIDA_Histogram_native {
00016
00027 class AIDA_Cloud2D : public AIDA_BaseHistogram,
00028 virtual public AIDA::Dev::IDevCloud2D
00029 {
00030 public:
00032 static const unsigned int defaultCacheSize = 1000000;
00034 static const unsigned int defaultNumberOfBins = 50;
00035
00037 AIDA_Cloud2D( const std::string& title );
00039 AIDA_Cloud2D( const AIDA_Cloud2D& h );
00041 AIDA_Cloud2D( const AIDA::ICloud2D& h );
00043 ~AIDA_Cloud2D();
00048 protected:
00049 void updateAnnotation() const;
00050 public:
00051 bool reset();
00052 int entries() const;
00053
00055 double sumOfWeights() const;
00056 bool convertToHistogram();
00057 bool isConverted() const;
00058 bool scale( double scaleFactor );
00059
00061 bool fill( double x, double y, double weight = 1. );
00062 double lowerEdgeX() const;
00063 double lowerEdgeY() const;
00064 double upperEdgeX() const;
00065 double upperEdgeY() const;
00066 double valueX( int index ) const;
00067 double valueY( int index ) const;
00068 double weight( int index ) const;
00069 double meanX() const;
00070 double meanY() const;
00071 double rmsX() const;
00072 double rmsY() const;
00073 bool convert( int nBinsX, double lowerEdgeX, double upperEdgeX, int nBinsY, double lowerEdgeY, double upperEdgeY );
00074 bool convert( const std::vector< double >& binEdgeX, const std::vector< double >& binEdgeY );
00075 const AIDA::IHistogram2D & histogram() const;
00076 bool fillHistogram( AIDA::IHistogram2D & hist ) const;
00077
00079 bool setCacheSize( unsigned int newCacheSize );
00081 unsigned int cacheSize() const;
00082
00083
00084 private:
00086 class Cloud2DElement {
00087 public:
00088 Cloud2DElement( double newX = 0,
00089 double newY = 0,
00090 double newW = 1.0 ):
00091 x( newX ), y( newY ), w( newW ) {}
00092 ~Cloud2DElement(){}
00093 double x;
00094 double y;
00095 double w;
00096 };
00097
00099 unsigned int m_cacheSize;
00101 std::vector< Cloud2DElement > m_elements;
00103 double m_sumOfWeights;
00105 double m_sumOfWeightTimesValueX;
00106 double m_sumOfWeightTimesValueY;
00108 double m_sumOfWeightTimesSquaredValueX;
00109 double m_sumOfWeightTimesSquaredValueY;
00111 double m_lowEdgeX;
00112 double m_lowEdgeY;
00114 double m_highEdgeX;
00115 double m_highEdgeY;
00117 AIDA::IHistogram2D* m_histo;
00118
00120 AIDA_Cloud2D& operator=( const AIDA_Cloud2D& );
00121 };
00122
00123 }
00124 }
00125
00126 #endif