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

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

Amelioration du Help pour piapp (Groupe de Help) Reza 24/6/99

File size: 27.6 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// #include "dlftypes.h"
12
13#include "pistdimgapp.h"
14#include "nobjmgr.h"
15#include "servnobjm.h"
16
17#include "histos.h"
18#include "histos2.h"
19#include "hisprof.h"
20#include "ntuple.h"
21#include "generaldata.h"
22
23
24
25/* --Methode-- */
26PIABaseExecutor::PIABaseExecutor(PIACmd* piac, NamedObjMgr* omg, PIStdImgApp* app)
27{
28mpiac = piac;
29mObjMgr = omg;
30mImgApp = app;
31dynlink = NULL;
32RegisterCommands();
33}
34
35PIABaseExecutor::~PIABaseExecutor()
36{
37}
38
39
40
41/* --Methode-- */
42int PIABaseExecutor::Execute(string& kw, vector<string>& tokens)
43{
44
45// >>>>> Chargement de modules
46if (kw == "loadmodule") {
47 if (tokens.size() < 2) { cout << "Usage: loadmodule fnameso modulename" << endl; return(0); }
48 mpiac->LoadModule(tokens[0], tokens[1]);
49 }
50// >>>>>>>>>>> Fenetre graphique , changement d'attributs graphiques
51else if (kw == "zone") {
52 if (tokens.size() < 2) { cout << "Usage: zone nx ny" << endl; return(0); }
53 int nx, ny;
54 nx = ny = 1;
55 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str());
56 mObjMgr->SetGraphicWinZone(nx, ny, false);
57 }
58else if (kw == "newwin") {
59 if (tokens.size() < 2) { cout << "Usage: newwin nx ny" << endl; return(0); }
60 int nx, ny;
61 nx = ny = 1;
62 nx = atoi(tokens[0].c_str()); ny = atoi(tokens[1].c_str());
63 mObjMgr->SetGraphicWinZone(nx, ny, true);
64 }
65else if (kw == "stacknext") mImgApp->StackWinNext();
66else if (kw == "gratt") {
67 if (tokens.size() < 1) { cout << "Usage: gratt attributes_list (att=def->defaut)" << endl; return(0); }
68 mObjMgr->SetGraphicAttributes(tokens[0]);
69 }
70
71// >>>>>>>>>>> Link dynamique de fonctions C++
72else if (kw == "link" ) {
73 if (tokens.size() < 2) { cout << "Usage: link fnameso f1 [f2 f3]" << endl; return(0); }
74 string sph = "";
75 for(int gg=0; gg<5; gg++) tokens.push_back(sph);
76 int rc = LinkUserFuncs(tokens[0], tokens[1], tokens[2], tokens[3]);
77 if (rc == 0) cout << "PIABaseExecutor: Link from " << tokens[0] << " OK " << endl;
78}
79else if (kw == "call" ) {
80 if (tokens.size() < 1) { cout << "Usage: call userf [arg1 arg2 ...]" << endl; return(0); }
81 UsFmap::iterator it = usfmap.find(tokens[0]);
82 if (it == usfmap.end()) {
83 cerr << "PIABaseExecutor: No User Function " << tokens[0] << endl;
84 return(0);
85 }
86 cout << "PIABaseExecutor: Call " << tokens[0] << "( ... )" << endl;
87// on est oblige de faire un cast etant donne qu'on
88// utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
89 DlUserProcFunction fuf = (DlUserProcFunction)(*it).second;
90// On redirige la sortie sur le terminal
91 bool red = mImgApp->HasRedirectedStdOutErr();
92 mImgApp->RedirectStdOutErr(false);
93 TRY {
94 tokens.erase(tokens.begin());
95 fuf(tokens);
96 } CATCH(merr) {
97 fflush(stdout);
98 cout << endl;
99 cerr << endl;
100 string es = PeidaExc(merr);
101 cerr << "PIABaseExecutor: Call UserFunc Exception :" << merr << es;
102 }
103 mImgApp->RedirectStdOutErr(red);
104}
105
106// >>>>>>>>>>> lecture/ecriture des objets, gestion des objets
107else if (kw == "openfits" ) {
108 if (tokens.size() < 1) { cout << "Usage: openfits file " << endl; return(0); }
109 else mObjMgr->ReadFits(tokens[0]);
110}
111else if (kw == "savefits" ) {
112 if (tokens.size() < 2) { cout << "Usage: savefits nameobj filename " << endl; return(0); }
113 else mObjMgr->SaveFits(tokens[0], tokens[1]);
114}
115else if (kw == "openppf" ) {
116 if (tokens.size() < 1) { cout << "Usage: openppf file " << endl; return(0); }
117 mObjMgr->ReadAll(tokens[0]);
118}
119else if (kw == "saveall" ) {
120 if (tokens.size() < 1) { cout << "Usage: saveall file " << endl; return(0); }
121 mObjMgr->SaveAll(tokens[0]);
122}
123else if (kw == "print" ) {
124 if (tokens.size() < 1) { cout << "Usage: print nameobj " << endl; return(0); }
125 mObjMgr->PrintObj(tokens[0]);
126}
127else if (kw == "rename" ) {
128 if (tokens.size() < 2) { cout << "Usage: rename nameobj namenew" << endl; return(0); }
129 mObjMgr->RenameObj(tokens[0], tokens[1]);
130}
131else if (kw == "del" ) {
132 if (tokens.size() < 1) { cout << "Usage: del nameobj " << endl; return(0); }
133 mObjMgr->DelObj(tokens[0]);
134}
135else if (kw == "delobjs" ) {
136 if (tokens.size() < 1) { cout << "Usage: delobjs nomobjpattern (*,?) " << endl; return(0); }
137 mObjMgr->DelObjects(tokens[0]);
138}
139else if (kw == "listobjs") mObjMgr->ListObjs();
140
141// >>>>>>>>>>> Creation d'histos 1D-2D
142else if (kw == "newh1d") {
143 if (tokens.size() < 4) { cout << "Usage: newh1d name xmin xmax nbin" << endl; return(0); }
144 int nbx;
145 float xmin, xmax;
146 nbx = 100;
147 xmin = 0.; xmax = 1.;
148 nbx = atoi(tokens[3].c_str());
149 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
150 Histo* h = new Histo(xmin, xmax, nbx);
151 mObjMgr->AddObj(h, tokens[0]);
152 }
153else if (kw == "newh2d") {
154 if (tokens.size() < 7) {
155 cout << "Usage: newh2d name xmin xmax nbinx ymin ymax nbiny" << endl;
156 return(0);
157 }
158 int nbx, nby;
159 float xmin, xmax;
160 float ymin, ymax;
161 nbx = nby = 50;
162 xmin = 0.; xmax = 1.;
163 ymin = 0.; ymax = 1.;
164 nbx = atoi(tokens[3].c_str());
165 nby = atoi(tokens[6].c_str());
166 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
167 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
168 Histo2D* h = new Histo2D(xmin, xmax, nbx, ymin, ymax, nby);
169 mObjMgr->AddObj(h, tokens[0]);
170 }
171else if (kw == "newprof") {
172 if (tokens.size() < 4)
173 { cout << "Usage: newprof name xmin xmax nbin [ymin ymax]" << endl; return(0); }
174 int nbx;
175 float xmin, xmax, ymin = 1., ymax = -1.;
176 if(tokens.size() > 5)
177 {ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());}
178 nbx = 100;
179 xmin = 0.; xmax = 1.;
180 nbx = atoi(tokens[3].c_str());
181 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
182 HProf* h = new HProf(xmin, xmax, nbx, ymin, ymax);
183 mObjMgr->AddObj(h, tokens[0]);
184 }
185else if (kw == "newgfd") {
186 if (tokens.size() < 3)
187 { cout << "Usage: newgfd nvar nalloc [errx(0/1)]" << endl; return(0); }
188 int nvar, nalloc, errx=0;
189 if (tokens.size() > 3)
190 { errx = atoi(tokens[3].c_str()); if(errx>0) errx=1; else errx = 0;}
191 nvar = atoi(tokens[1].c_str()); nalloc = atoi(tokens[2].c_str());
192 if(nvar>0 && nalloc>0) {
193 GeneralFitData* gfd = new GeneralFitData(nvar,nalloc,errx);
194 mObjMgr->AddObj(gfd, tokens[0]);
195 }
196 }
197
198// >>>>>>>>>>> Affichage des objets
199else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
200 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
201 string opt = "n";
202 if (tokens.size() > 1) opt = tokens[1];
203 if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
204 else if (kw == "surf") mObjMgr->DisplaySurf3D(tokens[0], opt);
205 else if (kw == "imag") mObjMgr->DisplayImage(tokens[0], opt);
206 }
207
208else if (kw == "nt2d") {
209 if (tokens.size() < 5) { cout << "Usage: nt2d nameobj varx vary errx erry opt" << endl; return(0); }
210 string opt = "n";
211 if (tokens.size() > 5) opt = tokens[5];
212 string ph = "";
213 mObjMgr->DisplayNT(tokens[0],tokens[1],tokens[2], ph, tokens[3], tokens[4], ph, opt);
214 }
215else if (kw == "nt3d") {
216 if (tokens.size() < 7) { cout << "Usage: nt3d nameobj varx vary varz errx erry errz opt" << endl; return(0); }
217 string opt = "n";
218 if (tokens.size() > 7) opt = tokens[7];
219 mObjMgr->DisplayNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], opt);
220 }
221
222else if (kw == "gfd2d") {
223 if(tokens.size()<2)
224 {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
225 return(0);}
226 string numvary = "";
227 string err = "";
228 string opt = "n";
229 if(tokens.size()>2) err = tokens[2];
230 if(tokens.size()>3) opt = tokens[3];
231 mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
232 }
233else if (kw == "gfd3d") {
234 if(tokens.size()<3)
235 {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
236 return(0);}
237 string err = "";
238 string opt = "n";
239 if(tokens.size()>3) err = tokens[3];
240 if(tokens.size()>4) opt = tokens[4];
241 mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
242 }
243
244// >>>>>>>>>>> Trace de fonctions
245else if ( (kw == "func") ) {
246 if (tokens.size() < 4) { cout << "Usage: func f(x) xmin xmax npt [opt]" << endl; return(0); }
247 string opt = "n";
248 if (tokens.size() > 4) opt = tokens[4];
249 int np;
250 float xmin, xmax;
251 np = 100;
252 xmin = 0.; xmax = 1.;
253 np = atoi(tokens[3].c_str());
254 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
255 mObjMgr->GetServiceObj()->PlotFunc(tokens[0], xmin, xmax, np, opt);
256 }
257else if ( (kw == "funcff") ) {
258 if (tokens.size() < 5) { cout << "Usage: funcff C-filename f(x)-name xmin xmax npt [opt]" << endl; return(0); }
259 string opt = "n";
260 if (tokens.size() > 5) opt = tokens[5];
261 int np;
262 float xmin, xmax;
263 np = 100;
264 xmin = 0.; xmax = 1.;
265 np = atoi(tokens[4].c_str());
266 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
267 mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], xmin, xmax, np, opt);
268 }
269else if ( (kw == "func2d") ) {
270 if (tokens.size() < 7) {
271 cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty opt" << endl;
272 return(0);
273 }
274 int npx, npy;
275 float xmin, xmax;
276 float ymin, ymax;
277 npx = npy = 50;
278 xmin = 0.; xmax = 1.;
279 ymin = 0.; ymax = 1.;
280 npx = atoi(tokens[3].c_str());
281 npy = atoi(tokens[6].c_str());
282 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
283 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
284 string opt = "n";
285 if (tokens.size() > 7) opt = tokens[7];
286 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], xmin, xmax, ymin, ymax, npx, npy, opt);
287 }
288else if ( (kw == "func2dff") ) {
289 if (tokens.size() < 8) {
290 cout << "Usage: func2d C-filename F(x,y)-name xmax nptx ymin ymax npty opt" << endl;
291 return(0);
292 }
293 int npx, npy;
294 float xmin, xmax;
295 float ymin, ymax;
296 npx = npy = 50;
297 xmin = 0.; xmax = 1.;
298 ymin = 0.; ymax = 1.;
299 npx = atoi(tokens[4].c_str());
300 npy = atoi(tokens[7].c_str());
301 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
302 ymin = atof(tokens[5].c_str()); ymax = atof(tokens[6].c_str());
303 string opt = "n";
304 if (tokens.size() > 8) opt = tokens[8];
305 mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], xmin, xmax, ymin, ymax, npx, npy, opt);
306 }
307
308// >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
309else if (kw == "plot2d" ) {
310 if (tokens.size() < 4) {
311 cout << "Usage: plot2d nameobj expx expy [experrx experry] expcut [opt]" << endl;
312 return(0);
313 }
314 string errx = ""; string erry = ""; string ecut = "1";
315 string opt = "n";
316 if (tokens.size() < 6) { // Plot sans les erreurs
317 ecut = tokens[3];
318 if (tokens.size() > 4) opt = tokens[4];
319 }
320 else { // Plot avec les erreurs
321 errx = tokens[3]; erry = tokens[4]; ecut = tokens[5];
322 if (tokens.size() > 6) opt = tokens[6];
323 }
324 mObjMgr->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,ecut,opt);
325 }
326
327else if (kw == "plot3d" ) {
328 if (tokens.size() < 5) {
329 cout << "Usage: plot3d nomobj expx expy expz expcut opt" << endl;
330 return(0);
331 }
332 string opt = "n";
333 if (tokens.size() > 5) opt = tokens[5];
334 mObjMgr->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], opt);
335 }
336
337else if (kw == "projh1d" ) {
338 if (tokens.size() < 5) {
339 cout << "Usage: projh1d nomobj expx expwt expcut nomh1 opt" << endl;
340 return(0);
341 }
342 string opt = "n";
343 if (tokens.size() > 5) opt = tokens[5];
344 mObjMgr->ProjectH1(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], opt);
345 }
346
347else if (kw == "projh2d" ) {
348 if (tokens.size() < 6) {
349 cout << "Usage: projh2 nomobj expx expy expwt expcut nomh2 opt" << endl;
350 return(0);
351 }
352 string opt = "n";
353 if (tokens.size() > 6) opt = tokens[6];
354
355 mObjMgr->ProjectH2(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt);
356 }
357
358else if (kw == "projprof" ) {
359 if (tokens.size() < 6) {
360 cout << "Usage: projprof nomobj expx expy expwt expcut nomprof opt" << endl;
361 return(0);
362 }
363 string opt = "n";
364 if (tokens.size() > 6) opt = tokens[6];
365
366 mObjMgr->ProjectHProf(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt);
367 }
368
369else if (kw == "fillnt" ) {
370 if (tokens.size() < 7) {
371 cout << "Usage: fillnt nameobj expx expy expz expt expcut nament" << endl;
372 return(0);
373 }
374 mObjMgr->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6] );
375 }
376
377else if (kw == "fillvec" ) {
378 if (tokens.size() < 4) {
379 cout << "Usage: fillvec nameobj expx expcut nomvec opt" << endl;
380 return(0);
381 }
382 string opt = "n";
383 if (tokens.size() > 4) opt = tokens[4];
384 mObjMgr->FillVect(tokens[0],tokens[1],tokens[2], tokens[3], opt);
385 }
386
387else if (kw == "fillgd1" ) {
388 if (tokens.size() < 5) {
389 cout << "Usage: fillgd1 nomobj expx expy experry expcut nomgfd" << endl;
390 return(0);
391 }
392 string nomgfd = "";
393 if (tokens.size() > 5) nomgfd = tokens[5];
394 string expy = "";
395 mObjMgr->FillGFD(tokens[0],tokens[1], expy, tokens[2], tokens[3], tokens[4],nomgfd);
396 }
397
398else if (kw == "fillgd2" ) {
399 if (tokens.size() < 6) {
400 cout << "Usage: fillgd2 nomobj expx expy expz experrz expcut nomgfd" << endl;
401 return(0);
402 }
403 string nomgfd = "";
404 if (tokens.size() > 6) nomgfd = tokens[6];
405 mObjMgr->FillGFD(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5],nomgfd);
406 }
407
408
409// Fit 1D sur objets 1D. Egalement Fit 2D sur objets 2D.
410else if (kw == "fit") {
411 if (tokens.size() < 2) {
412 cout <<"Usage:fit nomobj func \n"
413 <<" [p:p1,...,pn s:s1,...,sn m:m1,...,mn M:M1,...,Mn o:... o:...]\n";
414 return(0);
415 }
416 string p=""; string s=""; string m=""; string M=""; string O="";
417 if (tokens.size()>2)
418 for(int ip=2;ip<tokens.size();ip++) {
419 if(tokens[ip].length()<=2) continue;
420 const char *c = tokens[ip].c_str();
421 if(c[1]!=':') continue;
422 if(c[0]=='p') p=c+2;
423 else if(c[0]=='s') s=c+2;
424 else if(c[0]=='m') m=c+2;
425 else if(c[0]=='M') M=c+2;
426 else if(c[0]=='o') {O += ","; O += c+2;}
427 }
428 mObjMgr->Fit12D(tokens[0],tokens[1],p,s,m,M,O);
429}
430
431
432else {
433 cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
434 return(-1);
435 }
436
437return(0);
438}
439
440/* --Methode-- */
441void PIABaseExecutor::RegisterCommands()
442{
443string kw, usage;
444kw = "loadmodule";
445usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
446usage += "\n Related commands: link";
447mpiac->RegisterCommand(kw, usage, this, "External Modules");
448kw = "link";
449usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
450usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
451usage += "\n Related commands: call loadmodule";
452mpiac->RegisterCommand(kw, usage, this, "External Modules");
453kw = "call";
454usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
455usage += "\n User function : f(vector<string>& args)";
456usage += "\n Related commands: link";
457mpiac->RegisterCommand(kw, usage, this, "External Modules");
458
459kw = "zone";
460usage = "To Divide the Graphic window \n Usage: zone nx ny";
461mpiac->RegisterCommand(kw, usage, this, "Graphics");
462kw = "newwin";
463usage = "To Create a New Graphic window, with zones \n Usage: newwin nx ny";
464mpiac->RegisterCommand(kw, usage, this, "Graphics");
465kw = "stacknext";
466usage = "Displays the next widget on stack window \n Usage: stacknext";
467mpiac->RegisterCommand(kw, usage, this, "Graphics");
468
469kw = "gratt";
470usage = "To change default graphic options \n Usage: gratt att_list \n";
471usage += "att_list=def back to default values, Example: gratt red,circlemarker5";
472usage += "\n ------------------ Graphic attribute list ------------------ \n";
473usage += ">> Colors: defcol black white grey red blue green yellow magenta cyan \n";
474usage += " turquoise navyblue orange siennared purple limegreen gold \n";
475usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n";
476usage += " thickdashedline dottedline thindottedline thickdottedline \n";
477usage += ">> Fonts: deffont normalfont boldfont italicfont smallfont smallboldfont \n";
478usage += " smallitalicfont bigfont bigboldfont bigitalicfont \n";
479usage += " hugefont hugeboldfont hugeitalicfont \n";
480usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker <T> \n";
481usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
482usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n";
483usage += " with <T> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ... \n";
484usage += ">> ColorTables: defcmap grey32 greyinv32 colrj32 colbr32 \n";
485usage += " grey128 greyinv128 colrj128 colbr128 \n";
486usage += ">> ZoomFactors: defzoom zoomx1 zoomx2 zoomx3 zoomx4 zoomx5 \n";
487usage += " zoom/2 zoom/3 zoom/4 zoom/5 \n";
488usage += ">> Axes: stdaxes=defaxes=boxaxes simpleaxes boxaxesgrid \n";
489usage += " fineaxes grid=fineaxesgrid \n";
490usage += ">> DisplayWindow: next same win stack \n";
491mpiac->RegisterCommand(kw, usage, this, "Graphics");
492
493kw = "openfits";
494usage = "Loads a FITS file into an Image<T> \n Usage: openfits filename";
495usage += "\n Related commands: savefits openppf";
496mpiac->RegisterCommand(kw, usage, this, "FileIO");
497kw = "savefits";
498usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
499usage += "\n Related commands: openfits saveall";
500mpiac->RegisterCommand(kw, usage, this, "FileIO");
501kw = "openppf";
502usage = "Reads all objects from a PPF file \n Usage: openppf filename";
503usage += "\n Related commands: saveall openfits";
504mpiac->RegisterCommand(kw, usage, this, "FileIO");
505kw = "saveall";
506usage = "Saves all objects into a PPF file \n Usage: saveall filename";
507usage += "\n Related commands: openppf savefits";
508mpiac->RegisterCommand(kw, usage, this, "FileIO");
509
510kw = "print";
511usage = "Prints an object \n Usage: print nameobj";
512mpiac->RegisterCommand(kw, usage, this, "FileIO");
513
514kw = "listobjs";
515usage = "Prints the list of objects";
516usage += "\n Usage: listobjs";
517mpiac->RegisterCommand(kw, usage, this, "Object Managment");
518kw = "rename";
519usage = "Rename an object \n Usage: rename nameobj namenew";
520usage += "\n Related commands: del delobjs";
521mpiac->RegisterCommand(kw, usage, this, "Object Managment");
522kw = "del";
523usage = "Deletes an object \n Usage: del nameobj";
524usage += "\n Related commands: delobjs rename";
525mpiac->RegisterCommand(kw, usage, this, "Object Managment");
526kw = "delobjs";
527usage = "Delete a set of objects with names matching a pattern (x?y*)";
528usage += "\n Usage: delobjs nameobjpattern \n";
529usage += "\n Related commands: del rename";
530mpiac->RegisterCommand(kw, usage, this, "Object Managment");
531
532kw = "newh1d";
533usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
534usage += "\n Related commands: newh2d newprof newgfd ";
535mpiac->RegisterCommand(kw, usage, this, "Histrograms");
536kw = "newh2d";
537usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
538usage += "\n Related commands: newh1d newprof newgfd ";
539mpiac->RegisterCommand(kw, usage, this, "Histrograms");
540kw = "newprof";
541usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
542usage += "\n Related commands: newh1d newh2d newgfd ";
543mpiac->RegisterCommand(kw, usage, this, "Histrograms");
544kw = "newgfd";
545usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
546usage += "\n Related commands: newh1d newh2d newprof ";
547mpiac->RegisterCommand(kw, usage, this, "Histrograms");
548
549kw = "disp";
550usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
551usage += "\n Related commands: surf nt2d nt3d ";
552mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
553kw = "imag";
554usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
555usage += "\n Related commands: disp surf nt2d nt3d ";
556mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
557kw = "surf";
558usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
559usage += "\n Related commands: disp nt2d nt3d ";
560mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
561kw = "nt2d";
562usage = "Displays Points (X-Y) [with error-bars] from an NTuple ";
563usage += "\n Usage : nt2d nameobj varx vary [errx erry] [graphic_attributes]";
564usage += "\n Related commands: disp surf nt3d gfd2d ";
565mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
566kw = "nt3d";
567usage = "Displays 3D-Points (X-Y-Z) [with error-bars] from an NTuple ";
568usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz] [graphic_attributes]";
569usage += "\n Related commands: disp surf nt2d gfd3d ";
570mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
571kw = "gfd2d";
572usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
573usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
574usage += "\n Related commands: gfd3d nt2d nt3d ";
575mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
576kw = "gfd3d";
577usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
578usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
579usage += "\n Related commands: gfd2d nt2d nt3d ";
580mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
581
582kw = "func";
583usage = "Displays a function y=f(x) (Fills a vector with function values)";
584usage += "\n Usage: func f(x) xmin xmax npt [graphic_attributes]";
585usage += "\n Related commands: funcff func2d func2dff ";
586mpiac->RegisterCommand(kw, usage, this, "Func Plot");
587kw = "funcff";
588usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
589usage += "\n Usage: funcff C-FileName FunctionName xmin xmax npt [graphic_attributes]";
590usage += "\n Related commands: func func2d func2dff ";
591mpiac->RegisterCommand(kw, usage, this, "Func Plot");
592kw = "func2d";
593usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
594usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
595usage += "\n Related commands: func";
596mpiac->RegisterCommand(kw, usage, this, "Func Plot");
597kw = "func2dff";
598usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
599usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
600usage += "\n Related commands: func funcff func2d ";
601mpiac->RegisterCommand(kw, usage, this, "Func Plot");
602
603kw = "plot2d";
604usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
605usage += "\nNTuple varnames - Histo1D/HProf: i,x,val,err - Histo2D: i,j,x,y,val,err";
606usage += "\nVector: i,val - Matrix: i,j,val - Image: x=i,y=j, pix=val";
607usage += "\n Usage: plot2d nameobj f_X() g_Y() [ f_ErrX() f_ErrY() ] f_Cut() [graphic_attributes]";
608usage += "\n Related commands: plot3d projh1d projh2d projprof fillnt fillvec fillgd1 ";
609mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
610kw = "plot3d";
611usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
612usage += "\n Usage: plot2d nameobj f_X() g_Y() h_Z() Cut() [graphic_attributes]";
613usage += "\n Related commands: plot2d projh1d projh2d projprof fillnt fillvec ";
614mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
615
616kw = "projh1d";
617usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
618usage += "\n Usage: projh1d nameobj f_X() h_WT() Cut() nameh1d [graphic_attributes]";
619usage += "\n Histo1D nameh1d is created if necessary ";
620usage += "\n Related commands: plot2d projh2d projprof fillnt fillvec ";
621mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
622kw = "projh2d";
623usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
624usage += "\n Usage: projh2d nameobj f_X() g_Y() h_WT() Cut() nameh2d [graphic_attributes]";
625usage += "\n Histo2D nameh2d is created if necessary ";
626usage += "\n Related commands: plot2d projh1d projprof ";
627mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
628kw = "projprof";
629usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
630usage += "\n Usage: projh2d nameobj f_X() g_Y() h_WT() Cut() nameprof [graphic_attributes]";
631usage += "\n HProf nameprof is created if necessary ";
632usage += "\n Related commands: plot2d projh2d ";
633mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
634
635kw = "fillnt";
636usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
637usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() Cut() nameNt";
638usage += "\n Related commands: plot2d projh1d projh2d projprof ";
639mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
640kw = "fillvec";
641usage = "Creates and Fills a Vector with X=f(Object)";
642usage += "\n Usage: fillvec nameobj f_X() Cut() nameVec [graphic_attributes]";
643usage += "\n Related commands: plot2d projh1d fillnt ";
644mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
645kw = "fillgd1";
646usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
647usage += "\n Usage: fillgd1 nameobj f_X() g_Y() h_ErrY() Cut() nameGfd";
648usage += "\n Related commands: plot2d fillnt ";
649mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
650kw = "fillgd2";
651usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
652usage += "\n Usage: fillgd1 nameobj f_X() g_Y() h_Z() k_ErrZ() Cut() nameGfd";
653usage += "\n Related commands: plot2d fillgd2 ";
654mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
655
656kw = "fit";
657usage = "Fitting function to DataObjects (Histo, Histo2D, Vector, ...)";
658usage += "\n Usage: fit nomobj func [Options]";
659usage += "\n [p:p1,...,pn s:s1,...,sn m:m1,...,mn M:M1,...,Mn o:... o:...]";
660mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
661
662
663}
664
665/* --Methode-- */
666int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
667// string& func4, string& func5)
668{
669string cmd;
670int rc;
671
672if (dynlink) delete dynlink; dynlink = NULL;
673usfmap.clear();
674
675dynlink = new PDynLinkMgr(fnameso, true);
676if (dynlink == NULL) {
677 string sn = fnameso;
678 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
679 return(2);
680 }
681
682int nok=0;
683// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
684// DlUserProcFunction f = NULL;
685DlFunction f = NULL;
686if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
687// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
688f = dynlink->GetFunction(func1);
689if (f) { nok++; usfmap[func1] = f; }
690else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
691
692if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
693// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
694f = dynlink->GetFunction(func2);
695if (f) { nok++; usfmap[func2] = f; }
696else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
697
698if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
699// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
700f = dynlink->GetFunction(func3);
701if (f) { nok++; usfmap[func3] = f; }
702else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
703
704/* Pb compile g++ 2.7.2
705if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
706// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
707f = dynlink->GetFunction(func4);
708if (f) { nok++; usfmap[func4] = f; }
709else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
710
711if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
712// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
713f = dynlink->GetFunction(func5);
714if (f) { nok++; usfmap[func5] = f; }
715else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
716*/
717fin:
718if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
719else return(0);
720}
721
Note: See TracBrowser for help on using the repository browser.