Changeset 1109 in Sophya


Ignore:
Timestamp:
Jul 28, 2000, 6:29:55 PM (25 years ago)
Author:
ansari
Message:

on vire FitResidus/Function -> cf objfitter cmv 28/7/00

Location:
trunk/SophyaLib/HiStats
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/HiStats/Makefile

    r919 r1109  
    1111endif
    1212 
    13 $(OBJ)hisprof.o: hisprof.cc $(INC)machdefs.h \
    14  hisprof.h $(INC)peida.h \
     13$(OBJ)hisprof.o: hisprof.cc \
     14 $(INC)machdefs.h hisprof.h \
     15 $(INC)peida.h \
    1516 $(INC)utils.h \
    1617 $(INC)perrors.h \
     
    2223 $(INC)basarr.h \
    2324 $(INC)anydataobj.h \
     25 $(INC)mutyv.h \
    2426 $(INC)dvlist.h \
    2527 $(INC)objfio.h \
     
    2830 $(INC)ndatablock.h \
    2931 $(INC)utilarr.h histos.h
    30 $(OBJ)histinit.o: histinit.cc $(INC)machdefs.h \
    31  histinit.h $(INC)ntoolsinit.h \
     32$(OBJ)histinit.o: histinit.cc \
     33 $(INC)machdefs.h histinit.h \
     34 $(INC)ntoolsinit.h \
    3235 $(INC)tarrinit.h \
    3336 $(INC)sophyainit.h histos.h \
     
    4548 $(INC)tarray.h \
    4649 $(INC)basarr.h \
     50 $(INC)mutyv.h \
    4751 $(INC)dvlist.h \
    4852 $(INC)ndatablock.h \
    49  $(INC)utilarr.h histos2.h hisprof.h ntuple.h \
     53 $(INC)utilarr.h histos2.h \
     54 hisprof.h ntuple.h \
    5055 $(INC)ntupintf.h xntuple.h
    51 $(OBJ)histos.o: histos.cc $(INC)machdefs.h histos.h \
     56$(OBJ)histos.o: histos.cc \
     57 $(INC)machdefs.h histos.h \
    5258 $(INC)objfio.h \
    5359 $(INC)anydataobj.h \
     
    6369 $(INC)tarray.h \
    6470 $(INC)basarr.h \
     71 $(INC)mutyv.h \
    6572 $(INC)dvlist.h \
    6673 $(INC)ndatablock.h \
    6774 $(INC)utilarr.h \
    6875 $(INC)poly.h \
    69  $(INC)strutil.h \
    70  $(INC)generalfit.h \
    71  $(INC)generaldata.h \
    72  $(INC)ntupintf.h
    73 $(OBJ)histos2.o: histos2.cc $(INC)machdefs.h \
    74  histos2.h $(INC)peida.h \
     76 $(INC)strutil.h
     77$(OBJ)histos2.o: histos2.cc \
     78 $(INC)machdefs.h histos2.h \
     79 $(INC)peida.h \
    7580 $(INC)utils.h \
    7681 $(INC)perrors.h \
     
    8590 $(INC)tarray.h \
    8691 $(INC)basarr.h \
     92 $(INC)mutyv.h \
    8793 $(INC)dvlist.h \
    8894 $(INC)ndatablock.h \
    89  $(INC)utilarr.h \
    90  $(INC)generalfit.h \
    91  $(INC)generaldata.h \
    92  $(INC)ntupintf.h \
    93  $(INC)poly.h
    94 $(OBJ)ntuple.o: ntuple.cc $(INC)strutil.h \
     95 $(INC)utilarr.h
     96$(OBJ)ntuple.o: ntuple.cc \
     97 $(INC)strutil.h \
    9598 $(INC)perrors.h \
    9699 $(INC)pexceptions.h \
     
    101104 $(INC)gnumd5.h \
    102105 $(INC)ntupintf.h \
    103  $(INC)dvlist.h
    104 $(OBJ)xntuple.o: xntuple.cc $(INC)ppersist.h \
     106 $(INC)dvlist.h \
     107 $(INC)mutyv.h
     108$(OBJ)xntuple.o: xntuple.cc \
     109 $(INC)ppersist.h \
    105110 $(INC)machdefs.h \
    106111 $(INC)pexceptions.h \
    107112 $(INC)gnumd5.h \
    108113 $(INC)perrors.h xntuple.h \
     114 $(INC)ntupintf.h \
     115 $(INC)dvlist.h \
    109116 $(INC)objfio.h \
    110117 $(INC)anydataobj.h \
    111  $(INC)ntupintf.h \
    112  $(INC)dvlist.h
     118 $(INC)mutyv.h
  • trunk/SophyaLib/HiStats/hisprof.h

    r1092 r1109  
    6262  virtual void HRebin(int_4 nbinew);
    6363
    64   // Fit
    65   //! Fit du profile par ``gfit''.
    66   inline int_4 Fit(GeneralFit& gfit)
    67          {UpdateHisto(); return Histo::Fit(gfit,0);}
    68   //! Retourne l'Histogramme des residus par ``gfit''.
    69   inline Histo FitResidus(GeneralFit& gfit)
    70          {UpdateHisto(); return Histo::FitResidus(gfit);}
    71   //! Retourne l'Histogramme de la fonction fittee par ``gfit''.
    72   inline Histo FitFunction(GeneralFit& gfit)
    73          {UpdateHisto(); return Histo::FitFunction(gfit);}
    74 
    7564  // Print
    7665  //! Print, voir detail dans Histo::Print
  • trunk/SophyaLib/HiStats/histos.cc

    r1092 r1109  
    11//
    2 // $Id: histos.cc,v 1.10 2000-07-26 13:15:15 ansari Exp $
     2// $Id: histos.cc,v 1.11 2000-07-28 16:29:54 ansari Exp $
    33//
    44
     
    1111#include "poly.h"
    1212#include "strutil.h"
    13 #include "generalfit.h"
    1413
    1514/*!
     
    295294  Remplissage d'un tableau avec la valeur des abscisses
    296295*/
    297 void Histo::GetAbsc(TVector<r_8> &v)
     296void Histo::GetAbsc(TVector<r_8> &v) const
    298297{
    299298v.Realloc(mBins);
     
    305304  Remplissage d'un tableau avec la valeur du contenu
    306305*/
    307 void Histo::GetValue(TVector<r_8> &v)
     306void Histo::GetValue(TVector<r_8> &v) const
    308307{
    309308v.Realloc(mBins);
     
    315314  Remplissage d'un tableau avec la valeur des erreurs au carre
    316315*/
    317 void Histo::GetError2(TVector<r_8> &v)
     316void Histo::GetError2(TVector<r_8> &v) const
    318317{
    319318v.Realloc(mBins);
     
    326325  Remplissage d'un tableau avec la valeur des erreurs
    327326*/
    328 void Histo::GetError(TVector<r_8> &v)
     327void Histo::GetError(TVector<r_8> &v) const
    329328{
    330329v.Realloc(mBins);
     
    764763  \endverbatim
    765764*/
    766 int_4 Histo::BinPercent(r_8 x,r_8 per,int& imin,int& imax)
     765int_4 Histo::BinPercent(r_8 x,r_8 per,int& imin,int& imax) const
    767766{
    768767imin = imax = -1;
     
    792791  Idem precedent mais renvoie xmin et xmax
    793792*/
    794 int_4 Histo::BinPercent(r_8 x,r_8 per,r_8& xmin,r_8& xmax)
     793int_4 Histo::BinPercent(r_8 x,r_8 per,r_8& xmin,r_8& xmax) const
    795794{
    796795xmin = xmax = 0.;
     
    901900  consecutifs, le bin le plus a droite est pris.
    902901*/
    903 int_4 Histo::MaxiLocal(r_8& maxi,int& imax,r_8& maxn,int& imaxn)
     902int_4 Histo::MaxiLocal(r_8& maxi,int& imax,r_8& maxn,int& imaxn) const
    904903{
    905904int_4 nml = 0;
     
    11621161  Cf suivant mais im est le bin du maximum de l'histo
    11631162*/
    1164 int_4 Histo::EstimeMax(r_8& xm,int_4 SzPav)
     1163int_4 Histo::EstimeMax(r_8& xm,int_4 SzPav) const
    11651164{
    11661165int_4 im = IMax();
     
    11801179  \endverbatim
    11811180*/
    1182 int_4 Histo::EstimeMax(int& im,r_8& xm,int_4 SzPav)
     1181int_4 Histo::EstimeMax(int& im,r_8& xm,int_4 SzPav) const
    11831182{
    11841183xm = 0;
     
    12121211  et a droite (widthD)
    12131212*/
    1214 void Histo::EstimeWidthS(r_8 frac,r_8& widthG,r_8& widthD)
     1213void Histo::EstimeWidthS(r_8 frac,r_8& widthG,r_8& widthD) const
    12151214{
    12161215int_4 i;
     
    12481247}
    12491248
    1250 }
    1251 
    1252 //////////////////////////////////////////////////////////
    1253 /*!
    1254   Fit de l'histogramme par ``gfit''.
    1255   \verbatim
    1256     typ_err = 0 :
    1257        - erreur attachee au bin si elle existe
    1258        - sinon 1
    1259     typ_err = 1 :
    1260        - erreur attachee au bin si elle existe
    1261        - sinon max( sqrt(abs(bin) ,1 )
    1262     typ_err = 2 :
    1263        - erreur forcee a 1
    1264     typ_err = 3 :
    1265        - erreur forcee a max( sqrt(abs(bin) ,1 )
    1266     typ_err = 4 :
    1267        - erreur forcee a 1, nulle si bin a zero.
    1268     typ_err = 5 :
    1269        - erreur forcee a max( sqrt(abs(bin) ,1 ),
    1270          nulle si bin a zero.
    1271   \endverbatim
    1272 */
    1273 int_4  Histo::Fit(GeneralFit& gfit,unsigned short typ_err)
    1274 {
    1275 if(NBins()<=0) return -1000;
    1276 if(typ_err>5) typ_err=0;
    1277 
    1278 GeneralFitData mydata(1,NBins());
    1279 
    1280 for(int_4 i=0;i<NBins();i++) {
    1281   r_8 x =  BinCenter(i);
    1282   r_8 f =  (*this)(i);
    1283   r_8 saf = sqrt(fabs( f)); if(saf<1.) saf=1.;
    1284   r_8 e=0.;
    1285   if(typ_err==0)      {if(HasErrors()) e=Error(i); else e=1.;}
    1286   else if(typ_err==1) {if(HasErrors()) e=Error(i); else e=saf;}
    1287   else if(typ_err==2) e=1.;
    1288   else if(typ_err==3) e=saf;
    1289   else if(typ_err==4) e=(f==0.)?0.:1.;
    1290   else if(typ_err==5) e=(f==0.)?0.:saf;
    1291   mydata.AddData1(x,f,e);
    1292 }
    1293 
    1294 gfit.SetData(&mydata);
    1295 
    1296 return gfit.Fit();
    1297 }
    1298 
    1299 /*!
    1300   Retourne une classe contenant les residus du fit ``gfit''.
    1301 */
    1302 Histo Histo::FitResidus(GeneralFit& gfit)
    1303 {
    1304 if(NBins()<=0)
    1305   throw(SzMismatchError("Histo::FitResidus: size mismatch\n"));
    1306 GeneralFunction* f = gfit.GetFunction();
    1307 if(f==NULL)
    1308   throw(NullPtrError("Histo::FitResidus: NULL pointer\n"));
    1309 TVector<r_8> par = gfit.GetParm();
    1310 Histo h(*this);
    1311 for(int_4 i=0;i<NBins();i++) {
    1312   r_8 x =  BinCenter(i);
    1313   h(i) -=  f->Value(&x,par.Data());
    1314 }
    1315 return h;
    1316 }
    1317 
    1318 /*!
    1319   Retourne une classe contenant la fonction du fit ``gfit''.
    1320 */
    1321 Histo Histo::FitFunction(GeneralFit& gfit)
    1322 {
    1323 if(NBins()<=0)
    1324   throw(SzMismatchError("Histo::FitFunction: size mismatch\n"));
    1325 GeneralFunction* f = gfit.GetFunction();
    1326 if(f==NULL)
    1327   throw(NullPtrError("Histo::FitFunction: NULL pointer\n"));
    1328 TVector<r_8> par = gfit.GetParm();
    1329 Histo h(*this);
    1330 for(int_4 i=0;i<NBins();i++) {
    1331   r_8 x =  BinCenter(i);
    1332   h(i) =  f->Value(&x,par.Data());
    1333 }
    1334 return h;
    13351249}
    13361250
     
    13541268*/
    13551269void Histo::PrintF(FILE * fp, int_4 hdyn,r_8 hmin, r_8 hmax,int_4 pflag,
    1356               int_4 il, int_4 ih)
     1270              int_4 il, int_4 ih) const
    13571271{
    13581272 
     
    15121426*/
    15131427void Histo::Print(int_4 hdyn,r_8 hmin, r_8 hmax,int_4 pflag,
    1514              int_4 il, int_4 ih)
     1428             int_4 il, int_4 ih) const
    15151429{
    15161430 Histo::PrintF(stdout, hdyn, hmin, hmax, pflag, il, ih);
  • trunk/SophyaLib/HiStats/histos.h

    r1092 r1109  
    11// This may look like C code, but it is really -*- C++ -*-
    22//
    3 // $Id: histos.h,v 1.11 2000-07-26 13:15:15 ansari Exp $
     3// $Id: histos.h,v 1.12 2000-07-28 16:29:55 ansari Exp $
    44//
    55
     
    1616
    1717namespace SOPHYA {
    18 
    19 class GeneralFit;
    2018
    2119//! 1 dimension histograms
     
    5856
    5957  // get/put dans/depuis un vector
    60   void GetAbsc(TVector<r_8>& v);
    61   void GetValue(TVector<r_8>& v);
    62   void GetError2(TVector<r_8>& v);
    63   void GetError(TVector<r_8>& v);
     58  void GetAbsc(TVector<r_8>& v) const;
     59  void GetValue(TVector<r_8>& v) const;
     60  void GetError2(TVector<r_8>& v) const;
     61  void GetError(TVector<r_8>& v) const;
    6462  void PutValue(TVector<r_8>& v, int_4 ierr=0);
    6563  void PutValueAdd(TVector<r_8> &v, int_4 ierr=0);
     
    8482  inline r_8& operator()(int_4 i) {return mData[i];}
    8583  //! retourne "true" si il y a des erreurs stoquees
    86   inline bool HasErrors()
     84  inline bool HasErrors() const
    8785         {if(mErr2) return true; else return false;}
    8886  //! Retourne l'erreur du bin i
     
    130128  r_8       CleanedMean(r_8& sigma) const;
    131129  int_4     BinPercent(r_8 per) const;
    132   int_4     BinPercent(r_8 x,r_8 per,int_4& imin,int_4& imax);
    133   int_4     BinPercent(r_8 x,r_8 per,r_8& xmin,r_8& xmax);
     130  int_4     BinPercent(r_8 x,r_8 per,int_4& imin,int_4& imax) const;
     131  int_4     BinPercent(r_8 x,r_8 per,r_8& xmin,r_8& xmax) const;
    134132  void      HInteg(r_8 norm = 0.);
    135133  void      HDeriv();
    136134  virtual void HRebin(int_4 nbinew);
    137135
    138   int_4     MaxiLocal(r_8& maxi,int_4& imax,r_8& maxn,int_4& imaxn);
     136  int_4     MaxiLocal(r_8& maxi,int_4& imax,r_8& maxn,int_4& imaxn) const;
    139137  r_8       FitMax(int_4 degree=2, r_8 frac=0.5f, int_4 debug=0) const;
    140138  r_8       FindWidth(r_8 xmax,r_8 frac=0.5f, int_4 debug=0) const;
    141139  r_8       FindWidth(r_8 frac=0.5f, int_4 debug=0) const;
    142   int_4     EstimeMax(r_8& xm,int_4 SzPav = 3);
    143   int_4     EstimeMax(int_4& im,r_8& xm,int_4 SzPav = 3);
    144   void      EstimeWidthS(r_8 frac,r_8& widthG,r_8& widthD);
    145 
    146   // Fit
    147   int_4  Fit(GeneralFit& gfit,unsigned short typ_err=0);
    148   Histo  FitResidus(GeneralFit& gfit);
    149   Histo  FitFunction(GeneralFit& gfit);
     140  int_4     EstimeMax(r_8& xm,int_4 SzPav = 3) const;
     141  int_4     EstimeMax(int_4& im,r_8& xm,int_4 SzPav = 3) const;
     142  void      EstimeWidthS(r_8 frac,r_8& widthG,r_8& widthD) const;
    150143
    151144  // Print et Display ASCII
    152145  void PrintF(FILE * fp, int_4 dyn = 100, r_8 hmin = 1., r_8 hmax = -1.,
    153                       int_4 pflag = 0, int_4 il = 1, int_4 ih = -1);
     146                      int_4 pflag = 0, int_4 il = 1, int_4 ih = -1) const;
    154147  void Print(int_4 dyn = 100, r_8 hmin = 1., r_8 hmax = -1.,
    155                      int_4 pflag = 0, int_4 il = 1, int_4 ih = -1);
     148                     int_4 pflag = 0, int_4 il = 1, int_4 ih = -1) const;
    156149
    157150protected:
  • trunk/SophyaLib/HiStats/histos2.cc

    r1092 r1109  
    1414
    1515#include "histos2.h"
    16 #include "generalfit.h"
    1716
    1817/*!
     
    514513  Remplissage d'un tableau avec les valeurs des abscisses.
    515514*/
    516 void Histo2D::GetXCoor(TVector<r_8> &v)
     515void Histo2D::GetXCoor(TVector<r_8> &v) const
    517516{
    518517r_8 x,y;
     
    525524  Remplissage d'un tableau avec les valeurs des ordonnees.
    526525*/
    527 void Histo2D::GetYCoor(TVector<r_8> &v)
     526void Histo2D::GetYCoor(TVector<r_8> &v) const
    528527{
    529528r_8 x,y;
     
    536535  Remplissage d'un tableau avec les valeurs du contenu.
    537536*/
    538 void Histo2D::GetValue(TMatrix<r_8> &v)
     537void Histo2D::GetValue(TMatrix<r_8> &v) const
    539538{
    540539v.Realloc(mNx,mNy);
     
    547546  Remplissage d'un tableau avec les valeurs du carre des erreurs.
    548547*/
    549 void Histo2D::GetError2(TMatrix<r_8> &v)
     548void Histo2D::GetError2(TMatrix<r_8> &v) const
    550549{
    551550int_4 i,j;
     
    560559  Remplissage d'un tableau avec les valeurs des erreurs.
    561560*/
    562 void Histo2D::GetError(TMatrix<r_8> &v)
     561void Histo2D::GetError(TMatrix<r_8> &v) const
    563562{
    564563int_4 i,j;
     
    698697  Recherche du bin du maximum dans le pave [il,ih][jl,jh].
    699698*/
    700 void Histo2D::IJMax(int_4& imax,int_4& jmax,int_4 il,int_4 ih,int_4 jl,int_4 jh)
     699void Histo2D::IJMax(int_4& imax,int_4& jmax,int_4 il,int_4 ih,int_4 jl,int_4 jh) const
    701700{
    702701if( il > ih ) { il = 0; ih = mNx-1; }
     
    719718  Recherche du bin du minimum dans le pave [il,ih][jl,jh].
    720719*/
    721 void Histo2D::IJMin(int_4& imax,int_4& jmax,int_4 il,int_4 ih,int_4 jl,int_4 jh)
     720void Histo2D::IJMin(int_4& imax,int_4& jmax,int_4 il,int_4 ih,int_4 jl,int_4 jh) const
    722721{
    723722if( il > ih ) { il = 0; ih = mNx-1; }
     
    827826*/
    828827int_4 Histo2D::EstimeMax(r_8& xm,r_8& ym,int_4 SzPav
    829                       ,int_4 il,int_4 ih,int_4 jl,int_4 jh)
     828                      ,int_4 il,int_4 ih,int_4 jl,int_4 jh) const
    830829{
    831830int_4 im,jm;
     
    846845  \endverbatim
    847846*/
    848 int_4 Histo2D::EstimeMax(int_4 im,int_4 jm,r_8& xm,r_8& ym,int_4 SzPav)
     847int_4 Histo2D::EstimeMax(int_4 im,int_4 jm,r_8& xm,r_8& ym,int_4 SzPav) const
    849848{
    850849xm = ym = 0;
     
    902901*/
    903902int_4 Histo2D::FindMax(int_4& im,int_4& jm,int_4 SzPav,r_8 Dz
    904                     ,int_4 il,int_4 ih,int_4 jl,int_4 jh)
     903                    ,int_4 il,int_4 ih,int_4 jl,int_4 jh) const
    905904{
    906905if( il > ih ) { il = 0; ih = mNx-1; }
     
    933932}
    934933
    935 //////////////////////////////////////////////////////////
    936 
    937 //////////////////////////////////////////////////////////
    938 /*!
    939   Fit de l'histogramme par ``gfit''.
    940   \verbatim
    941     typ_err = 0 :
    942        - erreur attachee au bin si elle existe
    943        - sinon 1
    944     typ_err = 1 :
    945        - erreur attachee au bin si elle existe
    946        - sinon max( sqrt(abs(bin) ,1 )
    947     typ_err = 2 :
    948        - erreur forcee a 1
    949     typ_err = 3 :
    950        - erreur forcee a max( sqrt(abs(bin) ,1 )
    951     typ_err = 4 :
    952        - erreur forcee a 1, nulle si bin a zero.
    953     typ_err = 5 :
    954        - erreur forcee a max( sqrt(abs(bin) ,1 ),
    955          nulle si bin a zero.
    956   \endverbatim
    957 */
    958 int_4  Histo2D::Fit(GeneralFit& gfit,unsigned short typ_err)
    959 {
    960 if(NBinX()*NBinY()<=0) return -1000;
    961 if(typ_err>5) typ_err=0;
    962 
    963 GeneralFitData mydata(2,NBinX()*NBinY());
    964 
    965 for(int_4 i=0;i<NBinX();i++) for(int_4 j=0;j<NBinY();j++) {
    966   r_8 x,y;
    967   BinCenter(i,j,x,y);
    968   r_8 f = (*this)(i,j);
    969   r_8 saf = sqrt(fabs(f)); if(saf<1.) saf=1.;
    970   r_8 e=0.;
    971   if(typ_err==0)      {if(HasErrors()) e=Error(i,j); else e=1.;}
    972   else if(typ_err==1) {if(HasErrors()) e=Error(i,j); else e=saf;}
    973   else if(typ_err==2) e=1.;
    974   else if(typ_err==3) e=saf;
    975   else if(typ_err==4) e=(f==0.)?0.:1.;
    976   else if(typ_err==5) e=(f==0.)?0.:saf;
    977   mydata.AddData2(x,y,f,e);
    978 }
    979 
    980 gfit.SetData(&mydata);
    981 
    982 return gfit.Fit();
    983 }
    984 
    985 /*!
    986   Retourne une classe contenant les residus du fit ``gfit''.
    987 */
    988 Histo2D Histo2D::FitResidus(GeneralFit& gfit)
    989 {
    990 if(NBinX()<=0 || NBinY()<=0)
    991   throw(SzMismatchError("Histo2D::FitResidus: size mismatch\n"));
    992 GeneralFunction* f = gfit.GetFunction();
    993 if(f==NULL)
    994   throw(NullPtrError("Histo2D::FitResidus: NULL pointer\n"));
    995 TVector<r_8> par = gfit.GetParm();
    996 Histo2D h2(*this);
    997 for(int_4 i=0;i<NBinX();i++) for(int_4 j=0;j<NBinY();j++) {
    998   r_8 xc,yc;
    999   BinCenter(i,j,xc,yc);
    1000   r_8 x[2] = {xc,yc};
    1001   h2(i,j) -= f->Value(x,par.Data());
    1002 }
    1003 return h2;
    1004 }
    1005 
    1006 /*!
    1007   Retourne une classe contenant la fonction du fit ``gfit''.
    1008 */
    1009 Histo2D Histo2D::FitFunction(GeneralFit& gfit)
    1010 {
    1011 if(NBinX()<=0 || NBinY()<=0)
    1012   throw(SzMismatchError("Histo2D::FitFunction: size mismatch\n"));
    1013 GeneralFunction* f = gfit.GetFunction();
    1014 if(f==NULL)
    1015   throw(NullPtrError("Histo2D::FitFunction: NULL pointer\n"));
    1016 TVector<r_8> par = gfit.GetParm();
    1017 Histo2D h2(*this);
    1018 for(int_4 i=0;i<NBinX();i++) for(int_4 j=0;j<NBinY();j++) {
    1019   r_8 xc,yc;
    1020   BinCenter(i,j,xc,yc);
    1021   r_8 x[2] = {xc,yc};
    1022   h2(i,j) = f->Value(x,par.Data());
    1023 }
    1024 return h2;
    1025 }
    1026 
    1027934///////////////////////////////////////////////////////////////////
    1028935/*!
    1029936  Impression des informations sur l'histogramme.
    1030937*/
    1031 void Histo2D::PrintStatus()
     938void Histo2D::PrintStatus() const
    1032939{
    1033940printf("~Histo::Print    nHist=%g nEntries=%d",nHist,nEntries);
     
    1052959*/
    1053960void Histo2D::Print(r_8 min,r_8 max
    1054                    ,int_4 il,int_4 ih,int_4 jl,int_4 jh)
     961                   ,int_4 il,int_4 ih,int_4 jl,int_4 jh) const
    1055962{
    1056963int_4 ns = 35;
     
    11701077  Informations sur les projections.
    11711078*/
    1172 void Histo2D::ShowProj()
     1079void Histo2D::ShowProj() const
    11731080{
    11741081if( mHprojx != NULL ) cout << ">>>> Projection X set : "<< mHprojx <<endl;
     
    13581265  Informations sur les bandes.
    13591266*/
    1360 void Histo2D::ShowBand(int_4 lp)
     1267void Histo2D::ShowBand(int_4 lp) const
    13611268{
    13621269  cout << ">>>> Nombre de bande X : " << mLBandx.size() << endl;
    13631270if( lp>0 && mLBandx.size()>0 ) {
    1364   list<bande_slice>::iterator i;
     1271  list<bande_slice>::const_iterator i;
    13651272  for(i = mLBandx.begin(); i != mLBandx.end(); i++) {
    13661273    cout<<"  "<<(*i).num<<" de ymin="<<(*i).min<<" a ymax="<<(*i).max;
     
    13721279cout << ">>>> Nombre de bande Y : " << mLBandy.size() << endl;
    13731280if( lp>0 && mLBandy.size()>0 ) {
    1374   list<bande_slice>::iterator i;
     1281  list<bande_slice>::const_iterator i;
    13751282  for(i = mLBandy.begin(); i != mLBandy.end(); i++) {
    13761283    cout<<"  "<<(*i).num<<" de xmin="<<(*i).min<<" a xmax="<<(*i).max;
     
    14971404  Informations sur les bandes equidistantes.
    14981405*/
    1499 void Histo2D::ShowSli(int_4 lp)
    1500 {
    1501 list<bande_slice>::iterator i;
     1406void Histo2D::ShowSli(int_4 lp) const
     1407{
     1408list<bande_slice>::const_iterator i;
    15021409cout << ">>>> Nombre de slice X : " << mLSlix.size() << endl;
    15031410if( lp>0 && mLSlix.size() > 0 )
  • trunk/SophyaLib/HiStats/histos2.h

    r1092 r1109  
    1919
    2020namespace SOPHYA {
    21 
    22 class GeneralFit;
    2321
    2422//! 2 dimensions histograms
     
    5351
    5452  // get/put dans/depuis une matrice / vector
    55   void GetXCoor(TVector<r_8>& v);
    56   void GetValue(TMatrix<r_8> &v);
    57   void GetYCoor(TVector<r_8>& v);
    58   void GetError2(TMatrix<r_8>& v);
    59   void GetError(TMatrix<r_8>& v);
     53  void GetXCoor(TVector<r_8>& v) const;
     54  void GetValue(TMatrix<r_8> &v) const;
     55  void GetYCoor(TVector<r_8>& v) const;
     56  void GetError2(TMatrix<r_8>& v) const;
     57  void GetError(TMatrix<r_8>& v) const;
    6058  void PutValue(TMatrix<r_8>& v, int_4 ierr=0);
    6159  void PutValueAdd(TMatrix<r_8>& v, int_4 ierr=0);
     
    8886  inline r_8& operator()(int_4 i,int_4 j)      {return mData[j*mNx+i];}
    8987  //! retourne "true" si il y a des erreurs stoquees
    90   inline bool HasErrors() { if(mErr2) return true; else return false;}
     88  inline bool HasErrors() const { if(mErr2) return true; else return false;}
    9189  //! Retourne l'erreur du bin i,j.
    9290  inline r_8 Error(int_4 i,int_4 j)  const
     
    104102  inline int_4 NEntries() const {return nEntries;}
    105103  //! Retourne l'abscisse et l'ordonnee du coin inferieur du bin i,j.
    106   inline void BinLowEdge(int_4 i,int_4 j,r_8& x,r_8& y)
     104  inline void BinLowEdge(int_4 i,int_4 j,r_8& x,r_8& y) const
    107105              {x = mXmin + i*mWBinx; y = mYmin + j*mWBiny;}
    108106  //! Retourne l'abscisse et l'ordonnee du coin inferieur du bin i,j.
    109   inline void BinLowEdge(int_4 i,int_4 j,r_4& xf,r_4& yf)
     107  inline void BinLowEdge(int_4 i,int_4 j,r_4& xf,r_4& yf) const
    110108              {r_8 x,y; BinLowEdge(i,j,x,y); xf=x; yf=y;}
    111109  //! Retourne l'abscisse et l'ordonnee du centre du bin i,j.
    112   inline void BinCenter(int_4 i,int_4 j,r_8& x,r_8& y)
     110  inline void BinCenter(int_4 i,int_4 j,r_8& x,r_8& y) const
    113111              {x = mXmin + (i+0.5)*mWBinx; y = mYmin + (j+0.5)*mWBiny;}
    114112  //! Retourne l'abscisse et l'ordonnee du centre du bin i,j.
    115   inline void BinCenter(int_4 i,int_4 j,r_4& xf,r_4& yf)
     113  inline void BinCenter(int_4 i,int_4 j,r_4& xf,r_4& yf) const
    116114              {r_8 x,y; BinCenter(i,j,x,y); xf=x; yf=y;}
    117115  //! Retourne l'abscisse et l'ordonnee du coin superieur du bin i,j.
    118   inline void BinHighEdge(int_4 i,int_4 j,r_8& x,r_8& y)
     116  inline void BinHighEdge(int_4 i,int_4 j,r_8& x,r_8& y) const
    119117              {x = mXmin + (i+1)*mWBinx; y = mYmin + (j+1)*mWBiny;}
    120118  //! Retourne l'abscisse et l'ordonnee du coin superieur du bin i,j.
    121   inline void BinHighEdge(int_4 i,int_4 j,r_4& xf,r_4& yf)
     119  inline void BinHighEdge(int_4 i,int_4 j,r_4& xf,r_4& yf) const
    122120              {r_8 x,y; BinHighEdge(i,j,x,y); xf=x; yf=y;}
    123121  //! Retourne les numeros du bin contenant l'abscisse et l'ordonnee x,y.
    124   inline void FindBin(r_8 x,r_8 y,int_4& i,int_4& j)
     122  inline void FindBin(r_8 x,r_8 y,int_4& i,int_4& j) const
    125123    {i=(int_4) floor((x-mXmin)/mWBinx); j=(int_4) floor((y-mYmin)/mWBiny);}
    126124
     
    129127  int_4 BinNonNul() const;
    130128  int_4 ErrNonNul() const;
    131   void IJMax(int_4& imax,int_4& jmax,int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1);
    132   void IJMin(int_4& imax,int_4& jmax,int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1);
     129  void IJMax(int_4& imax,int_4& jmax,int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1) const;
     130  void IJMin(int_4& imax,int_4& jmax,int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1) const;
    133131  r_8 VMax(int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1) const;
    134132  r_8 VMin(int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1) const;
    135133  int_4 EstimeMax(r_8& xm,r_8& ym,int_4 SzPav = 3
    136                  ,int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1);
    137   int_4 EstimeMax(int_4 im,int_4 jm,r_8& xm,r_8& ym,int_4 SzPav = 3);
     134                 ,int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1) const;
     135  int_4 EstimeMax(int_4 im,int_4 jm,r_8& xm,r_8& ym,int_4 SzPav = 3) const;
    138136  int_4 FindMax(int_4& im,int_4& jm,int_4 SzPav = 3,r_8 Dz = 0.
    139                ,int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1);
    140 
    141   // Fit
    142   int_4   Fit(GeneralFit& gfit,unsigned short typ_err=0);
    143   Histo2D FitResidus(GeneralFit& gfit);
    144   Histo2D FitFunction(GeneralFit& gfit);
     137               ,int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1) const;
    145138
    146139  // Print et Display ASCII
    147   void PrintStatus();
     140  void PrintStatus() const;
    148141  void Print(r_8 min=1.,r_8 max=-1.
    149                ,int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1);
     142            ,int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1) const;
    150143
    151144  // PROJECTIONS
     
    163156  //! Retourne le pointeur sur l'histo 1D de la projection selon Y.
    164157  inline Histo* HProjY() const {return mHprojy;}
    165   void ShowProj();
     158  void ShowProj() const;
    166159
    167160  // BANDES
     
    180173  void GetBandX(int_4 n,r_8& ybmin,r_8& ybmax) const;
    181174  void GetBandY(int_4 n,r_8& xbmin,r_8& xbmax) const;
    182   void ShowBand(int_4 lp = 0);
     175  void ShowBand(int_4 lp = 0) const;
    183176
    184177  // SLICES
     
    195188  Histo* HSliX(int_4 n) const;
    196189  Histo* HSliY(int_4 n) const;
    197   void ShowSli(int_4 lp = 0);
     190  void ShowSli(int_4 lp = 0) const;
    198191
    199192#ifndef __DECCXX
Note: See TracChangeset for help on using the changeset viewer.