Changeset 2627 in Sophya for trunk/SophyaLib/HiStats


Ignore:
Timestamp:
Oct 6, 2004, 6:04:27 PM (21 years ago)
Author:
cmv
Message:

petit bug dans methode ReCenterBin cmv 6/10/04

Location:
trunk/SophyaLib/HiStats
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/HiStats/histerr.cc

    r2626 r2627  
    8484 else if(numBin>=mBins) mOver += w;
    8585 else {
    86    mData[numBin] += w; mNData[numBin]++; mErr2[numBin] += e*e;
     86   mData[numBin] += w; mNData[numBin] += 1.; mErr2[numBin] += e*e;
    8787   nHist += w; nEntries++;
    8888 }
     
    9898 else if(numBin>=mBins) mOver += w;
    9999 else {
    100    mData[numBin] += w; mNData[numBin]++; mErr2[numBin] += e*e;
     100   mData[numBin] += w; mNData[numBin] += 1.; mErr2[numBin] += e*e;
    101101   nHist += w; nEntries++;
    102102 }
     
    149149/*!
    150150 Recompute XMin and XMax so that
    151  the center of the first bin is exactly xcmin and
    152  the center of the last bin is exactly xcmax
    153 */
    154 void HistoErr::ReCenterBin(r_8 xcmin,r_8 xcmax)
    155 {
    156  if(xcmax<=xcmin) return;
     151 the CENTER of the first bin is exactly XMin and
     152 the CENTER of the last bin is exactly XMax.
     153 Remember that otherwise
     154 XMin is the beginning of the first bin
     155 and XMax is the end of the last bin
     156*/
     157void HistoErr::ReCenterBin(void)
     158{
    157159 if(mBins<=1) return;
    158160 double dx = (mMax-mMin)/(mBins-1);
    159   mMin -= dx/2.;
    160   mMax += dx/2.;
    161   binWidth = (mMax-mMin)/mBins;
     161 mMin -= dx/2.;
     162 mMax += dx/2.;
     163 binWidth = (mMax-mMin)/mBins;
    162164}
    163165
     
    174176 if(mBins<1) return;
    175177 for(int_4 i=0;i<mBins;i++) {
    176    if(mNData[i]<1) continue;
     178   if(mNData[i]<1.) continue;
    177179   mData[i] /= mNData[i];
    178180   mErr2[i] /= mNData[i];
  • trunk/SophyaLib/HiStats/histerr.h

    r2626 r2627  
    4040
    4141  //! Re-center bin abscissa
    42   void ReCenterBin(r_8 xcmin,r_8 xcmax);
     42  void ReCenterBin(void);
    4343  //! Compute the correlation histogram
    4444  void ToCorrel(void);
Note: See TracChangeset for help on using the changeset viewer.