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

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

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

File size: 2.9 KB
Line 
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
33PIGFFDrawer::Draw(PIGraphicUC* g, double /*xmin*/, double/*ymin*/, double/*xmax*/, double/*ymax*/)
34{
35 PIGrCoord x1, x2, y1, y2;
36 g->GetGrSpace(x1, x2, y1, y2);
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);
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
56
57// ----------------------------------------------------------
58// Adaptateur d'Histo-2D Peida++ a P2DArrayAdapter
59// ----------------------------------------------------------
60
61/* --Methode-- */
62POH2DAdapter::POH2DAdapter(Histo2D* h2d, bool ad)
63 : P2DArrayAdapter(h2d->NBinX(), h2d->NBinY())
64{
65aDel = ad; mH2d = h2d;
66DefineXYCoordinates(h2d->XMin(), h2d->YMin(), h2d->WBinX(), h2d->WBinY() );
67}
68
69/* --Methode-- */
70POH2DAdapter::~POH2DAdapter()
71{
72if (aDel) delete mH2d;
73}
74
75/* --Methode-- */
76double POH2DAdapter::Value(int ix, int iy)
77{
78return((*mH2d)(ix, iy));
79}
80
81
82#ifdef SANS_EVOLPLANCK
83
84// ----------------------------------------------------------
85// Adaptateur de vecteurs Peida++ a P1DArrayAdapter
86// ----------------------------------------------------------
87
88/* --Methode-- */
89POVectorAdapter::POVectorAdapter(Vector* v, bool ad)
90 : P1DArrayAdapter(v->NElts())
91{
92aDel = ad; mVec = v;
93}
94
95/* --Methode-- */
96POVectorAdapter::~POVectorAdapter()
97{
98if (aDel) delete mVec;
99}
100
101/* --Methode-- */
102double POVectorAdapter::Value(int i)
103{
104return((*mVec)(i));
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-- */
126double POMatrixAdapter::Value(int ix, int iy)
127{
128// Attention MatrixAdapter(X=Colonne, Y= Row) = Matrix(row, col)
129return((*mMtx)(iy, ix));
130}
131
132#endif // SANS_EVOLPLANCK
133
Note: See TracBrowser for help on using the repository browser.