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

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

Center Image et Cur-LastWdg - Reza 9/9/99

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