Changeset 3145 in Sophya for trunk/SophyaPI/PIext/phistwrapper.h


Ignore:
Timestamp:
Jan 18, 2007, 5:33:46 PM (19 years ago)
Author:
ansari
Message:

1/ Petites modifs ds PIHisto et le P1DHistoWrapper - en particulier decodage des options et choix renvoi BinContent/Error/NEntries
2/ Codage Wrapper pour Histo-2D et modifs PIHisto2D
3/ Suppression des adaptateurs de tableaux PI des Histos2D ds pipodrw.h .cc, les
Wrappers d'histos heritant de P1D,P2DArrayAdapter
4/ Mise a jour Makefile et smakefile

Reza , 18/01/2007

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/phistwrapper.h

    r3135 r3145  
    99#include <string>
    1010#include <vector>
     11#include "parradapter.h"
    1112
    1213
    1314//! Wrapper class interface for 1d-histogram like objects , used by PIHisto
    1415// methodes par defaut dans pihisto.cc
    15 class P1DHistoWrapper
     16class P1DHistoWrapper : public P1DArrayAdapter
    1617{
    1718public:
    18   P1DHistoWrapper();
     19  P1DHistoWrapper(int asz);  // asz: taille du tableau pour P1DArrayAdapter
    1920  virtual ~P1DHistoWrapper();
    2021
     
    2930
    3031  // Renvoie contenu du bin i
    31   virtual r_8 Value(int_4 i) = 0;
     32  virtual r_8 Content(int_4 i) = 0;
    3233  virtual r_8 Error(int_4 i) = 0;
    3334  virtual r_8 NbEntries(int_4 i) = 0;
    3435
    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
    3646  // Methode de mise a jour du contenu
    3747  // avec implementation par defaut - ne faisant rien
     
    4555//   l'implementation par defaut ds le fichier pihisto.cc
    4656  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;
    4759
    4860protected:
    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};
    5064
     65//-----------------------------------------------------------------------------
     66
     67//! Wrapper class interface for 2d-histogram like objects , used by PIHisto2D
     68// methodes par defaut dans pihisto2d.cc
     69class P2DHistoWrapper : public P2DArrayAdapter
     70{
     71public:
     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
     116protected:
     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
    51119};
    52120
    53121
     122
     123
    54124#endif
Note: See TracChangeset for help on using the changeset viewer.