Changeset 1092 in Sophya for trunk/SophyaLib/HiStats/histos2.cc
- Timestamp:
- Jul 26, 2000, 3:15:52 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/HiStats/histos2.cc
r1064 r1092 43 43 entre xMin,xMax et yMin,yMax. 44 44 */ 45 Histo2D::Histo2D(float xMin, float xMax, int nxBin 46 ,float yMin, float yMax, int nyBin) 47 : data(new float[nxBin*nyBin]), err2(NULL) 45 Histo2D::Histo2D(r_8 xMin,r_8 xMax,int_4 nxBin,r_8 yMin,r_8 yMax,int_4 nyBin) 46 : mData(new r_8[nxBin*nyBin]), mErr2(NULL) 48 47 , nHist(0), nEntries(0) 49 , nx(nxBin), ny(nyBin), nxy(nxBin*nyBin)50 , xmin(xMin), xmax(xMax), ymin(yMin), ymax(yMax)51 , wbinx((xMax - xMin)/nxBin), wbiny((yMax - yMin)/nyBin)52 , hprojx(NULL), hprojy(NULL)48 , mNx(nxBin), mNy(nyBin), mNxy(nxBin*nyBin) 49 , mXmin(xMin), mXmax(xMax), mYmin(yMin), mYmax(yMax) 50 , mWBinx((xMax - xMin)/nxBin), mWBiny((yMax - yMin)/nyBin) 51 , mHprojx(NULL), mHprojy(NULL) 53 52 { 54 53 ASSERT(nxBin>0 && nyBin>0 && xMin<xMax && yMin<yMax); 55 for(int i=0;i<3;i++) for(int j=0;j<3;j++) over[i][j]=0.;54 for(int_4 i=0;i<3;i++) for(int_4 j=0;j<3;j++) mOver[i][j]=0.; 56 55 Zero(); 57 b_s.H = NULL;56 mB_s.H = NULL; 58 57 END_CONSTRUCTOR 59 58 } 60 59 61 60 /*! 61 Createur d'un histogramme 2D ayant nxBin,nyBin bins 62 entre xMin,xMax et yMin,yMax. 63 */ 64 Histo2D::Histo2D(r_4 xMin,r_4 xMax,int_4 nxBin,r_4 yMin,r_4 yMax,int_4 nyBin) 65 : mData(new r_8[nxBin*nyBin]), mErr2(NULL) 66 , nHist(0), nEntries(0) 67 , mNx(nxBin), mNy(nyBin), mNxy(nxBin*nyBin) 68 , mXmin((r_8)xMin), mXmax((r_8)xMax), mYmin((r_8)yMin), mYmax((r_8)yMax) 69 , mWBinx((xMax - xMin)/nxBin), mWBiny((yMax - yMin)/nyBin) 70 , mHprojx(NULL), mHprojy(NULL) 71 { 72 ASSERT(nxBin>0 && nyBin>0 && xMin<xMax && yMin<yMax); 73 for(int_4 i=0;i<3;i++) for(int_4 j=0;j<3;j++) mOver[i][j]=0.; 74 Zero(); 75 mB_s.H = NULL; 76 END_CONSTRUCTOR 77 } 78 79 /*! 62 80 Constructeur par copie. 63 81 */ 64 82 Histo2D::Histo2D(const Histo2D& h) 65 83 { 66 int i,j;67 data = new float[h.nxy];68 memcpy( data, h.data, h.nxy*sizeof(float));69 70 err2 = NULL;71 if(h. err2) {72 err2 = new double[h.nxy];73 memcpy( err2, h.err2, h.nxy*sizeof(double));84 int_4 i,j; 85 mData = new r_8[h.mNxy]; 86 memcpy(mData, h.mData, h.mNxy*sizeof(r_8)); 87 88 mErr2 = NULL; 89 if(h.mErr2) { 90 mErr2 = new r_8[h.mNxy]; 91 memcpy(mErr2, h.mErr2, h.mNxy*sizeof(r_8)); 74 92 } 75 93 76 94 nHist = h.nHist; nEntries = h.nEntries; 77 for(i=0;i<3;i++) for(j=0;j<3;j++) over[i][j]=h.over[i][j];78 nx = h.nx; ny = h.ny; nxy = h.nxy;79 xmin = h.xmin; xmax = h.xmax; ymin = h.ymin; ymax = h.ymax;80 wbinx = h.wbinx; wbiny = h.wbiny;81 b_s.H = NULL;82 83 hprojx = hprojy = NULL;84 if(h. hprojx) {95 for(i=0;i<3;i++) for(j=0;j<3;j++) mOver[i][j]=h.mOver[i][j]; 96 mNx = h.mNx; mNy = h.mNy; mNxy = h.mNxy; 97 mXmin = h.mXmin; mXmax = h.mXmax; mYmin = h.mYmin; mYmax = h.mYmax; 98 mWBinx = h.mWBinx; mWBiny = h.mWBiny; 99 mB_s.H = NULL; 100 101 mHprojx = mHprojy = NULL; 102 if(h.mHprojx) { 85 103 SetProjX(); 86 * hprojx = *(h.hprojx);87 } 88 if(h. hprojy) {104 *mHprojx = *(h.mHprojx); 105 } 106 if(h.mHprojy) { 89 107 SetProjY(); 90 * hprojy = *(h.hprojy);91 } 92 93 int nb;94 floatmin,max;108 *mHprojy = *(h.mHprojy); 109 } 110 111 int_4 nb; 112 r_8 min,max; 95 113 nb = h.NSliX(); 96 114 if(nb>0) { … … 130 148 */ 131 149 Histo2D::Histo2D() 132 : data(NULL), err2(NULL)150 : mData(NULL), mErr2(NULL) 133 151 , nHist(0), nEntries(0) 134 , nx(0), ny(0), nxy(0)135 , xmin(0), xmax(0), ymin(0), ymax(0)136 , wbinx(0), wbiny(0)137 , hprojx(NULL), hprojy(NULL)138 { 139 for(int i=0;i<3;i++) for(int j=0;j<3;j++) over[i][j]=0.;140 b_s.H = NULL;152 , mNx(0), mNy(0), mNxy(0) 153 , mXmin(0), mXmax(0), mYmin(0), mYmax(0) 154 , mWBinx(0), mWBiny(0) 155 , mHprojx(NULL), mHprojy(NULL) 156 { 157 for(int_4 i=0;i<3;i++) for(int_4 j=0;j<3;j++) mOver[i][j]=0.; 158 mB_s.H = NULL; 141 159 END_CONSTRUCTOR 142 160 } … … 148 166 void Histo2D::Delete() 149 167 { 150 if( data != NULL ) { delete[] data; data = NULL;}151 152 if( err2 != NULL ) { delete[] err2; err2 = NULL;}168 if( mData != NULL ) { delete[] mData; mData = NULL;} 169 170 if( mErr2 != NULL ) { delete[] mErr2; mErr2 = NULL;} 153 171 154 172 DelProj(); … … 162 180 nHist = 0; 163 181 nEntries = 0; 164 nx = 0; ny = 0; nxy = 0;165 xmin = 0; xmax = 0; ymin = 0; ymax = 0;166 wbinx = 0; wbiny = 0;167 for(int i=0;i<3;i++) for(int j=0;j<3;j++) over[i][j]=0.;168 b_s.H = NULL;182 mNx = 0; mNy = 0; mNxy = 0; 183 mXmin = 0; mXmax = 0; mYmin = 0; mYmax = 0; 184 mWBinx = 0; mWBiny = 0; 185 for(int_4 i=0;i<3;i++) for(int_4 j=0;j<3;j++) mOver[i][j]=0.; 186 mB_s.H = NULL; 169 187 } 170 188 … … 184 202 { 185 203 nHist = nEntries = 0; 186 for(int i=0;i<3;i++) for(int j=0;j<3;j++) over[i][j]=0.;187 memset( data, 0, nxy*sizeof(float));188 memset( over, 0, 9*sizeof(float));189 190 if( err2 != NULL ) memset(err2, 0, nxy*sizeof(double));204 for(int_4 i=0;i<3;i++) for(int_4 j=0;j<3;j++) mOver[i][j]=0.; 205 memset(mData, 0, mNxy*sizeof(r_8)); 206 memset(mOver, 0, 9*sizeof(r_8)); 207 208 if( mErr2 != NULL ) memset(mErr2, 0, mNxy*sizeof(r_8)); 191 209 192 210 ZeroProj(); … … 205 223 void Histo2D::Errors() 206 224 { 207 if( nxy > 0 ) {208 if( err2==NULL) err2 = new double[nxy];209 memset( err2, 0, nxy*sizeof(double));225 if( mNxy > 0 ) { 226 if(mErr2==NULL) mErr2 = new r_8[mNxy]; 227 memset(mErr2, 0, mNxy*sizeof(r_8)); 210 228 } 211 229 } … … 217 235 Histo2D& Histo2D::operator = (const Histo2D& h) 218 236 { 219 int i,j,nb;220 floatmin,max;237 int_4 i,j,nb; 238 r_8 min,max; 221 239 222 240 if(this == &h) return *this; 223 if( h. nxy > nxy ) Delete();224 if(! data) data = new float[h.nxy];225 if( !h. err2 && err2 ) { delete [] err2; err2=NULL;}226 if( h. err2 && !err2 ) err2 = new double[h.nxy];227 228 for(i=0;i<3;i++) for(j=0;j<3;j++) over[i][j] = h.over[i][j];241 if( h.mNxy > mNxy ) Delete(); 242 if(!mData) mData = new r_8[h.mNxy]; 243 if( !h.mErr2 && mErr2 ) { delete [] mErr2; mErr2=NULL;} 244 if( h.mErr2 && !mErr2 ) mErr2 = new r_8[h.mNxy]; 245 246 for(i=0;i<3;i++) for(j=0;j<3;j++) mOver[i][j] = h.mOver[i][j]; 229 247 nHist = h.nHist; 230 248 nEntries = h.nEntries; 231 nx = h.nx; ny = h.ny; nxy = h.nxy;232 xmin = h.xmin; xmax = h.xmax; wbinx = h.wbinx;233 ymin = h.ymin; ymax = h.ymax; wbiny = h.wbiny;249 mNx = h.mNx; mNy = h.mNy; mNxy = h.mNxy; 250 mXmin = h.mXmin; mXmax = h.mXmax; mWBinx = h.mWBinx; 251 mYmin = h.mYmin; mYmax = h.mYmax; mWBiny = h.mWBiny; 234 252 235 memcpy( data, h.data, nxy*sizeof(float));236 if( err2) memcpy(err2, h.err2, nxy*sizeof(double));253 memcpy(mData, h.mData, mNxy*sizeof(r_8)); 254 if(mErr2) memcpy(mErr2, h.mErr2, mNxy*sizeof(r_8)); 237 255 238 256 DelProjX(); 239 if(h. hprojx) {257 if(h.mHprojx) { 240 258 SetProjX(); 241 * hprojx = *(h.hprojx);259 *mHprojx = *(h.mHprojx); 242 260 } 243 261 DelProjY(); 244 if(h. hprojy) {262 if(h.mHprojy) { 245 263 SetProjY(); 246 * hprojy = *(h.hprojy);264 *mHprojy = *(h.mHprojy); 247 265 } 248 266 … … 288 306 Operateur H *= b 289 307 */ 290 Histo2D& Histo2D::operator *= ( doubleb)291 { 292 int i,j;293 doubleb2 = b*b;294 for(i=0;i< nxy;i++) {295 data[i] *= b;296 if( err2) err2[i] *= b2;297 } 298 for(i=0;i<3;i++) for(j=0;j<3;j++) over[i][j] *= b;308 Histo2D& Histo2D::operator *= (r_8 b) 309 { 310 int_4 i,j; 311 r_8 b2 = b*b; 312 for(i=0;i<mNxy;i++) { 313 mData[i] *= b; 314 if(mErr2) mErr2[i] *= b2; 315 } 316 for(i=0;i<3;i++) for(j=0;j<3;j++) mOver[i][j] *= b; 299 317 nHist *= b; 300 318 301 if( hprojx) *hprojx *= b;302 if( hprojy) *hprojy *= b;319 if(mHprojx) *mHprojx *= b; 320 if(mHprojy) *mHprojy *= b; 303 321 if(NSliX()>0) for(i=0; i<NSliX();i++) *HSliX(i) *= b; 304 322 if(NSliY()>0) for(i=0; i<NSliY();i++) *HSliY(i) *= b; … … 312 330 Operateur H /= b 313 331 */ 314 Histo2D& Histo2D::operator /= ( doubleb)315 { 316 int i,j;332 Histo2D& Histo2D::operator /= (r_8 b) 333 { 334 int_4 i,j; 317 335 if (b==0.) THROW(inconsistentErr); 318 doubleb2 = b*b;319 for(i=0;i< nxy;i++) {320 data[i] /= b;321 if( err2) err2[i] /= b2;322 } 323 for(i=0;i<3;i++) for(j=0;j<3;j++) over[i][j] /= b;336 r_8 b2 = b*b; 337 for(i=0;i<mNxy;i++) { 338 mData[i] /= b; 339 if(mErr2) mErr2[i] /= b2; 340 } 341 for(i=0;i<3;i++) for(j=0;j<3;j++) mOver[i][j] /= b; 324 342 nHist /= b; 325 343 326 if( hprojx) *hprojx /= b;327 if( hprojy) *hprojy /= b;344 if(mHprojx) *mHprojx /= b; 345 if(mHprojy) *mHprojy /= b; 328 346 if(NSliX()>0) for(i=0; i<NSliX();i++) *HSliX(i) /= b; 329 347 if(NSliY()>0) for(i=0; i<NSliY();i++) *HSliY(i) /= b; … … 337 355 Operateur H += b 338 356 */ 339 Histo2D& Histo2D::operator += ( doubleb)340 { 341 int i,j;342 floatmin,max;343 for(i=0;i< nxy;i++) data[i] += b;344 for(i=0;i<3;i++) for(j=0;j<3;j++) over[i][j] += b;345 nHist += nxy*b;346 347 if( hprojx) *hprojx += b*ny;348 if( hprojy) *hprojy += b*nx;349 if(NSliX()>0) for(i=0; i<NSliX();i++) *HSliX(i) += b* ny/NSliX();350 if(NSliY()>0) for(i=0; i<NSliY();i++) *HSliY(i) += b* nx/NSliY();357 Histo2D& Histo2D::operator += (r_8 b) 358 { 359 int_4 i,j; 360 r_8 min,max; 361 for(i=0;i<mNxy;i++) mData[i] += b; 362 for(i=0;i<3;i++) for(j=0;j<3;j++) mOver[i][j] += b; 363 nHist += mNxy*b; 364 365 if(mHprojx) *mHprojx += b*mNy; 366 if(mHprojy) *mHprojy += b*mNx; 367 if(NSliX()>0) for(i=0; i<NSliX();i++) *HSliX(i) += b*mNy/NSliX(); 368 if(NSliY()>0) for(i=0; i<NSliY();i++) *HSliY(i) += b*mNx/NSliY(); 351 369 if(NBandX()>0) for(i=0; i<NBandX();i++) { 352 370 GetBandX(i,min,max); 353 *HBandX(i) += b*(max-min)/( ymax-ymin)*ny;371 *HBandX(i) += b*(max-min)/(mYmax-mYmin)*mNy; 354 372 } 355 373 if(NBandY()>0) for(i=0; i<NBandY();i++) { 356 374 GetBandY(i,min,max); 357 *HBandY(i) += b*(max-min)/( xmax-xmin)*nx;375 *HBandY(i) += b*(max-min)/(mXmax-mXmin)*mNx; 358 376 } 359 377 … … 364 382 Operateur H -= b 365 383 */ 366 Histo2D& Histo2D::operator -= ( doubleb)367 { 368 int i,j;369 floatmin,max;370 for(i=0;i< nxy;i++) data[i] -= b;371 for(i=0;i<3;i++) for(j=0;j<3;j++) over[i][j] -= b;372 nHist -= nxy*b;373 374 if( hprojx) *hprojx -= b*ny;375 if( hprojy) *hprojy -= b*nx;376 if(NSliX()>0) for(i=0; i<NSliX();i++) *HSliX(i) -= b* ny/NSliX();377 if(NSliY()>0) for(i=0; i<NSliY();i++) *HSliY(i) -= b* nx/NSliY();384 Histo2D& Histo2D::operator -= (r_8 b) 385 { 386 int_4 i,j; 387 r_8 min,max; 388 for(i=0;i<mNxy;i++) mData[i] -= b; 389 for(i=0;i<3;i++) for(j=0;j<3;j++) mOver[i][j] -= b; 390 nHist -= mNxy*b; 391 392 if(mHprojx) *mHprojx -= b*mNy; 393 if(mHprojy) *mHprojy -= b*mNx; 394 if(NSliX()>0) for(i=0; i<NSliX();i++) *HSliX(i) -= b*mNy/NSliX(); 395 if(NSliY()>0) for(i=0; i<NSliY();i++) *HSliY(i) -= b*mNx/NSliY(); 378 396 if(NBandX()>0) for(i=0; i<NBandX();i++) { 379 397 GetBandX(i,min,max); 380 *HBandX(i) -= b*(max-min)/( ymax-ymin)*ny;398 *HBandX(i) -= b*(max-min)/(mYmax-mYmin)*mNy; 381 399 } 382 400 if(NBandY()>0) for(i=0; i<NBandY();i++) { 383 401 GetBandY(i,min,max); 384 *HBandY(i) -= b*(max-min)/( xmax-xmin)*nx;402 *HBandY(i) -= b*(max-min)/(mXmax-mXmin)*mNx; 385 403 } 386 404 … … 394 412 Histo2D& Histo2D::operator += (const Histo2D& a) 395 413 { 396 int i,j;397 if( nx!=a.nx || ny!=a.ny) THROW(sizeMismatchErr);398 for(i=0;i< nxy;i++) {399 data[i] += a.data[i];400 if( err2 && a.err2) err2[i] += a.err2[i];401 } 402 for(i=0;i<3;i++) for(j=0;j<3;j++) over[i][j] += a.over[i][j];414 int_4 i,j; 415 if(mNx!=a.mNx || mNy!=a.mNy) THROW(sizeMismatchErr); 416 for(i=0;i<mNxy;i++) { 417 mData[i] += a.mData[i]; 418 if(mErr2 && a.mErr2) mErr2[i] += a.mErr2[i]; 419 } 420 for(i=0;i<3;i++) for(j=0;j<3;j++) mOver[i][j] += a.mOver[i][j]; 403 421 nHist += a.nHist; 404 422 nEntries += a.nEntries; 405 423 406 if( hprojx && a.hprojx) *hprojx += *(a.hprojx);407 if( hprojy && a.hprojy) *hprojy += *(a.hprojy);424 if(mHprojx && a.mHprojx) *mHprojx += *(a.mHprojx); 425 if(mHprojy && a.mHprojy) *mHprojy += *(a.mHprojy); 408 426 ZeroSliX(); ZeroSliY(); 409 427 ZeroBandX(); ZeroBandY(); … … 417 435 Histo2D& Histo2D::operator -= (const Histo2D& a) 418 436 { 419 int i,j;420 if( nx!=a.nx || ny!=a.ny) THROW(sizeMismatchErr);421 for(i=0;i< nxy;i++) {422 data[i] -= a.data[i];423 if( err2 && a.err2) err2[i] += a.err2[i];424 } 425 for(i=0;i<3;i++) for(j=0;j<3;j++) over[i][j] += a.over[i][j];437 int_4 i,j; 438 if(mNx!=a.mNx || mNy!=a.mNy) THROW(sizeMismatchErr); 439 for(i=0;i<mNxy;i++) { 440 mData[i] -= a.mData[i]; 441 if(mErr2 && a.mErr2) mErr2[i] += a.mErr2[i]; 442 } 443 for(i=0;i<3;i++) for(j=0;j<3;j++) mOver[i][j] += a.mOver[i][j]; 426 444 nHist -= a.nHist; 427 445 nEntries += a.nEntries; 428 446 429 if( hprojx && a.hprojx) *hprojx -= *(a.hprojx);430 if( hprojy && a.hprojy) *hprojy -= *(a.hprojy);447 if(mHprojx && a.mHprojx) *mHprojx -= *(a.mHprojx); 448 if(mHprojy && a.mHprojy) *mHprojy -= *(a.mHprojy); 431 449 ZeroSliX(); ZeroSliY(); 432 450 ZeroBandX(); ZeroBandY(); … … 440 458 Histo2D& Histo2D::operator *= (const Histo2D& a) 441 459 { 442 int i,j;443 if( nx!=a.nx || ny!=a.ny) THROW(sizeMismatchErr);460 int_4 i,j; 461 if(mNx!=a.mNx || mNy!=a.mNy) THROW(sizeMismatchErr); 444 462 nHist = 0.; 445 for(i=0;i< nxy;i++) {446 if( err2 && a.err2)447 err2[i] = a.data[i]*a.data[i]*err2[i] + data[i]*data[i]*a.err2[i];448 data[i] *= a.data[i];449 nHist += data[i];450 } 451 for(i=0;i<3;i++) for(j=0;j<3;j++) over[i][j] *= a.over[i][j];463 for(i=0;i<mNxy;i++) { 464 if(mErr2 && a.mErr2) 465 mErr2[i] = a.mData[i]*a.mData[i]*mErr2[i] + mData[i]*mData[i]*a.mErr2[i]; 466 mData[i] *= a.mData[i]; 467 nHist += mData[i]; 468 } 469 for(i=0;i<3;i++) for(j=0;j<3;j++) mOver[i][j] *= a.mOver[i][j]; 452 470 nEntries += a.nEntries; 453 471 454 if( hprojx && a.hprojx) *hprojx *= *(a.hprojx);455 if( hprojy && a.hprojy) *hprojy *= *(a.hprojy);472 if(mHprojx && a.mHprojx) *mHprojx *= *(a.mHprojx); 473 if(mHprojy && a.mHprojy) *mHprojy *= *(a.mHprojy); 456 474 ZeroSliX(); ZeroSliY(); 457 475 ZeroBandX(); ZeroBandY(); … … 465 483 Histo2D& Histo2D::operator /= (const Histo2D& a) 466 484 { 467 int i,j;468 if( nx!=a.nx || ny!=a.ny) THROW(sizeMismatchErr);485 int_4 i,j; 486 if(mNx!=a.mNx || mNy!=a.mNy) THROW(sizeMismatchErr); 469 487 nHist = 0.; 470 for(i=0;i< nxy;i++) {471 if(a. data[i]==0.) {472 data[i]=0.;473 if( err2) err2[i]=0.;488 for(i=0;i<mNxy;i++) { 489 if(a.mData[i]==0.) { 490 mData[i]=0.; 491 if(mErr2) mErr2[i]=0.; 474 492 continue; 475 493 } 476 if( err2 && a.err2)477 err2[i] = (err2[i] + data[i]/a.data[i]*data[i]/a.data[i]*a.err2[i])478 /(a. data[i]*a.data[i]);479 data[i] /= a.data[i];480 nHist += data[i];494 if(mErr2 && a.mErr2) 495 mErr2[i] = (mErr2[i] + mData[i]/a.mData[i]*mData[i]/a.mData[i]*a.mErr2[i]) 496 /(a.mData[i]*a.mData[i]); 497 mData[i] /= a.mData[i]; 498 nHist += mData[i]; 481 499 } 482 500 for(i=0;i<3;i++) for(j=0;j<3;j++) 483 if(a. over[i][j]!=0.) over[i][j] *= a.over[i][j]; else over[i][j] = 0.;501 if(a.mOver[i][j]!=0.) mOver[i][j] *= a.mOver[i][j]; else mOver[i][j] = 0.; 484 502 nEntries += a.nEntries; 485 503 486 if( hprojx && a.hprojx) *hprojx /= *(a.hprojx);487 if( hprojy && a.hprojy) *hprojy /= *(a.hprojy);504 if(mHprojx && a.mHprojx) *mHprojx /= *(a.mHprojx); 505 if(mHprojy && a.mHprojy) *mHprojy /= *(a.mHprojy); 488 506 ZeroSliX(); ZeroSliY(); 489 507 ZeroBandX(); ZeroBandY(); … … 498 516 void Histo2D::GetXCoor(TVector<r_8> &v) 499 517 { 500 floatx,y;501 v.Realloc( nx);502 for(int i=0;i<nx;i++) {BinLowEdge(i,0,x,y); v(i) = x;}518 r_8 x,y; 519 v.Realloc(mNx); 520 for(int_4 i=0;i<mNx;i++) {BinLowEdge(i,0,x,y); v(i) = x;} 503 521 return; 504 522 } … … 509 527 void Histo2D::GetYCoor(TVector<r_8> &v) 510 528 { 511 floatx,y;512 v.Realloc( ny);513 for(int i=0;i<ny;i++) {BinLowEdge(0,i,x,y); v(i) = y;}529 r_8 x,y; 530 v.Realloc(mNy); 531 for(int_4 i=0;i<mNy;i++) {BinLowEdge(0,i,x,y); v(i) = y;} 514 532 return; 515 533 } … … 520 538 void Histo2D::GetValue(TMatrix<r_8> &v) 521 539 { 522 v.Realloc( nx,ny);523 for(int i=0;i<nx;i++)524 for(int j=0;j<ny;j++) v(i,j) = (*this)(i,j);540 v.Realloc(mNx,mNy); 541 for(int_4 i=0;i<mNx;i++) 542 for(int_4 j=0;j<mNy;j++) v(i,j) = (*this)(i,j); 525 543 return; 526 544 } … … 531 549 void Histo2D::GetError2(TMatrix<r_8> &v) 532 550 { 533 int i,j;534 v.Realloc( nx,ny);535 if(! err2)536 {for(i=0;i< nx;i++) for(j=0;j<ny;j++) v(i,j) = 0.; return;}537 for(i=0;i< nx;i++) for(j=0;j<ny;j++) v(i,j) = Error2(i,j);551 int_4 i,j; 552 v.Realloc(mNx,mNy); 553 if(!mErr2) 554 {for(i=0;i<mNx;i++) for(j=0;j<mNy;j++) v(i,j) = 0.; return;} 555 for(i=0;i<mNx;i++) for(j=0;j<mNy;j++) v(i,j) = Error2(i,j); 538 556 return; 539 557 } … … 544 562 void Histo2D::GetError(TMatrix<r_8> &v) 545 563 { 546 int i,j;547 v.Realloc( nx,ny);548 if(! err2)549 {for(i=0;i< nx;i++) for(j=0;j<ny;j++) v(i,j) = 0.; return;}550 for(i=0;i< nx;i++) for(j=0;j<ny;j++) v(i,j) = Error(i,j);564 int_4 i,j; 565 v.Realloc(mNx,mNy); 566 if(!mErr2) 567 {for(i=0;i<mNx;i++) for(j=0;j<mNy;j++) v(i,j) = 0.; return;} 568 for(i=0;i<mNx;i++) for(j=0;j<mNy;j++) v(i,j) = Error(i,j); 551 569 return; 552 570 } … … 556 574 Remplissage du contenu de l'histo avec les valeurs d'un tableau. 557 575 */ 558 void Histo2D::PutValue(TMatrix<r_8> &v, int ierr) 559 { 560 int i,j; 561 //if(v.NRows()!=(uint_4)nx || v.NCol()!=(uint_4)ny) THROW(sizeMismatchErr); 562 uint_4 nnx = (v.NRows()<(uint_4)nx)? v.NRows(): (uint_4)nx; 563 uint_4 nny = (v.NCol() <(uint_4)ny)? v.NCol() : (uint_4)ny; 564 if(nnx>0 && nny>0) for(i=0;i<nnx;i++) for(j=0;j<nny;j++) { 576 void Histo2D::PutValue(TMatrix<r_8> &v, int_4 ierr) 577 { 578 //if(v.NRows()!=(uint_4)mNx || v.NCol()!=(uint_4)mNy) THROW(sizeMismatchErr); 579 uint_4 nnx = (v.NRows()<(uint_4)mNx)? v.NRows(): (uint_4)mNx; 580 uint_4 nny = (v.NCol() <(uint_4)mNy)? v.NCol() : (uint_4)mNy; 581 if(nnx>0 && nny>0) for(uint_4 i=0;i<nnx;i++) for(uint_4 j=0;j<nny;j++) { 565 582 (*this)(i,j) = v(i,j); 566 if( err2 && ierr) Error2(i,j) = fabs(v(i,j));583 if(mErr2 && ierr) Error2(i,j) = fabs(v(i,j)); 567 584 } 568 585 return; … … 572 589 Addition du contenu de l'histo avec les valeurs d'un tableau. 573 590 */ 574 void Histo2D::PutValueAdd(TMatrix<r_8> &v, int ierr) 575 { 576 int i,j; 577 //if(v.NRows()!=(uint_4)nx || v.NCol()!=(uint_4)ny) THROW(sizeMismatchErr); 578 uint_4 nnx = (v.NRows()<(uint_4)nx)? v.NRows(): (uint_4)nx; 579 uint_4 nny = (v.NCol() <(uint_4)ny)? v.NCol() : (uint_4)ny; 580 if(nnx>0 && nny>0) for(i=0;i<nnx;i++) for(j=0;j<nny;j++) { 591 void Histo2D::PutValueAdd(TMatrix<r_8> &v, int_4 ierr) 592 { 593 //if(v.NRows()!=(uint_4)mNx || v.NCol()!=(uint_4)mNy) THROW(sizeMismatchErr); 594 uint_4 nnx = (v.NRows()<(uint_4)mNx)? v.NRows(): (uint_4)mNx; 595 uint_4 nny = (v.NCol() <(uint_4)mNy)? v.NCol() : (uint_4)mNy; 596 if(nnx>0 && nny>0) for(uint_4 i=0;i<nnx;i++) for(uint_4 j=0;j<nny;j++) { 581 597 (*this)(i,j) += v(i,j); 582 if( err2 && ierr) Error2(i,j) += fabs(v(i,j));598 if(mErr2 && ierr) Error2(i,j) += fabs(v(i,j)); 583 599 } 584 600 return; … … 591 607 void Histo2D::PutError2(TMatrix<r_8> &v) 592 608 { 593 int i,j; 594 //if(v.NRows()!=(uint_4)nx || v.NCol()!=(uint_4)ny) THROW(sizeMismatchErr); 595 uint_4 nnx = (v.NRows()<(uint_4)nx)? v.NRows(): (uint_4)nx; 596 uint_4 nny = (v.NCol() <(uint_4)ny)? v.NCol() : (uint_4)ny; 609 //if(v.NRows()!=(uint_4)mNx || v.NCol()!=(uint_4)mNy) THROW(sizeMismatchErr); 610 uint_4 nnx = (v.NRows()<(uint_4)mNx)? v.NRows(): (uint_4)mNx; 611 uint_4 nny = (v.NCol() <(uint_4)mNy)? v.NCol() : (uint_4)mNy; 597 612 if(nnx>0 && nny>0) { 598 if(! err2) Errors();599 for( i=0;i<nnx;i++) for(j=0;j<nny;j++) Error2(i,j) = v(i,j);613 if(!mErr2) Errors(); 614 for(uint_4 i=0;i<nnx;i++) for(uint_4 j=0;j<nny;j++) Error2(i,j) = v(i,j); 600 615 } 601 616 return; … … 608 623 void Histo2D::PutError2Add(TMatrix<r_8> &v) 609 624 { 610 int i,j; 611 //if(v.NRows()!=(uint_4)nx || v.NCol()!=(uint_4)ny) THROW(sizeMismatchErr); 612 uint_4 nnx = (v.NRows()<(uint_4)nx)? v.NRows(): (uint_4)nx; 613 uint_4 nny = (v.NCol() <(uint_4)ny)? v.NCol() : (uint_4)ny; 625 //if(v.NRows()!=(uint_4)mNx || v.NCol()!=(uint_4)mNy) THROW(sizeMismatchErr); 626 uint_4 nnx = (v.NRows()<(uint_4)mNx)? v.NRows(): (uint_4)mNx; 627 uint_4 nny = (v.NCol() <(uint_4)mNy)? v.NCol() : (uint_4)mNy; 614 628 if(nnx>0 && nny>0) { 615 if(! err2) Errors();616 for( i=0;i<nnx;i++) for(j=0;j<nny;j++)629 if(!mErr2) Errors(); 630 for(uint_4 i=0;i<nnx;i++) for(uint_4 j=0;j<nny;j++) 617 631 if(v(i,j)>0.) Error2(i,j) += v(i,j); 618 632 } … … 625 639 void Histo2D::PutError(TMatrix<r_8> &v) 626 640 { 627 int i,j; 628 //if(v.NRows()!=(uint_4)nx || v.NCol()!=(uint_4)ny) THROW(sizeMismatchErr); 629 uint_4 nnx = (v.NRows()<(uint_4)nx)? v.NRows(): (uint_4)nx; 630 uint_4 nny = (v.NCol() <(uint_4)ny)? v.NCol() : (uint_4)ny; 641 //if(v.NRows()!=(uint_4)mNx || v.NCol()!=(uint_4)mNy) THROW(sizeMismatchErr); 642 uint_4 nnx = (v.NRows()<(uint_4)mNx)? v.NRows(): (uint_4)mNx; 643 uint_4 nny = (v.NCol() <(uint_4)mNy)? v.NCol() : (uint_4)mNy; 631 644 if(nnx>0 && nny>0) { 632 if(! err2) Errors();633 for( i=0;i<nnx;i++) for(j=0;j<nny;j++)645 if(!mErr2) Errors(); 646 for(uint_4 i=0;i<nnx;i++) for(uint_4 j=0;j<nny;j++) 634 647 if(v(i,j)>0.) Error2(i,j)=v(i,j)*v(i,j); else Error2(i,j)= -v(i,j)*v(i,j); 635 648 } … … 642 655 Addition du contenu de l'histo pour x,y poids w. 643 656 */ 644 void Histo2D::Add( float x, float y, floatw)657 void Histo2D::Add(r_8 x, r_8 y, r_8 w) 645 658 { 646 659 list<bande_slice>::iterator it; 647 int i,j;660 int_4 i,j; 648 661 FindBin(x,y,i,j); 649 662 650 if( hprojx != NULL ) hprojx->Add(x,w);651 if( hprojy != NULL ) hprojy->Add(y,w);652 653 if( lbandx.size()>0)654 for( it = lbandx.begin(); it != lbandx.end(); it++)663 if( mHprojx != NULL ) mHprojx->Add(x,w); 664 if( mHprojy != NULL ) mHprojy->Add(y,w); 665 666 if(mLBandx.size()>0) 667 for( it = mLBandx.begin(); it != mLBandx.end(); it++) 655 668 if( (*it).min <= y && y < (*it).max ) (*it).H->Add(x,w); 656 669 657 if( lbandy.size()>0)658 for( it = lbandy.begin(); it != lbandy.end(); it++)670 if(mLBandy.size()>0) 671 for( it = mLBandy.begin(); it != mLBandy.end(); it++) 659 672 if( (*it).min <= x && x < (*it).max ) (*it).H->Add(y,w); 660 673 661 if( lslix.size()>0)662 for( it = lslix.begin(); it != lslix.end(); it++)674 if(mLSlix.size()>0) 675 for( it = mLSlix.begin(); it != mLSlix.end(); it++) 663 676 if( (*it).min <= y && y < (*it).max ) (*it).H->Add(x,w); 664 677 665 if( lsliy.size()>0)666 for( it = lsliy.begin(); it != lsliy.end(); it++)678 if(mLSliy.size()>0) 679 for( it = mLSliy.begin(); it != mLSliy.end(); it++) 667 680 if( (*it).min <= x && x < (*it).max ) (*it).H->Add(y,w); 668 681 669 if( i<0 || i>= nx || j<0 || j>=ny ) {670 if(i<0) i=0; else if(i>= nx) i=2; else i=1;671 if(j<0) j=0; else if(j>= ny) j=2; else j=1;672 over[i][j] += w;673 over[1][1] += w;682 if( i<0 || i>=mNx || j<0 || j>=mNy ) { 683 if(i<0) i=0; else if(i>=mNx) i=2; else i=1; 684 if(j<0) j=0; else if(j>=mNy) j=2; else j=1; 685 mOver[i][j] += w; 686 mOver[1][1] += w; 674 687 return; 675 688 } 676 689 677 data[j*nx+i] += w;678 if( err2!=NULL) err2[j*nx+i] += w*w;690 mData[j*mNx+i] += w; 691 if(mErr2!=NULL) mErr2[j*mNx+i] += w*w; 679 692 nHist += w; 680 693 nEntries++; … … 685 698 Recherche du bin du maximum dans le pave [il,ih][jl,jh]. 686 699 */ 687 void Histo2D::IJMax(int & imax,int& jmax,int il,int ih,int jl,intjh)688 { 689 if( il > ih ) { il = 0; ih = nx-1; }690 if( jl > jh ) { jl = 0; jh = ny-1; }700 void Histo2D::IJMax(int_4& imax,int_4& jmax,int_4 il,int_4 ih,int_4 jl,int_4 jh) 701 { 702 if( il > ih ) { il = 0; ih = mNx-1; } 703 if( jl > jh ) { jl = 0; jh = mNy-1; } 691 704 if( il < 0 ) il = 0; 692 705 if( jl < 0 ) jl = 0; 693 if( ih >= nx ) ih = nx-1;694 if( jh >= ny ) jh = ny-1;706 if( ih >= mNx ) ih = mNx-1; 707 if( jh >= mNy ) jh = mNy-1; 695 708 696 709 imax = jmax = 0; 697 if( nxy==1) return;698 699 floatmx=(*this)(il,jl);700 for (int i=il; i<=ih; i++)701 for (int j=jl; j<=jh; j++)710 if(mNxy==1) return; 711 712 r_8 mx=(*this)(il,jl); 713 for (int_4 i=il; i<=ih; i++) 714 for (int_4 j=jl; j<=jh; j++) 702 715 if ((*this)(i,j)>mx) {imax = i; jmax = j; mx=(*this)(i,j);} 703 716 } … … 706 719 Recherche du bin du minimum dans le pave [il,ih][jl,jh]. 707 720 */ 708 void Histo2D::IJMin(int & imax,int& jmax,int il,int ih,int jl,intjh)709 { 710 if( il > ih ) { il = 0; ih = nx-1; }711 if( jl > jh ) { jl = 0; jh = ny-1; }721 void Histo2D::IJMin(int_4& imax,int_4& jmax,int_4 il,int_4 ih,int_4 jl,int_4 jh) 722 { 723 if( il > ih ) { il = 0; ih = mNx-1; } 724 if( jl > jh ) { jl = 0; jh = mNy-1; } 712 725 if( il < 0 ) il = 0; 713 726 if( jl < 0 ) jl = 0; 714 if( ih >= nx ) ih = nx-1;715 if( jh >= ny ) jh = ny-1;727 if( ih >= mNx ) ih = mNx-1; 728 if( jh >= mNy ) jh = mNy-1; 716 729 717 730 imax = jmax = 0; 718 if( nxy==1) return;719 720 floatmx=(*this)(il,jl);721 for (int i=il; i<=ih; i++)722 for (int j=jl; j<=jh; j++)731 if(mNxy==1) return; 732 733 r_8 mx=(*this)(il,jl); 734 for (int_4 i=il; i<=ih; i++) 735 for (int_4 j=jl; j<=jh; j++) 723 736 if ((*this)(i,j)<mx) {imax = i; jmax = j; mx=(*this)(i,j);} 724 737 } … … 728 741 Recherche du maximum dans le pave [il,ih][jl,jh]. 729 742 */ 730 float Histo2D::VMax(int il,int ih,int jl,intjh) const731 { 732 if( il > ih ) { il = 0; ih = nx-1; }733 if( jl > jh ) { jl = 0; jh = ny-1; }743 r_8 Histo2D::VMax(int_4 il,int_4 ih,int_4 jl,int_4 jh) const 744 { 745 if( il > ih ) { il = 0; ih = mNx-1; } 746 if( jl > jh ) { jl = 0; jh = mNy-1; } 734 747 if( il < 0 ) il = 0; 735 748 if( jl < 0 ) jl = 0; 736 if( ih >= nx ) ih = nx-1;737 if( jh >= ny ) jh = ny-1;738 739 floatmx=(*this)(il,jl);740 if( nxy==1) return mx;741 for (int i=il; i<=ih; i++)742 for (int j=jl; j<=jh; j++)749 if( ih >= mNx ) ih = mNx-1; 750 if( jh >= mNy ) jh = mNy-1; 751 752 r_8 mx=(*this)(il,jl); 753 if(mNxy==1) return mx; 754 for (int_4 i=il; i<=ih; i++) 755 for (int_4 j=jl; j<=jh; j++) 743 756 if ((*this)(i,j)>mx) mx=(*this)(i,j); 744 757 return mx; … … 748 761 Recherche du minimum dans le pave [il,ih][jl,jh]. 749 762 */ 750 float Histo2D::VMin(int il,int ih,int jl,intjh) const751 { 752 if( il > ih ) { il = 0; ih = nx-1; }753 if( jl > jh ) { jl = 0; jh = ny-1; }763 r_8 Histo2D::VMin(int_4 il,int_4 ih,int_4 jl,int_4 jh) const 764 { 765 if( il > ih ) { il = 0; ih = mNx-1; } 766 if( jl > jh ) { jl = 0; jh = mNy-1; } 754 767 if( il < 0 ) il = 0; 755 768 if( jl < 0 ) jl = 0; 756 if( ih >= nx ) ih = nx-1;757 if( jh >= ny ) jh = ny-1;758 759 floatmx=(*this)(il,jl);760 if( nxy==1) return mx;761 for (int i=il; i<=ih; i++)762 for (int j=jl; j<=jh; j++)769 if( ih >= mNx ) ih = mNx-1; 770 if( jh >= mNy ) jh = mNy-1; 771 772 r_8 mx=(*this)(il,jl); 773 if(mNxy==1) return mx; 774 for (int_4 i=il; i<=ih; i++) 775 for (int_4 j=jl; j<=jh; j++) 763 776 if ((*this)(i,j)<mx) mx=(*this)(i,j); 764 777 return mx; … … 769 782 Renvoie les under.overflow dans les 8 quadrants. 770 783 \verbatim 771 over[3][3]:20 | 21 | 22784 mOver[3][3]: 20 | 21 | 22 772 785 | | 773 786 -------------- … … 780 793 \endverbatim 781 794 */ 782 float Histo2D::NOver(int i,intj) const783 { 784 if( i < 0 || i>=3 || j < 0 || j>=3 ) return over[1][1];785 return over[i][j];795 r_8 Histo2D::NOver(int_4 i,int_4 j) const 796 { 797 if( i < 0 || i>=3 || j < 0 || j>=3 ) return mOver[1][1]; 798 return mOver[i][j]; 786 799 } 787 800 … … 791 804 Retourne le nombre de bins non-nuls. 792 805 */ 793 int Histo2D::BinNonNul() const794 { 795 int non=0;796 for (int i=0;i<nxy;i++) if( data[i] != 0. ) non++;806 int_4 Histo2D::BinNonNul() const 807 { 808 int_4 non=0; 809 for (int_4 i=0;i<mNxy;i++) if( mData[i] != 0. ) non++; 797 810 return non; 798 811 } … … 801 814 Retourne le nombre de bins avec erreurs non-nulles. 802 815 */ 803 int Histo2D::ErrNonNul() const804 { 805 if( err2==NULL) return -1;806 int non=0;807 for (int i=0;i<nxy;i++) if( err2[i] != 0. ) non++;816 int_4 Histo2D::ErrNonNul() const 817 { 818 if(mErr2==NULL) return -1; 819 int_4 non=0; 820 for (int_4 i=0;i<mNxy;i++) if( mErr2[i] != 0. ) non++; 808 821 return non; 809 822 } … … 813 826 Idem EstimeMax(int...) mais retourne x,y. 814 827 */ 815 int Histo2D::EstimeMax(float& xm,float& ym,intSzPav816 ,int il,int ih,int jl,intjh)817 { 818 int im,jm;828 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) 830 { 831 int_4 im,jm; 819 832 IJMax(im,jm,il,ih,jl,jh); 820 833 return EstimeMax(im,jm,xm,ym,SzPav); … … 833 846 \endverbatim 834 847 */ 835 int Histo2D::EstimeMax(int im,int jm,float& xm,float& ym,intSzPav)848 int_4 Histo2D::EstimeMax(int_4 im,int_4 jm,r_8& xm,r_8& ym,int_4 SzPav) 836 849 { 837 850 xm = ym = 0; 838 851 if( SzPav <= 0 ) return -1; 839 if( im < 0 || im >= nx ) return -1;840 if( jm < 0 || jm >= ny ) return -1;852 if( im < 0 || im >= mNx ) return -1; 853 if( jm < 0 || jm >= mNy ) return -1; 841 854 842 855 if( SzPav%2 == 0 ) SzPav++; 843 856 SzPav = (SzPav-1)/2; 844 857 845 int rc = 0;846 doubledxm = 0, dym = 0, wx = 0;847 for(int i=im-SzPav;i<=im+SzPav;i++) {848 if( i<0 || i>= nx ) {rc=1; continue;}849 for(int j=jm-SzPav;j<=jm+SzPav;j++) {850 if( j<0 || j>= ny ) {rc=1; continue;}851 floatx,y;858 int_4 rc = 0; 859 r_8 dxm = 0, dym = 0, wx = 0; 860 for(int_4 i=im-SzPav;i<=im+SzPav;i++) { 861 if( i<0 || i>= mNx ) {rc=1; continue;} 862 for(int_4 j=jm-SzPav;j<=jm+SzPav;j++) { 863 if( j<0 || j>= mNy ) {rc=1; continue;} 864 r_8 x,y; 852 865 BinCenter(i,j,x,y); 853 866 dxm += x * (*this)(i,j); … … 888 901 \endverbatim 889 902 */ 890 int Histo2D::FindMax(int& im,int& jm,int SzPav,floatDz891 ,int il,int ih,int jl,intjh)892 { 893 if( il > ih ) { il = 0; ih = nx-1; }894 if( jl > jh ) { jl = 0; jh = ny-1; }903 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) 905 { 906 if( il > ih ) { il = 0; ih = mNx-1; } 907 if( jl > jh ) { jl = 0; jh = mNy-1; } 895 908 if( il < 0 ) il = 0; 896 909 if( jl < 0 ) jl = 0; 897 if( ih >= nx ) ih = nx-1;898 if( jh >= ny ) jh = ny-1;910 if( ih >= mNx ) ih = mNx-1; 911 if( jh >= mNy ) jh = mNy-1; 899 912 if( SzPav < 0 ) SzPav = 0; 900 913 else { if( SzPav%2 == 0 ) SzPav++; SzPav = (SzPav-1)/2;} 901 914 if( Dz < 0 ) Dz = 0.; 902 floatmax = VMax(il,ih,jl,jh) - Dz;903 int nmax = 0;904 float sumx = -MAXFLOAT;905 for(int i=il;i<=ih;i++) for(intj=jl;j<=jh;j++) {915 r_8 max = VMax(il,ih,jl,jh) - Dz; 916 int_4 nmax = 0; 917 r_8 sumx = -1.e20; 918 for(int_4 i=il;i<=ih;i++) for(int_4 j=jl;j<=jh;j++) { 906 919 if( (*this)(i,j) < max) continue; 907 920 nmax++; 908 floatsum = 0.;909 for(int ii=i-SzPav;ii<=i+SzPav;ii++) {910 if( ii<0 || ii >= nx ) continue;911 for(int jj=j-SzPav;jj<=j+SzPav;jj++) {912 if( jj<0 || jj >= ny ) continue;921 r_8 sum = 0.; 922 for(int_4 ii=i-SzPav;ii<=i+SzPav;ii++) { 923 if( ii<0 || ii >= mNx ) continue; 924 for(int_4 jj=j-SzPav;jj<=j+SzPav;jj++) { 925 if( jj<0 || jj >= mNy ) continue; 913 926 sum += (*this)(ii,jj); 914 927 } 915 928 } 916 if( sum > sumx ) { im = i; jm = j; sumx =sum;}929 if(nmax==1 || sum>sumx) {im=i; jm=j; sumx=sum;} 917 930 } 918 931 if( nmax <= 0 ) { IJMax(im,jm,il,ih,jl,jh); return 1;} … … 943 956 \endverbatim 944 957 */ 945 int Histo2D::Fit(GeneralFit& gfit,unsigned short typ_err)958 int_4 Histo2D::Fit(GeneralFit& gfit,unsigned short typ_err) 946 959 { 947 960 if(NBinX()*NBinY()<=0) return -1000; … … 950 963 GeneralFitData mydata(2,NBinX()*NBinY()); 951 964 952 for(int i=0;i<NBinX();i++) for(intj=0;j<NBinY();j++) {953 floatx,y;965 for(int_4 i=0;i<NBinX();i++) for(int_4 j=0;j<NBinY();j++) { 966 r_8 x,y; 954 967 BinCenter(i,j,x,y); 955 double f = (double)(*this)(i,j);956 doublesaf = sqrt(fabs(f)); if(saf<1.) saf=1.;957 doublee=0.;968 r_8 f = (*this)(i,j); 969 r_8 saf = sqrt(fabs(f)); if(saf<1.) saf=1.; 970 r_8 e=0.; 958 971 if(typ_err==0) {if(HasErrors()) e=Error(i,j); else e=1.;} 959 972 else if(typ_err==1) {if(HasErrors()) e=Error(i,j); else e=saf;} … … 962 975 else if(typ_err==4) e=(f==0.)?0.:1.; 963 976 else if(typ_err==5) e=(f==0.)?0.:saf; 964 mydata.AddData2( (double) x,(double)y,f,e);977 mydata.AddData2(x,y,f,e); 965 978 } 966 979 … … 982 995 TVector<r_8> par = gfit.GetParm(); 983 996 Histo2D h2(*this); 984 for(int i=0;i<NBinX();i++) for(intj=0;j<NBinY();j++) {985 floatxc,yc;997 for(int_4 i=0;i<NBinX();i++) for(int_4 j=0;j<NBinY();j++) { 998 r_8 xc,yc; 986 999 BinCenter(i,j,xc,yc); 987 double x[2] = {(double)xc,(double)yc};988 h2(i,j) -= (float)f->Value(x,par.Data());1000 r_8 x[2] = {xc,yc}; 1001 h2(i,j) -= f->Value(x,par.Data()); 989 1002 } 990 1003 return h2; … … 1003 1016 TVector<r_8> par = gfit.GetParm(); 1004 1017 Histo2D h2(*this); 1005 for(int i=0;i<NBinX();i++) for(intj=0;j<NBinY();j++) {1006 floatxc,yc;1018 for(int_4 i=0;i<NBinX();i++) for(int_4 j=0;j<NBinY();j++) { 1019 r_8 xc,yc; 1007 1020 BinCenter(i,j,xc,yc); 1008 double x[2] = {(double)xc,(double)yc};1009 h2(i,j) = (float)f->Value(x,par.Data());1021 r_8 x[2] = {xc,yc}; 1022 h2(i,j) = f->Value(x,par.Data()); 1010 1023 } 1011 1024 return h2; … … 1020 1033 printf("~Histo::Print nHist=%g nEntries=%d",nHist,nEntries); 1021 1034 if(HasErrors()) printf(" Errors=1\n"); else printf(" Errors=0\n"); 1022 printf(" over: [ %g %g %g // %g %g %g // %g %g %g ]\n"1023 , over[2][0],over[2][1],over[2][2]1024 , over[1][0],over[1][1],over[1][2]1025 , over[0][0],over[0][1],over[0][2]);1026 printf(" nx=%d xmin=%g xmax=%g binx=%g ", nx,xmin,xmax,wbinx);1027 printf(" ny=%d ymin=%g ymax=%g biny=%g\n", ny,ymin,ymax,wbiny);1035 printf("mOver: [ %g %g %g // %g %g %g // %g %g %g ]\n" 1036 ,mOver[2][0],mOver[2][1],mOver[2][2] 1037 ,mOver[1][0],mOver[1][1],mOver[1][2] 1038 ,mOver[0][0],mOver[0][1],mOver[0][2]); 1039 printf(" nx=%d xmin=%g xmax=%g binx=%g ",mNx,mXmin,mXmax,mWBinx); 1040 printf(" ny=%d ymin=%g ymax=%g biny=%g\n",mNy,mYmin,mYmax,mWBiny); 1028 1041 } 1029 1042 … … 1038 1051 \endverbatim 1039 1052 */ 1040 void Histo2D::Print( float min,floatmax1041 ,int il,int ih,int jl,intjh)1042 { 1043 int ns = 35;1053 void Histo2D::Print(r_8 min,r_8 max 1054 ,int_4 il,int_4 ih,int_4 jl,int_4 jh) 1055 { 1056 int_4 ns = 35; 1044 1057 const char *s = "+23456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 1045 1058 1046 if( il > ih ) { il = 0; ih = nx-1; }1047 if( jl > jh ) { jl = 0; jh = ny-1; }1059 if( il > ih ) { il = 0; ih = mNx-1; } 1060 if( jl > jh ) { jl = 0; jh = mNy-1; } 1048 1061 if( il < 0 ) il = 0; 1049 1062 if( jl < 0 ) jl = 0; 1050 if( ih >= nx ) ih = nx-1;1051 if( jh >= ny ) jh = ny-1;1063 if( ih >= mNx ) ih = mNx-1; 1064 if( jh >= mNy ) jh = mNy-1; 1052 1065 1053 1066 PrintStatus(); 1054 1067 1055 if( il != 0 || ih != nx-1 || jl != 0 || jh != ny-1 ) {1056 floatxl,xh,yl,yh;1068 if( il != 0 || ih != mNx-1 || jl != 0 || jh != mNy-1 ) { 1069 r_8 xl,xh,yl,yh; 1057 1070 BinLowEdge(il,jl,xl,yl); 1058 1071 BinHighEdge(ih,jh,xh,yh); … … 1072 1085 // imprime numero de bin en colonne 1073 1086 printf("\n"); 1074 if( nx-1 >= 100 ) {1087 if( mNx-1 >= 100 ) { 1075 1088 printf(" "); 1076 for(int i=il;i<=ih;i++) printf("%1d",(int) (i%1000)/100);1089 for(int_4 i=il;i<=ih;i++) printf("%1d",(int_4) (i%1000)/100); 1077 1090 printf("\n"); 1078 1091 } 1079 if( nx-1 >= 10 ) {1092 if( mNx-1 >= 10 ) { 1080 1093 printf(" "); 1081 for(int i=il;i<=ih;i++) printf("%1d",(int) (i%100)/10);1094 for(int_4 i=il;i<=ih;i++) printf("%1d",(int_4) (i%100)/10); 1082 1095 printf("\n"); 1083 1096 } 1084 1097 printf(" "); 1085 for(int i=il;i<=ih;i++) printf("%1d",i%10);1098 for(int_4 i=il;i<=ih;i++) printf("%1d",i%10); 1086 1099 printf("\n"); 1087 printf(" "); {for(int i=il;i<=ih;i++) printf("-"); printf("\n");}1100 printf(" "); {for(int_4 i=il;i<=ih;i++) printf("-"); printf("\n");} 1088 1101 1089 1102 // imprime histogramme 1090 for(int j=jh;j>=jl;j--) {1103 for(int_4 j=jh;j>=jl;j--) { 1091 1104 printf("%3d: ",j); 1092 for(int i=il;i<=ih;i++) {1093 int h;1094 if( 1<=max-min && max-min<=35 ) h = (int )( (*this)(i,j) - min ) - 1;1095 else h = (int )( ((*this)(i,j)-min)/(max-min) * ns ) - 1;1105 for(int_4 i=il;i<=ih;i++) { 1106 int_4 h; 1107 if( 1<=max-min && max-min<=35 ) h = (int_4)( (*this)(i,j) - min ) - 1; 1108 else h = (int_4)( ((*this)(i,j)-min)/(max-min) * ns ) - 1; 1096 1109 char c; 1097 1110 if(h<0 && (*this)(i,j)>min) c = '.'; … … 1105 1118 1106 1119 // imprime numero de bin en colonne 1107 printf(" "); {for(int i=il;i<=ih;i++) printf("-"); printf("\n");}1108 if( nx-1 >= 100 ) {1120 printf(" "); {for(int_4 i=il;i<=ih;i++) printf("-"); printf("\n");} 1121 if( mNx-1 >= 100 ) { 1109 1122 printf(" "); 1110 for(int i=il;i<=ih;i++) printf("%1d",(int) (i%1000)/100);1123 for(int_4 i=il;i<=ih;i++) printf("%1d",(int_4) (i%1000)/100); 1111 1124 printf("\n"); 1112 1125 } 1113 if( nx-1 >= 10 ) {1126 if( mNx-1 >= 10 ) { 1114 1127 printf(" "); 1115 for(int i=il;i<=ih;i++) printf("%1d",(int) (i%100)/10);1128 for(int_4 i=il;i<=ih;i++) printf("%1d",(int_4) (i%100)/10); 1116 1129 printf("\n"); 1117 1130 } 1118 1131 printf(" "); 1119 {for(int i=il;i<=ih;i++) printf("%1d",i%10);}1132 {for(int_4 i=il;i<=ih;i++) printf("%1d",i%10);} 1120 1133 printf("\n"); 1121 1134 … … 1130 1143 void Histo2D::SetProjX() 1131 1144 { 1132 if( hprojx != NULL ) DelProjX();1133 hprojx = new Histo(xmin,xmax,nx);1134 if( err2 != NULL && hprojx != NULL ) hprojx->Errors();1145 if( mHprojx != NULL ) DelProjX(); 1146 mHprojx = new Histo(mXmin,mXmax,mNx); 1147 if( mErr2 != NULL && mHprojx != NULL ) mHprojx->Errors(); 1135 1148 } 1136 1149 … … 1140 1153 void Histo2D::SetProjY() 1141 1154 { 1142 if( hprojy != NULL ) DelProjY();1143 hprojy = new Histo(ymin,ymax,ny);1144 if( err2 != NULL && hprojy != NULL ) hprojy->Errors();1155 if( mHprojy != NULL ) DelProjY(); 1156 mHprojy = new Histo(mYmin,mYmax,mNy); 1157 if( mErr2 != NULL && mHprojy != NULL ) mHprojy->Errors(); 1145 1158 } 1146 1159 … … 1159 1172 void Histo2D::ShowProj() 1160 1173 { 1161 if( hprojx != NULL ) cout << ">>>> Projection X set : "<< hprojx <<endl;1174 if( mHprojx != NULL ) cout << ">>>> Projection X set : "<< mHprojx <<endl; 1162 1175 else cout << ">>>> NO Projection X set"<<endl; 1163 if( hprojy != NULL ) cout << ">>>> Projection Y set : "<< hprojy <<endl;1176 if( mHprojy != NULL ) cout << ">>>> Projection Y set : "<< mHprojy <<endl; 1164 1177 else cout << ">>>> NO Projection Y set"<<endl; 1165 1178 } … … 1170 1183 void Histo2D::DelProjX() 1171 1184 { 1172 if( hprojx == NULL ) return;1173 delete hprojx;1174 hprojx = NULL;1185 if( mHprojx == NULL ) return; 1186 delete mHprojx; 1187 mHprojx = NULL; 1175 1188 } 1176 1189 … … 1180 1193 void Histo2D::DelProjY() 1181 1194 { 1182 if( hprojy == NULL ) return;1183 delete hprojy;1184 hprojy = NULL;1195 if( mHprojy == NULL ) return; 1196 delete mHprojy; 1197 mHprojy = NULL; 1185 1198 } 1186 1199 … … 1199 1212 void Histo2D::ZeroProjX() 1200 1213 { 1201 if( hprojx == NULL ) return;1202 hprojx->Zero();1214 if( mHprojx == NULL ) return; 1215 mHprojx->Zero(); 1203 1216 } 1204 1217 … … 1208 1221 void Histo2D::ZeroProjY() 1209 1222 { 1210 if( hprojy == NULL ) return;1211 hprojy->Zero();1223 if( mHprojy == NULL ) return; 1224 mHprojy->Zero(); 1212 1225 } 1213 1226 … … 1227 1240 Pour creer une bande en X entre ybmin et ybmax. 1228 1241 */ 1229 int Histo2D::SetBandX(float ybmin,floatybmax)1230 { 1231 b_s.num = lbandx.size();1232 b_s.min = ybmin;1233 b_s.max = ybmax;1234 b_s.H = new Histo(xmin,xmax,nx);1235 lbandx.push_back(b_s);1236 b_s.H = NULL;1237 return lbandx.size()-1;1242 int_4 Histo2D::SetBandX(r_8 ybmin,r_8 ybmax) 1243 { 1244 mB_s.num = mLBandx.size(); 1245 mB_s.min = ybmin; 1246 mB_s.max = ybmax; 1247 mB_s.H = new Histo(mXmin,mXmax,mNx); 1248 mLBandx.push_back(mB_s); 1249 mB_s.H = NULL; 1250 return mLBandx.size()-1; 1238 1251 } 1239 1252 … … 1241 1254 Pour creer une bande en Y entre xbmin et xbmax. 1242 1255 */ 1243 int Histo2D::SetBandY(float xbmin,floatxbmax)1244 { 1245 b_s.num = lbandy.size();1246 b_s.min = xbmin;1247 b_s.max = xbmax;1248 b_s.H = new Histo(ymin,ymax,ny);1249 lbandy.push_back(b_s);1250 b_s.H = NULL;1251 return lbandy.size()-1;1256 int_4 Histo2D::SetBandY(r_8 xbmin,r_8 xbmax) 1257 { 1258 mB_s.num = mLBandy.size(); 1259 mB_s.min = xbmin; 1260 mB_s.max = xbmax; 1261 mB_s.H = new Histo(mYmin,mYmax,mNy); 1262 mLBandy.push_back(mB_s); 1263 mB_s.H = NULL; 1264 return mLBandy.size()-1; 1252 1265 } 1253 1266 … … 1257 1270 void Histo2D::DelBandX() 1258 1271 { 1259 if( lbandx.size() <= 0 ) return;1260 for(list<bande_slice>::iterator i = lbandx.begin(); i != lbandx.end(); i++)1272 if( mLBandx.size() <= 0 ) return; 1273 for(list<bande_slice>::iterator i = mLBandx.begin(); i != mLBandx.end(); i++) 1261 1274 if( (*i).H != NULL ) {delete (*i).H; (*i).H=NULL;} 1262 lbandx.erase(lbandx.begin(),lbandx.end());1275 mLBandx.erase(mLBandx.begin(),mLBandx.end()); 1263 1276 } 1264 1277 … … 1268 1281 void Histo2D::DelBandY() 1269 1282 { 1270 if( lbandy.size() <= 0 ) return;1271 for(list<bande_slice>::iterator i = lbandy.begin(); i != lbandy.end(); i++)1283 if( mLBandy.size() <= 0 ) return; 1284 for(list<bande_slice>::iterator i = mLBandy.begin(); i != mLBandy.end(); i++) 1272 1285 if( (*i).H != NULL ) {delete (*i).H; (*i).H=NULL;} 1273 lbandy.erase(lbandy.begin(),lbandy.end());1286 mLBandy.erase(mLBandy.begin(),mLBandy.end()); 1274 1287 } 1275 1288 … … 1279 1292 void Histo2D::ZeroBandX() 1280 1293 { 1281 if( lbandx.size() <= 0 ) return;1294 if( mLBandx.size() <= 0 ) return; 1282 1295 list<bande_slice>::iterator i; 1283 for(i = lbandx.begin(); i != lbandx.end(); i++)1296 for(i = mLBandx.begin(); i != mLBandx.end(); i++) 1284 1297 (*i).H->Zero(); 1285 1298 } … … 1290 1303 void Histo2D::ZeroBandY() 1291 1304 { 1292 if( lbandy.size() <= 0 ) return;1305 if( mLBandy.size() <= 0 ) return; 1293 1306 list<bande_slice>::iterator i; 1294 for(i = lbandy.begin(); i != lbandy.end(); i++)1307 for(i = mLBandy.begin(); i != mLBandy.end(); i++) 1295 1308 (*i).H->Zero(); 1296 1309 } … … 1299 1312 Retourne un pointeur sur la bande numero `n' selon X. 1300 1313 */ 1301 Histo* Histo2D::HBandX(int n) const1302 { 1303 if( lbandx.size() <= 0 || n < 0 || n >= (int) lbandx.size() ) return NULL;1304 for(list<bande_slice>::const_iterator i = lbandx.begin(); i != lbandx.end(); i++)1314 Histo* Histo2D::HBandX(int_4 n) const 1315 { 1316 if( mLBandx.size() <= 0 || n < 0 || n >= (int_4) mLBandx.size() ) return NULL; 1317 for(list<bande_slice>::const_iterator i = mLBandx.begin(); i != mLBandx.end(); i++) 1305 1318 if( (*i).num == n ) return (*i).H; 1306 1319 return NULL; … … 1310 1323 Retourne un pointeur sur la bande numero `n' selon Y. 1311 1324 */ 1312 Histo* Histo2D::HBandY(int n) const1313 { 1314 if( lbandy.size() <= 0 || n < 0 || n >= (int) lbandy.size() ) return NULL;1315 for(list<bande_slice>::const_iterator i = lbandy.begin(); i != lbandy.end(); i++)1325 Histo* Histo2D::HBandY(int_4 n) const 1326 { 1327 if( mLBandy.size() <= 0 || n < 0 || n >= (int_4) mLBandy.size() ) return NULL; 1328 for(list<bande_slice>::const_iterator i = mLBandy.begin(); i != mLBandy.end(); i++) 1316 1329 if( (*i).num == n ) return (*i).H; 1317 1330 return NULL; … … 1321 1334 Retourne les limites de la bande numero `n' selon X. 1322 1335 */ 1323 void Histo2D::GetBandX(int n,float& ybmin,float& ybmax) const1336 void Histo2D::GetBandX(int_4 n,r_8& ybmin,r_8& ybmax) const 1324 1337 { 1325 1338 ybmin = 0.; ybmax = 0.; 1326 if( lbandx.size() <= 0 || n < 0 || n >= (int) lbandx.size() ) return;1327 for(list<bande_slice>::const_iterator i = lbandx.begin(); i != lbandx.end(); i++)1339 if( mLBandx.size() <= 0 || n < 0 || n >= (int_4) mLBandx.size() ) return; 1340 for(list<bande_slice>::const_iterator i = mLBandx.begin(); i != mLBandx.end(); i++) 1328 1341 if( (*i).num == n ) { ybmin = (*i).min; ybmax = (*i).max; return;} 1329 1342 return; … … 1333 1346 Retourne les limites de la bande numero `n' selon Y. 1334 1347 */ 1335 void Histo2D::GetBandY(int n,float& xbmin,float& xbmax) const1348 void Histo2D::GetBandY(int_4 n,r_8& xbmin,r_8& xbmax) const 1336 1349 { 1337 1350 xbmin = 0.; xbmax = 0.; 1338 if( lbandy.size() <= 0 || n < 0 || n >= (int) lbandy.size() ) return;1339 for(list<bande_slice>::const_iterator i = lbandy.begin(); i != lbandy.end(); i++)1351 if( mLBandy.size() <= 0 || n < 0 || n >= (int_4) mLBandy.size() ) return; 1352 for(list<bande_slice>::const_iterator i = mLBandy.begin(); i != mLBandy.end(); i++) 1340 1353 if( (*i).num == n ) { xbmin = (*i).min; xbmax = (*i).max; return;} 1341 1354 return; … … 1345 1358 Informations sur les bandes. 1346 1359 */ 1347 void Histo2D::ShowBand(int lp)1348 { 1349 cout << ">>>> Nombre de bande X : " << lbandx.size() << endl;1350 if( lp>0 && lbandx.size()>0 ) {1360 void Histo2D::ShowBand(int_4 lp) 1361 { 1362 cout << ">>>> Nombre de bande X : " << mLBandx.size() << endl; 1363 if( lp>0 && mLBandx.size()>0 ) { 1351 1364 list<bande_slice>::iterator i; 1352 for(i = lbandx.begin(); i != lbandx.end(); i++) {1365 for(i = mLBandx.begin(); i != mLBandx.end(); i++) { 1353 1366 cout<<" "<<(*i).num<<" de ymin="<<(*i).min<<" a ymax="<<(*i).max; 1354 1367 if(lp>1) cout << " H=" << (*i).H; … … 1357 1370 } 1358 1371 1359 cout << ">>>> Nombre de bande Y : " << lbandy.size() << endl;1360 if( lp>0 && lbandy.size()>0 ) {1372 cout << ">>>> Nombre de bande Y : " << mLBandy.size() << endl; 1373 if( lp>0 && mLBandy.size()>0 ) { 1361 1374 list<bande_slice>::iterator i; 1362 for(i = lbandy.begin(); i != lbandy.end(); i++) {1375 for(i = mLBandy.begin(); i != mLBandy.end(); i++) { 1363 1376 cout<<" "<<(*i).num<<" de xmin="<<(*i).min<<" a xmax="<<(*i).max; 1364 1377 if(lp>1) cout << " H=" << (*i).H; … … 1374 1387 Pour creer `nsli' bandes equidistantes selon X. 1375 1388 */ 1376 int Histo2D::SetSliX(intnsli)1389 int_4 Histo2D::SetSliX(int_4 nsli) 1377 1390 { 1378 1391 if( nsli <= 0 ) return -1; 1379 if( nsli > ny ) nsli = ny;1380 if( lslix.size() > 0 ) DelSliX();1381 float w = (ymax-ymin)/nsli;1382 1383 for(int i=0; i<nsli; i++ ) {1384 b_s.num = i;1385 b_s.min = ymin + i*w;1386 b_s.max = b_s.min + w;1387 b_s.H = new Histo(xmin,xmax,nx);1388 lslix.push_back(b_s);1389 b_s.H = NULL;1390 } 1391 return (int ) lslix.size();1392 if( nsli > mNy ) nsli = mNy; 1393 if( mLSlix.size() > 0 ) DelSliX(); 1394 r_8 w = (mYmax-mYmin)/nsli; 1395 1396 for(int_4 i=0; i<nsli; i++ ) { 1397 mB_s.num = i; 1398 mB_s.min = mYmin + i*w; 1399 mB_s.max = mB_s.min + w; 1400 mB_s.H = new Histo(mXmin,mXmax,mNx); 1401 mLSlix.push_back(mB_s); 1402 mB_s.H = NULL; 1403 } 1404 return (int_4) mLSlix.size(); 1392 1405 } 1393 1406 … … 1395 1408 Pour creer `nsli' bandes equidistantes selon Y. 1396 1409 */ 1397 int Histo2D::SetSliY(intnsli)1410 int_4 Histo2D::SetSliY(int_4 nsli) 1398 1411 { 1399 1412 if( nsli <= 0 ) return -1; 1400 if( nsli > nx ) nsli = nx;1401 if( lsliy.size() > 0 ) DelSliY();1402 float w = (xmax-xmin)/nsli;1403 1404 for(int i=0; i<nsli; i++ ) {1405 b_s.num = i;1406 b_s.min = xmin + i*w;1407 b_s.max = b_s.min + w;1408 b_s.H = new Histo(ymin,ymax,ny);1409 lsliy.push_back(b_s);1410 b_s.H = NULL;1411 } 1412 return (int ) lsliy.size();1413 if( nsli > mNx ) nsli = mNx; 1414 if( mLSliy.size() > 0 ) DelSliY(); 1415 r_8 w = (mXmax-mXmin)/nsli; 1416 1417 for(int_4 i=0; i<nsli; i++ ) { 1418 mB_s.num = i; 1419 mB_s.min = mXmin + i*w; 1420 mB_s.max = mB_s.min + w; 1421 mB_s.H = new Histo(mYmin,mYmax,mNy); 1422 mLSliy.push_back(mB_s); 1423 mB_s.H = NULL; 1424 } 1425 return (int_4) mLSliy.size(); 1413 1426 } 1414 1427 … … 1418 1431 void Histo2D::DelSliX() 1419 1432 { 1420 if( lslix.size() <= 0 ) return;1421 for(list<bande_slice>::iterator i = lslix.begin(); i != lslix.end(); i++)1433 if( mLSlix.size() <= 0 ) return; 1434 for(list<bande_slice>::iterator i = mLSlix.begin(); i != mLSlix.end(); i++) 1422 1435 if( (*i).H != NULL ) {delete (*i).H; (*i).H=NULL;} 1423 lslix.erase(lslix.begin(),lslix.end());1436 mLSlix.erase(mLSlix.begin(),mLSlix.end()); 1424 1437 } 1425 1438 … … 1429 1442 void Histo2D::DelSliY() 1430 1443 { 1431 if( lsliy.size() <= 0 ) return;1432 for(list<bande_slice>::iterator i = lsliy.begin(); i != lsliy.end(); i++)1444 if( mLSliy.size() <= 0 ) return; 1445 for(list<bande_slice>::iterator i = mLSliy.begin(); i != mLSliy.end(); i++) 1433 1446 if( (*i).H != NULL ) {delete (*i).H; (*i).H=NULL;} 1434 lsliy.erase(lsliy.begin(),lsliy.end());1447 mLSliy.erase(mLSliy.begin(),mLSliy.end()); 1435 1448 } 1436 1449 … … 1440 1453 void Histo2D::ZeroSliX() 1441 1454 { 1442 if( lslix.size() <= 0 ) return;1455 if( mLSlix.size() <= 0 ) return; 1443 1456 list<bande_slice>::iterator i; 1444 for(i = lslix.begin(); i != lslix.end(); i++)1457 for(i = mLSlix.begin(); i != mLSlix.end(); i++) 1445 1458 (*i).H->Zero(); 1446 1459 } … … 1451 1464 void Histo2D::ZeroSliY() 1452 1465 { 1453 if( lsliy.size() <= 0 ) return;1466 if( mLSliy.size() <= 0 ) return; 1454 1467 list<bande_slice>::iterator i; 1455 for(i = lsliy.begin(); i != lsliy.end(); i++)1468 for(i = mLSliy.begin(); i != mLSliy.end(); i++) 1456 1469 (*i).H->Zero(); 1457 1470 } … … 1461 1474 selon X. 1462 1475 */ 1463 Histo* Histo2D::HSliX(int n) const1464 { 1465 if( lslix.size() <= 0 || n < 0 || n >= (int) lslix.size() ) return NULL;1466 for(list<bande_slice>::const_iterator i = lslix.begin(); i != lslix.end(); i++)1476 Histo* Histo2D::HSliX(int_4 n) const 1477 { 1478 if( mLSlix.size() <= 0 || n < 0 || n >= (int_4) mLSlix.size() ) return NULL; 1479 for(list<bande_slice>::const_iterator i = mLSlix.begin(); i != mLSlix.end(); i++) 1467 1480 if( (*i).num == n ) return (*i).H; 1468 1481 return NULL; … … 1473 1486 selon Y. 1474 1487 */ 1475 Histo* Histo2D::HSliY(int n) const1476 { 1477 if( lsliy.size() <= 0 || n < 0 || n >= (int) lsliy.size() ) return NULL;1478 for(list<bande_slice>::const_iterator i = lsliy.begin(); i != lsliy.end(); i++)1488 Histo* Histo2D::HSliY(int_4 n) const 1489 { 1490 if( mLSliy.size() <= 0 || n < 0 || n >= (int_4) mLSliy.size() ) return NULL; 1491 for(list<bande_slice>::const_iterator i = mLSliy.begin(); i != mLSliy.end(); i++) 1479 1492 if( (*i).num == n ) return (*i).H; 1480 1493 return NULL; … … 1484 1497 Informations sur les bandes equidistantes. 1485 1498 */ 1486 void Histo2D::ShowSli(int lp)1499 void Histo2D::ShowSli(int_4 lp) 1487 1500 { 1488 1501 list<bande_slice>::iterator i; 1489 cout << ">>>> Nombre de slice X : " << lslix.size() << endl;1490 if( lp>0 && lslix.size() > 0 )1491 for(i = lslix.begin(); i != lslix.end(); i++) {1502 cout << ">>>> Nombre de slice X : " << mLSlix.size() << endl; 1503 if( lp>0 && mLSlix.size() > 0 ) 1504 for(i = mLSlix.begin(); i != mLSlix.end(); i++) { 1492 1505 cout<<" "<<(*i).num<<" de ymin="<<(*i).min<<" a ymax="<<(*i).max; 1493 1506 if(lp>1) cout << " H=" << (*i).H; … … 1495 1508 } 1496 1509 1497 cout << ">>>> Nombre de slice Y : " << lsliy.size() << endl;1498 if( lp>0 && lsliy.size()>0 )1499 for(i = lsliy.begin(); i != lsliy.end(); i++) {1510 cout << ">>>> Nombre de slice Y : " << mLSliy.size() << endl; 1511 if( lp>0 && mLSliy.size()>0 ) 1512 for(i = mLSliy.begin(); i != mLSliy.end(); i++) { 1500 1513 cout<<" "<<(*i).num<<" de xmin="<<(*i).min<<" a xmax="<<(*i).max; 1501 1514 if(lp>1) cout << " H=" << (*i).H; … … 1518 1531 else dobj->Delete(); 1519 1532 1520 floatmin,max;1533 r_8 min,max; 1521 1534 int_4 errok, projx, projy, nslix, nsliy, nbanx, nbany; 1522 1535 … … 1530 1543 1531 1544 // Lecture variables de definitions 1532 is.Get(dobj-> nx);1533 is.Get(dobj-> ny);1534 is.Get(dobj-> nxy);1545 is.Get(dobj->mNx); 1546 is.Get(dobj->mNy); 1547 is.Get(dobj->mNxy); 1535 1548 is.Get(errok); 1536 1549 is.Get(dobj->nEntries); 1537 1550 is.Get(dobj->nHist); 1538 1551 1539 is.Get(dobj-> xmin);1540 is.Get(dobj-> xmax);1541 is.Get(dobj-> ymin);1542 is.Get(dobj-> ymax);1543 is.Get(dobj-> wbinx);1544 is.Get(dobj-> wbiny);1545 1546 is.Get(&(dobj-> over[0][0]),9);1552 is.Get(dobj->mXmin); 1553 is.Get(dobj->mXmax); 1554 is.Get(dobj->mYmin); 1555 is.Get(dobj->mYmax); 1556 is.Get(dobj->mWBinx); 1557 is.Get(dobj->mWBiny); 1558 1559 is.Get(&(dobj->mOver[0][0]),9); 1547 1560 1548 1561 is.Get(projx); … … 1554 1567 1555 1568 // Lecture histo2D 1556 dobj-> data = new float[dobj->nxy];1569 dobj->mData = new r_8[dobj->mNxy]; 1557 1570 is.GetLine(strg, 255); 1558 {for(int j=0;j<dobj->ny;j++) is.Get(dobj->data+j*dobj->nx,dobj->nx);}1571 {for(int_4 j=0;j<dobj->mNy;j++) is.Get(dobj->mData+j*dobj->mNx,dobj->mNx);} 1559 1572 1560 1573 // Lecture erreurs 1561 1574 if(errok) { 1562 1575 is.GetLine(strg, 255); 1563 dobj-> err2 = new double[dobj->nxy];1564 for(int j=0;j<dobj->ny;j++) is.Get(dobj->err2+j*dobj->nx,dobj->nx);1576 dobj->mErr2 = new r_8[dobj->mNxy]; 1577 for(int_4 j=0;j<dobj->mNy;j++) is.Get(dobj->mErr2+j*dobj->mNx,dobj->mNx); 1565 1578 } 1566 1579 … … 1569 1582 is.GetLine(strg, 255); 1570 1583 dobj->SetProjX(); 1571 ObjFileIO<Histo> fio_h(dobj-> hprojx);1584 ObjFileIO<Histo> fio_h(dobj->mHprojx); 1572 1585 fio_h.Read(is); 1573 1586 } … … 1575 1588 is.GetLine(strg, 255); 1576 1589 dobj->SetProjY(); 1577 ObjFileIO<Histo> fio_h(dobj-> hprojy);1590 ObjFileIO<Histo> fio_h(dobj->mHprojy); 1578 1591 fio_h.Read(is); 1579 1592 } … … 1584 1597 dobj->SetSliX(nslix); 1585 1598 ASSERT (nslix==dobj->NSliX()); 1586 for(int j=0;j<dobj->NSliX();j++)1599 for(int_4 j=0;j<dobj->NSliX();j++) 1587 1600 {ObjFileIO<Histo> fio_h(dobj->HSliX(j)); fio_h.Read(is);} 1588 1601 } … … 1591 1604 dobj->SetSliY(nsliy); 1592 1605 ASSERT (nsliy==dobj->NSliY()); 1593 for(int j=0;j<dobj->NSliY();j++)1606 for(int_4 j=0;j<dobj->NSliY();j++) 1594 1607 {ObjFileIO<Histo> fio_h(dobj->HSliY(j)); fio_h.Read(is);} 1595 1608 } … … 1598 1611 if( nbanx>0 ) { 1599 1612 is.GetLine(strg, 255); 1600 {for(int j=0; j<nbanx; j++) {1613 {for(int_4 j=0; j<nbanx; j++) { 1601 1614 is.Get(min); is.Get(max); 1602 1615 dobj->SetBandX(min,max); 1603 1616 }} 1604 1617 ASSERT (nbanx==dobj->NBandX()); 1605 {for(int j=0; j<dobj->NBandX(); j++) {1618 {for(int_4 j=0; j<dobj->NBandX(); j++) { 1606 1619 ObjFileIO<Histo> fio_h(dobj->HBandX(j)); 1607 1620 fio_h.Read(is); … … 1610 1623 if( nbany>0 ) { 1611 1624 is.GetLine(strg, 255); 1612 {for(int j=0; j<nbany; j++) {1625 {for(int_4 j=0; j<nbany; j++) { 1613 1626 is.Get(min); is.Get(max); 1614 1627 dobj->SetBandY(min,max); 1615 1628 }} 1616 1629 ASSERT (nbany==dobj->NBandY()); 1617 {for(int j=0; j<dobj->NBandY(); j++) {1630 {for(int_4 j=0; j<dobj->NBandY(); j++) { 1618 1631 ObjFileIO<Histo> fio_h(dobj->HBandY(j)); 1619 1632 fio_h.Read(is); … … 1630 1643 1631 1644 // Que faut-il ecrire? 1632 int_4 errok = (dobj-> err2) ? 1 : 0;1633 int_4 projx = (dobj-> hprojx) ? 1 : 0;1634 int_4 projy = (dobj-> hprojy) ? 1 : 0;1645 int_4 errok = (dobj->mErr2) ? 1 : 0; 1646 int_4 projx = (dobj->mHprojx) ? 1 : 0; 1647 int_4 projy = (dobj->mHprojy) ? 1 : 0; 1635 1648 int_4 nslix = dobj->NSliX(); 1636 1649 int_4 nsliy = dobj->NSliY(); … … 1640 1653 // Ecriture entete pour identifier facilement 1641 1654 sprintf(strg,"nx=%d ny=%d nxy=%d errok=%1d" 1642 ,dobj-> nx,dobj->ny,dobj->nxy,errok);1655 ,dobj->mNx,dobj->mNy,dobj->mNxy,errok); 1643 1656 os.PutLine(strg); 1644 1657 sprintf(strg,"nHist=%g nEntries=%d",dobj->nHist,dobj->nEntries); 1645 1658 os.PutLine(strg); 1646 sprintf(strg,"wbinx=%g wbiny=%g",dobj-> wbinx,dobj->wbiny);1659 sprintf(strg,"wbinx=%g wbiny=%g",dobj->mWBinx,dobj->mWBiny); 1647 1660 os.PutLine(strg); 1648 1661 sprintf(strg,"xmin=%g xmax=%g ymin=%g ymax=%g" 1649 ,dobj-> xmin,dobj->xmax,dobj->ymin,dobj->ymax);1662 ,dobj->mXmin,dobj->mXmax,dobj->mYmin,dobj->mYmax); 1650 1663 os.PutLine(strg); 1651 1664 sprintf(strg,"projx/y=%d %d nbandx/y=%d %d nbslix/y=%d %d" 1652 1665 ,projx,projy,nbanx,nbany,nslix,nsliy); 1653 1666 os.PutLine(strg); 1654 sprintf(strg," over %g %g %g %g %g %g %g %g %g"1655 ,dobj-> over[0][0],dobj->over[0][1],dobj->over[0][2]1656 ,dobj-> over[1][0],dobj->over[1][1],dobj->over[1][2]1657 ,dobj-> over[2][0],dobj->over[2][1],dobj->over[2][2]);1667 sprintf(strg,"mOver %g %g %g %g %g %g %g %g %g" 1668 ,dobj->mOver[0][0],dobj->mOver[0][1],dobj->mOver[0][2] 1669 ,dobj->mOver[1][0],dobj->mOver[1][1],dobj->mOver[1][2] 1670 ,dobj->mOver[2][0],dobj->mOver[2][1],dobj->mOver[2][2]); 1658 1671 os.PutLine(strg); 1659 1672 1660 1673 // Ecriture variables de definitions 1661 os.Put(dobj-> nx);1662 os.Put(dobj-> ny);1663 os.Put(dobj-> nxy);1674 os.Put(dobj->mNx); 1675 os.Put(dobj->mNy); 1676 os.Put(dobj->mNxy); 1664 1677 os.Put(errok); 1665 1678 os.Put(dobj->nEntries); 1666 1679 os.Put(dobj->nHist); 1667 1680 1668 os.Put(dobj-> xmin);1669 os.Put(dobj-> xmax);1670 os.Put(dobj-> ymin);1671 os.Put(dobj-> ymax);1672 os.Put(dobj-> wbinx);1673 os.Put(dobj-> wbiny);1674 1675 os.Put(&(dobj-> over[0][0]),9);1681 os.Put(dobj->mXmin); 1682 os.Put(dobj->mXmax); 1683 os.Put(dobj->mYmin); 1684 os.Put(dobj->mYmax); 1685 os.Put(dobj->mWBinx); 1686 os.Put(dobj->mWBiny); 1687 1688 os.Put(&(dobj->mOver[0][0]),9); 1676 1689 1677 1690 os.Put(projx); … … 1684 1697 // Ecriture histo2D 1685 1698 sprintf(strg,"Histo2D: Tableau des donnees %d = %d * %d" 1686 ,dobj-> nxy,dobj->nx,dobj->ny);1699 ,dobj->mNxy,dobj->mNx,dobj->mNy); 1687 1700 os.PutLine(strg); 1688 {for(int j=0;j<dobj->ny;j++) os.Put(dobj->data+j*dobj->nx,dobj->nx);}1701 {for(int_4 j=0;j<dobj->mNy;j++) os.Put(dobj->mData+j*dobj->mNx,dobj->mNx);} 1689 1702 1690 1703 // Ecriture erreurs 1691 1704 if(errok) { 1692 1705 sprintf(strg,"Histo2D: Tableau des erreurs %d = %d * %d" 1693 ,dobj-> nxy,dobj->nx,dobj->ny);1706 ,dobj->mNxy,dobj->mNx,dobj->mNy); 1694 1707 os.PutLine(strg); 1695 for(int j=0;j<dobj->ny;j++) os.Put(dobj->err2+j*dobj->nx,dobj->nx);1708 for(int_4 j=0;j<dobj->mNy;j++) os.Put(dobj->mErr2+j*dobj->mNx,dobj->mNx); 1696 1709 } 1697 1710 … … 1700 1713 sprintf(strg,"Histo2D: Projection X"); 1701 1714 os.PutLine(strg); 1702 ObjFileIO<Histo> fio_h(dobj-> hprojx); fio_h.Write(os);1715 ObjFileIO<Histo> fio_h(dobj->mHprojx); fio_h.Write(os); 1703 1716 } 1704 1717 if(projy) { 1705 1718 sprintf(strg,"Histo2D: Projection Y"); 1706 1719 os.PutLine(strg); 1707 ObjFileIO<Histo> fio_h(dobj-> hprojy); fio_h.Write(os);1720 ObjFileIO<Histo> fio_h(dobj->mHprojy); fio_h.Write(os); 1708 1721 } 1709 1722 … … 1712 1725 sprintf(strg,"Histo2D: Slices X %d",nslix); 1713 1726 os.PutLine(strg); 1714 for(int j=0;j<nslix;j++) {1727 for(int_4 j=0;j<nslix;j++) { 1715 1728 Histo* h = dobj->HSliX(j); 1716 1729 ObjFileIO<Histo> fio_h(h); fio_h.Write(os); … … 1720 1733 sprintf(strg,"Histo2D: Slices Y %d",nsliy); 1721 1734 os.PutLine(strg); 1722 for(int j=0;j<nsliy;j++) {1735 for(int_4 j=0;j<nsliy;j++) { 1723 1736 Histo* h = dobj->HSliY(j); 1724 1737 ObjFileIO<Histo> fio_h(h); fio_h.Write(os); … … 1731 1744 os.PutLine(strg); 1732 1745 list<Histo2D::bande_slice>::const_iterator it; 1733 for(it = dobj-> lbandx.begin(); it != dobj->lbandx.end(); it++) {1734 float min = (*it).min; floatmax = (*it).max;1746 for(it = dobj->mLBandx.begin(); it != dobj->mLBandx.end(); it++) { 1747 r_8 min = (*it).min; r_8 max = (*it).max; 1735 1748 os.Put(min); os.Put(max); 1736 1749 } 1737 for(it = dobj-> lbandx.begin(); it != dobj->lbandx.end(); it++) {1750 for(it = dobj->mLBandx.begin(); it != dobj->mLBandx.end(); it++) { 1738 1751 Histo* h = (*it).H; 1739 1752 ObjFileIO<Histo> fio_h(h); fio_h.Write(os); … … 1744 1757 os.PutLine(strg); 1745 1758 list<Histo2D::bande_slice>::const_iterator it; 1746 for(it = dobj-> lbandy.begin(); it != dobj->lbandy.end(); it++) {1747 float min = (*it).min; floatmax = (*it).max;1759 for(it = dobj->mLBandy.begin(); it != dobj->mLBandy.end(); it++) { 1760 r_8 min = (*it).min; r_8 max = (*it).max; 1748 1761 os.Put(min); os.Put(max); 1749 1762 } 1750 for(it = dobj-> lbandy.begin(); it != dobj->lbandy.end(); it++) {1763 for(it = dobj->mLBandy.begin(); it != dobj->mLBandy.end(); it++) { 1751 1764 Histo* h = (*it).H; 1752 1765 ObjFileIO<Histo> fio_h(h); fio_h.Write(os);
Note:
See TracChangeset
for help on using the changeset viewer.