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

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

Petit bug pointeur NULL Reza 31/05/99

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