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

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

copy objects + NamedObjMgr de NTFromASCII cmv 8/10/99

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