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

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

Adaptation Sophya, suppression cvector, classe ObjectFitter - Reza 2/3/2000

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