source: Sophya/trunk/SophyaPI/PIext/basexecut.cc@ 331

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

Ajout SetXYLimits et debut d'introduction de repertoire dans la gestion des objets nommes - Reza 28/6/99

File size: 28.4 KB
Line 
1#include "piacmd.h"
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <math.h>
6
7#include "basexecut.h"
8
9#include "pdlmgr.h"
10#include "ctimer.h"
11// #include "dlftypes.h"
12
13#include "pistdimgapp.h"
14#include "nobjmgr.h"
15#include "servnobjm.h"
16
17#include "histos.h"
18#include "histos2.h"
19#include "hisprof.h"
20#include "ntuple.h"
21#include "generaldata.h"
22
23
24
25/* --Methode-- */
26PIABaseExecutor::PIABaseExecutor(PIACmd* piac, NamedObjMgr* omg, PIStdImgApp* app)
27{
28mpiac = piac;
29mObjMgr = omg;
30mImgApp = app;
31dynlink = NULL;
32RegisterCommands();
33}
34
35PIABaseExecutor::~PIABaseExecutor()
36{
37}
38
39
40
41/* --Methode-- */
42int PIABaseExecutor::Execute(string& kw, vector<string>& tokens)
43{
44
45// >>>>> Chargement de modules
46if (kw == "loadmodule") {
47 if (tokens.size() < 2) { cout << "Usage: loadmodule fnameso modulename" << endl; return(0); }
48 mpiac->LoadModule(tokens[0], tokens[1]);
49 }
50// >>>>>>>>>>> Fenetre graphique , changement d'attributs graphiques
51else if (kw == "zone") {
52 if (tokens.size() < 2) { cout << "Usage: zone nx ny" << endl; return(0); }
53 int nx, ny;
54 nx = ny = 1;
55 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str());
56 mObjMgr->SetGraphicWinZone(nx, ny, false);
57 }
58else if (kw == "newwin") {
59 if (tokens.size() < 2) { cout << "Usage: newwin nx ny" << endl; return(0); }
60 int nx, ny;
61 nx = ny = 1;
62 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str());
63 mObjMgr->SetGraphicWinZone(nx, ny, true);
64 }
65else if (kw == "stacknext") mImgApp->StackWinNext();
66else if (kw == "gratt") {
67 if (tokens.size() < 1) { cout << "Usage: gratt attributes_list (att=def->defaut)" << endl; return(0); }
68 mObjMgr->SetGraphicAttributes(tokens[0]);
69 }
70else if (kw == "setxylimits") {
71 if (tokens.size() < 4) { cout << "Usage: setxylimits xmin xmax ymin ymax" << endl; return(0); }
72 double xmin = atof(tokens[0].c_str());
73 double xmax = atof(tokens[1].c_str());
74 double ymin = atof(tokens[2].c_str());
75 double ymax = atof(tokens[3].c_str());
76 mImgApp->SetXYLimits(xmin, xmax, ymin, ymax);
77 }
78// >>>>>>>>>>> Link dynamique de fonctions C++
79else if (kw == "link" ) {
80 if (tokens.size() < 2) { cout << "Usage: link fnameso f1 [f2 f3]" << endl; return(0); }
81 string sph = "";
82 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
83 int rc = LinkUserFuncs(tokens[0], tokens[1], tokens[2], tokens[3]);
84 if (rc == 0) cout << "PIABaseExecutor: Link from " << tokens[0] << " OK " << endl;
85}
86else if (kw == "call" ) {
87 if (tokens.size() < 1) { cout << "Usage: call userf [arg1 arg2 ...]" << endl; return(0); }
88 UsFmap::iterator it = usfmap.find(tokens[0]);
89 if (it == usfmap.end()) {
90 cerr << "PIABaseExecutor: No User Function " << tokens[0] << endl;
91 return(0);
92 }
93 cout << "PIABaseExecutor: Call " << tokens[0] << "( ... )" << endl;
94// on est oblige de faire un cast etant donne qu'on
95// utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
96 DlUserProcFunction fuf = (DlUserProcFunction)(*it).second;
97// On redirige la sortie sur le terminal
98 bool red = mImgApp->HasRedirectedStdOutErr();
99 mImgApp->RedirectStdOutErr(false);
100 TRY {
101 tokens.erase(tokens.begin());
102 fuf(tokens);
103 } CATCH(merr) {
104 fflush(stdout);
105 cout << endl;
106 cerr << endl;
107 string es = PeidaExc(merr);
108 cerr << "PIABaseExecutor: Call UserFunc Exception :" << merr << es;
109 }
110 mImgApp->RedirectStdOutErr(red);
111}
112
113// >>>>>>>>>>> lecture/ecriture des objets, gestion des objets
114else if (kw == "openfits" ) {
115 if (tokens.size() < 1) { cout << "Usage: openfits file " << endl; return(0); }
116 else { string nomobj = ""; mObjMgr->ReadFits(tokens[0], nomobj); }
117}
118else if (kw == "savefits" ) {
119 if (tokens.size() < 2) { cout << "Usage: savefits nameobj filename " << endl; return(0); }
120 else mObjMgr->SaveFits(tokens[0], tokens[1]);
121}
122else if (kw == "openppf" ) {
123 if (tokens.size() < 1) { cout << "Usage: openppf file " << endl; return(0); }
124 mObjMgr->ReadAll(tokens[0]);
125}
126else if (kw == "saveall" ) {
127 if (tokens.size() < 1) { cout << "Usage: saveall file " << endl; return(0); }
128 mObjMgr->SaveAll(tokens[0]);
129}
130else if (kw == "print" ) {
131 if (tokens.size() < 1) { cout << "Usage: print nameobj " << endl; return(0); }
132 mObjMgr->PrintObj(tokens[0]);
133}
134else if (kw == "rename" ) {
135 if (tokens.size() < 2) { cout << "Usage: rename nameobj namenew" << endl; return(0); }
136 mObjMgr->RenameObj(tokens[0], tokens[1]);
137}
138else if (kw == "del" ) {
139 if (tokens.size() < 1) { cout << "Usage: del nameobj " << endl; return(0); }
140 mObjMgr->DelObj(tokens[0]);
141}
142else if (kw == "delobjs" ) {
143 if (tokens.size() < 1) { cout << "Usage: delobjs nomobjpattern (*,?) " << endl; return(0); }
144 mObjMgr->DelObjects(tokens[0]);
145}
146else if (kw == "listobjs") {
147 if (tokens.size() < 1) tokens.push_back("*");
148 mObjMgr->ListObjs(tokens[0]);
149}
150
151// >>>>>>>>>>> Creation d'histos 1D-2D
152else if (kw == "newh1d") {
153 if (tokens.size() < 4) { cout << "Usage: newh1d name xmin xmax nbin" << endl; return(0); }
154 int nbx;
155 float xmin, xmax;
156 nbx = 100;
157 xmin = 0.; xmax = 1.;
158 nbx = atoi(tokens[3].c_str());
159 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
160 Histo* h = new Histo(xmin, xmax, nbx);
161 mObjMgr->AddObj(h, tokens[0]);
162 }
163else if (kw == "newh2d") {
164 if (tokens.size() < 7) {
165 cout << "Usage: newh2d name xmin xmax nbinx ymin ymax nbiny" << endl;
166 return(0);
167 }
168 int nbx, nby;
169 float xmin, xmax;
170 float ymin, ymax;
171 nbx = nby = 50;
172 xmin = 0.; xmax = 1.;
173 ymin = 0.; ymax = 1.;
174 nbx = atoi(tokens[3].c_str());
175 nby = atoi(tokens[6].c_str());
176 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
177 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
178 Histo2D* h = new Histo2D(xmin, xmax, nbx, ymin, ymax, nby);
179 mObjMgr->AddObj(h, tokens[0]);
180 }
181else if (kw == "newprof") {
182 if (tokens.size() < 4)
183 { cout << "Usage: newprof name xmin xmax nbin [ymin ymax]" << endl; return(0); }
184 int nbx;
185 float xmin, xmax, ymin = 1., ymax = -1.;
186 if(tokens.size() > 5)
187 {ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());}
188 nbx = 100;
189 xmin = 0.; xmax = 1.;
190 nbx = atoi(tokens[3].c_str());
191 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
192 HProf* h = new HProf(xmin, xmax, nbx, ymin, ymax);
193 mObjMgr->AddObj(h, tokens[0]);
194 }
195else if (kw == "newgfd") {
196 if (tokens.size() < 3)
197 { cout << "Usage: newgfd nvar nalloc [errx(0/1)]" << endl; return(0); }
198 int nvar, nalloc, errx=0;
199 if (tokens.size() > 3)
200 { errx = atoi(tokens[3].c_str()); if(errx>0) errx=1; else errx = 0;}
201 nvar = atoi(tokens[1].c_str()); nalloc = atoi(tokens[2].c_str());
202 if(nvar>0 && nalloc>0) {
203 GeneralFitData* gfd = new GeneralFitData(nvar,nalloc,errx);
204 mObjMgr->AddObj(gfd, tokens[0]);
205 }
206 }
207
208// >>>>>>>>>>> Affichage des objets
209else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
210 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
211 string opt = "n";
212 if (tokens.size() > 1) opt = tokens[1];
213 if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
214 else if (kw == "surf") mObjMgr->DisplaySurf3D(tokens[0], opt);
215 else if (kw == "imag") mObjMgr->DisplayImage(tokens[0], opt);
216 }
217
218else if (kw == "nt2d") {
219 if (tokens.size() < 5) { cout << "Usage: nt2d nameobj varx vary errx erry opt" << endl; return(0); }
220 string opt = "n";
221 if (tokens.size() > 5) opt = tokens[5];
222 string ph = "";
223 mObjMgr->DisplayNT(tokens[0],tokens[1],tokens[2], ph, tokens[3], tokens[4], ph, opt);
224 }
225else if (kw == "nt3d") {
226 if (tokens.size() < 7) { cout << "Usage: nt3d nameobj varx vary varz errx erry errz opt" << endl; return(0); }
227 string opt = "n";
228 if (tokens.size() > 7) opt = tokens[7];
229 mObjMgr->DisplayNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], opt);
230 }
231
232else if (kw == "gfd2d") {
233 if(tokens.size()<2)
234 {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
235 return(0);}
236 string numvary = "";
237 string err = "";
238 string opt = "n";
239 if(tokens.size()>2) err = tokens[2];
240 if(tokens.size()>3) opt = tokens[3];
241 mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
242 }
243else if (kw == "gfd3d") {
244 if(tokens.size()<3)
245 {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
246 return(0);}
247 string err = "";
248 string opt = "n";
249 if(tokens.size()>3) err = tokens[3];
250 if(tokens.size()>4) opt = tokens[4];
251 mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
252 }
253
254// >>>>>>>>>>> Trace de fonctions
255else if ( (kw == "func") ) {
256 if (tokens.size() < 4) { cout << "Usage: func f(x) xmin xmax npt [opt]" << endl; return(0); }
257 string opt = "n";
258 if (tokens.size() > 4) opt = tokens[4];
259 int np;
260 float xmin, xmax;
261 np = 100;
262 xmin = 0.; xmax = 1.;
263 np = atoi(tokens[3].c_str());
264 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
265 mObjMgr->GetServiceObj()->PlotFunc(tokens[0], xmin, xmax, np, opt);
266 }
267else if ( (kw == "funcff") ) {
268 if (tokens.size() < 5) { cout << "Usage: funcff C-filename f(x)-name xmin xmax npt [opt]" << endl; return(0); }
269 string opt = "n";
270 if (tokens.size() > 5) opt = tokens[5];
271 int np;
272 float xmin, xmax;
273 np = 100;
274 xmin = 0.; xmax = 1.;
275 np = atoi(tokens[4].c_str());
276 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
277 mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], xmin, xmax, np, opt);
278 }
279else if ( (kw == "func2d") ) {
280 if (tokens.size() < 7) {
281 cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty opt" << endl;
282 return(0);
283 }
284 int npx, npy;
285 float xmin, xmax;
286 float ymin, ymax;
287 npx = npy = 50;
288 xmin = 0.; xmax = 1.;
289 ymin = 0.; ymax = 1.;
290 npx = atoi(tokens[3].c_str());
291 npy = atoi(tokens[6].c_str());
292 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
293 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
294 string opt = "n";
295 if (tokens.size() > 7) opt = tokens[7];
296 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], xmin, xmax, ymin, ymax, npx, npy, opt);
297 }
298else if ( (kw == "func2dff") ) {
299 if (tokens.size() < 8) {
300 cout << "Usage: func2d C-filename F(x,y)-name xmax nptx ymin ymax npty opt" << endl;
301 return(0);
302 }
303 int npx, npy;
304 float xmin, xmax;
305 float ymin, ymax;
306 npx = npy = 50;
307 xmin = 0.; xmax = 1.;
308 ymin = 0.; ymax = 1.;
309 npx = atoi(tokens[4].c_str());
310 npy = atoi(tokens[7].c_str());
311 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
312 ymin = atof(tokens[5].c_str()); ymax = atof(tokens[6].c_str());
313 string opt = "n";
314 if (tokens.size() > 8) opt = tokens[8];
315 mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], xmin, xmax, ymin, ymax, npx, npy, opt);
316 }
317
318// >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
319else if (kw == "plot2d" ) {
320 if (tokens.size() < 4) {
321 cout << "Usage: plot2d nameobj expx expy [experrx experry] expcut [opt]" << endl;
322 return(0);
323 }
324 string errx = ""; string erry = ""; string ecut = "1";
325 string opt = "n";
326 if (tokens.size() < 6) { // Plot sans les erreurs
327 ecut = tokens[3];
328 if (tokens.size() > 4) opt = tokens[4];
329 }
330 else { // Plot avec les erreurs
331 errx = tokens[3]; erry = tokens[4]; ecut = tokens[5];
332 if (tokens.size() > 6) opt = tokens[6];
333 }
334 mObjMgr->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,ecut,opt);
335 }
336
337else if (kw == "plot3d" ) {
338 if (tokens.size() < 5) {
339 cout << "Usage: plot3d nomobj expx expy expz expcut opt" << endl;
340 return(0);
341 }
342 string opt = "n";
343 if (tokens.size() > 5) opt = tokens[5];
344 mObjMgr->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], opt);
345 }
346
347else if (kw == "projh1d" ) {
348 if (tokens.size() < 5) {
349 cout << "Usage: projh1d nomobj expx expwt expcut nomh1 opt" << endl;
350 return(0);
351 }
352 string opt = "n";
353 if (tokens.size() > 5) opt = tokens[5];
354 mObjMgr->ProjectH1(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], opt);
355 }
356
357else if (kw == "projh2d" ) {
358 if (tokens.size() < 6) {
359 cout << "Usage: projh2 nomobj expx expy expwt expcut nomh2 opt" << endl;
360 return(0);
361 }
362 string opt = "n";
363 if (tokens.size() > 6) opt = tokens[6];
364
365 mObjMgr->ProjectH2(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt);
366 }
367
368else if (kw == "projprof" ) {
369 if (tokens.size() < 6) {
370 cout << "Usage: projprof nomobj expx expy expwt expcut nomprof opt" << endl;
371 return(0);
372 }
373 string opt = "n";
374 if (tokens.size() > 6) opt = tokens[6];
375
376 mObjMgr->ProjectHProf(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt);
377 }
378
379else if (kw == "fillnt" ) {
380 if (tokens.size() < 7) {
381 cout << "Usage: fillnt nameobj expx expy expz expt expcut nament" << endl;
382 return(0);
383 }
384 mObjMgr->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6] );
385 }
386
387else if (kw == "fillvec" ) {
388 if (tokens.size() < 4) {
389 cout << "Usage: fillvec nameobj expx expcut nomvec opt" << endl;
390 return(0);
391 }
392 string opt = "n";
393 if (tokens.size() > 4) opt = tokens[4];
394 mObjMgr->FillVect(tokens[0],tokens[1],tokens[2], tokens[3], opt);
395 }
396
397else if (kw == "fillgd1" ) {
398 if (tokens.size() < 5) {
399 cout << "Usage: fillgd1 nomobj expx expy experry expcut nomgfd" << endl;
400 return(0);
401 }
402 string nomgfd = "";
403 if (tokens.size() > 5) nomgfd = tokens[5];
404 string expy = "";
405 mObjMgr->FillGFD(tokens[0],tokens[1], expy, tokens[2], tokens[3], tokens[4],nomgfd);
406 }
407
408else if (kw == "fillgd2" ) {
409 if (tokens.size() < 6) {
410 cout << "Usage: fillgd2 nomobj expx expy expz experrz expcut nomgfd" << endl;
411 return(0);
412 }
413 string nomgfd = "";
414 if (tokens.size() > 6) nomgfd = tokens[6];
415 mObjMgr->FillGFD(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5],nomgfd);
416 }
417
418
419// Fit 1D sur objets 1D. Egalement Fit 2D sur objets 2D.
420else if (kw == "fit") {
421 if (tokens.size() < 2) {
422 cout <<"Usage:fit nomobj func \n"
423 <<" [p:p1,...,pn s:s1,...,sn m:m1,...,mn M:M1,...,Mn o:... o:...]\n";
424 return(0);
425 }
426 string p=""; string s=""; string m=""; string M=""; string O="";
427 if (tokens.size()>2)
428 for(int ip=2;ip<tokens.size();ip++) {
429 if(tokens[ip].length()<=2) continue;
430 const char *c = tokens[ip].c_str();
431 if(c[1]!=':') continue;
432 if(c[0]=='p') p=c+2;
433 else if(c[0]=='s') s=c+2;
434 else if(c[0]=='m') m=c+2;
435 else if(c[0]=='M') M=c+2;
436 else if(c[0]=='o') {O += ","; O += c+2;}
437 }
438 mObjMgr->Fit12D(tokens[0],tokens[1],p,s,m,M,O);
439}
440
441
442else {
443 cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
444 return(-1);
445 }
446
447return(0);
448}
449
450/* --Methode-- */
451void PIABaseExecutor::RegisterCommands()
452{
453string kw, usage;
454kw = "loadmodule";
455usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
456usage += "\n Related commands: link";
457mpiac->RegisterCommand(kw, usage, this, "External Modules");
458kw = "link";
459usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
460usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
461usage += "\n Related commands: call loadmodule";
462mpiac->RegisterCommand(kw, usage, this, "External Modules");
463kw = "call";
464usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
465usage += "\n User function : f(vector<string>& args)";
466usage += "\n Related commands: link";
467mpiac->RegisterCommand(kw, usage, this, "External Modules");
468
469kw = "zone";
470usage = "To Divide the Graphic window \n Usage: zone nx ny";
471mpiac->RegisterCommand(kw, usage, this, "Graphics");
472kw = "newwin";
473usage = "To Create a New Graphic window, with zones \n Usage: newwin nx ny";
474mpiac->RegisterCommand(kw, usage, this, "Graphics");
475kw = "stacknext";
476usage = "Displays the next widget on stack window \n Usage: stacknext";
477mpiac->RegisterCommand(kw, usage, this, "Graphics");
478
479kw = "gratt";
480usage = "To change default graphic options \n Usage: gratt att_list \n";
481usage += "att_list=def back to default values, Example: gratt red,circlemarker5";
482usage += "\n ------------------ Graphic attribute list ------------------ \n";
483usage += ">> Colors: defcol black white grey red blue green yellow magenta cyan \n";
484usage += " turquoise navyblue orange siennared purple limegreen gold \n";
485usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n";
486usage += " thickdashedline dottedline thindottedline thickdottedline \n";
487usage += ">> Fonts: deffont normalfont boldfont italicfont smallfont smallboldfont \n";
488usage += " smallitalicfont bigfont bigboldfont bigitalicfont \n";
489usage += " hugefont hugeboldfont hugeitalicfont \n";
490usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker <T> \n";
491usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
492usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n";
493usage += " with <T> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ... \n";
494usage += ">> ColorTables: defcmap grey32 greyinv32 colrj32 colbr32 \n";
495usage += " grey128 greyinv128 colrj128 colbr128 \n";
496usage += ">> ZoomFactors: defzoom zoomx1 zoomx2 zoomx3 zoomx4 zoomx5 \n";
497usage += " zoom/2 zoom/3 zoom/4 zoom/5 \n";
498usage += ">> Axes: stdaxes=defaxes=boxaxes simpleaxes boxaxesgrid \n";
499usage += " fineaxes grid=fineaxesgrid \n";
500usage += ">> XYLimits : xylimits -> Forces X-Y limits in 2-D plots \n";
501usage += ">> DisplayWindow: next same win stack \n";
502usage += " Related commands: setxylimits";
503mpiac->RegisterCommand(kw, usage, this, "Graphics");
504
505kw = "setxylimits";
506usage = "Define 2-D plot limits \n Usage: setxylimits xmin xmax ymin ymax";
507usage += "\n Related commands: gratt";
508mpiac->RegisterCommand(kw, usage, this, "Graphics");
509
510kw = "openfits";
511usage = "Loads a FITS file into an Image<T> \n Usage: openfits filename";
512usage += "\n Related commands: savefits openppf";
513mpiac->RegisterCommand(kw, usage, this, "FileIO");
514kw = "savefits";
515usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
516usage += "\n Related commands: openfits saveall";
517mpiac->RegisterCommand(kw, usage, this, "FileIO");
518kw = "openppf";
519usage = "Reads all objects from a PPF file \n Usage: openppf filename";
520usage += "\n Related commands: saveall openfits";
521mpiac->RegisterCommand(kw, usage, this, "FileIO");
522kw = "saveall";
523usage = "Saves all objects into a PPF file \n Usage: saveall filename";
524usage += "\n Related commands: openppf savefits";
525mpiac->RegisterCommand(kw, usage, this, "FileIO");
526
527kw = "print";
528usage = "Prints an object \n Usage: print nameobj";
529mpiac->RegisterCommand(kw, usage, this, "FileIO");
530
531kw = "listobjs";
532usage = "Prints the list of objects";
533usage += "\n Usage: listobjs";
534mpiac->RegisterCommand(kw, usage, this, "Object Managment");
535kw = "rename";
536usage = "Rename an object \n Usage: rename nameobj namenew";
537usage += "\n Related commands: del delobjs";
538mpiac->RegisterCommand(kw, usage, this, "Object Managment");
539kw = "del";
540usage = "Deletes an object \n Usage: del nameobj";
541usage += "\n Related commands: delobjs rename";
542mpiac->RegisterCommand(kw, usage, this, "Object Managment");
543kw = "delobjs";
544usage = "Delete a set of objects with names matching a pattern (x?y*)";
545usage += "\n Usage: delobjs nameobjpattern \n";
546usage += "\n Related commands: del rename";
547mpiac->RegisterCommand(kw, usage, this, "Object Managment");
548
549kw = "newh1d";
550usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
551usage += "\n Related commands: newh2d newprof newgfd ";
552mpiac->RegisterCommand(kw, usage, this, "Histrograms");
553kw = "newh2d";
554usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
555usage += "\n Related commands: newh1d newprof newgfd ";
556mpiac->RegisterCommand(kw, usage, this, "Histrograms");
557kw = "newprof";
558usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
559usage += "\n Related commands: newh1d newh2d newgfd ";
560mpiac->RegisterCommand(kw, usage, this, "Histrograms");
561kw = "newgfd";
562usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
563usage += "\n Related commands: newh1d newh2d newprof ";
564mpiac->RegisterCommand(kw, usage, this, "Histrograms");
565
566kw = "disp";
567usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
568usage += "\n Related commands: surf nt2d nt3d ";
569mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
570kw = "imag";
571usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
572usage += "\n Related commands: disp surf nt2d nt3d ";
573mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
574kw = "surf";
575usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
576usage += "\n Related commands: disp nt2d nt3d ";
577mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
578kw = "nt2d";
579usage = "Displays Points (X-Y) [with error-bars] from an NTuple ";
580usage += "\n Usage : nt2d nameobj varx vary [errx erry] [graphic_attributes]";
581usage += "\n Related commands: disp surf nt3d gfd2d ";
582mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
583kw = "nt3d";
584usage = "Displays 3D-Points (X-Y-Z) [with error-bars] from an NTuple ";
585usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz] [graphic_attributes]";
586usage += "\n Related commands: disp surf nt2d gfd3d ";
587mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
588kw = "gfd2d";
589usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
590usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
591usage += "\n Related commands: gfd3d nt2d nt3d ";
592mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
593kw = "gfd3d";
594usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
595usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
596usage += "\n Related commands: gfd2d nt2d nt3d ";
597mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
598
599kw = "func";
600usage = "Displays a function y=f(x) (Fills a vector with function values)";
601usage += "\n Usage: func f(x) xmin xmax npt [graphic_attributes]";
602usage += "\n Related commands: funcff func2d func2dff ";
603mpiac->RegisterCommand(kw, usage, this, "Func Plot");
604kw = "funcff";
605usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
606usage += "\n Usage: funcff C-FileName FunctionName xmin xmax npt [graphic_attributes]";
607usage += "\n Related commands: func func2d func2dff ";
608mpiac->RegisterCommand(kw, usage, this, "Func Plot");
609kw = "func2d";
610usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
611usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
612usage += "\n Related commands: func";
613mpiac->RegisterCommand(kw, usage, this, "Func Plot");
614kw = "func2dff";
615usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
616usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
617usage += "\n Related commands: func funcff func2d ";
618mpiac->RegisterCommand(kw, usage, this, "Func Plot");
619
620kw = "plot2d";
621usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
622usage += "\nNTuple varnames - Histo1D/HProf: i,x,val,err - Histo2D: i,j,x,y,val,err";
623usage += "\nVector: i,val - Matrix: i,j,val - Image: x=i,y=j, pix=val";
624usage += "\n Usage: plot2d nameobj f_X() g_Y() [ f_ErrX() f_ErrY() ] f_Cut() [graphic_attributes]";
625usage += "\n Related commands: plot3d projh1d projh2d projprof fillnt fillvec fillgd1 ";
626mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
627kw = "plot3d";
628usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
629usage += "\n Usage: plot2d nameobj f_X() g_Y() h_Z() Cut() [graphic_attributes]";
630usage += "\n Related commands: plot2d projh1d projh2d projprof fillnt fillvec ";
631mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
632
633kw = "projh1d";
634usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
635usage += "\n Usage: projh1d nameobj f_X() h_WT() Cut() nameh1d [graphic_attributes]";
636usage += "\n Histo1D nameh1d is created if necessary ";
637usage += "\n Related commands: plot2d projh2d projprof fillnt fillvec ";
638mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
639kw = "projh2d";
640usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
641usage += "\n Usage: projh2d nameobj f_X() g_Y() h_WT() Cut() nameh2d [graphic_attributes]";
642usage += "\n Histo2D nameh2d is created if necessary ";
643usage += "\n Related commands: plot2d projh1d projprof ";
644mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
645kw = "projprof";
646usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
647usage += "\n Usage: projh2d nameobj f_X() g_Y() h_WT() Cut() nameprof [graphic_attributes]";
648usage += "\n HProf nameprof is created if necessary ";
649usage += "\n Related commands: plot2d projh2d ";
650mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
651
652kw = "fillnt";
653usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
654usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() Cut() nameNt";
655usage += "\n Related commands: plot2d projh1d projh2d projprof ";
656mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
657kw = "fillvec";
658usage = "Creates and Fills a Vector with X=f(Object)";
659usage += "\n Usage: fillvec nameobj f_X() Cut() nameVec [graphic_attributes]";
660usage += "\n Related commands: plot2d projh1d fillnt ";
661mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
662kw = "fillgd1";
663usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
664usage += "\n Usage: fillgd1 nameobj f_X() g_Y() h_ErrY() Cut() nameGfd";
665usage += "\n Related commands: plot2d fillnt ";
666mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
667kw = "fillgd2";
668usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
669usage += "\n Usage: fillgd1 nameobj f_X() g_Y() h_Z() k_ErrZ() Cut() nameGfd";
670usage += "\n Related commands: plot2d fillgd2 ";
671mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
672
673kw = "fit";
674usage = "Fitting function to DataObjects (Histo, Histo2D, Vector, ...)";
675usage += "\n Usage: fit nomobj func [Options]";
676usage += "\n [p:p1,...,pn s:s1,...,sn m:m1,...,mn M:M1,...,Mn o:... o:...]";
677mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
678
679
680}
681
682/* --Methode-- */
683int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
684// string& func4, string& func5)
685{
686string cmd;
687int rc;
688
689if (dynlink) delete dynlink; dynlink = NULL;
690usfmap.clear();
691
692dynlink = new PDynLinkMgr(fnameso, true);
693if (dynlink == NULL) {
694 string sn = fnameso;
695 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
696 return(2);
697 }
698
699int nok=0;
700// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
701// DlUserProcFunction f = NULL;
702DlFunction f = NULL;
703if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
704// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
705f = dynlink->GetFunction(func1);
706if (f) { nok++; usfmap[func1] = f; }
707else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
708
709if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
710// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
711f = dynlink->GetFunction(func2);
712if (f) { nok++; usfmap[func2] = f; }
713else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
714
715if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
716// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
717f = dynlink->GetFunction(func3);
718if (f) { nok++; usfmap[func3] = f; }
719else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
720
721/* Pb compile g++ 2.7.2
722if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
723// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
724f = dynlink->GetFunction(func4);
725if (f) { nok++; usfmap[func4] = f; }
726else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
727
728if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
729// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
730f = dynlink->GetFunction(func5);
731if (f) { nok++; usfmap[func5] = f; }
732else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
733*/
734fin:
735if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
736else return(0);
737}
738
Note: See TracBrowser for help on using the repository browser.