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

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

Correction bug ds PIACmd::SubstituteVar(), ajout commandes line2vec line2nt vec2var ... - Reza 08/01/2003

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