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

Last change on this file since 1091 was 1091, checked in by ercodmgr, 25 years ago

Histos/Hprof/Histo2D en r_8 cmv 26/7/00

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