Changeset 3145 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Jan 18, 2007, 5:33:46 PM (19 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/Makefile
r3133 r3145 597 597 $(SOPHYAINCP)pisurfdr.h pipodrw.h \ 598 598 $(SOPHYAINCP)histos2.h $(SOPHYAINCP)histos.h \ 599 pintuple.h pintup3d.h pigfd1.h pigfd2.h 599 $(SOPHYAINCP)hist2err.h pintuple.h pintup3d.h pigfd1.h \ 600 pigfd2.h 600 601 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ nobjmgr.cc 601 602 … … 691 692 $(SOPHYAINCP)generalfunc.h pipodrw.h \ 692 693 $(SOPHYAINCP)histos2.h $(SOPHYAINCP)histos.h \ 694 $(SOPHYAINCP)hist2err.h \ 693 695 $(SOPHYAINCP)objfitter.h \ 694 696 $(SOPHYAINCP)cimage.h $(SOPHYAINCP)fioarr.h \ … … 741 743 $(SOPHYAINCP)generalfunc.h \ 742 744 $(SOPHYAINCP)histerr.h \ 743 $(SOPHYAINCP)hist2err.h servnobjm.h nobjmgr.h dlftypes.h \ 744 $(SOPHYAINCP)pdlmgr.h $(SOPHYAINCP)zthread.h \ 745 pihisto.h phistwrapper.h sohiswrap.h $(SOPHYAINCP)histos.h \ 746 $(SOPHYAINCP)hisprof.h \ 745 $(SOPHYAINCP)hist2err.h pihisto.h phistwrapper.h \ 746 pihisto2d.h $(SOPHYAINCP)pimenux.h \ 747 $(SOPHYAINCP)pimenugen.h \ 748 $(SOPHYAINCP)pimenubarx.h \ 749 $(SOPHYAINCP)pimenubargen.h \ 750 $(SOPHYAINCP)pioptmenux.h \ 751 $(SOPHYAINCP)pioptmenugen.h \ 752 $(SOPHYAINCP)pistdwdgx.h \ 753 $(SOPHYAINCP)pistdwdggen.h \ 754 $(SOPHYAINCP)piscdrawwdg.h \ 755 $(SOPHYAINCP)pibwdgx.h \ 756 $(SOPHYAINCP)pigraphps.h \ 757 $(SOPHYAINCP)piwindowx.h \ 758 $(SOPHYAINCP)piwindowgen.h \ 759 $(SOPHYAINCP)picontainerx.h \ 760 $(SOPHYAINCP)picontainergen.h \ 761 $(SOPHYAINCP)pieldrw.h sohiswrap.h \ 762 $(SOPHYAINCP)histos.h $(SOPHYAINCP)hisprof.h \ 763 $(SOPHYAINCP)histos2.h pipodrw.h servnobjm.h nobjmgr.h \ 764 dlftypes.h $(SOPHYAINCP)pdlmgr.h \ 765 $(SOPHYAINCP)zthread.h \ 747 766 $(SOPHYAINCP)objfitter.h \ 748 $(SOPHYAINCP)cimage.h $(SOPHYAINCP)fioarr.h \ 749 $(SOPHYAINCP)histos2.h 767 $(SOPHYAINCP)cimage.h $(SOPHYAINCP)fioarr.h 750 768 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ nomherradapter.cc 751 769 … … 795 813 $(SOPHYAINCP)generalfunc.h \ 796 814 $(SOPHYAINCP)histos.h $(SOPHYAINCP)histos2.h \ 797 $(SOPHYAINCP)hisprof.h $(SOPHYAINCP) histerr.h \798 $(SOPHYAINCP) ntuple.h $(SOPHYAINCP)xntuple.h \815 $(SOPHYAINCP)hisprof.h $(SOPHYAINCP)ntuple.h \ 816 $(SOPHYAINCP)xntuple.h \ 799 817 $(SOPHYAINCP)basedtable.h \ 800 818 $(SOPHYAINCP)segdatablock.h pihisto.h phistwrapper.h \ 801 sohiswrap.h pihisto2d.h $(SOPHYAINCP)pimenux.h \ 819 sohiswrap.h $(SOPHYAINCP)histerr.h \ 820 $(SOPHYAINCP)hist2err.h pihisto2d.h \ 821 $(SOPHYAINCP)pimenux.h \ 802 822 $(SOPHYAINCP)pimenugen.h \ 803 823 $(SOPHYAINCP)pimenubarx.h \ … … 1436 1456 $(SOPHYAINCP)pitherm.h \ 1437 1457 $(SOPHYAINCP)resusage.h nomhistadapter.h \ 1438 $(SOPHYAINCP) histerr.h $(SOPHYAINCP)xntuple.h \1458 $(SOPHYAINCP)xntuple.h \ 1439 1459 $(SOPHYAINCP)basedtable.h \ 1440 1460 $(SOPHYAINCP)segdatablock.h nomgfdadapter.h \ … … 1547 1567 $(SOPHYAINCP)pievthandler.h \ 1548 1568 $(SOPHYAINCP)psfile.h $(SOPHYAINCP)pigratt.h \ 1549 $(SOPHYAINCP)piaxes.h phistwrapper.h 1569 $(SOPHYAINCP)piaxes.h phistwrapper.h \ 1570 $(SOPHYAINCP)parradapter.h $(SOPHYAINCP)lut.h 1550 1571 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ pihisto.cc 1551 1572 … … 1584 1605 $(SOPHYAINCP)pioptmenux.h \ 1585 1606 $(SOPHYAINCP)pioptmenugen.h \ 1586 $(SOPHYAINCP)histos2.h $(SOPHYAINCP)peida.h \1587 $(SOPHYAINCP)utils.h $(SOPHYAINCP)perrors.h \1588 $(SOPHYAINCP)pexceptions.h \1589 $(SOPHYAINCP)fmath.h $(SOPHYAINCP)histos.h \1590 $(SOPHYAINCP)objfio.h \1591 $(SOPHYAINCP)anydataobj.h \1592 $(SOPHYAINCP)ppersist.h $(SOPHYAINCP)gnumd5.h \1593 $(SOPHYAINCP)ppfbinstream.h \1594 $(SOPHYAINCP)rawstream.h \1595 $(SOPHYAINCP)ppfnametag.h \1596 $(SOPHYAINCP)tvector.h $(SOPHYAINCP)tmatrix.h \1597 $(SOPHYAINCP)tarray.h $(SOPHYAINCP)basarr.h \1598 $(SOPHYAINCP)mutyv.h $(SOPHYAINCP)timestamp.h \1599 $(SOPHYAINCP)dvlist.h \1600 $(SOPHYAINCP)ndatablock.h \1601 $(SOPHYAINCP)utilarr.h \1602 $(SOPHYAINCP)tmatrix_tsnl.h \1603 $(SOPHYAINCP)tvector_tsnl.h \1604 1607 $(SOPHYAINCP)pidrawer.h \ 1605 1608 $(SOPHYAINCP)pigratt.h $(SOPHYAINCP)piaxes.h \ … … 1607 1610 $(SOPHYAINCP)piwindowx.h \ 1608 1611 $(SOPHYAINCP)piwindowgen.h \ 1609 $(SOPHYAINCP)pieldrw.h \ 1612 $(SOPHYAINCP)pieldrw.h phistwrapper.h \ 1613 $(SOPHYAINCP)parradapter.h $(SOPHYAINCP)lut.h \ 1610 1614 $(SOPHYAINCP)srandgen.h 1611 1615 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ pihisto2d.cc … … 1697 1701 $(SOPHYAINCP)generalfunc.h \ 1698 1702 $(SOPHYAINCP)histos.h $(SOPHYAINCP)histos2.h \ 1699 $(SOPHYAINCP)hisprof.h $(SOPHYAINCP) histerr.h \1700 $(SOPHYAINCP) ntuple.h $(SOPHYAINCP)xntuple.h \1703 $(SOPHYAINCP)hisprof.h $(SOPHYAINCP)ntuple.h \ 1704 $(SOPHYAINCP)xntuple.h \ 1701 1705 $(SOPHYAINCP)basedtable.h \ 1702 $(SOPHYAINCP)segdatablock.h nomgfdadapter.h \ 1703 nomimagadapter.h $(SOPHYAINCP)cimage.h \ 1704 $(SOPHYAINCP)fioarr.h nomtmatvecadapter.h nomtarradapter.h \ 1706 $(SOPHYAINCP)segdatablock.h nomherradapter.h \ 1707 $(SOPHYAINCP)histerr.h \ 1708 $(SOPHYAINCP)hist2err.h nomgfdadapter.h nomimagadapter.h \ 1709 $(SOPHYAINCP)cimage.h $(SOPHYAINCP)fioarr.h \ 1710 nomtmatvecadapter.h nomtarradapter.h \ 1705 1711 $(SOPHYAINCP)datatable.h \ 1706 1712 $(SOPHYAINCP)swppfdtable.h \ … … 1817 1823 $(SOPHYAINCP)tmatrix_tsnl.h \ 1818 1824 $(SOPHYAINCP)tvector_tsnl.h \ 1825 $(SOPHYAINCP)hist2err.h \ 1819 1826 $(SOPHYAINCP)generalfit.h \ 1820 1827 $(SOPHYAINCP)generaldata.h \ … … 2094 2101 $(SOPHYAINCP)segdatablock.h \ 2095 2102 $(SOPHYAINCP)piyfxdrw.h \ 2096 $(SOPHYAINCP)pisurfdr.h pintuple.h pintup3d.h pipodrw.h 2103 $(SOPHYAINCP)pisurfdr.h pintuple.h pintup3d.h pipodrw.h \ 2104 $(SOPHYAINCP)hist2err.h 2097 2105 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ servnobjm.cc 2098 2106 -
trunk/SophyaPI/PIext/nomherradapter.cc
r3139 r3145 7 7 8 8 #include "nomherradapter.h" 9 #include "pihisto.h" /* Wrapper pour HistoErr */ 10 #include "sohiswrap.h" /* Wrapper pour HistoErr */ 9 #include "pihisto.h" /* Traceur pour Histo1D */ 10 #include "pihisto2d.h" /* Traceur pour Histo2D */ 11 #include "sohiswrap.h" /* Wrapper pour histos (HistoErr Histo2DErr ...) */ 11 12 12 13 #include "pipodrw.h" … … 242 243 PIDrawer* NOMAdapter_Histo2DErr::GetDrawer(string & dopt) 243 244 { 244 /* A_FAIRE_REZA -> + des options pour choisir val / err2 / nb 245 dopt = "thinline " + dopt; 246 return( new PIHisto2DErr(mHerr, false) ); 247 */ 248 return NULL; 245 dopt = "thinline " + dopt; // $CHECK$ CMV : faut-il ajouter thinline 246 return( new PIHisto2D(new Histo2DErrWrapper(mHerr, false), true) ); 249 247 } 250 248 … … 252 250 P2DArrayAdapter* NOMAdapter_Histo2DErr::Get2DArray(string & dopt) 253 251 { 254 return ( new POHe2DAdapter(mHerr, false) ); 252 // DEL return ( new POHe2DAdapter(mHerr, false) ); -- A SUPPRIMER 253 Histo2DErrWrapper* hwp = new Histo2DErrWrapper(mHerr, false); 254 // $CHECK$ CMV : pour les options hbincont hbinerr ... 255 // voir NOMAdapter_Histo2D::Get2DArray(string & dopt) ds nomhistadapter.cc 256 return hwp; 255 257 } 256 258 -
trunk/SophyaPI/PIext/nomhistadapter.cc
r3139 r3145 331 331 PIDrawer* NOMAdapter_Histo2D::GetDrawer(string & dopt) 332 332 { 333 dopt = "thinline " + dopt; 334 return( new PIHisto2D( mHis, false) );333 dopt = "thinline " + dopt; // $CHECK$ CMV : faut-il ajouter thinline 334 return( new PIHisto2D(new Histo2DWrapper(mHis, false), true) ); 335 335 } 336 336 … … 338 338 P2DArrayAdapter* NOMAdapter_Histo2D::Get2DArray(string & dopt) 339 339 { 340 return (new POH2DAdapter(mHis, false) ); 340 // DEL return (new POH2DAdapter(mHis, false) ); -- A SUPPRIMER 341 Histo2DWrapper* hwp = new Histo2DWrapper(mHis, false); 342 // $CHECK$ CMV : pour les options hbincont hbinerr ... 343 // On peut decoder les options si on veut, par exemple avec : 344 // vector<string> vopts; 345 // FillVStringFrString(string const & dopt, vector<string>& vopts,char sep = ' ') 346 // hwp->DecodeOptionString(vopts, false); 347 return hwp; 341 348 } 342 349 -
trunk/SophyaPI/PIext/phistwrapper.h
r3135 r3145 9 9 #include <string> 10 10 #include <vector> 11 #include "parradapter.h" 11 12 12 13 13 14 //! Wrapper class interface for 1d-histogram like objects , used by PIHisto 14 15 // methodes par defaut dans pihisto.cc 15 class P1DHistoWrapper 16 class P1DHistoWrapper : public P1DArrayAdapter 16 17 { 17 18 public: 18 P1DHistoWrapper( );19 P1DHistoWrapper(int asz); // asz: taille du tableau pour P1DArrayAdapter 19 20 virtual ~P1DHistoWrapper(); 20 21 … … 29 30 30 31 // Renvoie contenu du bin i 31 virtual r_8 Value(int_4 i) = 0;32 virtual r_8 Content(int_4 i) = 0; 32 33 virtual r_8 Error(int_4 i) = 0; 33 34 virtual r_8 NbEntries(int_4 i) = 0; 34 35 35 inline r_8 operator()(int_4 i) { return ( Value(i)*mScale+mOff ); } 36 inline r_8 operator()(int_4 i) 37 { 38 r_8 rv = (mRetFg == 2) ? NbEntries(i) : ( (mRetFg == 1) ? Error(i) : Content(i) ) ; 39 return ( rv*mScale+mOff ); 40 } 41 42 // Implementation de la methode P1DArrayAdapter::Value(int i) 43 // Identique a l'operateur ()(i) 44 virtual double Value(int i) { return (*this)(i); } 45 36 46 // Methode de mise a jour du contenu 37 47 // avec implementation par defaut - ne faisant rien … … 45 55 // l'implementation par defaut ds le fichier pihisto.cc 46 56 virtual int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); 57 // liste des options sous forme text (ds pihisto.cc ) 58 virtual int OptionToString(vector<string> & opt) const; 47 59 48 60 protected: 49 r_8 mScale, mOff; // scaling coefficient, offset coefficient 61 r_8 mScale, mOff; // scaling coefficient, offset coefficient used in operator () 62 short mRetFg; // operator() : 0 -> bin content , 1 -> bin error , 2 -> bin nentries 63 }; 50 64 65 //----------------------------------------------------------------------------- 66 67 //! Wrapper class interface for 2d-histogram like objects , used by PIHisto2D 68 // methodes par defaut dans pihisto2d.cc 69 class P2DHistoWrapper : public P2DArrayAdapter 70 { 71 public: 72 P2DHistoWrapper(int_4 asx, int_4 asy); // asx,asy: tailles du tableau pour P2DArrayAdapter 73 virtual ~P2DHistoWrapper(); 74 75 virtual int_4 NBinX() = 0; 76 virtual int_4 NBinY() = 0; 77 virtual r_8 XMin() = 0; 78 virtual r_8 XMax() = 0; 79 virtual r_8 YMin() = 0; 80 virtual r_8 YMax() = 0; 81 virtual r_8 WBinX() = 0; 82 virtual r_8 WBinY() = 0; 83 84 virtual void BinLowEdge(int_4 i, int_4 j, r_8& xr, r_8& yr) = 0; 85 virtual void BinCenter(int_4 i, int_4 j, r_8& xr, r_8& yr) = 0; 86 virtual void BinHighEdge(int_4 i, int_4 j, r_8& xr, r_8& yr) = 0; 87 88 // Renvoie contenu du bin i 89 virtual r_8 Content(int_4 i, int_4 j) = 0; 90 virtual r_8 Error(int_4 i, int_4 j) = 0; 91 virtual r_8 NbEntries(int_4 i, int_4 j) = 0; 92 93 inline r_8 operator()(int_4 i, int_4 j) 94 { 95 r_8 rv = (mRetFg == 2) ? NbEntries(i,j) : ( (mRetFg == 1) ? Error(i,j) : Content(i,j) ) ; 96 return ( rv*mScale+mOff ); 97 } 98 // Implementation de la methode P2DArrayAdapter::Value(int i, j) 99 // Identique a l'operateur ()(i) 100 virtual double Value(int i, int j) { return (*this)(i, j); } 101 102 // Methode de mise a jour du contenu 103 // avec implementation par defaut - ne faisant rien 104 virtual void Update() { return; } 105 106 // ajoute des lignes de texte avec les infos statistiques (dans text) 107 // renvoie le nombre de lignes ajoutees - avec implementation par defaut 108 virtual int GetStatInfoAsText(vector<string> & text ); 109 110 // Methode de decodage des options - avec implementation par defaut 111 // l'implementation par defaut ds le fichier pihisto.cc 112 virtual int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); 113 // liste des options sous forme text (ds pihisto.cc ) 114 virtual int OptionToString(vector<string> & opt) const; 115 116 protected: 117 r_8 mScale, mOff; // scaling coefficient, offset coefficient used in operator () 118 short mRetFg; // operator() : 0 -> bin content , 1 -> bin error , 2 -> bin nentries 51 119 }; 52 120 53 121 122 123 54 124 #endif -
trunk/SophyaPI/PIext/pihisto.cc
r3139 r3145 12 12 13 13 //------ Implementation classe P1DHistoWrapper 14 P1DHistoWrapper::P1DHistoWrapper() 15 : mScale(1.) , mOff(0.) 14 P1DHistoWrapper::P1DHistoWrapper(int_4 asx) 15 : P1DArrayAdapter(asx) , 16 mScale(1.) , mOff(0.) , mRetFg(0) 16 17 { 17 18 } … … 44 45 mOff = atof(opts.substr(8).c_str()); 45 46 } 47 else if(opts.substr(0,8) == "hbincont") { 48 mRetFg = 0; 49 } 50 else if(opts.substr(0,8) == "hbinerr") { 51 mRetFg = 1; 52 } 53 else if(opts.substr(0,8) == "hbinent") { 54 mRetFg = 2; 55 } 46 56 else { 47 57 ndec--; … … 54 64 if (rmdecopt) opt = udopt; 55 65 return(ndec); 66 } 67 68 int 69 P1DHistoWrapper::OptionToString(vector<string> & opt) const 70 { 71 char buff[64]; 72 sprintf(buff, "hscale=%g", mScale); opt.push_back(buff); 73 sprintf(buff, "hoffset=%g", mOff); opt.push_back(buff); 74 if (mRetFg == 2) opt.push_back("hbinent"); 75 else if (mRetFg == 1) opt.push_back("hbinerr"); 76 else opt.push_back("hbincont"); 77 78 return 1; 56 79 } 57 80 … … 75 98 // Constructeur. Si "ad == true", l'objet "histowp" est détruit par 76 99 // le destructeur de l'objet "PIHisto" 77 // Note : "histowp" doit être créé par new 100 // Note : "histowp" doit être créé par new si ad==true 78 101 // 79 102 //-- … … 85 108 mAdDO = ad; // Flag pour suppression automatique de mHistoWp 86 109 stats=true; 87 // todraw = 0 draw scaled and offset value (default) 88 // = 1 draw bin content 89 // = 2 draw bin error (if exist) 90 // = 3 draw number of entries in the bin (if exist) 91 todraw=0; 92 // error = -1 pas de barre d'erreur 93 // 1 barres d'erreurs, 94 // 0 barres d'erreurs automatiques (si markeur demande) 95 error=0; 110 pline=true; 111 error=false; 96 112 filled=false; 97 113 spoX=-0.01; spoY=-0.01; … … 108 124 { 109 125 if (!mHistoWp) return; 126 if ( mHistoWp->NBins() < 1 ) { 127 SetLimits(mHistoWp->XMin(), mHistoWp->XMax(), 0., 1.); 128 } 110 129 double v,hmin,hmax; 111 hmin = 9.e39; 112 hmax = -9.e39; 113 for (int i=1; i<mHistoWp->NBins(); i++) { 114 v = DrawVal(i); 130 hmin = hmax = (*mHistoWp)(0); 131 for (int_4 i=1; i<mHistoWp->NBins(); i++) { 132 v = (*mHistoWp)(i); 115 133 if(v<hmin) hmin = v; 116 134 if(v>hmax) hmax = v; 117 135 } 118 // REZA$CHECK : Modifier pour tenir compte si axe (Y) en log 119 v = 0.1*(hmax-hmin); 120 hmin -= v; hmax += v; 121 136 if ( isLogScaleY() ) { 137 if ( hmin >= 0.) { 138 if ( hmax <= hmin ) { 139 hmax = hmin*10.; 140 if (hmax <= 0.) hmax = 1.; 141 if (hmin <= 0.) hmin = hmax / 100.; 142 } 143 else if ( (hmin == 0.) && (hmax > hmin) ) hmin = hmax/1.e6; 144 else hmin /= 1.1; 145 } 146 else if (hmax > 0.) hmax *= 1.1; 147 } 148 else { 149 v = 0.05*(hmax-hmin); 150 hmin -= v; hmax += v; 151 } 122 152 if(hmax<=hmin) hmax = hmin+1.; 153 123 154 SetLimits(mHistoWp->XMin(), mHistoWp->XMax(), hmin, hmax); 124 155 } … … 134 165 mHistoWp->Update(); 135 166 136 bool oktrace=false;137 167 // Tracer d'une polyline si demandee 138 168 bool drawpline=false; 139 if (GetGraphicAtt().GetLineAtt() != PI_NotDefLineAtt) drawpline=true;169 if (pline) drawpline=true; 140 170 // Tracer des marqueurs si demande ou si HProf 141 171 bool drawmarker=false; … … 143 173 // Tracer des erreurs ? 144 174 bool drawerr=false; 145 if(error==0) { // Gestion automatique des erreurs 146 // Trace les erreurs si marqueurs demandes 147 if(drawmarker) drawerr=true; 148 } 149 else if(error>0) drawerr=true; 150 else if(error<0) drawerr=false; 175 if (error) drawerr = true; 151 176 // Fill de l'histo ? 152 177 bool drawfill=false; 153 178 if(filled) drawfill=true; else drawfill=false; 154 // Et aussi si on ne demande ni ligne ni marqueur ?155 if( !drawmarker && !draw pline && !drawerr ) drawfill=true;179 // Et aussi si on ne demande ni ligne ni marqueur ni erreur ni fill ? 180 if( !drawmarker && !drawfill && !drawerr ) drawpline=true; 156 181 157 182 // Remplissage des bins avec la couleur courante (trace en premier) 158 183 if(drawfill) { 159 oktrace = true;160 184 for(int i=0; i<mHistoWp->NBins(); i++) { 161 185 double left = mHistoWp->BinLowEdge(i); 162 186 double width = mHistoWp->BinWidth(); 163 187 double bottom = 0; 164 double height = DrawVal(i);188 double height = (*mHistoWp)(i); 165 189 g->DrawFBox(left,bottom,width,height); 166 190 } … … 169 193 // Trace des marqeurs 170 194 if(drawmarker) { 171 double x1,y1; oktrace = true;195 double x1,y1; 172 196 for(int i=0; i<mHistoWp->NBins(); i++) { 173 197 x1 = mHistoWp->BinCenter(i); 174 y1 = DrawVal(i);198 y1 = (*mHistoWp)(i); 175 199 g->DrawMarker(x1,y1); 176 200 } … … 180 204 if(drawerr) { 181 205 if(GetGraphicAtt().GetLineAtt()==PI_NotDefLineAtt) g->SelLine(PI_ThinLine); 182 double x1,x2,y1,y2; oktrace = true;206 double x1,x2,y1,y2; 183 207 double bw = mHistoWp->BinWidth(); 184 208 for(int i=0; i<mHistoWp->NBins(); i++) { … … 186 210 // barres d'erreur verticales 187 211 x1 = x2 = mHistoWp->BinCenter(i); 188 y1 = DrawVal(i) - mHistoWp->Error(i);189 y2 = DrawVal(i) + mHistoWp->Error(i);212 y1 = (*mHistoWp)(i) - mHistoWp->Error(i); 213 y2 = (*mHistoWp)(i) + mHistoWp->Error(i); 190 214 g->DrawLine(x1,y1, x1, y2); 191 215 // limites de barres d'erreurs (horizontales) … … 199 223 // Trace de la ligne continue si demandee 200 224 if(drawpline) { 225 if(GetGraphicAtt().GetLineAtt()==PI_NotDefLineAtt) g->SelLine(PI_ThinLine); 201 226 PIGrCoord* x1 = new PIGrCoord[2*mHistoWp->NBins()+2]; 202 227 PIGrCoord* y1 = new PIGrCoord[2*mHistoWp->NBins()+2]; … … 208 233 for(int i=0; i<mHistoWp->NBins(); i++) { 209 234 x1[npt] = mHistoWp->BinLowEdge(i); 210 y1[npt] = DrawVal(i);235 y1[npt] = (*mHistoWp)(i); 211 236 npt++; 212 237 x1[npt] = (double)x1[npt-1] + dx; … … 219 244 g->DrawPolygon(x1,y1,npt,false); 220 245 delete [] x1; delete [] y1; 221 oktrace = true;222 246 } 223 247 … … 243 267 else if( opts=="nsta" || opts=="nstat" 244 268 || opts=="nostat" || opts=="nostats") stats=false; 245 else if(opts=="err") error= 1;246 else if(opts=="noerr" || opts=="nerr") error= -1;247 else if(opts=="autoerr") error=0;248 else if(opts=="fill") filled=true;269 else if(opts=="err") error=true; 270 else if(opts=="noerr" || opts=="nerr") error=false; 271 // $CHECK$CMV : on desactive pline si fill ? 272 else if(opts=="fill") { filled=true; pline=false; } 249 273 else if(opts=="nofill" || opts=="nfill") filled=false; 274 // $CHECK$CMV : on desactive fill si pline ? 275 else if(opts=="pline") { pline=true; filled=false; } 276 else if(opts=="nopline") pline=false; 250 277 else if(opts.substr(0,11) == "statposoff=") { 251 278 float xo=0., yo=0.; … … 253 280 spoX=xo; spoY=yo; 254 281 } 255 else if(opts.substr(0,6) == "draw=v") todraw = 1;256 else if(opts.substr(0,6) == "draw=e") todraw = 2;257 else if(opts.substr(0,6) == "draw=n") todraw = 3;258 else if(opts.substr(0,5) == "draw=" ) todraw = 0;259 282 else { 260 283 ndec--; … … 281 304 PIDrawer::OptionToString(opt); 282 305 283 if(stats) opt.push_back("stat"); else opt.push_back("nstat"); 284 if(error==-1) opt.push_back("noerr"); 285 else if(error==0) opt.push_back("autoerr"); 286 else if(error==1) opt.push_back("err"); 306 if(stats) opt.push_back("stat"); else opt.push_back("nostat"); 307 if(error) opt.push_back("err"); else opt.push_back("noerr"); 287 308 if(filled) opt.push_back("fill"); else opt.push_back("nofill"); 288 if(todraw==1) opt.push_back("draw=v"); 289 else if(todraw==2) opt.push_back("draw=e"); 290 else if(todraw==3) opt.push_back("draw=n"); 309 if(pline) opt.push_back("pline"); else opt.push_back("nopline"); 291 310 292 311 char str[256]; sprintf(str,"statposoff=%g,%g",spoX,spoY); 293 312 opt.push_back(str); 294 313 314 mHistoWp->OptionToString(opt); 295 315 return 1; 296 316 } … … 300 320 { 301 321 info += " ---- PIHisto options help info : \n" ; 302 info += " draw=v: draw bin content\n"; 303 info += " =e: draw bin error (if exist)\n"; 304 info += " =n: draw number of entries in the bin (if exist)\n"; 305 info += " default: draw scaled and offset value (default)\n"; 306 info += " sta,stat,stats: activate statistic display\n"; 307 info += " nsta,nstat,nostat,nostats: deactivate statistic display\n"; 308 info += " err / noerr,nerr : draw, do not draw error bars\n"; 309 info += " autoerr : draw error bars if Marker drawing requested\n"; 310 info += " fill / nofill,nfill : fill, do not fill bars with selected color\n"; 311 info += " statposoff=OffsetX,OffsetY : Position offset for Stats drawing \n"; 312 info += " as a fraction of total size \n"; 322 info += " sta,stat,stats: activate statistic display\n"; 323 info += " nsta,nstat,nostat,nostats: deactivate statistic display\n"; 324 info += " pline/nopline: display/do not display as polyline (def= pline) \n"; 325 info += " err/noerr,nerr: draw/do not draw error bars (def= noerr) \n"; 326 info += " fill/nofill,nfill: fill/do not fill histo (def= nofill) \n"; 327 info += " - Use marker attribute (marker=...) to draw markers \n"; 328 info += " statposoff=OffsetX,OffsetY : Position offset for Stats drawing \n"; 329 info += " as a fraction of total size \n"; 313 330 info += " ---- HistoWrapper options : \n" ; 314 info += " hscale=value : multiplicative factor (in Y) \n" ; 315 info += " hoffset=value : additive coefficient (in Y) \n" ; 316 info += " hs1 : set hscale=1 hoffset=0 (default) \n" ; 331 info += " hbincont: select bin content as Y value for display (default) \n"; 332 info += " hbinerr: select bin error as Y value for display \n"; 333 info += " hbinent: select bin entries as Y value for display \n"; 334 info += " hscale=value : multiplicative factor for Y value \n" ; 335 info += " hoffset=value : additive coefficient for Y value \n" ; 336 info += " hs1: set hscale=1 hoffset=0 (default) \n" ; 317 337 // On recupere ensuite la chaine info de la classe de base 318 338 PIDrawer::GetOptionsHelpInfo(info); … … 335 355 if (nlig < 1) return; 336 356 337 double cellHeight = (nlig+0.6)* cH;357 double cellHeight = nlig*1.2 * cH; 338 358 339 359 int idxll = 0; … … 383 403 for(int i=0; i<mHistoWp->NBins(); i++) { 384 404 double xp=mHistoWp->BinCenter(i); 385 double yp= DrawVal(i);405 double yp=(*mHistoWp)(i); 386 406 xp = (xp-x)/(XMax()-XMin())/0.5; 387 407 yp = (yp-y)/(YMax()-YMin())/0.5; -
trunk/SophyaPI/PIext/pihisto.h
r3135 r3145 20 20 inline P1DHistoWrapper* HistoWrapper() {return(mHistoWp);} 21 21 22 // ce qu'on plot23 double DrawVal(int_4 i) {24 if(todraw==1) return mHistoWp->Value(i);25 if(todraw==2) return mHistoWp->Error(i);26 if(todraw==3) return mHistoWp->NbEntries(i);27 return (*mHistoWp)(i);28 }29 30 22 // Methode de decodage des options 31 23 virtual int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); … … 40 32 P1DHistoWrapper* mHistoWp; 41 33 bool mAdDO; 42 bool stats,filled; 43 short error,todraw; 44 float spoX, spoY; // Stat pos offset par rapport a position defaut 34 bool stats; // if true: draw text with statistical information 35 bool filled; // if true: fill histo with fg color 36 bool pline; // if true: draw histogram as polyline 37 bool error; // if true: draw error bars 38 float spoX, spoY; // Stat pos offset par rapport a position defaut 45 39 }; 46 40 -
trunk/SophyaPI/PIext/pihisto2d.cc
r3075 r3145 3 3 #include <pisysdep.h> 4 4 #include PIAPP_H 5 6 #include <iostream> 7 #include <math.h> 8 5 9 #include "sopnamsp.h" 6 10 #include "pihisto2d.h" … … 9 13 static int dbg = 0; 10 14 15 16 //------ Implementation classe P2DHistoWrapper 17 P2DHistoWrapper::P2DHistoWrapper(int_4 asx, int_4 asy) 18 : P2DArrayAdapter(asx, asy) , 19 mScale(1.) , mOff(0.) , mRetFg(0) 20 { 21 } 22 23 P2DHistoWrapper::~P2DHistoWrapper() 24 { 25 } 26 27 int P2DHistoWrapper::GetStatInfoAsText(vector<string> & /* text */ ) 28 { 29 return 0; 30 } 31 32 int P2DHistoWrapper::DecodeOptionString(vector<string> & opt, bool rmdecopt) 33 { 34 if(opt.size() < 1) return(0); 35 36 vector<string> udopt; // On gardera ici les options non decodees 37 unsigned int k = 0; 38 int ndec = opt.size(); 39 for( k=0; k<opt.size(); k++ ) { 40 string & opts = opt[k]; 41 if(opts.substr(0,7) == "hs1") { 42 mScale = 1.; mOff = 0.; 43 } 44 else if(opts.substr(0,7) == "hscale=") { 45 mScale = atof(opts.substr(7).c_str()); 46 } 47 else if(opts.substr(0,8) == "hoffset=") { 48 mOff = atof(opts.substr(8).c_str()); 49 } 50 else if(opts.substr(0,8) == "hbincont") { 51 mRetFg = 0; 52 } 53 else if(opts.substr(0,8) == "hbinerr") { 54 mRetFg = 1; 55 } 56 else if(opts.substr(0,8) == "hbinent") { 57 mRetFg = 2; 58 } 59 else { 60 ndec--; 61 // S'il faut supprimer les options decodees 62 if (rmdecopt) udopt.push_back(opts); 63 } 64 } 65 // S'il faut supprimer les options decodees, on remplace l'argument opt 66 // par le vecteur des options non decodees. 67 if (rmdecopt) opt = udopt; 68 return(ndec); 69 } 70 71 int 72 P2DHistoWrapper::OptionToString(vector<string> & opt) const 73 { 74 char buff[64]; 75 sprintf(buff, "hscale=%g", mScale); opt.push_back(buff); 76 sprintf(buff, "hoffset=%g", mOff); opt.push_back(buff); 77 if (mRetFg == 2) opt.push_back("hbinent"); 78 else if (mRetFg == 1) opt.push_back("hbinerr"); 79 else opt.push_back("hbincont"); 80 81 return 1; 82 } 83 11 84 //++ 12 85 // Class PIHisto2D … … 28 101 29 102 //++ 30 PIHisto2D::PIHisto2D( Histo2D* histo, bool ad)103 PIHisto2D::PIHisto2D(P2DHistoWrapper* histowp, bool ad) 31 104 // 32 105 // Createur d'une classe de dessin pour l'histogramme 2D histo. 33 106 //-- 34 : PIDrawer(), mHisto (histo), mAdDO(ad), mLogScale(10.), mFPoints(0.5)35 { 36 // mAdDO : Flag pour suppression automatique de mHisto 107 : PIDrawer(), mHistoWp(histowp), mAdDO(ad), mLogScale(10.), mFPoints(0.5) 108 { 109 // mAdDO : Flag pour suppression automatique de mHistoWp 37 110 // Attention: mFPoints n'est initialise que si on display par nuages de points 38 111 // mLogScale n'est initialise que si on utilise une echelle log … … 43 116 UseFrac(); 44 117 SetStats(); 45 118 SetStatPosOffset(); 46 119 SetName("Histo2DDrw"); 47 120 // PIHisto2D has specific control tools … … 62 135 // ---> parametre d'appel PIBaseWdgGen* wdg=NULL 63 136 DeactivateControlWindow(NULL); 64 if(mAdDO && mHisto !=NULL) delete mHisto;137 if(mAdDO && mHistoWp!=NULL) delete mHistoWp; 65 138 } 66 139 … … 139 212 140 213 //++ 141 void PIHisto2D::UseDyn(float hmin,float hmax)214 void PIHisto2D::UseDyn(float fmin,float fmax) 142 215 // 143 216 // Gestion de la dynamique a representer: … … 151 224 //-- 152 225 { 153 if(mHisto) 154 if(hmin>=hmax) {hmin = mHisto->VMin(); hmax = mHisto->VMax();} 155 if(hmin>=hmax) hmax = hmin+1.; 156 mHMin = hmin; mHMax = hmax; 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 ?? 239 if(fmin>=fmax) fmax = fmin+1.; 240 mHMin = fmin; mHMax = fmax; 157 241 } 158 242 … … 189 273 ,(int)mFgCol,(int)mCmap,(int)mRevCmap,mTypScal,mTypDisp,mFPoints); 190 274 printf(" Dyn=%g,%g Frac=%g,%g LogSc=%g H=%p\n" 191 ,mHMin,mHMax,mFracMin,mFracMax,mLogScale,mHisto );192 if(lp>=1) mHisto->PrintStatus(); 275 ,mHMin,mHMax,mFracMin,mFracMax,mLogScale,mHistoWp); 276 // if(lp>=1) mHistoWp->PrintStatus(); $CHECK$ CMV : que faut-il faire ? 193 277 fflush(stdout); 194 278 } … … 201 285 //-- 202 286 { 203 if(!mHisto ) return;204 SetLimits(mHisto ->XMin(), mHisto->XMax(), mHisto->YMin() , mHisto->YMax());287 if(!mHistoWp) return; 288 SetLimits(mHistoWp->XMin(), mHistoWp->XMax(), mHistoWp->YMin() , mHistoWp->YMax()); 205 289 } 206 290 … … 259 343 if (axesFlags != kAxesNone) DrawAxes(g); 260 344 261 if(!mHisto ) return;262 if(mHisto ->NBinX()<=0 || mHisto->NBinY()<=0) return;345 if(!mHistoWp) return; 346 if(mHistoWp->NBinX()<=0 || mHistoWp->NBinY()<=0) return; 263 347 264 348 // Caracteristiques histogramme 265 double dx = mHisto ->WBinX(),dy = mHisto->WBinY();349 double dx = mHistoWp->WBinX(),dy = mHistoWp->WBinY(); 266 350 double p1dx,p1dy; 267 351 g->DGrC2UC(1.,1.,p1dx,p1dy); … … 309 393 310 394 // Plot de l'histogramme 311 for(int i=0; i<mHisto ->NBinX(); i++)312 for(int j=0; j<mHisto ->NBinY(); j++) {395 for(int i=0; i<mHistoWp->NBinX(); i++) 396 for(int j=0; j<mHistoWp->NBinY(); j++) { 313 397 314 398 r_8 left0,bottom0; 315 mHisto ->BinLowEdge(i,j,left0,bottom0);399 mHistoWp->BinLowEdge(i,j,left0,bottom0); 316 400 317 401 // Gestion de la dynamique a dessiner 318 float frac = ((*mHisto )(i,j)-HMin())/(HMax()-HMin());402 float frac = ((*mHistoWp)(i,j)-HMin())/(HMax()-HMin()); 319 403 if(frac<0.) continue; 320 404 if(mTypScal==1) { // echelle log10 … … 385 469 //-- 386 470 { 387 Histo2D* h = Histogram();471 P2DHistoWrapper* h = HistoWrapper(); 388 472 if(h == NULL) return; 389 473 390 int i,j; 391 h->FindBin(x,y,i,j); 474 int_4 i,j; 475 i = floor((x-h->XMin())/h->WBinX()); 476 j = floor((y-h->YMin())/h->WBinY()); 477 392 478 if(i>=0 && i<h->NBinX() && j>=0 && j<h->NBinY()) { 393 479 char str[64]; 394 480 if(fgdiff) { 395 481 int i0,j0; 396 h->FindBin(x0,y0,i0,j0); 482 i0 = floor((x0-h->XMin())/h->WBinX()); 483 j0 = floor((y0-h->YMin())/h->WBinY()); 397 484 if(i0>=0 && i0<h->NBinX() && j0>=0 && j0<h->NBinY()) { 398 485 sprintf(str," DV=%g",(*h)(i,j)-(*h)(i0,j0)); … … 417 504 //-- 418 505 { 419 if (!mHisto ) return;506 if (!mHistoWp) return; 420 507 if (GetGraphicAtt().GetLineAtt() == PI_NotDefLineAtt) g->SelLine(PI_ThinLine); 421 508 g->SelFontSz((YMax() - YMin())/30); … … 424 511 PIGrCoord a, d; 425 512 double cH = (double)g->GetFontHeight(a,d); 426 double cellHeight = 1.2 * cH; 427 428 // Les labels et leurs longueurs -> largeur de la cellule 429 char label[64]; 430 sprintf(label,"N= %-g", mHisto->NData()); 431 double cellWidth = 1.1 * (double)g->CalcStringWidth(label); 513 vector<string> lines; 514 int nlig = mHistoWp->GetStatInfoAsText(lines); 515 if (nlig < 1) return; 516 517 double cellHeight = nlig*1.2 * cH; 518 519 int idxll = 0; 520 521 int kl; 522 // on recherche la ligne la plus longue 523 for(kl=1; kl<nlig; kl++) 524 if ( lines[kl].length() > lines[idxll].length() ) idxll = kl; 525 526 double cellWidth = 1.1 * (double)g->CalcStringWidth(lines[idxll].c_str()); 527 432 528 433 529 double ofpx = spoX*(XMax()-XMin()); … … 446 542 cw = (g->isAxeXDirRtoL()) ? -0.05*cellWidth : -0.95*cellWidth; 447 543 xu = g->DeltaUCX(XMax(),cw); 448 cw = (g->isAxeYDirUpDown()) ? -0.1*cH : -1.1*cH; 544 545 cw = (g->isAxeYDirUpDown()) ? -0.15*cH : -1.15*cH; 449 546 yu = g->DeltaUCY(YMax(),cw); 450 547 xu += ofpx; yu += ofpy; 451 g->DrawString(xu,yu,label); 548 549 for(kl=0; kl<nlig; kl++) { 550 g->DrawString(xu, yu, lines[kl].c_str() ); 551 cw += -1.15*cH; 552 yu = g->DeltaUCY(YMax(),cw); yu += ofpy; 553 } 554 452 555 453 556 // printf("H[%d,%d] Dynamique: [%g,%g] Frac [%g,%g]\n" 454 // ,mHisto ->NBinX(),mHisto->NBinY(),HMin(),HMax(),FMin(),FMax());557 // ,mHistoWp->NBinX(),mHistoWp->NBinY(),HMin(),HMax(),FMin(),FMax()); 455 558 } 456 559 … … 489 592 //-- 490 593 { 491 double dx = mHisto ->WBinX(),dy = mHisto->WBinY();594 double dx = mHistoWp->WBinX(),dy = mHistoWp->WBinY(); 492 595 double dxg,dyg; 493 596 g->DUC2GrC(dx,dy,dxg,dyg); … … 573 676 if (rmdecopt) opt = udopt; 574 677 678 // Decodage des options par le histo-wrapper 679 int ndec2 = 0; 680 if ( ( optsz1-ndec1-ndec > 0) && (mHistoWp) ) { 681 ndec2 = mHistoWp->DecodeOptionString(opt, rmdecopt); 682 } 683 575 684 // Liste des options si demande 576 685 if(listopt) Print(); 577 686 578 return(ndec+ndec1 );687 return(ndec+ndec1+ndec2); 579 688 } 580 689 … … 607 716 if(mRevCmap) opt.push_back("revcmap"); 608 717 718 // Les options du Histo2DWrapper : 719 mHistoWp->OptionToString(opt); 609 720 return 1; 610 721 } … … 630 741 info += "- h2scale=lin/log[,logscale]: choose linear or logarithmic scale\n"; 631 742 info += "- h2dyn=[hmin][,hmax]: choose histogramme range for display\n"; 632 info += "- use g eneral keyto define color table (ex: grey32,midas_heat,...)\n";743 info += "- use graphic att. to define color table (ex: grey32,midas_heat,...)\n"; 633 744 info += " (see general graphicatt description)\n"; 634 info += "- use key\"revcmap\" to reverse color table\n";745 info += "- use \"revcmap\" to reverse color table\n"; 635 746 info += "- h2frac=[fmin][,fmax]: choose sub-range display [0,1]\n"; 747 info += " ---- HistoWrapper options : \n" ; 748 info += " hbincont: select bin content as Y value for display (default) \n"; 749 info += " hbinerr: select bin error as Y value for display \n"; 750 info += " hbinent: select bin entries as Y value for display \n"; 751 info += " hscale=value : multiplicative factor for Y value \n" ; 752 info += " hoffset=value : additive coefficient for Y value \n" ; 753 info += " hs1: set hscale=1 hoffset=0 (default) \n" ; 636 754 // On recupere ensuite la chaine info de la classe de base 637 755 PIDrawer::GetOptionsHelpInfo(info); -
trunk/SophyaPI/PIext/pihisto2d.h
r2523 r3145 12 12 #include PIOPTMENU_H 13 13 14 #include "histos2.h"15 14 #include "pidrawer.h" 16 15 #include "piscdrawwdg.h" 16 17 #include "phistwrapper.h" 17 18 18 19 //////////////////////////////////////////////////////////////////// 19 20 class PIHisto2D : public PIDrawer { 20 21 public: 21 PIHisto2D( Histo2D* histo, bool ad=false);22 PIHisto2D(P2DHistoWrapper* h2wp, bool ad=false); 22 23 virtual ~PIHisto2D(); 23 24 … … 56 57 57 58 // Methodes inline 58 inline Histo2D* Histogram() {return(mHisto);}59 inline P2DHistoWrapper* HistoWrapper() {return(mHistoWp);} 59 60 inline bool Color() {return(mFgCol);} 60 61 inline CMapId ColMap() {return(mCmap);} … … 73 74 char HPrint2(float f); 74 75 75 Histo2D* mHisto;76 P2DHistoWrapper* mHistoWp; 76 77 bool mAdDO; bool stats; 77 78 bool mFgCol; CMapId mCmap; bool mRevCmap; -
trunk/SophyaPI/PIext/pipodrw.cc
r3139 r3145 56 56 57 57 58 // ----------------------------------------------------------59 // Adaptateur d'Histo-2D a P2DArrayAdapter60 // ----------------------------------------------------------61 62 /* --Methode-- */63 POH2DAdapter::POH2DAdapter(Histo2D* h2d, bool ad)64 : P2DArrayAdapter(h2d->NBinX(), h2d->NBinY())65 {66 aDel = ad; mH2d = h2d;67 DefineXYCoordinates(h2d->XMin(), h2d->YMin(), h2d->WBinX(), h2d->WBinY() );68 }69 70 /* --Methode-- */71 POH2DAdapter::~POH2DAdapter()72 {73 if (aDel) delete mH2d;74 }75 76 /* --Methode-- */77 double POH2DAdapter::Value(int ix, int iy)78 {79 return((*mH2d)(ix, iy));80 }81 82 // ----------------------------------------------------------83 // Adaptateur d'Histo2DErr a P2DArrayAdapter84 // ----------------------------------------------------------85 86 /* --Methode-- */87 POHe2DAdapter::POHe2DAdapter(Histo2DErr* he2d, bool ad)88 : P2DArrayAdapter(he2d->NBinX(), he2d->NBinY())89 {90 aDel = ad; mHe2d = he2d;91 DefineXYCoordinates(he2d->XMin(), he2d->YMin(), he2d->WBinX(), he2d->WBinY() );92 }93 94 /* --Methode-- */95 POHe2DAdapter::~POHe2DAdapter()96 {97 if (aDel) delete mHe2d;98 }99 100 /* --Methode-- */101 double POHe2DAdapter::Value(int ix, int iy)102 {103 return((*mHe2d)(ix, iy));104 }105 106 107 58 #ifdef SANS_EVOLPLANCK 108 59 … … 129 80 return((*mVec)(i)); 130 81 } 82 83 ------- FIN SUPPRESSION */ 131 84 132 85 // ---------------------------------------------------------- -
trunk/SophyaPI/PIext/pipodrw.h
r3139 r3145 34 34 35 35 36 // Adaptateur d'Histo-2D a P2DArrayAdapter37 class POH2DAdapter : public P2DArrayAdapter {38 public :39 POH2DAdapter(Histo2D* h2d, bool ad=false);40 virtual ~POH2DAdapter();41 42 virtual double Value(int ix, int iy);43 44 protected:45 bool aDel;46 Histo2D* mH2d;47 };48 49 // Adaptateur d'Histo2DErr a P2DArrayAdapter50 class POHe2DAdapter : public P2DArrayAdapter {51 public :52 POHe2DAdapter(Histo2DErr* he2d, bool ad=false);53 virtual ~POHe2DAdapter();54 55 virtual double Value(int ix, int iy);56 57 protected:58 bool aDel;59 Histo2DErr* mHe2d;60 };61 62 36 #ifdef SANS_EVOLPLANCK 63 37 #include "cvector.h" -
trunk/SophyaPI/PIext/smakefile
r3133 r3145 597 597 $(SOPHYAINCP)pisurfdr.h pipodrw.h \ 598 598 $(SOPHYAINCP)histos2.h $(SOPHYAINCP)histos.h \ 599 pintuple.h pintup3d.h pigfd1.h pigfd2.h 599 $(SOPHYAINCP)hist2err.h pintuple.h pintup3d.h pigfd1.h \ 600 pigfd2.h 600 601 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ nobjmgr.cc 601 602 … … 691 692 $(SOPHYAINCP)generalfunc.h pipodrw.h \ 692 693 $(SOPHYAINCP)histos2.h $(SOPHYAINCP)histos.h \ 694 $(SOPHYAINCP)hist2err.h \ 693 695 $(SOPHYAINCP)objfitter.h \ 694 696 $(SOPHYAINCP)cimage.h $(SOPHYAINCP)fioarr.h \ … … 741 743 $(SOPHYAINCP)generalfunc.h \ 742 744 $(SOPHYAINCP)histerr.h \ 743 $(SOPHYAINCP)hist2err.h servnobjm.h nobjmgr.h dlftypes.h \ 744 $(SOPHYAINCP)pdlmgr.h $(SOPHYAINCP)zthread.h \ 745 pihisto.h phistwrapper.h sohiswrap.h $(SOPHYAINCP)histos.h \ 746 $(SOPHYAINCP)hisprof.h \ 745 $(SOPHYAINCP)hist2err.h pihisto.h phistwrapper.h \ 746 pihisto2d.h $(SOPHYAINCP)pimenux.h \ 747 $(SOPHYAINCP)pimenugen.h \ 748 $(SOPHYAINCP)pimenubarx.h \ 749 $(SOPHYAINCP)pimenubargen.h \ 750 $(SOPHYAINCP)pioptmenux.h \ 751 $(SOPHYAINCP)pioptmenugen.h \ 752 $(SOPHYAINCP)pistdwdgx.h \ 753 $(SOPHYAINCP)pistdwdggen.h \ 754 $(SOPHYAINCP)piscdrawwdg.h \ 755 $(SOPHYAINCP)pibwdgx.h \ 756 $(SOPHYAINCP)pigraphps.h \ 757 $(SOPHYAINCP)piwindowx.h \ 758 $(SOPHYAINCP)piwindowgen.h \ 759 $(SOPHYAINCP)picontainerx.h \ 760 $(SOPHYAINCP)picontainergen.h \ 761 $(SOPHYAINCP)pieldrw.h sohiswrap.h \ 762 $(SOPHYAINCP)histos.h $(SOPHYAINCP)hisprof.h \ 763 $(SOPHYAINCP)histos2.h pipodrw.h servnobjm.h nobjmgr.h \ 764 dlftypes.h $(SOPHYAINCP)pdlmgr.h \ 765 $(SOPHYAINCP)zthread.h \ 747 766 $(SOPHYAINCP)objfitter.h \ 748 $(SOPHYAINCP)cimage.h $(SOPHYAINCP)fioarr.h \ 749 $(SOPHYAINCP)histos2.h 767 $(SOPHYAINCP)cimage.h $(SOPHYAINCP)fioarr.h 750 768 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ nomherradapter.cc 751 769 … … 795 813 $(SOPHYAINCP)generalfunc.h \ 796 814 $(SOPHYAINCP)histos.h $(SOPHYAINCP)histos2.h \ 797 $(SOPHYAINCP)hisprof.h $(SOPHYAINCP) histerr.h \798 $(SOPHYAINCP) ntuple.h $(SOPHYAINCP)xntuple.h \815 $(SOPHYAINCP)hisprof.h $(SOPHYAINCP)ntuple.h \ 816 $(SOPHYAINCP)xntuple.h \ 799 817 $(SOPHYAINCP)basedtable.h \ 800 818 $(SOPHYAINCP)segdatablock.h pihisto.h phistwrapper.h \ 801 sohiswrap.h pihisto2d.h $(SOPHYAINCP)pimenux.h \ 819 sohiswrap.h $(SOPHYAINCP)histerr.h \ 820 $(SOPHYAINCP)hist2err.h pihisto2d.h \ 821 $(SOPHYAINCP)pimenux.h \ 802 822 $(SOPHYAINCP)pimenugen.h \ 803 823 $(SOPHYAINCP)pimenubarx.h \ … … 1436 1456 $(SOPHYAINCP)pitherm.h \ 1437 1457 $(SOPHYAINCP)resusage.h nomhistadapter.h \ 1438 $(SOPHYAINCP) histerr.h $(SOPHYAINCP)xntuple.h \1458 $(SOPHYAINCP)xntuple.h \ 1439 1459 $(SOPHYAINCP)basedtable.h \ 1440 1460 $(SOPHYAINCP)segdatablock.h nomgfdadapter.h \ … … 1547 1567 $(SOPHYAINCP)pievthandler.h \ 1548 1568 $(SOPHYAINCP)psfile.h $(SOPHYAINCP)pigratt.h \ 1549 $(SOPHYAINCP)piaxes.h phistwrapper.h 1569 $(SOPHYAINCP)piaxes.h phistwrapper.h \ 1570 $(SOPHYAINCP)parradapter.h $(SOPHYAINCP)lut.h 1550 1571 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ pihisto.cc 1551 1572 … … 1584 1605 $(SOPHYAINCP)pioptmenux.h \ 1585 1606 $(SOPHYAINCP)pioptmenugen.h \ 1586 $(SOPHYAINCP)histos2.h $(SOPHYAINCP)peida.h \1587 $(SOPHYAINCP)utils.h $(SOPHYAINCP)perrors.h \1588 $(SOPHYAINCP)pexceptions.h \1589 $(SOPHYAINCP)fmath.h $(SOPHYAINCP)histos.h \1590 $(SOPHYAINCP)objfio.h \1591 $(SOPHYAINCP)anydataobj.h \1592 $(SOPHYAINCP)ppersist.h $(SOPHYAINCP)gnumd5.h \1593 $(SOPHYAINCP)ppfbinstream.h \1594 $(SOPHYAINCP)rawstream.h \1595 $(SOPHYAINCP)ppfnametag.h \1596 $(SOPHYAINCP)tvector.h $(SOPHYAINCP)tmatrix.h \1597 $(SOPHYAINCP)tarray.h $(SOPHYAINCP)basarr.h \1598 $(SOPHYAINCP)mutyv.h $(SOPHYAINCP)timestamp.h \1599 $(SOPHYAINCP)dvlist.h \1600 $(SOPHYAINCP)ndatablock.h \1601 $(SOPHYAINCP)utilarr.h \1602 $(SOPHYAINCP)tmatrix_tsnl.h \1603 $(SOPHYAINCP)tvector_tsnl.h \1604 1607 $(SOPHYAINCP)pidrawer.h \ 1605 1608 $(SOPHYAINCP)pigratt.h $(SOPHYAINCP)piaxes.h \ … … 1607 1610 $(SOPHYAINCP)piwindowx.h \ 1608 1611 $(SOPHYAINCP)piwindowgen.h \ 1609 $(SOPHYAINCP)pieldrw.h \ 1612 $(SOPHYAINCP)pieldrw.h phistwrapper.h \ 1613 $(SOPHYAINCP)parradapter.h $(SOPHYAINCP)lut.h \ 1610 1614 $(SOPHYAINCP)srandgen.h 1611 1615 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ pihisto2d.cc … … 1697 1701 $(SOPHYAINCP)generalfunc.h \ 1698 1702 $(SOPHYAINCP)histos.h $(SOPHYAINCP)histos2.h \ 1699 $(SOPHYAINCP)hisprof.h $(SOPHYAINCP) histerr.h \1700 $(SOPHYAINCP) ntuple.h $(SOPHYAINCP)xntuple.h \1703 $(SOPHYAINCP)hisprof.h $(SOPHYAINCP)ntuple.h \ 1704 $(SOPHYAINCP)xntuple.h \ 1701 1705 $(SOPHYAINCP)basedtable.h \ 1702 $(SOPHYAINCP)segdatablock.h nomgfdadapter.h \ 1703 nomimagadapter.h $(SOPHYAINCP)cimage.h \ 1704 $(SOPHYAINCP)fioarr.h nomtmatvecadapter.h nomtarradapter.h \ 1706 $(SOPHYAINCP)segdatablock.h nomherradapter.h \ 1707 $(SOPHYAINCP)histerr.h \ 1708 $(SOPHYAINCP)hist2err.h nomgfdadapter.h nomimagadapter.h \ 1709 $(SOPHYAINCP)cimage.h $(SOPHYAINCP)fioarr.h \ 1710 nomtmatvecadapter.h nomtarradapter.h \ 1705 1711 $(SOPHYAINCP)datatable.h \ 1706 1712 $(SOPHYAINCP)swppfdtable.h \ … … 1817 1823 $(SOPHYAINCP)tmatrix_tsnl.h \ 1818 1824 $(SOPHYAINCP)tvector_tsnl.h \ 1825 $(SOPHYAINCP)hist2err.h \ 1819 1826 $(SOPHYAINCP)generalfit.h \ 1820 1827 $(SOPHYAINCP)generaldata.h \ … … 2094 2101 $(SOPHYAINCP)segdatablock.h \ 2095 2102 $(SOPHYAINCP)piyfxdrw.h \ 2096 $(SOPHYAINCP)pisurfdr.h pintuple.h pintup3d.h pipodrw.h 2103 $(SOPHYAINCP)pisurfdr.h pintuple.h pintup3d.h pipodrw.h \ 2104 $(SOPHYAINCP)hist2err.h 2097 2105 $(CXXCOMPILE) $(CXXTEMPFLG) -o $@ servnobjm.cc 2098 2106 -
trunk/SophyaPI/PIext/sohiswrap.h
r3135 r3145 12 12 #include "histerr.h" 13 13 14 #include "histos2.h" 15 #include "hist2err.h" 16 14 17 #include "pexceptions.h" 15 18 … … 18 21 namespace SOPHYA { 19 22 20 //! Wrapper class for SOPHYA::Histo , SOPHYA::HProf 23 //! Wrapper class for SOPHYA::Histo , SOPHYA::HProf , for use by PIHisto 21 24 class HistoWrapper : public P1DHistoWrapper 22 25 { 23 26 public: 24 27 HistoWrapper(Histo* h, bool ad=true) 28 : P1DHistoWrapper(h->NBins()) 25 29 { 26 30 if (h == NULL) throw NullPtrError("HistoWrapper(Histo* h = NULL)"); … … 28 32 mHpr = dynamic_cast<HProf*>(h); 29 33 mAD = ad; 34 DefineXCoordinate(h->XMin(), h->BinWidth()); // Pour P1DArrayAdapter 30 35 } 31 36 ~HistoWrapper() { if (mAD) delete mHis; } … … 40 45 virtual r_8 BinHighEdge(int_4 i) { return mHis->BinHighEdge(i) ; } 41 46 42 virtual r_8 Value(int_4 i) { return (*mHis)(i) ; }47 virtual r_8 Content(int_4 i) { return (*mHis)(i) ; } 43 48 virtual r_8 Error(int_4 i) { return mHis->Error(i) ; } 44 49 virtual r_8 NbEntries(int_4 i) { if(mHpr) return mHpr->SumW(i); else return 0.; } … … 70 75 71 76 72 //! Wrapper class for SOPHYA::HistoErr 77 //! Wrapper class for SOPHYA::HistoErr for use by PIHisto 73 78 class HistoErrWrapper : public P1DHistoWrapper 74 79 { 75 80 public: 76 81 HistoErrWrapper(HistoErr* h, bool ad=false) 77 { 78 if (h == NULL) throw NullPtrError("HistoWrapper(HistoErr* h = NULL)"); 82 : P1DHistoWrapper(h->NBins()) 83 { 84 if (h == NULL) throw NullPtrError("HistoErrWrapper(HistoErr* h = NULL)"); 79 85 mHis = h; mAD = ad; 86 DefineXCoordinate(h->XMin(), h->BinWidth()); // Pour P1DArrayAdapter 80 87 } 81 88 ~HistoErrWrapper() { if (mAD) delete mHis; } … … 90 97 virtual r_8 BinHighEdge(int_4 i) { return mHis->BinHighEdge(i) ; } 91 98 92 virtual r_8 Value(int_4 i) { return (*mHis)(i) ; }99 virtual r_8 Content(int_4 i) { return (*mHis)(i) ; } 93 100 virtual r_8 Error(int_4 i) { return mHis->Error(i) ; } 94 101 virtual r_8 NbEntries(int_4 i) { return mHis->NEntBin(i) ; } … … 113 120 }; 114 121 122 123 //! Wrapper class for SOPHYA::Histo2D for use by PIHisto2D 124 class Histo2DWrapper : public P2DHistoWrapper 125 { 126 public: 127 Histo2DWrapper(Histo2D* h, bool ad=true) 128 : P2DHistoWrapper(h->NBinX(), h->NBinY()) 129 { 130 if (h == NULL) throw NullPtrError("Histo2DWrapper(Histo2D* h = NULL)"); 131 mHis = h; mAD = ad; 132 DefineXYCoordinates(h->XMin(), h->YMin(), h->WBinX(), h->WBinY() ); // pour P2DArrayAdapter 133 } 134 135 virtual ~Histo2DWrapper() { if (mAD) delete mHis; } 136 137 virtual int_4 NBinX() { return mHis->NBinX(); } 138 virtual int_4 NBinY() { return mHis->NBinY(); } 139 virtual r_8 XMin() { return mHis->XMin() ; } 140 virtual r_8 XMax() { return mHis->XMax() ; } 141 virtual r_8 YMin() { return mHis->YMin() ; } 142 virtual r_8 YMax() { return mHis->YMax() ; } 143 virtual r_8 WBinX() { return mHis->WBinX() ; } 144 virtual r_8 WBinY() { return mHis->WBinY() ; } 145 146 virtual void BinLowEdge(int_4 i, int_4 j, r_8& xr, r_8& yr) 147 { mHis->BinLowEdge(i, j, xr, yr); return; } 148 virtual void BinCenter(int_4 i, int_4 j, r_8& xr, r_8& yr) 149 { mHis->BinCenter(i, j, xr, yr); return; } 150 virtual void BinHighEdge(int_4 i, int_4 j, r_8& xr, r_8& yr) 151 { mHis->BinHighEdge(i, j, xr, yr); return; } 152 153 // Renvoie contenu du bin i 154 virtual r_8 Content(int_4 i, int_4 j) { return (*mHis)(i,j) ; } 155 virtual r_8 Error(int_4 i, int_4 j) { return mHis->Error(i,j) ; } 156 virtual r_8 NbEntries(int_4 i, int_4 j) { return 0.; } // $CHECK$ CMV 0 ?? 157 158 // Methode de mise a jour du contenu 159 // virtual void Update() $CHECK$ CMV a supprimer ? 160 161 // ajoute des lignes de texte avec les infos statistiques (dans text) 162 // renvoie le nombre de lignes ajoutees - avec implementation par defaut 163 virtual int GetStatInfoAsText(vector<string> & text ) 164 { 165 // $CHECK$ CMV , faut-il completer ? 166 char label[64]; 167 string s; 168 sprintf(label,"N= %-g", mHis->NData()); 169 s = label; text.push_back(s); 170 return 1; 171 } 172 173 inline Histo2D* getHisto2D() { return mHis; } 174 175 protected: 176 Histo2D* mHis; 177 bool mAD; 178 }; 179 180 181 182 //! Wrapper class for SOPHYA::Histo2DErr for use by PIHisto2D 183 class Histo2DErrWrapper : public P2DHistoWrapper 184 { 185 public: 186 Histo2DErrWrapper(Histo2DErr* h, bool ad=true) 187 : P2DHistoWrapper(h->NBinX(), h->NBinY()) 188 { 189 if (h == NULL) throw NullPtrError("Histo2DErrWrapper(Histo2DErr* h = NULL)"); 190 mHis = h; mAD = ad; 191 DefineXYCoordinates(h->XMin(), h->YMin(), h->WBinX(), h->WBinY() ); // pour P2DArrayAdapter 192 } 193 194 virtual ~Histo2DErrWrapper() { if (mAD) delete mHis; } 195 196 virtual int_4 NBinX() { return mHis->NBinX(); } 197 virtual int_4 NBinY() { return mHis->NBinY(); } 198 virtual r_8 XMin() { return mHis->XMin() ; } 199 virtual r_8 XMax() { return mHis->XMax() ; } 200 virtual r_8 YMin() { return mHis->YMin() ; } 201 virtual r_8 YMax() { return mHis->YMax() ; } 202 virtual r_8 WBinX() { return mHis->WBinX() ; } 203 virtual r_8 WBinY() { return mHis->WBinY() ; } 204 205 virtual void BinLowEdge(int_4 i, int_4 j, r_8& xr, r_8& yr) 206 { mHis->BinLowEdge(i, j, xr, yr); return; } 207 virtual void BinCenter(int_4 i, int_4 j, r_8& xr, r_8& yr) 208 { mHis->BinCenter(i, j, xr, yr); return; } 209 virtual void BinHighEdge(int_4 i, int_4 j, r_8& xr, r_8& yr) 210 { mHis->BinHighEdge(i, j, xr, yr); return; } 211 212 // Renvoie contenu du bin i 213 virtual r_8 Content(int_4 i, int_4 j) { return (*mHis)(i,j) ; } 214 virtual r_8 Error(int_4 i, int_4 j) { return mHis->Error(i,j) ; } 215 virtual r_8 NbEntries(int_4 i, int_4 j) { return mHis->NEntBin(i,j) ; } // $CHECK$ CMV OK ? 216 217 // Methode de mise a jour du contenu 218 // virtual void Update() $CHECK$ CMV a supprimer ? 219 220 // ajoute des lignes de texte avec les infos statistiques (dans text) 221 // renvoie le nombre de lignes ajoutees - avec implementation par defaut 222 virtual int GetStatInfoAsText(vector<string> & text ) 223 { 224 // $CHECK$ CMV , faut-il completer ? 225 char label[64]; 226 string s; 227 sprintf(label,"NCorrel= %d", mHis->NCorrel()); 228 text.push_back(label); 229 return 1; 230 } 231 232 inline Histo2DErr* getHisto2DErr() { return mHis; } 233 234 protected: 235 Histo2DErr* mHis; 236 bool mAD; 237 }; 238 115 239 } // Fin du namespace 116 240
Note:
See TracChangeset
for help on using the changeset viewer.