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