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