source: Sophya/trunk/SophyaPI/PIext/pipodrw.cc@ 2460

Last change on this file since 2460 was 584, checked in by ercodmgr, 26 years ago

Modifs pour SOPHYA , TMatrix, PixelMap, ... Reza 17/11/99

File size: 2.9 KB
RevLine 
[165]1// Adaptateurs et Drawers divers pour Outils PEIDA++
2// R. Ansari 06-08/98
3// LAL (Orsay) / IN2P3-CNRS DAPNIA/SPP (Saclay) / CEA
4
5#include "pipodrw.h"
6#include "generalfit.h"
7
8
9//================================================================
10// PIGFFDrawer
11//================================================================
12
13PIGFFDrawer::PIGFFDrawer(GeneralFunction* f)
14: mFunc(f), mNParms(f->NPar()), mParms(new double[mNParms])
15{
16 ASSERT(f->NVar() == 1);
17}
18
19PIGFFDrawer::~PIGFFDrawer()
20{
21 delete[] mParms;
22}
23
24void
25PIGFFDrawer::SetParms(double const* p)
26{
27 for (int i=0; i<mNParms; i++)
28 mParms[i] = p[i];
29}
30
31
32void
[205]33PIGFFDrawer::Draw(PIGraphicUC* g, double /*xmin*/, double/*ymin*/, double/*xmax*/, double/*ymax*/)
[165]34{
35 PIGrCoord x1, x2, y1, y2;
36 g->GetGrSpace(x1, x2, y1, y2);
[205]37 double xMax = x2;
38 double xMin = x1;
39 double yMax = y2;
40 double yMin = y1;
41 double xStep = (xMax - xMin)/100;
42 double xOld = xMin;
43 double yOld = 0;
44// double yOld = f->Value(&xMin, mParms);
45 for (double x = xMin+xStep; x<xMax; x+=xStep) {
46 double y = 0; // $CHECK$
47// double y = f->Value(&x, mParms);
[165]48 if (y>yMin && yOld>yMin &&
49 y<yMax && yOld<yMax)
50 g->DrawLine(xOld, yOld, x, y);
51 xOld = x;
52 yOld = y;
53 }
54}
55
[584]56
[165]57// ----------------------------------------------------------
[584]58// Adaptateur d'Histo-2D Peida++ a P2DArrayAdapter
[165]59// ----------------------------------------------------------
60
61/* --Methode-- */
[584]62POH2DAdapter::POH2DAdapter(Histo2D* h2d, bool ad)
63 : P2DArrayAdapter(h2d->NBinX(), h2d->NBinY())
[165]64{
[584]65aDel = ad; mH2d = h2d;
66DefineXYCoordinates(h2d->XMin(), h2d->YMin(), h2d->WBinX(), h2d->WBinY() );
[165]67}
68
69/* --Methode-- */
[584]70POH2DAdapter::~POH2DAdapter()
[165]71{
[584]72if (aDel) delete mH2d;
[165]73}
74
75/* --Methode-- */
[584]76double POH2DAdapter::Value(int ix, int iy)
77{
78return((*mH2d)(ix, iy));
[165]79}
80
[584]81
82#ifdef SANS_EVOLPLANCK
83
[165]84// ----------------------------------------------------------
[584]85// Adaptateur de vecteurs Peida++ a P1DArrayAdapter
[165]86// ----------------------------------------------------------
87
88/* --Methode-- */
[584]89POVectorAdapter::POVectorAdapter(Vector* v, bool ad)
90 : P1DArrayAdapter(v->NElts())
[165]91{
[584]92aDel = ad; mVec = v;
[165]93}
94
95/* --Methode-- */
[584]96POVectorAdapter::~POVectorAdapter()
[165]97{
[584]98if (aDel) delete mVec;
[165]99}
100
101/* --Methode-- */
[584]102double POVectorAdapter::Value(int i)
103{
104return((*mVec)(i));
[165]105}
106
107// ----------------------------------------------------------
108// Adaptateur de matrice Peida++ a P2DArrayAdapter
109// Attention Y: Lignes (rows) X: Colonnes
110// ----------------------------------------------------------
111
112/* --Methode-- */
113POMatrixAdapter::POMatrixAdapter(Matrix* mtx, bool ad)
114 : P2DArrayAdapter(mtx->NCol(), mtx->NRows())
115{
116aDel = ad; mMtx = mtx;
117}
118
119/* --Methode-- */
120POMatrixAdapter::~POMatrixAdapter()
121{
122if (aDel) delete mMtx;
123}
124
125/* --Methode-- */
[205]126double POMatrixAdapter::Value(int ix, int iy)
[165]127{
128// Attention MatrixAdapter(X=Colonne, Y= Row) = Matrix(row, col)
129return((*mMtx)(iy, ix));
130}
131
[584]132#endif // SANS_EVOLPLANCK
[165]133
Note: See TracBrowser for help on using the repository browser.