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

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

Adaptation aux modifs de tables de couleurs pour attributs graphique - Reza 1/8/2000

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