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

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

petit pb de print pour saveobjs
intro du PPersist pour GeneralFitData

cmv 13/7/00

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