Changeset 2517 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Mar 17, 2004, 7:04:57 PM (22 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r2494 r2517 1176 1176 usage += ">> Axes: axesnone stdaxes=defaxes=boxaxes boxaxesgrid \n"; 1177 1177 usage += " fineaxes fineaxesgrid centeredaxes finecenteredaxes \n"; 1178 usage += " centeredaxesgrid finecenteredaxesgrid \n"; 1178 usage += " centeredaxesgrid finecenteredaxesgrid\n"; 1179 usage += " axescenter=x0,y0 (for default axescenter=)\n"; 1179 1180 usage += " grid nogrid labels nolabels \n"; 1180 1181 usage += " ticks noticks minorticks nominorticks \n"; -
trunk/SophyaPI/PIext/pi2dvec.cc
r2322 r2517 169 169 } 170 170 171 172 173 /* --Methode-- */ 174 double PI2dVecDrawer::GetDistanceToPoint(double x, double y) 175 { 176 if(_nti==NULL) return 1.e+9; 177 if( xK<0 || yK<0 ) return 1.e+9; 178 if( vK<0 || wK<0 ) return 1.e+9; 179 180 double dist = -1.e+18; 181 for(int i=0; i<_nti->NbLines(); i++) { 182 double xp=_nti->GetCell(i,xK); 183 double yp=_nti->GetCell(i,yK); 184 xp = (xp-x)/(XMax()-XMin())/0.5; 185 yp = (yp-y)/(YMax()-YMin())/0.5; 186 xp = xp*xp+yp*yp; 187 if(dist<0. || xp<dist) dist = xp; 188 } 189 dist=sqrt(fabs(dist)); 190 cout<<dist<<"PI2dVecDrawer: xlim="<<XMin()<<","<<XMax()<<" ylim="<<YMin()<<","<<YMax() 191 <<" NbLines="<<_nti->NbLines()<<endl; 192 cout<<"....d="<<dist<<" x="<<x<<" y="<<y<<endl; 193 cout<<"****** NON teste (CMV) ******"<<endl; 194 195 return dist; 196 } -
trunk/SophyaPI/PIext/pi2dvec.h
r2161 r2517 22 22 virtual int SelectVW(const char* px, const char* py); 23 23 24 // Renvoie une distance au point x,y 25 virtual double GetDistanceToPoint(double x, double y); 24 26 25 27 protected: -
trunk/SophyaPI/PIext/pigfd1.cc
r2115 r2517 10 10 SelectX(0); 11 11 SelectErrBar(false,false); 12 NptDraw = 0; 12 13 } 13 14 … … 60 61 if(GetGraphicAtt().GetLineAtt()!=PI_NotDefLineAtt) SelectErrBar(true,true); 61 62 double xp,yp,er; 63 NptDraw = 0; 62 64 for (int i=0; i<mGFD->NData(); i++) { 63 65 xp = mGFD->Absc(VarX,i); 64 66 yp = mGFD->Val(i); 65 67 if(xp<xmin || xp>xmax || yp<ymin || yp>ymax) continue; 68 NptDraw++; 66 69 if(ErrX) { 67 70 er = mGFD->EAbsc(VarX,i); … … 76 79 return; 77 80 } 81 82 /* --Methode-- */ 83 double PIGenFitDat::GetDistanceToPoint(double x, double y) 84 { 85 if(!mGFD) return 1.e+9; 86 if(mGFD->NData()<=0) return 1.e+9; 87 if(VarX<0) return 1.e+9; 88 89 const int nessai = 100; 90 long inc = (NptDraw>nessai) ? (long)(NptDraw/nessai)+1 : 1; 91 92 double dist = -1.e+18; 93 long n = 0; 94 for(long i=0; i<mGFD->NData(); i++) { 95 double xp=mGFD->Absc(VarX,i); 96 if(xp<XMin() || xp>XMax()) continue; 97 double yp=mGFD->Val(i); 98 if(yp<YMin() || yp>YMax()) continue; 99 if(n%inc==0) { 100 xp = (xp-x)/(XMax()-XMin())/0.5; 101 yp = (yp-y)/(YMax()-YMin())/0.5; 102 xp = xp*xp+yp*yp; 103 if(dist<0. || xp<dist) dist = xp; 104 } 105 n++; 106 } 107 dist=sqrt(fabs(dist)); 108 //cout<<"PIGenFitDat: xlim="<<XMin()<<","<<XMax()<<" ylim="<<YMin()<<","<<YMax() 109 // <<" NData="<<mGFD->NData()<<" inc="<<inc<<endl; 110 //cout<<"....d="<<dist<<" x="<<x<<" y="<<y<<" NptDraw="<<NptDraw<<endl; 111 112 return dist; 113 } -
trunk/SophyaPI/PIext/pigfd1.h
r339 r2517 17 17 void SelectX(int varx); 18 18 void SelectErrBar(bool erbx,bool erby); 19 20 // Renvoie une distance au point x,y 21 virtual double GetDistanceToPoint(double x, double y); 19 22 20 23 protected: … … 23 26 int VarX; // numero de variable X ds le GeneralFitData 24 27 bool ErrX,ErrY; // Erreur en X et Y ? 28 long NptDraw; // nombre de points effectivement dessines dans la fenetre 25 29 }; 26 30 -
trunk/SophyaPI/PIext/pigfd2.h
r339 r2517 17 17 void SelectXY(int varx,int vary); 18 18 void SelectErrBar(bool erbx,bool erby,bool erbz); 19 20 19 21 20 protected: -
trunk/SophyaPI/PIext/pihisto.cc
r2469 r2517 3 3 4 4 #include <stdio.h> 5 #include <stdlib.h> 6 #include <iostream> 7 #include <math.h> 5 8 #include <typeinfo> 6 9 … … 39 42 SetStats(); 40 43 SetError(); 44 SetFilled(); 41 45 SetStatPosOffset(); 42 46 SetName("HistoDrw"); … … 80 84 81 85 bool oktrace=false; 86 // Tracer d'une polyline si demandee 87 bool drawpline=false; 88 if(GetGraphicAtt().GetLineAtt() != PI_NotDefLineAtt) drawpline=true; 82 89 // Tracer des marqueurs si demande ou si HProf 83 90 bool drawmarker=false; … … 94 101 else if(error>0) drawerr=true; 95 102 else if(error<0) drawerr=false; 103 // Fill de l'histo ? 104 bool drawfill=false; 105 if(filled) drawfill=true; else drawfill=false; 106 // Et aussi si on ne demande ni ligne ni marqueur ? 107 if( !drawmarker && !drawpline && !drawerr ) drawfill=true; 108 109 // Remplissage des bins avec la couleur courante (trace en premier) 110 if(drawfill) { 111 oktrace = true; 112 for(int i=0; i<mHisto->NBins(); i++) { 113 double left = mHisto->BinLowEdge(i); 114 double width = mHisto->BinWidth(); 115 double bottom = 0; 116 double height = (*mHisto)(i); 117 g->DrawFBox(left,bottom,width,height); 118 } 119 } 96 120 97 121 // Trace des marqeurs … … 125 149 } 126 150 127 // Trace de la ligne continue 128 // Si on ne demande pas de ligne (PI_NotDefLineAtt) 129 // et que l'on a rien trace auparavent, on trace un FPolygon 130 if(GetGraphicAtt().GetLineAtt() != PI_NotDefLineAtt || !oktrace) { 151 // Trace de la ligne continue si demandee 152 if(drawpline) { 131 153 PIGrCoord* x1 = new PIGrCoord[2*mHisto->NBins()+2]; 132 154 PIGrCoord* y1 = new PIGrCoord[2*mHisto->NBins()+2]; … … 147 169 y1[npt] = 0; 148 170 npt++; 149 if(GetGraphicAtt().GetLineAtt() != PI_NotDefLineAtt) { 150 g->DrawPolygon(x1,y1,npt,false); 151 oktrace = true; 152 } 153 if(!oktrace) g->DrawFPolygon(x1,y1,npt,false); 154 delete[] x1; delete[] y1; 171 g->DrawPolygon(x1,y1,npt,false); 172 delete [] x1; delete [] y1; 173 oktrace = true; 155 174 } 156 175 … … 179 198 else if(opts=="noerr") SetError(-1); 180 199 else if(opts=="autoerr") SetError(0); 200 else if(opts=="fill") SetFilled(true); 201 else if(opts=="nofill") SetFilled(false); 181 202 else if(opts.substr(0,11) == "statposoff=") { 182 203 float xo=0., yo=0.; … … 204 225 info += " err / nerr : draw, do not draw error bars\n"; 205 226 info += " autoerr : draw error bars if Marker drawing requested OR Profile histo\n"; 227 info += " fill / nofill : fill, do not fill bars with selected color\n"; 206 228 info += " statposoff=OffsetX,OffsetY : Position offset for Stats drawing \n"; 207 229 info += " as a fraction of total size \n"; … … 262 284 263 285 } 286 287 288 289 /* --Methode-- */ 290 double PIHisto::GetDistanceToPoint(double x, double y) 291 { 292 if (!mHisto) return 1.e+9; 293 294 double dist = -1.e+18; 295 for(int i=0; i<mHisto->NBins(); i++) { 296 double xp=mHisto->BinCenter(i); 297 double yp=(*mHisto)(i); 298 xp = (xp-x)/(XMax()-XMin())/0.5; 299 yp = (yp-y)/(YMax()-YMin())/0.5; 300 xp = xp*xp+yp*yp; 301 if(dist<0. || xp<dist) dist = xp; 302 } 303 dist=sqrt(fabs(dist)); 304 //cout<<dist<<"PIHisto: xlim="<<XMin()<<","<<XMax()<<" ylim="<<YMin()<<","<<YMax() 305 // <<" NBins="<<mHisto->NBins()<<endl; 306 //cout<<"....d="<<dist<<" x="<<x<<" y="<<y<<endl; 307 308 return dist; 309 } -
trunk/SophyaPI/PIext/pihisto.h
r2469 r2517 20 20 // 0=barres d'erreurs automatiques: trace si HProf ou markeur demande 21 21 inline void SetError(short fg=0) {error=fg;} 22 inline void SetFilled(bool fg=false) {filled=fg;} 22 23 inline Histo* Histogram() {return(mHisto);} 23 24 … … 26 27 virtual void GetOptionsHelpInfo(string& info); 27 28 29 // Renvoie une distance au point x,y 30 virtual double GetDistanceToPoint(double x, double y); 31 28 32 protected: 29 33 virtual void DrawStats(PIGraphicUC* g); 30 34 Histo* mHisto; 31 35 bool mAdDO; 32 bool stats ;36 bool stats,filled; 33 37 short error; 34 38 float spoX, spoY; // Stat pos offset par rapport a position defaut -
trunk/SophyaPI/PIext/pintuple.cc
r2469 r2517 4 4 5 5 #include <stdio.h> 6 #include <stdlib.h> 7 #include <iostream> 8 #include <math.h> 6 9 #include "pintuple.h" 7 10 … … 55 58 SelectLabel(NULL); 56 59 SetName("NTupleDrw"); 60 NptDraw = 0; 61 57 62 } 58 63 … … 189 194 xp = yp = xl = yl = 0; 190 195 PIGrCoord xpolyg[NMXMULTP_LOCAL], ypolyg[NMXMULTP_LOCAL]; 191 npolyg = 0; 196 npolyg = 0; 197 NptDraw = 0; 192 198 for (long i=0; i<(long)mNT->NbLines(); i++) { 193 199 xl = xp; yl = yp; … … 198 204 if ( (xp < xmin) || (xp > xmax) || (yp < ymin) || (yp > ymax) ) continue; 199 205 206 NptDraw++; 200 207 // Taille - couleur de marker en fonction du poids 201 208 if (wK >= 0) wp = mNT->GetCell(i, wK); … … 391 398 392 399 393 400 /* --Methode-- */ 401 double PINTuple::GetDistanceToPoint(double x, double y) 402 { 403 if(!mNT) return 1.e+9; 404 if( xK<0 || yK<0 ) return 1.e+9; 405 406 const int nessai = 100; 407 long inc = (NptDraw>nessai) ? (long)(NptDraw/nessai)+1 : 1; 408 409 double dist = -1.e+18; 410 long n = 0; 411 for(long i=0; i<(long)mNT->NbLines(); i++) { 412 double xp=mNT->GetCell(i,xK); 413 if(xp<XMin() || xp>XMax()) continue; 414 double yp=mNT->GetCell(i,yK); 415 if(yp<YMin() || yp>YMax()) continue; 416 if(n%inc==0) { 417 xp = (xp-x)/(XMax()-XMin())/0.5; 418 yp = (yp-y)/(YMax()-YMin())/0.5; 419 xp = xp*xp+yp*yp; 420 if(dist<0. || xp<dist) dist = xp; 421 } 422 n++; 423 } 424 dist=sqrt(fabs(dist)); 425 //cout<<"PINTuple: xlim="<<XMin()<<","<<XMax()<<" ylim="<<YMin()<<","<<YMax() 426 // <<" NbLines="<<mNT->NbLines()<<" inc="<<inc<<endl; 427 //cout<<"....d="<<dist<<" x="<<x<<" y="<<y<<" NptDraw="<<NptDraw<<endl; 428 429 return dist; 430 } -
trunk/SophyaPI/PIext/pintuple.h
r2383 r2517 44 44 // Texte d'aide des options disponibles 45 45 virtual void GetOptionsHelpInfo(string& info); 46 47 // Renvoie une distance au point x,y 48 virtual double GetDistanceToPoint(double x, double y); 46 49 47 50 protected: … … 59 62 bool connectPts; // true -> les points sont relies par une ligne 60 63 float spoX, spoY; // Stat pos offset par rapport a position defaut 64 long NptDraw; // nombre de points effectivement dessines dans la fenetre 61 65 }; 62 66
Note:
See TracChangeset
for help on using the changeset viewer.