[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"
|
---|
[333] | 22 | #include "cvector.h"
|
---|
[293] | 23 |
|
---|
| 24 |
|
---|
| 25 |
|
---|
| 26 | /* --Methode-- */
|
---|
| 27 | PIABaseExecutor::PIABaseExecutor(PIACmd* piac, NamedObjMgr* omg, PIStdImgApp* app)
|
---|
| 28 | {
|
---|
| 29 | mpiac = piac;
|
---|
| 30 | mObjMgr = omg;
|
---|
| 31 | mImgApp = app;
|
---|
[312] | 32 | dynlink = NULL;
|
---|
[293] | 33 | RegisterCommands();
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | PIABaseExecutor::~PIABaseExecutor()
|
---|
| 37 | {
|
---|
| 38 | }
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 |
|
---|
| 42 | /* --Methode-- */
|
---|
| 43 | int PIABaseExecutor::Execute(string& kw, vector<string>& tokens)
|
---|
| 44 | {
|
---|
[333] | 45 | Services2NObjMgr* srvo = mObjMgr->GetServiceObj();
|
---|
[293] | 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 | }
|
---|
[331] | 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 | }
|
---|
[293] | 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); }
|
---|
[331] | 117 | else { string nomobj = ""; mObjMgr->ReadFits(tokens[0], nomobj); }
|
---|
[293] | 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 | }
|
---|
[333] | 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 | }
|
---|
[293] | 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 | }
|
---|
[333] | 139 | else if ( (kw == "rename" ) || (kw == "mv") ) {
|
---|
[293] | 140 | if (tokens.size() < 2) { cout << "Usage: rename nameobj namenew" << endl; return(0); }
|
---|
| 141 | mObjMgr->RenameObj(tokens[0], tokens[1]);
|
---|
| 142 | }
|
---|
[333] | 143 | else if ( (kw == "del" ) || (kw == "rm") ) {
|
---|
[293] | 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 | }
|
---|
[333] | 151 | else if ( (kw == "listobjs") || (kw == "ls") ) {
|
---|
[331] | 152 | if (tokens.size() < 1) tokens.push_back("*");
|
---|
| 153 | mObjMgr->ListObjs(tokens[0]);
|
---|
| 154 | }
|
---|
[333] | 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 | }
|
---|
[293] | 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 |
|
---|
[333] | 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 |
|
---|
[293] | 257 | // >>>>>>>>>>> Affichage des objets
|
---|
[295] | 258 | else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
|
---|
| 259 | if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
|
---|
[293] | 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);
|
---|
[295] | 264 | else if (kw == "imag") mObjMgr->DisplayImage(tokens[0], opt);
|
---|
[293] | 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 | }
|
---|
[333] | 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 | }
|
---|
[293] | 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];
|
---|
[333] | 285 | mObjMgr->DisplayNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], opt, true);
|
---|
[293] | 286 | }
|
---|
| 287 |
|
---|
[339] | 288 | // Obsolete : ne pas virer SVP, cmv 26/7/99
|
---|
[293] | 289 | else if (kw == "gfd2d") {
|
---|
[339] | 290 | cout<<"----- gfd2d OBSOLETE: utilisez nt2d -----"<<endl;
|
---|
[293] | 291 | if(tokens.size()<2)
|
---|
| 292 | {cout<<"Usage: gfd2d nomobj numvarx erreur=(x y xy) opt"<<endl;
|
---|
| 293 | return(0);}
|
---|
| 294 | string numvary = "";
|
---|
| 295 | string err = "";
|
---|
| 296 | string opt = "n";
|
---|
| 297 | if(tokens.size()>2) err = tokens[2];
|
---|
| 298 | if(tokens.size()>3) opt = tokens[3];
|
---|
| 299 | mObjMgr->DisplayGFD(tokens[0],tokens[1],numvary,err,opt);
|
---|
| 300 | }
|
---|
| 301 | else if (kw == "gfd3d") {
|
---|
[339] | 302 | cout<<"----- gfd3d OBSOLETE: utilisez nt3d -----"<<endl;
|
---|
[293] | 303 | if(tokens.size()<3)
|
---|
| 304 | {cout<<"Usage: gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) opt"<<endl;
|
---|
| 305 | return(0);}
|
---|
| 306 | string err = "";
|
---|
| 307 | string opt = "n";
|
---|
| 308 | if(tokens.size()>3) err = tokens[3];
|
---|
| 309 | if(tokens.size()>4) opt = tokens[4];
|
---|
| 310 | mObjMgr->DisplayGFD(tokens[0],tokens[1],tokens[2],err,opt);
|
---|
| 311 | }
|
---|
| 312 |
|
---|
| 313 | // >>>>>>>>>>> Trace de fonctions
|
---|
| 314 | else if ( (kw == "func") ) {
|
---|
| 315 | if (tokens.size() < 4) { cout << "Usage: func f(x) xmin xmax npt [opt]" << endl; return(0); }
|
---|
| 316 | string opt = "n";
|
---|
| 317 | if (tokens.size() > 4) opt = tokens[4];
|
---|
| 318 | int np;
|
---|
[333] | 319 | double xmin, xmax;
|
---|
[293] | 320 | np = 100;
|
---|
| 321 | xmin = 0.; xmax = 1.;
|
---|
| 322 | np = atoi(tokens[3].c_str());
|
---|
| 323 | xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
|
---|
[333] | 324 | string nom = "";
|
---|
| 325 | mObjMgr->GetServiceObj()->PlotFunc(tokens[0], nom, xmin, xmax, np, opt);
|
---|
[293] | 326 | }
|
---|
[326] | 327 | else if ( (kw == "funcff") ) {
|
---|
| 328 | if (tokens.size() < 5) { cout << "Usage: funcff C-filename f(x)-name xmin xmax npt [opt]" << endl; return(0); }
|
---|
| 329 | string opt = "n";
|
---|
| 330 | if (tokens.size() > 5) opt = tokens[5];
|
---|
| 331 | int np;
|
---|
[333] | 332 | double xmin, xmax;
|
---|
[326] | 333 | np = 100;
|
---|
| 334 | xmin = 0.; xmax = 1.;
|
---|
| 335 | np = atoi(tokens[4].c_str());
|
---|
| 336 | xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
|
---|
[333] | 337 | string nom = "";
|
---|
| 338 | mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], nom, xmin, xmax, np, opt);
|
---|
[326] | 339 | }
|
---|
[293] | 340 | else if ( (kw == "func2d") ) {
|
---|
| 341 | if (tokens.size() < 7) {
|
---|
| 342 | cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty opt" << endl;
|
---|
| 343 | return(0);
|
---|
| 344 | }
|
---|
| 345 | int npx, npy;
|
---|
[333] | 346 | double xmin, xmax;
|
---|
| 347 | double ymin, ymax;
|
---|
[293] | 348 | npx = npy = 50;
|
---|
| 349 | xmin = 0.; xmax = 1.;
|
---|
| 350 | ymin = 0.; ymax = 1.;
|
---|
| 351 | npx = atoi(tokens[3].c_str());
|
---|
| 352 | npy = atoi(tokens[6].c_str());
|
---|
| 353 | xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
|
---|
| 354 | ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
|
---|
| 355 | string opt = "n";
|
---|
| 356 | if (tokens.size() > 7) opt = tokens[7];
|
---|
[333] | 357 | string nom = "";
|
---|
| 358 | mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
|
---|
[293] | 359 | }
|
---|
[326] | 360 | else if ( (kw == "func2dff") ) {
|
---|
| 361 | if (tokens.size() < 8) {
|
---|
| 362 | cout << "Usage: func2d C-filename F(x,y)-name xmax nptx ymin ymax npty opt" << endl;
|
---|
| 363 | return(0);
|
---|
| 364 | }
|
---|
| 365 | int npx, npy;
|
---|
[333] | 366 | double xmin, xmax;
|
---|
| 367 | double ymin, ymax;
|
---|
[326] | 368 | npx = npy = 50;
|
---|
| 369 | xmin = 0.; xmax = 1.;
|
---|
| 370 | ymin = 0.; ymax = 1.;
|
---|
| 371 | npx = atoi(tokens[4].c_str());
|
---|
| 372 | npy = atoi(tokens[7].c_str());
|
---|
| 373 | xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
|
---|
| 374 | ymin = atof(tokens[5].c_str()); ymax = atof(tokens[6].c_str());
|
---|
| 375 | string opt = "n";
|
---|
| 376 | if (tokens.size() > 8) opt = tokens[8];
|
---|
[333] | 377 | string nom = "";
|
---|
| 378 | mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
|
---|
[326] | 379 | }
|
---|
[293] | 380 |
|
---|
| 381 | // >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
|
---|
| 382 | else if (kw == "plot2d" ) {
|
---|
| 383 | if (tokens.size() < 4) {
|
---|
| 384 | cout << "Usage: plot2d nameobj expx expy [experrx experry] expcut [opt]" << endl;
|
---|
| 385 | return(0);
|
---|
| 386 | }
|
---|
| 387 | string errx = ""; string erry = ""; string ecut = "1";
|
---|
| 388 | string opt = "n";
|
---|
| 389 | if (tokens.size() < 6) { // Plot sans les erreurs
|
---|
| 390 | ecut = tokens[3];
|
---|
| 391 | if (tokens.size() > 4) opt = tokens[4];
|
---|
| 392 | }
|
---|
| 393 | else { // Plot avec les erreurs
|
---|
| 394 | errx = tokens[3]; erry = tokens[4]; ecut = tokens[5];
|
---|
| 395 | if (tokens.size() > 6) opt = tokens[6];
|
---|
| 396 | }
|
---|
[333] | 397 | srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,ecut,opt);
|
---|
[293] | 398 | }
|
---|
| 399 |
|
---|
[333] | 400 | else if (kw == "plot2dw" ) {
|
---|
| 401 | if (tokens.size() < 5) {
|
---|
| 402 | cout << "Usage: plot2dw nomobj expx expy expwt expcut opt" << endl;
|
---|
| 403 | return(0);
|
---|
| 404 | }
|
---|
| 405 | string opt = "n";
|
---|
| 406 | if (tokens.size() > 5) opt = tokens[5];
|
---|
| 407 | srvo->DisplayPoints2DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], opt);
|
---|
| 408 | }
|
---|
[293] | 409 | else if (kw == "plot3d" ) {
|
---|
| 410 | if (tokens.size() < 5) {
|
---|
| 411 | cout << "Usage: plot3d nomobj expx expy expz expcut opt" << endl;
|
---|
| 412 | return(0);
|
---|
| 413 | }
|
---|
| 414 | string opt = "n";
|
---|
| 415 | if (tokens.size() > 5) opt = tokens[5];
|
---|
[333] | 416 | srvo->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], opt);
|
---|
[293] | 417 | }
|
---|
| 418 |
|
---|
| 419 | else if (kw == "projh1d" ) {
|
---|
| 420 | if (tokens.size() < 5) {
|
---|
| 421 | cout << "Usage: projh1d nomobj expx expwt expcut nomh1 opt" << endl;
|
---|
| 422 | return(0);
|
---|
| 423 | }
|
---|
| 424 | string opt = "n";
|
---|
| 425 | if (tokens.size() > 5) opt = tokens[5];
|
---|
[333] | 426 | srvo->ProjectH1(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], opt);
|
---|
[293] | 427 | }
|
---|
| 428 |
|
---|
| 429 | else if (kw == "projh2d" ) {
|
---|
| 430 | if (tokens.size() < 6) {
|
---|
| 431 | cout << "Usage: projh2 nomobj expx expy expwt expcut nomh2 opt" << endl;
|
---|
| 432 | return(0);
|
---|
| 433 | }
|
---|
| 434 | string opt = "n";
|
---|
| 435 | if (tokens.size() > 6) opt = tokens[6];
|
---|
| 436 |
|
---|
[333] | 437 | srvo->ProjectH2(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt);
|
---|
[293] | 438 | }
|
---|
| 439 |
|
---|
| 440 | else if (kw == "projprof" ) {
|
---|
| 441 | if (tokens.size() < 6) {
|
---|
| 442 | cout << "Usage: projprof nomobj expx expy expwt expcut nomprof opt" << endl;
|
---|
| 443 | return(0);
|
---|
| 444 | }
|
---|
| 445 | string opt = "n";
|
---|
| 446 | if (tokens.size() > 6) opt = tokens[6];
|
---|
| 447 |
|
---|
[333] | 448 | srvo->ProjectHProf(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt);
|
---|
[293] | 449 | }
|
---|
| 450 |
|
---|
| 451 | else if (kw == "fillnt" ) {
|
---|
[333] | 452 | if (tokens.size() < 6) {
|
---|
| 453 | cout << "Usage: fillnt nameobj expx expy expz expt expcut [ntname]" << endl;
|
---|
[293] | 454 | return(0);
|
---|
| 455 | }
|
---|
[333] | 456 | if (tokens.size() < 7) tokens.push_back("");
|
---|
| 457 | srvo->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6] );
|
---|
[293] | 458 | }
|
---|
| 459 |
|
---|
[333] | 460 | else if (kw == "ntloop" ) {
|
---|
| 461 | if (tokens.size() < 3) {
|
---|
| 462 | cout << "Usage: ntloop nameobj fname funcname [ntname]" << endl;
|
---|
| 463 | return(0);
|
---|
| 464 | }
|
---|
| 465 | if (tokens.size() < 4) tokens.push_back("");
|
---|
| 466 | srvo->FillNTFrCFile(tokens[0],tokens[1], tokens[2], tokens[3]);
|
---|
| 467 | }
|
---|
| 468 |
|
---|
| 469 | else if (kw == "ntexpcfile" ) {
|
---|
| 470 | if (tokens.size() < 3) {
|
---|
| 471 | cout << "Usage: ntexpcfile nameobj fname funcname" << endl;
|
---|
| 472 | return(0);
|
---|
| 473 | }
|
---|
| 474 | srvo->PrepareNTExpressionCFile(tokens[0],tokens[1], tokens[2]);
|
---|
| 475 | }
|
---|
| 476 |
|
---|
[293] | 477 | else if (kw == "fillvec" ) {
|
---|
| 478 | if (tokens.size() < 4) {
|
---|
| 479 | cout << "Usage: fillvec nameobj expx expcut nomvec opt" << endl;
|
---|
| 480 | return(0);
|
---|
| 481 | }
|
---|
| 482 | string opt = "n";
|
---|
| 483 | if (tokens.size() > 4) opt = tokens[4];
|
---|
[333] | 484 | srvo->FillVect(tokens[0],tokens[1],tokens[2], tokens[3], opt);
|
---|
[293] | 485 | }
|
---|
| 486 |
|
---|
| 487 | else if (kw == "fillgd1" ) {
|
---|
| 488 | if (tokens.size() < 5) {
|
---|
| 489 | cout << "Usage: fillgd1 nomobj expx expy experry expcut nomgfd" << endl;
|
---|
| 490 | return(0);
|
---|
| 491 | }
|
---|
| 492 | string nomgfd = "";
|
---|
| 493 | if (tokens.size() > 5) nomgfd = tokens[5];
|
---|
| 494 | string expy = "";
|
---|
[333] | 495 | srvo->FillGFD(tokens[0],tokens[1], expy, tokens[2], tokens[3], tokens[4],nomgfd);
|
---|
[293] | 496 | }
|
---|
| 497 |
|
---|
| 498 | else if (kw == "fillgd2" ) {
|
---|
| 499 | if (tokens.size() < 6) {
|
---|
| 500 | cout << "Usage: fillgd2 nomobj expx expy expz experrz expcut nomgfd" << endl;
|
---|
| 501 | return(0);
|
---|
| 502 | }
|
---|
| 503 | string nomgfd = "";
|
---|
| 504 | if (tokens.size() > 6) nomgfd = tokens[6];
|
---|
[333] | 505 | srvo->FillGFD(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5],nomgfd);
|
---|
[293] | 506 | }
|
---|
| 507 |
|
---|
| 508 |
|
---|
| 509 | // Fit 1D sur objets 1D. Egalement Fit 2D sur objets 2D.
|
---|
| 510 | else if (kw == "fit") {
|
---|
| 511 | if (tokens.size() < 2) {
|
---|
| 512 | cout <<"Usage:fit nomobj func \n"
|
---|
| 513 | <<" [p:p1,...,pn s:s1,...,sn m:m1,...,mn M:M1,...,Mn o:... o:...]\n";
|
---|
| 514 | return(0);
|
---|
| 515 | }
|
---|
| 516 | string p=""; string s=""; string m=""; string M=""; string O="";
|
---|
| 517 | if (tokens.size()>2)
|
---|
| 518 | for(int ip=2;ip<tokens.size();ip++) {
|
---|
| 519 | if(tokens[ip].length()<=2) continue;
|
---|
| 520 | const char *c = tokens[ip].c_str();
|
---|
| 521 | if(c[1]!=':') continue;
|
---|
| 522 | if(c[0]=='p') p=c+2;
|
---|
| 523 | else if(c[0]=='s') s=c+2;
|
---|
| 524 | else if(c[0]=='m') m=c+2;
|
---|
| 525 | else if(c[0]=='M') M=c+2;
|
---|
| 526 | else if(c[0]=='o') {O += ","; O += c+2;}
|
---|
| 527 | }
|
---|
[333] | 528 | srvo->Fit12D(tokens[0],tokens[1],p,s,m,M,O);
|
---|
[293] | 529 | }
|
---|
| 530 |
|
---|
| 531 |
|
---|
| 532 | else {
|
---|
| 533 | cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
|
---|
| 534 | return(-1);
|
---|
| 535 | }
|
---|
| 536 |
|
---|
| 537 | return(0);
|
---|
| 538 | }
|
---|
| 539 |
|
---|
| 540 | /* --Methode-- */
|
---|
| 541 | void PIABaseExecutor::RegisterCommands()
|
---|
| 542 | {
|
---|
| 543 | string kw, usage;
|
---|
| 544 | kw = "loadmodule";
|
---|
| 545 | usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
|
---|
| 546 | usage += "\n Related commands: link";
|
---|
[330] | 547 | mpiac->RegisterCommand(kw, usage, this, "External Modules");
|
---|
[293] | 548 | kw = "link";
|
---|
| 549 | usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
|
---|
| 550 | usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
|
---|
| 551 | usage += "\n Related commands: call loadmodule";
|
---|
[330] | 552 | mpiac->RegisterCommand(kw, usage, this, "External Modules");
|
---|
[293] | 553 | kw = "call";
|
---|
| 554 | usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
|
---|
| 555 | usage += "\n User function : f(vector<string>& args)";
|
---|
| 556 | usage += "\n Related commands: link";
|
---|
[330] | 557 | mpiac->RegisterCommand(kw, usage, this, "External Modules");
|
---|
[293] | 558 |
|
---|
| 559 | kw = "zone";
|
---|
| 560 | usage = "To Divide the Graphic window \n Usage: zone nx ny";
|
---|
[330] | 561 | mpiac->RegisterCommand(kw, usage, this, "Graphics");
|
---|
[293] | 562 | kw = "newwin";
|
---|
| 563 | usage = "To Create a New Graphic window, with zones \n Usage: newwin nx ny";
|
---|
[330] | 564 | mpiac->RegisterCommand(kw, usage, this, "Graphics");
|
---|
[293] | 565 | kw = "stacknext";
|
---|
| 566 | usage = "Displays the next widget on stack window \n Usage: stacknext";
|
---|
[330] | 567 | mpiac->RegisterCommand(kw, usage, this, "Graphics");
|
---|
[293] | 568 |
|
---|
| 569 | kw = "gratt";
|
---|
| 570 | usage = "To change default graphic options \n Usage: gratt att_list \n";
|
---|
| 571 | usage += "att_list=def back to default values, Example: gratt red,circlemarker5";
|
---|
| 572 | usage += "\n ------------------ Graphic attribute list ------------------ \n";
|
---|
| 573 | usage += ">> Colors: defcol black white grey red blue green yellow magenta cyan \n";
|
---|
| 574 | usage += " turquoise navyblue orange siennared purple limegreen gold \n";
|
---|
| 575 | usage += ">> Lines: defline normalline thinline thickline dashedline thindashedline \n";
|
---|
| 576 | usage += " thickdashedline dottedline thindottedline thickdottedline \n";
|
---|
| 577 | usage += ">> Fonts: deffont normalfont boldfont italicfont smallfont smallboldfont \n";
|
---|
| 578 | usage += " smallitalicfont bigfont bigboldfont bigitalicfont \n";
|
---|
| 579 | usage += " hugefont hugeboldfont hugeitalicfont \n";
|
---|
| 580 | usage += ">> Marker: dotmarker<T> plusmarker<T> crossmarker<T> circlemarker <T> \n";
|
---|
| 581 | usage += " fcirclemarker<T> boxmarker<T> fboxmarker<T> trianglemarker<T> \n";
|
---|
| 582 | usage += " ftrianglemarker<T> starmarker<T> fstarmarker<T> \n";
|
---|
| 583 | usage += " with <T> = 1 3 5 7 9 , Example fboxmarker5 , plusmarker9 ... \n";
|
---|
| 584 | usage += ">> ColorTables: defcmap grey32 greyinv32 colrj32 colbr32 \n";
|
---|
| 585 | usage += " grey128 greyinv128 colrj128 colbr128 \n";
|
---|
| 586 | usage += ">> ZoomFactors: defzoom zoomx1 zoomx2 zoomx3 zoomx4 zoomx5 \n";
|
---|
| 587 | usage += " zoom/2 zoom/3 zoom/4 zoom/5 \n";
|
---|
| 588 | usage += ">> Axes: stdaxes=defaxes=boxaxes simpleaxes boxaxesgrid \n";
|
---|
| 589 | usage += " fineaxes grid=fineaxesgrid \n";
|
---|
[331] | 590 | usage += ">> XYLimits : xylimits -> Forces X-Y limits in 2-D plots \n";
|
---|
[293] | 591 | usage += ">> DisplayWindow: next same win stack \n";
|
---|
[331] | 592 | usage += " Related commands: setxylimits";
|
---|
[330] | 593 | mpiac->RegisterCommand(kw, usage, this, "Graphics");
|
---|
[293] | 594 |
|
---|
[331] | 595 | kw = "setxylimits";
|
---|
| 596 | usage = "Define 2-D plot limits \n Usage: setxylimits xmin xmax ymin ymax";
|
---|
| 597 | usage += "\n Related commands: gratt";
|
---|
| 598 | mpiac->RegisterCommand(kw, usage, this, "Graphics");
|
---|
| 599 |
|
---|
[293] | 600 | kw = "openfits";
|
---|
| 601 | usage = "Loads a FITS file into an Image<T> \n Usage: openfits filename";
|
---|
| 602 | usage += "\n Related commands: savefits openppf";
|
---|
[330] | 603 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[293] | 604 | kw = "savefits";
|
---|
| 605 | usage = "Save an object into a FITS file \n Usage: savefits nameobj filename";
|
---|
| 606 | usage += "\n Related commands: openfits saveall";
|
---|
[330] | 607 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[293] | 608 | kw = "openppf";
|
---|
| 609 | usage = "Reads all objects from a PPF file \n Usage: openppf filename";
|
---|
| 610 | usage += "\n Related commands: saveall openfits";
|
---|
[330] | 611 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[333] | 612 | kw = "saveobjs";
|
---|
| 613 | usage = "Saves objects with names matching a pattern (x?y*) into a PPF file \n";
|
---|
| 614 | usage += "Usage: saveall nameobjpattern filename";
|
---|
| 615 | usage += "\n Related commands: saveall openppf savefits";
|
---|
| 616 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[293] | 617 | kw = "saveall";
|
---|
| 618 | usage = "Saves all objects into a PPF file \n Usage: saveall filename";
|
---|
[333] | 619 | usage += "\n Related commands: saveobj openppf savefits";
|
---|
[330] | 620 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[293] | 621 |
|
---|
| 622 | kw = "print";
|
---|
| 623 | usage = "Prints an object \n Usage: print nameobj";
|
---|
[330] | 624 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[293] | 625 |
|
---|
[333] | 626 | kw = "mkdir";
|
---|
| 627 | usage = "Create a directory";
|
---|
| 628 | usage += "\n Usage: mkdir dirname";
|
---|
| 629 | mpiac->RegisterCommand(kw, usage, this, "Object Managment");
|
---|
| 630 | kw = "rmdir";
|
---|
| 631 | usage = "Removes an empty directory";
|
---|
| 632 | usage += "\n Usage: remove dirname";
|
---|
| 633 | mpiac->RegisterCommand(kw, usage, this, "Object Managment");
|
---|
| 634 | kw = "cd";
|
---|
| 635 | usage = "Change current directory";
|
---|
| 636 | usage += "\n Usage: cd [dirname]";
|
---|
| 637 | mpiac->RegisterCommand(kw, usage, this, "Object Managment");
|
---|
| 638 | kw = "pwd";
|
---|
| 639 | usage = "Prints current directory";
|
---|
| 640 | usage += "\n Usage: pwd";
|
---|
| 641 | mpiac->RegisterCommand(kw, usage, this, "Object Managment");
|
---|
| 642 | kw = "listdirs";
|
---|
| 643 | usage = "Prints the list of directories";
|
---|
| 644 | usage += "\n Usage: listdirs [patt=*] \n patt : * , ? ";
|
---|
| 645 | mpiac->RegisterCommand(kw, usage, this, "Object Managment");
|
---|
[295] | 646 | kw = "listobjs";
|
---|
[333] | 647 | usage = "Prints the list of objects (Alias: ls)";
|
---|
| 648 | usage += "\n Usage: listobjs [patt=*] \n patt : /*/x?y* ... ";
|
---|
[330] | 649 | mpiac->RegisterCommand(kw, usage, this, "Object Managment");
|
---|
[293] | 650 | kw = "rename";
|
---|
[333] | 651 | usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew";
|
---|
[293] | 652 | usage += "\n Related commands: del delobjs";
|
---|
[330] | 653 | mpiac->RegisterCommand(kw, usage, this, "Object Managment");
|
---|
[293] | 654 | kw = "del";
|
---|
[333] | 655 | usage = "Deletes an object (Alias: rm) \n Usage: del nameobj";
|
---|
[293] | 656 | usage += "\n Related commands: delobjs rename";
|
---|
[330] | 657 | mpiac->RegisterCommand(kw, usage, this, "Object Managment");
|
---|
[293] | 658 | kw = "delobjs";
|
---|
| 659 | usage = "Delete a set of objects with names matching a pattern (x?y*)";
|
---|
| 660 | usage += "\n Usage: delobjs nameobjpattern \n";
|
---|
| 661 | usage += "\n Related commands: del rename";
|
---|
[330] | 662 | mpiac->RegisterCommand(kw, usage, this, "Object Managment");
|
---|
[293] | 663 |
|
---|
| 664 | kw = "newh1d";
|
---|
| 665 | usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
|
---|
| 666 | usage += "\n Related commands: newh2d newprof newgfd ";
|
---|
[333] | 667 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[293] | 668 | kw = "newh2d";
|
---|
| 669 | usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
|
---|
| 670 | usage += "\n Related commands: newh1d newprof newgfd ";
|
---|
[333] | 671 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[293] | 672 | kw = "newprof";
|
---|
| 673 | usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
|
---|
| 674 | usage += "\n Related commands: newh1d newh2d newgfd ";
|
---|
[333] | 675 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[293] | 676 | kw = "newgfd";
|
---|
| 677 | usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
|
---|
| 678 | usage += "\n Related commands: newh1d newh2d newprof ";
|
---|
[333] | 679 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
| 680 | kw = "newvec";
|
---|
| 681 | usage = "Creates (and fills) a vector \n Usage: newvec name size [f(i) [dopt] ] ";
|
---|
| 682 | usage += "\n Related commands: newmtx";
|
---|
| 683 | mpiac->RegisterCommand(kw, usage, this, "Objets");
|
---|
| 684 | kw = "newmtx";
|
---|
| 685 | usage = "Creates (and fills) a matrix \n Usage: newvec name sizeX sizeY [f(i,j) [dopt] ] ";
|
---|
| 686 | usage += "\n Related commands: newvec";
|
---|
| 687 | mpiac->RegisterCommand(kw, usage, this, "Objets");
|
---|
[293] | 688 |
|
---|
| 689 | kw = "disp";
|
---|
| 690 | usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
|
---|
| 691 | usage += "\n Related commands: surf nt2d nt3d ";
|
---|
[330] | 692 | mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
|
---|
[295] | 693 | kw = "imag";
|
---|
| 694 | usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
|
---|
| 695 | usage += "\n Related commands: disp surf nt2d nt3d ";
|
---|
[330] | 696 | mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
|
---|
[293] | 697 | kw = "surf";
|
---|
| 698 | usage = "Displays an object as a 3D surface \n Usage: surf nameobj [graphic_attributes]";
|
---|
| 699 | usage += "\n Related commands: disp nt2d nt3d ";
|
---|
[330] | 700 | mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
|
---|
[293] | 701 | kw = "nt2d";
|
---|
| 702 | usage = "Displays Points (X-Y) [with error-bars] from an NTuple ";
|
---|
| 703 | usage += "\n Usage : nt2d nameobj varx vary [errx erry] [graphic_attributes]";
|
---|
[333] | 704 | usage += "\n Related commands: disp surf nt2dw nt3d gfd2d ";
|
---|
[330] | 705 | mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
|
---|
[333] | 706 | kw = "nt2dw";
|
---|
| 707 | usage = "Displays Points (X-Y) with weight [with error-bars] from an NTuple ";
|
---|
| 708 | usage += "\n Usage : nt2d nameobj varx vary varz [errx erry] [graphic_attributes]";
|
---|
| 709 | usage += "\n Related commands: disp surf nt2d nt3d gfd2d ";
|
---|
| 710 | mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
|
---|
[293] | 711 | kw = "nt3d";
|
---|
| 712 | usage = "Displays 3D-Points (X-Y-Z) [with error-bars] from an NTuple ";
|
---|
| 713 | usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz] [graphic_attributes]";
|
---|
[333] | 714 | usage += "\n Related commands: disp surf nt2d nt2dw gfd3d ";
|
---|
[339] | 715 | usage += "\n Related commands: disp surf nt2d nt2dw ";
|
---|
[330] | 716 | mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
|
---|
[339] | 717 |
|
---|
| 718 | // Ceci est maintenant obsolete, on garde pour info.
|
---|
[293] | 719 | kw = "gfd2d";
|
---|
| 720 | usage = "Displays Points (X-Y) with error-bars from a GeneralFit Data ";
|
---|
| 721 | usage += "\n Usage : gfd2d nameobj numvarx erreur=(x y xy) [graphic_attributes]";
|
---|
[339] | 722 | usage += "\n Related commands: gfd3d nt2d nt3d ";
|
---|
| 723 | usage += "\n ----- OBSOLETE: utilisez nt2d -----";
|
---|
[330] | 724 | mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
|
---|
[293] | 725 | kw = "gfd3d";
|
---|
| 726 | usage = "Displays 3D-Points (X-Y-Z) with error-bars from a GeneralFit Data ";
|
---|
| 727 | usage += "\n Usage : gfd3d nameobj numvarx numvary erreur=(x y z xy xz yz xyz) [graphic_attributes]";
|
---|
| 728 | usage += "\n Related commands: gfd2d nt2d nt3d ";
|
---|
[339] | 729 | usage += "\n ----- OBSOLETE: utilisez nt3d -----";
|
---|
[330] | 730 | mpiac->RegisterCommand(kw, usage, this, "Obj. Display");
|
---|
[293] | 731 |
|
---|
| 732 | kw = "func";
|
---|
| 733 | usage = "Displays a function y=f(x) (Fills a vector with function values)";
|
---|
| 734 | usage += "\n Usage: func f(x) xmin xmax npt [graphic_attributes]";
|
---|
[326] | 735 | usage += "\n Related commands: funcff func2d func2dff ";
|
---|
[330] | 736 | mpiac->RegisterCommand(kw, usage, this, "Func Plot");
|
---|
[326] | 737 | kw = "funcff";
|
---|
| 738 | usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
|
---|
| 739 | usage += "\n Usage: funcff C-FileName FunctionName xmin xmax npt [graphic_attributes]";
|
---|
| 740 | usage += "\n Related commands: func func2d func2dff ";
|
---|
[330] | 741 | mpiac->RegisterCommand(kw, usage, this, "Func Plot");
|
---|
[293] | 742 | kw = "func2d";
|
---|
| 743 | usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
|
---|
| 744 | usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
|
---|
| 745 | usage += "\n Related commands: func";
|
---|
[330] | 746 | mpiac->RegisterCommand(kw, usage, this, "Func Plot");
|
---|
[326] | 747 | kw = "func2dff";
|
---|
| 748 | usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
|
---|
| 749 | usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
|
---|
| 750 | usage += "\n Related commands: func funcff func2d ";
|
---|
[330] | 751 | mpiac->RegisterCommand(kw, usage, this, "Func Plot");
|
---|
[293] | 752 |
|
---|
| 753 | kw = "plot2d";
|
---|
| 754 | usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
|
---|
| 755 | usage += "\nNTuple varnames - Histo1D/HProf: i,x,val,err - Histo2D: i,j,x,y,val,err";
|
---|
| 756 | usage += "\nVector: i,val - Matrix: i,j,val - Image: x=i,y=j, pix=val";
|
---|
| 757 | usage += "\n Usage: plot2d nameobj f_X() g_Y() [ f_ErrX() f_ErrY() ] f_Cut() [graphic_attributes]";
|
---|
[333] | 758 | usage += "\n Related commands: plot2dw plot3d projh1d projh2d projprof fillnt fillvec fillgd1 ";
|
---|
[330] | 759 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[333] | 760 | kw = "plot2dw";
|
---|
| 761 | usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) ";
|
---|
| 762 | usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() Cut() [graphic_attributes]";
|
---|
| 763 | usage += "\n Related commands: plot2d projh1d projh2d projprof fillnt fillvec ";
|
---|
| 764 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 765 | kw = "plot3d";
|
---|
| 766 | usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs ";
|
---|
[333] | 767 | usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() Cut() [graphic_attributes]";
|
---|
| 768 | usage += "\n Related commands: plot2d plot2dw projh1d projh2d projprof fillnt fillvec ";
|
---|
[330] | 769 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 770 |
|
---|
| 771 | kw = "projh1d";
|
---|
| 772 | usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
|
---|
| 773 | usage += "\n Usage: projh1d nameobj f_X() h_WT() Cut() nameh1d [graphic_attributes]";
|
---|
| 774 | usage += "\n Histo1D nameh1d is created if necessary ";
|
---|
| 775 | usage += "\n Related commands: plot2d projh2d projprof fillnt fillvec ";
|
---|
[330] | 776 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 777 | kw = "projh2d";
|
---|
| 778 | usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
|
---|
| 779 | usage += "\n Usage: projh2d nameobj f_X() g_Y() h_WT() Cut() nameh2d [graphic_attributes]";
|
---|
| 780 | usage += "\n Histo2D nameh2d is created if necessary ";
|
---|
| 781 | usage += "\n Related commands: plot2d projh1d projprof ";
|
---|
[330] | 782 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 783 | kw = "projprof";
|
---|
| 784 | usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
|
---|
| 785 | usage += "\n Usage: projh2d nameobj f_X() g_Y() h_WT() Cut() nameprof [graphic_attributes]";
|
---|
| 786 | usage += "\n HProf nameprof is created if necessary ";
|
---|
| 787 | usage += "\n Related commands: plot2d projh2d ";
|
---|
[330] | 788 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 789 |
|
---|
| 790 | kw = "fillnt";
|
---|
| 791 | usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
|
---|
| 792 | usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() Cut() nameNt";
|
---|
[333] | 793 | usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof ";
|
---|
[330] | 794 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[333] | 795 | kw = "ntloop";
|
---|
| 796 | usage = "Loops over an Object NTupleInterface calling a function from a C-file \n";
|
---|
| 797 | usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
|
---|
| 798 | usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName]";
|
---|
| 799 | usage += "\n Related commands: ntexpcfile fillnt";
|
---|
| 800 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
| 801 | kw = "ntexpcfile";
|
---|
| 802 | usage = "Creates a C-File with declarations suitable to be used for ntloop";
|
---|
| 803 | usage += "\n Usage: ntexpcfile nameobj CFileName FuncName ";
|
---|
| 804 | usage += "\n Related commands: ntloop";
|
---|
| 805 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
| 806 |
|
---|
[293] | 807 | kw = "fillvec";
|
---|
| 808 | usage = "Creates and Fills a Vector with X=f(Object)";
|
---|
| 809 | usage += "\n Usage: fillvec nameobj f_X() Cut() nameVec [graphic_attributes]";
|
---|
| 810 | usage += "\n Related commands: plot2d projh1d fillnt ";
|
---|
[330] | 811 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 812 | kw = "fillgd1";
|
---|
| 813 | usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
|
---|
| 814 | usage += "\n Usage: fillgd1 nameobj f_X() g_Y() h_ErrY() Cut() nameGfd";
|
---|
| 815 | usage += "\n Related commands: plot2d fillnt ";
|
---|
[330] | 816 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 817 | kw = "fillgd2";
|
---|
| 818 | usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
|
---|
| 819 | usage += "\n Usage: fillgd1 nameobj f_X() g_Y() h_Z() k_ErrZ() Cut() nameGfd";
|
---|
| 820 | usage += "\n Related commands: plot2d fillgd2 ";
|
---|
[330] | 821 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 822 |
|
---|
| 823 | kw = "fit";
|
---|
| 824 | usage = "Fitting function to DataObjects (Histo, Histo2D, Vector, ...)";
|
---|
| 825 | usage += "\n Usage: fit nomobj func [Options]";
|
---|
| 826 | usage += "\n [p:p1,...,pn s:s1,...,sn m:m1,...,mn M:M1,...,Mn o:... o:...]";
|
---|
[330] | 827 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 828 |
|
---|
| 829 | }
|
---|
| 830 |
|
---|
| 831 | /* --Methode-- */
|
---|
| 832 | int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
|
---|
| 833 | // string& func4, string& func5)
|
---|
| 834 | {
|
---|
| 835 | string cmd;
|
---|
| 836 |
|
---|
| 837 | if (dynlink) delete dynlink; dynlink = NULL;
|
---|
| 838 | usfmap.clear();
|
---|
| 839 |
|
---|
| 840 | dynlink = new PDynLinkMgr(fnameso, true);
|
---|
| 841 | if (dynlink == NULL) {
|
---|
| 842 | string sn = fnameso;
|
---|
| 843 | cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
|
---|
| 844 | return(2);
|
---|
| 845 | }
|
---|
| 846 |
|
---|
| 847 | int nok=0;
|
---|
| 848 | // on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
|
---|
| 849 | // DlUserProcFunction f = NULL;
|
---|
| 850 | DlFunction f = NULL;
|
---|
| 851 | if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
|
---|
| 852 | // f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
|
---|
| 853 | f = dynlink->GetFunction(func1);
|
---|
| 854 | if (f) { nok++; usfmap[func1] = f; }
|
---|
| 855 | else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
|
---|
| 856 |
|
---|
| 857 | if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
|
---|
| 858 | // f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
|
---|
| 859 | f = dynlink->GetFunction(func2);
|
---|
| 860 | if (f) { nok++; usfmap[func2] = f; }
|
---|
| 861 | else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
|
---|
| 862 |
|
---|
| 863 | if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
|
---|
| 864 | // f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
|
---|
| 865 | f = dynlink->GetFunction(func3);
|
---|
| 866 | if (f) { nok++; usfmap[func3] = f; }
|
---|
| 867 | else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
|
---|
| 868 |
|
---|
| 869 | /* Pb compile g++ 2.7.2
|
---|
| 870 | if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
|
---|
| 871 | // f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
|
---|
| 872 | f = dynlink->GetFunction(func4);
|
---|
| 873 | if (f) { nok++; usfmap[func4] = f; }
|
---|
| 874 | else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
|
---|
| 875 |
|
---|
| 876 | if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
|
---|
| 877 | // f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
|
---|
| 878 | f = dynlink->GetFunction(func5);
|
---|
| 879 | if (f) { nok++; usfmap[func5] = f; }
|
---|
| 880 | else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
|
---|
| 881 | */
|
---|
| 882 | fin:
|
---|
| 883 | if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
|
---|
| 884 | else return(0);
|
---|
| 885 | }
|
---|
| 886 |
|
---|