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

Last change on this file since 2669 was 2669, checked in by cmv, 20 years ago
  • n/read pour creer et remplir un ntuple a partir d'un choix de colonnes d'un fichier ASCII
  • n/merge pour merger des ntuples dans un ntuple unique
  • savelist pour sauver une liste d'objects dans un fichier ppf

cmv 15/04/2005

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