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

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

modifs cosmetiques - Reza 5/11/99

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