00001
00002 #ifndef ANAPHE_AIDACLOUD3D
00003 #define ANAPHE_AIDACLOUD3D 1
00004
00005 #include "AIDA_BaseHistogram.h"
00006 #include "AIDA_Dev/IDevCloud3D.h"
00007 #include <vector>
00008
00009
00010 namespace AIDA {
00011 class IHistogram3D;
00012 }
00013
00014 namespace Anaphe {
00015 namespace AIDA_Histogram_native {
00016
00027 class AIDA_Cloud3D : public AIDA_BaseHistogram,
00028 virtual public AIDA::Dev::IDevCloud3D
00029 {
00030 public:
00032 static const unsigned int defaultCacheSize = 1000000;
00034 static const unsigned int defaultNumberOfBins = 25;
00035
00037 AIDA_Cloud3D( const std::string& title );
00039 AIDA_Cloud3D( const AIDA_Cloud3D& h );
00041 AIDA_Cloud3D( const AIDA::ICloud3D& h );
00043 ~AIDA_Cloud3D();
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 z, double weight = 1. );
00062 double lowerEdgeX() const;
00063 double lowerEdgeY() const;
00064 double lowerEdgeZ() const;
00065 double upperEdgeX() const;
00066 double upperEdgeY() const;
00067 double upperEdgeZ() const;
00068 double valueX( int index ) const;
00069 double valueY( int index ) const;
00070 double valueZ( int index ) const;
00071 double weight( int index ) const;
00072 double meanX() const;
00073 double meanY() const;
00074 double meanZ() const;
00075 double rmsX() const;
00076 double rmsY() const;
00077 double rmsZ() const;
00078 bool convert( int nBinsX, double lowerEdgeX, double upperEdgeX,
00079 int nBinsY, double lowerEdgeY, double upperEdgeY,
00080 int nBinsZ, double lowerEdgeZ, double upperEdgeZ );
00081 bool convert( const std::vector< double >& binEdgeX,
00082 const std::vector< double >& binEdgeY,
00083 const std::vector< double >& binEdgeZ );
00084 const AIDA::IHistogram3D & histogram() const;
00085 bool fillHistogram( AIDA::IHistogram3D & hist ) const;
00086
00088 bool setCacheSize( unsigned int newCacheSize );
00090 unsigned int cacheSize() const;
00091
00092
00093 private:
00095 class Cloud3DElement {
00096 public:
00097 Cloud3DElement( double newX = 0,
00098 double newY = 0,
00099 double newZ = 0,
00100 double newW = 1.0 ):
00101 x( newX ), y( newY ), z( newZ ), w( newW ) {}
00102 ~Cloud3DElement(){}
00103 double x;
00104 double y;
00105 double z;
00106 double w;
00107 };
00108
00110 unsigned int m_cacheSize;
00112 std::vector< Cloud3DElement > m_elements;
00114 double m_sumOfWeights;
00116 double m_sumOfWeightTimesValueX;
00117 double m_sumOfWeightTimesValueY;
00118 double m_sumOfWeightTimesValueZ;
00120 double m_sumOfWeightTimesSquaredValueX;
00121 double m_sumOfWeightTimesSquaredValueY;
00122 double m_sumOfWeightTimesSquaredValueZ;
00124 double m_lowEdgeX;
00125 double m_lowEdgeY;
00126 double m_lowEdgeZ;
00128 double m_highEdgeX;
00129 double m_highEdgeY;
00130 double m_highEdgeZ;
00132 AIDA::IHistogram3D* m_histo;
00133
00135 AIDA_Cloud3D& operator=( const AIDA_Cloud3D& );
00136 };
00137
00138 }
00139 }
00140
00141 #endif