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

Last change on this file since 2265 was 2265, checked in by ansari, 23 years ago

Ajout addarca et addfarca: Trace d'arc defini par un angle et dangle + sum/product/mean/sigma ds RPNEvaluator - Reza 14/11/2002

File size: 74.1 KB
Line 
1#include "piacmd.h"
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <math.h>
6
7#include "basexecut.h"
8
9#include "pdlmgr.h"
10#include "ctimer.h"
11#include "strutilxx.h"
12
13#include "pistdimgapp.h"
14#include "nobjmgr.h"
15#include "servnobjm.h"
16#include "piyfxdrw.h"
17
18#include "histos.h"
19#include "histos2.h"
20#include "hisprof.h"
21#include "ntuple.h"
22#include "generaldata.h"
23
24#ifdef SANS_EVOLPLANCK
25#include "cvector.h"
26#else
27#include "tvector.h"
28#endif
29
30
31/* --Methode-- */
32PIABaseExecutor::PIABaseExecutor(PIACmd* piac, NamedObjMgr* omg, PIStdImgApp* app)
33{
34mpiac = piac;
35mObjMgr = omg;
36mImgApp = app;
37dynlink = NULL;
38dynlink2 = NULL;
39RegisterCommands();
40}
41
42PIABaseExecutor::~PIABaseExecutor()
43{
44 if (dynlink) delete dynlink;
45 if (dynlink2) delete dynlink2;
46}
47
48
49/* Macro pour tester si flag normalized coordinate est present */
50#define _CkBoolNC_(_jk_) ((tokens.size()>_jk_) && (tokens[_jk_] == "true")) ? true : false;
51
52/* --Methode-- */
53int PIABaseExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
54{
55Services2NObjMgr* srvo = mObjMgr->GetServiceObj();
56// ----> Sortie d'application
57if (kw == "exitpiapp") {
58 mImgApp->Stop();
59 return(0);
60}
61// >>>>> Chargement de modules
62else if (kw == "loadmodule") {
63 if (tokens.size() < 2) { cout << "Usage: loadmodule fnameso modulename" << endl; return(0); }
64 mpiac->LoadModule(tokens[0], tokens[1]);
65 }
66// >>>>>>>>>>> Fenetre graphique , changement d'attributs graphiques
67else if (kw == "zone") {
68 while (tokens.size() < 2) tokens.push_back("1");
69 int nx, ny;
70 nx = ny = 1;
71 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str());
72 if (mImgApp) mImgApp->SetZone(nx, ny);
73 }
74else if (kw == "newwin") {
75 int nx=1, ny=1;
76 int sx=0, sy=0;
77 //if(tokens.size() < 2) { cout << "Usage: newwin nx ny" << endl; return(0); }
78 if(tokens.size() > 0) nx = atoi(tokens[0].c_str());
79 if(tokens.size() > 1) ny = atoi(tokens[1].c_str());
80 if(tokens.size() > 3) {
81 sx = atoi(tokens[2].c_str());
82 sy = atoi(tokens[3].c_str());
83 }
84 if (mImgApp) mImgApp->CreateGraphWin(nx, ny, sx, sy);
85}
86else if (kw == "stacknext") mImgApp->StackWinNext();
87else if (kw == "graphicatt") {
88 if (tokens.size() < 1) { cout << "Usage: graphicatt attributes_list (att=def->defaut)" << endl; return(0); }
89 string opts = tokens[0];
90 if (tokens.size() > 1)
91 for(unsigned int kt=1; kt<tokens.size(); kt++) { opts += ' '; opts += tokens[kt]; }
92 if (mImgApp) mImgApp->SetDefaultGraphicAttributes(opts);
93 }
94else if (kw == "setaxesatt") {
95 if (tokens.size() < 1) { cout << "Usage: setaxesatt attributes_list " << endl; return(0); }
96 string opts = tokens[0];
97 if (tokens.size() > 1)
98 for(unsigned int kt=1; kt<tokens.size(); kt++) { opts += ' '; opts += tokens[kt]; }
99 if (mImgApp) mImgApp->SetDefaultAxesAttributes(opts);
100 }
101else if (kw == "setinsetlimits") {
102 if (tokens.size() < 4) { cout << "Usage: setinsetlimits xmin xmax ymin ymax" << endl; return(0); }
103 double xmin = atof(tokens[0].c_str());
104 double xmax = atof(tokens[1].c_str());
105 double ymin = atof(tokens[2].c_str());
106 double ymax = atof(tokens[3].c_str());
107 mImgApp->SetInsetLimits(xmin, xmax, ymin, ymax);
108 }
109else if (kw == "drpanel") {
110 if (tokens.size() < 4) {
111 cout << "Usage: drpanel xmin xmax ymin ymax [gratt] [name]" << endl;
112 return(0);
113 }
114 double xmin = atof(tokens[0].c_str());
115 double xmax = atof(tokens[1].c_str());
116 double ymin = atof(tokens[2].c_str());
117 double ymax = atof(tokens[3].c_str());
118 char buff[128];
119 sprintf(buff, "axesnone xylimits=%g,%g,%g,%g ", xmin, xmax, ymin, ymax);
120 string sop = buff;
121 if (tokens.size() > 4) sop += tokens[4];
122 string name;
123 if (tokens.size() > 5) name = tokens[5];
124 PIFuncDrawer* gdr = new PIFuncDrawer(NULL);
125 mImgApp->DispScDrawer(gdr, name, sop);
126}
127else if (kw == "addtext") {
128 if (tokens.size() < 3) {
129 cout << "Usage: addtext x y txt [colfontatt] [fgnc]" << endl;
130 return(0);
131 }
132 double xp = atof(tokens[0].c_str());
133 double yp = atof(tokens[1].c_str());
134 string txt = tokens[2];
135 string sop;
136 if (tokens.size() > 3) sop = tokens[3];
137 bool fgnc = _CkBoolNC_(4);
138 mImgApp->AddText(txt, xp, yp, sop, fgnc);
139 }
140else if (kw == "addctext") {
141 if (tokens.size() < 5) {
142 cout << "Usage: addctext x y txt s_up s_dn [colfontatt] [updnfatt] [fgnc] " << endl;
143 return(0);
144 }
145 double xp = atof(tokens[0].c_str());
146 double yp = atof(tokens[1].c_str());
147 string sop;
148 if (tokens.size() > 5) sop = tokens[5];
149 string sopfss;
150 if (tokens.size() > 6) sopfss = tokens[6];
151 bool fgnc = _CkBoolNC_(7);
152 mImgApp->AddCompText(tokens[2], tokens[3], tokens[4], xp, yp, sop, sopfss, fgnc);
153 }
154else if ((kw == "addline") || (kw == "addrect") || (kw == "addfrect") ||
155 (kw == "addarrow") ) {
156 if (tokens.size() < 4) {
157 cout << "Usage: addline/addrect/addfrect x1 y1 x2 y2 [colatt] [fgnc]" << endl;
158 return(0);
159 }
160 double xp1 = atof(tokens[0].c_str());
161 double yp1 = atof(tokens[1].c_str());
162 double xp2 = atof(tokens[2].c_str());
163 double yp2 = atof(tokens[3].c_str());
164 string sop;
165 if (tokens.size() > 4) sop = tokens[4];
166 bool fgnc = _CkBoolNC_(5);
167 if (kw == "addline") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, false, fgnc);
168 else if (kw == "addarrow") mImgApp->AddLine(xp1, yp1, xp2, yp2, sop, true, fgnc);
169 else {
170 bool fgfill = (kw == "addrect") ? false : true;
171 mImgApp->AddRectangle(xp1, yp1, xp2, yp2, sop, fgfill, fgnc);
172 }
173}
174else if ((kw == "addcirc") || (kw == "addfcirc")) {
175 if (tokens.size() < 3) {
176 cout << "Usage: addcirc/addfcirc xc yc r [colatt] [fgnc]" << endl;
177 return(0);
178 }
179 double xc = atof(tokens[0].c_str());
180 double yc = atof(tokens[1].c_str());
181 double rad = atof(tokens[2].c_str());
182 string sop;
183 if (tokens.size() > 3) sop = tokens[3];
184 bool fgnc = _CkBoolNC_(4);
185 bool fgfill = (kw == "addcirc") ? false : true;
186 mImgApp->AddCircle(xc, yc, rad, sop, fgfill, fgnc);
187 }
188else if ((kw == "addarca") || (kw == "addfarca")) {
189 if (tokens.size() < 5) {
190 cout << "Usage: addarca/addfarca xc yc r a da [colatt] [fgnc]" << endl;
191 return(0);
192 }
193 double xc = atof(tokens[0].c_str());
194 double yc = atof(tokens[1].c_str());
195 double rad = atof(tokens[2].c_str());
196 double ang = atof(tokens[3].c_str());
197 double dang = atof(tokens[4].c_str());
198 string sop;
199 if (tokens.size() > 5) sop = tokens[5];
200 bool fgnc = _CkBoolNC_(6);
201 bool fgfill = (kw == "addarca") ? false : true;
202 mImgApp->AddArc(xc, yc, rad, ang, dang, sop, fgfill, fgnc);
203 }
204else if (kw == "addmarker") {
205 if (tokens.size() < 2) {
206 cout << "Usage: addmarker x y [gratt] [fgnc]" << endl;
207 return(0);
208 }
209 double xm = atof(tokens[0].c_str());
210 double ym = atof(tokens[1].c_str());
211 string sop;
212 if (tokens.size() > 2) sop = tokens[2];
213 bool fgnc = _CkBoolNC_(3);
214 mImgApp->AddCircle(xm, ym, -1, sop, false, fgnc);
215}
216else if ((kw == "addarc") || (kw == "addfarc") ) {
217 if (tokens.size() < 6) {
218 cout << "Usage: addarc/addfarc x1 y1 x2 y2 x3 y3 [gratt] [fgnc]" << endl;
219 return(0);
220 }
221 double x1 = atof(tokens[0].c_str());
222 double y1 = atof(tokens[1].c_str());
223 double x2 = atof(tokens[2].c_str());
224 double y2 = atof(tokens[3].c_str());
225 double x3 = atof(tokens[4].c_str());
226 double y3 = atof(tokens[5].c_str());
227 string sop;
228 if (tokens.size() > 6) sop = tokens[6];
229 bool fgnc = _CkBoolNC_(7);
230 bool fgfill = (kw == "addarc") ? false : true;
231 mImgApp->AddArc(x1, y1, x2, y2, x3, y3, sop, fgfill, fgnc);
232}
233else if ((kw == "addpoly") || (kw == "addfpoly")) {
234 if (tokens.size() < 1) {
235 cout << "Usage: addpoly/addfpoly 'x1,y1 x2,y2 x3,y3 ...' [gratt] [fgnc]" << endl;
236 return(0);
237 }
238 vector<string> sxy;
239 vector<double> xpol, ypol;
240 double xp, yp;
241 FillVStringFrString(tokens[0], sxy);
242 for(int jkk=0; jkk<sxy.size(); jkk++) {
243 xp = yp = 0;
244 if (sscanf(sxy[jkk].c_str(), "%lg,%lg", &xp, &yp) == 2) {
245 xpol.push_back(xp);
246 ypol.push_back(yp);
247 }
248 }
249 string sop;
250 if (tokens.size() > 1) sop = tokens[1];
251 bool fgnc = _CkBoolNC_(2);
252 bool fgfill = (kw == "addpoly") ? false : true;
253 mImgApp->AddPoly(xpol, ypol, sop, fgfill, fgnc);
254 }
255
256
257else if ((kw == "settitle") || (kw == "addtitle")) {
258 if (tokens.size() < 1) { cout << "Usage: settitle/addtitle TopTitle [BotTitle] [fontatt]" << endl; return(0); }
259 if(tokens.size()<2) tokens.push_back("");
260 string gropt;
261 if(tokens.size()>2) gropt = tokens[2];
262 mImgApp->SetTitle(tokens[0], tokens[1], gropt);
263}
264
265else if ((kw == "setaxelabels") || (kw == "addaxelabels")) {
266 if (tokens.size() < 2) { cout << "Usage: setaxelabels/addaxelabels xLabel yLabel [fontatt]" << endl; return(0); }
267 string gropt;
268 if(tokens.size()>2) gropt = tokens[2];
269 mImgApp->SetAxeLabels(tokens[0], tokens[1], gropt);
270}
271
272// >>>>>>>>>>> Link dynamique de fonctions C++
273else if (kw == "link" ) {
274 if (tokens.size() < 2) { cout << "Usage: link fnameso f1 [f2 f3]" << endl; return(0); }
275 string sph = "";
276 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
277 int rc = LinkUserFuncs(tokens[0], tokens[1], tokens[2], tokens[3]);
278 if (rc == 0) cout << "PIABaseExecutor: Link from " << tokens[0] << " OK " << endl;
279}
280else if (kw == "linkff2" ) {
281 if (tokens.size() < 2) { cout << "Usage: linkff2 fnameso f1 [f2 f3]" << endl; return(0); }
282 string sph = "";
283 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
284 int rc = LinkUserFuncs2(tokens[0], tokens[1], tokens[2], tokens[3]);
285 if (rc == 0) cout << "PIABaseExecutor: Link2 from " << tokens[0] << " OK " << endl;
286}
287else if (kw == "call" ) {
288 if (tokens.size() < 1) { cout << "Usage: call userf [arg1 arg2 ...]" << endl; return(0); }
289 UsFmap::iterator it;
290 UsFmap::iterator it1 = usfmap.find(tokens[0]);
291 UsFmap::iterator it2 = usfmap2.find(tokens[0]);
292 if ((it1 == usfmap.end()) && (it2 == usfmap2.end()) ) {
293 cerr << "PIABaseExecutor: No User Function " << tokens[0] << endl;
294 return(0);
295 }
296 if (it1 == usfmap.end()) it = it2;
297 else it = it1;
298 cout << "PIABaseExecutor: Call " << tokens[0] << "( ... )" << endl;
299// on est oblige de faire un cast etant donne qu'on
300// utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
301 DlUserProcFunction fuf = (DlUserProcFunction)(*it).second;
302// On redirige la sortie sur le terminal
303 bool red = mImgApp->HasRedirectedStdOutErr();
304 mImgApp->RedirectStdOutErr(false);
305#ifdef SANS_EVOLPLANCK
306 TRY {
307 tokens.erase(tokens.begin());
308 fuf(tokens);
309 } CATCH(merr) {
310 fflush(stdout);
311 string es = PeidaExc(merr);
312 cerr << "\n PIABaseExecutor: Call UserFunc Exception :" << merr << es;
313 cout << endl;
314 }
315#else
316 try {
317 tokens.erase(tokens.begin());
318 fuf(tokens);
319 }
320 catch ( PThrowable & exc ) {
321 cerr << "\n PIABaseExecutor: Call / Catched Exception :"
322 << (string)typeid(exc).name() << " Msg= "
323 << exc.Msg() << endl;
324 cout << endl;
325 }
326 catch ( ... ) {
327 cerr << "\n PIABaseExecutor: Call / Catched Exception ... "
328 << endl;
329 cout << endl;
330 }
331#endif
332 mImgApp->RedirectStdOutErr(red);
333}
334
335// >>>>>>>>>>> lecture/ecriture des objets, gestion des objets
336else if (kw == "openfits" ) {
337 if (tokens.size() < 1) { cout << "Usage: openfits file " << endl; return(0); }
338 else { string nomobj = ""; mObjMgr->ReadFits(tokens[0], nomobj); }
339}
340else if (kw == "savefits" ) {
341 if (tokens.size() < 2) { cout << "Usage: savefits nameobj filename " << endl; return(0); }
342 else mObjMgr->SaveFits(tokens[0], tokens[1]);
343}
344else if (kw == "openppf" ) {
345 if (tokens.size() < 1) { cout << "Usage: openppf file " << endl; return(0); }
346 mObjMgr->ReadAll(tokens[0]);
347}
348else if ((kw == "saveobjs") || (kw == "saveppf")) {
349 if (tokens.size() < 2) { cout << "Usage: saveobjs patt filename " << endl; return(0); }
350 mObjMgr->SaveObjects(tokens[0], tokens[1]);
351}
352else if (kw == "saveall" ) {
353 if (tokens.size() < 1) { cout << "Usage: saveall file " << endl; return(0); }
354 mObjMgr->SaveAll(tokens[0]);
355}
356else if (kw == "print" ) {
357 if (tokens.size() < 1) { cout << "Usage: print nameobj " << endl; return(0); }
358 mObjMgr->PrintObj(tokens[0]);
359}
360else if ( (kw == "rename" ) || (kw == "mv") ) {
361 if (tokens.size() < 2) { cout << "Usage: rename/mv nameobj namenew" << endl; return(0); }
362 mObjMgr->RenameObj(tokens[0], tokens[1]);
363}
364else if ( (kw == "del" ) || (kw == "rm") ) {
365 if (tokens.size() < 1) { cout << "Usage: del nameobj [nameobj2 ...]" << endl; return(0); }
366 if (tokens.size()>0)
367 for(uint_4 i=0;i<tokens.size();i++) mObjMgr->DelObj(tokens[i]);
368}
369else if (kw == "delobjs" ) {
370 if (tokens.size() < 1) { cout << "Usage: delobjs nomobjpattern (*,?) " << endl; return(0); }
371 mObjMgr->DelObjects(tokens[0]);
372}
373else if ( (kw == "listobjs") || (kw == "ls") ) {
374 if (tokens.size() < 1) tokens.push_back("*");
375 mObjMgr->ListObjs(tokens[0]);
376}
377// Gestion des repertoires
378else if (kw == "mkdir" ) {
379 if (tokens.size() < 1) { cout << "Usage: mkdir dirname [true]" << endl; return(0); }
380 bool crd = mObjMgr->CreateDir(tokens[0]);
381 if ( crd && (tokens.size() > 1) && (tokens[1] == "true") )
382 mObjMgr->SetKeepOldDirAtt(tokens[0], true);
383 }
384else if (kw == "rmdir" ) {
385 if (tokens.size() < 1) { cout << "Usage: rmdir dirname " << endl; return(0); }
386 mObjMgr->DeleteDir(tokens[0]);
387 }
388else if (kw == "setdiratt" ) {
389 if (tokens.size() < 2) { cout << "Usage: setdiratt dirname true/false" << endl; return(0); }
390 if (tokens[1] == "true") mObjMgr->SetKeepOldDirAtt(tokens[0], true);
391 else mObjMgr->SetKeepOldDirAtt(tokens[0], false);
392}
393else if (kw == "cd") {
394 if (tokens.size() < 1) tokens.push_back("home");
395 mObjMgr->SetCurrentDir(tokens[0]);
396 }
397else if (kw == "pwd") {
398 string dirn;
399 mObjMgr->GetCurrentDir(dirn);
400 cout << "CurrentDirectory: " << dirn << endl;
401 }
402else if (kw == "listdirs") {
403 if (tokens.size() < 1) tokens.push_back("*");
404 mObjMgr->ListDirs(tokens[0]);
405 }
406
407// >>>>>>>>>>> Creation d'histos 1D-2D
408else if (kw == "newh1d") {
409 if (tokens.size() < 4) { cout << "Usage: newh1d name xmin xmax nbin" << endl; return(0); }
410 int_4 nbx = 100;
411 r_8 xmin = 0., xmax = 1.;
412 nbx = atoi(tokens[3].c_str());
413 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
414 Histo* h = new Histo(xmin, xmax, nbx);
415 mObjMgr->AddObj(h, tokens[0]);
416 }
417else if (kw == "newh2d") {
418 if (tokens.size() < 7) {
419 cout << "Usage: newh2d name xmin xmax nbinx ymin ymax nbiny" << endl;
420 return(0);
421 }
422 int_4 nbx = 50, nby = 50;
423 r_8 xmin = 0., xmax = 1.;
424 r_8 ymin = 0., ymax = 1.;
425 nbx = atoi(tokens[3].c_str());
426 nby = 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 Histo2D* h = new Histo2D(xmin, xmax, nbx, ymin, ymax, nby);
430 mObjMgr->AddObj(h, tokens[0]);
431 }
432else if (kw == "newprof" || kw == "newprofe") {
433 if (tokens.size() < 4)
434 { cout << "Usage: newprof[e] name xmin xmax nbin [ymin ymax]" << endl; return(0); }
435 int_4 nbx = 100;
436 r_8 xmin = 0., xmax = 1., ymin = 1., ymax = -1.;
437 if(tokens.size() > 5)
438 {ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());}
439 nbx = atoi(tokens[3].c_str());
440 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
441 HProf* h = new HProf(xmin, xmax, nbx, ymin, ymax);
442 if(kw == "newprofe") h->SetErrOpt(false);
443 mObjMgr->AddObj(h, tokens[0]);
444 }
445
446// Creation de NTuple
447else if (kw == "newnt") {
448 if(tokens.size() < 2)
449 {cout<<"Usage: newnt name v1 v2 ... vn / newnt name nvar"<<endl; return(0);}
450 vector<string> varname;
451 int nvar = 0;
452 const char *c = tokens[1].c_str();
453 if(isdigit(c[0])) {
454 nvar = atoi(tokens[1].c_str());
455 if(nvar<=0 || nvar>=10000)
456 {cout<<"newnt name nvar : nvar must be an positive integer<10000"<<endl;
457 return(0);}
458 for(int i=0;i<nvar;i++) {
459 char str[16]; sprintf(str,"%d",i);
460 string dum = "v"; dum += str;
461 varname.push_back(dum.c_str());
462 }
463 } else if( islower(c[0]) || isupper(c[0]) ) {
464 for(int i=1;i<(int)tokens.size();i++) {
465 varname.push_back(tokens[i].c_str());
466 nvar++;
467 }
468 } else {
469 cout<<"newnt name v1 v2 ... vn : name vi must begin by a letter"<<endl
470 <<"newnt name nvar : nvar must be an positive integer"<<endl;
471 return(0);
472 }
473 char **noms = new char*[nvar];
474 for(int i=0;i<nvar;i++) noms[i] = (char *)varname[i].c_str();
475 NTuple* nt = new NTuple(nvar,noms);
476 delete [] noms;
477 mObjMgr->AddObj(nt,tokens[0]);
478 }
479
480// Creation de GeneralFitData
481else if (kw == "newgfd") {
482 if (tokens.size() < 3)
483 { cout << "Usage: newgfd nvar nalloc [errx(0/1)]" << endl; return(0); }
484 int nvar, nalloc, errx=0;
485 if (tokens.size() > 3)
486 { errx = atoi(tokens[3].c_str()); if(errx>0) errx=1; else errx = 0;}
487 nvar = atoi(tokens[1].c_str()); nalloc = atoi(tokens[2].c_str());
488 if(nvar>0 && nalloc>0) {
489 GeneralFitData* gfd = new GeneralFitData(nvar,nalloc,errx);
490 mObjMgr->AddObj(gfd, tokens[0]);
491 }
492 }
493
494// Creation/remplissage de vecteur et de matrice
495else if (kw == "newvec") {
496 if (tokens.size() < 2) {
497 cout << "Usage: newvec name size [f(i) dopt] " << endl; return(0);
498 }
499 int n = atoi(tokens[1].c_str());
500 double xmin, xmax;
501 xmin = 0.; xmax = n;
502 if (tokens.size() < 3) {
503 Vector* v = new Vector(n);
504 mObjMgr->AddObj(v, tokens[0]);
505 }
506 else {
507 if (tokens.size() < 4) tokens.push_back("");
508 mObjMgr->GetServiceObj()->PlotFunc(tokens[2], tokens[0], xmin, xmax, n, tokens[3]);
509 }
510 }
511else if (kw == "newmtx") {
512 if (tokens.size() < 3) {
513 cout << "Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) dopt] " << endl; return(0);
514 }
515 int nx = atoi(tokens[1].c_str());
516 int ny = atoi(tokens[2].c_str());
517 double xmin, xmax, ymin, ymax;
518 xmin = 0.; xmax = nx;
519 ymin = 0.; ymax = ny;
520 if (tokens.size() < 4) {
521 Matrix* mtx = new Matrix(ny,nx);
522 mObjMgr->AddObj(mtx, tokens[0]);
523 }
524 else {
525 if (tokens.size() < 5) tokens.push_back("next");
526 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[3], tokens[0], xmin, xmax, ymin, ymax,
527 nx, ny, tokens[4]);
528 }
529 }
530
531// Copie d'objets
532else if ( (kw == "copy") || (kw == "cp") ) {
533 if(tokens.size()<2) {
534 cout<<"Usage: copy name_from name_to"<<endl;return(0);
535 }
536 mObjMgr->CopyObj(tokens[0],tokens[1]);
537}
538
539
540// >>>>>>>>>>> Affichage des objets
541else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
542 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
543 string opt = "next";
544 if (tokens.size() > 1) opt = tokens[1];
545 if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
546 else if (kw == "surf") mObjMgr->DisplaySurf3D(tokens[0], opt);
547 else if (kw == "imag") mObjMgr->DisplayImage(tokens[0], opt);
548 }
549
550else if (kw == "nt2d") {
551 if (tokens.size() < 3) {
552 cout << "Usage: nt2d nameobj varx vary [errx erry wt label opt]" << endl;
553 return(0);
554 }
555 while (tokens.size() < 8) tokens.push_back("");
556 string ph = "";
557 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], ph, tokens[3], tokens[4], ph,
558 tokens[5], tokens[6], tokens[7], false);
559 }
560else if (kw == "nt3d") {
561 if (tokens.size() < 7) {
562 cout << "Usage: nt3d nameobj varx vary varz [errx erry errz wt label opt]" << endl;
563 return(0);
564 }
565 while (tokens.size() < 10) tokens.push_back("");
566 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], tokens[3], tokens[4], tokens[5],
567 tokens[6], tokens[7], tokens[8], tokens[9], true);
568 }
569else if (kw == "vecplot") {
570 if (tokens.size() < 2) {
571 cout << "Usage: vecplot nameVecX nameVecY [opt]" << endl;
572 }
573 while (tokens.size() < 3) tokens.push_back("");
574 mObjMgr->DisplayVector(tokens[0], tokens[1], tokens[2]);
575}
576
577// Obsolete : ne pas virer SVP, cmv 26/7/99
578else if (kw == "gfd2d") {
579 cout<<"----- gfd2d OBSOLETE: utilisez nt2d -----"<<endl;
580 if(tokens.size()<2)
581 {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
582 return(0);}
583 string numvary = "";
584 string err = "";
585 string opt = "next";
586 if(tokens.size()>2) err = tokens[2];
587 if(tokens.size()>3) opt = tokens[3];
588 mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
589 }
590else if (kw == "gfd3d") {
591 cout<<"----- gfd3d OBSOLETE: utilisez nt3d -----"<<endl;
592 if(tokens.size()<3)
593 {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
594 return(0);}
595 string err = "";
596 string opt = "next";
597 if(tokens.size()>3) err = tokens[3];
598 if(tokens.size()>4) opt = tokens[4];
599 mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
600 }
601
602// >>>>>>>>>>> Trace de fonctions
603else if ( (kw == "func") ) {
604 if(tokens.size()<3) {cout<<"Usage: func f(x) xmin xmax [npt opt]"<<endl; return(0);}
605 int np = 100;
606 double xmin=0., xmax=1.;
607 string opt = "", nom = "";
608 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
609 if (tokens.size() > 3) np = atoi(tokens[3].c_str());
610 if (tokens.size() > 4) opt = tokens[4];
611 mObjMgr->GetServiceObj()->PlotFunc(tokens[0], nom, xmin, xmax, np, opt);
612 }
613else if ( (kw == "funcff") ) {
614 if (tokens.size()<4) {cout<<"Usage: funcff C-filename f(x)-name xmin xmax [npt opt]"<<endl; return(0);}
615 int np = 100;
616 double xmin=0., xmax=1.;
617 string opt = "", nom = "";
618 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
619 if(tokens.size()>4) np = atoi(tokens[4].c_str());
620 if(tokens.size()>5) opt = tokens[5];
621 mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], nom, xmin, xmax, np, opt);
622 }
623else if ( (kw == "func2d") ) {
624 if (tokens.size() < 7) {
625 cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [opt]" << endl;
626 return(0);
627 }
628 int npx, npy;
629 double xmin, xmax;
630 double ymin, ymax;
631 npx = npy = 50;
632 xmin = 0.; xmax = 1.;
633 ymin = 0.; ymax = 1.;
634 npx = atoi(tokens[3].c_str());
635 npy = atoi(tokens[6].c_str());
636 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
637 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
638 string opt = "";
639 if (tokens.size() > 7) opt = tokens[7];
640 string nom = "";
641 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
642 }
643else if ( (kw == "func2dff") ) {
644 if (tokens.size() < 8) {
645 cout << "Usage: func2d C-filename F(x,y)-name xmax nptx ymin ymax npty [opt]" << endl;
646 return(0);
647 }
648 int npx, npy;
649 double xmin, xmax;
650 double ymin, ymax;
651 npx = npy = 50;
652 xmin = 0.; xmax = 1.;
653 ymin = 0.; ymax = 1.;
654 npx = atoi(tokens[4].c_str());
655 npy = atoi(tokens[7].c_str());
656 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
657 ymin = atof(tokens[5].c_str()); ymax = atof(tokens[6].c_str());
658 string opt = "";
659 if (tokens.size() > 8) opt = tokens[8];
660 string nom = "";
661 mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
662 }
663
664// >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
665else if (kw == "plot2d" ) {
666 if (tokens.size() < 3) {
667 cout << "Usage: plot2d nameobj expx expy [expcut opt loop_par]" << endl;
668 return(0);
669 }
670 string errx = ""; string erry = "";
671 if (tokens.size() < 4) tokens.push_back("1");
672 while (tokens.size() < 6) tokens.push_back("");
673 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,tokens[3],tokens[4],tokens[5]);
674 }
675
676else if (kw == "plot2de" ) { // Plot2D avec les erreurs
677 if (tokens.size() < 5) {
678 cout << "Usage: plot2de nameobj expx expy experrx experry [expcut opt loop_par]" << endl;
679 return(0);
680 }
681 if (tokens.size() < 6) tokens.push_back("1");
682 while (tokens.size() < 8) tokens.push_back("");
683 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4],
684 tokens[5],tokens[6],tokens[7]);
685 }
686
687else if (kw == "plot2dw" ) { // Plot2d avec poids
688 if (tokens.size() < 4) {
689 cout << "Usage: plot2dw nomobj expx expy expwt [expcut opt loop_par]" << endl;
690 return(0);
691 }
692 if (tokens.size() < 5) tokens.push_back("1");
693 while (tokens.size() < 7) tokens.push_back("");
694 srvo->DisplayPoints2DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
695 }
696else if (kw == "plot3d" ) {
697 if (tokens.size() < 4) {
698 cout << "Usage: plot3d nomobj expx expy expz [expcut opt loop_par]" << endl;
699 return(0);
700 }
701 if (tokens.size() < 5) tokens.push_back("1");
702 while (tokens.size() < 7) tokens.push_back("");
703 srvo->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
704 }
705
706else if (kw == "projh1d" ) {
707 if (tokens.size() < 3) {
708 cout << "Usage: projh1d nomh1 nomobj expx [expwt expcut opt loop_par]" << endl;
709 return(0);
710 }
711 if (tokens.size() < 4) tokens.push_back("1.");
712 if (tokens.size() < 5) tokens.push_back("1");
713 while (tokens.size() < 7) tokens.push_back("");
714 srvo->ProjectH1(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
715 }
716
717
718// Projection dans histogrammes
719else if (kw == "projh2d" ) {
720 if (tokens.size() < 4) {
721 cout << "Usage: projh2d nomh2 nomobj expx expy [expwt expcut opt loop_par]" << endl;
722 return(0);
723 }
724 if (tokens.size() < 5) tokens.push_back("1.");
725 if (tokens.size() < 6) tokens.push_back("1");
726 while (tokens.size() < 8) tokens.push_back("");
727 srvo->ProjectH2(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
728 tokens[6], tokens[7] );
729 }
730
731else if (kw == "projprof" ) {
732 if (tokens.size() < 4) {
733 cout << "Usage: projprof nomprof nomobj expx expy [expwt expcut opt loop_par]" << endl;
734 return(0);
735 }
736 if (tokens.size() < 5) tokens.push_back("1.");
737 if (tokens.size() < 6) tokens.push_back("1");
738 while (tokens.size() < 8) tokens.push_back("");
739 srvo->ProjectHProf(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
740 tokens[6], tokens[7] );
741 }
742
743// Projection dans vector/matrix
744else if (kw == "fillvec" ) {
745 if (tokens.size() < 4) {
746 cout << "Usage: fillvec nomvec nomobj expx expv [expcut opt loop_par]" << endl;
747 return(0);
748 }
749 if (tokens.size() < 5) tokens.push_back("1");
750 while (tokens.size() < 7) tokens.push_back("");
751 srvo->FillVect(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
752 }
753
754else if (kw == "fillmtx" ) {
755 if (tokens.size() < 5) {
756 cout << "Usage: fillmtx nommtx nomobj expx expy expv [expcut opt loop_par]" << endl;
757 return(0);
758 }
759 if (tokens.size() < 6) tokens.push_back("1");
760 while (tokens.size() < 8) tokens.push_back("");
761 srvo->FillMatx(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
762 tokens[6], tokens[7] );
763 }
764
765// Remplissage NTuple,Vecteurs, ... , boucle de NTuple
766else if (kw == "ntfrascii" ) {
767 if(tokens.size() < 2) {
768 cout<<"Usage: ntfrascii nt_name file_name [def_init_val]"<<endl;
769 return(0);
770 }
771 double def_val = 0.;
772 if(tokens.size()>=3) def_val = atof(tokens[2].c_str());
773 srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val);
774 }
775
776#ifndef SANS_EVOLPLANCK
777/* Lecture matrice/vecteur depuis fichier ASCII */
778else if ((kw == "mtxfrascii") || (kw == "vecfrascii") ) {
779 if(tokens.size() < 2) {
780 cout<<"Usage: mtxfrascii/vecfrascii mtx/vec_name file_name "<<endl;
781 return(0);
782 }
783 TMatrix<r_8> mtx;
784 TVector<r_8> vec;
785 FILE* fip = fopen(tokens[1].c_str(), "r");
786 if (fip == NULL) {
787 cout << "vec/mtxfrascii: can not open file " << tokens[1] << endl;
788 return(0);
789 }
790 fclose(fip);
791 ifstream is(tokens[1].c_str());
792 sa_size_t nr, nc;
793 if (kw == "mtxfrascii") {
794 mtx.ReadASCII(is, nr, nc);
795 mObjMgr->AddObj(mtx, tokens[0]);
796 cout << "mtxfrascii: TMatrix<r_8> " << tokens[0] << " read from file "
797 << tokens[1] << endl;
798 }
799 else {
800 vec.ReadASCII(is, nr, nc);
801 mObjMgr->AddObj(vec, tokens[0]);
802 cout << "vecfrascii: TVector<r_8> " << tokens[0] << " read from file "
803 << tokens[1] << endl;
804 }
805}
806#endif
807
808else if (kw == "fillnt" ) {
809 if (tokens.size() < 5) {
810 cout << "Usage: fillnt nameobj expx expy expz expt [expcut ntname loop_par]" << endl;
811 return(0);
812 }
813 while (tokens.size() < 8) tokens.push_back("");
814 srvo->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], tokens[7] );
815 }
816
817else if (kw == "ntloop" ) {
818 if (tokens.size() < 3) {
819 cout << "Usage: ntloop nameobj fname funcname [ntname loop_par ]" << endl;
820 return(0);
821 }
822 while (tokens.size() < 5) tokens.push_back("");
823 srvo->FillNTFrCFile(tokens[0],tokens[1], tokens[2], tokens[3], tokens[4]);
824 }
825
826else if (kw == "ntexpcfile" ) {
827 if (tokens.size() < 3) {
828 cout << "Usage: ntexpcfile nameobj fname funcname" << endl;
829 return(0);
830 }
831 srvo->PrepareNTExpressionCFile(tokens[0],tokens[1], tokens[2]);
832 }
833
834else if (kw == "exptovec" ) {
835 if (tokens.size() < 3) {
836 cout << "Usage: exptovec nomvec nameobj expx [expcut opt loop_par]" << endl;
837 return(0);
838 }
839 while (tokens.size() < 6) tokens.push_back("");
840 srvo->ExpressionToVector(tokens[1],tokens[2],tokens[3],tokens[0],tokens[4],tokens[5]);
841 }
842
843else if (kw == "fillgd1" ) {
844 if (tokens.size() < 5) {
845 cout << "Usage: fillgd1 nomgfd nomobj expx expy experry [expcut loop_par] " << endl;
846 return(0);
847 }
848 if (tokens.size() < 6) tokens.push_back("1");
849 if (tokens.size() < 7) tokens.push_back("");
850 string expy = "";
851 srvo->FillGFD(tokens[1],tokens[2], expy, tokens[3], tokens[4], tokens[5], tokens[0]);
852 }
853
854else if (kw == "fillgd2" ) {
855 if (tokens.size() < 6) {
856 cout << "Usage: fillgd2 nomgfd nomobj expx expy expz experrz [expcut loop_par]" << endl;
857 return(0);
858 }
859 if (tokens.size() < 7) tokens.push_back("1");
860 if (tokens.size() < 8) tokens.push_back("");
861 srvo->FillGFD(tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6], tokens[0], tokens[7]);
862 }
863
864else if (kw == "gdfrvec" ) {
865 if(tokens.size()<3) {
866 cout<<"Usage: gdfrvec namegfd X Y\n"
867 <<" gdfrvec namegfd X Y"
868 <<" gdfrvec namegfd X Y ! EY\n"
869 <<" gdfrvec namegfd X Y Z\n"
870 <<" gdfrvec namegfd X Y Z EZ"<<endl;
871 return(0);
872 }
873 while(tokens.size()<5) tokens.push_back("!");
874 srvo->FillGFDfrVec(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4]);
875 }
876
877// >>>>>>>>>>> Calcul d'expression arithmetique
878else if ( (kw == "eval") ) {
879 if(tokens.size()<2)
880 {cout<<"Usage: eval resultvarname arithmetic expression...."<<endl; return(0);}
881 string expval = "";
882 for(unsigned int i=1;i<tokens.size();i++) expval+=tokens[i];
883 string resultvarname = "";
884 if(isalpha(tokens[0][0])) resultvarname=tokens[0];
885 mObjMgr->GetServiceObj()->ExpVal(expval,resultvarname);
886 }
887
888else {
889 cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
890 return(-1);
891 }
892
893return(0);
894}
895
896// Fonction pour enregistrer le Help des Widgets et Windows de piapp
897static void RegisterPIGraphicsHelp(PIACmd* piac);
898
899/* --Methode-- */
900void PIABaseExecutor::RegisterCommands()
901{
902string kw, usage;
903kw = "exitpiapp";
904usage = "To end the piapp session";
905mpiac->RegisterCommand(kw, usage, this, "Commands");
906kw = "loadmodule";
907usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
908usage += "\n Related commands: link";
909mpiac->RegisterCommand(kw, usage, this, "External Modules");
910kw = "link";
911usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
912usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
913usage += "\n Related commands: call loadmodule linkff2";
914mpiac->RegisterCommand(kw, usage, this, "External Modules");
915kw = "linkff2";
916usage = "Dynamic linking of compiled user functions (Set 2)\n Usage: linkff2 fnameso f1 [f2 f3]";
917usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
918usage += "\n Related commands: call link loadmodule";
919mpiac->RegisterCommand(kw, usage, this, "External Modules");
920kw = "call";
921usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
922usage += "\n User function : f(vector<string>& args)";
923usage += "\n Related commands: link";
924mpiac->RegisterCommand(kw, usage, this, "External Modules");
925
926kw = "zone";
927usage = "To Divide the Graphic window \n Usage: zone [nx=1 ny=1]";
928usage += "\n Related commands: newwin";
929mpiac->RegisterCommand(kw, usage, this, "Graphics");
930kw = "newwin";
931usage = "To Create a New Graphic window, with zones \n";
932usage += " Window size can be specified \n";
933usage += " Usage: newwin [nx ny [sizeX sizeY]] ";
934usage += "\n Related commands: zone";
935mpiac->RegisterCommand(kw, usage, this, "Graphics");
936kw = "stacknext";
937usage = "Displays the next widget on stack window \n Usage: stacknext";
938mpiac->RegisterCommand(kw, usage, this, "Graphics");
939
940kw = "graphicatt";
941usage = "To change default graphic options \n Usage: graphicatt att_list \n";
942usage += "att_list=def back to default values, Example: gratt 'red circlemarker5'";
943usage += "\n ------------------ Graphic attribute list ------------------ \n";
944usage += ">> Colors: defcol black white grey red blue green yellow \n";
945usage += " magenta cyan turquoise navyblue orange siennared purple \n";
946usage += " limegreen gold violet violetred blueviolet darkviolet \n";
947usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n";
948usage += " thickdashedline dottedline thindottedline thickdottedline \n";
949usage += ">> Font Att: deffontatt normalfont boldfont italicfont bolditalicfont \n";
950usage += " smallfont smallboldfont smallitalicfont smallbolditalicfont \n";
951usage += " bigfont bigboldfont bigitalicfont bigbolditalicfont \n";
952usage += " hugefont hugeboldfont hugeitalicfont hugebolditalicfont \n";
953usage += ">> Font Names: deffont courierfont helveticafont timesfont symbolfont \n";
954usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker<T> \n";
955usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
956usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n";
957usage += " with <T> = 1 3 5 7 .. 15 , Example fboxmarker5 , plusmarker9 ... \n";
958usage += ">> ArrowMarker: basicarrow<T> trianglearrow<T> ftrianglearrow<T> \n";
959usage += " arrowshapedarrow<T> farrowshapedarrow<T> \n";
960usage += " with <T> = 5 7 .. 15 , Example trianglearrow7 ... \n";
961usage += ">> ColorTables: defcmap grey32 invgrey32 colrj32 colbr32 \n";
962usage += " grey128 invgrey128 colrj128 colbr128 \n";
963usage += " midas_pastel midas_heat midas_rainbow3 midas_bluered\n";
964usage += " midas_bluewhite midas_redwhite \n";
965usage += " rainbow16 \n";
966usage += " revcmap : This flag reverses ColorMap indexing \n";
967usage += ">> ZoomFactors zoomxN zoomx1 zoomx2 zoomx3 ... \n";
968usage += " (image display) zoom/N zoom/2 zoom/3 zoom/4 ...\n";
969usage += ">> imagecenter=ix,iy -> Position the image in widget \n";
970usage += ">> lut=ltyp,min,max -> Sets LUT type and min/max for image display \n";
971usage += " (ltyp=lin/log/sqrt/square) \n";
972usage += ">> Axes: stdaxes=defaxes=boxaxes boxaxesgrid centeredaxes\n";
973usage += " fineaxes finecenteredaxes fineaxesgrid=grid \n";
974usage += " centeredaxesgrid finecenteredaxesgrid \n";
975usage += ">> Axe labels font size: fixedfontsize/autofontsize \n";
976usage += " autofontsize: Font size computed automatically \n";
977usage += " fixedfontsize: Use font size attribute (BaseDrawer) \n";
978usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
979usage += ">> xylimits=xmin,xmax,ymin,ymax -> Forces X-Y limits in 2-D plots \n";
980usage += ">> defdrrect=xmin,xmax,ymin,ymax -> Defines drawing rectangle 2-D plots \n";
981 usage += " The rectangle is defined as a fraction of the widget size\n";
982usage += ">> stat/nostat or stats/nostats -> Toggle statistic display flag \n";
983usage += ">> title/notitle or tit/notit -> Toggle Auto AddTitle flag \n";
984usage += ">> DisplayWindow: next same win stack inset \n";
985usage += " Related commands: setaxesatt setinsetlimits ";
986mpiac->RegisterCommand(kw, usage, this, "Graphics");
987
988kw = "setaxesatt";
989usage = "To set default axes attributes \n Usage: setaxesatt att_list \n";
990usage += "Color/Line/Font attributes and axes attributes \n";
991usage += ">> Axes: stdaxes=defaxes=boxaxes boxaxesgrid centeredaxes\n";
992usage += " fineaxes finecenteredaxes fineaxesgrid=grid \n";
993usage += " centeredaxesgrid finecenteredaxesgrid \n";
994usage += ">> Axe labels font size: fixedfontsize/autofontsize \n";
995usage += " autofontsize: Font size computed automatically \n";
996usage += " fixedfontsize: Use font size attribute (BaseDrawer) \n";
997usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
998usage += ">> xylimits=xmin,xmax,ymin,ymax -> Forces X-Y limits in 2-D plots \n";
999mpiac->RegisterCommand(kw, usage, this, "Graphics");
1000
1001kw = "setinsetlimits";
1002usage = "Define the display rectangle for drawers added as insets \n";
1003usage += " over existing graphic objects - limits expressed as fraction \n";
1004usage += " graphic object size (0. .. 1.) Xmax at right, YMax top. ";
1005usage += " Usage: setinsetlimits xmin xmax ymin ymax";
1006usage += "\n Related commands: graphicatt /inset";
1007mpiac->RegisterCommand(kw, usage, this, "Graphics");
1008
1009kw = "drpanel";
1010usage = "Creates a new 2D drawing zone for addtext, addline \n";
1011usage += " Usage: drpanel xmin xmax ymin ymax [GrAtt] [Name]";
1012usage += "\n Related commands: addtext addline addrect addcirc ...";
1013mpiac->RegisterCommand(kw, usage, this, "Graphics");
1014
1015kw = "addtext";
1016usage = "Adds a text string to the current graphic object";
1017usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
1018usage += "\n The Base/AxesDrawer is used to handle added text strings" ;
1019usage += "\n Alt<E> to remove the added element";
1020usage += "\n Usage: addtext x y TextString [ColFontPosAtt] [fgnc=false/true]";
1021usage += "\n (use quotes '' for multi word text strings) ";
1022usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1023usage += "\n Text position/direction attribute: ";
1024usage += "\n horizleft horizcenter horizright";
1025usage += "\n vertbottom vertcenter verttop ";
1026usage += "\n textdirhoriz textdirvertup textdirvertdown ";
1027usage += "\n Related commands: addctext addline addarrow addrect addfrect";
1028usage += "\n addcirc addfcirc addarc addfrac addpoly addfpoly settitle graphicatt";
1029mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1030
1031kw = "addctext";
1032usage = "Adds a composite text string with superscript and subscripts ";
1033usage += "\n at the specified position (+ color/font/pos/dir attributes) ";
1034usage += "\n Usage: addctext x y Text sUp sDown [ColFontPosAtt] [UpDownFontAtt] [fgnc]";
1035usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1036usage += "\n Related commands: addtext addline addrect ...";
1037usage += "\n (See command addtext and graphicatt for more details)";
1038mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1039
1040kw = "addline";
1041usage = "Adds a line to the current graphic object";
1042usage += "\n at the specified position (+ graphic attribute)";
1043usage += "\n The Base/AxesDrawer is used to handle added lines";
1044usage += "\n Alt<E> to remove the added element";
1045usage += "\n Usage: addline x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1046usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1047usage += "\n Related commands: addarrow addtext addrect addfrect ";
1048usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1049mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1050
1051kw = "addarrow";
1052usage = "Adds an arrow to the current graphic object";
1053usage += "\n at the specified position (+ graphic attribute)";
1054usage += "\n The Base/AxesDrawer is used to handle added lines";
1055usage += "\n Alt<E> to remove the added element";
1056usage += "\n Usage: addarrow x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1057usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1058usage += "\n Related commands: addline addtext addrect addfrect ";
1059usage += "\n addmarker addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1060mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1061kw = "addarrow_nc";
1062
1063kw = "addrect";
1064usage = "Adds a rectangle to the current graphic object";
1065usage += "\n between the specified positions (+ graphic attribute)";
1066usage += "\n The Base/AxesDrawer is used to handle added rectangle";
1067usage += "\n Alt<E> to remove added element";
1068usage += "\n Usage: addrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1069usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1070usage += "\n Related commands: addtext addline addarrow addfrect";
1071usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1072mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1073
1074kw = "addfrect";
1075usage = "Adds a filled rectangle to the current graphic object";
1076usage += "\n between the specified positions (+ graphic attribute)";
1077usage += "\n The Base/AxesDrawer is used to handle added rectangle";
1078usage += "\n Alt<E> to remove added element";
1079usage += "\n Usage: addfrect x1 y1 x2 y2 [GraphicAtt] [fgnc=false/true]";
1080usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1081usage += "\n Related commands: addtext addline addarrow addrect";
1082usage += "\n addcirc addfcirc addpoly addfpoly graphicatt";
1083mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1084
1085kw = "addmarker";
1086usage = "Adds a marker to the current graphic object";
1087usage += "\n at the specified position (+ graphic attribute)";
1088usage += "\n The Base/AxesDrawer is used to handle added circles";
1089usage += "\n Alt<E> to remove added element";
1090usage += "\n Usage: addmarker xpos ypos [GraphicAtt] [fgnc=false/true]";
1091usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1092usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1093usage += "\n addcirc addfcirc addarc addfarc addpoly addfpoly graphicatt";
1094mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1095
1096kw = "addcirc";
1097usage = "Adds a circle to the current graphic object";
1098usage += "\n with the specified center and radius (+ graphic attribute)";
1099usage += "\n The Base/AxesDrawer is used to handle added circles";
1100usage += "\n Alt<E> to remove added element";
1101usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
1102usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1103usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1104usage += "\n addfcirc addarc addfarc addpoly addfpoly graphicatt";
1105mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1106
1107kw = "addfcirc";
1108usage = "Adds a filled circle to the current graphic object";
1109usage += "\n with the specified center and radius (+ graphic attribute)";
1110usage += "\n The Base/AxesDrawer is used to handle added circles";
1111usage += "\n Alt<E> to remove added element";
1112usage += "\n Usage: addcirc xcenter ycenter radius [GraphicAtt] [fgnc=false/true]";
1113usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1114usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1115usage += "\n addcirc addarc addfarc addpoly addfpoly graphicatt";
1116mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1117
1118kw = "addarca";
1119usage = "Adds an arc to the current graphic object";
1120usage += "\n defined by the circle (center+radius), start angle and angular extension";
1121usage += "\n Angles are specified in degrees";
1122usage += "\n Usage: addarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
1123usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1124usage += "\n Related commands: addtext addline addfarca addarc ...";
1125mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1126
1127kw = "addfarca";
1128usage = "Adds a filled arc to the current graphic object";
1129usage += "\n defined by the circle (center+radius), start angle and angular extension";
1130usage += "\n Angles are specified in degrees";
1131usage += "\n Usage: addfarca xc yc r a0deg dadeg [GraphicAtt] [fgnc=false/true]";
1132usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1133usage += "\n Related commands: addtext addline addarca addarc ...";
1134mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1135
1136kw = "addarc";
1137usage = "Adds an arc to the current graphic object";
1138usage += "\n defined by 3 points (+ graphic attribute)";
1139usage += "\n The Base/AxesDrawer is used to handle added arcs";
1140usage += "\n Alt<E> to remove the added element";
1141usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
1142usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1143usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1144usage += "\n addcirc addfcirc addfarc addarca addpoly addfpoly graphicatt";
1145mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1146
1147kw = "addfarc";
1148usage = "Adds a filled arc to the current graphic object";
1149usage += "\n defined by 3 points (+ graphic attribute)";
1150usage += "\n The Base/AxesDrawer is used to handle added arcs";
1151usage += "\n Alt<E> to remove added element";
1152usage += "\n Usage: addarc x1 y1 x2 y2 x3 y3 [GraphicAtt] [fgnc=false/true]";
1153usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1154usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1155usage += "\n addcirc addfcirc addfarc addpoly addfpoly graphicatt";
1156mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1157
1158kw = "addpoly";
1159usage = "Adds a polyline/polygon to the current graphic object";
1160usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
1161usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
1162usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1163usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1164usage += "\n addcirc addfcirc addfarc graphicatt";
1165mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1166
1167kw = "addfpoly";
1168usage = "Adds a filled polygon to the current graphic object";
1169usage += "\n Usage: addploy 'x1,y1 x2,y2 x3,y3 ...' [GraphicAtt] [fgnc=false/true]";
1170usage += "\n Coordinates specified as pairs x,y in a single word (use simple or double quotes";
1171usage += "\n if fgnc==true : Normalized 0..1 coordinates specification (def=false)";
1172usage += "\n Related commands: addtext addline addarrow addfrect addfrect";
1173usage += "\n addcirc addfcirc addfarc graphicatt";
1174mpiac->RegisterCommand(kw, usage, this, "Graphic-Elts");
1175
1176kw = "settitle";
1177usage = "Set the title string (top title / bottom title) for the current graphic object";
1178usage += "\n Usage: settitle TopTitle [BottomTitle] [fontAtt]";
1179usage += "\n Related commands: addtext graphicatt";
1180mpiac->RegisterCommand(kw, usage, this, "Graphics");
1181
1182kw = "addtitle";
1183usage = "Set the title string (top title / bottom title) \n";
1184usage += " alias for settitle ";
1185mpiac->RegisterCommand(kw, usage, this, "Graphics");
1186
1187kw = "setaxelabels";
1188usage = "Set the X and Y axis labels for the current 2D graphic object \n";
1189usage += "\n Usage: setaxelabels xLabel yLabel [ColorFntAtt]";
1190usage += "\n Related commands: settitle addtext graphicatt";
1191mpiac->RegisterCommand(kw, usage, this, "Graphics");
1192
1193kw = "addaxelabels";
1194usage = "Set the X and Y axis labels for the current 2D graphic object";
1195usage += " alias for setaxelabels ";
1196mpiac->RegisterCommand(kw, usage, this, "Graphics");
1197
1198RegisterPIGraphicsHelp(mpiac);
1199
1200kw = "openfits";
1201usage = "Loads a FITS file into an appropriate object \n Usage: openfits filename";
1202usage += "\n Related commands: savefits openppf";
1203mpiac->RegisterCommand(kw, usage, this, "FileIO");
1204kw = "savefits";
1205usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
1206usage += "\n Related commands: openfits saveobjs saveall";
1207mpiac->RegisterCommand(kw, usage, this, "FileIO");
1208kw = "openppf";
1209usage = "Reads all objects from a PPF file \n Usage: openppf filename";
1210usage += "\n Related commands: saveall openfits";
1211mpiac->RegisterCommand(kw, usage, this, "FileIO");
1212kw = "saveppf";
1213usage = "Saves objects with names matching a pattern into a\n";
1214usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
1215usage += "Usage: saveppf nameobjpattern filename";
1216usage += "\n Related commands: saveobjs saveall openppf savefits";
1217mpiac->RegisterCommand(kw, usage, this, "FileIO");
1218kw = "saveobjs";
1219usage = "Saves objects with names matching a pattern into a\n";
1220usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
1221usage += "Usage: saveobjs nameobjpattern filename";
1222usage += "\n Related commands: saveppf saveall openppf savefits";
1223mpiac->RegisterCommand(kw, usage, this, "FileIO");
1224kw = "saveall";
1225usage = "Saves all objects into a PPF file \n Usage: saveall filename";
1226usage += "\n Related commands: saveobj openppf savefits";
1227mpiac->RegisterCommand(kw, usage, this, "FileIO");
1228kw = "ntfrascii";
1229usage = "Fills an existing NTuple from ASCII table file";
1230usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]";
1231usage += "\n Related commands: ntloop fillnt ";
1232mpiac->RegisterCommand(kw, usage, this, "FileIO");
1233#ifndef SANS_EVOLPLANCK
1234kw = "mtxfrascii";
1235usage = "Reads a matrix from an ASCII file (TMatrix<r_8>)";
1236usage += "\n Usage: mtxfrascii mtx_name file_name";
1237usage += "\n Related commands: vecfrascii ntfrascii ";
1238mpiac->RegisterCommand(kw, usage, this, "FileIO");
1239kw = "vecfrascii";
1240usage = "Reads a vactor from an ASCII file (TVector<r_8>)";
1241usage += "\n Usage: vecfrascii vec_name file_name";
1242usage += "\n Related commands: mtxfrascii ntfrascii ";
1243mpiac->RegisterCommand(kw, usage, this, "FileIO");
1244#endif
1245
1246kw = "print";
1247usage = "Prints an object \n Usage: print nameobj";
1248mpiac->RegisterCommand(kw, usage, this, "FileIO");
1249
1250kw = "mkdir";
1251usage = "Create a directory";
1252usage += "\n Usage: mkdir dirname [true]";
1253usage += "\n if second argument==true, the directory's KeepOld attribute is set to true";
1254mpiac->RegisterCommand(kw, usage, this, "Object Management");
1255kw = "rmdir";
1256usage = "Removes an empty directory";
1257usage += "\n Usage: remove dirname";
1258mpiac->RegisterCommand(kw, usage, this, "Object Management");
1259kw = "setdiratt";
1260usage = "Sets directory attributes";
1261usage += "\n Usage: setdiratt dirname KeepOldFlag(=true/false)";
1262usage += "\n KeepOldFlag=true Object with the same name is moved to old";
1263usage += "\n when adding objects";
1264mpiac->RegisterCommand(kw, usage, this, "Object Management");
1265kw = "cd";
1266usage = "Change current directory";
1267usage += "\n Usage: cd [dirname]";
1268mpiac->RegisterCommand(kw, usage, this, "Object Management");
1269kw = "pwd";
1270usage = "Prints current directory";
1271usage += "\n Usage: pwd";
1272mpiac->RegisterCommand(kw, usage, this, "Object Management");
1273kw = "listdirs";
1274usage = "Prints the list of directories";
1275usage += "\n Usage: listdirs [patt=*] \n patt : * , ? ";
1276mpiac->RegisterCommand(kw, usage, this, "Object Management");
1277kw = "listobjs";
1278usage = "Prints the list of objects (Alias: ls)";
1279 usage += "\n Usage: listobjs [patt=*] \n patt : /*/x?y* ... ";
1280mpiac->RegisterCommand(kw, usage, this, "Object Management");
1281kw = "rename";
1282usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew";
1283usage += "\n Related commands: mv del delobjs";
1284mpiac->RegisterCommand(kw, usage, this, "Object Management");
1285kw = "mv";
1286usage = "Rename an object (Alias: rename) \n Usage: mv nameobj namenew";
1287usage += "\n Related commands: rename del delobjs";
1288mpiac->RegisterCommand(kw, usage, this, "Object Management");
1289kw = "copy";
1290usage = "Copy objects (Alias cp) \n";
1291usage +=" Usage: copy name_from name_to";
1292usage += "\n Related commands: cp new...";
1293mpiac->RegisterCommand(kw, usage, this, "Object Management");
1294kw = "cp";
1295usage = "Copy objects (Alias copy) \n";
1296usage +=" Usage: cp name_from name_to";
1297usage += "\n Related commands: copy new...";
1298mpiac->RegisterCommand(kw, usage, this, "Object Management");
1299kw = "del";
1300usage = "Deletes an object (Alias: rm) \n Usage: del nameobj [nameobj2 ...]";
1301usage += "\n Related commands: rm delobjs rename";
1302mpiac->RegisterCommand(kw, usage, this, "Object Management");
1303kw = "rm";
1304usage = "Deletes an object (Alias: del) \n Usage: rm nameobj [nameobj2 ...]";
1305usage += "\n Related commands: del delobjs rename";
1306mpiac->RegisterCommand(kw, usage, this, "Object Management");
1307kw = "delobjs";
1308usage = "Delete a set of objects with names matching a pattern (x?y*)";
1309usage += "\n Usage: delobjs nameobjpattern \n";
1310usage += "\n Related commands: del rename";
1311mpiac->RegisterCommand(kw, usage, this, "Object Management");
1312
1313kw = "newh1d";
1314usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
1315usage += "\n Related commands: newh2d newprof[e] newnt newgfd ";
1316mpiac->RegisterCommand(kw, usage, this, "Objects");
1317kw = "newh2d";
1318usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
1319usage += "\n Related commands: newh1d newprof[e] newnt newgfd ";
1320mpiac->RegisterCommand(kw, usage, this, "Objects");
1321kw = "newprof";
1322usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
1323usage += "\n Errors represent the data spread in the X bin ";
1324usage += "\n Related commands: newh1d newh2d newprofe newnt newgfd ";
1325mpiac->RegisterCommand(kw, usage, this, "Objects");
1326kw = "newprofe";
1327usage = "Creates a profile histogramm \n Usage: newprofe name xmin xmax nbin [ymin ymax]";
1328usage += "\n Errors represent the error on the data mean in the X bin ";
1329usage += "\n Related commands: newh1d newh2d newprof newnt newgfd ";
1330mpiac->RegisterCommand(kw, usage, this, "Objects");
1331kw = "newnt";
1332usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn";
1333usage += "\n newnt name nvar";
1334usage += "\n Related commands: newh1d newh2d newprof[e] newgfd ";
1335mpiac->RegisterCommand(kw, usage, this, "Objects");
1336kw = "newgfd";
1337usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
1338usage += "\n Related commands: newh1d newh2d newprof[e] newnt ";
1339mpiac->RegisterCommand(kw, usage, this, "Objects");
1340kw = "newvec";
1341usage = "Creates (and optionaly fills) a vector \n Usage: newvec name size [f(i) [dopt] ] ";
1342usage += "\n Related commands: newmtx";
1343mpiac->RegisterCommand(kw, usage, this, "Objects");
1344kw = "newmtx";
1345usage = "Creates (and optionaly fills) a matrix \n";
1346usage +=" Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) [dopt] ] ";
1347usage += "\n Related commands: newvec";
1348mpiac->RegisterCommand(kw, usage, this, "Objects");
1349
1350kw = "disp";
1351usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
1352usage += "\n Related commands: surf nt2d nt3d vecplot";
1353mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1354kw = "imag";
1355usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
1356usage += "\n Related commands: disp surf nt2d nt3d vecplot";
1357mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1358kw = "surf";
1359usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
1360usage += "\n Related commands: disp nt2d nt3d vecplot";
1361mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1362kw = "nt2d";
1363usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
1364usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
1365usage += "\n Related commands: disp surf nt3d gfd2d vecplot";
1366mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1367kw = "nt3d";
1368usage = "Displays 3D-Points (X-Y-Z) [with error-bars / Weight / Label ] from an NTuple ";
1369usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz wt label graphic_attributes]";
1370usage += "\n Related commands: disp surf nt2d gfd3d ";
1371mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1372kw = "vecplot";
1373usage = "Displays Points (X-Y) with coordinates defined by two vectors ";
1374usage += "\n Usage : vecplot nameVecX nameVecY [graphic_attributes]";
1375usage += "\n Related commands: disp nt2d ";
1376mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1377
1378// Ceci est maintenant obsolete, on garde pour info.
1379kw = "gfd2d";
1380usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
1381usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
1382usage += "\n Related commands: gfd3d nt2d nt3d ";
1383usage += "\n ----- OBSOLETE: utilisez nt2d -----";
1384mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1385kw = "gfd3d";
1386usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
1387usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
1388usage += "\n Related commands: gfd2d nt2d nt3d ";
1389usage += "\n ----- OBSOLETE: utilisez nt3d -----";
1390mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
1391
1392kw = "func";
1393usage = "Displays a function y=f(x) (Fills a vector with function values)";
1394usage += "\n Usage: func f(x) xmin xmax [npt graphic_attributes]";
1395usage += "\n Related commands: funcff func2d func2dff ";
1396mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1397kw = "funcff";
1398usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
1399usage += "\n Usage: funcff C-FileName FunctionName xmin xmax [npt graphic_attributes]";
1400usage += "\n Related commands: func func2d func2dff ";
1401mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1402kw = "func2d";
1403usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
1404usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
1405usage += "\n Related commands: func";
1406mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1407kw = "func2dff";
1408usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
1409usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
1410usage += "\n Related commands: func funcff func2d ";
1411mpiac->RegisterCommand(kw, usage, this, "Func Plot");
1412
1413kw = "ObjectExpressions";
1414usage = "Any mathematical expression (math.h) with object variables can be used";
1415usage += "\n ------ Object Variable names (double) -------- ";
1416usage += "\n- NTuple: ntuple variable names";
1417usage += "\n- Histo1D/HProf: i,x,val,err";
1418usage += "\n- Histo2D: i,j,x,y,val,err";
1419usage += "\n- Vector/Matrix: n,r,c,val,real,imag,mod,phas";
1420usage += "\n- TArray: n,x,y,z,t,u,val,real,imag,mod,phas";
1421usage += "\n- Image: i,j,x,y,val(=pix)";
1422usage += "\n- GeneralFitData: x0,ex0 x1,ex1 ... xn,exn y,ey ok";
1423usage += "\n- LocalMap/SphereThetaPhi/SphereHEALPix: ";
1424usage += "\n- i,k,val,real,imag,mod,phas,teta,phi";
1425usage += "\n- FITS Binary/ASCII table: fits column names";
1426#ifdef SANS_EVOLPLANCK
1427usage += "\n ------ Eros Variable names (double) -------- ";
1428usage += "\n- StarList: x,y,flux,fond,pixmax,flags,";
1429usage += "\n- xref,yref,fluxref,fondref,pixmaxref";
1430#endif
1431usage += "\n ------ Other parameters -------- ";
1432usage += "\nLoop parameters can be specified as I1[:I2[:DI]] for(int i=I1; i<I2; i+=DI)";
1433usage += "\nThe default Cut() expression in true (=1) for all";
1434usage += "\n\n Related commands: plot2d plot2de plot2dw plot3d ";
1435usage += "\n projh1d projh2d projprof fillvec fillmtx ";
1436usage += "\n fillnt fillgd1 fillgd2 ntloop exptovec ... ";
1437mpiac->RegisterCommand(kw, usage, NULL, "Expr. Plotting");
1438kw = "plot2d";
1439usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
1440usage += "\n Usage: plot2d nameobj f_X() g_Y() [f_Cut() graphic_attributes loop_param]";
1441usage += "\n Related commands: plot2de plot2dw plot3d ObjectExpressions ...";
1442mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1443kw = "plot2de";
1444usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) ";
1445usage += "\n Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]";
1446usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1447mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1448kw = "plot2dw";
1449usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) ";
1450usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() [Cut() graphic_attributes loop_param]";
1451usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1452mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1453kw = "plot3d";
1454usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
1455usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() [Cut() graphic_attributes loop_param]";
1456usage += "\n Related commands: plot2d plot2dw plot2de plot3d ObjectExpressions ...";
1457mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1458
1459kw = "projh1d";
1460usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
1461usage += "\n Usage: projh1d nameh1d nameobj f_X() [h_WT()=1. Cut() graphic_attributes loop_param]";
1462usage += "\n Histo1D nameh1d is created if necessary ";
1463usage += "\n Related commands: projh2d projprof ObjectExpressions ...";
1464mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1465kw = "projh2d";
1466usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
1467usage += "\n Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
1468usage += "\n Histo2D nameh2d is created if necessary ";
1469usage += "\n Related commands: projh1d projprof ObjectExpressions ...";
1470mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1471kw = "projprof";
1472usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
1473usage += "\n Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
1474usage += "\n HProf nameprof is created if necessary ";
1475usage += "\n Related commands: projh1d projh2d ObjectExpressions ...";
1476mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1477kw = "fillvec";
1478usage = "Fills a Vector V((int)(f_X(Object)+0.5)) = h_V(Object) ";
1479usage += "\n Usage: fillvec namevec nameobj f_X() h_V() [Cut() graphic_attributes loop_param]";
1480usage += "\n Related commands: fillmtx fillnt ObjectExpressions ...";
1481mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1482kw = "fillmtx";
1483usage = "Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) = h_V(Object) ";
1484usage += "\n Usage: fillvec namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]";
1485usage += "\n Related commands: fillvec fillnt ObjectExpressions ...";
1486mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1487
1488kw = "fillnt";
1489usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
1490usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]";
1491usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof ";
1492usage += "\n Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...";
1493mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1494
1495kw = "ntloop";
1496usage = "Loops over an Object NTupleInterface calling a function from a C-file \n";
1497usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
1498usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]";
1499usage += "\n Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...";
1500usage += "\n Related commands: ntexpcfile fillnt";
1501mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1502
1503kw = "ntexpcfile";
1504usage = "Creates a C-File with declarations suitable to be used for ntloop";
1505usage += "\n Usage: ntexpcfile nameobj CFileName FuncName ";
1506usage += "\n Related commands: ntloop";
1507mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1508
1509kw = "exptovec";
1510usage = "Creates and Fills a Vector with X=f(Object)";
1511usage += "\n Usage: exptovec namevec nameobj f_X() [Cut() graphic_attributes loop_param]";
1512usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1513mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1514kw = "fillgd1";
1515usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
1516usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_ErrY() [Cut() loop_param]";
1517usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1518mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1519kw = "fillgd2";
1520usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
1521usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]";
1522usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
1523mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1524kw = "gdfrvec";
1525usage = "Fills a GeneralFitData with vectors X,Y,Z,EZ";
1526usage += "\n Usage: gdfrvec namegfd X Y";
1527usage += "\n Usage: gdfrvec namegfd X Y ! EY";
1528usage += "\n Usage: gdfrvec namegfd X Y Z";
1529usage += "\n Usage: gdfrvec namegfd X Y Z EZ";
1530usage += "\n Related commands: fillgd1 fillgd2 ...";
1531mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1532
1533
1534kw = "eval";
1535usage = "Compute arithmetic expression\n";
1536usage += "\n Usage: eval resultvarname arithmetic expression....";
1537usage += "\n resultvarname: store result in variable resultvarname";
1538usage += "\n - If first character is not alphabetic, just print result";
1539usage += "\n arithmetic expression:";
1540usage += "\n ex: x + sqrt(y)+z +3.14 (x,y,z are variables)";
1541usage += "\n ex: $x + sqrt($y)+$z +3.14 (x,y,z are variables)";
1542usage += "\n ex: 360 * M_PI / 180.";
1543mpiac->RegisterCommand(kw, usage, this, "Expr. Arithmetic");
1544
1545}
1546
1547/* --Methode-- */
1548int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
1549// string& func4, string& func5)
1550{
1551string cmd;
1552
1553if (dynlink) delete dynlink; dynlink = NULL;
1554usfmap.clear();
1555
1556dynlink = new PDynLinkMgr(fnameso, true);
1557if (dynlink == NULL) {
1558 string sn = fnameso;
1559 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
1560 return(2);
1561 }
1562
1563int nok=0;
1564// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1565// DlUserProcFunction f = NULL;
1566DlFunction f = NULL;
1567if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1568// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
1569f = dynlink->GetFunction(func1);
1570if (f) { nok++; usfmap[func1] = f; }
1571else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
1572
1573if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1574// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
1575f = dynlink->GetFunction(func2);
1576if (f) { nok++; usfmap[func2] = f; }
1577else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
1578
1579if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1580// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
1581f = dynlink->GetFunction(func3);
1582if (f) { nok++; usfmap[func3] = f; }
1583else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
1584
1585/* Pb compile g++ 2.7.2
1586if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
1587// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
1588f = dynlink->GetFunction(func4);
1589if (f) { nok++; usfmap[func4] = f; }
1590else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
1591
1592if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
1593// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
1594f = dynlink->GetFunction(func5);
1595if (f) { nok++; usfmap[func5] = f; }
1596else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
1597*/
1598fin:
1599if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
1600else return(0);
1601}
1602
1603/* --Methode-- */
1604int PIABaseExecutor::LinkUserFuncs2(string& fnameso, string& func1, string& func2, string& func3)
1605{
1606string cmd;
1607
1608if (dynlink2) delete dynlink2; dynlink2 = NULL;
1609usfmap2.clear();
1610
1611dynlink2 = new PDynLinkMgr(fnameso, true);
1612if (dynlink2 == NULL) {
1613 string sn = fnameso;
1614 cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur ouverture SO " << sn << endl;
1615 return(2);
1616 }
1617
1618int nok=0;
1619// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1620// DlUserProcFunction f = NULL;
1621DlFunction f = NULL;
1622if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1623f = dynlink2->GetFunction(func1);
1624if (f) { nok++; usfmap2[func1] = f; }
1625else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func1 << endl;
1626
1627if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1628f = dynlink2->GetFunction(func2);
1629if (f) { nok++; usfmap2[func2] = f; }
1630else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func2 << endl;
1631
1632if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1633f = dynlink2->GetFunction(func3);
1634if (f) { nok++; usfmap2[func3] = f; }
1635else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func3 << endl;
1636
1637fin:
1638if (nok < 1) { if (dynlink2) delete dynlink2; dynlink2 = NULL; return(3); }
1639else return(0);
1640}
1641
1642/* Nouvelle-Fonction */
1643void RegisterPIGraphicsHelp(PIACmd* piac)
1644{
1645string kw,grp,usage;
1646
1647grp = "Graphics";
1648
1649kw = "PIImage";
1650usage = "Manages the display of a 2-D array (P2DArrayAdapter) as an image \n";
1651usage += "and controls a zoom widget, as well as a global image view widget \n";
1652usage += ">>>> Mouse controls : \n";
1653usage += "o Button-1: Display current coordinates and pixel value\n";
1654usage += " Position the cursor an refresh the zoom widget\n";
1655usage += "o Button-2: Defines an image zone and positions the cursor \n";
1656usage += "o Button-3: Moves the viewed portion of the array inside the window \n";
1657usage += ">>>> Keyboard controls : \n";
1658usage += "o <Alt>R : Refresh display \n";
1659usage += "o <Alt>O : Shows the PIImageTools (image display parameter controls) \n";
1660usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of overlayed graphics (Drawers)) \n";
1661usage += "o <Alt>V : Copy/Paste / Text paste at the current cursor position \n";
1662usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
1663usage += "o <Alt>X : Show/Hide the Cut Window \n";
1664usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
1665usage += "o <Alt>E : Removes the last added graphic element \n";
1666usage += "o <Alt>+ or <Cntl>+ : Zoom in \n";
1667usage += "o <Alt>- or <Cntl>- : Zoom out \n";
1668usage += "o Cursor keys : Moves the image cursor \n";
1669piac->RegisterHelp(kw, usage, grp);
1670
1671kw = "PIScDrawWdg";
1672usage = "Manages display of 2-D drawers with interactive zoom \n";
1673usage += ">>>> Mouse controls : \n";
1674usage += "o Button-1: Display current coordinates \n";
1675usage += "o Button-2: Defines a rectangle for zoom \n";
1676usage += "o Button-3: Defines a rectangle for Text-Info (<Alt>I) \n";
1677usage += ">>>> Keyboard controls : \n";
1678usage += "o <Alt>R : Refresh display \n";
1679usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
1680usage += " Specific controls for 2-D histograms \n";
1681usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1682usage += " Drawer 0 manages the axes, as well as the added text \n";
1683usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
1684usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
1685usage += "o <Alt>E : Removes the last added graphic element \n";
1686usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle \n";
1687usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1\n";
1688usage += "o <Alt>L : Deactivate DX,DY print (see below)\n";
1689usage += ">>>> Mouse + Keyboard controls : \n";
1690usage += "o Button-1 + <Alt>K : Set (reset) the reference point for DX,DY print \n";
1691piac->RegisterHelp(kw, usage, grp);
1692
1693kw = "PIDraw3DWdg";
1694usage = "Manages display of 3-D objects (drawers) \n";
1695usage += ">>>> Mouse controls : \n";
1696usage += "o Button-2: Rotates the observer (camera) around object \n";
1697usage += "o Shift-Button-2: Rotates object with camera fixed \n";
1698usage += " The object rotation mode can be assigned to Button-2 with <Alt>S \n";
1699usage += "o Button-3: Zoom control (Camera distance And/Or view angle) \n";
1700usage += ">>>> Keyboard controls : \n";
1701usage += "o <Alt>R : Resets the 3-D view and refreshes the display \n";
1702usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1703usage += "o <Alt>O : = <Alt>G \n";
1704usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
1705usage += "o <Alt>Z : Removes added graphic elements (handled by BaseDrawer - 0) \n";
1706usage += "o <Alt>E : Removes the last added graphic element \n";
1707usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
1708usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
1709piac->RegisterHelp(kw, usage, grp);
1710
1711kw = "Windows";
1712usage = "Objects can be displayed in different windows, or overlayed on the \n";
1713usage += "previous display. The graphics attributes next,win,stack,same control \n";
1714usage += "the display window. \n";
1715usage += "o GraphicWindow : This is the default mode (gr_att=next)\n";
1716usage += " Graphic windows can be divided int zones. Object is displayed \n";
1717usage += " in the next available position, removing a previously displayed \n";
1718usage += " widget if necessary \n";
1719usage += "o Window : An object is displayed in its own window (gr_att= win) \n";
1720usage += "o StackWindow : multpile widgets can be stacked in a StackWindow (gr_att= stack) \n";
1721usage += " A single widget is displayed a any time. Different widgets in a StackWindow \n";
1722usage += " can be displayed using the stacknext command, as well as the StackTools item \n";
1723usage += " in the Tools menu (from Menubar). An automatic cyclic display mode can also \n";
1724usage += " be activated using the StackTools menu (Blink) \n";
1725usage += "o Most objects can be also be displayed overlayed \n";
1726usage += " on the last displayed widget (gr_att= same) \n";
1727usage += "o The overlay can be on a selected rectangle of the \n";
1728usage += " last displayed widget (gr_att= inset) - See setinsetlimits\n";
1729usage += "\n Related commands: newwin zone stacknext graphicatt setinsetlimits";
1730piac->RegisterHelp(kw, usage, grp);
1731
1732kw = "PIConsole";
1733usage = "Text output area and command editing window (console) \n";
1734usage += ">>>> Mouse controls : \n";
1735usage += "o Button-1: Rectangle selection for copy/paste \n";
1736usage += "o Button-2: Paste text in the command editing line \n";
1737usage += "o Button-3: activate display option menu \n";
1738usage += ">>>> Keyboard controls : \n";
1739usage += "o <Alt>O : activate display option menu \n";
1740usage += "o <Alt>V : Paste text in the command editing line \n";
1741usage += "o <Alt>A : Selection of the whole window for copy \n";
1742usage += "o <Alt>L : Command history (List of command history buffer) \n";
1743usage += "o <Ctl>A : Command editing -> Goto the beginning of line \n";
1744usage += "o <Ctl>E : Command editing -> Goto the end of line \n";
1745usage += "o <Ctl>K : Command editing -> Clear to the end of line \n";
1746usage += "o <Ctl>C : Command editing -> Clear the line \n";
1747usage += "o Cursor left,right : Command editing -> Move cursor \n";
1748usage += "o Cursor Up,Down : recall command from history buffer \n";
1749usage += "o Backspace,Del : Command editing \n";
1750usage += "o <Return>,<Enter> : Execute command \n";
1751piac->RegisterHelp(kw, usage, grp);
1752}
Note: See TracBrowser for help on using the repository browser.