Changeset 1056 in Sophya for trunk/SophyaLib/HiStats/histos.h
- Timestamp:
- Jul 7, 2000, 10:41:11 AM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/HiStats/histos.h
r1053 r1056 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: histos.h,v 1. 7 2000-06-30 13:21:53ansari Exp $3 // $Id: histos.h,v 1.8 2000-07-07 08:41:11 ansari Exp $ 4 4 // 5 5 … … 28 28 Histo(float xMin, float xMax, int nBin=100); 29 29 Histo(const Histo& H); 30 virtual 30 virtual ~Histo(); 31 31 32 32 // OPTIONS 33 void 33 void Errors(); 34 34 35 35 // UPDATING or SETTING 36 void 37 void 38 void 39 void 40 void 41 void 42 void 43 void 36 void Zero(); 37 void Add(float x, float w = 1.); 38 void AddBin(int numBin, float w = 1.); 39 void SetBin(float x, float w = 1.); 40 void SetBin(int numBin, float w = 1.); 41 void SetErr2(float x, double e2); 42 void SetErr2(int numBin, double e2); 43 void SetErr(float x, float e); 44 44 void SetErr(int numBin, float e); 45 45 … … 68 68 // INLINES 69 69 //! Retourne l'abscisse minimum 70 inline float XMin() const{return min;}70 inline float XMin() const {return min;} 71 71 //! Retourne l'abscisse maximum 72 inline float XMax() const{return max;}72 inline float XMax() const {return max;} 73 73 //! Retourne le nombre de bins 74 inline int_4 NBins() const{return bins;}74 inline int_4 NBins() const {return bins;} 75 75 //! Retourne la largeur du bin 76 inline float BinWidth() const{return binWidth;}76 inline float BinWidth() const {return binWidth;} 77 77 //! Retourne le pointeur sur le tableaux des contenus 78 inline float* Bins() const{return data;}78 inline float* Bins() const {return data;} 79 79 //! Retourne le contenu du bin i 80 inline float 80 inline float operator()(int i) const {return data[i];} 81 81 //! Remplit le contenu du bin i 82 inline float& operator()(int i){return data[i];}82 inline float& operator()(int i) {return data[i];} 83 83 //! retourne "true" si il y a des erreurs stoquees 84 inline bool HasErrors() { if(err2) return true; else return false;} 84 inline bool HasErrors() 85 {if(err2) return true; else return false;} 85 86 //! Retourne l'erreur du bin i 86 inline float 87 88 87 inline float Error(int i) const 88 {if(err2) {if(err2[i]>0.) return sqrt(err2[i]); else return 0.;} 89 else return 0.;} 89 90 //! Retourne l'erreur au carre du bin i 90 inline double 91 91 inline double Error2(int i) const 92 {if(err2) return err2[i]; else return 0.;} 92 93 //! Remplit l'erreur au carre du bin i 93 inline double& 94 inline double& Error2(int i) {return err2[i];} 94 95 //! Retourne la somme ponderee 95 inline float 96 inline float NData() const {return (float) nHist;} 96 97 //! Retourne le nombre d'entrees 97 inline float 98 inline float NEntries() const {return nEntries;} 98 99 //! Retourne le nombre d'overflow 99 inline float 100 inline float NOver() const {return over;} 100 101 //! Retourne le nombre d'underflow 101 inline float 102 inline float NUnder() const {return under;} 102 103 103 104 //! Retourne l'abscisse du bord inferieur du bin i 104 inline float 105 inline float BinLowEdge(int i) const {return min + i*binWidth;} 105 106 //! Retourne l'abscisse du centre du bin i 106 inline float 107 inline float BinCenter(int i) const {return min + (i+0.5)*binWidth;} 107 108 //! Retourne l'abscisse du bord superieur du bin i 108 inline float 109 inline float BinHighEdge(int i) const {return min + (i+1)*binWidth;} 109 110 //! Retourne le numero du bin contenant l'abscisse x 110 inline int_4 111 111 inline int_4 FindBin(float x) const 112 {return (int_4) floorf((x - min) / binWidth);} 112 113 113 114 // Info, statistique et calculs sur les histogrammes 114 int 115 int 116 int 117 int 118 float 119 float 120 float 121 float 122 float 123 float 124 float 125 float 126 float 127 float 128 int 129 int 130 int 131 void 132 void 133 void 134 135 int 136 float 137 float 138 float 139 int 140 int 141 void 115 int BinNonNul() const; 116 int ErrNonNul() const; 117 int IMax() const; 118 int IMin() const; 119 float VMax() const; 120 float VMin() const; 121 float Mean() const; 122 float Sigma() const; 123 float MeanLH(int il,int ih) const; 124 float SigmaLH(int il,int ih) const; 125 float Mean(float x0, float dx) const; 126 float Sigma(float x0, float dx) const; 127 float CleanedMean() const; 128 float CleanedMean(float& sigma) const; 129 int BinPercent(float per) const; 130 int BinPercent(float x,float per,int& imin,int& imax); 131 int BinPercent(float x,float per,float& xmin,float& xmax); 132 void HInteg(float norm = 0.); 133 void HDeriv(); 134 void HRebin(int nbinew); 135 136 int MaxiLocal(float& maxi,int& imax,float& maxn,int& imaxn); 137 float FitMax(int degree=2, float frac=0.5f, int debug=0) const; 138 float FindWidth(float xmax,float frac=0.5f, int debug=0) const; 139 float FindWidth(float frac=0.5f, int debug=0) const; 140 int EstimeMax(float& xm,int SzPav = 3); 141 int EstimeMax(int& im,float& xm,int SzPav = 3); 142 void EstimeWidthS(float frac,float& widthG,float& widthD); 142 143 143 144 // Fit … … 147 148 148 149 // Print et Display ASCII 149 void 150 151 void 152 150 void PrintF(FILE * fp, int dyn = 100, float hmin = 1., float hmax = -1., 151 int pflag = 0, int il = 1, int ih = -1); 152 void Print(int dyn = 100, float hmin = 1., float hmax = -1., 153 int pflag = 0, int il = 1, int ih = -1); 153 154 154 155 protected: 155 156 void Delete(); 156 157 157 float* 158 double* 159 float 160 float 161 double 162 int_4 163 int_4 164 float 165 float 166 float 158 float* data; //!< donnees 159 double* err2; //!< erreurs carrees 160 float under; //!< underflow 161 float over; //!< overflow 162 double nHist; //!< somme ponderee des entrees 163 int_4 nEntries; //!< nombre d'entrees 164 int_4 bins; //!< nombre de bins 165 float min; //!< abscisse minimum 166 float max; //!< abscisse maximum 167 float binWidth; //!< largeur du bin 167 168 }; 168 169
Note:
See TracChangeset
for help on using the changeset viewer.