Changeset 3149 in Sophya for trunk/SophyaPI/PIext/pihisto2d.cc
- Timestamp:
- Jan 18, 2007, 7:21:49 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pihisto2d.cc
r3145 r3149 51 51 mRetFg = 0; 52 52 } 53 else if(opts.substr(0, 8) == "hbinerr") {53 else if(opts.substr(0,7) == "hbinerr") { 54 54 mRetFg = 1; 55 55 } 56 else if(opts.substr(0, 8) == "hbinent") {56 else if(opts.substr(0,7) == "hbinent") { 57 57 mRetFg = 2; 58 58 } … … 157 157 158 158 //++ 159 void PIHisto2D::UseScale(unsigned short type, floatlogscale)159 void PIHisto2D::UseScale(unsigned short type,double logscale) 160 160 // 161 161 // Pour changer les echelles (lineaire ou logarithmique) … … 184 184 185 185 //++ 186 void PIHisto2D::UseDisplay(unsigned short type, floatfnpt)186 void PIHisto2D::UseDisplay(unsigned short type,double fnpt) 187 187 // 188 188 // Type de Display … … 212 212 213 213 //++ 214 void PIHisto2D::UseDyn( float fmin,floatfmax)214 void PIHisto2D::UseDyn(double fmin,double fmax) 215 215 // 216 216 // Gestion de la dynamique a representer: … … 224 224 //-- 225 225 { 226 if( (mHistoWp) && (mHistoWp->NBinX()>0) && (mHistoWp->NBinY()>0) && (fmin>=fmax) ) { 227 double v,hmin,hmax; 228 hmin = hmax = (*mHistoWp)(0,0); 229 for (int_4 i=0; i<mHistoWp->NBinX(); i++) 230 for (int_4 j=0; j<mHistoWp->NBinY(); j++) { 231 v = (*mHistoWp)(i, j); 232 if(v<hmin) hmin = v; 233 if(v>hmax) hmax = v; 234 } 235 fmin = hmin; fmax = hmax; // $CHECK$ CMV : attention, double vers float !! 236 } 237 238 // $CHECK$ CMV : Ne faut-il pas passer les attributs de la classe en double ?? 226 if( (mHistoWp) && (mHistoWp->NBinX()>0) && (mHistoWp->NBinY()>0) && (fmin>=fmax) ) { 227 double v,hmin,hmax; 228 hmin = hmax = (*mHistoWp)(0,0); 229 for (int_4 i=0; i<mHistoWp->NBinX(); i++) 230 for (int_4 j=0; j<mHistoWp->NBinY(); j++) { 231 v = (*mHistoWp)(i, j); 232 if(v<hmin) hmin = v; 233 if(v>hmax) hmax = v; 234 } 235 fmin = hmin; fmax = hmax; 236 } 237 239 238 if(fmin>=fmax) fmax = fmin+1.; 240 239 mHMin = fmin; mHMax = fmax; … … 242 241 243 242 //++ 244 void PIHisto2D::UseFrac( float frmin,floatfrmax)243 void PIHisto2D::UseFrac(double frmin,double frmax) 245 244 // 246 245 // Pour definir la fraction de la dynamique a dessiner: … … 274 273 printf(" Dyn=%g,%g Frac=%g,%g LogSc=%g H=%p\n" 275 274 ,mHMin,mHMax,mFracMin,mFracMax,mLogScale,mHistoWp); 276 // if(lp>=1) mHistoWp->PrintStatus(); $CHECK$ CMV : que faut-il faire ?277 275 fflush(stdout); 278 276 } … … 352 350 353 351 // Gamme a representer entre [0,1] mais >=fracmin et scale fracmax 354 floatfracmin=FMin(), fracmax=FMax();355 float llscale = (float) log10((double)LogScale());352 double fracmin=FMin(), fracmax=FMax(); 353 double llscale = log10(LogScale()); 356 354 357 355 // gestion Couleurs. … … 377 375 if(mTypDisp==1) { 378 376 g->SelMarker(1,PI_DotMarker); 379 npt = (int) ((float)NPixBin(g)*FPoints()); if(npt<=0) npt = 2;377 npt = (int)(NPixBin(g)*FPoints()); if(npt<=0) npt = 2; 380 378 } 381 379 … … 400 398 401 399 // Gestion de la dynamique a dessiner 402 floatfrac = ((*mHistoWp)(i,j)-HMin())/(HMax()-HMin());400 double frac = ((*mHistoWp)(i,j)-HMin())/(HMax()-HMin()); 403 401 if(frac<0.) continue; 404 402 if(mTypScal==1) { // echelle log10 … … 408 406 if(frac<=fracmin) continue; 409 407 if(frac>1.) frac = 1.; 410 floatfracred = frac * fracmax;408 double fracred = frac * fracmax; 411 409 412 410 // Gestion de la couleur 413 411 int icol = 0; 414 412 if (cmap) { 415 icol = int( (float) ncol*frac);413 icol = int(ncol*frac); 416 414 if(icol>=ncol) icol = ncol-1; else if(icol<0) icol=0; 417 415 g->SelForeground(*cmap,icol); … … 431 429 } else if(mTypDisp==1) { 432 430 //..... nuage de points ..... 433 int ipt = int( (float) npt *frac);431 int ipt = int(npt *frac); 434 432 for(int k=0;k<ipt;k++) { 435 433 double x = left0 + frand01()*dx; … … 559 557 560 558 //++ 561 char PIHisto2D::HPrint2( floatf)559 char PIHisto2D::HPrint2(double f) 562 560 // 563 561 // Codage des valeurs en caracteres (fct privee). … … 638 636 SetStats(false); 639 637 } else if(opts.substr(0,11) == "statposoff=") { 640 floatxo=0., yo=0.;641 sscanf(opts.substr(11).c_str(),"% g,%g",&xo, &yo);638 double xo=0., yo=0.; 639 sscanf(opts.substr(11).c_str(),"%lf,%lf",&xo, &yo); 642 640 SetStatPosOffset(xo, yo); 643 641 } else if(opts.substr(0,8)=="h2scale=") { 644 unsigned short t=TypScale(); floatls=LogScale();642 unsigned short t=TypScale(); double ls=LogScale(); 645 643 if(opts.substr(8,3)=="lin") t=0; 646 644 else if(opts.substr(8,3)=="log") 647 {t=1; sscanf(opts.c_str(),"h2scale=log,% g",&ls);}645 {t=1; sscanf(opts.c_str(),"h2scale=log,%lf",&ls);} 648 646 UseScale(t,ls); 649 647 } else if(opts.substr(0,7)=="h2disp=") { 650 unsigned short t=TypDisplay(); floatfpts=FPoints();648 unsigned short t=TypDisplay(); double fpts=FPoints(); 651 649 if(opts.substr(7,3)=="var") t=0; 652 650 else if(opts.substr(7,3)=="hbk") t=2; 653 651 else if(opts.substr(7,3)=="img") t=3; 654 652 else if(opts.substr(7,3)=="pts") 655 {t=1; sscanf(opts.c_str(),"h2disp=pts,% g",&fpts);}653 {t=1; sscanf(opts.c_str(),"h2disp=pts,%lf",&fpts);} 656 654 UseDisplay(t,fpts); 657 655 } else if(opts.substr(0,6)=="h2dyn=") { 658 floathmin=HMin(),hmax=HMax(); size_t q = opts.find(',');659 sscanf(opts.c_str(),"h2dyn=% g",&hmin);660 if(q<opts.length()-1) sscanf(opts.substr(q+1).c_str(),"% g",&hmax);656 double hmin=HMin(),hmax=HMax(); size_t q = opts.find(','); 657 sscanf(opts.c_str(),"h2dyn=%lf",&hmin); 658 if(q<opts.length()-1) sscanf(opts.substr(q+1).c_str(),"%lf",&hmax); 661 659 UseDyn(hmin,hmax); 662 660 } else if(opts.substr(0,7)=="h2frac=") { 663 floatfmin=FMin(),fmax=FMax(); size_t q = opts.find(',');664 sscanf(opts.c_str(),"h2frac=% g",&fmin);665 if(q<opts.length()-1) sscanf(opts.substr(q+1).c_str(),"% g",&fmax);661 double fmin=FMin(),fmax=FMax(); size_t q = opts.find(','); 662 sscanf(opts.c_str(),"h2frac=%lf",&fmin); 663 if(q<opts.length()-1) sscanf(opts.substr(q+1).c_str(),"%lf",&fmax); 666 664 UseFrac(fmin,fmax); 667 665 } else { … … 1077 1075 1078 1076 else if(opt==6001) { 1079 sscanf(mText[0]->GetText().c_str(),"% g %g",&mHMin,&mHMax);1080 sscanf(mText[1]->GetText().c_str(),"% g %g",&mFracMin,&mFracMax);1081 sscanf(mText[2]->GetText().c_str(),"% g",&mLogScale);1077 sscanf(mText[0]->GetText().c_str(),"%lf %lf",&mHMin,&mHMax); 1078 sscanf(mText[1]->GetText().c_str(),"%lf %lf",&mFracMin,&mFracMax); 1079 sscanf(mText[2]->GetText().c_str(),"%lf",&mLogScale); 1082 1080 mpih->UseColors(mFgCol,mCmap,mRevCmap); 1083 1081 mpih->UseScale(mTypScal,mLogScale);
Note:
See TracChangeset
for help on using the changeset viewer.