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