[2615] | 1 | #include "sopnamsp.h"
|
---|
[293] | 2 | #include "piacmd.h"
|
---|
| 3 |
|
---|
| 4 | #include <stdio.h>
|
---|
| 5 | #include <stdlib.h>
|
---|
| 6 | #include <math.h>
|
---|
| 7 |
|
---|
| 8 | #include "basexecut.h"
|
---|
| 9 |
|
---|
| 10 | #include "pdlmgr.h"
|
---|
| 11 | #include "ctimer.h"
|
---|
[2263] | 12 | #include "strutilxx.h"
|
---|
[293] | 13 |
|
---|
| 14 | #include "pistdimgapp.h"
|
---|
| 15 | #include "nobjmgr.h"
|
---|
[326] | 16 | #include "servnobjm.h"
|
---|
[2305] | 17 | #include "nomgadapter.h"
|
---|
[293] | 18 |
|
---|
| 19 | #include "histos.h"
|
---|
| 20 | #include "histos2.h"
|
---|
| 21 | #include "hisprof.h"
|
---|
| 22 | #include "ntuple.h"
|
---|
| 23 | #include "generaldata.h"
|
---|
[2792] | 24 | #include "datatable.h"
|
---|
[769] | 25 |
|
---|
| 26 | #ifdef SANS_EVOLPLANCK
|
---|
[333] | 27 | #include "cvector.h"
|
---|
[769] | 28 | #else
|
---|
| 29 | #include "tvector.h"
|
---|
| 30 | #endif
|
---|
[293] | 31 |
|
---|
| 32 |
|
---|
| 33 | /* --Methode-- */
|
---|
| 34 | PIABaseExecutor::PIABaseExecutor(PIACmd* piac, NamedObjMgr* omg, PIStdImgApp* app)
|
---|
| 35 | {
|
---|
| 36 | mpiac = piac;
|
---|
| 37 | mObjMgr = omg;
|
---|
| 38 | mImgApp = app;
|
---|
[312] | 39 | dynlink = NULL;
|
---|
[1276] | 40 | dynlink2 = NULL;
|
---|
[293] | 41 | RegisterCommands();
|
---|
| 42 | }
|
---|
| 43 |
|
---|
| 44 | PIABaseExecutor::~PIABaseExecutor()
|
---|
| 45 | {
|
---|
[1276] | 46 | if (dynlink) delete dynlink;
|
---|
| 47 | if (dynlink2) delete dynlink2;
|
---|
[293] | 48 | }
|
---|
| 49 |
|
---|
| 50 |
|
---|
[2755] | 51 |
|
---|
[293] | 52 | /* --Methode-- */
|
---|
[1268] | 53 | int PIABaseExecutor::Execute(string& kw, vector<string>& tokens, string& toks)
|
---|
[293] | 54 | {
|
---|
[333] | 55 | Services2NObjMgr* srvo = mObjMgr->GetServiceObj();
|
---|
[293] | 56 | // >>>>> Chargement de modules
|
---|
[2307] | 57 | if (kw == "loadmodule") {
|
---|
[293] | 58 | if (tokens.size() < 2) { cout << "Usage: loadmodule fnameso modulename" << endl; return(0); }
|
---|
| 59 | mpiac->LoadModule(tokens[0], tokens[1]);
|
---|
| 60 | }
|
---|
[349] | 61 |
|
---|
[293] | 62 | // >>>>>>>>>>> Link dynamique de fonctions C++
|
---|
| 63 | else if (kw == "link" ) {
|
---|
| 64 | if (tokens.size() < 2) { cout << "Usage: link fnameso f1 [f2 f3]" << endl; return(0); }
|
---|
| 65 | string sph = "";
|
---|
| 66 | for(int gg=0; gg<5; gg++) tokens.push_back(sph);
|
---|
| 67 | int rc = LinkUserFuncs(tokens[0], tokens[1], tokens[2], tokens[3]);
|
---|
| 68 | if (rc == 0) cout << "PIABaseExecutor: Link from " << tokens[0] << " OK " << endl;
|
---|
| 69 | }
|
---|
[1276] | 70 | else if (kw == "linkff2" ) {
|
---|
| 71 | if (tokens.size() < 2) { cout << "Usage: linkff2 fnameso f1 [f2 f3]" << endl; return(0); }
|
---|
| 72 | string sph = "";
|
---|
| 73 | for(int gg=0; gg<5; gg++) tokens.push_back(sph);
|
---|
| 74 | int rc = LinkUserFuncs2(tokens[0], tokens[1], tokens[2], tokens[3]);
|
---|
| 75 | if (rc == 0) cout << "PIABaseExecutor: Link2 from " << tokens[0] << " OK " << endl;
|
---|
| 76 | }
|
---|
[293] | 77 | else if (kw == "call" ) {
|
---|
| 78 | if (tokens.size() < 1) { cout << "Usage: call userf [arg1 arg2 ...]" << endl; return(0); }
|
---|
[1276] | 79 | UsFmap::iterator it;
|
---|
| 80 | UsFmap::iterator it1 = usfmap.find(tokens[0]);
|
---|
| 81 | UsFmap::iterator it2 = usfmap2.find(tokens[0]);
|
---|
| 82 | if ((it1 == usfmap.end()) && (it2 == usfmap2.end()) ) {
|
---|
[293] | 83 | cerr << "PIABaseExecutor: No User Function " << tokens[0] << endl;
|
---|
| 84 | return(0);
|
---|
| 85 | }
|
---|
[1276] | 86 | if (it1 == usfmap.end()) it = it2;
|
---|
| 87 | else it = it1;
|
---|
[293] | 88 | cout << "PIABaseExecutor: Call " << tokens[0] << "( ... )" << endl;
|
---|
| 89 | // on est oblige de faire un cast etant donne qu'on
|
---|
| 90 | // utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
|
---|
| 91 | DlUserProcFunction fuf = (DlUserProcFunction)(*it).second;
|
---|
[2494] | 92 | /*DEL----- Plus besoin en multi-thread ? / Reza 06/01/2004
|
---|
[293] | 93 | // On redirige la sortie sur le terminal
|
---|
| 94 | bool red = mImgApp->HasRedirectedStdOutErr();
|
---|
| 95 | mImgApp->RedirectStdOutErr(false);
|
---|
[2494] | 96 | --------DEL */
|
---|
[1276] | 97 | #ifdef SANS_EVOLPLANCK
|
---|
[293] | 98 | TRY {
|
---|
| 99 | tokens.erase(tokens.begin());
|
---|
| 100 | fuf(tokens);
|
---|
| 101 | } CATCH(merr) {
|
---|
| 102 | fflush(stdout);
|
---|
[1276] | 103 | string es = PeidaExc(merr);
|
---|
| 104 | cerr << "\n PIABaseExecutor: Call UserFunc Exception :" << merr << es;
|
---|
[293] | 105 | cout << endl;
|
---|
| 106 | }
|
---|
[1276] | 107 | #else
|
---|
| 108 | try {
|
---|
| 109 | tokens.erase(tokens.begin());
|
---|
| 110 | fuf(tokens);
|
---|
[2944] | 111 | return(0);
|
---|
[1276] | 112 | }
|
---|
| 113 | catch ( PThrowable & exc ) {
|
---|
| 114 | cerr << "\n PIABaseExecutor: Call / Catched Exception :"
|
---|
| 115 | << (string)typeid(exc).name() << " Msg= "
|
---|
| 116 | << exc.Msg() << endl;
|
---|
[2944] | 117 | return(-77);
|
---|
[1276] | 118 | }
|
---|
| 119 | catch ( ... ) {
|
---|
| 120 | cerr << "\n PIABaseExecutor: Call / Catched Exception ... "
|
---|
| 121 | << endl;
|
---|
[2944] | 122 | return(-79);
|
---|
[1276] | 123 | }
|
---|
| 124 | #endif
|
---|
[2494] | 125 | /*DEL----- Plus besoin en multi-thread ? / Reza 06/01/2004
|
---|
[293] | 126 | mImgApp->RedirectStdOutErr(red);
|
---|
[2494] | 127 | --------DEL */
|
---|
[293] | 128 | }
|
---|
| 129 |
|
---|
| 130 | else if (kw == "openppf" ) {
|
---|
[3423] | 131 | if (tokens.size()<1) {
|
---|
| 132 | cout<<"Usage: openppf [-s] file [objname1 objname2 ...]"<<endl;
|
---|
| 133 | return(0);
|
---|
| 134 | }
|
---|
| 135 | else if (tokens.size()==1) // read all objects at nametags
|
---|
| 136 | mObjMgr->ReadAll(tokens[0],true);
|
---|
| 137 | else {
|
---|
| 138 | if (tokens[0] == "-s") // Read all objects sequentially
|
---|
| 139 | mObjMgr->ReadAll(tokens[1],false);
|
---|
| 140 | else mObjMgr->ReadObj(tokens); // read specified objects
|
---|
| 141 | }
|
---|
[293] | 142 | }
|
---|
[2132] | 143 | else if ((kw == "saveobjs") || (kw == "saveppf")) {
|
---|
[333] | 144 | if (tokens.size() < 2) { cout << "Usage: saveobjs patt filename " << endl; return(0); }
|
---|
| 145 | mObjMgr->SaveObjects(tokens[0], tokens[1]);
|
---|
| 146 | }
|
---|
[2669] | 147 | else if (kw == "savelist") {
|
---|
| 148 | if (tokens.size() < 2) {
|
---|
| 149 | cout << "Usage: savelist objname1 [objname2 ...] filename "<<endl;
|
---|
| 150 | return(0);
|
---|
| 151 | }
|
---|
| 152 | mObjMgr->SaveListObjects(tokens);
|
---|
| 153 | }
|
---|
[293] | 154 | else if (kw == "saveall" ) {
|
---|
| 155 | if (tokens.size() < 1) { cout << "Usage: saveall file " << endl; return(0); }
|
---|
| 156 | mObjMgr->SaveAll(tokens[0]);
|
---|
| 157 | }
|
---|
| 158 | else if (kw == "print" ) {
|
---|
[2975] | 159 | if (tokens.size() < 1) { cout << "Usage: print nameobj [prtlev]" << endl; return(0); }
|
---|
| 160 | int lev = 0;
|
---|
| 161 | if (tokens.size()>1) lev = atoi(tokens[1].c_str());
|
---|
| 162 | mObjMgr->PrintObj(tokens[0], lev);
|
---|
[293] | 163 | }
|
---|
[333] | 164 | else if ( (kw == "rename" ) || (kw == "mv") ) {
|
---|
[2132] | 165 | if (tokens.size() < 2) { cout << "Usage: rename/mv nameobj namenew" << endl; return(0); }
|
---|
[293] | 166 | mObjMgr->RenameObj(tokens[0], tokens[1]);
|
---|
| 167 | }
|
---|
[333] | 168 | else if ( (kw == "del" ) || (kw == "rm") ) {
|
---|
[1655] | 169 | if (tokens.size() < 1) { cout << "Usage: del nameobj [nameobj2 ...]" << endl; return(0); }
|
---|
| 170 | if (tokens.size()>0)
|
---|
| 171 | for(uint_4 i=0;i<tokens.size();i++) mObjMgr->DelObj(tokens[i]);
|
---|
[293] | 172 | }
|
---|
| 173 | else if (kw == "delobjs" ) {
|
---|
| 174 | if (tokens.size() < 1) { cout << "Usage: delobjs nomobjpattern (*,?) " << endl; return(0); }
|
---|
| 175 | mObjMgr->DelObjects(tokens[0]);
|
---|
| 176 | }
|
---|
[333] | 177 | else if ( (kw == "listobjs") || (kw == "ls") ) {
|
---|
[331] | 178 | if (tokens.size() < 1) tokens.push_back("*");
|
---|
[2519] | 179 | if (tokens.size() < 2) mObjMgr->ListObjs(tokens[0]);
|
---|
| 180 | else {
|
---|
| 181 | vector<string> olv;
|
---|
| 182 | mObjMgr->GetObjList(tokens[0], olv);
|
---|
| 183 | mpiac->SetVar(tokens[1], olv);
|
---|
| 184 | }
|
---|
[331] | 185 | }
|
---|
[2519] | 186 |
|
---|
[333] | 187 | // Gestion des repertoires
|
---|
| 188 | else if (kw == "mkdir" ) {
|
---|
[344] | 189 | if (tokens.size() < 1) { cout << "Usage: mkdir dirname [true]" << endl; return(0); }
|
---|
| 190 | bool crd = mObjMgr->CreateDir(tokens[0]);
|
---|
| 191 | if ( crd && (tokens.size() > 1) && (tokens[1] == "true") )
|
---|
| 192 | mObjMgr->SetKeepOldDirAtt(tokens[0], true);
|
---|
[333] | 193 | }
|
---|
| 194 | else if (kw == "rmdir" ) {
|
---|
| 195 | if (tokens.size() < 1) { cout << "Usage: rmdir dirname " << endl; return(0); }
|
---|
| 196 | mObjMgr->DeleteDir(tokens[0]);
|
---|
| 197 | }
|
---|
[2132] | 198 | else if (kw == "setdiratt" ) {
|
---|
| 199 | if (tokens.size() < 2) { cout << "Usage: setdiratt dirname true/false" << endl; return(0); }
|
---|
| 200 | if (tokens[1] == "true") mObjMgr->SetKeepOldDirAtt(tokens[0], true);
|
---|
| 201 | else mObjMgr->SetKeepOldDirAtt(tokens[0], false);
|
---|
| 202 | }
|
---|
[333] | 203 | else if (kw == "cd") {
|
---|
| 204 | if (tokens.size() < 1) tokens.push_back("home");
|
---|
| 205 | mObjMgr->SetCurrentDir(tokens[0]);
|
---|
| 206 | }
|
---|
[345] | 207 | else if (kw == "pwd") {
|
---|
| 208 | string dirn;
|
---|
| 209 | mObjMgr->GetCurrentDir(dirn);
|
---|
| 210 | cout << "CurrentDirectory: " << dirn << endl;
|
---|
| 211 | }
|
---|
[333] | 212 | else if (kw == "listdirs") {
|
---|
| 213 | if (tokens.size() < 1) tokens.push_back("*");
|
---|
| 214 | mObjMgr->ListDirs(tokens[0]);
|
---|
| 215 | }
|
---|
[293] | 216 |
|
---|
| 217 | // >>>>>>>>>>> Creation d'histos 1D-2D
|
---|
| 218 | else if (kw == "newh1d") {
|
---|
| 219 | if (tokens.size() < 4) { cout << "Usage: newh1d name xmin xmax nbin" << endl; return(0); }
|
---|
[1091] | 220 | int_4 nbx = 100;
|
---|
| 221 | r_8 xmin = 0., xmax = 1.;
|
---|
[293] | 222 | nbx = atoi(tokens[3].c_str());
|
---|
| 223 | xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
|
---|
| 224 | Histo* h = new Histo(xmin, xmax, nbx);
|
---|
| 225 | mObjMgr->AddObj(h, tokens[0]);
|
---|
| 226 | }
|
---|
| 227 | else if (kw == "newh2d") {
|
---|
| 228 | if (tokens.size() < 7) {
|
---|
| 229 | cout << "Usage: newh2d name xmin xmax nbinx ymin ymax nbiny" << endl;
|
---|
| 230 | return(0);
|
---|
| 231 | }
|
---|
[1091] | 232 | int_4 nbx = 50, nby = 50;
|
---|
| 233 | r_8 xmin = 0., xmax = 1.;
|
---|
| 234 | r_8 ymin = 0., ymax = 1.;
|
---|
[293] | 235 | nbx = atoi(tokens[3].c_str());
|
---|
| 236 | nby = atoi(tokens[6].c_str());
|
---|
| 237 | xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
|
---|
| 238 | ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
|
---|
| 239 | Histo2D* h = new Histo2D(xmin, xmax, nbx, ymin, ymax, nby);
|
---|
| 240 | mObjMgr->AddObj(h, tokens[0]);
|
---|
| 241 | }
|
---|
[1035] | 242 | else if (kw == "newprof" || kw == "newprofe") {
|
---|
[293] | 243 | if (tokens.size() < 4)
|
---|
[1035] | 244 | { cout << "Usage: newprof[e] name xmin xmax nbin [ymin ymax]" << endl; return(0); }
|
---|
[1091] | 245 | int_4 nbx = 100;
|
---|
| 246 | r_8 xmin = 0., xmax = 1., ymin = 1., ymax = -1.;
|
---|
[293] | 247 | if(tokens.size() > 5)
|
---|
| 248 | {ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());}
|
---|
| 249 | nbx = atoi(tokens[3].c_str());
|
---|
| 250 | xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
|
---|
| 251 | HProf* h = new HProf(xmin, xmax, nbx, ymin, ymax);
|
---|
[1035] | 252 | if(kw == "newprofe") h->SetErrOpt(false);
|
---|
[293] | 253 | mObjMgr->AddObj(h, tokens[0]);
|
---|
| 254 | }
|
---|
[447] | 255 |
|
---|
| 256 | // Creation de NTuple
|
---|
| 257 | else if (kw == "newnt") {
|
---|
| 258 | if(tokens.size() < 2)
|
---|
| 259 | {cout<<"Usage: newnt name v1 v2 ... vn / newnt name nvar"<<endl; return(0);}
|
---|
| 260 | vector<string> varname;
|
---|
| 261 | int nvar = 0;
|
---|
| 262 | const char *c = tokens[1].c_str();
|
---|
| 263 | if(isdigit(c[0])) {
|
---|
| 264 | nvar = atoi(tokens[1].c_str());
|
---|
| 265 | if(nvar<=0 || nvar>=10000)
|
---|
| 266 | {cout<<"newnt name nvar : nvar must be an positive integer<10000"<<endl;
|
---|
| 267 | return(0);}
|
---|
| 268 | for(int i=0;i<nvar;i++) {
|
---|
| 269 | char str[16]; sprintf(str,"%d",i);
|
---|
| 270 | string dum = "v"; dum += str;
|
---|
| 271 | varname.push_back(dum.c_str());
|
---|
| 272 | }
|
---|
| 273 | } else if( islower(c[0]) || isupper(c[0]) ) {
|
---|
[1548] | 274 | for(int i=1;i<(int)tokens.size();i++) {
|
---|
[447] | 275 | varname.push_back(tokens[i].c_str());
|
---|
| 276 | nvar++;
|
---|
| 277 | }
|
---|
| 278 | } else {
|
---|
| 279 | cout<<"newnt name v1 v2 ... vn : name vi must begin by a letter"<<endl
|
---|
| 280 | <<"newnt name nvar : nvar must be an positive integer"<<endl;
|
---|
| 281 | return(0);
|
---|
| 282 | }
|
---|
| 283 | char **noms = new char*[nvar];
|
---|
| 284 | for(int i=0;i<nvar;i++) noms[i] = (char *)varname[i].c_str();
|
---|
| 285 | NTuple* nt = new NTuple(nvar,noms);
|
---|
| 286 | delete [] noms;
|
---|
| 287 | mObjMgr->AddObj(nt,tokens[0]);
|
---|
| 288 | }
|
---|
| 289 |
|
---|
[2792] | 290 | // Creation de DataTable
|
---|
| 291 | else if (kw == "newdt") {
|
---|
| 292 | if(tokens.size() < 2)
|
---|
| 293 | {cout<<"Usage: newdt name v1:t1 v2:t2 ... vn:tn / newdt name nvar"<<endl; return(0);}
|
---|
| 294 | DataTable* dt = new DataTable();
|
---|
| 295 | const char *c = tokens[1].c_str();
|
---|
| 296 | if(isdigit(c[0])) {
|
---|
| 297 | int n = atoi(tokens[1].c_str());
|
---|
| 298 | if(n<=0 || n>=10000) {
|
---|
| 299 | cout<<"newdt name nvar : nvar="<<n<<" must be an positive integer<10000"<<endl;
|
---|
| 300 | delete dt; return(0);
|
---|
| 301 | }
|
---|
| 302 | for(int i=0;i<n;i++) {
|
---|
| 303 | char str[16]; sprintf(str,"v%d",i);
|
---|
| 304 | dt->AddDoubleColumn(str);
|
---|
| 305 | }
|
---|
| 306 | } else {
|
---|
| 307 | for(int i=1;i<tokens.size();i++) {
|
---|
| 308 | string vname = tokens[i];
|
---|
| 309 | uint_4 p = tokens[i].find(':');
|
---|
| 310 | if(p<tokens[i].size()) vname = vname.substr(0,p);
|
---|
| 311 | if(vname.size()<1) {
|
---|
| 312 | cout<<"Zero size name for variable: tokens["<<i<<"]="<<tokens[i]<<endl;
|
---|
| 313 | delete dt; return(0);
|
---|
| 314 | }
|
---|
| 315 | if (tokens[i].find(":r4")<tokens[i].size()) dt->AddFloatColumn(vname);
|
---|
| 316 | else if(tokens[i].find(":r8")<tokens[i].size()) dt->AddDoubleColumn(vname);
|
---|
| 317 | else if(tokens[i].find(":i4")<tokens[i].size()) dt->AddIntegerColumn(vname);
|
---|
| 318 | else if(tokens[i].find(":i8")<tokens[i].size()) dt->AddLongColumn(vname);
|
---|
| 319 | else if(tokens[i].find(":s") <tokens[i].size()) dt->AddStringColumn(vname);
|
---|
| 320 | else dt->AddDoubleColumn(vname);
|
---|
| 321 | }
|
---|
| 322 | }
|
---|
| 323 | mObjMgr->AddObj(dt,tokens[0]);
|
---|
| 324 | }
|
---|
| 325 |
|
---|
[447] | 326 | // Creation de GeneralFitData
|
---|
[293] | 327 | else if (kw == "newgfd") {
|
---|
| 328 | if (tokens.size() < 3)
|
---|
| 329 | { cout << "Usage: newgfd nvar nalloc [errx(0/1)]" << endl; return(0); }
|
---|
| 330 | int nvar, nalloc, errx=0;
|
---|
| 331 | if (tokens.size() > 3)
|
---|
| 332 | { errx = atoi(tokens[3].c_str()); if(errx>0) errx=1; else errx = 0;}
|
---|
| 333 | nvar = atoi(tokens[1].c_str()); nalloc = atoi(tokens[2].c_str());
|
---|
| 334 | if(nvar>0 && nalloc>0) {
|
---|
| 335 | GeneralFitData* gfd = new GeneralFitData(nvar,nalloc,errx);
|
---|
| 336 | mObjMgr->AddObj(gfd, tokens[0]);
|
---|
| 337 | }
|
---|
| 338 | }
|
---|
| 339 |
|
---|
[333] | 340 | // Creation/remplissage de vecteur et de matrice
|
---|
| 341 | else if (kw == "newvec") {
|
---|
| 342 | if (tokens.size() < 2) {
|
---|
| 343 | cout << "Usage: newvec name size [f(i) dopt] " << endl; return(0);
|
---|
| 344 | }
|
---|
| 345 | int n = atoi(tokens[1].c_str());
|
---|
| 346 | double xmin, xmax;
|
---|
| 347 | xmin = 0.; xmax = n;
|
---|
[357] | 348 | if (tokens.size() < 3) {
|
---|
| 349 | Vector* v = new Vector(n);
|
---|
| 350 | mObjMgr->AddObj(v, tokens[0]);
|
---|
| 351 | }
|
---|
| 352 | else {
|
---|
| 353 | if (tokens.size() < 4) tokens.push_back("");
|
---|
| 354 | mObjMgr->GetServiceObj()->PlotFunc(tokens[2], tokens[0], xmin, xmax, n, tokens[3]);
|
---|
| 355 | }
|
---|
[333] | 356 | }
|
---|
| 357 | else if (kw == "newmtx") {
|
---|
| 358 | if (tokens.size() < 3) {
|
---|
[1917] | 359 | cout << "Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) dopt] " << endl; return(0);
|
---|
[333] | 360 | }
|
---|
| 361 | int nx = atoi(tokens[1].c_str());
|
---|
| 362 | int ny = atoi(tokens[2].c_str());
|
---|
| 363 | double xmin, xmax, ymin, ymax;
|
---|
| 364 | xmin = 0.; xmax = nx;
|
---|
| 365 | ymin = 0.; ymax = ny;
|
---|
[357] | 366 | if (tokens.size() < 4) {
|
---|
| 367 | Matrix* mtx = new Matrix(ny,nx);
|
---|
| 368 | mObjMgr->AddObj(mtx, tokens[0]);
|
---|
| 369 | }
|
---|
| 370 | else {
|
---|
[1971] | 371 | if (tokens.size() < 5) tokens.push_back("next");
|
---|
[357] | 372 | mObjMgr->GetServiceObj()->PlotFunc2D(tokens[3], tokens[0], xmin, xmax, ymin, ymax,
|
---|
| 373 | nx, ny, tokens[4]);
|
---|
| 374 | }
|
---|
[333] | 375 | }
|
---|
[2305] | 376 | // ----- Vecteur/NTuple <> Lignes/variables interpreteur
|
---|
| 377 | // Creation de vecteur depuis le contenu de la ligne
|
---|
| 378 | else if (kw == "line2vec") {
|
---|
| 379 | if (tokens.size() < 2) {
|
---|
| 380 | cout << "Usage: line2vec vecname v0 v1 v2 ... " << endl; return(0);
|
---|
| 381 | }
|
---|
| 382 | int vsz = tokens.size()-1;
|
---|
| 383 | Vector* v = new Vector(vsz);
|
---|
| 384 | for(int kkv=0; kkv<vsz; kkv++) (*v)(kkv) = atof(tokens[kkv+1].c_str());
|
---|
| 385 | mObjMgr->AddObj(v, tokens[0]);
|
---|
| 386 | }
|
---|
| 387 | // Remplissage de NTuple depuis la ligne
|
---|
| 388 | else if (kw == "line2nt") {
|
---|
| 389 | if (tokens.size() < 2) {
|
---|
| 390 | cout << "Usage: line2nt ntname col0 col1 ..." << endl; return(0);
|
---|
| 391 | }
|
---|
| 392 | AnyDataObj* obj;
|
---|
| 393 | obj = mObjMgr->GetObj(tokens[0]);
|
---|
| 394 | if(obj == NULL) {
|
---|
| 395 | cerr << "line2nt Error , No such object " << tokens[0] << endl;
|
---|
| 396 | return(0);
|
---|
| 397 | }
|
---|
| 398 | NTuple* nt = dynamic_cast<NTuple *>(obj);
|
---|
| 399 | if(nt == NULL) {
|
---|
| 400 | cerr << "line2nt Error " << tokens[0] << " not an NTuple ! " << endl;
|
---|
| 401 | return(0);
|
---|
| 402 | }
|
---|
| 403 | if (nt->NbColumns() < 1) {
|
---|
| 404 | cerr << "line2nt Error: NbColumns < 1" << endl;
|
---|
| 405 | return(0);
|
---|
| 406 | }
|
---|
| 407 | r_4* xnt = new r_4[ nt->NbColumns() ];
|
---|
| 408 | int kkx;
|
---|
| 409 | for(kkx=0; kkx<nt->NbColumns(); kkx++) {
|
---|
| 410 | if (kkx < tokens.size()-1) xnt[kkx] = atof(tokens[kkx+1].c_str());
|
---|
| 411 | else xnt[kkx] = 0.;
|
---|
| 412 | }
|
---|
| 413 | nt->Fill(xnt);
|
---|
| 414 | delete[] xnt;
|
---|
| 415 | }
|
---|
| 416 | // Contenu du vecteur vers variable interpreteur
|
---|
| 417 | #define MAXNWORDSO2V 32768
|
---|
| 418 | else if (kw == "vec2var") {
|
---|
| 419 | if (tokens.size() < 2) {
|
---|
| 420 | cout << "Usage: vec2var vecname varname [loop_param start:end:step] " << endl; return(0);
|
---|
| 421 | }
|
---|
| 422 | AnyDataObj* obj;
|
---|
| 423 | obj = mObjMgr->GetObj(tokens[0]);
|
---|
| 424 | if(obj == NULL) {
|
---|
| 425 | cerr << "vec2var Error , No such object " << tokens[0] << endl;
|
---|
| 426 | return(0);
|
---|
| 427 | }
|
---|
| 428 | Vector* v = dynamic_cast<Vector *>(obj);
|
---|
| 429 | if(v == NULL) {
|
---|
| 430 | cerr << "vec2var Error " << tokens[0] << " not a Vector ! " << endl;
|
---|
| 431 | return(0);
|
---|
| 432 | }
|
---|
[2419] | 433 | int_8 kks = 0;
|
---|
| 434 | int_8 kke = v->NElts();
|
---|
| 435 | int_8 kkp = 1;
|
---|
[2305] | 436 | if (tokens.size() > 2) Services2NObjMgr::DecodeLoopParameters(tokens[2], kks, kke, kkp);
|
---|
| 437 | if (kks < 0) kks = 0;
|
---|
[2419] | 438 | if (kke > (int_8)v->NElts()) kke = v->NElts();
|
---|
[2305] | 439 | if (kkp < 1) kkp = 1;
|
---|
| 440 | int nelt = (kke-kks-1)/kkp;
|
---|
| 441 | if (nelt > MAXNWORDSO2V) {
|
---|
| 442 | nelt = MAXNWORDSO2V;
|
---|
| 443 | cout << "vec2var Warning: Only " << nelt
|
---|
| 444 | << " elements will be converted to string" << endl;
|
---|
| 445 | kke = kks+nelt*kkp;
|
---|
| 446 | }
|
---|
| 447 | string v2str;
|
---|
| 448 | char buff[64];
|
---|
| 449 | for(int kkv=kks; kkv<kke; kkv+=kkp) {
|
---|
| 450 | sprintf(buff, "%lg ", (*v)(kkv));
|
---|
| 451 | v2str += buff;
|
---|
| 452 | }
|
---|
| 453 |
|
---|
[2999] | 454 | mpiac->SetVar(tokens[1], v2str);
|
---|
[2305] | 455 | }
|
---|
| 456 | // Une ligne du NTuple/NTupleInterface -> variable interpreteur
|
---|
| 457 | else if ((kw == "ntline2var") || (kw == "ntcol2var")) {
|
---|
| 458 | if (tokens.size() < 3) {
|
---|
| 459 | cout << "Usage: ntline/col2var objname line_number varname" << endl;
|
---|
| 460 | return(0);
|
---|
| 461 | }
|
---|
| 462 | NObjMgrAdapter* oa = mObjMgr->GetObjAdapter(tokens[0]);
|
---|
| 463 | if(oa == NULL) {
|
---|
| 464 | cerr << "ntline/col2var Error , No such object " << tokens[0] << endl;
|
---|
| 465 | return(0);
|
---|
| 466 | }
|
---|
| 467 | bool adel = false;
|
---|
| 468 | NTupleInterface* nti = oa->GetNTupleInterface(adel);
|
---|
| 469 | if(nti == NULL) {
|
---|
| 470 | cerr << "ntline/col2var Error: objet" << tokens[0] << " has no NTupleInterface" << endl;
|
---|
| 471 | return(0);
|
---|
| 472 | }
|
---|
[333] | 473 |
|
---|
[2305] | 474 | if (nti->NbColumns() < 1 || nti->NbLines() < 1) {
|
---|
| 475 | cerr << "ntline/col2var Error: NbColumns or NbLines < 1" << endl;
|
---|
| 476 | return(0);
|
---|
| 477 | }
|
---|
| 478 | string v2str;
|
---|
| 479 | char buff[64];
|
---|
| 480 | if (kw == "ntline2var") {
|
---|
| 481 | int numline = atoi(tokens[1].c_str());
|
---|
| 482 | if ( (numline >= nti->NbLines()) || (numline < 0) ) {
|
---|
| 483 | cerr << "ntline2var Error: numline" << tokens[1] << " out of bounds" << endl;
|
---|
| 484 | return(0);
|
---|
| 485 | }
|
---|
| 486 | r_8* dline = nti->GetLineD(numline);
|
---|
| 487 | for(int kkv=0; kkv<nti->NbColumns(); kkv++) {
|
---|
| 488 | sprintf(buff, "%lg ", dline[kkv]);
|
---|
| 489 | v2str += buff;
|
---|
| 490 | }
|
---|
| 491 | }
|
---|
| 492 | else {
|
---|
| 493 | int numcol = atoi(tokens[1].c_str());
|
---|
| 494 | if ( (numcol >= nti->NbColumns()) || (numcol < 0) ) {
|
---|
| 495 | cerr << "ntcol2var Error: numcol" << tokens[1] << " out of bounds" << endl;
|
---|
| 496 | return(0);
|
---|
| 497 | }
|
---|
[2419] | 498 | int_8 kks = 0;
|
---|
| 499 | int_8 kke = nti->NbLines();
|
---|
| 500 | int_8 kkp = 1;
|
---|
[2305] | 501 | if (tokens.size() > 3) Services2NObjMgr::DecodeLoopParameters(tokens[3], kks, kke, kkp);
|
---|
| 502 | if (kks < 0) kks = 0;
|
---|
[2419] | 503 | if (kke > (int_8)nti->NbLines()) kke = nti->NbLines();
|
---|
[2305] | 504 | if (kkp < 1) kkp = 1;
|
---|
| 505 | int nelt = (kke-kks-1)/kkp;
|
---|
| 506 | if (nelt > MAXNWORDSO2V) {
|
---|
| 507 | nelt = MAXNWORDSO2V;
|
---|
| 508 | cout << "ntcol2var Warning: Only " << nelt
|
---|
| 509 | << " lines " << " will be converted to string" << endl;
|
---|
| 510 | kke = kks+nelt*kkp;
|
---|
| 511 | }
|
---|
| 512 | r_8* dline;
|
---|
| 513 | for(int kkl=kks; kkl<kke; kkl+=kkp) {
|
---|
| 514 | dline = nti->GetLineD(kkl);
|
---|
| 515 | sprintf(buff, "%lg ", dline[numcol]);
|
---|
| 516 | v2str += buff;
|
---|
| 517 | }
|
---|
| 518 | }
|
---|
[2999] | 519 | mpiac->SetVar(tokens[2], v2str);
|
---|
[2305] | 520 | if (adel) delete nti;
|
---|
| 521 | }
|
---|
[2999] | 522 | // Operation sur objets a travers l'adaptateur NObjMgrAdapter::PerformOperation()
|
---|
| 523 | else if (kw == "objaoper") {
|
---|
| 524 | if (tokens.size() < 2) {
|
---|
| 525 | cout << "Usage: objaoper objname operation [args ...]" << endl;
|
---|
| 526 | return(0);
|
---|
| 527 | }
|
---|
| 528 | NObjMgrAdapter* oa = mObjMgr->GetObjAdapter(tokens[0]);
|
---|
| 529 | if(oa == NULL) {
|
---|
| 530 | cerr << "objaoper Error , No such object " << tokens[0] << endl;
|
---|
| 531 | return(0);
|
---|
| 532 | }
|
---|
| 533 | tokens.erase(tokens.begin());
|
---|
| 534 | return oa->PerformOperation(tokens);
|
---|
| 535 | }
|
---|
[2305] | 536 |
|
---|
| 537 | // -------------------------------------------------------
|
---|
[455] | 538 | // Copie d'objets
|
---|
[2176] | 539 | else if ( (kw == "copy") || (kw == "cp") ) {
|
---|
[455] | 540 | if(tokens.size()<2) {
|
---|
| 541 | cout<<"Usage: copy name_from name_to"<<endl;return(0);
|
---|
| 542 | }
|
---|
[463] | 543 | mObjMgr->CopyObj(tokens[0],tokens[1]);
|
---|
[455] | 544 | }
|
---|
| 545 |
|
---|
| 546 |
|
---|
[293] | 547 | // >>>>>>>>>>> Trace de fonctions
|
---|
| 548 | else if ( (kw == "func") ) {
|
---|
[1938] | 549 | if(tokens.size()<3) {cout<<"Usage: func f(x) xmin xmax [npt opt]"<<endl; return(0);}
|
---|
| 550 | int np = 100;
|
---|
| 551 | double xmin=0., xmax=1.;
|
---|
| 552 | string opt = "", nom = "";
|
---|
| 553 | xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
|
---|
| 554 | if (tokens.size() > 3) np = atoi(tokens[3].c_str());
|
---|
[293] | 555 | if (tokens.size() > 4) opt = tokens[4];
|
---|
[333] | 556 | mObjMgr->GetServiceObj()->PlotFunc(tokens[0], nom, xmin, xmax, np, opt);
|
---|
[293] | 557 | }
|
---|
[326] | 558 | else if ( (kw == "funcff") ) {
|
---|
[1938] | 559 | if (tokens.size()<4) {cout<<"Usage: funcff C-filename f(x)-name xmin xmax [npt opt]"<<endl; return(0);}
|
---|
| 560 | int np = 100;
|
---|
| 561 | double xmin=0., xmax=1.;
|
---|
| 562 | string opt = "", nom = "";
|
---|
| 563 | xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
|
---|
| 564 | if(tokens.size()>4) np = atoi(tokens[4].c_str());
|
---|
| 565 | if(tokens.size()>5) opt = tokens[5];
|
---|
[333] | 566 | mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], nom, xmin, xmax, np, opt);
|
---|
[326] | 567 | }
|
---|
[293] | 568 | else if ( (kw == "func2d") ) {
|
---|
| 569 | if (tokens.size() < 7) {
|
---|
[357] | 570 | cout << "Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [opt]" << endl;
|
---|
[293] | 571 | return(0);
|
---|
| 572 | }
|
---|
| 573 | int npx, npy;
|
---|
[333] | 574 | double xmin, xmax;
|
---|
| 575 | double ymin, ymax;
|
---|
[293] | 576 | npx = npy = 50;
|
---|
| 577 | xmin = 0.; xmax = 1.;
|
---|
| 578 | ymin = 0.; ymax = 1.;
|
---|
| 579 | npx = atoi(tokens[3].c_str());
|
---|
| 580 | npy = atoi(tokens[6].c_str());
|
---|
| 581 | xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str());
|
---|
| 582 | ymin = atof(tokens[4].c_str()); ymax = atof(tokens[5].c_str());
|
---|
[357] | 583 | string opt = "";
|
---|
[293] | 584 | if (tokens.size() > 7) opt = tokens[7];
|
---|
[333] | 585 | string nom = "";
|
---|
| 586 | mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
|
---|
[293] | 587 | }
|
---|
[326] | 588 | else if ( (kw == "func2dff") ) {
|
---|
| 589 | if (tokens.size() < 8) {
|
---|
[357] | 590 | cout << "Usage: func2d C-filename F(x,y)-name xmax nptx ymin ymax npty [opt]" << endl;
|
---|
[326] | 591 | return(0);
|
---|
| 592 | }
|
---|
| 593 | int npx, npy;
|
---|
[333] | 594 | double xmin, xmax;
|
---|
| 595 | double ymin, ymax;
|
---|
[326] | 596 | npx = npy = 50;
|
---|
| 597 | xmin = 0.; xmax = 1.;
|
---|
| 598 | ymin = 0.; ymax = 1.;
|
---|
| 599 | npx = atoi(tokens[4].c_str());
|
---|
| 600 | npy = atoi(tokens[7].c_str());
|
---|
| 601 | xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str());
|
---|
| 602 | ymin = atof(tokens[5].c_str()); ymax = atof(tokens[6].c_str());
|
---|
[357] | 603 | string opt = "";
|
---|
[326] | 604 | if (tokens.size() > 8) opt = tokens[8];
|
---|
[333] | 605 | string nom = "";
|
---|
| 606 | mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], nom, xmin, xmax, ymin, ymax, npx, npy, opt);
|
---|
[326] | 607 | }
|
---|
[293] | 608 |
|
---|
| 609 | // >>>>>>>>>>> Trace d'expressions de N_Tuple, StarList, etc ...
|
---|
| 610 | else if (kw == "plot2d" ) {
|
---|
[357] | 611 | if (tokens.size() < 3) {
|
---|
| 612 | cout << "Usage: plot2d nameobj expx expy [expcut opt loop_par]" << endl;
|
---|
[293] | 613 | return(0);
|
---|
| 614 | }
|
---|
[357] | 615 | string errx = ""; string erry = "";
|
---|
| 616 | if (tokens.size() < 4) tokens.push_back("1");
|
---|
| 617 | while (tokens.size() < 6) tokens.push_back("");
|
---|
| 618 | srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,tokens[3],tokens[4],tokens[5]);
|
---|
| 619 | }
|
---|
| 620 |
|
---|
| 621 | else if (kw == "plot2de" ) { // Plot2D avec les erreurs
|
---|
| 622 | if (tokens.size() < 5) {
|
---|
| 623 | cout << "Usage: plot2de nameobj expx expy experrx experry [expcut opt loop_par]" << endl;
|
---|
| 624 | return(0);
|
---|
[293] | 625 | }
|
---|
[357] | 626 | if (tokens.size() < 6) tokens.push_back("1");
|
---|
| 627 | while (tokens.size() < 8) tokens.push_back("");
|
---|
| 628 | srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4],
|
---|
| 629 | tokens[5],tokens[6],tokens[7]);
|
---|
[293] | 630 | }
|
---|
| 631 |
|
---|
[3279] | 632 | else if ((kw == "plot2dw")||(kw == "plot2dc")) { // Plot2d avec poids
|
---|
[357] | 633 | if (tokens.size() < 4) {
|
---|
[3279] | 634 | cout << "Usage: plot2dw/c nomobj expx expy expwt/expcolidx [expcut opt loop_par]" << endl;
|
---|
[333] | 635 | return(0);
|
---|
| 636 | }
|
---|
[357] | 637 | if (tokens.size() < 5) tokens.push_back("1");
|
---|
| 638 | while (tokens.size() < 7) tokens.push_back("");
|
---|
[3279] | 639 | bool fgcolidx = false;
|
---|
| 640 | if (kw == "plot2dc") fgcolidx = true;
|
---|
| 641 | srvo->DisplayPoints2DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4],
|
---|
| 642 | fgcolidx, tokens[5], tokens[6]);
|
---|
[333] | 643 | }
|
---|
[357] | 644 | else if (kw == "plot3d" ) {
|
---|
| 645 | if (tokens.size() < 4) {
|
---|
| 646 | cout << "Usage: plot3d nomobj expx expy expz [expcut opt loop_par]" << endl;
|
---|
[293] | 647 | return(0);
|
---|
| 648 | }
|
---|
[357] | 649 | if (tokens.size() < 5) tokens.push_back("1");
|
---|
| 650 | while (tokens.size() < 7) tokens.push_back("");
|
---|
| 651 | srvo->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6]);
|
---|
[293] | 652 | }
|
---|
[2999] | 653 | else if (kw == "plot3dw" ) {
|
---|
| 654 | if (tokens.size() < 5) {
|
---|
| 655 | cout << "Usage: plot3dw nomobj expx expy expz expwt [expcut opt loop_par]" << endl;
|
---|
| 656 | return(0);
|
---|
| 657 | }
|
---|
| 658 | if (tokens.size() < 6) tokens.push_back("1");
|
---|
| 659 | while (tokens.size() < 8) tokens.push_back("");
|
---|
| 660 | srvo->DisplayPoints3DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], tokens[5],
|
---|
| 661 | tokens[6], tokens[7]);
|
---|
| 662 | }
|
---|
[293] | 663 |
|
---|
| 664 | else if (kw == "projh1d" ) {
|
---|
[357] | 665 | if (tokens.size() < 3) {
|
---|
| 666 | cout << "Usage: projh1d nomh1 nomobj expx [expwt expcut opt loop_par]" << endl;
|
---|
[293] | 667 | return(0);
|
---|
| 668 | }
|
---|
[357] | 669 | if (tokens.size() < 4) tokens.push_back("1.");
|
---|
| 670 | if (tokens.size() < 5) tokens.push_back("1");
|
---|
| 671 | while (tokens.size() < 7) tokens.push_back("");
|
---|
| 672 | srvo->ProjectH1(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
|
---|
[293] | 673 | }
|
---|
| 674 |
|
---|
[357] | 675 |
|
---|
| 676 | // Projection dans histogrammes
|
---|
[293] | 677 | else if (kw == "projh2d" ) {
|
---|
[357] | 678 | if (tokens.size() < 4) {
|
---|
| 679 | cout << "Usage: projh2d nomh2 nomobj expx expy [expwt expcut opt loop_par]" << endl;
|
---|
[293] | 680 | return(0);
|
---|
| 681 | }
|
---|
[357] | 682 | if (tokens.size() < 5) tokens.push_back("1.");
|
---|
| 683 | if (tokens.size() < 6) tokens.push_back("1");
|
---|
| 684 | while (tokens.size() < 8) tokens.push_back("");
|
---|
| 685 | srvo->ProjectH2(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
|
---|
| 686 | tokens[6], tokens[7] );
|
---|
[293] | 687 | }
|
---|
| 688 |
|
---|
| 689 | else if (kw == "projprof" ) {
|
---|
[357] | 690 | if (tokens.size() < 4) {
|
---|
| 691 | cout << "Usage: projprof nomprof nomobj expx expy [expwt expcut opt loop_par]" << endl;
|
---|
[293] | 692 | return(0);
|
---|
| 693 | }
|
---|
[357] | 694 | if (tokens.size() < 5) tokens.push_back("1.");
|
---|
| 695 | if (tokens.size() < 6) tokens.push_back("1");
|
---|
| 696 | while (tokens.size() < 8) tokens.push_back("");
|
---|
| 697 | srvo->ProjectHProf(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
|
---|
[1091] | 698 | tokens[6], tokens[7] );
|
---|
[357] | 699 | }
|
---|
[293] | 700 |
|
---|
[357] | 701 | // Projection dans vector/matrix
|
---|
| 702 | else if (kw == "fillvec" ) {
|
---|
| 703 | if (tokens.size() < 4) {
|
---|
| 704 | cout << "Usage: fillvec nomvec nomobj expx expv [expcut opt loop_par]" << endl;
|
---|
| 705 | return(0);
|
---|
| 706 | }
|
---|
| 707 | if (tokens.size() < 5) tokens.push_back("1");
|
---|
| 708 | while (tokens.size() < 7) tokens.push_back("");
|
---|
| 709 | srvo->FillVect(tokens[1], tokens[2], tokens[3], tokens[4], tokens[0], tokens[5], tokens[6] );
|
---|
[293] | 710 | }
|
---|
| 711 |
|
---|
[357] | 712 | else if (kw == "fillmtx" ) {
|
---|
| 713 | if (tokens.size() < 5) {
|
---|
| 714 | cout << "Usage: fillmtx nommtx nomobj expx expy expv [expcut opt loop_par]" << endl;
|
---|
| 715 | return(0);
|
---|
| 716 | }
|
---|
| 717 | if (tokens.size() < 6) tokens.push_back("1");
|
---|
| 718 | while (tokens.size() < 8) tokens.push_back("");
|
---|
| 719 | srvo->FillMatx(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5], tokens[0],
|
---|
| 720 | tokens[6], tokens[7] );
|
---|
| 721 | }
|
---|
| 722 |
|
---|
| 723 | // Remplissage NTuple,Vecteurs, ... , boucle de NTuple
|
---|
[447] | 724 | else if (kw == "ntfrascii" ) {
|
---|
| 725 | if(tokens.size() < 2) {
|
---|
| 726 | cout<<"Usage: ntfrascii nt_name file_name [def_init_val]"<<endl;
|
---|
| 727 | return(0);
|
---|
| 728 | }
|
---|
| 729 | double def_val = 0.;
|
---|
| 730 | if(tokens.size()>=3) def_val = atof(tokens[2].c_str());
|
---|
| 731 | srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val);
|
---|
| 732 | }
|
---|
| 733 |
|
---|
[2263] | 734 | #ifndef SANS_EVOLPLANCK
|
---|
| 735 | /* Lecture matrice/vecteur depuis fichier ASCII */
|
---|
| 736 | else if ((kw == "mtxfrascii") || (kw == "vecfrascii") ) {
|
---|
| 737 | if(tokens.size() < 2) {
|
---|
[2289] | 738 | cout<<"Usage: mtxfrascii/vecfrascii mtx/vec_name file_name [CommLine Separator]"<<endl;
|
---|
[2263] | 739 | return(0);
|
---|
| 740 | }
|
---|
| 741 | TMatrix<r_8> mtx;
|
---|
| 742 | TVector<r_8> vec;
|
---|
| 743 | FILE* fip = fopen(tokens[1].c_str(), "r");
|
---|
| 744 | if (fip == NULL) {
|
---|
| 745 | cout << "vec/mtxfrascii: can not open file " << tokens[1] << endl;
|
---|
| 746 | return(0);
|
---|
| 747 | }
|
---|
| 748 | fclose(fip);
|
---|
| 749 | ifstream is(tokens[1].c_str());
|
---|
| 750 | sa_size_t nr, nc;
|
---|
[2289] | 751 | char clm = '#';
|
---|
| 752 | string sep = " \t";
|
---|
| 753 | if (tokens.size()>2) clm = tokens[2][0];
|
---|
| 754 | if (tokens.size()>3) sep = tokens[3];
|
---|
[2263] | 755 | if (kw == "mtxfrascii") {
|
---|
[2289] | 756 | mtx.ReadASCII(is, nr, nc, clm, sep.c_str());
|
---|
[2263] | 757 | mObjMgr->AddObj(mtx, tokens[0]);
|
---|
| 758 | cout << "mtxfrascii: TMatrix<r_8> " << tokens[0] << " read from file "
|
---|
| 759 | << tokens[1] << endl;
|
---|
| 760 | }
|
---|
| 761 | else {
|
---|
[2289] | 762 | vec.ReadASCII(is, nr, nc, clm, sep.c_str());
|
---|
[2263] | 763 | mObjMgr->AddObj(vec, tokens[0]);
|
---|
| 764 | cout << "vecfrascii: TVector<r_8> " << tokens[0] << " read from file "
|
---|
| 765 | << tokens[1] << endl;
|
---|
| 766 | }
|
---|
| 767 | }
|
---|
[2268] | 768 | else if (kw == "arrtoascii") {
|
---|
| 769 | if(tokens.size() < 2) {
|
---|
| 770 | cout<<"Usage: arrtoascii array_name file_name "<<endl;
|
---|
| 771 | return(0);
|
---|
| 772 | }
|
---|
| 773 |
|
---|
| 774 | AnyDataObj* obj;
|
---|
| 775 | obj = mObjMgr->GetObj(tokens[0]);
|
---|
| 776 | if(obj == NULL) {
|
---|
| 777 | cerr << "arrtoascii Error , No such object " << tokens[0] << endl;
|
---|
| 778 | return(0);
|
---|
| 779 | }
|
---|
| 780 | BaseArray* ba = dynamic_cast<BaseArray *>(obj);
|
---|
| 781 | if(ba == NULL) {
|
---|
| 782 | cerr << "arrtoascii Error " << tokens[0] << " not a BaseArray ! " << endl;
|
---|
| 783 | return(0);
|
---|
| 784 | }
|
---|
| 785 | ofstream os(tokens[1].c_str());
|
---|
| 786 | ba->WriteASCII(os);
|
---|
| 787 | cout << "arrtoascii: Array " << tokens[0] << " written to file " << tokens[1] << endl;
|
---|
| 788 | }
|
---|
| 789 |
|
---|
[2263] | 790 | #endif
|
---|
| 791 |
|
---|
[293] | 792 | else if (kw == "fillnt" ) {
|
---|
[357] | 793 | if (tokens.size() < 5) {
|
---|
| 794 | cout << "Usage: fillnt nameobj expx expy expz expt [expcut ntname loop_par]" << endl;
|
---|
[293] | 795 | return(0);
|
---|
| 796 | }
|
---|
[357] | 797 | while (tokens.size() < 8) tokens.push_back("");
|
---|
| 798 | srvo->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], tokens[7] );
|
---|
[293] | 799 | }
|
---|
| 800 |
|
---|
[333] | 801 | else if (kw == "ntloop" ) {
|
---|
| 802 | if (tokens.size() < 3) {
|
---|
[357] | 803 | cout << "Usage: ntloop nameobj fname funcname [ntname loop_par ]" << endl;
|
---|
[333] | 804 | return(0);
|
---|
| 805 | }
|
---|
[357] | 806 | while (tokens.size() < 5) tokens.push_back("");
|
---|
| 807 | srvo->FillNTFrCFile(tokens[0],tokens[1], tokens[2], tokens[3], tokens[4]);
|
---|
[333] | 808 | }
|
---|
| 809 |
|
---|
| 810 | else if (kw == "ntexpcfile" ) {
|
---|
| 811 | if (tokens.size() < 3) {
|
---|
| 812 | cout << "Usage: ntexpcfile nameobj fname funcname" << endl;
|
---|
| 813 | return(0);
|
---|
| 814 | }
|
---|
| 815 | srvo->PrepareNTExpressionCFile(tokens[0],tokens[1], tokens[2]);
|
---|
| 816 | }
|
---|
| 817 |
|
---|
[2922] | 818 | else if (kw == "expmeansig" ) {
|
---|
| 819 | if (tokens.size() < 2) {
|
---|
| 820 | cout << "Usage: expmeansig nameobj expx [expcut loop_par]" << endl;
|
---|
| 821 | return(0);
|
---|
| 822 | }
|
---|
| 823 | while (tokens.size() < 4) tokens.push_back("");
|
---|
| 824 | string dummy = "";
|
---|
| 825 | cout << " expmeansig: computing mean/sigma + min/max for " << tokens[0]
|
---|
| 826 | << "." << tokens[1] << endl;
|
---|
| 827 | srvo->ExpressionToVector(tokens[0],tokens[1],tokens[2],dummy,dummy,tokens[3]);
|
---|
| 828 | }
|
---|
| 829 |
|
---|
[357] | 830 | else if (kw == "exptovec" ) {
|
---|
| 831 | if (tokens.size() < 3) {
|
---|
| 832 | cout << "Usage: exptovec nomvec nameobj expx [expcut opt loop_par]" << endl;
|
---|
[293] | 833 | return(0);
|
---|
| 834 | }
|
---|
[357] | 835 | while (tokens.size() < 6) tokens.push_back("");
|
---|
| 836 | srvo->ExpressionToVector(tokens[1],tokens[2],tokens[3],tokens[0],tokens[4],tokens[5]);
|
---|
[293] | 837 | }
|
---|
| 838 |
|
---|
| 839 | else if (kw == "fillgd1" ) {
|
---|
| 840 | if (tokens.size() < 5) {
|
---|
[357] | 841 | cout << "Usage: fillgd1 nomgfd nomobj expx expy experry [expcut loop_par] " << endl;
|
---|
[293] | 842 | return(0);
|
---|
| 843 | }
|
---|
[357] | 844 | if (tokens.size() < 6) tokens.push_back("1");
|
---|
| 845 | if (tokens.size() < 7) tokens.push_back("");
|
---|
[293] | 846 | string expy = "";
|
---|
[357] | 847 | srvo->FillGFD(tokens[1],tokens[2], expy, tokens[3], tokens[4], tokens[5], tokens[0]);
|
---|
[293] | 848 | }
|
---|
| 849 |
|
---|
| 850 | else if (kw == "fillgd2" ) {
|
---|
| 851 | if (tokens.size() < 6) {
|
---|
[357] | 852 | cout << "Usage: fillgd2 nomgfd nomobj expx expy expz experrz [expcut loop_par]" << endl;
|
---|
[293] | 853 | return(0);
|
---|
| 854 | }
|
---|
[357] | 855 | if (tokens.size() < 7) tokens.push_back("1");
|
---|
| 856 | if (tokens.size() < 8) tokens.push_back("");
|
---|
| 857 | srvo->FillGFD(tokens[1],tokens[2],tokens[3], tokens[4], tokens[5], tokens[6], tokens[0], tokens[7]);
|
---|
[293] | 858 | }
|
---|
| 859 |
|
---|
[1067] | 860 | else if (kw == "gdfrvec" ) {
|
---|
| 861 | if(tokens.size()<3) {
|
---|
| 862 | cout<<"Usage: gdfrvec namegfd X Y\n"
|
---|
| 863 | <<" gdfrvec namegfd X Y"
|
---|
| 864 | <<" gdfrvec namegfd X Y ! EY\n"
|
---|
| 865 | <<" gdfrvec namegfd X Y Z\n"
|
---|
| 866 | <<" gdfrvec namegfd X Y Z EZ"<<endl;
|
---|
| 867 | return(0);
|
---|
| 868 | }
|
---|
| 869 | while(tokens.size()<5) tokens.push_back("!");
|
---|
| 870 | srvo->FillGFDfrVec(tokens[0],tokens[1],tokens[2],tokens[3],tokens[4]);
|
---|
| 871 | }
|
---|
[293] | 872 |
|
---|
[2180] | 873 | // >>>>>>>>>>> Calcul d'expression arithmetique
|
---|
| 874 | else if ( (kw == "eval") ) {
|
---|
| 875 | if(tokens.size()<2)
|
---|
| 876 | {cout<<"Usage: eval resultvarname arithmetic expression...."<<endl; return(0);}
|
---|
| 877 | string expval = "";
|
---|
| 878 | for(unsigned int i=1;i<tokens.size();i++) expval+=tokens[i];
|
---|
| 879 | string resultvarname = "";
|
---|
| 880 | if(isalpha(tokens[0][0])) resultvarname=tokens[0];
|
---|
| 881 | mObjMgr->GetServiceObj()->ExpVal(expval,resultvarname);
|
---|
| 882 | }
|
---|
[293] | 883 |
|
---|
| 884 | else {
|
---|
| 885 | cerr << "PIABaseExecutor::Do() Erreur - Commande " << kw << " inconuue ! " << endl;
|
---|
| 886 | return(-1);
|
---|
| 887 | }
|
---|
| 888 |
|
---|
| 889 | return(0);
|
---|
| 890 | }
|
---|
| 891 |
|
---|
[2755] | 892 | /* --Methode-- */
|
---|
| 893 | bool PIABaseExecutor::IsThreadable(string const & keyw)
|
---|
| 894 | {
|
---|
| 895 | if ( (keyw == "fillvec") || (keyw == "fillmtx") ||
|
---|
| 896 | (keyw == "fillnt") || (keyw == "ntloop") ) return true;
|
---|
| 897 | else if (keyw.substr(0,4) == "func") return true;
|
---|
| 898 | else {
|
---|
| 899 | string skw = keyw.substr(0,5);
|
---|
| 900 | if ( (skw == "plot2") || (skw == "plot3") || (skw == "projh") ) return true;
|
---|
| 901 | }
|
---|
| 902 | return false;
|
---|
| 903 | }
|
---|
| 904 |
|
---|
[388] | 905 |
|
---|
[293] | 906 | /* --Methode-- */
|
---|
| 907 | void PIABaseExecutor::RegisterCommands()
|
---|
| 908 | {
|
---|
[2419] | 909 | string kw, usage, grp;
|
---|
[2781] | 910 | //--------- Commandes du groupe modules externes
|
---|
[2465] | 911 | grp = "External Modules";
|
---|
| 912 | string gdesc = "Dynamic load (shared object modules) management command group";
|
---|
| 913 | mpiac->AddHelpGroup(grp, gdesc);
|
---|
[293] | 914 | kw = "loadmodule";
|
---|
| 915 | usage = "To load and initialize modules \n Usage: loadmodule fnameso modulename";
|
---|
| 916 | usage += "\n Related commands: link";
|
---|
[2465] | 917 | mpiac->RegisterCommand(kw, usage, this, grp);
|
---|
[293] | 918 | kw = "link";
|
---|
| 919 | usage = "Dynamic linking of compiled user functions \n Usage: link fnameso f1 [f2 f3]";
|
---|
| 920 | usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
|
---|
[1276] | 921 | usage += "\n Related commands: call loadmodule linkff2";
|
---|
[2465] | 922 | mpiac->RegisterCommand(kw, usage, this, grp);
|
---|
[1276] | 923 | kw = "linkff2";
|
---|
| 924 | usage = "Dynamic linking of compiled user functions (Set 2)\n Usage: linkff2 fnameso f1 [f2 f3]";
|
---|
| 925 | usage += "\n fnameso: Shared-object file name, f1,f2,f3 : User function names ";
|
---|
| 926 | usage += "\n Related commands: call link loadmodule";
|
---|
[2465] | 927 | mpiac->RegisterCommand(kw, usage, this, grp);
|
---|
[293] | 928 | kw = "call";
|
---|
| 929 | usage = "Dynamically linked user function call \n Usage: call userf [arg1 arg2 ...]";
|
---|
| 930 | usage += "\n User function : f(vector<string>& args)";
|
---|
| 931 | usage += "\n Related commands: link";
|
---|
[2465] | 932 | mpiac->RegisterCommand(kw, usage, this, grp);
|
---|
[293] | 933 |
|
---|
| 934 | kw = "openppf";
|
---|
[3423] | 935 | usage = "Reads all or some objects from a PPF file";
|
---|
| 936 | usage += "\n Usage: (1) openppf filename ";
|
---|
| 937 | usage += "\n Or (2) openppf -s filename (2)";
|
---|
| 938 | usage += "\n Or (3) openppf filename objname1 [ objname2 ...]";
|
---|
| 939 | usage += "\n The first form reads all objects at NameTags,";
|
---|
| 940 | usage += "\n or all objects if the file has no NameTags.";
|
---|
| 941 | usage += "\n The third reads only the objects with the specified nametags";
|
---|
| 942 | usage += "\n Related commands: saveppf saveall savelist";
|
---|
[330] | 943 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[2132] | 944 | kw = "saveppf";
|
---|
| 945 | usage = "Saves objects with names matching a pattern into a\n";
|
---|
| 946 | usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
|
---|
| 947 | usage += "Usage: saveppf nameobjpattern filename";
|
---|
[2933] | 948 | usage += "\n Related commands: saveobjs savelist saveall openppf";
|
---|
[2132] | 949 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[333] | 950 | kw = "saveobjs";
|
---|
[2132] | 951 | usage = "Saves objects with names matching a pattern into a\n";
|
---|
| 952 | usage += " PPF file (pattern: x?y*) - Alias saveppf\n";
|
---|
[1068] | 953 | usage += "Usage: saveobjs nameobjpattern filename";
|
---|
[2933] | 954 | usage += "\n Related commands: saveppf savelist saveall openppf ";
|
---|
[333] | 955 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[293] | 956 | kw = "saveall";
|
---|
| 957 | usage = "Saves all objects into a PPF file \n Usage: saveall filename";
|
---|
[2933] | 958 | usage += "\n Related commands: saveobj savelist openppf";
|
---|
[2669] | 959 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
| 960 | kw = "savelist";
|
---|
| 961 | usage = "Saves a list of objects into a PPF file";
|
---|
| 962 | usage = "\n Usage: savelist objname1 [objname2 ...] filename";
|
---|
[2933] | 963 | usage += "\n Related commands: saveobj openppf";
|
---|
[330] | 964 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[449] | 965 | kw = "ntfrascii";
|
---|
[2792] | 966 | usage = "Fills an existing NTuple or DataTable from ASCII table file";
|
---|
[449] | 967 | usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]";
|
---|
| 968 | usage += "\n Related commands: ntloop fillnt ";
|
---|
| 969 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[2263] | 970 | #ifndef SANS_EVOLPLANCK
|
---|
| 971 | kw = "mtxfrascii";
|
---|
| 972 | usage = "Reads a matrix from an ASCII file (TMatrix<r_8>)";
|
---|
[2289] | 973 | usage += "\n Usage: mtxfrascii mtx_name file_name [CommChar Separator]";
|
---|
[2268] | 974 | usage += "\n Related commands: arrtoascii vecfrascii ntfrascii ";
|
---|
[2263] | 975 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
| 976 | kw = "vecfrascii";
|
---|
[2268] | 977 | usage = "Reads a vector from an ASCII file (TVector<r_8>)";
|
---|
[2263] | 978 | usage += "\n Usage: vecfrascii vec_name file_name";
|
---|
[2289] | 979 | usage += "\n Related commands: arrtoascii mtxfrascii ntfrascii [CommChar Separator]";
|
---|
[2263] | 980 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[2268] | 981 | kw = "arrtoascii";
|
---|
| 982 | usage = "Writes an array (TArray<T>) to an ASCII file ";
|
---|
| 983 | usage += "\n Usage: arrtoascii array_name file_name";
|
---|
| 984 | usage += "\n Related commands: mtxfrascii vecfrascii ntfrascii ";
|
---|
| 985 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[2263] | 986 | #endif
|
---|
[293] | 987 |
|
---|
| 988 | kw = "print";
|
---|
[2975] | 989 | usage = "Prints an object \n Usage: print nameobj [prtlev]";
|
---|
| 990 | usage += "\n prtlev = 0,1,2... default: prtlev=0";
|
---|
[330] | 991 | mpiac->RegisterCommand(kw, usage, this, "FileIO");
|
---|
[293] | 992 |
|
---|
[2781] | 993 | //------- Commandes gestion de repertoires et d'objets
|
---|
[333] | 994 | kw = "mkdir";
|
---|
| 995 | usage = "Create a directory";
|
---|
[344] | 996 | usage += "\n Usage: mkdir dirname [true]";
|
---|
| 997 | usage += "\n if second argument==true, the directory's KeepOld attribute is set to true";
|
---|
[463] | 998 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[333] | 999 | kw = "rmdir";
|
---|
| 1000 | usage = "Removes an empty directory";
|
---|
| 1001 | usage += "\n Usage: remove dirname";
|
---|
[463] | 1002 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[2132] | 1003 | kw = "setdiratt";
|
---|
| 1004 | usage = "Sets directory attributes";
|
---|
| 1005 | usage += "\n Usage: setdiratt dirname KeepOldFlag(=true/false)";
|
---|
| 1006 | usage += "\n KeepOldFlag=true Object with the same name is moved to old";
|
---|
| 1007 | usage += "\n when adding objects";
|
---|
| 1008 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[333] | 1009 | kw = "cd";
|
---|
| 1010 | usage = "Change current directory";
|
---|
| 1011 | usage += "\n Usage: cd [dirname]";
|
---|
[463] | 1012 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[333] | 1013 | kw = "pwd";
|
---|
| 1014 | usage = "Prints current directory";
|
---|
| 1015 | usage += "\n Usage: pwd";
|
---|
[463] | 1016 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[333] | 1017 | kw = "listdirs";
|
---|
| 1018 | usage = "Prints the list of directories";
|
---|
| 1019 | usage += "\n Usage: listdirs [patt=*] \n patt : * , ? ";
|
---|
[463] | 1020 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[295] | 1021 | kw = "listobjs";
|
---|
[333] | 1022 | usage = "Prints the list of objects (Alias: ls)";
|
---|
[3423] | 1023 | usage += "\n Usage: listobjs [patt=*] ";
|
---|
| 1024 | usage += "\n Or listobjs patt VarName ";
|
---|
[3428] | 1025 | usage += "\n Obj. name pattern patt in the form abc?x* or /*/x?y ... ";
|
---|
[463] | 1026 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[3428] | 1027 | kw = "ls";
|
---|
| 1028 | usage = " Alias for listobjs ";
|
---|
| 1029 | usage += "\n Usage: ls [patt=*] [VarName]";
|
---|
| 1030 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[293] | 1031 | kw = "rename";
|
---|
[333] | 1032 | usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew";
|
---|
[2132] | 1033 | usage += "\n Related commands: mv del delobjs";
|
---|
[463] | 1034 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[2132] | 1035 | kw = "mv";
|
---|
| 1036 | usage = "Rename an object (Alias: rename) \n Usage: mv nameobj namenew";
|
---|
| 1037 | usage += "\n Related commands: rename del delobjs";
|
---|
| 1038 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[463] | 1039 | kw = "copy";
|
---|
[2132] | 1040 | usage = "Copy objects (Alias cp) \n";
|
---|
[463] | 1041 | usage +=" Usage: copy name_from name_to";
|
---|
[2132] | 1042 | usage += "\n Related commands: cp new...";
|
---|
[2176] | 1043 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[2132] | 1044 | kw = "cp";
|
---|
| 1045 | usage = "Copy objects (Alias copy) \n";
|
---|
| 1046 | usage +=" Usage: cp name_from name_to";
|
---|
| 1047 | usage += "\n Related commands: copy new...";
|
---|
[463] | 1048 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[293] | 1049 | kw = "del";
|
---|
[1655] | 1050 | usage = "Deletes an object (Alias: rm) \n Usage: del nameobj [nameobj2 ...]";
|
---|
[2132] | 1051 | usage += "\n Related commands: rm delobjs rename";
|
---|
[463] | 1052 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[2132] | 1053 | kw = "rm";
|
---|
| 1054 | usage = "Deletes an object (Alias: del) \n Usage: rm nameobj [nameobj2 ...]";
|
---|
| 1055 | usage += "\n Related commands: del delobjs rename";
|
---|
| 1056 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[293] | 1057 | kw = "delobjs";
|
---|
| 1058 | usage = "Delete a set of objects with names matching a pattern (x?y*)";
|
---|
| 1059 | usage += "\n Usage: delobjs nameobjpattern \n";
|
---|
| 1060 | usage += "\n Related commands: del rename";
|
---|
[463] | 1061 | mpiac->RegisterCommand(kw, usage, this, "Object Management");
|
---|
[293] | 1062 |
|
---|
[2781] | 1063 | //------- Commandes creation/manipulation d'objets
|
---|
[293] | 1064 | kw = "newh1d";
|
---|
| 1065 | usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
|
---|
[2792] | 1066 | usage += "\n Related commands: newh2d newprof[e] newdt newnt newgfd ";
|
---|
[333] | 1067 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[293] | 1068 | kw = "newh2d";
|
---|
| 1069 | usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
|
---|
[2792] | 1070 | usage += "\n Related commands: newh1d newprof[e] newdt newnt newgfd ";
|
---|
[333] | 1071 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[293] | 1072 | kw = "newprof";
|
---|
| 1073 | usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
|
---|
[1035] | 1074 | usage += "\n Errors represent the data spread in the X bin ";
|
---|
[2792] | 1075 | usage += "\n Related commands: newh1d newh2d newprofe newdt newnt newgfd ";
|
---|
[333] | 1076 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[1035] | 1077 | kw = "newprofe";
|
---|
| 1078 | usage = "Creates a profile histogramm \n Usage: newprofe name xmin xmax nbin [ymin ymax]";
|
---|
| 1079 | usage += "\n Errors represent the error on the data mean in the X bin ";
|
---|
[2792] | 1080 | usage += "\n Related commands: newh1d newh2d newprof newdt newnt newgfd ";
|
---|
[1035] | 1081 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[447] | 1082 | kw = "newnt";
|
---|
| 1083 | usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn";
|
---|
| 1084 | usage += "\n newnt name nvar";
|
---|
[2792] | 1085 | usage += "\n Related commands: newdt newh1d newh2d newprof[e] newgfd ";
|
---|
[447] | 1086 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[2792] | 1087 | kw = "newdt";
|
---|
| 1088 | usage = "Creates a datatable \n Usage: newdt name v1:t1 v2:t2 v3:t3 .. vn:tn";
|
---|
| 1089 | usage += "\n newdt name nvar";
|
---|
| 1090 | usage += "\n vi : variable name";
|
---|
| 1091 | usage += "\n ti : variable type";
|
---|
| 1092 | usage += "\n r8,r4 for 8 and 4 bytes float";
|
---|
| 1093 | usage += "\n i8,i4 for 8 and 4 bytes signed integer";
|
---|
| 1094 | usage += "\n s for string";
|
---|
| 1095 | usage += "\n Related commands: newnt newh1d newh2d newprof[e] newgfd";
|
---|
| 1096 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[293] | 1097 | kw = "newgfd";
|
---|
| 1098 | usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
|
---|
[2792] | 1099 | usage += "\n Related commands: newh1d newh2d newprof[e] newdt newnt ";
|
---|
[333] | 1100 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
| 1101 | kw = "newvec";
|
---|
[357] | 1102 | usage = "Creates (and optionaly fills) a vector \n Usage: newvec name size [f(i) [dopt] ] ";
|
---|
[2305] | 1103 | usage += "\n Related commands: newmtx line2vec";
|
---|
[357] | 1104 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[333] | 1105 | kw = "newmtx";
|
---|
[357] | 1106 | usage = "Creates (and optionaly fills) a matrix \n";
|
---|
[1917] | 1107 | usage +=" Usage: newmtx name sizeX(Col) sizeY(Lines) [f(i,j) [dopt] ] ";
|
---|
[333] | 1108 | usage += "\n Related commands: newvec";
|
---|
[357] | 1109 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[2305] | 1110 | kw = "line2vec";
|
---|
| 1111 | usage = "Creates a vector from the line \n";
|
---|
| 1112 | usage += " Usage: line2vec vecname v0 v1 v2 ... \n";
|
---|
| 1113 | usage += " Related commands: newvec line2nt";
|
---|
| 1114 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
| 1115 | kw = "line2nt";
|
---|
| 1116 | usage = "Fills (append) an NTuple from the line content \n";
|
---|
| 1117 | usage += " Usage: line2nt ntname col0 col1 ... \n";
|
---|
| 1118 | usage += " Related commands: newnt line2vec ntline2var ntcol2var";
|
---|
| 1119 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
| 1120 | kw = "vec2var";
|
---|
| 1121 | usage = "Vector content to an interpreter variable varname = 'v0 v1 v2 ...' \n";
|
---|
| 1122 | usage += " Usage: line2vec vecname varname [LoopParam start:end[:step] ]\n";
|
---|
| 1123 | usage += " Related commands: line2vec ntline2var";
|
---|
| 1124 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
| 1125 | kw = "ntline2var";
|
---|
| 1126 | usage = "Object NTupleInterface line to an interpreter variable \n";
|
---|
| 1127 | usage += " Usage: ntline2var objname line_number varname \n";
|
---|
| 1128 | usage += " Related commands: vec2var ntcol2var";
|
---|
| 1129 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
| 1130 | kw = "ntcol2var";
|
---|
| 1131 | usage = "Object NTupleInterface column to an interpreter variable \n";
|
---|
| 1132 | usage += " Usage: ntline2var objname column_number varname [LoopParam start:end[:step] ] \n";
|
---|
| 1133 | usage += " Related commands: vec2var ntline2var";
|
---|
| 1134 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[2999] | 1135 | kw = "objaoper";
|
---|
| 1136 | usage = "Perform an operation through the object adapter NObjMgrAdapter::PerformOperation()\n";
|
---|
| 1137 | usage += " Usage: objaoper objname operation [arg1 ...] \n";
|
---|
| 1138 | usage += " Examples of defined operations : \n";
|
---|
| 1139 | usage += " Matrices: row indx_row , col indx_col \n";
|
---|
| 1140 | usage += " Arrays: slicexy indx_Z , slicexz indx_Y, sliceyz indxX \n";
|
---|
| 1141 | mpiac->RegisterCommand(kw, usage, this, "Objects");
|
---|
[293] | 1142 |
|
---|
[2781] | 1143 | //------- Commandes trace de fonctions
|
---|
[293] | 1144 | kw = "func";
|
---|
| 1145 | usage = "Displays a function y=f(x) (Fills a vector with function values)";
|
---|
[1938] | 1146 | usage += "\n Usage: func f(x) xmin xmax [npt graphic_attributes]";
|
---|
[326] | 1147 | usage += "\n Related commands: funcff func2d func2dff ";
|
---|
[330] | 1148 | mpiac->RegisterCommand(kw, usage, this, "Func Plot");
|
---|
[326] | 1149 | kw = "funcff";
|
---|
| 1150 | usage = "Displays a function y=f(x) from a C-file (Fills a vector with function values)";
|
---|
[1938] | 1151 | usage += "\n Usage: funcff C-FileName FunctionName xmin xmax [npt graphic_attributes]";
|
---|
[326] | 1152 | usage += "\n Related commands: func func2d func2dff ";
|
---|
[330] | 1153 | mpiac->RegisterCommand(kw, usage, this, "Func Plot");
|
---|
[293] | 1154 | kw = "func2d";
|
---|
| 1155 | usage = "Displays a function z=f(x,y) (Fills a matrix with function values)";
|
---|
| 1156 | usage += "\n Usage: func2d f(x,y) xmin xmax nptx ymin ymax npty [graphic_attributes]";
|
---|
| 1157 | usage += "\n Related commands: func";
|
---|
[330] | 1158 | mpiac->RegisterCommand(kw, usage, this, "Func Plot");
|
---|
[326] | 1159 | kw = "func2dff";
|
---|
| 1160 | usage = "Displays a function z=f(x,y) from a C-file (Fills a matrix with function values)";
|
---|
| 1161 | usage += "\n Usage: func2dff C-FileName FunctionName xmin xmax nptx ymin ymax npty [graphic_attributes]";
|
---|
| 1162 | usage += "\n Related commands: func funcff func2d ";
|
---|
[330] | 1163 | mpiac->RegisterCommand(kw, usage, this, "Func Plot");
|
---|
[293] | 1164 |
|
---|
[2781] | 1165 | //------ Commandes trace d'expression
|
---|
[357] | 1166 | kw = "ObjectExpressions";
|
---|
| 1167 | usage = "Any mathematical expression (math.h) with object variables can be used";
|
---|
| 1168 | usage += "\n ------ Object Variable names (double) -------- ";
|
---|
[2419] | 1169 | usage += "\n (_nl is the table line number or the sequential index)";
|
---|
| 1170 | usage += "\n- NTuple: ntuple variable names,_nl";
|
---|
[3123] | 1171 | usage += "\n- Histo1D/HProf: i,x,val,err,nb,_nl";
|
---|
[2419] | 1172 | usage += "\n- Histo2D: i,j,x,y,val,err,_nl";
|
---|
[3123] | 1173 | usage += "\n- HistoErr: i,x,val,err2,nb,_nl";
|
---|
| 1174 | usage += "\n- Histo2DErr: i,j,x,y,val,err2,nb,_nl";
|
---|
[2419] | 1175 | usage += "\n- Vector/Matrix: n,r,c,val,real,imag,mod,phas,_nl";
|
---|
| 1176 | usage += "\n- TArray: n,x,y,z,t,u,val,real,imag,mod,phas,_nl";
|
---|
| 1177 | usage += "\n- Image: i,j,x,y,val(=pix),_nl";
|
---|
| 1178 | usage += "\n- GeneralFitData: x0,ex0 x1,ex1 ... xn,exn y,ey ok ,_nl";
|
---|
[1548] | 1179 | usage += "\n- LocalMap/SphereThetaPhi/SphereHEALPix: ";
|
---|
[2419] | 1180 | usage += "\n- i,k,val,real,imag,mod,phas,teta,phi,_nl";
|
---|
| 1181 | usage += "\n- FITS Binary/ASCII table: fits column names,_nl";
|
---|
[2128] | 1182 | #ifdef SANS_EVOLPLANCK
|
---|
| 1183 | usage += "\n ------ Eros Variable names (double) -------- ";
|
---|
| 1184 | usage += "\n- StarList: x,y,flux,fond,pixmax,flags,";
|
---|
[2419] | 1185 | usage += "\n- xref,yref,fluxref,fondref,pixmaxref,_nl";
|
---|
[2128] | 1186 | #endif
|
---|
[1548] | 1187 | usage += "\n ------ Other parameters -------- ";
|
---|
[357] | 1188 | usage += "\nLoop parameters can be specified as I1[:I2[:DI]] for(int i=I1; i<I2; i+=DI)";
|
---|
| 1189 | usage += "\nThe default Cut() expression in true (=1) for all";
|
---|
[2999] | 1190 | usage += "\n\n Related commands: plot2d plot2de plot2dw plot3d plot3dw";
|
---|
| 1191 | usage += "\n projh1d projh2d projprof fillvec fillmtx ";
|
---|
| 1192 | usage += "\n fillnt fillgd1 fillgd2 ntloop exptovec ... ";
|
---|
[2419] | 1193 | grp = "Expr. Plotting";
|
---|
| 1194 | mpiac->RegisterHelp(kw, usage, grp);
|
---|
[293] | 1195 | kw = "plot2d";
|
---|
| 1196 | usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
|
---|
[357] | 1197 | usage += "\n Usage: plot2d nameobj f_X() g_Y() [f_Cut() graphic_attributes loop_param]";
|
---|
[2999] | 1198 | usage += "\n Related commands: plot2de plot2dw plot3d plot3dw ObjectExpressions ...";
|
---|
[330] | 1199 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[357] | 1200 | kw = "plot2de";
|
---|
| 1201 | usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with error bars eX/Y=f_ErrX/Y(Object) ";
|
---|
| 1202 | usage += "\n Usage: plot2de nameobj f_X() g_Y() f_ErrX() f_ErrY() [f_Cut() graphic_attributes loop_param]";
|
---|
| 1203 | usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
|
---|
| 1204 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[333] | 1205 | kw = "plot2dw";
|
---|
| 1206 | usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) ";
|
---|
[357] | 1207 | usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() [Cut() graphic_attributes loop_param]";
|
---|
[3279] | 1208 | usage += "\n Related commands: plot2d plot2dc plot3d ObjectExpressions ...";
|
---|
| 1209 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
| 1210 | kw = "plot2dc";
|
---|
| 1211 | usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Color ColIndex=h(Object) ";
|
---|
| 1212 | usage += "\n Usage: plot2dc nameobj f_X() g_Y() h_Col() [Cut() graphic_attributes loop_param]";
|
---|
[357] | 1213 | usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
|
---|
[333] | 1214 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 1215 | kw = "plot3d";
|
---|
[2999] | 1216 | usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object)";
|
---|
[357] | 1217 | usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() [Cut() graphic_attributes loop_param]";
|
---|
[2999] | 1218 | usage += "\n Related commands: plot2d plot2de plot3dw ObjectExpressions ...";
|
---|
[330] | 1219 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[2999] | 1220 | kw = "plot3dw";
|
---|
| 1221 | usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) with Weight W=k(Object) ";
|
---|
| 1222 | usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() k_Wt() [Cut() graphic_attributes loop_param]";
|
---|
| 1223 | usage += "\n Related commands: plot2d plot2dw plot3d ObjectExpressions ...";
|
---|
| 1224 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 1225 |
|
---|
| 1226 | kw = "projh1d";
|
---|
| 1227 | usage = "Projects X=f(Object) with weight WT=h(Object) into a 1D histogram ";
|
---|
[357] | 1228 | usage += "\n Usage: projh1d nameh1d nameobj f_X() [h_WT()=1. Cut() graphic_attributes loop_param]";
|
---|
[293] | 1229 | usage += "\n Histo1D nameh1d is created if necessary ";
|
---|
[357] | 1230 | usage += "\n Related commands: projh2d projprof ObjectExpressions ...";
|
---|
[330] | 1231 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 1232 | kw = "projh2d";
|
---|
| 1233 | usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a 2D histogram ";
|
---|
[357] | 1234 | usage += "\n Usage: projh2d nameh2d nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
|
---|
[293] | 1235 | usage += "\n Histo2D nameh2d is created if necessary ";
|
---|
[357] | 1236 | usage += "\n Related commands: projh1d projprof ObjectExpressions ...";
|
---|
[330] | 1237 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 1238 | kw = "projprof";
|
---|
| 1239 | usage = "Projects (X=f(Object),Y=g(Object)) with weight WT=h(Object) into a profile histogram ";
|
---|
[709] | 1240 | usage += "\n Usage: projprof nameprof nameobj f_X() g_Y() [h_WT()=1. Cut() graphic_attributes loop_param]";
|
---|
[293] | 1241 | usage += "\n HProf nameprof is created if necessary ";
|
---|
[357] | 1242 | usage += "\n Related commands: projh1d projh2d ObjectExpressions ...";
|
---|
[330] | 1243 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[357] | 1244 | kw = "fillvec";
|
---|
| 1245 | usage = "Fills a Vector V((int)(f_X(Object)+0.5)) = h_V(Object) ";
|
---|
| 1246 | usage += "\n Usage: fillvec namevec nameobj f_X() h_V() [Cut() graphic_attributes loop_param]";
|
---|
| 1247 | usage += "\n Related commands: fillmtx fillnt ObjectExpressions ...";
|
---|
| 1248 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
| 1249 | kw = "fillmtx";
|
---|
| 1250 | usage = "Fills a Matrix M(Line=g_Y(Object)+0.5, Col=f_X(Object)+0.5)) = h_V(Object) ";
|
---|
| 1251 | usage += "\n Usage: fillvec namevec nameobj f_X() g_Y() h_V() [Cut() graphic_attributes loop_param]";
|
---|
| 1252 | usage += "\n Related commands: fillvec fillnt ObjectExpressions ...";
|
---|
| 1253 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 1254 |
|
---|
| 1255 | kw = "fillnt";
|
---|
| 1256 | usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
|
---|
[357] | 1257 | usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() [Cut() nameNt loop_param]";
|
---|
[333] | 1258 | usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof ";
|
---|
[357] | 1259 | usage += "\n Related commands: fillvec fillmtx ntloop exptovec fillgd1 fillgd2 ObjectExpressions ...";
|
---|
[330] | 1260 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[357] | 1261 |
|
---|
[333] | 1262 | kw = "ntloop";
|
---|
| 1263 | usage = "Loops over an Object NTupleInterface calling a function from a C-file \n";
|
---|
| 1264 | usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
|
---|
[357] | 1265 | usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName loop_param]";
|
---|
| 1266 | usage += "\n Related commands: fillvec fillmtx fillnt fillgd1 fillgd2 exptovec ObjectExpressions ...";
|
---|
[333] | 1267 | usage += "\n Related commands: ntexpcfile fillnt";
|
---|
| 1268 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[357] | 1269 |
|
---|
[333] | 1270 | kw = "ntexpcfile";
|
---|
| 1271 | usage = "Creates a C-File with declarations suitable to be used for ntloop";
|
---|
| 1272 | usage += "\n Usage: ntexpcfile nameobj CFileName FuncName ";
|
---|
| 1273 | usage += "\n Related commands: ntloop";
|
---|
| 1274 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
| 1275 |
|
---|
[2922] | 1276 | kw = "expmeansig";
|
---|
| 1277 | usage = "Computes Mean/Sigma (+Min/Max) for an expression X=f(Object)";
|
---|
| 1278 | usage += "\n Usage: expmeansig nameobj f_X() [Cut() loop_param]";
|
---|
| 1279 | usage += "\n Related commands: exptovec ntloop fillnt ObjectExpressions ...";
|
---|
| 1280 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
| 1281 |
|
---|
[357] | 1282 | kw = "exptovec";
|
---|
[293] | 1283 | usage = "Creates and Fills a Vector with X=f(Object)";
|
---|
[357] | 1284 | usage += "\n Usage: exptovec namevec nameobj f_X() [Cut() graphic_attributes loop_param]";
|
---|
| 1285 | usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
|
---|
[330] | 1286 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[2922] | 1287 |
|
---|
[293] | 1288 | kw = "fillgd1";
|
---|
| 1289 | usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), ErrY=h(...))";
|
---|
[357] | 1290 | usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_ErrY() [Cut() loop_param]";
|
---|
| 1291 | usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
|
---|
[330] | 1292 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 1293 | kw = "fillgd2";
|
---|
| 1294 | usage = "Creates and Fills a GeneralFitData with (X=f(Object), Y=g(...), Z=h(...)) ErrZ=k(...)";
|
---|
[357] | 1295 | usage += "\n Usage: fillgd1 namegfd nameobj f_X() g_Y() h_Z() k_ErrZ() [Cut() loop_param]";
|
---|
| 1296 | usage += "\n Related commands: ntloop fillnt ObjectExpressions ...";
|
---|
[330] | 1297 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[1067] | 1298 | kw = "gdfrvec";
|
---|
| 1299 | usage = "Fills a GeneralFitData with vectors X,Y,Z,EZ";
|
---|
| 1300 | usage += "\n Usage: gdfrvec namegfd X Y";
|
---|
| 1301 | usage += "\n Usage: gdfrvec namegfd X Y ! EY";
|
---|
| 1302 | usage += "\n Usage: gdfrvec namegfd X Y Z";
|
---|
| 1303 | usage += "\n Usage: gdfrvec namegfd X Y Z EZ";
|
---|
| 1304 | usage += "\n Related commands: fillgd1 fillgd2 ...";
|
---|
| 1305 | mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
|
---|
[293] | 1306 |
|
---|
[2180] | 1307 |
|
---|
| 1308 | kw = "eval";
|
---|
| 1309 | usage = "Compute arithmetic expression\n";
|
---|
| 1310 | usage += "\n Usage: eval resultvarname arithmetic expression....";
|
---|
| 1311 | usage += "\n resultvarname: store result in variable resultvarname";
|
---|
| 1312 | usage += "\n - If first character is not alphabetic, just print result";
|
---|
| 1313 | usage += "\n arithmetic expression:";
|
---|
| 1314 | usage += "\n ex: x + sqrt(y)+z +3.14 (x,y,z are variables)";
|
---|
| 1315 | usage += "\n ex: $x + sqrt($y)+$z +3.14 (x,y,z are variables)";
|
---|
| 1316 | usage += "\n ex: 360 * M_PI / 180.";
|
---|
| 1317 | mpiac->RegisterCommand(kw, usage, this, "Expr. Arithmetic");
|
---|
| 1318 |
|
---|
[293] | 1319 | }
|
---|
| 1320 |
|
---|
| 1321 | /* --Methode-- */
|
---|
| 1322 | int PIABaseExecutor::LinkUserFuncs(string& fnameso, string& func1, string& func2, string& func3)
|
---|
| 1323 | // string& func4, string& func5)
|
---|
| 1324 | {
|
---|
| 1325 | string cmd;
|
---|
| 1326 |
|
---|
| 1327 | if (dynlink) delete dynlink; dynlink = NULL;
|
---|
| 1328 | usfmap.clear();
|
---|
| 1329 |
|
---|
| 1330 | dynlink = new PDynLinkMgr(fnameso, true);
|
---|
| 1331 | if (dynlink == NULL) {
|
---|
| 1332 | string sn = fnameso;
|
---|
| 1333 | cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur ouverture SO " << sn << endl;
|
---|
| 1334 | return(2);
|
---|
| 1335 | }
|
---|
| 1336 |
|
---|
| 1337 | int nok=0;
|
---|
| 1338 | // on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
|
---|
| 1339 | // DlUserProcFunction f = NULL;
|
---|
| 1340 | DlFunction f = NULL;
|
---|
| 1341 | if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
|
---|
| 1342 | // f = (DlUserProcFunction) dlsym(dlhandle, func1.c_str());
|
---|
| 1343 | f = dynlink->GetFunction(func1);
|
---|
| 1344 | if (f) { nok++; usfmap[func1] = f; }
|
---|
| 1345 | else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func1 << endl;
|
---|
| 1346 |
|
---|
| 1347 | if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
|
---|
| 1348 | // f = (DlUserProcFunction) dlsym(dlhandle, func2.c_str());
|
---|
| 1349 | f = dynlink->GetFunction(func2);
|
---|
| 1350 | if (f) { nok++; usfmap[func2] = f; }
|
---|
| 1351 | else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func2 << endl;
|
---|
| 1352 |
|
---|
| 1353 | if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
|
---|
| 1354 | // f = (DlUserProcFunction) dlsym(dlhandle, func3.c_str());
|
---|
| 1355 | f = dynlink->GetFunction(func3);
|
---|
| 1356 | if (f) { nok++; usfmap[func3] = f; }
|
---|
| 1357 | else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func3 << endl;
|
---|
| 1358 |
|
---|
| 1359 | /* Pb compile g++ 2.7.2
|
---|
| 1360 | if ((func4.length() < 1) || (func4 == "-") || (func4 == ".") ) goto fin;
|
---|
| 1361 | // f = (DlUserProcFunction) dlsym(dlhandle, func4.c_str());
|
---|
| 1362 | f = dynlink->GetFunction(func4);
|
---|
| 1363 | if (f) { nok++; usfmap[func4] = f; }
|
---|
| 1364 | else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func4 << endl;
|
---|
| 1365 |
|
---|
| 1366 | if ((func5.length() < 1) || (func5 == "-") || (func5 == ".") ) goto fin;
|
---|
| 1367 | // f = (DlUserProcFunction) dlsym(dlhandle, func5.c_str());
|
---|
| 1368 | f = dynlink->GetFunction(func5);
|
---|
| 1369 | if (f) { nok++; usfmap[func5] = f; }
|
---|
| 1370 | else cerr << "PIABaseExecutor/LinkUserFuncs_Erreur: Erreur linking " << func5 << endl;
|
---|
| 1371 | */
|
---|
| 1372 | fin:
|
---|
| 1373 | if (nok < 1) { if (dynlink) delete dynlink; dynlink = NULL; return(3); }
|
---|
| 1374 | else return(0);
|
---|
| 1375 | }
|
---|
| 1376 |
|
---|
[1276] | 1377 | /* --Methode-- */
|
---|
| 1378 | int PIABaseExecutor::LinkUserFuncs2(string& fnameso, string& func1, string& func2, string& func3)
|
---|
| 1379 | {
|
---|
| 1380 | string cmd;
|
---|
| 1381 |
|
---|
| 1382 | if (dynlink2) delete dynlink2; dynlink2 = NULL;
|
---|
| 1383 | usfmap2.clear();
|
---|
| 1384 |
|
---|
| 1385 | dynlink2 = new PDynLinkMgr(fnameso, true);
|
---|
| 1386 | if (dynlink2 == NULL) {
|
---|
| 1387 | string sn = fnameso;
|
---|
| 1388 | cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur ouverture SO " << sn << endl;
|
---|
| 1389 | return(2);
|
---|
| 1390 | }
|
---|
| 1391 |
|
---|
| 1392 | int nok=0;
|
---|
| 1393 | // on utilise donc des DlFunction (Reza 20/08/98) voir commentaire ds .h (pb g++)
|
---|
| 1394 | // DlUserProcFunction f = NULL;
|
---|
| 1395 | DlFunction f = NULL;
|
---|
| 1396 | if ((func1.length() < 1) || (func1 == "-") || (func1 == ".") ) goto fin;
|
---|
| 1397 | f = dynlink2->GetFunction(func1);
|
---|
| 1398 | if (f) { nok++; usfmap2[func1] = f; }
|
---|
| 1399 | else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func1 << endl;
|
---|
| 1400 |
|
---|
| 1401 | if ((func2.length() < 1) || (func2 == "-") || (func2 == ".") ) goto fin;
|
---|
| 1402 | f = dynlink2->GetFunction(func2);
|
---|
| 1403 | if (f) { nok++; usfmap2[func2] = f; }
|
---|
| 1404 | else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func2 << endl;
|
---|
| 1405 |
|
---|
| 1406 | if ((func3.length() < 1) || (func3 == "-") || (func3 == ".") ) goto fin;
|
---|
| 1407 | f = dynlink2->GetFunction(func3);
|
---|
| 1408 | if (f) { nok++; usfmap2[func3] = f; }
|
---|
| 1409 | else cerr << "PIABaseExecutor/LinkUserFuncs2_Erreur: Erreur linking " << func3 << endl;
|
---|
| 1410 |
|
---|
| 1411 | fin:
|
---|
| 1412 | if (nok < 1) { if (dynlink2) delete dynlink2; dynlink2 = NULL; return(3); }
|
---|
| 1413 | else return(0);
|
---|
| 1414 | }
|
---|
| 1415 |
|
---|