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

Last change on this file since 496 was 496, checked in by ercodmgr, 26 years ago

vire using namespace oublie cmv 22/10/99

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