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