- Timestamp:
- Sep 30, 1999, 7:26:52 PM (26 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r388 r447 234 234 mObjMgr->AddObj(h, tokens[0]); 235 235 } 236 237 // Creation de NTuple 238 else if (kw == "newnt") { 239 if(tokens.size() < 2) 240 {cout<<"Usage: newnt name v1 v2 ... vn / newnt name nvar"<<endl; return(0);} 241 vector<string> varname; 242 int nvar = 0; 243 const char *c = tokens[1].c_str(); 244 if(isdigit(c[0])) { 245 nvar = atoi(tokens[1].c_str()); 246 if(nvar<=0 || nvar>=10000) 247 {cout<<"newnt name nvar : nvar must be an positive integer<10000"<<endl; 248 return(0);} 249 for(int i=0;i<nvar;i++) { 250 char str[16]; sprintf(str,"%d",i); 251 string dum = "v"; dum += str; 252 varname.push_back(dum.c_str()); 253 } 254 } else if( islower(c[0]) || isupper(c[0]) ) { 255 for(int i=1;i<tokens.size();i++) { 256 varname.push_back(tokens[i].c_str()); 257 nvar++; 258 } 259 } else { 260 cout<<"newnt name v1 v2 ... vn : name vi must begin by a letter"<<endl 261 <<"newnt name nvar : nvar must be an positive integer"<<endl; 262 return(0); 263 } 264 char **noms = new char*[nvar]; 265 for(int i=0;i<nvar;i++) noms[i] = (char *)varname[i].c_str(); 266 NTuple* nt = new NTuple(nvar,noms); 267 delete [] noms; 268 mObjMgr->AddObj(nt,tokens[0]); 269 } 270 271 // Creation de GeneralFitData 236 272 else if (kw == "newgfd") { 237 273 if (tokens.size() < 3) … … 510 546 511 547 // Remplissage NTuple,Vecteurs, ... , boucle de NTuple 548 else if (kw == "ntfrascii" ) { 549 if(tokens.size() < 2) { 550 cout<<"Usage: ntfrascii nt_name file_name [def_init_val]"<<endl; 551 return(0); 552 } 553 cout<<"CMV -> Reza tu dois mettre ici (def_val) la valeur par defaut"<<endl; 554 double def_val = 0.; 555 if(tokens.size()>=3) def_val = atof(tokens[2].c_str()); 556 srvo->NtFromASCIIFile(tokens[0],tokens[1],def_val); 557 } 558 512 559 else if (kw == "fillnt" ) { 513 560 if (tokens.size() < 5) { … … 717 764 kw = "newh1d"; 718 765 usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin"; 719 usage += "\n Related commands: newh2d newprof newgfd ";766 usage += "\n Related commands: newh2d newprof newnt newgfd "; 720 767 mpiac->RegisterCommand(kw, usage, this, "Objects"); 721 768 kw = "newh2d"; 722 769 usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny"; 723 usage += "\n Related commands: newh1d newprof newgfd ";770 usage += "\n Related commands: newh1d newprof newnt newgfd "; 724 771 mpiac->RegisterCommand(kw, usage, this, "Objects"); 725 772 kw = "newprof"; 726 773 usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]"; 727 usage += "\n Related commands: newh1d newh2d newgfd "; 774 usage += "\n Related commands: newh1d newh2d newnt newgfd "; 775 mpiac->RegisterCommand(kw, usage, this, "Objects"); 776 kw = "newnt"; 777 usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn"; 778 usage += "\n newnt name nvar"; 779 usage += "\n Related commands: newh1d newh2d newprof newgfd "; 728 780 mpiac->RegisterCommand(kw, usage, this, "Objects"); 729 781 kw = "newgfd"; 730 782 usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]"; 731 usage += "\n Related commands: newh1d newh2d newprof ";783 usage += "\n Related commands: newh1d newh2d newprof newnt "; 732 784 mpiac->RegisterCommand(kw, usage, this, "Objects"); 733 785 kw = "newvec"; … … 866 918 mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting"); 867 919 920 kw = "ntfrascii"; 921 usage = "Fills an existing NTuple from ASCII table file"; 922 usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]"; 923 usage += "\n Related commands: ntloop fillnt "; 924 mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting"); 925 868 926 kw = "fillnt"; 869 927 usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))"; -
trunk/SophyaPI/PIext/servnobjm.cc
r440 r447 703 703 mOmg->DisplayObj(nomvec, dopt); 704 704 return; 705 } 706 707 /* --Methode-- */ 708 void Services2NObjMgr::NtFromASCIIFile(string& nom,string& filename,double def_val) 709 // Pour remplir un ntuple "nom" existant a partir du fichier 710 // ASCII table "filename". Si il y a plus de variables dans le 711 // ntuple que dans le fichier "filename", 712 // les sur-numeraires sont mises a "def_val" par defaut. 713 { 714 NamedObjMgr omg; 715 AnyDataObj* mobj = omg.GetObj(nom); 716 if(mobj == NULL) 717 {cout<<"NtFromASCIIFile() Error, object "<<nom<<" not existing"<<endl; 718 return;} 719 if(typeid(*mobj) != typeid(NTuple)) 720 {cout<<"NtFromASCIIFile() Error, object "<<nom<<" not an NTuple"<<endl; 721 return;} 722 if (!mImgapp) return; 723 724 NTuple* nt = (NTuple*) mobj; 725 cout<<"CMV -> Reza tu dois mofidier FillFromASCIIFile"<<endl; 726 cout<<"CMV -> Reza pour permettre une valeur par defaut"<<endl; 727 cout<<"CMV -> Reza n oublie AUSSI pas l arg par def dans servnobj.h"<<endl; 728 cout<<"CMV -> Reza > nt->FillFromASCIIFile(filename,def_val);"<<endl; 729 nt->FillFromASCIIFile(filename); 730 return; 705 731 } 706 732 -
trunk/SophyaPI/PIext/servnobjm.h
r440 r447 76 76 virtual void ExpressionToVector(string & nom, string& expx, string& expcut, 77 77 string& nomvec, string dopt="", string loop=""); 78 virtual void NtFromASCIIFile(string& nom,string& filename,double def_val=0.); 78 79 virtual void FillNT(string & nom, string& expx, string& expy, string& expz, 79 80 string& expt, string& expcut, string& nomnt, string loop="");
Note:
See TracChangeset
for help on using the changeset viewer.