Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

AIDA_Cloud1D.h

Go to the documentation of this file.
00001 // Emacs -*- C++ -*-
00002 #ifndef ANAPHE_AIDACLOUD1D
00003 #define ANAPHE_AIDACLOUD1D 1
00004 
00005 #include "AIDA_BaseHistogram.h"
00006 #include "AIDA_Dev/IDevCloud1D.h"
00007 #include <vector>
00008 
00009 // Forward declatations
00010 namespace AIDA {
00011   class IHistogram1D;
00012 }
00013 
00014 namespace Anaphe {
00015   namespace AIDA_Histogram_native {
00016 
00027 class AIDA_Cloud1D : public AIDA_BaseHistogram,
00028                      virtual public AIDA::Dev::IDevCloud1D
00029 {
00030 public:
00032   static const unsigned int defaultCacheSize = 1000000;
00034   static const unsigned int defaultNumberOfBins = 100;
00035 
00037   AIDA_Cloud1D( const std::string& title  );
00039   AIDA_Cloud1D( const AIDA_Cloud1D& h );
00041   AIDA_Cloud1D( const AIDA::ICloud1D& h );
00043   ~AIDA_Cloud1D();
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 weight = 1. );
00062   double lowerEdge() const;
00063   double upperEdge() const;
00064   double value( int index ) const;
00065   double weight( int index ) const;
00066   double mean() const;
00067   double rms() const;
00068   bool convert( int nBins, double lowerEdge, double upperEdge );
00069   bool convert( const std::vector< double >& binEdge );
00070   const AIDA::IHistogram1D & histogram() const;
00071   bool fillHistogram( AIDA::IHistogram1D& hist ) const;
00072 
00074   bool setCacheSize( unsigned int newCacheSize );
00076   unsigned int cacheSize() const;
00077   
00078 
00079 private:
00081   class Cloud1DElement {
00082   public:
00083     Cloud1DElement( double newX = 0,
00084                     double newW = 1.0 ):
00085       x( newX ), w( newW ) {}
00086     ~Cloud1DElement(){}
00087     double x;
00088     double w;
00089   };
00090 
00092   unsigned int                   m_cacheSize;
00094   std::vector< Cloud1DElement >  m_elements;
00096   double                         m_sumOfWeights;
00098   double                         m_sumOfWeightTimesValue;
00100   double                         m_sumOfWeightTimesSquaredValue;
00102   double                         m_lowEdge;
00104   double                         m_highEdge;
00106   AIDA::IHistogram1D*            m_histo;
00107 
00109   AIDA_Cloud1D& operator=( const AIDA_Cloud1D& );
00110 };
00111 
00112   }
00113 }
00114 
00115 #endif /* ifndef ANAPHE_AIDACLOUD1D */

Generated on Tue Nov 19 12:32:15 2002 for AIDA_Histogram_native by doxygen1.2.16