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

Last change on this file since 1539 was 1525, checked in by ansari, 24 years ago

Ajout methode NamedObjMgr::DisplayVector() et commande vecplot , Reza 13/6/2001

File size: 52.9 KB
RevLine 
[293]1#include "piacmd.h"
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <math.h>
6
7#include "basexecut.h"
8
9#include "pdlmgr.h"
10#include "ctimer.h"
11
12#include "pistdimgapp.h"
13#include "nobjmgr.h"
[326]14#include "servnobjm.h"
[293]15
16#include "histos.h"
17#include "histos2.h"
18#include "hisprof.h"
19#include "ntuple.h"
20#include "generaldata.h"
[769]21
22#ifdef SANS_EVOLPLANCK
[333]23#include "cvector.h"
[769]24#else
25#include "tvector.h"
26#endif
[293]27
28
29/* --Methode-- */
30PIABaseExecutor::PIABaseExecutor(PIACmd* piac, NamedObjMgr* omg, PIStdImgApp* app)
31{
32mpiac = piac;
33mObjMgr = omg;
34mImgApp = app;
[312]35dynlink = NULL;
[1276]36dynlink2 = NULL;
[293]37RegisterCommands();
38}
39
40PIABaseExecutor::~PIABaseExecutor()
41{
[1276]42 if (dynlink) delete dynlink;
43 if (dynlink2) delete dynlink2;
[293]44}
45
46
47
48/* --Methode-- */
[1268]49int PIABaseExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
[293]50{
[333]51Services2NObjMgr* srvo = mObjMgr->GetServiceObj();
[293]52// >>>>> Chargement de modules
53if (kw == "loadmodule") {
54 if (tokens.size() < 2) { cout << "Usage: loadmodule fnameso modulename" << endl; return(0); }
55 mpiac->LoadModule(tokens[0], tokens[1]);
56 }
57// >>>>>>>>>>> Fenetre graphique , changement d'attributs graphiques
58else if (kw == "zone") {
[384]59 while (tokens.size() < 2) tokens.push_back("1");
[293]60 int nx, ny;
61 nx = ny = 1;
62 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str());
63 mObjMgr->SetGraphicWinZone(nx, ny, false);
64 }
65else if (kw == "newwin") {
[1451]66 int nx=1, ny=1;
67 //if(tokens.size() < 2) { cout << "Usage: newwin nx ny" << endl; return(0); }
68 if(tokens.size() > 0) nx = atoi(tokens[0].c_str());
69 if(tokens.size() > 1) ny = atoi(tokens[1].c_str());
[293]70 mObjMgr->SetGraphicWinZone(nx, ny, true);
71 }
72else if (kw == "stacknext") mImgApp->StackWinNext();
[553]73else if (kw == "graphicatt") {
74 if (tokens.size() < 1) { cout << "Usage: graphicatt attributes_list (att=def->defaut)" << endl; return(0); }
[293]75 mObjMgr->SetGraphicAttributes(tokens[0]);
76 }
[331]77else if (kw == "setxylimits") {
78 if (tokens.size() < 4) { cout << "Usage: setxylimits xmin xmax ymin ymax" << endl; return(0); }
79 double xmin = atof(tokens[0].c_str());
80 double xmax = atof(tokens[1].c_str());
81 double ymin = atof(tokens[2].c_str());
82 double ymax = atof(tokens[3].c_str());
83 mImgApp->SetXYLimits(xmin, xmax, ymin, ymax);
84 }
[548]85else if (kw == "setinsetlimits") {
86 if (tokens.size() < 4) { cout << "Usage: setinsetlimits xmin xmax ymin ymax" << endl; return(0); }
87 double xmin = atof(tokens[0].c_str());
88 double xmax = atof(tokens[1].c_str());
89 double ymin = atof(tokens[2].c_str());
90 double ymax = atof(tokens[3].c_str());
91 mImgApp->SetInsetLimits(xmin, xmax, ymin, ymax);
92 }
[558]93else if (kw == "setimgcenter") {
94 if (tokens.size() < 2) { cout << "Usage: setimgcenter xc yc" << endl; return(0); }
95 int xc = atoi(tokens[0].c_str());
96 int yc = atoi(tokens[1].c_str());
97 mImgApp->SetImageCenterPosition(xc, yc);
98 }
[349]99else if (kw == "addtext") {
100 if (tokens.size() < 4) { cout << "Usage: addtext x y colfontatt txt" << endl; return(0); }
101 double xp = atof(tokens[0].c_str());
102 double yp = atof(tokens[1].c_str());
103 bool fgsr = true;
104 string txt = tokens[3];
105 for(int k=4; k<tokens.size(); k++) txt += (' ' + tokens[k]);
106 int opt = mObjMgr->GetServiceObj()->DecodeDispOption(tokens[2], fgsr);
107 mImgApp->AddText(txt, xp, yp);
108 if (fgsr) mImgApp->RestoreGraphicAtt();
109 }
[1131]110else if (kw == "settitle") {
111 if (tokens.size() < 2) { cout << "Usage: addtitle fontatt titleup " << endl; return(0); }
112 bool fgsr = true;
113 int opt = mObjMgr->GetServiceObj()->DecodeDispOption(tokens[0], fgsr);
114 string txt = tokens[1];
115 for(int k=2; k<tokens.size(); k++) txt += (' ' + tokens[k]);
116 string td = "";
117 mImgApp->SetTitle(txt, td);
118 if (fgsr) mImgApp->RestoreGraphicAtt();
119 }
[349]120
[293]121// >>>>>>>>>>> Link dynamique de fonctions C++
122else if (kw == "link" ) {
123 if (tokens.size() < 2) { cout << "Usage: link fnameso f1 [f2 f3]" << endl; return(0); }
124 string sph = "";
125 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
126 int rc = LinkUserFuncs(tokens[0], tokens[1], tokens[2], tokens[3]);
127 if (rc == 0) cout << "PIABaseExecutor: Link from " << tokens[0] << " OK " << endl;
128}
[1276]129else if (kw == "linkff2" ) {
130 if (tokens.size() < 2) { cout << "Usage: linkff2 fnameso f1 [f2 f3]" << endl; return(0); }
131 string sph = "";
132 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
133 int rc = LinkUserFuncs2(tokens[0], tokens[1], tokens[2], tokens[3]);
134 if (rc == 0) cout << "PIABaseExecutor: Link2 from " << tokens[0] << " OK " << endl;
135}
[293]136else if (kw == "call" ) {
137 if (tokens.size() < 1) { cout << "Usage: call userf [arg1 arg2 ...]" << endl; return(0); }
[1276]138 UsFmap::iterator it;
139 UsFmap::iterator it1 = usfmap.find(tokens[0]);
140 UsFmap::iterator it2 = usfmap2.find(tokens[0]);
141 if ((it1 == usfmap.end()) && (it2 == usfmap2.end()) ) {
[293]142 cerr << "PIABaseExecutor: No User Function " << tokens[0] << endl;
143 return(0);
144 }
[1276]145 if (it1 == usfmap.end()) it = it2;
146 else it = it1;
[293]147 cout << "PIABaseExecutor: Call " << tokens[0] << "( ... )" << endl;
148// on est oblige de faire un cast etant donne qu'on
149// utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
150 DlUserProcFunction fuf = (DlUserProcFunction)(*it).second;
151// On redirige la sortie sur le terminal
152 bool red = mImgApp->HasRedirectedStdOutErr();
153 mImgApp->RedirectStdOutErr(false);
[1276]154#ifdef SANS_EVOLPLANCK
[293]155 TRY {
156 tokens.erase(tokens.begin());
157 fuf(tokens);
158 } CATCH(merr) {
159 fflush(stdout);
[1276]160 string es = PeidaExc(merr);
161 cerr << "\n PIABaseExecutor: Call UserFunc Exception :" << merr << es;
[293]162 cout << endl;
163 }
[1276]164#else
165 try {
166 tokens.erase(tokens.begin());
167 fuf(tokens);
168 }
169 catch ( PThrowable & exc ) {
170 cerr << "\n PIABaseExecutor: Call / Catched Exception :"
171 << (string)typeid(exc).name() << " Msg= "
172 << exc.Msg() << endl;
173 cout << endl;
174 }
175 catch ( ... ) {
176 cerr << "\n PIABaseExecutor: Call / Catched Exception ... "
177 << endl;
178 cout << endl;
179 }
180#endif
[293]181 mImgApp->RedirectStdOutErr(red);
182}
183
184// >>>>>>>>>>> lecture/ecriture des objets, gestion des objets
185else if (kw == "openfits" ) {
186 if (tokens.size() < 1) { cout << "Usage: openfits file " << endl; return(0); }
[331]187 else { string nomobj = ""; mObjMgr->ReadFits(tokens[0], nomobj); }
[293]188}
189else if (kw == "savefits" ) {
190 if (tokens.size() < 2) { cout << "Usage: savefits nameobj filename " << endl; return(0); }
191 else mObjMgr->SaveFits(tokens[0], tokens[1]);
192}
193else if (kw == "openppf" ) {
194 if (tokens.size() < 1) { cout << "Usage: openppf file " << endl; return(0); }
195 mObjMgr->ReadAll(tokens[0]);
196}
[333]197else if (kw == "saveobjs" ) {
198 if (tokens.size() < 2) { cout << "Usage: saveobjs patt filename " << endl; return(0); }
199 mObjMgr->SaveObjects(tokens[0], tokens[1]);
200}
[293]201else if (kw == "saveall" ) {
202 if (tokens.size() < 1) { cout << "Usage: saveall file " << endl; return(0); }
203 mObjMgr->SaveAll(tokens[0]);
204}
205else if (kw == "print" ) {
206 if (tokens.size() < 1) { cout << "Usage: print nameobj " << endl; return(0); }
207 mObjMgr->PrintObj(tokens[0]);
208}
[333]209else if ( (kw == "rename" ) || (kw == "mv") ) {
[293]210 if (tokens.size() < 2) { cout << "Usage: rename nameobj namenew" << endl; return(0); }
211 mObjMgr->RenameObj(tokens[0], tokens[1]);
212}
[333]213else if ( (kw == "del" ) || (kw == "rm") ) {
[293]214 if (tokens.size() < 1) { cout << "Usage: del nameobj " << endl; return(0); }
215 mObjMgr->DelObj(tokens[0]);
216}
217else if (kw == "delobjs" ) {
218 if (tokens.size() < 1) { cout << "Usage: delobjs nomobjpattern (*,?) " << endl; return(0); }
219 mObjMgr->DelObjects(tokens[0]);
220}
[333]221else if ( (kw == "listobjs") || (kw == "ls") ) {
[331]222 if (tokens.size() < 1) tokens.push_back("*");
223 mObjMgr->ListObjs(tokens[0]);
224}
[333]225// Gestion des repertoires
226else if (kw == "mkdir" ) {
[344]227 if (tokens.size() < 1) { cout << "Usage: mkdir dirname [true]" << endl; return(0); }
228 bool crd = mObjMgr->CreateDir(tokens[0]);
229 if ( crd && (tokens.size() > 1) && (tokens[1] == "true") )
230 mObjMgr->SetKeepOldDirAtt(tokens[0], true);
[333]231 }
232else if (kw == "rmdir" ) {
233 if (tokens.size() < 1) { cout << "Usage: rmdir dirname " << endl; return(0); }
234 mObjMgr->DeleteDir(tokens[0]);
235 }
236else if (kw == "cd") {
237 if (tokens.size() < 1) tokens.push_back("home");
238 mObjMgr->SetCurrentDir(tokens[0]);
239 }
[345]240else if (kw == "pwd") {
241 string dirn;
242 mObjMgr->GetCurrentDir(dirn);
243 cout << "CurrentDirectory: " << dirn << endl;
244 }
[333]245else if (kw == "listdirs") {
246 if (tokens.size() < 1) tokens.push_back("*");
247 mObjMgr->ListDirs(tokens[0]);
248 }
[293]249
250// >>>>>>>>>>> Creation d'histos 1D-2D
251else if (kw == "newh1d") {
252 if (tokens.size() < 4) { cout << "Usage: newh1d name xmin xmax nbin" << endl; return(0); }
[1091]253 int_4 nbx = 100;
254 r_8 xmin = 0., xmax = 1.;
[293]255 nbx = atoi(tokens[3].c_str());
256 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
257 Histo* h = new Histo(xmin, xmax, nbx);
258 mObjMgr->AddObj(h, tokens[0]);
259 }
260else if (kw == "newh2d") {
261 if (tokens.size() < 7) {
262 cout << "Usage: newh2d name xmin xmax nbinx ymin ymax nbiny" << endl;
263 return(0);
264 }
[1091]265 int_4 nbx = 50, nby = 50;
266 r_8 xmin = 0., xmax = 1.;
267 r_8 ymin = 0., ymax = 1.;
[293]268 nbx = atoi(tokens[3].c_str());
269 nby = atoi(tokens[6].c_str());
270 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
271 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
272 Histo2D* h = new Histo2D(xmin, xmax, nbx, ymin, ymax, nby);
273 mObjMgr->AddObj(h, tokens[0]);
274 }
[1035]275else if (kw == "newprof" || kw == "newprofe") {
[293]276 if (tokens.size() < 4)
[1035]277 { cout << "Usage: newprof[e] name xmin xmax nbin [ymin ymax]" << endl; return(0); }
[1091]278 int_4 nbx = 100;
279 r_8 xmin = 0., xmax = 1., ymin = 1., ymax = -1.;
[293]280 if(tokens.size() > 5)
281 {ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());}
282 nbx = atoi(tokens[3].c_str());
283 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
284 HProf* h = new HProf(xmin, xmax, nbx, ymin, ymax);
[1035]285 if(kw == "newprofe") h->SetErrOpt(false);
[293]286 mObjMgr->AddObj(h, tokens[0]);
287 }
[447]288
289// Creation de NTuple
290else if (kw == "newnt") {
291 if(tokens.size() < 2)
292 {cout<<"Usage: newnt name v1 v2 ... vn / newnt name nvar"<<endl; return(0);}
293 vector<string> varname;
294 int nvar = 0;
295 const char *c = tokens[1].c_str();
296 if(isdigit(c[0])) {
297 nvar = atoi(tokens[1].c_str());
298 if(nvar<=0 || nvar>=10000)
299 {cout<<"newnt name nvar : nvar must be an positive integer<10000"<<endl;
300 return(0);}
301 for(int i=0;i<nvar;i++) {
302 char str[16]; sprintf(str,"%d",i);
303 string dum = "v"; dum += str;
304 varname.push_back(dum.c_str());
305 }
306 } else if( islower(c[0]) || isupper(c[0]) ) {
307 for(int i=1;i<tokens.size();i++) {
308 varname.push_back(tokens[i].c_str());
309 nvar++;
310 }
311 } else {
312 cout<<"newnt name v1 v2 ... vn : name vi must begin by a letter"<<endl
313 <<"newnt name nvar : nvar must be an positive integer"<<endl;
314 return(0);
315 }
316 char **noms = new char*[nvar];
317 for(int i=0;i<nvar;i++) noms[i] = (char *)varname[i].c_str();
318 NTuple* nt = new NTuple(nvar,noms);
319 delete [] noms;
320 mObjMgr->AddObj(nt,tokens[0]);
321 }
322
323// Creation de GeneralFitData
[293]324else if (kw == "newgfd") {
325 if (tokens.size() < 3)
326 { cout << "Usage: newgfd nvar nalloc [errx(0/1)]" << endl; return(0); }
327 int nvar, nalloc, errx=0;
328 if (tokens.size() > 3)
329 { errx = atoi(tokens[3].c_str()); if(errx>0) errx=1; else errx = 0;}
330 nvar = atoi(tokens[1].c_str()); nalloc = atoi(tokens[2].c_str());
331 if(nvar>0 && nalloc>0) {
332 GeneralFitData* gfd = new GeneralFitData(nvar,nalloc,errx);
333 mObjMgr->AddObj(gfd, tokens[0]);
334 }
335 }
336
[333]337// Creation/remplissage de vecteur et de matrice
338else if (kw == "newvec") {
339 if (tokens.size() < 2) {
340 cout << "Usage: newvec name size [f(i) dopt] " << endl; return(0);
341 }
342 int n = atoi(tokens[1].c_str());
343 double xmin, xmax;
344 xmin = 0.; xmax = n;
[357]345 if (tokens.size() < 3) {
346 Vector* v = new Vector(n);
347 mObjMgr->AddObj(v, tokens[0]);
348 }
349 else {
350 if (tokens.size() < 4) tokens.push_back("");
351 mObjMgr->GetServiceObj()->PlotFunc(tokens[2], tokens[0], xmin, xmax, n, tokens[3]);
352 }
[333]353 }
354else if (kw == "newmtx") {
355 if (tokens.size() < 3) {
[357]356 cout << "Usage: newvec name sizeX(Col) sizeY(Lines) [f(i,j) dopt] " << endl; return(0);
[333]357 }
358 int nx = atoi(tokens[1].c_str());
359 int ny = atoi(tokens[2].c_str());
360 double xmin, xmax, ymin, ymax;
361 xmin = 0.; xmax = nx;
362 ymin = 0.; ymax = ny;
[357]363 if (tokens.size() < 4) {
364 Matrix* mtx = new Matrix(ny,nx);
365 mObjMgr->AddObj(mtx, tokens[0]);
366 }
367 else {
368 if (tokens.size() < 5) tokens.push_back("n");
369 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[3], tokens[0], xmin, xmax, ymin, ymax,
370 nx, ny, tokens[4]);
371 }
[333]372 }
373
[455]374// Copie d'objets
375else if (kw == "copy") {
376 if(tokens.size()<2) {
377 cout<<"Usage: copy name_from name_to"<<endl;return(0);
378 }
[463]379 mObjMgr->CopyObj(tokens[0],tokens[1]);
[455]380}
381
382
[293]383// >>>>>>>>>>> Affichage des objets
[295]384else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
385 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
[293]386 string opt = "n";
387 if (tokens.size() > 1) opt = tokens[1];
388 if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
389 else if (kw == "surf") mObjMgr->DisplaySurf3D(tokens[0], opt);
[295]390 else if (kw == "imag") mObjMgr->DisplayImage(tokens[0], opt);
[293]391 }
392
393else if (kw == "nt2d") {
[486]394 if (tokens.size() < 3) {
395 cout << "Usage: nt2d nameobj varx vary [errx erry wt label opt]" << endl;
396 return(0);
[293]397 }
[486]398 while (tokens.size() < 8) tokens.push_back("");
[333]399 string ph = "";
[486]400 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], ph, tokens[3], tokens[4], ph,
401 tokens[5], tokens[6], tokens[7], false);
[333]402 }
[293]403else if (kw == "nt3d") {
[486]404 if (tokens.size() < 7) {
405 cout << "Usage: nt3d nameobj varx vary varz [errx erry errz wt label opt]" << endl;
406 return(0);
[293]407 }
[486]408 while (tokens.size() < 10) tokens.push_back("");
409 mObjMgr->DisplayNT(tokens[0], tokens[1], tokens[2], tokens[3], tokens[4], tokens[5],
410 tokens[6], tokens[7], tokens[8], tokens[9], true);
411 }
[1525]412else if (kw == "vecplot") {
413 if (tokens.size() < 2) {
414 cout << "Usage: vecplot nameVecX nameVecY [opt]" << endl;
415 }
416 while (tokens.size() < 3) tokens.push_back("");
417 mObjMgr->DisplayVector(tokens[0], tokens[1], tokens[2]);
418}
[293]419
[339]420// Obsolete : ne pas virer SVP, cmv 26/7/99
[293]421else if (kw == "gfd2d") {
[339]422 cout<<"----- gfd2d OBSOLETE: utilisez nt2d -----"<<endl;
[293]423 if(tokens.size()<2)
424 {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
425 return(0);}
426 string numvary = "";
427 string err = "";
428 string opt = "n";
429 if(tokens.size()>2) err = tokens[2];
430 if(tokens.size()>3) opt = tokens[3];
431 mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
432 }
433else if (kw == "gfd3d") {
[339]434 cout<<"----- gfd3d OBSOLETE: utilisez nt3d -----"<<endl;
[293]435 if(tokens.size()<3)
436 {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
437 return(0);}
438 string err = "";
439 string opt = "n";
440 if(tokens.size()>3) err = tokens[3];
441 if(tokens.size()>4) opt = tokens[4];
442 mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
443 }
444
445// >>>>>>>>>>> Trace de fonctions
446else if ( (kw == "func") ) {
447 if (tokens.size() < 4) { cout << "Usage: func f(x) xmin xmax npt [opt]" << endl; return(0); }
[357]448 string opt = "";
[293]449 if (tokens.size() > 4) opt = tokens[4];
450 int np;
[333]451 double xmin, xmax;
[293]452 np = 100;
453 xmin = 0.; xmax = 1.;
454 np = atoi(tokens[3].c_str());
455 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
[333]456 string nom = "";
457 mObjMgr->GetServiceObj()->PlotFunc(tokens[0], nom, xmin, xmax, np, opt);
[293]458 }
[326]459else if ( (kw == "funcff") ) {
460 if (tokens.size() < 5) { cout << "Usage: funcff C-filename f(x)-name xmin xmax npt [opt]" << endl; return(0); }
[357]461 string opt = "";
[326]462 if (tokens.size() > 5) opt = tokens[5];
463 int np;
[333]464 double xmin, xmax;
[326]465 np = 100;
466 xmin = 0.; xmax = 1.;
467 np = atoi(tokens[4].c_str());
468 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
[333]469 string nom = "";
470 mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], nom, xmin, xmax, np, opt);
[326]471 }
[293]472else if ( (kw == "func2d") ) {
473 if (tokens.size() < 7) {
[357]474 cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [opt]" << endl;
[293]475 return(0);
476 }
477 int npx, npy;
[333]478 double xmin, xmax;
479 double ymin, ymax;
[293]480 npx = npy = 50;
481 xmin = 0.; xmax = 1.;
482 ymin = 0.; ymax = 1.;
483 npx = atoi(tokens[3].c_str());
484 npy = atoi(tokens[6].c_str());
485 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
486 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
[357]487 string opt = "";
[293]488 if (tokens.size() > 7) opt = tokens[7];
[333]489 string nom = "";
490 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
[293]491 }
[326]492else if ( (kw == "func2dff") ) {
493 if (tokens.size() < 8) {
[357]494 cout << "Usage: func2d C-filename F(x,y)-name xmax nptx ymin ymax npty [opt]" << endl;
[326]495 return(0);
496 }
497 int npx, npy;
[333]498 double xmin, xmax;
499 double ymin, ymax;
[326]500 npx = npy = 50;
501 xmin = 0.; xmax = 1.;
502 ymin = 0.; ymax = 1.;
503 npx = atoi(tokens[4].c_str());
504 npy = atoi(tokens[7].c_str());
505 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
506 ymin = atof(tokens[5].c_str()); ymax = atof(tokens[6].c_str());
[357]507 string opt = "";
[326]508 if (tokens.size() > 8) opt = tokens[8];
[333]509 string nom = "";
510 mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
[326]511 }
[293]512
513// >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
514else if (kw == "plot2d" ) {
[357]515 if (tokens.size() < 3) {
516 cout << "Usage: plot2d nameobj expx expy [expcut opt loop_par]" << endl;
[293]517 return(0);
518 }
[357]519 string errx = ""; string erry = "";
520 if (tokens.size() < 4) tokens.push_back("1");
521 while (tokens.size() < 6) tokens.push_back("");
522 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,tokens[3],tokens[4],tokens[5]);
523 }
524
525else if (kw == "plot2de" ) { // Plot2D avec les erreurs
526 if (tokens.size() < 5) {
527 cout << "Usage: plot2de nameobj expx expy experrx experry [expcut opt loop_par]" << endl;
528 return(0);
[293]529 }
[357]530 if (tokens.size() < 6) tokens.push_back("1");
531 while (tokens.size() < 8) tokens.push_back("");
532 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4],
533 tokens[5],tokens[6],tokens[7]);
[293]534 }
535
[357]536else if (kw == "plot2dw" ) { // Plot2d avec poids
537 if (tokens.size() < 4) {
538 cout << "Usage: plot2dw nomobj expx expy expwt [expcut opt loop_par]" << endl;
[333]539 return(0);
540 }
[357]541 if (tokens.size() < 5) tokens.push_back("1");
542 while (tokens.size() < 7) tokens.push_back("");
543 srvo->DisplayPoints2DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
[333]544 }
[357]545else if (kw == "plot3d" ) {
546 if (tokens.size() < 4) {
547 cout << "Usage: plot3d nomobj expx expy expz [expcut opt loop_par]" << endl;
[293]548 return(0);
549 }
[357]550 if (tokens.size() < 5) tokens.push_back("1");
551 while (tokens.size() < 7) tokens.push_back("");
552 srvo->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
[293]553 }
554
555else if (kw == "projh1d" ) {
[357]556 if (tokens.size() < 3) {
557 cout << "Usage: projh1d nomh1 nomobj expx [expwt expcut opt loop_par]" << endl;
[293]558 return(0);
559 }
[357]560 if (tokens.size() < 4) tokens.push_back("1.");
561 if (tokens.size() < 5) tokens.push_back("1");
562 while (tokens.size() < 7) tokens.push_back("");
563 srvo->ProjectH1(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
[293]564 }
565
[357]566
567// Projection dans histogrammes
[293]568else if (kw == "projh2d" ) {
[357]569 if (tokens.size() < 4) {
570 cout << "Usage: projh2d nomh2 nomobj expx expy [expwt expcut opt loop_par]" << endl;
[293]571 return(0);
572 }
[357]573 if (tokens.size() < 5) tokens.push_back("1.");
574 if (tokens.size() < 6) tokens.push_back("1");
575 while (tokens.size() < 8) tokens.push_back("");
576 srvo->ProjectH2(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
577 tokens[6], tokens[7] );
[293]578 }
579
580else if (kw == "projprof" ) {
[357]581 if (tokens.size() < 4) {
582 cout << "Usage: projprof nomprof nomobj expx expy [expwt expcut opt loop_par]" << endl;
[293]583 return(0);
584 }
[357]585 if (tokens.size() < 5) tokens.push_back("1.");
586 if (tokens.size() < 6) tokens.push_back("1");
587 while (tokens.size() < 8) tokens.push_back("");
588 srvo->ProjectHProf(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
[1091]589 tokens[6], tokens[7] );
[357]590 }
[293]591
[357]592// Projection dans vector/matrix
593else if (kw == "fillvec" ) {
594 if (tokens.size() < 4) {
595 cout << "Usage: fillvec nomvec nomobj expx expv [expcut opt loop_par]" << endl;
596 return(0);
597 }
598 if (tokens.size() < 5) tokens.push_back("1");
599 while (tokens.size() < 7) tokens.push_back("");
600 srvo->FillVect(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
[293]601 }
602
[357]603else if (kw == "fillmtx" ) {
604 if (tokens.size() < 5) {
605 cout << "Usage: fillmtx nommtx nomobj expx expy expv [expcut opt loop_par]" << endl;
606 return(0);
607 }
608 if (tokens.size() < 6) tokens.push_back("1");
609 while (tokens.size() < 8) tokens.push_back("");
610 srvo->FillMatx(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
611 tokens[6], tokens[7] );
612 }
613
614// Remplissage NTuple,Vecteurs, ... , boucle de NTuple
[447]615else if (kw == "ntfrascii" ) {
616 if(tokens.size() < 2) {
617 cout<<"Usage: ntfrascii nt_name file_name [def_init_val]"<<endl;
618 return(0);
619 }
620 double def_val = 0.;
621 if(tokens.size()>=3) def_val = atof(tokens[2].c_str());
622 srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val);
623 }
624
[293]625else if (kw == "fillnt" ) {
[357]626 if (tokens.size() < 5) {
627 cout << "Usage: fillnt nameobj expx expy expz expt [expcut ntname loop_par]" << endl;
[293]628 return(0);
629 }
[357]630 while (tokens.size() < 8) tokens.push_back("");
631 srvo->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], tokens[7] );
[293]632 }
633
[333]634else if (kw == "ntloop" ) {
635 if (tokens.size() < 3) {
[357]636 cout << "Usage: ntloop nameobj fname funcname [ntname loop_par ]" << endl;
[333]637 return(0);
638 }
[357]639 while (tokens.size() < 5) tokens.push_back("");
640 srvo->FillNTFrCFile(tokens[0],tokens[1], tokens[2], tokens[3], tokens[4]);
[333]641 }
642
643else if (kw == "ntexpcfile" ) {
644 if (tokens.size() < 3) {
645 cout << "Usage: ntexpcfile nameobj fname funcname" << endl;
646 return(0);
647 }
648 srvo->PrepareNTExpressionCFile(tokens[0],tokens[1], tokens[2]);
649 }
650
[357]651else if (kw == "exptovec" ) {
652 if (tokens.size() < 3) {
653 cout << "Usage: exptovec nomvec nameobj expx [expcut opt loop_par]" << endl;
[293]654 return(0);
655 }
[357]656 while (tokens.size() < 6) tokens.push_back("");
657 srvo->ExpressionToVector(tokens[1],tokens[2],tokens[3],tokens[0],tokens[4],tokens[5]);
[293]658 }
659
660else if (kw == "fillgd1" ) {
661 if (tokens.size() < 5) {
[357]662 cout << "Usage: fillgd1 nomgfd nomobj expx expy experry [expcut loop_par] " << endl;
[293]663 return(0);
664 }
[357]665 if (tokens.size() < 6) tokens.push_back("1");
666 if (tokens.size() < 7) tokens.push_back("");
[293]667 string expy = "";
[357]668 srvo->FillGFD(tokens[1],tokens[2], expy, tokens[3], tokens[4], tokens[5], tokens[0]);
[293]669 }
670
671else if (kw == "fillgd2" ) {
672 if (tokens.size() < 6) {
[357]673 cout << "Usage: fillgd2 nomgfd nomobj expx expy expz experrz [expcut loop_par]" << endl;
[293]674 return(0);
675 }
[357]676 if (tokens.size() < 7) tokens.push_back("1");
677 if (tokens.size() < 8) tokens.push_back("");
678 srvo->FillGFD(tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6], tokens[0], tokens[7]);
[293]679 }
680
[1067]681else if (kw == "gdfrvec" ) {
682 if(tokens.size()<3) {
683 cout<<"Usage: gdfrvec namegfd X Y\n"
684 <<" gdfrvec namegfd X Y"
685 <<" gdfrvec namegfd X Y ! EY\n"
686 <<" gdfrvec namegfd X Y Z\n"
687 <<" gdfrvec namegfd X Y Z EZ"<<endl;
688 return(0);
689 }
690 while(tokens.size()<5) tokens.push_back("!");
691 srvo->FillGFDfrVec(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4]);
692 }
[293]693
694
695else {
696 cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
697 return(-1);
698 }
699
700return(0);
701}
702
[388]703// Fonction pour enregistrer le Help des Widgets et Windows de piapp
704static void RegisterPIGraphicsHelp(PIACmd* piac);
705
[293]706/* --Methode-- */
707void PIABaseExecutor::RegisterCommands()
708{
709string kw, usage;
710kw = "loadmodule";
711usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
712usage += "\n Related commands: link";
[330]713mpiac->RegisterCommand(kw, usage, this, "External Modules");
[293]714kw = "link";
715usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
716usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
[1276]717usage += "\n Related commands: call loadmodule linkff2";
[330]718mpiac->RegisterCommand(kw, usage, this, "External Modules");
[1276]719kw = "linkff2";
720usage = "Dynamic linking of compiled user functions (Set 2)\n Usage: linkff2 fnameso f1 [f2 f3]";
721usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
722usage += "\n Related commands: call link loadmodule";
723mpiac->RegisterCommand(kw, usage, this, "External Modules");
[293]724kw = "call";
725usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
726usage += "\n User function : f(vector<string>& args)";
727usage += "\n Related commands: link";
[330]728mpiac->RegisterCommand(kw, usage, this, "External Modules");
[293]729
730kw = "zone";
[384]731usage = "To Divide the Graphic window \n Usage: zone [nx=1 ny=1]";
[388]732usage += "\n Related commands: newwin";
[330]733mpiac->RegisterCommand(kw, usage, this, "Graphics");
[293]734kw = "newwin";
735usage = "To Create a New Graphic window, with zones \n Usage: newwin nx ny";
[388]736usage += "\n Related commands: zone";
[330]737mpiac->RegisterCommand(kw, usage, this, "Graphics");
[293]738kw = "stacknext";
739usage = "Displays the next widget on stack window \n Usage: stacknext";
[330]740mpiac->RegisterCommand(kw, usage, this, "Graphics");
[293]741
[553]742kw = "graphicatt";
743usage = "To change default graphic options \n Usage: graphicatt att_list \n";
[293]744usage += "att_list=def back to default values, Example: gratt red,circlemarker5";
745usage += "\n ------------------ Graphic attribute list ------------------ \n";
746usage += ">> Colors: defcol black white grey red blue green yellow magenta cyan \n";
747usage += " turquoise navyblue orange siennared purple limegreen gold \n";
748usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n";
749usage += " thickdashedline dottedline thindottedline thickdottedline \n";
750usage += ">> Fonts: deffont normalfont boldfont italicfont smallfont smallboldfont \n";
751usage += " smallitalicfont bigfont bigboldfont bigitalicfont \n";
752usage += " hugefont hugeboldfont hugeitalicfont \n";
753usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker <T> \n";
754usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
755usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n";
756usage += " with <T> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ... \n";
[1126]757usage += ">> ColorTables: defcmap grey32 invgrey32 colrj32 colbr32 \n";
758usage += " grey128 invgrey128 colrj128 colbr128 \n";
759usage += " midas_pastel midas_heat midas_rainbow3 midas_bluered\n";
760usage += " midas_bluewhite midas_redwhite \n";
761usage += " rainbow16 \n";
[1504]762usage += " revcmap : This flag reverses ColorMap indexing \n";
[293]763usage += ">> ZoomFactors: defzoom zoomx1 zoomx2 zoomx3 zoomx4 zoomx5 \n";
764usage += " zoom/2 zoom/3 zoom/4 zoom/5 \n";
[558]765usage += ">> Image centering: centerimg -> Position the image in widget \n";
[293]766usage += ">> Axes: stdaxes=defaxes=boxaxes simpleaxes boxaxesgrid \n";
767usage += " fineaxes grid=fineaxesgrid \n";
[506]768usage += ">> LogScale : linx liny logx logy -> Lin/Log Scales for 2D plots \n";
[331]769usage += ">> XYLimits : xylimits -> Forces X-Y limits in 2-D plots \n";
[546]770usage += ">> stat/nostat or stats/nostats -> Toggle statistic display flag \n";
[1131]771usage += ">> title/notitle or tit/notit -> Toggle Auto AddTitle flag \n";
[548]772usage += ">> DisplayWindow: next same win stack inset \n";
[558]773usage += " Related commands: setxylimits setinsetlimits setimgcenter";
[330]774mpiac->RegisterCommand(kw, usage, this, "Graphics");
[293]775
[331]776kw = "setxylimits";
777usage = "Define 2-D plot limits \n Usage: setxylimits xmin xmax ymin ymax";
[558]778usage += "\n Related commands: graphicatt /xylimits";
[331]779mpiac->RegisterCommand(kw, usage, this, "Graphics");
780
[548]781kw = "setinsetlimits";
782usage = "Define the display rectangle for drawers added as insets \n";
783usage += " over existing graphic objects - limits expressed as fraction \n";
784usage += " graphic object size (0. .. 1.) Xmax at right, YMax top. ";
785usage += " Usage: setinsetlimits xmin xmax ymin ymax";
[558]786usage += "\n Related commands: graphicatt /inset";
[548]787mpiac->RegisterCommand(kw, usage, this, "Graphics");
788
[558]789kw = "setimgcenter";
790usage = "Define image center postion \n Usage: setimgcenter xc yc";
791usage += "\n Related commands: graphicatt /centerimg";
792mpiac->RegisterCommand(kw, usage, this, "Graphics");
793
[349]794kw = "addtext";
795usage = "Adds a text string to the current graphic object";
796usage += "\n at the specified position (Gr-Object Coordinate) with graphic attribute specification";
797usage += "\n Usage: addtext x y ColFontAtt TextString";
[1131]798usage += "\n Related commands: settitle graphicatt";
[349]799mpiac->RegisterCommand(kw, usage, this, "Graphics");
800
[1131]801kw = "settitle";
802usage = "Set the title string (top title) for the current graphic object";
803usage += "\n Usage: settitle FontAtt TopTitle";
804usage += "\n Related commands: addtext graphicatt";
805mpiac->RegisterCommand(kw, usage, this, "Graphics");
806
[388]807RegisterPIGraphicsHelp(mpiac);
808
[293]809kw = "openfits";
810usage = "Loads a FITS file into an Image<T> \n Usage: openfits filename";
811usage += "\n Related commands: savefits openppf";
[330]812mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]813kw = "savefits";
814usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
815usage += "\n Related commands: openfits saveall";
[330]816mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]817kw = "openppf";
818usage = "Reads all objects from a PPF file \n Usage: openppf filename";
819usage += "\n Related commands: saveall openfits";
[330]820mpiac->RegisterCommand(kw, usage, this, "FileIO");
[333]821kw = "saveobjs";
822usage = "Saves objects with names matching a pattern (x?y*) into a PPF file \n";
[1068]823usage += "Usage: saveobjs nameobjpattern filename";
[333]824usage += "\n Related commands: saveall openppf savefits";
825mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]826kw = "saveall";
827usage = "Saves all objects into a PPF file \n Usage: saveall filename";
[333]828usage += "\n Related commands: saveobj openppf savefits";
[330]829mpiac->RegisterCommand(kw, usage, this, "FileIO");
[449]830kw = "ntfrascii";
831usage = "Fills an existing NTuple from ASCII table file";
832usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]";
833usage += "\n Related commands: ntloop fillnt ";
834mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]835
[449]836
[293]837kw = "print";
838usage = "Prints an object \n Usage: print nameobj";
[330]839mpiac->RegisterCommand(kw, usage, this, "FileIO");
[293]840
[333]841kw = "mkdir";
842usage = "Create a directory";
[344]843usage += "\n Usage: mkdir dirname [true]";
844usage += "\n if second argument==true, the directory's KeepOld attribute is set to true";
[463]845mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]846kw = "rmdir";
847usage = "Removes an empty directory";
848usage += "\n Usage: remove dirname";
[463]849mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]850kw = "cd";
851usage = "Change current directory";
852usage += "\n Usage: cd [dirname]";
[463]853mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]854kw = "pwd";
855usage = "Prints current directory";
856usage += "\n Usage: pwd";
[463]857mpiac->RegisterCommand(kw, usage, this, "Object Management");
[333]858kw = "listdirs";
859usage = "Prints the list of directories";
860usage += "\n Usage: listdirs [patt=*] \n patt : * , ? ";
[463]861mpiac->RegisterCommand(kw, usage, this, "Object Management");
[295]862kw = "listobjs";
[333]863usage = "Prints the list of objects (Alias: ls)";
864 usage += "\n Usage: listobjs [patt=*] \n patt : /*/x?y* ... ";
[463]865mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]866kw = "rename";
[333]867usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew";
[293]868usage += "\n Related commands: del delobjs";
[463]869mpiac->RegisterCommand(kw, usage, this, "Object Management");
870kw = "copy";
871usage = "Copy objects \n";
872usage +=" Usage: copy name_from name_to";
873usage += "\n Related commands: new...";
874mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]875kw = "del";
[333]876usage = "Deletes an object (Alias: rm) \n Usage: del nameobj";
[293]877usage += "\n Related commands: delobjs rename";
[463]878mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]879kw = "delobjs";
880usage = "Delete a set of objects with names matching a pattern (x?y*)";
881usage += "\n Usage: delobjs nameobjpattern \n";
882usage += "\n Related commands: del rename";
[463]883mpiac->RegisterCommand(kw, usage, this, "Object Management");
[293]884
885kw = "newh1d";
886usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
[1035]887usage += "\n Related commands: newh2d newprof[e] newnt newgfd ";
[333]888mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]889kw = "newh2d";
890usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
[1035]891usage += "\n Related commands: newh1d newprof[e] newnt newgfd ";
[333]892mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]893kw = "newprof";
894usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
[1035]895usage += "\n Errors represent the data spread in the X bin ";
896usage += "\n Related commands: newh1d newh2d newprofe newnt newgfd ";
[333]897mpiac->RegisterCommand(kw, usage, this, "Objects");
[1035]898kw = "newprofe";
899usage = "Creates a profile histogramm \n Usage: newprofe name xmin xmax nbin [ymin ymax]";
900usage += "\n Errors represent the error on the data mean in the X bin ";
901usage += "\n Related commands: newh1d newh2d newprof newnt newgfd ";
902mpiac->RegisterCommand(kw, usage, this, "Objects");
[447]903kw = "newnt";
904usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn";
905usage += "\n newnt name nvar";
[1035]906usage += "\n Related commands: newh1d newh2d newprof[e] newgfd ";
[447]907mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]908kw = "newgfd";
909usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
[1035]910usage += "\n Related commands: newh1d newh2d newprof[e] newnt ";
[333]911mpiac->RegisterCommand(kw, usage, this, "Objects");
912kw = "newvec";
[357]913usage = "Creates (and optionaly fills) a vector \n Usage: newvec name size [f(i) [dopt] ] ";
[333]914usage += "\n Related commands: newmtx";
[357]915mpiac->RegisterCommand(kw, usage, this, "Objects");
[333]916kw = "newmtx";
[357]917usage = "Creates (and optionaly fills) a matrix \n";
918usage +=" Usage: newvec name sizeX(Col) sizeY(Lines) [f(i,j) [dopt] ] ";
[333]919usage += "\n Related commands: newvec";
[357]920mpiac->RegisterCommand(kw, usage, this, "Objects");
[293]921
922kw = "disp";
923usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
[1525]924usage += "\n Related commands: surf nt2d nt3d vecplot";
[330]925mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[295]926kw = "imag";
927usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
[1525]928usage += "\n Related commands: disp surf nt2d nt3d vecplot";
[330]929mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[293]930kw = "surf";
931usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
[1525]932usage += "\n Related commands: disp nt2d nt3d vecplot";
[330]933mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[293]934kw = "nt2d";
[486]935usage = "Displays Points (X-Y) [with error-bar / Weight / Label ] from an NTuple ";
936usage += "\n Usage : nt2d nameobj varx vary [errx erry wt label graphic_attributes]";
[1525]937usage += "\n Related commands: disp surf nt3d gfd2d vecplot";
[330]938mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[293]939kw = "nt3d";
[486]940usage = "Displays 3D-Points (X-Y-Z) [with error-bars / Weight / Label ] from an NTuple ";
941usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz wt label graphic_attributes]";
942usage += "\n Related commands: disp surf nt2d gfd3d ";
[330]943mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[1525]944kw = "vecplot";
945usage = "Displays Points (X-Y) with coordinates defined by two vectors ";
946usage += "\n Usage : vecplot nameVecX nameVecY [graphic_attributes]";
947usage += "\n Related commands: disp nt2d ";
948mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[339]949
950// Ceci est maintenant obsolete, on garde pour info.
[293]951kw = "gfd2d";
952usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
953usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
[339]954usage += "\n Related commands: gfd3d nt2d nt3d ";
955usage += "\n ----- OBSOLETE: utilisez nt2d -----";
[330]956mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[293]957kw = "gfd3d";
958usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
959usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
960usage += "\n Related commands: gfd2d nt2d nt3d ";
[339]961usage += "\n ----- OBSOLETE: utilisez nt3d -----";
[330]962mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
[293]963
964kw = "func";
965usage = "Displays a function y=f(x) (Fills a vector with function values)";
966usage += "\n Usage: func f(x) xmin xmax npt [graphic_attributes]";
[326]967usage += "\n Related commands: funcff func2d func2dff ";
[330]968mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[326]969kw = "funcff";
970usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
971usage += "\n Usage: funcff C-FileName FunctionName xmin xmax npt [graphic_attributes]";
972usage += "\n Related commands: func func2d func2dff ";
[330]973mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[293]974kw = "func2d";
975usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
976usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
977usage += "\n Related commands: func";
[330]978mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[326]979kw = "func2dff";
980usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
981usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
982usage += "\n Related commands: func funcff func2d ";
[330]983mpiac->RegisterCommand(kw, usage, this, "Func Plot");
[293]984
[357]985kw = "ObjectExpressions";
986usage = "Any mathematical expression (math.h) with object variables can be used";
987usage += "\n ------ Object Variable names (double) -------- ";
988usage += "\nNTuple varnames - Histo1D/HProf: i,x,val,err - Histo2D: i,j,x,y,val,err";
989usage += "\nVector: i,val - Matrix: i,j,val - Image: x=i,y=j, pix=val";
990usage += "\nLoop parameters can be specified as I1[:I2[:DI]] for(int i=I1; i<I2; i+=DI)";
991usage += "\nThe default Cut() expression in true (=1) for all";
992usage += "\n Related commands: plot2d plot2de plot2dw plot3d ";
993usage += "\n projh1d projh2d projprof fillvec fillmtx ";
994usage += "\n fillnt fillgd1 fillgd2 ntloop exptovec ... ";
995mpiac->RegisterCommand(kw, usage, NULL, "Expr. Plotting");
[293]996kw = "plot2d";
997usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
[357]998usage += "\n Usage: plot2d nameobj f_X() g_Y() [f_Cut() graphic_attributes loop_param]";
999usage += "\n Related commands: plot2de plot2dw plot3d ObjectExpressions ...";
[330]1000mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1001kw = "plot2de";
1002usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) ";
1003usage += "\n Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]";
1004usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
1005mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[333]1006kw = "plot2dw";
1007usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) ";
[357]1008usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() [Cut() graphic_attributes loop_param]";
1009usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
[333]1010mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1011kw = "plot3d";
1012usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
[357]1013usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() [Cut() graphic_attributes loop_param]";
1014usage += "\n Related commands: plot2d plot2dw plot2de plot3d ObjectExpressions ...";
[330]1015mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1016
1017kw = "projh1d";
1018usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
[357]1019usage += "\n Usage: projh1d nameh1d nameobj f_X() [h_WT()=1. Cut() graphic_attributes loop_param]";
[293]1020usage += "\n Histo1D nameh1d is created if necessary ";
[357]1021usage += "\n Related commands: projh2d projprof ObjectExpressions ...";
[330]1022mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1023kw = "projh2d";
1024usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
[357]1025usage += "\n Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
[293]1026usage += "\n Histo2D nameh2d is created if necessary ";
[357]1027usage += "\n Related commands: projh1d projprof ObjectExpressions ...";
[330]1028mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1029kw = "projprof";
1030usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
[709]1031usage += "\n Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
[293]1032usage += "\n HProf nameprof is created if necessary ";
[357]1033usage += "\n Related commands: projh1d projh2d ObjectExpressions ...";
[330]1034mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1035kw = "fillvec";
1036usage = "Fills a Vector V((int)(f_X(Object)+0.5)) = h_V(Object) ";
1037usage += "\n Usage: fillvec namevec nameobj f_X() h_V() [Cut() graphic_attributes loop_param]";
1038usage += "\n Related commands: fillmtx fillnt ObjectExpressions ...";
1039mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1040kw = "fillmtx";
1041usage = "Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) = h_V(Object) ";
1042usage += "\n Usage: fillvec namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]";
1043usage += "\n Related commands: fillvec fillnt ObjectExpressions ...";
1044mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1045
1046kw = "fillnt";
1047usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
[357]1048usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]";
[333]1049usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof ";
[357]1050usage += "\n Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...";
[330]1051mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1052
[333]1053kw = "ntloop";
1054usage = "Loops over an Object NTupleInterface calling a function from a C-file \n";
1055usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
[357]1056usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]";
1057usage += "\n Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...";
[333]1058usage += "\n Related commands: ntexpcfile fillnt";
1059mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[357]1060
[333]1061kw = "ntexpcfile";
1062usage = "Creates a C-File with declarations suitable to be used for ntloop";
1063usage += "\n Usage: ntexpcfile nameobj CFileName FuncName ";
1064usage += "\n Related commands: ntloop";
1065mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
1066
[357]1067kw = "exptovec";
[293]1068usage = "Creates and Fills a Vector with X=f(Object)";
[357]1069usage += "\n Usage: exptovec namevec nameobj f_X() [Cut() graphic_attributes loop_param]";
1070usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
[330]1071mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1072kw = "fillgd1";
1073usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
[357]1074usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_ErrY() [Cut() loop_param]";
1075usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
[330]1076mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1077kw = "fillgd2";
1078usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
[357]1079usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]";
1080usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
[330]1081mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[1067]1082kw = "gdfrvec";
1083usage = "Fills a GeneralFitData with vectors X,Y,Z,EZ";
1084usage += "\n Usage: gdfrvec namegfd X Y";
1085usage += "\n Usage: gdfrvec namegfd X Y ! EY";
1086usage += "\n Usage: gdfrvec namegfd X Y Z";
1087usage += "\n Usage: gdfrvec namegfd X Y Z EZ";
1088usage += "\n Related commands: fillgd1 fillgd2 ...";
1089mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
[293]1090
1091}
1092
1093/* --Methode-- */
1094int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
1095// string& func4, string& func5)
1096{
1097string cmd;
1098
1099if (dynlink) delete dynlink; dynlink = NULL;
1100usfmap.clear();
1101
1102dynlink = new PDynLinkMgr(fnameso, true);
1103if (dynlink == NULL) {
1104 string sn = fnameso;
1105 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
1106 return(2);
1107 }
1108
1109int nok=0;
1110// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1111// DlUserProcFunction f = NULL;
1112DlFunction f = NULL;
1113if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1114// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
1115f = dynlink->GetFunction(func1);
1116if (f) { nok++; usfmap[func1] = f; }
1117else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
1118
1119if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1120// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
1121f = dynlink->GetFunction(func2);
1122if (f) { nok++; usfmap[func2] = f; }
1123else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
1124
1125if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1126// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
1127f = dynlink->GetFunction(func3);
1128if (f) { nok++; usfmap[func3] = f; }
1129else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
1130
1131/* Pb compile g++ 2.7.2
1132if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
1133// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
1134f = dynlink->GetFunction(func4);
1135if (f) { nok++; usfmap[func4] = f; }
1136else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
1137
1138if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
1139// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
1140f = dynlink->GetFunction(func5);
1141if (f) { nok++; usfmap[func5] = f; }
1142else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
1143*/
1144fin:
1145if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
1146else return(0);
1147}
1148
[1276]1149/* --Methode-- */
1150int PIABaseExecutor::LinkUserFuncs2(string& fnameso, string& func1, string& func2, string& func3)
1151{
1152string cmd;
1153
1154if (dynlink2) delete dynlink2; dynlink2 = NULL;
1155usfmap2.clear();
1156
1157dynlink2 = new PDynLinkMgr(fnameso, true);
1158if (dynlink2 == NULL) {
1159 string sn = fnameso;
1160 cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur ouverture SO " << sn << endl;
1161 return(2);
1162 }
1163
1164int nok=0;
1165// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
1166// DlUserProcFunction f = NULL;
1167DlFunction f = NULL;
1168if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
1169f = dynlink2->GetFunction(func1);
1170if (f) { nok++; usfmap2[func1] = f; }
1171else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func1 << endl;
1172
1173if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
1174f = dynlink2->GetFunction(func2);
1175if (f) { nok++; usfmap2[func2] = f; }
1176else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func2 << endl;
1177
1178if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
1179f = dynlink2->GetFunction(func3);
1180if (f) { nok++; usfmap2[func3] = f; }
1181else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func3 << endl;
1182
1183fin:
1184if (nok < 1) { if (dynlink2) delete dynlink2; dynlink2 = NULL; return(3); }
1185else return(0);
1186}
1187
[388]1188/* Nouvelle-Fonction */
1189void RegisterPIGraphicsHelp(PIACmd* piac)
1190{
1191string kw,grp,usage;
1192
1193grp = "Graphics";
1194
1195kw = "PIImage";
1196usage = "Manages the display of a 2-D array (P2DArrayAdapter) as an image \n";
1197usage += "and controls a zoom widget, as well as a global image view widget \n";
1198usage += ">>>> Mouse controls : \n";
1199usage += "o Button-1: Display current coordinates and pixel value\n";
1200usage += " Position the cursor an refresh the zoom widget\n";
1201usage += "o Button-2: Defines an image zone and positions the cursor \n";
1202usage += "o Button-3: Moves the viewed portion of the array inside the window \n";
1203usage += ">>>> Keyboard controls : \n";
1204usage += "o <Alt>R : Refresh display \n";
1205usage += "o <Alt>O : Shows the PIImageTools (image display parameter controls) \n";
1206usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of overlayed graphics (Drawers)) \n";
1207usage += "o <Alt>V : Copy/Paste / Text paste at the current cursor position \n";
1208usage += "o <Alt>C : Copy/Paste / Copies the selected regions content as text in the copy/paste buffer \n";
1209usage += "o <Alt>X : Show/Hide the Cut Window \n";
1210usage += "o <Alt>Z : Removes signs overlayed on image (Drawer 0) \n";
1211usage += "o Cursor keys : Moves the image cursor \n";
1212piac->RegisterHelp(kw, usage, grp);
1213
1214kw = "PIScDrawWdg";
1215usage = "Manages display of 2-D drawers with interactive zoom \n";
1216usage += ">>>> Mouse controls : \n";
1217usage += "o Button-1: Display current coordinates \n";
1218usage += "o Button-2: Defines a rectangle for zoom \n";
1219usage += "o Button-3: Defines a rectangle for Text-Info (<Alt>I) \n";
1220usage += ">>>> Keyboard controls : \n";
1221usage += "o <Alt>R : Refresh display \n";
1222usage += "o <Alt>O : Displays a specific control window (default: PIDrawerTools) \n";
1223usage += " Specific controls for 2-D histograms \n";
1224usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1225usage += " Drawer 0 manages the axes, as well as the added text \n";
1226usage += "o <Alt>V : Copy/Paste / Text paste at the current position \n";
1227usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
[1134]1228usage += "o <Alt>I : Shows (or updates) a text info window on the selected rectangle \n";
[388]1229usage += "o <Alt>M : Activate/Deactivate a measurement cursor on Button-1";
1230piac->RegisterHelp(kw, usage, grp);
1231
1232kw = "PIDraw3DWdg";
1233usage = "Manages display of 3-D objects (drawers) \n";
1234usage += ">>>> Mouse controls : \n";
1235usage += "o Button-2: Rotates the observer (camera) around object \n";
1236usage += "o Shift-Button-2: Rotates object with camera fixed \n";
1237usage += " The object rotation mode can be assigned to Button-2 with <Alt>S \n";
1238usage += "o Button-3: Zoom control (Camera distance And/Or view angle) \n";
1239usage += ">>>> Keyboard controls : \n";
1240usage += "o <Alt>R : Resets the 3-D view and refreshes the display \n";
1241usage += "o <Alt>G : Show the PIDrawerTools (Graphic attributes of displayed Drawers) \n";
1242usage += "o <Alt>O : = <Alt>G \n";
1243usage += "o <Alt>V : Copy/Paste / Text paste at the current position (Drawer 0)\n";
1244usage += "o <Alt>Z : Removes added signs (text) to Drawer 0 \n";
1245usage += "o <Alt>A : Activate/Deactivate axes drawing \n";
1246usage += "o <Alt>S : Activate/Deactivate object rotation mode on Button-2 \n";
1247piac->RegisterHelp(kw, usage, grp);
1248
1249kw = "Windows";
1250usage = "Objects can be displayed in different windows, or overlayed on the \n";
1251usage += "previous display. The graphics attributes next,win,stack,same control \n";
1252usage += "the display window. \n";
1253usage += "o GraphicWindow : This is the default mode (gr_att=next)\n";
1254usage += " Graphic windows can be divided int zones. Object is displayed \n";
1255usage += " in the next available position, removing a previously displayed \n";
1256usage += " widget if necessary \n";
1257usage += "o Window : An object is displayed in its own window (gr_att= win) \n";
1258usage += "o StackWindow : multpile widgets can be stacked in a StackWindow (gr_att= stack) \n";
1259usage += " A single widget is displayed a any time. Different widgets in a StackWindow \n";
1260usage += " can be displayed using the stacknext command, as well as the StackTools item \n";
1261usage += " in the Tools menu (from Menubar). An automatic cyclic display mode can also \n";
1262usage += " be activated using the StackTools menu (Blink) \n";
[548]1263usage += "o Most objects can be also be displayed overlayed \n";
1264usage += " on the last displayed widget (gr_att= same) \n";
1265usage += "o The overlay can be on a selected rectangle of the \n";
1266usage += " last displayed widget (gr_att= inset) - See setinsetlimits\n";
[553]1267usage += "\n Related commands: newwin zone stacknext graphicatt setinsetlimits";
[388]1268piac->RegisterHelp(kw, usage, grp);
[484]1269
1270kw = "PIConsole";
1271usage = "Text output area and command editing window (console) \n";
1272usage += ">>>> Mouse controls : \n";
1273usage += "o Button-1: Rectangle selection for copy/paste \n";
1274usage += "o Button-2: Paste text in the command editing line \n";
1275usage += "o Button-3: activate display option menu \n";
1276usage += ">>>> Keyboard controls : \n";
1277usage += "o <Alt>O : activate display option menu \n";
1278usage += "o <Alt>V : Paste text in the command editing line \n";
1279usage += "o <Alt>A : Selection of the whole window for copy \n";
1280usage += "o <Alt>L : Command history (List of command history buffer) \n";
1281usage += "o <Ctl>A : Command editing -> Goto the beginning of line \n";
1282usage += "o <Ctl>E : Command editing -> Goto the end of line \n";
1283usage += "o <Ctl>K : Command editing -> Clear to the end of line \n";
1284usage += "o <Ctl>C : Command editing -> Clear the line \n";
1285usage += "o Cursor left,right : Command editing -> Move cursor \n";
1286usage += "o Cursor Up,Down : recall command from history buffer \n";
1287usage += "o Backspace,Del : Command editing \n";
1288usage += "o <Return>,<Enter> : Execute command \n";
1289piac->RegisterHelp(kw, usage, grp);
[388]1290}
Note: See TracBrowser for help on using the repository browser.