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