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