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

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

Adaptation aux "normes DPC", introduction des classes CmdExecutor, ...
Fenetre d'aide en lignes, gestion de modules, ... Reza 11/05/99

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