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

Last change on this file since 2764 was 2755, checked in by ansari, 20 years ago

1/ Correction bug trace des lignes ds PINTuple
2/ Ajout methode IsThreadable() (declaration conformite thread separe pour certaines commandes) ds baseexecut.h .cc (plot2d plot3d ...) , ds pawexecut.cc (n/plot ...) et ds cxxexecutor.h .cc (c++exec c++execfrf ...)
3/ Ajout de ZMutex (et ZSync) pour la gestion des commandes threadable - ds les
executeurs et ds servnobjm.h .cc
4/ bug d'execution en thread identifie et corrige ds nobjmgr.h .cc (ajout des
methodes GetObj_P() GetObjAdapter_P() et ReadObj_P()
5/ Ajout de l'appel a ZSync::NOp() pour eviter les warnings 'unused variable zs ...'

Reza 23 Mai 2005

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