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

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

Mise aux "normes" version DPC/Planck - Gestion des objets a travers

un adaptateur/interface NTuple par NamedObjMgr.
Enregistrement d'objets et de l'adaptateur (I/O PPersist, display, ...)
par ServNobjMgr .... Reza 13/05/99

File size: 25.2 KB
RevLine 
[293]1#include "piacmd.h"
2
3#include <stdio.h>
4#include <stdlib.h>
5#include <math.h>
6
7#include "basexecut.h"
8
9#include "pdlmgr.h"
10#include "ctimer.h"
11// #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
[295]197else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
198 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
[293]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);
[295]203 else if (kw == "imag") mObjMgr->DisplayImage(tokens[0], opt);
[293]204 }
205
206else if (kw == "nt2d") {
207 if (tokens.size() < 5) { cout << "Usage: nt2d nameobj varx vary errx erry opt" << endl; return(0); }
208 string opt = "n";
209 if (tokens.size() > 5) opt = tokens[5];
210 string ph = "";
211 mObjMgr->DisplayNT(tokens[0],tokens[1],tokens[2], ph, tokens[3], tokens[4], ph, opt);
212 }
213else if (kw == "nt3d") {
214 if (tokens.size() < 7) { cout << "Usage: nt3d nameobj varx vary varz errx erry errz opt" << endl; return(0); }
215 string opt = "n";
216 if (tokens.size() > 7) opt = tokens[7];
217 mObjMgr->DisplayNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], opt);
218 }
219
220else if (kw == "gfd2d") {
221 if(tokens.size()<2)
222 {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
223 return(0);}
224 string numvary = "";
225 string err = "";
226 string opt = "n";
227 if(tokens.size()>2) err = tokens[2];
228 if(tokens.size()>3) opt = tokens[3];
229 mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
230 }
231else if (kw == "gfd3d") {
232 if(tokens.size()<3)
233 {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
234 return(0);}
235 string err = "";
236 string opt = "n";
237 if(tokens.size()>3) err = tokens[3];
238 if(tokens.size()>4) opt = tokens[4];
239 mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
240 }
241
242// >>>>>>>>>>> Trace de fonctions
243else if ( (kw == "func") ) {
244 if (tokens.size() < 4) { cout << "Usage: func f(x) xmin xmax npt [opt]" << endl; return(0); }
245 string opt = "n";
246 if (tokens.size() > 4) opt = tokens[4];
247 int np;
248 float xmin, xmax;
249 np = 100;
250 xmin = 0.; xmax = 1.;
251 np = atoi(tokens[3].c_str());
252 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
253 mObjMgr->PlotFunc(tokens[0], xmin, xmax, np, opt);
254 }
255else if ( (kw == "func2d") ) {
256 if (tokens.size() < 7) {
257 cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty opt" << endl;
258 return(0);
259 }
260 int npx, npy;
261 float xmin, xmax;
262 float ymin, ymax;
263 npx = npy = 50;
264 xmin = 0.; xmax = 1.;
265 ymin = 0.; ymax = 1.;
266 npx = atoi(tokens[3].c_str());
267 npy = atoi(tokens[6].c_str());
268 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
269 ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
270 string opt = "n";
271 if (tokens.size() > 7) opt = tokens[7];
272 mObjMgr->PlotFunc2D(tokens[0], xmin, xmax, ymin, ymax, npx, npy, opt);
273 }
274
275// >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
276else if (kw == "plot2d" ) {
277 if (tokens.size() < 4) {
278 cout << "Usage: plot2d nameobj expx expy [experrx experry] expcut [opt]" << endl;
279 return(0);
280 }
281 string errx = ""; string erry = ""; string ecut = "1";
282 string opt = "n";
283 if (tokens.size() < 6) { // Plot sans les erreurs
284 ecut = tokens[3];
285 if (tokens.size() > 4) opt = tokens[4];
286 }
287 else { // Plot avec les erreurs
288 errx = tokens[3]; erry = tokens[4]; ecut = tokens[5];
289 if (tokens.size() > 6) opt = tokens[6];
290 }
291 mObjMgr->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,ecut,opt);
292 }
293
294else if (kw == "plot3d" ) {
295 if (tokens.size() < 5) {
296 cout << "Usage: plot3d nomobj expx expy expz expcut opt" << endl;
297 return(0);
298 }
299 string opt = "n";
300 if (tokens.size() > 5) opt = tokens[5];
301 mObjMgr->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], opt);
302 }
303
304else if (kw == "projh1d" ) {
305 if (tokens.size() < 5) {
306 cout << "Usage: projh1d nomobj expx expwt expcut nomh1 opt" << endl;
307 return(0);
308 }
309 string opt = "n";
310 if (tokens.size() > 5) opt = tokens[5];
311 mObjMgr->ProjectH1(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], opt);
312 }
313
314else if (kw == "projh2d" ) {
315 if (tokens.size() < 6) {
316 cout << "Usage: projh2 nomobj expx expy expwt expcut nomh2 opt" << endl;
317 return(0);
318 }
319 string opt = "n";
320 if (tokens.size() > 6) opt = tokens[6];
321
322 mObjMgr->ProjectH2(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt);
323 }
324
325else if (kw == "projprof" ) {
326 if (tokens.size() < 6) {
327 cout << "Usage: projprof nomobj expx expy expwt expcut nomprof opt" << endl;
328 return(0);
329 }
330 string opt = "n";
331 if (tokens.size() > 6) opt = tokens[6];
332
333 mObjMgr->ProjectHProf(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt);
334 }
335
336else if (kw == "fillnt" ) {
337 if (tokens.size() < 7) {
338 cout << "Usage: fillnt nameobj expx expy expz expt expcut nament" << endl;
339 return(0);
340 }
341 mObjMgr->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6] );
342 }
343
344else if (kw == "fillvec" ) {
345 if (tokens.size() < 4) {
346 cout << "Usage: fillvec nameobj expx expcut nomvec opt" << endl;
347 return(0);
348 }
349 string opt = "n";
350 if (tokens.size() > 4) opt = tokens[4];
351 mObjMgr->FillVect(tokens[0],tokens[1],tokens[2], tokens[3], opt);
352 }
353
354else if (kw == "fillgd1" ) {
355 if (tokens.size() < 5) {
356 cout << "Usage: fillgd1 nomobj expx expy experry expcut nomgfd" << endl;
357 return(0);
358 }
359 string nomgfd = "";
360 if (tokens.size() > 5) nomgfd = tokens[5];
361 string expy = "";
362 mObjMgr->FillGFD(tokens[0],tokens[1], expy, tokens[2], tokens[3], tokens[4],nomgfd);
363 }
364
365else if (kw == "fillgd2" ) {
366 if (tokens.size() < 6) {
367 cout << "Usage: fillgd2 nomobj expx expy expz experrz expcut nomgfd" << endl;
368 return(0);
369 }
370 string nomgfd = "";
371 if (tokens.size() > 6) nomgfd = tokens[6];
372 mObjMgr->FillGFD(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5],nomgfd);
373 }
374
375
376// Fit 1D sur objets 1D. Egalement Fit 2D sur objets 2D.
377else if (kw == "fit") {
378 if (tokens.size() < 2) {
379 cout <<"Usage:fit nomobj func \n"
380 <<" [p:p1,...,pn s:s1,...,sn m:m1,...,mn M:M1,...,Mn o:... o:...]\n";
381 return(0);
382 }
383 string p=""; string s=""; string m=""; string M=""; string O="";
384 if (tokens.size()>2)
385 for(int ip=2;ip<tokens.size();ip++) {
386 if(tokens[ip].length()<=2) continue;
387 const char *c = tokens[ip].c_str();
388 if(c[1]!=':') continue;
389 if(c[0]=='p') p=c+2;
390 else if(c[0]=='s') s=c+2;
391 else if(c[0]=='m') m=c+2;
392 else if(c[0]=='M') M=c+2;
393 else if(c[0]=='o') {O += ","; O += c+2;}
394 }
395 mObjMgr->Fit12D(tokens[0],tokens[1],p,s,m,M,O);
396}
397
398
399else {
400 cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
401 return(-1);
402 }
403
404return(0);
405}
406
407/* --Methode-- */
408void PIABaseExecutor::RegisterCommands()
409{
410string kw, usage;
411kw = "loadmodule";
412usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
413usage += "\n Related commands: link";
414mpiac->RegisterCommand(kw, usage, this);
415kw = "link";
416usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
417usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
418usage += "\n Related commands: call loadmodule";
419mpiac->RegisterCommand(kw, usage, this);
420kw = "call";
421usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
422usage += "\n User function : f(vector<string>& args)";
423usage += "\n Related commands: link";
424mpiac->RegisterCommand(kw, usage, this);
425
426kw = "zone";
427usage = "To Divide the Graphic window \n Usage: zone nx ny";
428mpiac->RegisterCommand(kw, usage, this);
429kw = "newwin";
430usage = "To Create a New Graphic window, with zones \n Usage: newwin nx ny";
431mpiac->RegisterCommand(kw, usage, this);
432kw = "stacknext";
433usage = "Displays the next widget on stack window \n Usage: stacknext";
434mpiac->RegisterCommand(kw, usage, this);
435
436kw = "gratt";
437usage = "To change default graphic options \n Usage: gratt att_list \n";
438usage += "att_list=def back to default values, Example: gratt red,circlemarker5";
439usage += "\n ------------------ Graphic attribute list ------------------ \n";
440usage += ">> Colors: defcol black white grey red blue green yellow magenta cyan \n";
441usage += " turquoise navyblue orange siennared purple limegreen gold \n";
442usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n";
443usage += " thickdashedline dottedline thindottedline thickdottedline \n";
444usage += ">> Fonts: deffont normalfont boldfont italicfont smallfont smallboldfont \n";
445usage += " smallitalicfont bigfont bigboldfont bigitalicfont \n";
446usage += " hugefont hugeboldfont hugeitalicfont \n";
447usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker <T> \n";
448usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
449usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n";
450usage += " with <T> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ... \n";
451usage += ">> ColorTables: defcmap grey32 greyinv32 colrj32 colbr32 \n";
452usage += " grey128 greyinv128 colrj128 colbr128 \n";
453usage += ">> ZoomFactors: defzoom zoomx1 zoomx2 zoomx3 zoomx4 zoomx5 \n";
454usage += " zoom/2 zoom/3 zoom/4 zoom/5 \n";
455usage += ">> Axes: stdaxes=defaxes=boxaxes simpleaxes boxaxesgrid \n";
456usage += " fineaxes grid=fineaxesgrid \n";
457usage += ">> DisplayWindow: next same win stack \n";
458mpiac->RegisterCommand(kw, usage, this);
459
460kw = "openfits";
461usage = "Loads a FITS file into an Image<T> \n Usage: openfits filename";
462usage += "\n Related commands: savefits openppf";
463mpiac->RegisterCommand(kw, usage, this);
464kw = "savefits";
465usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
466usage += "\n Related commands: openfits saveall";
467mpiac->RegisterCommand(kw, usage, this);
468kw = "openppf";
469usage = "Reads all objects from a PPF file \n Usage: openppf filename";
470usage += "\n Related commands: saveall openfits";
471mpiac->RegisterCommand(kw, usage, this);
472kw = "saveall";
473usage = "Saves all objects into a PPF file \n Usage: saveall filename";
474usage += "\n Related commands: openppf savefits";
475mpiac->RegisterCommand(kw, usage, this);
476
477kw = "print";
478usage = "Prints an object \n Usage: print nameobj";
479mpiac->RegisterCommand(kw, usage, this);
480
[295]481kw = "listobjs";
482usage = "Prints the list of objects";
483usage += "\n Usage: listobjs";
484mpiac->RegisterCommand(kw, usage, this);
[293]485kw = "rename";
486usage = "Rename an object \n Usage: rename nameobj namenew";
487usage += "\n Related commands: del delobjs";
488mpiac->RegisterCommand(kw, usage, this);
489kw = "del";
490usage = "Deletes an object \n Usage: del nameobj";
491usage += "\n Related commands: delobjs rename";
492mpiac->RegisterCommand(kw, usage, this);
493kw = "delobjs";
494usage = "Delete a set of objects with names matching a pattern (x?y*)";
495usage += "\n Usage: delobjs nameobjpattern \n";
496usage += "\n Related commands: del rename";
497mpiac->RegisterCommand(kw, usage, this);
498
499kw = "newh1d";
500usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
501usage += "\n Related commands: newh2d newprof newgfd ";
502mpiac->RegisterCommand(kw, usage, this);
503kw = "newh2d";
504usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
505usage += "\n Related commands: newh1d newprof newgfd ";
506mpiac->RegisterCommand(kw, usage, this);
507kw = "newprof";
508usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
509usage += "\n Related commands: newh1d newh2d newgfd ";
510mpiac->RegisterCommand(kw, usage, this);
511kw = "newgfd";
512usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
513usage += "\n Related commands: newh1d newh2d newprof ";
514mpiac->RegisterCommand(kw, usage, this);
515
516kw = "disp";
517usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
518usage += "\n Related commands: surf nt2d nt3d ";
519mpiac->RegisterCommand(kw, usage, this);
[295]520kw = "imag";
521usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
522usage += "\n Related commands: disp surf nt2d nt3d ";
523mpiac->RegisterCommand(kw, usage, this);
[293]524kw = "surf";
525usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
526usage += "\n Related commands: disp nt2d nt3d ";
527mpiac->RegisterCommand(kw, usage, this);
528kw = "nt2d";
529usage = "Displays Points (X-Y) [with error-bars] from an NTuple ";
530usage += "\n Usage : nt2d nameobj varx vary [errx erry] [graphic_attributes]";
531usage += "\n Related commands: disp surf nt3d gfd2d ";
532mpiac->RegisterCommand(kw, usage, this);
533kw = "nt3d";
534usage = "Displays 3D-Points (X-Y-Z) [with error-bars] from an NTuple ";
535usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz] [graphic_attributes]";
536usage += "\n Related commands: disp surf nt2d gfd3d ";
537mpiac->RegisterCommand(kw, usage, this);
538kw = "gfd2d";
539usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
540usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
541usage += "\n Related commands: gfd3d nt2d nt3d ";
542mpiac->RegisterCommand(kw, usage, this);
543kw = "gfd3d";
544usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
545usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
546usage += "\n Related commands: gfd2d nt2d nt3d ";
547mpiac->RegisterCommand(kw, usage, this);
548
549kw = "func";
550usage = "Displays a function y=f(x) (Fills a vector with function values)";
551usage += "\n Usage: func f(x) xmin xmax npt [graphic_attributes]";
552usage += "\n Related commands: func2d ";
553mpiac->RegisterCommand(kw, usage, this);
554kw = "func2d";
555usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
556usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
557usage += "\n Related commands: func";
558mpiac->RegisterCommand(kw, usage, this);
559
560kw = "plot2d";
561usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
562usage += "\nNTuple varnames - Histo1D/HProf: i,x,val,err - Histo2D: i,j,x,y,val,err";
563usage += "\nVector: i,val - Matrix: i,j,val - Image: x=i,y=j, pix=val";
564usage += "\n Usage: plot2d nameobj f_X() g_Y() [ f_ErrX() f_ErrY() ] f_Cut() [graphic_attributes]";
565usage += "\n Related commands: plot3d projh1d projh2d projprof fillnt fillvec fillgd1 ";
566mpiac->RegisterCommand(kw, usage, this);
567kw = "plot3d";
568usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
569usage += "\n Usage: plot2d nameobj f_X() g_Y() h_Z() Cut() [graphic_attributes]";
570usage += "\n Related commands: plot2d projh1d projh2d projprof fillnt fillvec ";
571mpiac->RegisterCommand(kw, usage, this);
572
573kw = "projh1d";
574usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
575usage += "\n Usage: projh1d nameobj f_X() h_WT() Cut() nameh1d [graphic_attributes]";
576usage += "\n Histo1D nameh1d is created if necessary ";
577usage += "\n Related commands: plot2d projh2d projprof fillnt fillvec ";
578mpiac->RegisterCommand(kw, usage, this);
579kw = "projh2d";
580usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
581usage += "\n Usage: projh2d nameobj f_X() g_Y() h_WT() Cut() nameh2d [graphic_attributes]";
582usage += "\n Histo2D nameh2d is created if necessary ";
583usage += "\n Related commands: plot2d projh1d projprof ";
584mpiac->RegisterCommand(kw, usage, this);
585kw = "projprof";
586usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
587usage += "\n Usage: projh2d nameobj f_X() g_Y() h_WT() Cut() nameprof [graphic_attributes]";
588usage += "\n HProf nameprof is created if necessary ";
589usage += "\n Related commands: plot2d projh2d ";
590mpiac->RegisterCommand(kw, usage, this);
591
592kw = "fillnt";
593usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
594usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() Cut() nameNt";
595usage += "\n Related commands: plot2d projh1d projh2d projprof ";
596mpiac->RegisterCommand(kw, usage, this);
597kw = "fillvec";
598usage = "Creates and Fills a Vector with X=f(Object)";
599usage += "\n Usage: fillvec nameobj f_X() Cut() nameVec [graphic_attributes]";
600usage += "\n Related commands: plot2d projh1d fillnt ";
601mpiac->RegisterCommand(kw, usage, this);
602kw = "fillgd1";
603usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
604usage += "\n Usage: fillgd1 nameobj f_X() g_Y() h_ErrY() Cut() nameGfd";
605usage += "\n Related commands: plot2d fillnt ";
606mpiac->RegisterCommand(kw, usage, this);
607kw = "fillgd2";
608usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
609usage += "\n Usage: fillgd1 nameobj f_X() g_Y() h_Z() k_ErrZ() Cut() nameGfd";
610usage += "\n Related commands: plot2d fillgd2 ";
611mpiac->RegisterCommand(kw, usage, this);
612
613kw = "fit";
614usage = "Fitting function to DataObjects (Histo, Histo2D, Vector, ...)";
615usage += "\n Usage: fit nomobj func [Options]";
616usage += "\n [p:p1,...,pn s:s1,...,sn m:m1,...,mn M:M1,...,Mn o:... o:...]";
617mpiac->RegisterCommand(kw, usage, this);
618
619
620}
621
622/* --Methode-- */
623int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
624// string& func4, string& func5)
625{
626string cmd;
627int rc;
628
629if (dynlink) delete dynlink; dynlink = NULL;
630usfmap.clear();
631
632dynlink = new PDynLinkMgr(fnameso, true);
633if (dynlink == NULL) {
634 string sn = fnameso;
635 cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
636 return(2);
637 }
638
639int nok=0;
640// on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
641// DlUserProcFunction f = NULL;
642DlFunction f = NULL;
643if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
644// f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
645f = dynlink->GetFunction(func1);
646if (f) { nok++; usfmap[func1] = f; }
647else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
648
649if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
650// f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
651f = dynlink->GetFunction(func2);
652if (f) { nok++; usfmap[func2] = f; }
653else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
654
655if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
656// f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
657f = dynlink->GetFunction(func3);
658if (f) { nok++; usfmap[func3] = f; }
659else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
660
661/* Pb compile g++ 2.7.2
662if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
663// f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
664f = dynlink->GetFunction(func4);
665if (f) { nok++; usfmap[func4] = f; }
666else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
667
668if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
669// f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
670f = dynlink->GetFunction(func5);
671if (f) { nok++; usfmap[func5] = f; }
672else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
673*/
674fin:
675if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
676else return(0);
677}
678
Note: See TracBrowser for help on using the repository browser.