Changeset 447 in Sophya for trunk/SophyaPI/PIext/basexecut.cc


Ignore:
Timestamp:
Sep 30, 1999, 7:26:52 PM (26 years ago)
Author:
ercodmgr
Message:

intro newnt et ntfrascci (partiel) cmv 30/9/99

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/basexecut.cc

    r388 r447  
    234234  mObjMgr->AddObj(h, tokens[0]);
    235235  }
     236
     237// Creation de NTuple
     238else 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
    236272else if (kw == "newgfd") {
    237273  if (tokens.size() < 3)
     
    510546
    511547// Remplissage NTuple,Vecteurs, ... , boucle de NTuple
     548else 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
    512559else if (kw == "fillnt" ) {
    513560  if (tokens.size() < 5) {
     
    717764kw = "newh1d";
    718765usage = "Creates a 1D histogramm \n Usage: newh1d name xmin xmax nbin";
    719 usage += "\n  Related commands: newh2d  newprof newgfd "; 
     766usage += "\n  Related commands: newh2d  newprof newnt newgfd "; 
    720767mpiac->RegisterCommand(kw, usage, this, "Objects");
    721768kw = "newh2d";
    722769usage = "Creates a 2D histogramm \n Usage: newh2d name xmin xmax nbinx ymin ymax nbiny";
    723 usage += "\n  Related commands: newh1d  newprof newgfd "; 
     770usage += "\n  Related commands: newh1d  newprof newnt newgfd "; 
    724771mpiac->RegisterCommand(kw, usage, this, "Objects");
    725772kw = "newprof";
    726773usage = "Creates a profile histogramm \n Usage: newprof name xmin xmax nbin [ymin ymax]";
    727 usage += "\n  Related commands: newh1d  newh2d newgfd "; 
     774usage += "\n  Related commands: newh1d  newh2d newnt newgfd "; 
     775mpiac->RegisterCommand(kw, usage, this, "Objects");
     776kw = "newnt";
     777usage = "Creates a ntuple \n Usage: newnt name v1 v2 v3 .. vn";
     778usage += "\n        newnt name nvar"; 
     779usage += "\n  Related commands: newh1d  newh2d newprof newgfd "; 
    728780mpiac->RegisterCommand(kw, usage, this, "Objects");
    729781kw = "newgfd";
    730782usage = "Creates GeneralFit Data object \n Usage: newgfd nvar nalloc [errx(0/1)]";
    731 usage += "\n  Related commands: newh1d  newh2d  newprof "; 
     783usage += "\n  Related commands: newh1d  newh2d  newprof newnt "; 
    732784mpiac->RegisterCommand(kw, usage, this, "Objects");
    733785kw = "newvec";
     
    866918mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
    867919
     920kw = "ntfrascii";
     921usage = "Fills an existing NTuple from ASCII table file";
     922usage += "\n Usage: ntfrascii nt_name file_name [def_init_val]";
     923usage += "\n  Related commands: ntloop fillnt ";
     924mpiac->RegisterCommand(kw, usage, this, "Expr. Plotting");
     925
    868926kw = "fillnt";
    869927usage = "Creates and Fills an NTuple(x,y,z,t) with (X=f(Object),Y=g(...),Z=h(...),T=k(...))";
Note: See TracChangeset for help on using the changeset viewer.