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

Last change on this file since 1035 was 1035, checked in by ercodmgr, 25 years ago
  • creation comm newprofe pour profile avec erreur sur mean
  • correction petit bug n/plot pour increment nom histo 1d paw_n_plot1D_??? dans le cas ou on veut faire

"n/plot ..." puis "n/plot ... same"

cmv 7/6/2000

File size: 48.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
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
640
641
642else {
643 cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
644 return(-1);
645 }
646
647return(0);
648}
649
650// Fonction pour enregistrer le Help des Widgets et Windows de piapp
651static void RegisterPIGraphicsHelp(PIACmd* piac);
652
653/* --Methode-- */
654void PIABaseExecutor::RegisterCommands()
655{
656string kw, usage;
657kw = "loadmodule";
658usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
659usage += "\n Related commands: link";
660mpiac->RegisterCommand(kw, usage, this, "External Modules");
661kw = "link";
662usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
663usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
664usage += "\n Related commands: call loadmodule";
665mpiac->RegisterCommand(kw, usage, this, "External Modules");
666kw = "call";
667usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
668usage += "\n User function : f(vector<string>& args)";
669usage += "\n Related commands: link";
670mpiac->RegisterCommand(kw, usage, this, "External Modules");
671
672kw = "zone";
673usage = "To Divide the Graphic window \n Usage: zone [nx=1 ny=1]";
674usage += "\n Related commands: newwin";
675mpiac->RegisterCommand(kw, usage, this, "Graphics");
676kw = "newwin";
677usage = "To Create a New Graphic window, with zones \n Usage: newwin nx ny";
678usage += "\n Related commands: zone";
679mpiac->RegisterCommand(kw, usage, this, "Graphics");
680kw = "stacknext";
681usage = "Displays the next widget on stack window \n Usage: stacknext";
682mpiac->RegisterCommand(kw, usage, this, "Graphics");
683
684kw = "graphicatt";
685usage = "To change default graphic options \n Usage: graphicatt att_list \n";
686usage += "att_list=def back to default values, Example: gratt red,circlemarker5";
687usage += "\n ------------------ Graphic attribute list ------------------ \n";
688usage += ">> Colors: defcol black white grey red blue green yellow magenta cyan \n";
689usage += " turquoise navyblue orange siennared purple limegreen gold \n";
690usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n";
691usage += " thickdashedline dottedline thindottedline thickdottedline \n";
692usage += ">> Fonts: deffont normalfont boldfont italicfont smallfont smallboldfont \n";
693usage += " smallitalicfont bigfont bigboldfont bigitalicfont \n";
694usage += " hugefont hugeboldfont hugeitalicfont \n";
695usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker <T> \n";
696usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
697usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n";
698usage += " with <T> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ... \n";
699usage += ">> ColorTables: defcmap grey32 greyinv32 colrj32 colbr32 \n";
700usage += " grey128 greyinv128 colrj128 colbr128 \n";
701usage += ">> ZoomFactors: defzoom zoomx1 zoomx2 zoomx3 zoomx4 zoomx5 \n";
702usage += " zoom/2 zoom/3 zoom/4 zoom/5 \n";
703usage += ">> Image centering: centerimg -> Position the image in widget \n";
704usage += ">> Axes: stdaxes=defaxes=boxaxes simpleaxes boxaxesgrid \n";
705usage += " fineaxes grid=fineaxesgrid \n";
706usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
707usage += ">> XYLimits : xylimits -> Forces X-Y limits in 2-D plots \n";
708usage += ">> stat/nostat or stats/nostats -> Toggle statistic display flag \n";
709usage += ">> DisplayWindow: next same win stack inset \n";
710usage += " Related commands: setxylimits setinsetlimits setimgcenter";
711mpiac->RegisterCommand(kw, usage, this, "Graphics");
712
713kw = "setxylimits";
714usage = "Define 2-D plot limits \n Usage: setxylimits xmin xmax ymin ymax";
715usage += "\n Related commands: graphicatt /xylimits";
716mpiac->RegisterCommand(kw, usage, this, "Graphics");
717
718kw = "setinsetlimits";
719usage = "Define the display rectangle for drawers added as insets \n";
720usage += " over existing graphic objects - limits expressed as fraction \n";
721usage += " graphic object size (0. .. 1.) Xmax at right, YMax top. ";
722usage += " Usage: setinsetlimits xmin xmax ymin ymax";
723usage += "\n Related commands: graphicatt /inset";
724mpiac->RegisterCommand(kw, usage, this, "Graphics");
725
726kw = "setimgcenter";
727usage = "Define image center postion \n Usage: setimgcenter xc yc";
728usage += "\n Related commands: graphicatt /centerimg";
729mpiac->RegisterCommand(kw, usage, this, "Graphics");
730
731kw = "addtext";
732usage = "Adds a text string to the current graphic object";
733usage += "\n at the specified position (Gr-Object Coordinate) with graphic attribute specification";
734usage += "\n Usage: addtext x y ColFontAtt TextString";
735usage += "\n Related commands: graphicatt";
736mpiac->RegisterCommand(kw, usage, this, "Graphics");
737
738RegisterPIGraphicsHelp(mpiac);
739
740kw = "openfits";
741usage = "Loads a FITS file into an Image<T> \n Usage: openfits filename";
742usage += "\n Related commands: savefits openppf";
743mpiac->RegisterCommand(kw, usage, this, "FileIO");
744kw = "savefits";
745usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
746usage += "\n Related commands: openfits saveall";
747mpiac->RegisterCommand(kw, usage, this, "FileIO");
748kw = "openppf";
749usage = "Reads all objects from a PPF file \n Usage: openppf filename";
750usage += "\n Related commands: saveall openfits";
751mpiac->RegisterCommand(kw, usage, this, "FileIO");
752kw = "saveobjs";
753usage = "Saves objects with names matching a pattern (x?y*) into a PPF file \n";
754usage += "Usage: saveall nameobjpattern filename";
755usage += "\n Related commands: saveall openppf savefits";
756mpiac->RegisterCommand(kw, usage, this, "FileIO");
757kw = "saveall";
758usage = "Saves all objects into a PPF file \n Usage: saveall filename";
759usage += "\n Related commands: saveobj openppf savefits";
760mpiac->RegisterCommand(kw, usage, this, "FileIO");
761kw = "ntfrascii";
762usage = "Fills an existing NTuple from ASCII table file";
763usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]";
764usage += "\n Related commands: ntloop fillnt ";
765mpiac->RegisterCommand(kw, usage, this, "FileIO");
766
767
768kw = "print";
769usage = "Prints an object \n Usage: print nameobj";
770mpiac->RegisterCommand(kw, usage, this, "FileIO");
771
772kw = "mkdir";
773usage = "Create a directory";
774usage += "\n Usage: mkdir dirname [true]";
775usage += "\n if second argument==true, the directory's KeepOld attribute is set to true";
776mpiac->RegisterCommand(kw, usage, this, "Object Management");
777kw = "rmdir";
778usage = "Removes an empty directory";
779usage += "\n Usage: remove dirname";
780mpiac->RegisterCommand(kw, usage, this, "Object Management");
781kw = "cd";
782usage = "Change current directory";
783usage += "\n Usage: cd [dirname]";
784mpiac->RegisterCommand(kw, usage, this, "Object Management");
785kw = "pwd";
786usage = "Prints current directory";
787usage += "\n Usage: pwd";
788mpiac->RegisterCommand(kw, usage, this, "Object Management");
789kw = "listdirs";
790usage = "Prints the list of directories";
791usage += "\n Usage: listdirs [patt=*] \n patt : * , ? ";
792mpiac->RegisterCommand(kw, usage, this, "Object Management");
793kw = "listobjs";
794usage = "Prints the list of objects (Alias: ls)";
795 usage += "\n Usage: listobjs [patt=*] \n patt : /*/x?y* ... ";
796mpiac->RegisterCommand(kw, usage, this, "Object Management");
797kw = "rename";
798usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew";
799usage += "\n Related commands: del delobjs";
800mpiac->RegisterCommand(kw, usage, this, "Object Management");
801kw = "copy";
802usage = "Copy objects \n";
803usage +=" Usage: copy name_from name_to";
804usage += "\n Related commands: new...";
805mpiac->RegisterCommand(kw, usage, this, "Object Management");
806kw = "del";
807usage = "Deletes an object (Alias: rm) \n Usage: del nameobj";
808usage += "\n Related commands: delobjs rename";
809mpiac->RegisterCommand(kw, usage, this, "Object Management");
810kw = "delobjs";
811usage = "Delete a set of objects with names matching a pattern (x?y*)";
812usage += "\n Usage: delobjs nameobjpattern \n";
813usage += "\n Related commands: del rename";
814mpiac->RegisterCommand(kw, usage, this, "Object Management");
815
816kw = "newh1d";
817usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
818usage += "\n Related commands: newh2d newprof[e] newnt newgfd ";
819mpiac->RegisterCommand(kw, usage, this, "Objects");
820kw = "newh2d";
821usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
822usage += "\n Related commands: newh1d newprof[e] newnt newgfd ";
823mpiac->RegisterCommand(kw, usage, this, "Objects");
824kw = "newprof";
825usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
826usage += "\n Errors represent the data spread in the X bin ";
827usage += "\n Related commands: newh1d newh2d newprofe newnt newgfd ";
828mpiac->RegisterCommand(kw, usage, this, "Objects");
829kw = "newprofe";
830usage = "Creates a profile histogramm \n Usage: newprofe name xmin xmax nbin [ymin ymax]";
831usage += "\n Errors represent the error on the data mean in the X bin ";
832usage += "\n Related commands: newh1d newh2d newprof newnt newgfd ";
833mpiac->RegisterCommand(kw, usage, this, "Objects");
834kw = "newnt";
835usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn";
836usage += "\n newnt name nvar";
837usage += "\n Related commands: newh1d newh2d newprof[e] newgfd ";
838mpiac->RegisterCommand(kw, usage, this, "Objects");
839kw = "newgfd";
840usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
841usage += "\n Related commands: newh1d newh2d newprof[e] newnt ";
842mpiac->RegisterCommand(kw, usage, this, "Objects");
843kw = "newvec";
844usage = "Creates (and optionaly fills) a vector \n Usage: newvec name size [f(i) [dopt] ] ";
845usage += "\n Related commands: newmtx";
846mpiac->RegisterCommand(kw, usage, this, "Objects");
847kw = "newmtx";
848usage = "Creates (and optionaly fills) a matrix \n";
849usage +=" Usage: newvec name sizeX(Col) sizeY(Lines) [f(i,j) [dopt] ] ";
850usage += "\n Related commands: newvec";
851mpiac->RegisterCommand(kw, usage, this, "Objects");
852
853kw = "disp";
854usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
855usage += "\n Related commands: surf nt2d nt3d ";
856mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
857kw = "imag";
858usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
859usage += "\n Related commands: disp surf nt2d nt3d ";
860mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
861kw = "surf";
862usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
863usage += "\n Related commands: disp nt2d nt3d ";
864mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
865kw = "nt2d";
866usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
867usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
868usage += "\n Related commands: disp surf nt3d gfd2d ";
869mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
870kw = "nt3d";
871usage = "Displays 3D-Points (X-Y-Z) [with error-bars / Weight / Label ] from an NTuple ";
872usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz wt label graphic_attributes]";
873usage += "\n Related commands: disp surf nt2d gfd3d ";
874mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
875
876// Ceci est maintenant obsolete, on garde pour info.
877kw = "gfd2d";
878usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
879usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
880usage += "\n Related commands: gfd3d nt2d nt3d ";
881usage += "\n ----- OBSOLETE: utilisez nt2d -----";
882mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
883kw = "gfd3d";
884usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
885usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
886usage += "\n Related commands: gfd2d nt2d nt3d ";
887usage += "\n ----- OBSOLETE: utilisez nt3d -----";
888mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
889
890kw = "func";
891usage = "Displays a function y=f(x) (Fills a vector with function values)";
892usage += "\n Usage: func f(x) xmin xmax npt [graphic_attributes]";
893usage += "\n Related commands: funcff func2d func2dff ";
894mpiac->RegisterCommand(kw, usage, this, "Func Plot");
895kw = "funcff";
896usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
897usage += "\n Usage: funcff C-FileName FunctionName xmin xmax npt [graphic_attributes]";
898usage += "\n Related commands: func func2d func2dff ";
899mpiac->RegisterCommand(kw, usage, this, "Func Plot");
900kw = "func2d";
901usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
902usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
903usage += "\n Related commands: func";
904mpiac->RegisterCommand(kw, usage, this, "Func Plot");
905kw = "func2dff";
906usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
907usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
908usage += "\n Related commands: func funcff func2d ";
909mpiac->RegisterCommand(kw, usage, this, "Func Plot");
910
911kw = "ObjectExpressions";
912usage = "Any mathematical expression (math.h) with object variables can be used";
913usage += "\n ------ Object Variable names (double) -------- ";
914usage += "\nNTuple varnames - Histo1D/HProf: i,x,val,err - Histo2D: i,j,x,y,val,err";
915usage += "\nVector: i,val - Matrix: i,j,val - Image: x=i,y=j, pix=val";
916usage += "\nLoop parameters can be specified as I1[:I2[:DI]] for(int i=I1; i<I2; i+=DI)";
917usage += "\nThe default Cut() expression in true (=1) for all";
918usage += "\n Related commands: plot2d plot2de plot2dw plot3d ";
919usage += "\n projh1d projh2d projprof fillvec fillmtx ";
920usage += "\n fillnt fillgd1 fillgd2 ntloop exptovec ... ";
921mpiac->RegisterCommand(kw, usage, NULL, "Expr. Plotting");
922kw = "plot2d";
923usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
924usage += "\n Usage: plot2d nameobj f_X() g_Y() [f_Cut() graphic_attributes loop_param]";
925usage += "\n Related commands: plot2de plot2dw plot3d ObjectExpressions ...";
926mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
927kw = "plot2de";
928usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) ";
929usage += "\n Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]";
930usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
931mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
932kw = "plot2dw";
933usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) ";
934usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() [Cut() graphic_attributes loop_param]";
935usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
936mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
937kw = "plot3d";
938usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
939usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() [Cut() graphic_attributes loop_param]";
940usage += "\n Related commands: plot2d plot2dw plot2de plot3d ObjectExpressions ...";
941mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
942
943kw = "projh1d";
944usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
945usage += "\n Usage: projh1d nameh1d nameobj f_X() [h_WT()=1. Cut() graphic_attributes loop_param]";
946usage += "\n Histo1D nameh1d is created if necessary ";
947usage += "\n Related commands: projh2d projprof ObjectExpressions ...";
948mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
949kw = "projh2d";
950usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
951usage += "\n Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
952usage += "\n Histo2D nameh2d is created if necessary ";
953usage += "\n Related commands: projh1d projprof ObjectExpressions ...";
954mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
955kw = "projprof";
956usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
957usage += "\n Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
958usage += "\n HProf nameprof is created if necessary ";
959usage += "\n Related commands: projh1d projh2d ObjectExpressions ...";
960mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
961kw = "fillvec";
962usage = "Fills a Vector V((int)(f_X(Object)+0.5)) = h_V(Object) ";
963usage += "\n Usage: fillvec namevec nameobj f_X() h_V() [Cut() graphic_attributes loop_param]";
964usage += "\n Related commands: fillmtx fillnt ObjectExpressions ...";
965mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
966kw = "fillmtx";
967usage = "Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) = h_V(Object) ";
968usage += "\n Usage: fillvec namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]";
969usage += "\n Related commands: fillvec fillnt ObjectExpressions ...";
970mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
971
972kw = "fillnt";
973usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
974usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]";
975usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof ";
976usage += "\n Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...";
977mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
978
979kw = "ntloop";
980usage = "Loops over an Object NTupleInterface calling a function from a C-file \n";
981usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
982usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]";
983usage += "\n Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...";
984usage += "\n Related commands: ntexpcfile fillnt";
985mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
986
987kw = "ntexpcfile";
988usage = "Creates a C-File with declarations suitable to be used for ntloop";
989usage += "\n Usage: ntexpcfile nameobj CFileName FuncName ";
990usage += "\n Related commands: ntloop";
991mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
992
993kw = "exptovec";
994usage = "Creates and Fills a Vector with X=f(Object)";
995usage += "\n Usage: exptovec namevec nameobj f_X() [Cut() graphic_attributes loop_param]";
996usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
997mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
998kw = "fillgd1";
999usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
1000usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_ErrY() [Cut() loop_param]";
1001usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1002mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1003kw = "fillgd2";
1004usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
1005usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]";
1006usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1007mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1008
1009}
1010
1011/* --Methode-- */
1012int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
1013// string& func4, string& func5)
1014{
1015string cmd;
1016
1017if (dynlink) delete dynlink; dynlink = NULL;
1018usfmap.clear();
1019
1020dynlink = new PDynLinkMgr(fnameso, true);
1021if (dynlink == NULL) {
1022 string sn = fnameso;
1023 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
1024 return(2);
1025 }
1026
1027int nok=0;
1028// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1029// DlUserProcFunction f = NULL;
1030DlFunction f = NULL;
1031if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1032// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
1033f = dynlink->GetFunction(func1);
1034if (f) { nok++; usfmap[func1] = f; }
1035else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
1036
1037if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1038// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
1039f = dynlink->GetFunction(func2);
1040if (f) { nok++; usfmap[func2] = f; }
1041else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
1042
1043if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1044// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
1045f = dynlink->GetFunction(func3);
1046if (f) { nok++; usfmap[func3] = f; }
1047else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
1048
1049/* Pb compile g++ 2.7.2
1050if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
1051// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
1052f = dynlink->GetFunction(func4);
1053if (f) { nok++; usfmap[func4] = f; }
1054else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
1055
1056if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
1057// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
1058f = dynlink->GetFunction(func5);
1059if (f) { nok++; usfmap[func5] = f; }
1060else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
1061*/
1062fin:
1063if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
1064else return(0);
1065}
1066
1067/* Nouvelle-Fonction */
1068void RegisterPIGraphicsHelp(PIACmd* piac)
1069{
1070string kw,grp,usage;
1071
1072grp = "Graphics";
1073
1074kw = "PIImage";
1075usage = "Manages the display of a 2-D array (P2DArrayAdapter) as an image \n";
1076usage += "and controls a zoom widget, as well as a global image view widget \n";
1077usage += ">>>> Mouse controls : \n";
1078usage += "o Button-1: Display current coordinates and pixel value\n";
1079usage += " Position the cursor an refresh the zoom widget\n";
1080usage += "o Button-2: Defines an image zone and positions the cursor \n";
1081usage += "o Button-3: Moves the viewed portion of the array inside the window \n";
1082usage += ">>>> Keyboard controls : \n";
1083usage += "o <Alt>R : Refresh display \n";
1084usage += "o <Alt>O : Shows the PIImageTools (image display parameter controls) \n";
1085usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of overlayed graphics (Drawers)) \n";
1086usage += "o <Alt>V : Copy/Paste / Text paste at the current cursor position \n";
1087usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
1088usage += "o <Alt>X : Show/Hide the Cut Window \n";
1089usage += "o <Alt>Z : Removes signs overlayed on image (Drawer 0) \n";
1090usage += "o Cursor keys : Moves the image cursor \n";
1091piac->RegisterHelp(kw, usage, grp);
1092
1093kw = "PIScDrawWdg";
1094usage = "Manages display of 2-D drawers with interactive zoom \n";
1095usage += ">>>> Mouse controls : \n";
1096usage += "o Button-1: Display current coordinates \n";
1097usage += "o Button-2: Defines a rectangle for zoom \n";
1098usage += "o Button-3: Defines a rectangle for Text-Info (<Alt>I) \n";
1099usage += ">>>> Keyboard controls : \n";
1100usage += "o <Alt>R : Refresh display \n";
1101usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
1102usage += " Specific controls for 2-D histograms \n";
1103usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1104usage += " Drawer 0 manages the axes, as well as the added text \n";
1105usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
1106usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
1107usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle\n";
1108usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1";
1109usage += "o Cursor keys : Moves the image cursor \n";
1110piac->RegisterHelp(kw, usage, grp);
1111
1112kw = "PIDraw3DWdg";
1113usage = "Manages display of 3-D objects (drawers) \n";
1114usage += ">>>> Mouse controls : \n";
1115usage += "o Button-2: Rotates the observer (camera) around object \n";
1116usage += "o Shift-Button-2: Rotates object with camera fixed \n";
1117usage += " The object rotation mode can be assigned to Button-2 with <Alt>S \n";
1118usage += "o Button-3: Zoom control (Camera distance And/Or view angle) \n";
1119usage += ">>>> Keyboard controls : \n";
1120usage += "o <Alt>R : Resets the 3-D view and refreshes the display \n";
1121usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1122usage += "o <Alt>O : = <Alt>G \n";
1123usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
1124usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
1125usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
1126usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
1127piac->RegisterHelp(kw, usage, grp);
1128
1129kw = "Windows";
1130usage = "Objects can be displayed in different windows, or overlayed on the \n";
1131usage += "previous display. The graphics attributes next,win,stack,same control \n";
1132usage += "the display window. \n";
1133usage += "o GraphicWindow : This is the default mode (gr_att=next)\n";
1134usage += " Graphic windows can be divided int zones. Object is displayed \n";
1135usage += " in the next available position, removing a previously displayed \n";
1136usage += " widget if necessary \n";
1137usage += "o Window : An object is displayed in its own window (gr_att= win) \n";
1138usage += "o StackWindow : multpile widgets can be stacked in a StackWindow (gr_att= stack) \n";
1139usage += " A single widget is displayed a any time. Different widgets in a StackWindow \n";
1140usage += " can be displayed using the stacknext command, as well as the StackTools item \n";
1141usage += " in the Tools menu (from Menubar). An automatic cyclic display mode can also \n";
1142usage += " be activated using the StackTools menu (Blink) \n";
1143usage += "o Most objects can be also be displayed overlayed \n";
1144usage += " on the last displayed widget (gr_att= same) \n";
1145usage += "o The overlay can be on a selected rectangle of the \n";
1146usage += " last displayed widget (gr_att= inset) - See setinsetlimits\n";
1147usage += "\n Related commands: newwin zone stacknext graphicatt setinsetlimits";
1148piac->RegisterHelp(kw, usage, grp);
1149
1150kw = "PIConsole";
1151usage = "Text output area and command editing window (console) \n";
1152usage += ">>>> Mouse controls : \n";
1153usage += "o Button-1: Rectangle selection for copy/paste \n";
1154usage += "o Button-2: Paste text in the command editing line \n";
1155usage += "o Button-3: activate display option menu \n";
1156usage += ">>>> Keyboard controls : \n";
1157usage += "o <Alt>O : activate display option menu \n";
1158usage += "o <Alt>V : Paste text in the command editing line \n";
1159usage += "o <Alt>A : Selection of the whole window for copy \n";
1160usage += "o <Alt>L : Command history (List of command history buffer) \n";
1161usage += "o <Ctl>A : Command editing -> Goto the beginning of line \n";
1162usage += "o <Ctl>E : Command editing -> Goto the end of line \n";
1163usage += "o <Ctl>K : Command editing -> Clear to the end of line \n";
1164usage += "o <Ctl>C : Command editing -> Clear the line \n";
1165usage += "o Cursor left,right : Command editing -> Move cursor \n";
1166usage += "o Cursor Up,Down : recall command from history buffer \n";
1167usage += "o Backspace,Del : Command editing \n";
1168usage += "o <Return>,<Enter> : Execute command \n";
1169piac->RegisterHelp(kw, usage, grp);
1170}
Note: See TracBrowser for help on using the repository browser.