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

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

Adaptation Sophya, suppression cvector, classe ObjectFitter - Reza 2/3/2000

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