CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/Utilities/BinningTools/interface/ClusterizingHistogram.h

Go to the documentation of this file.
00001 #ifndef _CLUSTERIZINGHISTOGRAM_TT_H_
00002 #define _CLUSTERIZINGHISTOGRAM_TT_H_
00003 
00004 #include <vector>
00005 #include <cmath>
00006 
00013 class ClusterizingHistogram {
00014 public:
00015   ClusterizingHistogram(int nb, float xmi, float xma);
00016   ~ClusterizingHistogram();
00017 
00018   void fill( float x);
00019   int nbins() const {return my_nbins;}
00020   float min_x() const {return xmin;}
00021   float max_x() const {return xmax;}
00022   int entries() const {return my_entries;}
00023   int underflows() const {return my_underflows;}
00024   int overflows() const {return my_overflows;}
00025   float bin_pos(int i) const {
00026     return (bin_entries[i]!=0) ? bin_means[i]/bin_entries[i] : 0;}
00027   void dump() const;
00028   void dump(int i1, int i2) const;
00029   void dump(float x1, float x2) const;
00030   void dump(double x1, double x2) const;
00031   void dump(float x1, double x2) const;
00032   void dump(double x1, float x2) const;
00033   void reset();
00034   int bin( float x) const;
00035   int bin( double x) const;
00036 
00037   std::vector<float> clusterize( float resolution);
00038   
00039 private:
00040   ClusterizingHistogram(){}  // Prohibit
00041   int my_nbins;
00042   float xmin;
00043   float xmax;
00044   int my_entries;
00045   int my_underflows;
00046   int my_overflows;
00047   int *bin_entries;
00048   float *bin_means;
00049   float binsiz;
00050 };
00051 
00052 #endif