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

Last change on this file since 1131 was 1131, checked in by ercodmgr, 25 years ago

Introduction de l'option graphique tit/notit (methodes ds PIStdImgApp, modifs ds baseexcut.cc et ds servnobjmgr.cc - Reza 22/08/2000

File size: 49.7 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
12#include "pistdimgapp.h"
13#include "nobjmgr.h"
14#include "servnobjm.h"
15
16#include "histos.h"
17#include "histos2.h"
18#include "hisprof.h"
19#include "ntuple.h"
20#include "generaldata.h"
21
22#ifdef SANS_EVOLPLANCK
23#include "cvector.h"
24#else
25#include "tvector.h"
26#endif
27
28
29/* --Methode-- */
30PIABaseExecutor::PIABaseExecutor(PIACmd* piac, NamedObjMgr* omg, PIStdImgApp* app)
31{
32mpiac = piac;
33mObjMgr = omg;
34mImgApp = app;
35dynlink = NULL;
36RegisterCommands();
37}
38
39PIABaseExecutor::~PIABaseExecutor()
40{
41}
42
43
44
45/* --Methode-- */
46int PIABaseExecutor::Execute(string& kw, vector<string>& tokens)
47{
48Services2NObjMgr* srvo = mObjMgr->GetServiceObj();
49// >>>>> Chargement de modules
50if (kw == "loadmodule") {
51 if (tokens.size() < 2) { cout << "Usage: loadmodule fnameso modulename" << endl; return(0); }
52 mpiac->LoadModule(tokens[0], tokens[1]);
53 }
54// >>>>>>>>>>> Fenetre graphique , changement d'attributs graphiques
55else if (kw == "zone") {
56 while (tokens.size() < 2) tokens.push_back("1");
57 int nx, ny;
58 nx = ny = 1;
59 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str());
60 mObjMgr->SetGraphicWinZone(nx, ny, false);
61 }
62else if (kw == "newwin") {
63 if (tokens.size() < 2) { cout << "Usage: newwin nx ny" << endl; return(0); }
64 int nx, ny;
65 nx = ny = 1;
66 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str());
67 mObjMgr->SetGraphicWinZone(nx, ny, true);
68 }
69else if (kw == "stacknext") mImgApp->StackWinNext();
70else if (kw == "graphicatt") {
71 if (tokens.size() < 1) { cout << "Usage: graphicatt attributes_list (att=def->defaut)" << endl; return(0); }
72 mObjMgr->SetGraphicAttributes(tokens[0]);
73 }
74else if (kw == "setxylimits") {
75 if (tokens.size() < 4) { cout << "Usage: setxylimits xmin xmax ymin ymax" << endl; return(0); }
76 double xmin = atof(tokens[0].c_str());
77 double xmax = atof(tokens[1].c_str());
78 double ymin = atof(tokens[2].c_str());
79 double ymax = atof(tokens[3].c_str());
80 mImgApp->SetXYLimits(xmin, xmax, ymin, ymax);
81 }
82else if (kw == "setinsetlimits") {
83 if (tokens.size() < 4) { cout << "Usage: setinsetlimits xmin xmax ymin ymax" << endl; return(0); }
84 double xmin = atof(tokens[0].c_str());
85 double xmax = atof(tokens[1].c_str());
86 double ymin = atof(tokens[2].c_str());
87 double ymax = atof(tokens[3].c_str());
88 mImgApp->SetInsetLimits(xmin, xmax, ymin, ymax);
89 }
90else if (kw == "setimgcenter") {
91 if (tokens.size() < 2) { cout << "Usage: setimgcenter xc yc" << endl; return(0); }
92 int xc = atoi(tokens[0].c_str());
93 int yc = atoi(tokens[1].c_str());
94 mImgApp->SetImageCenterPosition(xc, yc);
95 }
96else if (kw == "addtext") {
97 if (tokens.size() < 4) { cout << "Usage: addtext x y colfontatt txt" << endl; return(0); }
98 double xp = atof(tokens[0].c_str());
99 double yp = atof(tokens[1].c_str());
100 bool fgsr = true;
101 string txt = tokens[3];
102 for(int k=4; k<tokens.size(); k++) txt += (' ' + tokens[k]);
103 int opt = mObjMgr->GetServiceObj()->DecodeDispOption(tokens[2], fgsr);
104 mImgApp->AddText(txt, xp, yp);
105 if (fgsr) mImgApp->RestoreGraphicAtt();
106 }
107else if (kw == "settitle") {
108 if (tokens.size() < 2) { cout << "Usage: addtitle fontatt titleup " << endl; return(0); }
109 bool fgsr = true;
110 int opt = mObjMgr->GetServiceObj()->DecodeDispOption(tokens[0], fgsr);
111 string txt = tokens[1];
112 for(int k=2; k<tokens.size(); k++) txt += (' ' + tokens[k]);
113 string td = "";
114 mImgApp->SetTitle(txt, td);
115 if (fgsr) mImgApp->RestoreGraphicAtt();
116 }
117
118// >>>>>>>>>>> Link dynamique de fonctions C++
119else if (kw == "link" ) {
120 if (tokens.size() < 2) { cout << "Usage: link fnameso f1 [f2 f3]" << endl; return(0); }
121 string sph = "";
122 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
123 int rc = LinkUserFuncs(tokens[0], tokens[1], tokens[2], tokens[3]);
124 if (rc == 0) cout << "PIABaseExecutor: Link from " << tokens[0] << " OK " << endl;
125}
126else if (kw == "call" ) {
127 if (tokens.size() < 1) { cout << "Usage: call userf [arg1 arg2 ...]" << endl; return(0); }
128 UsFmap::iterator it = usfmap.find(tokens[0]);
129 if (it == usfmap.end()) {
130 cerr << "PIABaseExecutor: No User Function " << tokens[0] << endl;
131 return(0);
132 }
133 cout << "PIABaseExecutor: Call " << tokens[0] << "( ... )" << endl;
134// on est oblige de faire un cast etant donne qu'on
135// utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
136 DlUserProcFunction fuf = (DlUserProcFunction)(*it).second;
137// On redirige la sortie sur le terminal
138 bool red = mImgApp->HasRedirectedStdOutErr();
139 mImgApp->RedirectStdOutErr(false);
140 TRY {
141 tokens.erase(tokens.begin());
142 fuf(tokens);
143 } CATCH(merr) {
144 fflush(stdout);
145 cout << endl;
146 cerr << endl;
147//CMV_A_FAIRE string es = PeidaExc(merr);
148//CMV_A_FAIRE cerr << "PIABaseExecutor: Call UserFunc Exception :" << merr << es;
149 }
150 mImgApp->RedirectStdOutErr(red);
151}
152
153// >>>>>>>>>>> lecture/ecriture des objets, gestion des objets
154else if (kw == "openfits" ) {
155 if (tokens.size() < 1) { cout << "Usage: openfits file " << endl; return(0); }
156 else { string nomobj = ""; mObjMgr->ReadFits(tokens[0], nomobj); }
157}
158else if (kw == "savefits" ) {
159 if (tokens.size() < 2) { cout << "Usage: savefits nameobj filename " << endl; return(0); }
160 else mObjMgr->SaveFits(tokens[0], tokens[1]);
161}
162else if (kw == "openppf" ) {
163 if (tokens.size() < 1) { cout << "Usage: openppf file " << endl; return(0); }
164 mObjMgr->ReadAll(tokens[0]);
165}
166else if (kw == "saveobjs" ) {
167 if (tokens.size() < 2) { cout << "Usage: saveobjs patt filename " << endl; return(0); }
168 mObjMgr->SaveObjects(tokens[0], tokens[1]);
169}
170else if (kw == "saveall" ) {
171 if (tokens.size() < 1) { cout << "Usage: saveall file " << endl; return(0); }
172 mObjMgr->SaveAll(tokens[0]);
173}
174else if (kw == "print" ) {
175 if (tokens.size() < 1) { cout << "Usage: print nameobj " << endl; return(0); }
176 mObjMgr->PrintObj(tokens[0]);
177}
178else if ( (kw == "rename" ) || (kw == "mv") ) {
179 if (tokens.size() < 2) { cout << "Usage: rename nameobj namenew" << endl; return(0); }
180 mObjMgr->RenameObj(tokens[0], tokens[1]);
181}
182else if ( (kw == "del" ) || (kw == "rm") ) {
183 if (tokens.size() < 1) { cout << "Usage: del nameobj " << endl; return(0); }
184 mObjMgr->DelObj(tokens[0]);
185}
186else if (kw == "delobjs" ) {
187 if (tokens.size() < 1) { cout << "Usage: delobjs nomobjpattern (*,?) " << endl; return(0); }
188 mObjMgr->DelObjects(tokens[0]);
189}
190else if ( (kw == "listobjs") || (kw == "ls") ) {
191 if (tokens.size() < 1) tokens.push_back("*");
192 mObjMgr->ListObjs(tokens[0]);
193}
194// Gestion des repertoires
195else if (kw == "mkdir" ) {
196 if (tokens.size() < 1) { cout << "Usage: mkdir dirname [true]" << endl; return(0); }
197 bool crd = mObjMgr->CreateDir(tokens[0]);
198 if ( crd && (tokens.size() > 1) && (tokens[1] == "true") )
199 mObjMgr->SetKeepOldDirAtt(tokens[0], true);
200 }
201else if (kw == "rmdir" ) {
202 if (tokens.size() < 1) { cout << "Usage: rmdir dirname " << endl; return(0); }
203 mObjMgr->DeleteDir(tokens[0]);
204 }
205else if (kw == "cd") {
206 if (tokens.size() < 1) tokens.push_back("home");
207 mObjMgr->SetCurrentDir(tokens[0]);
208 }
209else if (kw == "pwd") {
210 string dirn;
211 mObjMgr->GetCurrentDir(dirn);
212 cout << "CurrentDirectory: " << dirn << endl;
213 }
214else if (kw == "listdirs") {
215 if (tokens.size() < 1) tokens.push_back("*");
216 mObjMgr->ListDirs(tokens[0]);
217 }
218
219// >>>>>>>>>>> Creation d'histos 1D-2D
220else if (kw == "newh1d") {
221 if (tokens.size() < 4) { cout << "Usage: newh1d name xmin xmax nbin" << endl; return(0); }
222 int_4 nbx = 100;
223 r_8 xmin = 0., xmax = 1.;
224 nbx = atoi(tokens[3].c_str());
225 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
226 Histo* h = new Histo(xmin, xmax, nbx);
227 mObjMgr->AddObj(h, tokens[0]);
228 }
229else if (kw == "newh2d") {
230 if (tokens.size() < 7) {
231 cout << "Usage: newh2d name xmin xmax nbinx ymin ymax nbiny" << endl;
232 return(0);
233 }
234 int_4 nbx = 50, nby = 50;
235 r_8 xmin = 0., xmax = 1.;
236 r_8 ymin = 0., ymax = 1.;
237 nbx = atoi(tokens[3].c_str());
238 nby = atoi(tokens[6].c_str());
239 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
240 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
241 Histo2D* h = new Histo2D(xmin, xmax, nbx, ymin, ymax, nby);
242 mObjMgr->AddObj(h, tokens[0]);
243 }
244else if (kw == "newprof" || kw == "newprofe") {
245 if (tokens.size() < 4)
246 { cout << "Usage: newprof[e] name xmin xmax nbin [ymin ymax]" << endl; return(0); }
247 int_4 nbx = 100;
248 r_8 xmin = 0., xmax = 1., ymin = 1., ymax = -1.;
249 if(tokens.size() > 5)
250 {ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());}
251 nbx = atoi(tokens[3].c_str());
252 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
253 HProf* h = new HProf(xmin, xmax, nbx, ymin, ymax);
254 if(kw == "newprofe") h->SetErrOpt(false);
255 mObjMgr->AddObj(h, tokens[0]);
256 }
257
258// Creation de NTuple
259else if (kw == "newnt") {
260 if(tokens.size() < 2)
261 {cout<<"Usage: newnt name v1 v2 ... vn / newnt name nvar"<<endl; return(0);}
262 vector<string> varname;
263 int nvar = 0;
264 const char *c = tokens[1].c_str();
265 if(isdigit(c[0])) {
266 nvar = atoi(tokens[1].c_str());
267 if(nvar<=0 || nvar>=10000)
268 {cout<<"newnt name nvar : nvar must be an positive integer<10000"<<endl;
269 return(0);}
270 for(int i=0;i<nvar;i++) {
271 char str[16]; sprintf(str,"%d",i);
272 string dum = "v"; dum += str;
273 varname.push_back(dum.c_str());
274 }
275 } else if( islower(c[0]) || isupper(c[0]) ) {
276 for(int i=1;i<tokens.size();i++) {
277 varname.push_back(tokens[i].c_str());
278 nvar++;
279 }
280 } else {
281 cout<<"newnt name v1 v2 ... vn : name vi must begin by a letter"<<endl
282 <<"newnt name nvar : nvar must be an positive integer"<<endl;
283 return(0);
284 }
285 char **noms = new char*[nvar];
286 for(int i=0;i<nvar;i++) noms[i] = (char *)varname[i].c_str();
287 NTuple* nt = new NTuple(nvar,noms);
288 delete [] noms;
289 mObjMgr->AddObj(nt,tokens[0]);
290 }
291
292// Creation de GeneralFitData
293else if (kw == "newgfd") {
294 if (tokens.size() < 3)
295 { cout << "Usage: newgfd nvar nalloc [errx(0/1)]" << endl; return(0); }
296 int nvar, nalloc, errx=0;
297 if (tokens.size() > 3)
298 { errx = atoi(tokens[3].c_str()); if(errx>0) errx=1; else errx = 0;}
299 nvar = atoi(tokens[1].c_str()); nalloc = atoi(tokens[2].c_str());
300 if(nvar>0 && nalloc>0) {
301 GeneralFitData* gfd = new GeneralFitData(nvar,nalloc,errx);
302 mObjMgr->AddObj(gfd, tokens[0]);
303 }
304 }
305
306// Creation/remplissage de vecteur et de matrice
307else if (kw == "newvec") {
308 if (tokens.size() < 2) {
309 cout << "Usage: newvec name size [f(i) dopt] " << endl; return(0);
310 }
311 int n = atoi(tokens[1].c_str());
312 double xmin, xmax;
313 xmin = 0.; xmax = n;
314 if (tokens.size() < 3) {
315 Vector* v = new Vector(n);
316 mObjMgr->AddObj(v, tokens[0]);
317 }
318 else {
319 if (tokens.size() < 4) tokens.push_back("");
320 mObjMgr->GetServiceObj()->PlotFunc(tokens[2], tokens[0], xmin, xmax, n, tokens[3]);
321 }
322 }
323else if (kw == "newmtx") {
324 if (tokens.size() < 3) {
325 cout << "Usage: newvec name sizeX(Col) sizeY(Lines) [f(i,j) dopt] " << endl; return(0);
326 }
327 int nx = atoi(tokens[1].c_str());
328 int ny = atoi(tokens[2].c_str());
329 double xmin, xmax, ymin, ymax;
330 xmin = 0.; xmax = nx;
331 ymin = 0.; ymax = ny;
332 if (tokens.size() < 4) {
333 Matrix* mtx = new Matrix(ny,nx);
334 mObjMgr->AddObj(mtx, tokens[0]);
335 }
336 else {
337 if (tokens.size() < 5) tokens.push_back("n");
338 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[3], tokens[0], xmin, xmax, ymin, ymax,
339 nx, ny, tokens[4]);
340 }
341 }
342
343// Copie d'objets
344else if (kw == "copy") {
345 if(tokens.size()<2) {
346 cout<<"Usage: copy name_from name_to"<<endl;return(0);
347 }
348 mObjMgr->CopyObj(tokens[0],tokens[1]);
349}
350
351
352// >>>>>>>>>>> Affichage des objets
353else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
354 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
355 string opt = "n";
356 if (tokens.size() > 1) opt = tokens[1];
357 if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
358 else if (kw == "surf") mObjMgr->DisplaySurf3D(tokens[0], opt);
359 else if (kw == "imag") mObjMgr->DisplayImage(tokens[0], opt);
360 }
361
362else if (kw == "nt2d") {
363 if (tokens.size() < 3) {
364 cout << "Usage: nt2d nameobj varx vary [errx erry wt label opt]" << endl;
365 return(0);
366 }
367 while (tokens.size() < 8) tokens.push_back("");
368 string ph = "";
369 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], ph, tokens[3], tokens[4], ph,
370 tokens[5], tokens[6], tokens[7], false);
371 }
372else if (kw == "nt3d") {
373 if (tokens.size() < 7) {
374 cout << "Usage: nt3d nameobj varx vary varz [errx erry errz wt label opt]" << endl;
375 return(0);
376 }
377 while (tokens.size() < 10) tokens.push_back("");
378 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], tokens[3], tokens[4], tokens[5],
379 tokens[6], tokens[7], tokens[8], tokens[9], true);
380 }
381
382// Obsolete : ne pas virer SVP, cmv 26/7/99
383else if (kw == "gfd2d") {
384 cout<<"----- gfd2d OBSOLETE: utilisez nt2d -----"<<endl;
385 if(tokens.size()<2)
386 {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
387 return(0);}
388 string numvary = "";
389 string err = "";
390 string opt = "n";
391 if(tokens.size()>2) err = tokens[2];
392 if(tokens.size()>3) opt = tokens[3];
393 mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
394 }
395else if (kw == "gfd3d") {
396 cout<<"----- gfd3d OBSOLETE: utilisez nt3d -----"<<endl;
397 if(tokens.size()<3)
398 {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
399 return(0);}
400 string err = "";
401 string opt = "n";
402 if(tokens.size()>3) err = tokens[3];
403 if(tokens.size()>4) opt = tokens[4];
404 mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
405 }
406
407// >>>>>>>>>>> Trace de fonctions
408else if ( (kw == "func") ) {
409 if (tokens.size() < 4) { cout << "Usage: func f(x) xmin xmax npt [opt]" << endl; return(0); }
410 string opt = "";
411 if (tokens.size() > 4) opt = tokens[4];
412 int np;
413 double xmin, xmax;
414 np = 100;
415 xmin = 0.; xmax = 1.;
416 np = atoi(tokens[3].c_str());
417 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
418 string nom = "";
419 mObjMgr->GetServiceObj()->PlotFunc(tokens[0], nom, xmin, xmax, np, opt);
420 }
421else if ( (kw == "funcff") ) {
422 if (tokens.size() < 5) { cout << "Usage: funcff C-filename f(x)-name xmin xmax npt [opt]" << endl; return(0); }
423 string opt = "";
424 if (tokens.size() > 5) opt = tokens[5];
425 int np;
426 double xmin, xmax;
427 np = 100;
428 xmin = 0.; xmax = 1.;
429 np = atoi(tokens[4].c_str());
430 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
431 string nom = "";
432 mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], nom, xmin, xmax, np, opt);
433 }
434else if ( (kw == "func2d") ) {
435 if (tokens.size() < 7) {
436 cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [opt]" << endl;
437 return(0);
438 }
439 int npx, npy;
440 double xmin, xmax;
441 double ymin, ymax;
442 npx = npy = 50;
443 xmin = 0.; xmax = 1.;
444 ymin = 0.; ymax = 1.;
445 npx = atoi(tokens[3].c_str());
446 npy = atoi(tokens[6].c_str());
447 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
448 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
449 string opt = "";
450 if (tokens.size() > 7) opt = tokens[7];
451 string nom = "";
452 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
453 }
454else if ( (kw == "func2dff") ) {
455 if (tokens.size() < 8) {
456 cout << "Usage: func2d C-filename F(x,y)-name xmax nptx ymin ymax npty [opt]" << endl;
457 return(0);
458 }
459 int npx, npy;
460 double xmin, xmax;
461 double ymin, ymax;
462 npx = npy = 50;
463 xmin = 0.; xmax = 1.;
464 ymin = 0.; ymax = 1.;
465 npx = atoi(tokens[4].c_str());
466 npy = atoi(tokens[7].c_str());
467 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
468 ymin = atof(tokens[5].c_str()); ymax = atof(tokens[6].c_str());
469 string opt = "";
470 if (tokens.size() > 8) opt = tokens[8];
471 string nom = "";
472 mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
473 }
474
475// >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
476else if (kw == "plot2d" ) {
477 if (tokens.size() < 3) {
478 cout << "Usage: plot2d nameobj expx expy [expcut opt loop_par]" << endl;
479 return(0);
480 }
481 string errx = ""; string erry = "";
482 if (tokens.size() < 4) tokens.push_back("1");
483 while (tokens.size() < 6) tokens.push_back("");
484 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,tokens[3],tokens[4],tokens[5]);
485 }
486
487else if (kw == "plot2de" ) { // Plot2D avec les erreurs
488 if (tokens.size() < 5) {
489 cout << "Usage: plot2de nameobj expx expy experrx experry [expcut opt loop_par]" << endl;
490 return(0);
491 }
492 if (tokens.size() < 6) tokens.push_back("1");
493 while (tokens.size() < 8) tokens.push_back("");
494 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4],
495 tokens[5],tokens[6],tokens[7]);
496 }
497
498else if (kw == "plot2dw" ) { // Plot2d avec poids
499 if (tokens.size() < 4) {
500 cout << "Usage: plot2dw nomobj expx expy expwt [expcut opt loop_par]" << endl;
501 return(0);
502 }
503 if (tokens.size() < 5) tokens.push_back("1");
504 while (tokens.size() < 7) tokens.push_back("");
505 srvo->DisplayPoints2DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
506 }
507else if (kw == "plot3d" ) {
508 if (tokens.size() < 4) {
509 cout << "Usage: plot3d nomobj expx expy expz [expcut opt loop_par]" << endl;
510 return(0);
511 }
512 if (tokens.size() < 5) tokens.push_back("1");
513 while (tokens.size() < 7) tokens.push_back("");
514 srvo->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
515 }
516
517else if (kw == "projh1d" ) {
518 if (tokens.size() < 3) {
519 cout << "Usage: projh1d nomh1 nomobj expx [expwt expcut opt loop_par]" << endl;
520 return(0);
521 }
522 if (tokens.size() < 4) tokens.push_back("1.");
523 if (tokens.size() < 5) tokens.push_back("1");
524 while (tokens.size() < 7) tokens.push_back("");
525 srvo->ProjectH1(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
526 }
527
528
529// Projection dans histogrammes
530else if (kw == "projh2d" ) {
531 if (tokens.size() < 4) {
532 cout << "Usage: projh2d nomh2 nomobj expx expy [expwt expcut opt loop_par]" << endl;
533 return(0);
534 }
535 if (tokens.size() < 5) tokens.push_back("1.");
536 if (tokens.size() < 6) tokens.push_back("1");
537 while (tokens.size() < 8) tokens.push_back("");
538 srvo->ProjectH2(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
539 tokens[6], tokens[7] );
540 }
541
542else if (kw == "projprof" ) {
543 if (tokens.size() < 4) {
544 cout << "Usage: projprof nomprof nomobj expx expy [expwt expcut opt loop_par]" << endl;
545 return(0);
546 }
547 if (tokens.size() < 5) tokens.push_back("1.");
548 if (tokens.size() < 6) tokens.push_back("1");
549 while (tokens.size() < 8) tokens.push_back("");
550 srvo->ProjectHProf(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
551 tokens[6], tokens[7] );
552 }
553
554// Projection dans vector/matrix
555else if (kw == "fillvec" ) {
556 if (tokens.size() < 4) {
557 cout << "Usage: fillvec nomvec nomobj expx expv [expcut opt loop_par]" << endl;
558 return(0);
559 }
560 if (tokens.size() < 5) tokens.push_back("1");
561 while (tokens.size() < 7) tokens.push_back("");
562 srvo->FillVect(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
563 }
564
565else if (kw == "fillmtx" ) {
566 if (tokens.size() < 5) {
567 cout << "Usage: fillmtx nommtx nomobj expx expy expv [expcut opt loop_par]" << endl;
568 return(0);
569 }
570 if (tokens.size() < 6) tokens.push_back("1");
571 while (tokens.size() < 8) tokens.push_back("");
572 srvo->FillMatx(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
573 tokens[6], tokens[7] );
574 }
575
576// Remplissage NTuple,Vecteurs, ... , boucle de NTuple
577else if (kw == "ntfrascii" ) {
578 if(tokens.size() < 2) {
579 cout<<"Usage: ntfrascii nt_name file_name [def_init_val]"<<endl;
580 return(0);
581 }
582 double def_val = 0.;
583 if(tokens.size()>=3) def_val = atof(tokens[2].c_str());
584 srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val);
585 }
586
587else if (kw == "fillnt" ) {
588 if (tokens.size() < 5) {
589 cout << "Usage: fillnt nameobj expx expy expz expt [expcut ntname loop_par]" << endl;
590 return(0);
591 }
592 while (tokens.size() < 8) tokens.push_back("");
593 srvo->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], tokens[7] );
594 }
595
596else if (kw == "ntloop" ) {
597 if (tokens.size() < 3) {
598 cout << "Usage: ntloop nameobj fname funcname [ntname loop_par ]" << endl;
599 return(0);
600 }
601 while (tokens.size() < 5) tokens.push_back("");
602 srvo->FillNTFrCFile(tokens[0],tokens[1], tokens[2], tokens[3], tokens[4]);
603 }
604
605else if (kw == "ntexpcfile" ) {
606 if (tokens.size() < 3) {
607 cout << "Usage: ntexpcfile nameobj fname funcname" << endl;
608 return(0);
609 }
610 srvo->PrepareNTExpressionCFile(tokens[0],tokens[1], tokens[2]);
611 }
612
613else if (kw == "exptovec" ) {
614 if (tokens.size() < 3) {
615 cout << "Usage: exptovec nomvec nameobj expx [expcut opt loop_par]" << endl;
616 return(0);
617 }
618 while (tokens.size() < 6) tokens.push_back("");
619 srvo->ExpressionToVector(tokens[1],tokens[2],tokens[3],tokens[0],tokens[4],tokens[5]);
620 }
621
622else if (kw == "fillgd1" ) {
623 if (tokens.size() < 5) {
624 cout << "Usage: fillgd1 nomgfd nomobj expx expy experry [expcut loop_par] " << endl;
625 return(0);
626 }
627 if (tokens.size() < 6) tokens.push_back("1");
628 if (tokens.size() < 7) tokens.push_back("");
629 string expy = "";
630 srvo->FillGFD(tokens[1],tokens[2], expy, tokens[3], tokens[4], tokens[5], tokens[0]);
631 }
632
633else if (kw == "fillgd2" ) {
634 if (tokens.size() < 6) {
635 cout << "Usage: fillgd2 nomgfd nomobj expx expy expz experrz [expcut loop_par]" << endl;
636 return(0);
637 }
638 if (tokens.size() < 7) tokens.push_back("1");
639 if (tokens.size() < 8) tokens.push_back("");
640 srvo->FillGFD(tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6], tokens[0], tokens[7]);
641 }
642
643else if (kw == "gdfrvec" ) {
644 if(tokens.size()<3) {
645 cout<<"Usage: gdfrvec namegfd X Y\n"
646 <<" gdfrvec namegfd X Y"
647 <<" gdfrvec namegfd X Y ! EY\n"
648 <<" gdfrvec namegfd X Y Z\n"
649 <<" gdfrvec namegfd X Y Z EZ"<<endl;
650 return(0);
651 }
652 while(tokens.size()<5) tokens.push_back("!");
653 srvo->FillGFDfrVec(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4]);
654 }
655
656
657else {
658 cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
659 return(-1);
660 }
661
662return(0);
663}
664
665// Fonction pour enregistrer le Help des Widgets et Windows de piapp
666static void RegisterPIGraphicsHelp(PIACmd* piac);
667
668/* --Methode-- */
669void PIABaseExecutor::RegisterCommands()
670{
671string kw, usage;
672kw = "loadmodule";
673usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
674usage += "\n Related commands: link";
675mpiac->RegisterCommand(kw, usage, this, "External Modules");
676kw = "link";
677usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
678usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
679usage += "\n Related commands: call loadmodule";
680mpiac->RegisterCommand(kw, usage, this, "External Modules");
681kw = "call";
682usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
683usage += "\n User function : f(vector<string>& args)";
684usage += "\n Related commands: link";
685mpiac->RegisterCommand(kw, usage, this, "External Modules");
686
687kw = "zone";
688usage = "To Divide the Graphic window \n Usage: zone [nx=1 ny=1]";
689usage += "\n Related commands: newwin";
690mpiac->RegisterCommand(kw, usage, this, "Graphics");
691kw = "newwin";
692usage = "To Create a New Graphic window, with zones \n Usage: newwin nx ny";
693usage += "\n Related commands: zone";
694mpiac->RegisterCommand(kw, usage, this, "Graphics");
695kw = "stacknext";
696usage = "Displays the next widget on stack window \n Usage: stacknext";
697mpiac->RegisterCommand(kw, usage, this, "Graphics");
698
699kw = "graphicatt";
700usage = "To change default graphic options \n Usage: graphicatt att_list \n";
701usage += "att_list=def back to default values, Example: gratt red,circlemarker5";
702usage += "\n ------------------ Graphic attribute list ------------------ \n";
703usage += ">> Colors: defcol black white grey red blue green yellow magenta cyan \n";
704usage += " turquoise navyblue orange siennared purple limegreen gold \n";
705usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n";
706usage += " thickdashedline dottedline thindottedline thickdottedline \n";
707usage += ">> Fonts: deffont normalfont boldfont italicfont smallfont smallboldfont \n";
708usage += " smallitalicfont bigfont bigboldfont bigitalicfont \n";
709usage += " hugefont hugeboldfont hugeitalicfont \n";
710usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker <T> \n";
711usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
712usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n";
713usage += " with <T> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ... \n";
714usage += ">> ColorTables: defcmap grey32 invgrey32 colrj32 colbr32 \n";
715usage += " grey128 invgrey128 colrj128 colbr128 \n";
716usage += " midas_pastel midas_heat midas_rainbow3 midas_bluered\n";
717usage += " midas_bluewhite midas_redwhite \n";
718usage += " rainbow16 \n";
719usage += ">> ZoomFactors: defzoom zoomx1 zoomx2 zoomx3 zoomx4 zoomx5 \n";
720usage += " zoom/2 zoom/3 zoom/4 zoom/5 \n";
721usage += ">> Image centering: centerimg -> Position the image in widget \n";
722usage += ">> Axes: stdaxes=defaxes=boxaxes simpleaxes boxaxesgrid \n";
723usage += " fineaxes grid=fineaxesgrid \n";
724usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
725usage += ">> XYLimits : xylimits -> Forces X-Y limits in 2-D plots \n";
726usage += ">> stat/nostat or stats/nostats -> Toggle statistic display flag \n";
727usage += ">> title/notitle or tit/notit -> Toggle Auto AddTitle flag \n";
728usage += ">> DisplayWindow: next same win stack inset \n";
729usage += " Related commands: setxylimits setinsetlimits setimgcenter";
730mpiac->RegisterCommand(kw, usage, this, "Graphics");
731
732kw = "setxylimits";
733usage = "Define 2-D plot limits \n Usage: setxylimits xmin xmax ymin ymax";
734usage += "\n Related commands: graphicatt /xylimits";
735mpiac->RegisterCommand(kw, usage, this, "Graphics");
736
737kw = "setinsetlimits";
738usage = "Define the display rectangle for drawers added as insets \n";
739usage += " over existing graphic objects - limits expressed as fraction \n";
740usage += " graphic object size (0. .. 1.) Xmax at right, YMax top. ";
741usage += " Usage: setinsetlimits xmin xmax ymin ymax";
742usage += "\n Related commands: graphicatt /inset";
743mpiac->RegisterCommand(kw, usage, this, "Graphics");
744
745kw = "setimgcenter";
746usage = "Define image center postion \n Usage: setimgcenter xc yc";
747usage += "\n Related commands: graphicatt /centerimg";
748mpiac->RegisterCommand(kw, usage, this, "Graphics");
749
750kw = "addtext";
751usage = "Adds a text string to the current graphic object";
752usage += "\n at the specified position (Gr-Object Coordinate) with graphic attribute specification";
753usage += "\n Usage: addtext x y ColFontAtt TextString";
754usage += "\n Related commands: settitle graphicatt";
755mpiac->RegisterCommand(kw, usage, this, "Graphics");
756
757kw = "settitle";
758usage = "Set the title string (top title) for the current graphic object";
759usage += "\n Usage: settitle FontAtt TopTitle";
760usage += "\n Related commands: addtext graphicatt";
761mpiac->RegisterCommand(kw, usage, this, "Graphics");
762
763RegisterPIGraphicsHelp(mpiac);
764
765kw = "openfits";
766usage = "Loads a FITS file into an Image<T> \n Usage: openfits filename";
767usage += "\n Related commands: savefits openppf";
768mpiac->RegisterCommand(kw, usage, this, "FileIO");
769kw = "savefits";
770usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
771usage += "\n Related commands: openfits saveall";
772mpiac->RegisterCommand(kw, usage, this, "FileIO");
773kw = "openppf";
774usage = "Reads all objects from a PPF file \n Usage: openppf filename";
775usage += "\n Related commands: saveall openfits";
776mpiac->RegisterCommand(kw, usage, this, "FileIO");
777kw = "saveobjs";
778usage = "Saves objects with names matching a pattern (x?y*) into a PPF file \n";
779usage += "Usage: saveobjs nameobjpattern filename";
780usage += "\n Related commands: saveall openppf savefits";
781mpiac->RegisterCommand(kw, usage, this, "FileIO");
782kw = "saveall";
783usage = "Saves all objects into a PPF file \n Usage: saveall filename";
784usage += "\n Related commands: saveobj openppf savefits";
785mpiac->RegisterCommand(kw, usage, this, "FileIO");
786kw = "ntfrascii";
787usage = "Fills an existing NTuple from ASCII table file";
788usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]";
789usage += "\n Related commands: ntloop fillnt ";
790mpiac->RegisterCommand(kw, usage, this, "FileIO");
791
792
793kw = "print";
794usage = "Prints an object \n Usage: print nameobj";
795mpiac->RegisterCommand(kw, usage, this, "FileIO");
796
797kw = "mkdir";
798usage = "Create a directory";
799usage += "\n Usage: mkdir dirname [true]";
800usage += "\n if second argument==true, the directory's KeepOld attribute is set to true";
801mpiac->RegisterCommand(kw, usage, this, "Object Management");
802kw = "rmdir";
803usage = "Removes an empty directory";
804usage += "\n Usage: remove dirname";
805mpiac->RegisterCommand(kw, usage, this, "Object Management");
806kw = "cd";
807usage = "Change current directory";
808usage += "\n Usage: cd [dirname]";
809mpiac->RegisterCommand(kw, usage, this, "Object Management");
810kw = "pwd";
811usage = "Prints current directory";
812usage += "\n Usage: pwd";
813mpiac->RegisterCommand(kw, usage, this, "Object Management");
814kw = "listdirs";
815usage = "Prints the list of directories";
816usage += "\n Usage: listdirs [patt=*] \n patt : * , ? ";
817mpiac->RegisterCommand(kw, usage, this, "Object Management");
818kw = "listobjs";
819usage = "Prints the list of objects (Alias: ls)";
820 usage += "\n Usage: listobjs [patt=*] \n patt : /*/x?y* ... ";
821mpiac->RegisterCommand(kw, usage, this, "Object Management");
822kw = "rename";
823usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew";
824usage += "\n Related commands: del delobjs";
825mpiac->RegisterCommand(kw, usage, this, "Object Management");
826kw = "copy";
827usage = "Copy objects \n";
828usage +=" Usage: copy name_from name_to";
829usage += "\n Related commands: new...";
830mpiac->RegisterCommand(kw, usage, this, "Object Management");
831kw = "del";
832usage = "Deletes an object (Alias: rm) \n Usage: del nameobj";
833usage += "\n Related commands: delobjs rename";
834mpiac->RegisterCommand(kw, usage, this, "Object Management");
835kw = "delobjs";
836usage = "Delete a set of objects with names matching a pattern (x?y*)";
837usage += "\n Usage: delobjs nameobjpattern \n";
838usage += "\n Related commands: del rename";
839mpiac->RegisterCommand(kw, usage, this, "Object Management");
840
841kw = "newh1d";
842usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
843usage += "\n Related commands: newh2d newprof[e] newnt newgfd ";
844mpiac->RegisterCommand(kw, usage, this, "Objects");
845kw = "newh2d";
846usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
847usage += "\n Related commands: newh1d newprof[e] newnt newgfd ";
848mpiac->RegisterCommand(kw, usage, this, "Objects");
849kw = "newprof";
850usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
851usage += "\n Errors represent the data spread in the X bin ";
852usage += "\n Related commands: newh1d newh2d newprofe newnt newgfd ";
853mpiac->RegisterCommand(kw, usage, this, "Objects");
854kw = "newprofe";
855usage = "Creates a profile histogramm \n Usage: newprofe name xmin xmax nbin [ymin ymax]";
856usage += "\n Errors represent the error on the data mean in the X bin ";
857usage += "\n Related commands: newh1d newh2d newprof newnt newgfd ";
858mpiac->RegisterCommand(kw, usage, this, "Objects");
859kw = "newnt";
860usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn";
861usage += "\n newnt name nvar";
862usage += "\n Related commands: newh1d newh2d newprof[e] newgfd ";
863mpiac->RegisterCommand(kw, usage, this, "Objects");
864kw = "newgfd";
865usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
866usage += "\n Related commands: newh1d newh2d newprof[e] newnt ";
867mpiac->RegisterCommand(kw, usage, this, "Objects");
868kw = "newvec";
869usage = "Creates (and optionaly fills) a vector \n Usage: newvec name size [f(i) [dopt] ] ";
870usage += "\n Related commands: newmtx";
871mpiac->RegisterCommand(kw, usage, this, "Objects");
872kw = "newmtx";
873usage = "Creates (and optionaly fills) a matrix \n";
874usage +=" Usage: newvec name sizeX(Col) sizeY(Lines) [f(i,j) [dopt] ] ";
875usage += "\n Related commands: newvec";
876mpiac->RegisterCommand(kw, usage, this, "Objects");
877
878kw = "disp";
879usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
880usage += "\n Related commands: surf nt2d nt3d ";
881mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
882kw = "imag";
883usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
884usage += "\n Related commands: disp surf nt2d nt3d ";
885mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
886kw = "surf";
887usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
888usage += "\n Related commands: disp nt2d nt3d ";
889mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
890kw = "nt2d";
891usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
892usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
893usage += "\n Related commands: disp surf nt3d gfd2d ";
894mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
895kw = "nt3d";
896usage = "Displays 3D-Points (X-Y-Z) [with error-bars / Weight / Label ] from an NTuple ";
897usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz wt label graphic_attributes]";
898usage += "\n Related commands: disp surf nt2d gfd3d ";
899mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
900
901// Ceci est maintenant obsolete, on garde pour info.
902kw = "gfd2d";
903usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
904usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
905usage += "\n Related commands: gfd3d nt2d nt3d ";
906usage += "\n ----- OBSOLETE: utilisez nt2d -----";
907mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
908kw = "gfd3d";
909usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
910usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
911usage += "\n Related commands: gfd2d nt2d nt3d ";
912usage += "\n ----- OBSOLETE: utilisez nt3d -----";
913mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
914
915kw = "func";
916usage = "Displays a function y=f(x) (Fills a vector with function values)";
917usage += "\n Usage: func f(x) xmin xmax npt [graphic_attributes]";
918usage += "\n Related commands: funcff func2d func2dff ";
919mpiac->RegisterCommand(kw, usage, this, "Func Plot");
920kw = "funcff";
921usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
922usage += "\n Usage: funcff C-FileName FunctionName xmin xmax npt [graphic_attributes]";
923usage += "\n Related commands: func func2d func2dff ";
924mpiac->RegisterCommand(kw, usage, this, "Func Plot");
925kw = "func2d";
926usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
927usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
928usage += "\n Related commands: func";
929mpiac->RegisterCommand(kw, usage, this, "Func Plot");
930kw = "func2dff";
931usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
932usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
933usage += "\n Related commands: func funcff func2d ";
934mpiac->RegisterCommand(kw, usage, this, "Func Plot");
935
936kw = "ObjectExpressions";
937usage = "Any mathematical expression (math.h) with object variables can be used";
938usage += "\n ------ Object Variable names (double) -------- ";
939usage += "\nNTuple varnames - Histo1D/HProf: i,x,val,err - Histo2D: i,j,x,y,val,err";
940usage += "\nVector: i,val - Matrix: i,j,val - Image: x=i,y=j, pix=val";
941usage += "\nLoop parameters can be specified as I1[:I2[:DI]] for(int i=I1; i<I2; i+=DI)";
942usage += "\nThe default Cut() expression in true (=1) for all";
943usage += "\n Related commands: plot2d plot2de plot2dw plot3d ";
944usage += "\n projh1d projh2d projprof fillvec fillmtx ";
945usage += "\n fillnt fillgd1 fillgd2 ntloop exptovec ... ";
946mpiac->RegisterCommand(kw, usage, NULL, "Expr. Plotting");
947kw = "plot2d";
948usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
949usage += "\n Usage: plot2d nameobj f_X() g_Y() [f_Cut() graphic_attributes loop_param]";
950usage += "\n Related commands: plot2de plot2dw plot3d ObjectExpressions ...";
951mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
952kw = "plot2de";
953usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) ";
954usage += "\n Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]";
955usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
956mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
957kw = "plot2dw";
958usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) ";
959usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() [Cut() graphic_attributes loop_param]";
960usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
961mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
962kw = "plot3d";
963usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
964usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() [Cut() graphic_attributes loop_param]";
965usage += "\n Related commands: plot2d plot2dw plot2de plot3d ObjectExpressions ...";
966mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
967
968kw = "projh1d";
969usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
970usage += "\n Usage: projh1d nameh1d nameobj f_X() [h_WT()=1. Cut() graphic_attributes loop_param]";
971usage += "\n Histo1D nameh1d is created if necessary ";
972usage += "\n Related commands: projh2d projprof ObjectExpressions ...";
973mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
974kw = "projh2d";
975usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
976usage += "\n Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
977usage += "\n Histo2D nameh2d is created if necessary ";
978usage += "\n Related commands: projh1d projprof ObjectExpressions ...";
979mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
980kw = "projprof";
981usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
982usage += "\n Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
983usage += "\n HProf nameprof is created if necessary ";
984usage += "\n Related commands: projh1d projh2d ObjectExpressions ...";
985mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
986kw = "fillvec";
987usage = "Fills a Vector V((int)(f_X(Object)+0.5)) = h_V(Object) ";
988usage += "\n Usage: fillvec namevec nameobj f_X() h_V() [Cut() graphic_attributes loop_param]";
989usage += "\n Related commands: fillmtx fillnt ObjectExpressions ...";
990mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
991kw = "fillmtx";
992usage = "Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) = h_V(Object) ";
993usage += "\n Usage: fillvec namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]";
994usage += "\n Related commands: fillvec fillnt ObjectExpressions ...";
995mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
996
997kw = "fillnt";
998usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
999usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]";
1000usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof ";
1001usage += "\n Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...";
1002mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1003
1004kw = "ntloop";
1005usage = "Loops over an Object NTupleInterface calling a function from a C-file \n";
1006usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
1007usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]";
1008usage += "\n Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...";
1009usage += "\n Related commands: ntexpcfile fillnt";
1010mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1011
1012kw = "ntexpcfile";
1013usage = "Creates a C-File with declarations suitable to be used for ntloop";
1014usage += "\n Usage: ntexpcfile nameobj CFileName FuncName ";
1015usage += "\n Related commands: ntloop";
1016mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1017
1018kw = "exptovec";
1019usage = "Creates and Fills a Vector with X=f(Object)";
1020usage += "\n Usage: exptovec namevec nameobj f_X() [Cut() graphic_attributes loop_param]";
1021usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1022mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1023kw = "fillgd1";
1024usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
1025usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_ErrY() [Cut() loop_param]";
1026usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1027mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1028kw = "fillgd2";
1029usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
1030usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]";
1031usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1032mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1033kw = "gdfrvec";
1034usage = "Fills a GeneralFitData with vectors X,Y,Z,EZ";
1035usage += "\n Usage: gdfrvec namegfd X Y";
1036usage += "\n Usage: gdfrvec namegfd X Y ! EY";
1037usage += "\n Usage: gdfrvec namegfd X Y Z";
1038usage += "\n Usage: gdfrvec namegfd X Y Z EZ";
1039usage += "\n Related commands: fillgd1 fillgd2 ...";
1040mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1041
1042}
1043
1044/* --Methode-- */
1045int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
1046// string& func4, string& func5)
1047{
1048string cmd;
1049
1050if (dynlink) delete dynlink; dynlink = NULL;
1051usfmap.clear();
1052
1053dynlink = new PDynLinkMgr(fnameso, true);
1054if (dynlink == NULL) {
1055 string sn = fnameso;
1056 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
1057 return(2);
1058 }
1059
1060int nok=0;
1061// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1062// DlUserProcFunction f = NULL;
1063DlFunction f = NULL;
1064if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1065// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
1066f = dynlink->GetFunction(func1);
1067if (f) { nok++; usfmap[func1] = f; }
1068else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
1069
1070if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1071// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
1072f = dynlink->GetFunction(func2);
1073if (f) { nok++; usfmap[func2] = f; }
1074else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
1075
1076if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1077// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
1078f = dynlink->GetFunction(func3);
1079if (f) { nok++; usfmap[func3] = f; }
1080else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
1081
1082/* Pb compile g++ 2.7.2
1083if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
1084// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
1085f = dynlink->GetFunction(func4);
1086if (f) { nok++; usfmap[func4] = f; }
1087else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
1088
1089if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
1090// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
1091f = dynlink->GetFunction(func5);
1092if (f) { nok++; usfmap[func5] = f; }
1093else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
1094*/
1095fin:
1096if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
1097else return(0);
1098}
1099
1100/* Nouvelle-Fonction */
1101void RegisterPIGraphicsHelp(PIACmd* piac)
1102{
1103string kw,grp,usage;
1104
1105grp = "Graphics";
1106
1107kw = "PIImage";
1108usage = "Manages the display of a 2-D array (P2DArrayAdapter) as an image \n";
1109usage += "and controls a zoom widget, as well as a global image view widget \n";
1110usage += ">>>> Mouse controls : \n";
1111usage += "o Button-1: Display current coordinates and pixel value\n";
1112usage += " Position the cursor an refresh the zoom widget\n";
1113usage += "o Button-2: Defines an image zone and positions the cursor \n";
1114usage += "o Button-3: Moves the viewed portion of the array inside the window \n";
1115usage += ">>>> Keyboard controls : \n";
1116usage += "o <Alt>R : Refresh display \n";
1117usage += "o <Alt>O : Shows the PIImageTools (image display parameter controls) \n";
1118usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of overlayed graphics (Drawers)) \n";
1119usage += "o <Alt>V : Copy/Paste / Text paste at the current cursor position \n";
1120usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
1121usage += "o <Alt>X : Show/Hide the Cut Window \n";
1122usage += "o <Alt>Z : Removes signs overlayed on image (Drawer 0) \n";
1123usage += "o Cursor keys : Moves the image cursor \n";
1124piac->RegisterHelp(kw, usage, grp);
1125
1126kw = "PIScDrawWdg";
1127usage = "Manages display of 2-D drawers with interactive zoom \n";
1128usage += ">>>> Mouse controls : \n";
1129usage += "o Button-1: Display current coordinates \n";
1130usage += "o Button-2: Defines a rectangle for zoom \n";
1131usage += "o Button-3: Defines a rectangle for Text-Info (<Alt>I) \n";
1132usage += ">>>> Keyboard controls : \n";
1133usage += "o <Alt>R : Refresh display \n";
1134usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
1135usage += " Specific controls for 2-D histograms \n";
1136usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1137usage += " Drawer 0 manages the axes, as well as the added text \n";
1138usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
1139usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
1140usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle\n";
1141usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1";
1142usage += "o Cursor keys : Moves the image cursor \n";
1143piac->RegisterHelp(kw, usage, grp);
1144
1145kw = "PIDraw3DWdg";
1146usage = "Manages display of 3-D objects (drawers) \n";
1147usage += ">>>> Mouse controls : \n";
1148usage += "o Button-2: Rotates the observer (camera) around object \n";
1149usage += "o Shift-Button-2: Rotates object with camera fixed \n";
1150usage += " The object rotation mode can be assigned to Button-2 with <Alt>S \n";
1151usage += "o Button-3: Zoom control (Camera distance And/Or view angle) \n";
1152usage += ">>>> Keyboard controls : \n";
1153usage += "o <Alt>R : Resets the 3-D view and refreshes the display \n";
1154usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1155usage += "o <Alt>O : = <Alt>G \n";
1156usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
1157usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
1158usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
1159usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
1160piac->RegisterHelp(kw, usage, grp);
1161
1162kw = "Windows";
1163usage = "Objects can be displayed in different windows, or overlayed on the \n";
1164usage += "previous display. The graphics attributes next,win,stack,same control \n";
1165usage += "the display window. \n";
1166usage += "o GraphicWindow : This is the default mode (gr_att=next)\n";
1167usage += " Graphic windows can be divided int zones. Object is displayed \n";
1168usage += " in the next available position, removing a previously displayed \n";
1169usage += " widget if necessary \n";
1170usage += "o Window : An object is displayed in its own window (gr_att= win) \n";
1171usage += "o StackWindow : multpile widgets can be stacked in a StackWindow (gr_att= stack) \n";
1172usage += " A single widget is displayed a any time. Different widgets in a StackWindow \n";
1173usage += " can be displayed using the stacknext command, as well as the StackTools item \n";
1174usage += " in the Tools menu (from Menubar). An automatic cyclic display mode can also \n";
1175usage += " be activated using the StackTools menu (Blink) \n";
1176usage += "o Most objects can be also be displayed overlayed \n";
1177usage += " on the last displayed widget (gr_att= same) \n";
1178usage += "o The overlay can be on a selected rectangle of the \n";
1179usage += " last displayed widget (gr_att= inset) - See setinsetlimits\n";
1180usage += "\n Related commands: newwin zone stacknext graphicatt setinsetlimits";
1181piac->RegisterHelp(kw, usage, grp);
1182
1183kw = "PIConsole";
1184usage = "Text output area and command editing window (console) \n";
1185usage += ">>>> Mouse controls : \n";
1186usage += "o Button-1: Rectangle selection for copy/paste \n";
1187usage += "o Button-2: Paste text in the command editing line \n";
1188usage += "o Button-3: activate display option menu \n";
1189usage += ">>>> Keyboard controls : \n";
1190usage += "o <Alt>O : activate display option menu \n";
1191usage += "o <Alt>V : Paste text in the command editing line \n";
1192usage += "o <Alt>A : Selection of the whole window for copy \n";
1193usage += "o <Alt>L : Command history (List of command history buffer) \n";
1194usage += "o <Ctl>A : Command editing -> Goto the beginning of line \n";
1195usage += "o <Ctl>E : Command editing -> Goto the end of line \n";
1196usage += "o <Ctl>K : Command editing -> Clear to the end of line \n";
1197usage += "o <Ctl>C : Command editing -> Clear the line \n";
1198usage += "o Cursor left,right : Command editing -> Move cursor \n";
1199usage += "o Cursor Up,Down : recall command from history buffer \n";
1200usage += "o Backspace,Del : Command editing \n";
1201usage += "o <Return>,<Enter> : Execute command \n";
1202piac->RegisterHelp(kw, usage, grp);
1203}
Note: See TracBrowser for help on using the repository browser.