[165] | 1 | // This may look like C code, but it is really -*- C++ -*-
|
---|
| 2 | // Classe de services destinee a NamedObjMgr pour piapp
|
---|
| 3 | // Reza Aout 98
|
---|
| 4 | // CEA-DAPNIA LAL-IN2P3/CNRS
|
---|
| 5 |
|
---|
| 6 | #ifndef SERVNOBJM_H_SEEN
|
---|
| 7 | #define SERVNOBJM_H_SEEN
|
---|
| 8 |
|
---|
[293] | 9 | #include "machdefs.h"
|
---|
[165] | 10 | #include <string>
|
---|
[295] | 11 | #include <list>
|
---|
| 12 | #include <map>
|
---|
[351] | 13 | #include <functional>
|
---|
[295] | 14 | #if defined(__KCC__)
|
---|
| 15 | using std::string ;
|
---|
| 16 | #include <list.h>
|
---|
| 17 | #include <map.h>
|
---|
[351] | 18 | #include <functional.h>
|
---|
[295] | 19 | #endif
|
---|
[165] | 20 |
|
---|
[171] | 21 | #include "pdlmgr.h"
|
---|
[165] | 22 | #include "dlftypes.h"
|
---|
[330] | 23 | #include "anydataobj.h"
|
---|
[165] | 24 |
|
---|
| 25 | class NTuple;
|
---|
| 26 | class Histo;
|
---|
| 27 | class Histo2D;
|
---|
| 28 | class HProf;
|
---|
[333] | 29 | class NamedObjMgr;
|
---|
[165] | 30 | class PIStdImgApp;
|
---|
[330] | 31 | class NObjMgrAdapter;
|
---|
[165] | 32 |
|
---|
| 33 | class Services2NObjMgr {
|
---|
| 34 | public:
|
---|
[333] | 35 | Services2NObjMgr(NamedObjMgr* omg, string& tmpdir);
|
---|
[327] | 36 | virtual ~Services2NObjMgr();
|
---|
[165] | 37 |
|
---|
[295] | 38 | // Pour enregistrer les objets de donnees et leurs adaptateurs
|
---|
| 39 | void RegisterClass(AnyDataObj* o, NObjMgrAdapter* oa);
|
---|
| 40 | // Pour recuperer l'adaptateur pour un objet o
|
---|
| 41 | NObjMgrAdapter* GetAdapter(AnyDataObj* o);
|
---|
| 42 |
|
---|
[165] | 43 | inline void SetImgApp(PIStdImgApp* app) {mImgapp = app; }
|
---|
| 44 |
|
---|
[333] | 45 | // Trace de fonctions 1-D , 2-D
|
---|
| 46 | virtual void PlotFunc(string const & expfunc, string & nom, double xmin, double xmax,
|
---|
| 47 | int np=100, string dopt="");
|
---|
| 48 | virtual void PlotFunc2D(string const & expfunc, string & nom, double xmin, double xmax,
|
---|
| 49 | double ymin, double ymax, int npx=50, int npy=50, string dopt="");
|
---|
| 50 | virtual void PlotFuncFrCFile(string const & fname, string const & func, string & nom,
|
---|
| 51 | double xmin, double xmax, int np=100, string dopt="");
|
---|
| 52 | virtual void PlotFunc2DFrCFile(string const & fname, string const & func, string & nom,
|
---|
| 53 | double xmin, double xmax, double ymin, double ymax,
|
---|
| 54 | int npx=50, int npy=50, string dopt="");
|
---|
| 55 | virtual void PlotFunc(DlFunctionOfX f, string & nom, double xmin, double xmax,
|
---|
| 56 | int np=100, string dopt="");
|
---|
| 57 | virtual void PlotFunc2D(DlFunctionOfXY f, string & nom, double xmin, double xmax,
|
---|
| 58 | double ymin, double ymax, int npx=50, int npy=50, string dopt="");
|
---|
| 59 |
|
---|
| 60 | // Trace d'expression de NTuple, et d'autres objets
|
---|
| 61 | virtual void DisplayPoints2D(string & nom, string& expx, string& expy,
|
---|
| 62 | string& experrx, string& experry,
|
---|
[357] | 63 | string& expcut, string dopt="", string loop="");
|
---|
[333] | 64 | virtual void DisplayPoints3D(string & nom, string& expx, string& expy, string& expz,
|
---|
[357] | 65 | string& expcut, string dopt="", string loop="");
|
---|
[333] | 66 | virtual void DisplayPoints2DW(string & nom, string& expx, string& expy,
|
---|
[357] | 67 | string& expwt, string& expcut, string dopt="", string loop="");
|
---|
| 68 | // Projection d'expressions dans histogramme, vecteur/matrices (et trace)
|
---|
[333] | 69 | virtual void ProjectH1(string & nom, string& expx, string& expwt, string& expcut,
|
---|
[357] | 70 | string& nomh1, string dopt="", string loop="");
|
---|
[333] | 71 | virtual void ProjectH2(string & nom, string& expx, string& expy, string& expwt,
|
---|
[357] | 72 | string& expcut, string& nomh2, string dopt="", string loop="");
|
---|
[333] | 73 | virtual void ProjectHProf(string & nom, string& expx, string& expy, string& expwt,
|
---|
[357] | 74 | string& expcut, string& nomprof, string dopt="", string loop="");
|
---|
| 75 |
|
---|
| 76 | // Remplissage de vecteurs, ntuples, GFD
|
---|
| 77 | virtual void FillVect(string & nom, string& expx, string& expv, string& expcut,
|
---|
| 78 | string& nomvec, string dopt="", string loop="");
|
---|
| 79 | virtual void FillMatx(string & nom, string& expx, string& expy, string& expv,
|
---|
| 80 | string& expcut, string& nommtx, string dopt="", string loop="");
|
---|
| 81 |
|
---|
| 82 | virtual void ExpressionToVector(string & nom, string& expx, string& expcut,
|
---|
| 83 | string& nomvec, string dopt="", string loop="");
|
---|
[333] | 84 | virtual void FillNT(string & nom, string& expx, string& expy, string& expz,
|
---|
[357] | 85 | string& expt, string& expcut, string& nomnt, string loop="");
|
---|
[333] | 86 | virtual void FillGFD(string & nom, string& expx, string& expy, string& expz,
|
---|
[357] | 87 | string& experr, string& expcut, string& nomgfd, string loop="");
|
---|
[333] | 88 | virtual void FillNTFrCFile(string & nom, string const & fname,
|
---|
[357] | 89 | string const & funcname, string & nomnt, string loop="");
|
---|
[333] | 90 | virtual void PrepareNTExpressionCFile(string & nomobj, string const & fname,
|
---|
| 91 | string const & funcname);
|
---|
| 92 |
|
---|
| 93 | // Methodes de fit - CMV , deux methodes H1 H2 ou 1 seule ??) ...
|
---|
| 94 | virtual void Fit12D(string & nom, string& func,
|
---|
| 95 | string par,string step,string min,string max,string opt);
|
---|
| 96 |
|
---|
| 97 | // Calcul d'expressions d'interface NTuple pour les objets
|
---|
| 98 | void ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy,
|
---|
[357] | 99 | string& expz, string& expt, string& expcut, string& loop,
|
---|
[333] | 100 | NTuple* nt=NULL, Histo* h1=NULL,
|
---|
| 101 | Histo2D* h2=NULL, HProf* hp=NULL);
|
---|
| 102 | PlotExprFunc LinkExprFunc(string& vardec, string& expx, string& expy,
|
---|
| 103 | string& expz, string& expt, string& cut);
|
---|
[326] | 104 | DlFunction LinkFunctionFromFile(string const & fname, string const & funcname);
|
---|
[165] | 105 | void CloseDLL();
|
---|
| 106 |
|
---|
[326] | 107 | // Utilitaires divers
|
---|
[357] | 108 | static void DecodeLoopParameters(string& loop, int& i1, int& i2, int& di);
|
---|
| 109 | int DecodeDispOption(string& dopt, bool& fgsrgr);
|
---|
[165] | 110 | string FileName2Name(string const & fn);
|
---|
[333] | 111 | char* PClassIdToClassName(int cid);
|
---|
[165] | 112 |
|
---|
[295] | 113 | protected:
|
---|
[165] | 114 | void InitGrAttNames();
|
---|
| 115 |
|
---|
[295] | 116 | // Pour enregister les objets et leurs adaptateurs pour NamedObjMgr
|
---|
| 117 | struct dataobj_adapter {
|
---|
| 118 | AnyDataObj* obj; NObjMgrAdapter* obja;
|
---|
| 119 | };
|
---|
| 120 | typedef list<dataobj_adapter> ObjAdaptList;
|
---|
| 121 | ObjAdaptList objadaplist;
|
---|
| 122 |
|
---|
[165] | 123 | // Variables membre , en public pour le moment
|
---|
| 124 | struct gratt_item {
|
---|
| 125 | int a1, a2;
|
---|
| 126 | };
|
---|
| 127 | typedef map<string, gratt_item, less<string> > GrAttNames;
|
---|
[295] | 128 |
|
---|
[165] | 129 | // Pour les changements d'attributs graphiques / de visualisation
|
---|
| 130 | GrAttNames GrAcolors;
|
---|
| 131 | GrAttNames GrAlines;
|
---|
| 132 | GrAttNames GrAmarkers;
|
---|
| 133 | GrAttNames GrAfonts;
|
---|
| 134 | GrAttNames GrAcmap;
|
---|
| 135 | GrAttNames GrAzoom;
|
---|
[203] | 136 | GrAttNames GrAaxes;
|
---|
[165] | 137 |
|
---|
[171] | 138 | PDynLinkMgr * dynlink; // shared-lib lib.so
|
---|
| 139 | string TmpDir; // Pour fichiers temporaires
|
---|
[165] | 140 |
|
---|
| 141 | PIStdImgApp* mImgapp;
|
---|
[333] | 142 | NamedObjMgr* mOmg;
|
---|
[165] | 143 |
|
---|
| 144 | };
|
---|
| 145 |
|
---|
| 146 |
|
---|
| 147 | #endif
|
---|