Changeset 333 in Sophya for trunk/SophyaPI/PIext/basexecut.cc
- Timestamp:
- Jul 12, 1999, 1:12:29 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r331 r333 20 20 #include "ntuple.h" 21 21 #include "generaldata.h" 22 #include "cvector.h" 22 23 23 24 … … 42 43 int PIABaseExecutor::Execute(string& kw, vector<string>& tokens) 43 44 { 44 45 Services2NObjMgr* srvo = mObjMgr->GetServiceObj(); 45 46 // >>>>> Chargement de modules 46 47 if (kw == "loadmodule") { … … 124 125 mObjMgr->ReadAll(tokens[0]); 125 126 } 127 else if (kw == "saveobjs" ) { 128 if (tokens.size() < 2) { cout << "Usage: saveobjs patt filename " << endl; return(0); } 129 mObjMgr->SaveObjects(tokens[0], tokens[1]); 130 } 126 131 else if (kw == "saveall" ) { 127 132 if (tokens.size() < 1) { cout << "Usage: saveall file " << endl; return(0); } … … 132 137 mObjMgr->PrintObj(tokens[0]); 133 138 } 134 else if ( kw == "rename" ){139 else if ( (kw == "rename" ) || (kw == "mv") ) { 135 140 if (tokens.size() < 2) { cout << "Usage: rename nameobj namenew" << endl; return(0); } 136 141 mObjMgr->RenameObj(tokens[0], tokens[1]); 137 142 } 138 else if ( kw == "del") {143 else if ( (kw == "del" ) || (kw == "rm") ) { 139 144 if (tokens.size() < 1) { cout << "Usage: del nameobj " << endl; return(0); } 140 145 mObjMgr->DelObj(tokens[0]); … … 144 149 mObjMgr->DelObjects(tokens[0]); 145 150 } 146 else if ( kw == "listobjs"){151 else if ( (kw == "listobjs") || (kw == "ls") ) { 147 152 if (tokens.size() < 1) tokens.push_back("*"); 148 153 mObjMgr->ListObjs(tokens[0]); 149 154 } 155 // Gestion des repertoires 156 else if (kw == "mkdir" ) { 157 if (tokens.size() < 1) { cout << "Usage: mkdir dirname " << endl; return(0); } 158 mObjMgr->CreateDir(tokens[0]); 159 } 160 else if (kw == "rmdir" ) { 161 if (tokens.size() < 1) { cout << "Usage: rmdir dirname " << endl; return(0); } 162 mObjMgr->DeleteDir(tokens[0]); 163 } 164 else if (kw == "cd") { 165 if (tokens.size() < 1) tokens.push_back("home"); 166 mObjMgr->SetCurrentDir(tokens[0]); 167 } 168 else if (kw == "listdirs") { 169 if (tokens.size() < 1) tokens.push_back("*"); 170 mObjMgr->ListDirs(tokens[0]); 171 } 150 172 151 173 // >>>>>>>>>>> Creation d'histos 1D-2D … … 206 228 } 207 229 230 // Creation/remplissage de vecteur et de matrice 231 else if (kw == "newvec") { 232 if (tokens.size() < 2) { 233 cout << "Usage: newvec name size [f(i) dopt] " << endl; return(0); 234 } 235 int n = atoi(tokens[1].c_str()); 236 double xmin, xmax; 237 xmin = 0.; xmax = n; 238 if (tokens.size() < 3) tokens.push_back("0."); 239 if (tokens.size() < 4) tokens.push_back("n"); 240 mObjMgr->GetServiceObj()->PlotFunc(tokens[2], tokens[0], xmin, xmax, n, tokens[3]); 241 } 242 else if (kw == "newmtx") { 243 if (tokens.size() < 3) { 244 cout << "Usage: newvec name sizeX sizeY [f(i,j) dopt] " << endl; return(0); 245 } 246 int nx = atoi(tokens[1].c_str()); 247 int ny = atoi(tokens[2].c_str()); 248 double xmin, xmax, ymin, ymax; 249 xmin = 0.; xmax = nx; 250 ymin = 0.; ymax = ny; 251 if (tokens.size() < 4) tokens.push_back("0."); 252 if (tokens.size() < 5) tokens.push_back("n"); 253 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[3], tokens[0], xmin, xmax, ymin, ymax, 254 nx, ny, tokens[4]); 255 } 256 208 257 // >>>>>>>>>>> Affichage des objets 209 258 else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) { … … 223 272 mObjMgr->DisplayNT(tokens[0],tokens[1],tokens[2], ph, tokens[3], tokens[4], ph, opt); 224 273 } 274 else if (kw == "nt2dw") { 275 if (tokens.size() < 6) { cout << "Usage: nt2dw nameobj varx vary varz errx erry opt" << endl; return(0); } 276 string opt = "n"; 277 if (tokens.size() > 6) opt = tokens[6]; 278 string ph = ""; 279 mObjMgr->DisplayNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], ph, opt, false); 280 } 225 281 else if (kw == "nt3d") { 226 282 if (tokens.size() < 7) { cout << "Usage: nt3d nameobj varx vary varz errx erry errz opt" << endl; return(0); } 227 283 string opt = "n"; 228 284 if (tokens.size() > 7) opt = tokens[7]; 229 mObjMgr->DisplayNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], opt );285 mObjMgr->DisplayNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6], opt, true); 230 286 } 231 287 … … 258 314 if (tokens.size() > 4) opt = tokens[4]; 259 315 int np; 260 floatxmin, xmax;316 double xmin, xmax; 261 317 np = 100; 262 318 xmin = 0.; xmax = 1.; 263 319 np = atoi(tokens[3].c_str()); 264 320 xmin = atof(tokens[1].c_str()); xmax = atof(tokens[2].c_str()); 265 mObjMgr->GetServiceObj()->PlotFunc(tokens[0], xmin, xmax, np, opt); 321 string nom = ""; 322 mObjMgr->GetServiceObj()->PlotFunc(tokens[0], nom, xmin, xmax, np, opt); 266 323 } 267 324 else if ( (kw == "funcff") ) { … … 270 327 if (tokens.size() > 5) opt = tokens[5]; 271 328 int np; 272 floatxmin, xmax;329 double xmin, xmax; 273 330 np = 100; 274 331 xmin = 0.; xmax = 1.; 275 332 np = atoi(tokens[4].c_str()); 276 333 xmin = atof(tokens[2].c_str()); xmax = atof(tokens[3].c_str()); 277 mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], xmin, xmax, np, opt); 334 string nom = ""; 335 mObjMgr->GetServiceObj()->PlotFuncFrCFile(tokens[0], tokens[1], nom, xmin, xmax, np, opt); 278 336 } 279 337 else if ( (kw == "func2d") ) { … … 283 341 } 284 342 int npx, npy; 285 floatxmin, xmax;286 floatymin, ymax;343 double xmin, xmax; 344 double ymin, ymax; 287 345 npx = npy = 50; 288 346 xmin = 0.; xmax = 1.; … … 294 352 string opt = "n"; 295 353 if (tokens.size() > 7) opt = tokens[7]; 296 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], xmin, xmax, ymin, ymax, npx, npy, opt); 354 string nom = ""; 355 mObjMgr->GetServiceObj()->PlotFunc2D(tokens[0], nom, xmin, xmax, ymin, ymax, npx, npy, opt); 297 356 } 298 357 else if ( (kw == "func2dff") ) { … … 302 361 } 303 362 int npx, npy; 304 floatxmin, xmax;305 floatymin, ymax;363 double xmin, xmax; 364 double ymin, ymax; 306 365 npx = npy = 50; 307 366 xmin = 0.; xmax = 1.; … … 313 372 string opt = "n"; 314 373 if (tokens.size() > 8) opt = tokens[8]; 315 mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], xmin, xmax, ymin, ymax, npx, npy, opt); 374 string nom = ""; 375 mObjMgr->GetServiceObj()->PlotFunc2DFrCFile(tokens[0], tokens[1], nom, xmin, xmax, ymin, ymax, npx, npy, opt); 316 376 } 317 377 … … 332 392 if (tokens.size() > 6) opt = tokens[6]; 333 393 } 334 mObjMgr->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,ecut,opt); 335 } 336 394 srvo->DisplayPoints2D(tokens[0],tokens[1],tokens[2],errx,erry,ecut,opt); 395 } 396 397 else if (kw == "plot2dw" ) { 398 if (tokens.size() < 5) { 399 cout << "Usage: plot2dw nomobj expx expy expwt expcut opt" << endl; 400 return(0); 401 } 402 string opt = "n"; 403 if (tokens.size() > 5) opt = tokens[5]; 404 srvo->DisplayPoints2DW(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], opt); 405 } 337 406 else if (kw == "plot3d" ) { 338 407 if (tokens.size() < 5) { … … 342 411 string opt = "n"; 343 412 if (tokens.size() > 5) opt = tokens[5]; 344 mObjMgr->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], opt);413 srvo->DisplayPoints3D(tokens[0],tokens[1],tokens[2],tokens[3], tokens[4], opt); 345 414 } 346 415 … … 352 421 string opt = "n"; 353 422 if (tokens.size() > 5) opt = tokens[5]; 354 mObjMgr->ProjectH1(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], opt);423 srvo->ProjectH1(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], opt); 355 424 } 356 425 … … 363 432 if (tokens.size() > 6) opt = tokens[6]; 364 433 365 mObjMgr->ProjectH2(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt);434 srvo->ProjectH2(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt); 366 435 } 367 436 … … 374 443 if (tokens.size() > 6) opt = tokens[6]; 375 444 376 mObjMgr->ProjectHProf(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt);445 srvo->ProjectHProf(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], opt); 377 446 } 378 447 379 448 else if (kw == "fillnt" ) { 380 if (tokens.size() < 7) { 381 cout << "Usage: fillnt nameobj expx expy expz expt expcut nament" << endl; 382 return(0); 383 } 384 mObjMgr->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6] ); 449 if (tokens.size() < 6) { 450 cout << "Usage: fillnt nameobj expx expy expz expt expcut [ntname]" << endl; 451 return(0); 452 } 453 if (tokens.size() < 7) tokens.push_back(""); 454 srvo->FillNT(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5], tokens[6] ); 455 } 456 457 else if (kw == "ntloop" ) { 458 if (tokens.size() < 3) { 459 cout << "Usage: ntloop nameobj fname funcname [ntname]" << endl; 460 return(0); 461 } 462 if (tokens.size() < 4) tokens.push_back(""); 463 srvo->FillNTFrCFile(tokens[0],tokens[1], tokens[2], tokens[3]); 464 } 465 466 else if (kw == "ntexpcfile" ) { 467 if (tokens.size() < 3) { 468 cout << "Usage: ntexpcfile nameobj fname funcname" << endl; 469 return(0); 470 } 471 srvo->PrepareNTExpressionCFile(tokens[0],tokens[1], tokens[2]); 385 472 } 386 473 … … 392 479 string opt = "n"; 393 480 if (tokens.size() > 4) opt = tokens[4]; 394 mObjMgr->FillVect(tokens[0],tokens[1],tokens[2], tokens[3], opt);481 srvo->FillVect(tokens[0],tokens[1],tokens[2], tokens[3], opt); 395 482 } 396 483 … … 403 490 if (tokens.size() > 5) nomgfd = tokens[5]; 404 491 string expy = ""; 405 mObjMgr->FillGFD(tokens[0],tokens[1], expy, tokens[2], tokens[3], tokens[4],nomgfd);492 srvo->FillGFD(tokens[0],tokens[1], expy, tokens[2], tokens[3], tokens[4],nomgfd); 406 493 } 407 494 … … 413 500 string nomgfd = ""; 414 501 if (tokens.size() > 6) nomgfd = tokens[6]; 415 mObjMgr->FillGFD(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5],nomgfd);502 srvo->FillGFD(tokens[0],tokens[1],tokens[2], tokens[3], tokens[4], tokens[5],nomgfd); 416 503 } 417 504 … … 436 523 else if(c[0]=='o') {O += ","; O += c+2;} 437 524 } 438 mObjMgr->Fit12D(tokens[0],tokens[1],p,s,m,M,O);525 srvo->Fit12D(tokens[0],tokens[1],p,s,m,M,O); 439 526 } 440 527 … … 520 607 usage += "\n Related commands: saveall openfits"; 521 608 mpiac->RegisterCommand(kw, usage, this, "FileIO"); 609 kw = "saveobjs"; 610 usage = "Saves objects with names matching a pattern (x?y*) into a PPF file \n"; 611 usage += "Usage: saveall nameobjpattern filename"; 612 usage += "\n Related commands: saveall openppf savefits"; 613 mpiac->RegisterCommand(kw, usage, this, "FileIO"); 522 614 kw = "saveall"; 523 615 usage = "Saves all objects into a PPF file \n Usage: saveall filename"; 524 usage += "\n Related commands: openppf savefits";616 usage += "\n Related commands: saveobj openppf savefits"; 525 617 mpiac->RegisterCommand(kw, usage, this, "FileIO"); 526 618 … … 529 621 mpiac->RegisterCommand(kw, usage, this, "FileIO"); 530 622 623 kw = "mkdir"; 624 usage = "Create a directory"; 625 usage += "\n Usage: mkdir dirname"; 626 mpiac->RegisterCommand(kw, usage, this, "Object Managment"); 627 kw = "rmdir"; 628 usage = "Removes an empty directory"; 629 usage += "\n Usage: remove dirname"; 630 mpiac->RegisterCommand(kw, usage, this, "Object Managment"); 631 kw = "cd"; 632 usage = "Change current directory"; 633 usage += "\n Usage: cd [dirname]"; 634 mpiac->RegisterCommand(kw, usage, this, "Object Managment"); 635 kw = "pwd"; 636 usage = "Prints current directory"; 637 usage += "\n Usage: pwd"; 638 mpiac->RegisterCommand(kw, usage, this, "Object Managment"); 639 kw = "listdirs"; 640 usage = "Prints the list of directories"; 641 usage += "\n Usage: listdirs [patt=*] \n patt : * , ? "; 642 mpiac->RegisterCommand(kw, usage, this, "Object Managment"); 531 643 kw = "listobjs"; 532 usage = "Prints the list of objects ";533 usage += "\n Usage: listobjs";644 usage = "Prints the list of objects (Alias: ls)"; 645 usage += "\n Usage: listobjs [patt=*] \n patt : /*/x?y* ... "; 534 646 mpiac->RegisterCommand(kw, usage, this, "Object Managment"); 535 647 kw = "rename"; 536 usage = "Rename an object \n Usage: rename nameobj namenew";648 usage = "Rename an object (Alias: mv) \n Usage: rename nameobj namenew"; 537 649 usage += "\n Related commands: del delobjs"; 538 650 mpiac->RegisterCommand(kw, usage, this, "Object Managment"); 539 651 kw = "del"; 540 usage = "Deletes an object \n Usage: del nameobj";652 usage = "Deletes an object (Alias: rm) \n Usage: del nameobj"; 541 653 usage += "\n Related commands: delobjs rename"; 542 654 mpiac->RegisterCommand(kw, usage, this, "Object Managment"); … … 550 662 usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin"; 551 663 usage += "\n Related commands: newh2d newprof newgfd "; 552 mpiac->RegisterCommand(kw, usage, this, " Histrograms");664 mpiac->RegisterCommand(kw, usage, this, "Objects"); 553 665 kw = "newh2d"; 554 666 usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny"; 555 667 usage += "\n Related commands: newh1d newprof newgfd "; 556 mpiac->RegisterCommand(kw, usage, this, " Histrograms");668 mpiac->RegisterCommand(kw, usage, this, "Objects"); 557 669 kw = "newprof"; 558 670 usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]"; 559 671 usage += "\n Related commands: newh1d newh2d newgfd "; 560 mpiac->RegisterCommand(kw, usage, this, " Histrograms");672 mpiac->RegisterCommand(kw, usage, this, "Objects"); 561 673 kw = "newgfd"; 562 674 usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]"; 563 675 usage += "\n Related commands: newh1d newh2d newprof "; 564 mpiac->RegisterCommand(kw, usage, this, "Histrograms"); 676 mpiac->RegisterCommand(kw, usage, this, "Objects"); 677 kw = "newvec"; 678 usage = "Creates (and fills) a vector \n Usage: newvec name size [f(i) [dopt] ] "; 679 usage += "\n Related commands: newmtx"; 680 mpiac->RegisterCommand(kw, usage, this, "Objets"); 681 kw = "newmtx"; 682 usage = "Creates (and fills) a matrix \n Usage: newvec name sizeX sizeY [f(i,j) [dopt] ] "; 683 usage += "\n Related commands: newvec"; 684 mpiac->RegisterCommand(kw, usage, this, "Objets"); 565 685 566 686 kw = "disp"; … … 579 699 usage = "Displays Points (X-Y) [with error-bars] from an NTuple "; 580 700 usage += "\n Usage : nt2d nameobj varx vary [errx erry] [graphic_attributes]"; 581 usage += "\n Related commands: disp surf nt3d gfd2d "; 701 usage += "\n Related commands: disp surf nt2dw nt3d gfd2d "; 702 mpiac->RegisterCommand(kw, usage, this, "Obj. Display"); 703 kw = "nt2dw"; 704 usage = "Displays Points (X-Y) with weight [with error-bars] from an NTuple "; 705 usage += "\n Usage : nt2d nameobj varx vary varz [errx erry] [graphic_attributes]"; 706 usage += "\n Related commands: disp surf nt2d nt3d gfd2d "; 582 707 mpiac->RegisterCommand(kw, usage, this, "Obj. Display"); 583 708 kw = "nt3d"; 584 709 usage = "Displays 3D-Points (X-Y-Z) [with error-bars] from an NTuple "; 585 710 usage += "\n Usage : nt3d nameobj varx vary varz [errx erry errz] [graphic_attributes]"; 586 usage += "\n Related commands: disp surf nt2d gfd3d ";711 usage += "\n Related commands: disp surf nt2d nt2dw gfd3d "; 587 712 mpiac->RegisterCommand(kw, usage, this, "Obj. Display"); 588 713 kw = "gfd2d"; … … 623 748 usage += "\nVector: i,val - Matrix: i,j,val - Image: x=i,y=j, pix=val"; 624 749 usage += "\n Usage: plot2d nameobj f_X() g_Y() [ f_ErrX() f_ErrY() ] f_Cut() [graphic_attributes]"; 625 usage += "\n Related commands: plot3d projh1d projh2d projprof fillnt fillvec fillgd1 "; 750 usage += "\n Related commands: plot2dw plot3d projh1d projh2d projprof fillnt fillvec fillgd1 "; 751 mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting"); 752 kw = "plot2dw"; 753 usage = "Plots (2D) Y=g(Object) vs. X=f(Object) with Weight W=h(Object) "; 754 usage += "\n Usage: plot2dw nameobj f_X() g_Y() h_Wt() Cut() [graphic_attributes]"; 755 usage += "\n Related commands: plot2d projh1d projh2d projprof fillnt fillvec "; 626 756 mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting"); 627 757 kw = "plot3d"; 628 758 usage = "Plots (3D) Z=h(Object) vs. Y=g(Object) vs. X=f(Object) vs "; 629 usage += "\n Usage: plot 2d nameobj f_X() g_Y() h_Z() Cut() [graphic_attributes]";630 usage += "\n Related commands: plot2d projh1d projh2d projprof fillnt fillvec ";759 usage += "\n Usage: plot3d nameobj f_X() g_Y() h_Z() Cut() [graphic_attributes]"; 760 usage += "\n Related commands: plot2d plot2dw projh1d projh2d projprof fillnt fillvec "; 631 761 mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting"); 632 762 … … 653 783 usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))"; 654 784 usage += "\n Usage: fillnt nameobj f_X() g_Y() h_Z() k_T() Cut() nameNt"; 655 usage += "\n Related commands: plot2d projh1d projh2d projprof "; 656 mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting"); 785 usage += "\n Related commands: ntloop plot2d projh1d projh2d projprof "; 786 mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting"); 787 kw = "ntloop"; 788 usage = "Loops over an Object NTupleInterface calling a function from a C-file \n"; 789 usage += "and optionaly fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))"; 790 usage += "\n Usage: ntloop nameobj CFileName FuncName [NtupleName]"; 791 usage += "\n Related commands: ntexpcfile fillnt"; 792 mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting"); 793 kw = "ntexpcfile"; 794 usage = "Creates a C-File with declarations suitable to be used for ntloop"; 795 usage += "\n Usage: ntexpcfile nameobj CFileName FuncName "; 796 usage += "\n Related commands: ntloop"; 797 mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting"); 798 657 799 kw = "fillvec"; 658 800 usage = "Creates and Fills a Vector with X=f(Object)"; … … 685 827 { 686 828 string cmd; 687 int rc;688 829 689 830 if (dynlink) delete dynlink; dynlink = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.