Changeset 1109 in Sophya
- Timestamp:
- Jul 28, 2000, 6:29:55 PM (25 years ago)
- Location:
- trunk/SophyaLib/HiStats
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/HiStats/Makefile
r919 r1109 11 11 endif 12 12 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 \ 15 16 $(INC)utils.h \ 16 17 $(INC)perrors.h \ … … 22 23 $(INC)basarr.h \ 23 24 $(INC)anydataobj.h \ 25 $(INC)mutyv.h \ 24 26 $(INC)dvlist.h \ 25 27 $(INC)objfio.h \ … … 28 30 $(INC)ndatablock.h \ 29 31 $(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 \ 32 35 $(INC)tarrinit.h \ 33 36 $(INC)sophyainit.h histos.h \ … … 45 48 $(INC)tarray.h \ 46 49 $(INC)basarr.h \ 50 $(INC)mutyv.h \ 47 51 $(INC)dvlist.h \ 48 52 $(INC)ndatablock.h \ 49 $(INC)utilarr.h histos2.h hisprof.h ntuple.h \ 53 $(INC)utilarr.h histos2.h \ 54 hisprof.h ntuple.h \ 50 55 $(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 \ 52 58 $(INC)objfio.h \ 53 59 $(INC)anydataobj.h \ … … 63 69 $(INC)tarray.h \ 64 70 $(INC)basarr.h \ 71 $(INC)mutyv.h \ 65 72 $(INC)dvlist.h \ 66 73 $(INC)ndatablock.h \ 67 74 $(INC)utilarr.h \ 68 75 $(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 \ 75 80 $(INC)utils.h \ 76 81 $(INC)perrors.h \ … … 85 90 $(INC)tarray.h \ 86 91 $(INC)basarr.h \ 92 $(INC)mutyv.h \ 87 93 $(INC)dvlist.h \ 88 94 $(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 \ 95 98 $(INC)perrors.h \ 96 99 $(INC)pexceptions.h \ … … 101 104 $(INC)gnumd5.h \ 102 105 $(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 \ 105 110 $(INC)machdefs.h \ 106 111 $(INC)pexceptions.h \ 107 112 $(INC)gnumd5.h \ 108 113 $(INC)perrors.h xntuple.h \ 114 $(INC)ntupintf.h \ 115 $(INC)dvlist.h \ 109 116 $(INC)objfio.h \ 110 117 $(INC)anydataobj.h \ 111 $(INC)ntupintf.h \ 112 $(INC)dvlist.h 118 $(INC)mutyv.h -
trunk/SophyaLib/HiStats/hisprof.h
r1092 r1109 62 62 virtual void HRebin(int_4 nbinew); 63 63 64 // Fit65 //! 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 75 64 // Print 76 65 //! Print, voir detail dans Histo::Print -
trunk/SophyaLib/HiStats/histos.cc
r1092 r1109 1 1 // 2 // $Id: histos.cc,v 1.1 0 2000-07-26 13:15:15ansari Exp $2 // $Id: histos.cc,v 1.11 2000-07-28 16:29:54 ansari Exp $ 3 3 // 4 4 … … 11 11 #include "poly.h" 12 12 #include "strutil.h" 13 #include "generalfit.h"14 13 15 14 /*! … … 295 294 Remplissage d'un tableau avec la valeur des abscisses 296 295 */ 297 void Histo::GetAbsc(TVector<r_8> &v) 296 void Histo::GetAbsc(TVector<r_8> &v) const 298 297 { 299 298 v.Realloc(mBins); … … 305 304 Remplissage d'un tableau avec la valeur du contenu 306 305 */ 307 void Histo::GetValue(TVector<r_8> &v) 306 void Histo::GetValue(TVector<r_8> &v) const 308 307 { 309 308 v.Realloc(mBins); … … 315 314 Remplissage d'un tableau avec la valeur des erreurs au carre 316 315 */ 317 void Histo::GetError2(TVector<r_8> &v) 316 void Histo::GetError2(TVector<r_8> &v) const 318 317 { 319 318 v.Realloc(mBins); … … 326 325 Remplissage d'un tableau avec la valeur des erreurs 327 326 */ 328 void Histo::GetError(TVector<r_8> &v) 327 void Histo::GetError(TVector<r_8> &v) const 329 328 { 330 329 v.Realloc(mBins); … … 764 763 \endverbatim 765 764 */ 766 int_4 Histo::BinPercent(r_8 x,r_8 per,int& imin,int& imax) 765 int_4 Histo::BinPercent(r_8 x,r_8 per,int& imin,int& imax) const 767 766 { 768 767 imin = imax = -1; … … 792 791 Idem precedent mais renvoie xmin et xmax 793 792 */ 794 int_4 Histo::BinPercent(r_8 x,r_8 per,r_8& xmin,r_8& xmax) 793 int_4 Histo::BinPercent(r_8 x,r_8 per,r_8& xmin,r_8& xmax) const 795 794 { 796 795 xmin = xmax = 0.; … … 901 900 consecutifs, le bin le plus a droite est pris. 902 901 */ 903 int_4 Histo::MaxiLocal(r_8& maxi,int& imax,r_8& maxn,int& imaxn) 902 int_4 Histo::MaxiLocal(r_8& maxi,int& imax,r_8& maxn,int& imaxn) const 904 903 { 905 904 int_4 nml = 0; … … 1162 1161 Cf suivant mais im est le bin du maximum de l'histo 1163 1162 */ 1164 int_4 Histo::EstimeMax(r_8& xm,int_4 SzPav) 1163 int_4 Histo::EstimeMax(r_8& xm,int_4 SzPav) const 1165 1164 { 1166 1165 int_4 im = IMax(); … … 1180 1179 \endverbatim 1181 1180 */ 1182 int_4 Histo::EstimeMax(int& im,r_8& xm,int_4 SzPav) 1181 int_4 Histo::EstimeMax(int& im,r_8& xm,int_4 SzPav) const 1183 1182 { 1184 1183 xm = 0; … … 1212 1211 et a droite (widthD) 1213 1212 */ 1214 void Histo::EstimeWidthS(r_8 frac,r_8& widthG,r_8& widthD) 1213 void Histo::EstimeWidthS(r_8 frac,r_8& widthG,r_8& widthD) const 1215 1214 { 1216 1215 int_4 i; … … 1248 1247 } 1249 1248 1250 }1251 1252 //////////////////////////////////////////////////////////1253 /*!1254 Fit de l'histogramme par ``gfit''.1255 \verbatim1256 typ_err = 0 :1257 - erreur attachee au bin si elle existe1258 - sinon 11259 typ_err = 1 :1260 - erreur attachee au bin si elle existe1261 - sinon max( sqrt(abs(bin) ,1 )1262 typ_err = 2 :1263 - erreur forcee a 11264 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 \endverbatim1272 */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;1335 1249 } 1336 1250 … … 1354 1268 */ 1355 1269 void 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 1357 1271 { 1358 1272 … … 1512 1426 */ 1513 1427 void 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 1515 1429 { 1516 1430 Histo::PrintF(stdout, hdyn, hmin, hmax, pflag, il, ih); -
trunk/SophyaLib/HiStats/histos.h
r1092 r1109 1 1 // This may look like C code, but it is really -*- C++ -*- 2 2 // 3 // $Id: histos.h,v 1.1 1 2000-07-26 13:15:15 ansari Exp $3 // $Id: histos.h,v 1.12 2000-07-28 16:29:55 ansari Exp $ 4 4 // 5 5 … … 16 16 17 17 namespace SOPHYA { 18 19 class GeneralFit;20 18 21 19 //! 1 dimension histograms … … 58 56 59 57 // 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; 64 62 void PutValue(TVector<r_8>& v, int_4 ierr=0); 65 63 void PutValueAdd(TVector<r_8> &v, int_4 ierr=0); … … 84 82 inline r_8& operator()(int_4 i) {return mData[i];} 85 83 //! retourne "true" si il y a des erreurs stoquees 86 inline bool HasErrors() 84 inline bool HasErrors() const 87 85 {if(mErr2) return true; else return false;} 88 86 //! Retourne l'erreur du bin i … … 130 128 r_8 CleanedMean(r_8& sigma) const; 131 129 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; 134 132 void HInteg(r_8 norm = 0.); 135 133 void HDeriv(); 136 134 virtual void HRebin(int_4 nbinew); 137 135 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; 139 137 r_8 FitMax(int_4 degree=2, r_8 frac=0.5f, int_4 debug=0) const; 140 138 r_8 FindWidth(r_8 xmax,r_8 frac=0.5f, int_4 debug=0) const; 141 139 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; 150 143 151 144 // Print et Display ASCII 152 145 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; 154 147 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; 156 149 157 150 protected: -
trunk/SophyaLib/HiStats/histos2.cc
r1092 r1109 14 14 15 15 #include "histos2.h" 16 #include "generalfit.h"17 16 18 17 /*! … … 514 513 Remplissage d'un tableau avec les valeurs des abscisses. 515 514 */ 516 void Histo2D::GetXCoor(TVector<r_8> &v) 515 void Histo2D::GetXCoor(TVector<r_8> &v) const 517 516 { 518 517 r_8 x,y; … … 525 524 Remplissage d'un tableau avec les valeurs des ordonnees. 526 525 */ 527 void Histo2D::GetYCoor(TVector<r_8> &v) 526 void Histo2D::GetYCoor(TVector<r_8> &v) const 528 527 { 529 528 r_8 x,y; … … 536 535 Remplissage d'un tableau avec les valeurs du contenu. 537 536 */ 538 void Histo2D::GetValue(TMatrix<r_8> &v) 537 void Histo2D::GetValue(TMatrix<r_8> &v) const 539 538 { 540 539 v.Realloc(mNx,mNy); … … 547 546 Remplissage d'un tableau avec les valeurs du carre des erreurs. 548 547 */ 549 void Histo2D::GetError2(TMatrix<r_8> &v) 548 void Histo2D::GetError2(TMatrix<r_8> &v) const 550 549 { 551 550 int_4 i,j; … … 560 559 Remplissage d'un tableau avec les valeurs des erreurs. 561 560 */ 562 void Histo2D::GetError(TMatrix<r_8> &v) 561 void Histo2D::GetError(TMatrix<r_8> &v) const 563 562 { 564 563 int_4 i,j; … … 698 697 Recherche du bin du maximum dans le pave [il,ih][jl,jh]. 699 698 */ 700 void Histo2D::IJMax(int_4& imax,int_4& jmax,int_4 il,int_4 ih,int_4 jl,int_4 jh) 699 void Histo2D::IJMax(int_4& imax,int_4& jmax,int_4 il,int_4 ih,int_4 jl,int_4 jh) const 701 700 { 702 701 if( il > ih ) { il = 0; ih = mNx-1; } … … 719 718 Recherche du bin du minimum dans le pave [il,ih][jl,jh]. 720 719 */ 721 void Histo2D::IJMin(int_4& imax,int_4& jmax,int_4 il,int_4 ih,int_4 jl,int_4 jh) 720 void Histo2D::IJMin(int_4& imax,int_4& jmax,int_4 il,int_4 ih,int_4 jl,int_4 jh) const 722 721 { 723 722 if( il > ih ) { il = 0; ih = mNx-1; } … … 827 826 */ 828 827 int_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 830 829 { 831 830 int_4 im,jm; … … 846 845 \endverbatim 847 846 */ 848 int_4 Histo2D::EstimeMax(int_4 im,int_4 jm,r_8& xm,r_8& ym,int_4 SzPav) 847 int_4 Histo2D::EstimeMax(int_4 im,int_4 jm,r_8& xm,r_8& ym,int_4 SzPav) const 849 848 { 850 849 xm = ym = 0; … … 902 901 */ 903 902 int_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 905 904 { 906 905 if( il > ih ) { il = 0; ih = mNx-1; } … … 933 932 } 934 933 935 //////////////////////////////////////////////////////////936 937 //////////////////////////////////////////////////////////938 /*!939 Fit de l'histogramme par ``gfit''.940 \verbatim941 typ_err = 0 :942 - erreur attachee au bin si elle existe943 - sinon 1944 typ_err = 1 :945 - erreur attachee au bin si elle existe946 - sinon max( sqrt(abs(bin) ,1 )947 typ_err = 2 :948 - erreur forcee a 1949 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 \endverbatim957 */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 1027 934 /////////////////////////////////////////////////////////////////// 1028 935 /*! 1029 936 Impression des informations sur l'histogramme. 1030 937 */ 1031 void Histo2D::PrintStatus() 938 void Histo2D::PrintStatus() const 1032 939 { 1033 940 printf("~Histo::Print nHist=%g nEntries=%d",nHist,nEntries); … … 1052 959 */ 1053 960 void 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 1055 962 { 1056 963 int_4 ns = 35; … … 1170 1077 Informations sur les projections. 1171 1078 */ 1172 void Histo2D::ShowProj() 1079 void Histo2D::ShowProj() const 1173 1080 { 1174 1081 if( mHprojx != NULL ) cout << ">>>> Projection X set : "<< mHprojx <<endl; … … 1358 1265 Informations sur les bandes. 1359 1266 */ 1360 void Histo2D::ShowBand(int_4 lp) 1267 void Histo2D::ShowBand(int_4 lp) const 1361 1268 { 1362 1269 cout << ">>>> Nombre de bande X : " << mLBandx.size() << endl; 1363 1270 if( lp>0 && mLBandx.size()>0 ) { 1364 list<bande_slice>:: iterator i;1271 list<bande_slice>::const_iterator i; 1365 1272 for(i = mLBandx.begin(); i != mLBandx.end(); i++) { 1366 1273 cout<<" "<<(*i).num<<" de ymin="<<(*i).min<<" a ymax="<<(*i).max; … … 1372 1279 cout << ">>>> Nombre de bande Y : " << mLBandy.size() << endl; 1373 1280 if( lp>0 && mLBandy.size()>0 ) { 1374 list<bande_slice>:: iterator i;1281 list<bande_slice>::const_iterator i; 1375 1282 for(i = mLBandy.begin(); i != mLBandy.end(); i++) { 1376 1283 cout<<" "<<(*i).num<<" de xmin="<<(*i).min<<" a xmax="<<(*i).max; … … 1497 1404 Informations sur les bandes equidistantes. 1498 1405 */ 1499 void Histo2D::ShowSli(int_4 lp) 1500 { 1501 list<bande_slice>:: iterator i;1406 void Histo2D::ShowSli(int_4 lp) const 1407 { 1408 list<bande_slice>::const_iterator i; 1502 1409 cout << ">>>> Nombre de slice X : " << mLSlix.size() << endl; 1503 1410 if( lp>0 && mLSlix.size() > 0 ) -
trunk/SophyaLib/HiStats/histos2.h
r1092 r1109 19 19 20 20 namespace SOPHYA { 21 22 class GeneralFit;23 21 24 22 //! 2 dimensions histograms … … 53 51 54 52 // 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; 60 58 void PutValue(TMatrix<r_8>& v, int_4 ierr=0); 61 59 void PutValueAdd(TMatrix<r_8>& v, int_4 ierr=0); … … 88 86 inline r_8& operator()(int_4 i,int_4 j) {return mData[j*mNx+i];} 89 87 //! 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;} 91 89 //! Retourne l'erreur du bin i,j. 92 90 inline r_8 Error(int_4 i,int_4 j) const … … 104 102 inline int_4 NEntries() const {return nEntries;} 105 103 //! 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 107 105 {x = mXmin + i*mWBinx; y = mYmin + j*mWBiny;} 108 106 //! 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 110 108 {r_8 x,y; BinLowEdge(i,j,x,y); xf=x; yf=y;} 111 109 //! 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 113 111 {x = mXmin + (i+0.5)*mWBinx; y = mYmin + (j+0.5)*mWBiny;} 114 112 //! 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 116 114 {r_8 x,y; BinCenter(i,j,x,y); xf=x; yf=y;} 117 115 //! 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 119 117 {x = mXmin + (i+1)*mWBinx; y = mYmin + (j+1)*mWBiny;} 120 118 //! 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 122 120 {r_8 x,y; BinHighEdge(i,j,x,y); xf=x; yf=y;} 123 121 //! 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 125 123 {i=(int_4) floor((x-mXmin)/mWBinx); j=(int_4) floor((y-mYmin)/mWBiny);} 126 124 … … 129 127 int_4 BinNonNul() const; 130 128 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; 133 131 r_8 VMax(int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1) const; 134 132 r_8 VMin(int_4 il=1,int_4 ih= -1,int_4 jl=1,int_4 jh= -1) const; 135 133 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; 138 136 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; 145 138 146 139 // Print et Display ASCII 147 void PrintStatus() ;140 void PrintStatus() const; 148 141 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; 150 143 151 144 // PROJECTIONS … … 163 156 //! Retourne le pointeur sur l'histo 1D de la projection selon Y. 164 157 inline Histo* HProjY() const {return mHprojy;} 165 void ShowProj() ;158 void ShowProj() const; 166 159 167 160 // BANDES … … 180 173 void GetBandX(int_4 n,r_8& ybmin,r_8& ybmax) const; 181 174 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; 183 176 184 177 // SLICES … … 195 188 Histo* HSliX(int_4 n) const; 196 189 Histo* HSliY(int_4 n) const; 197 void ShowSli(int_4 lp = 0) ;190 void ShowSli(int_4 lp = 0) const; 198 191 199 192 #ifndef __DECCXX
Note:
See TracChangeset
for help on using the changeset viewer.