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