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

Last change on this file since 2642 was 2638, checked in by ansari, 21 years ago

Ajout commandes addoval addfoval pour trace d'ellipse - Reza 19/11/2004

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