Changeset 3145 in Sophya for trunk/SophyaPI/PIext/phistwrapper.h
- Timestamp:
- Jan 18, 2007, 5:33:46 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.