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