Changeset 2419 in Sophya for trunk/SophyaPI/PIext


Ignore:
Timestamp:
Jul 21, 2003, 11:13:10 PM (22 years ago)
Author:
cmv
Message:
  • introduction notion de numero de ligne dans expression ntuple modif prototype PlotExprFunc NTLoopExprFunc (add _nl _nstart _nend) modif int_4 -> int_8_exprf (long long) pour _nl (DecodeLoopParameters,

PrepareNTExpressionCFile, LinkExprFunc,...)

  • doc pour _nl _nstart _nend et arragement repartition RegisterHelp/RegisterCommand

(rz + cmv 21/7/2003)

Location:
trunk/SophyaPI/PIext
Files:
6 edited

Legend:

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

    r2380 r2419  
    581581    return(0);
    582582  }
    583   int kks = 0;
    584   int kke = v->NElts();
    585   int kkp = 1;
     583  int_8 kks = 0;
     584  int_8 kke = v->NElts();
     585  int_8 kkp = 1;
    586586  if (tokens.size() > 2) Services2NObjMgr::DecodeLoopParameters(tokens[2], kks, kke, kkp);
    587587  if (kks < 0)  kks = 0;
    588   if (kke > v->NElts()) kke = v->NElts();
     588  if (kke > (int_8)v->NElts()) kke = v->NElts();
    589589  if (kkp < 1) kkp = 1;
    590590  int nelt = (kke-kks-1)/kkp;
     
    646646      return(0);
    647647    }
    648     int kks = 0;
    649     int kke = nti->NbLines();
    650     int kkp = 1;
     648    int_8 kks = 0;
     649    int_8 kke = nti->NbLines();
     650    int_8 kkp = 1;
    651651    if (tokens.size() > 3) Services2NObjMgr::DecodeLoopParameters(tokens[3], kks, kke, kkp);
    652652    if (kks < 0)  kks = 0;
    653     if (kke > nti->NbLines()) kke = nti->NbLines();
     653    if (kke > (int_8)nti->NbLines()) kke = nti->NbLines();
    654654    if (kkp < 1) kkp = 1;
    655655    int nelt = (kke-kks-1)/kkp;
     
    10701070void PIABaseExecutor::RegisterCommands()
    10711071{
    1072 string kw, usage;
     1072string kw, usage, grp;
    10731073kw = "loadmodule";
    10741074usage = "To load and initialize modules \n  Usage: loadmodule fnameso modulename";
     
    16141614usage = "Any mathematical expression (math.h) with object variables can be used";
    16151615usage += "\n  ------ Object Variable names (double) -------- ";
    1616 usage += "\n- NTuple: ntuple variable names";
    1617 usage += "\n- Histo1D/HProf: i,x,val,err";
    1618 usage += "\n- Histo2D: i,j,x,y,val,err";
    1619 usage += "\n- Vector/Matrix: n,r,c,val,real,imag,mod,phas";
    1620 usage += "\n- TArray: n,x,y,z,t,u,val,real,imag,mod,phas";
    1621 usage += "\n- Image: i,j,x,y,val(=pix)";
    1622 usage += "\n- GeneralFitData: x0,ex0 x1,ex1 ...  xn,exn   y,ey   ok";
     1616usage += "\n  (_nl is the table line number or the sequential index)";
     1617usage += "\n- NTuple: ntuple variable names,_nl";
     1618usage += "\n- Histo1D/HProf: i,x,val,err,_nl";
     1619usage += "\n- Histo2D: i,j,x,y,val,err,_nl";
     1620usage += "\n- Vector/Matrix: n,r,c,val,real,imag,mod,phas,_nl";
     1621usage += "\n- TArray: n,x,y,z,t,u,val,real,imag,mod,phas,_nl";
     1622usage += "\n- Image: i,j,x,y,val(=pix),_nl";
     1623usage += "\n- GeneralFitData: x0,ex0 x1,ex1 ...  xn,exn   y,ey   ok  ,_nl";
    16231624usage += "\n- LocalMap/SphereThetaPhi/SphereHEALPix: ";
    1624 usage += "\n-         i,k,val,real,imag,mod,phas,teta,phi";
    1625 usage += "\n- FITS Binary/ASCII table: fits column names";
     1625usage += "\n-         i,k,val,real,imag,mod,phas,teta,phi,_nl";
     1626usage += "\n- FITS Binary/ASCII table: fits column names,_nl";
    16261627#ifdef SANS_EVOLPLANCK
    16271628usage += "\n  ------ Eros Variable names (double) -------- ";
    16281629usage += "\n- StarList: x,y,flux,fond,pixmax,flags,";
    1629 usage += "\n-           xref,yref,fluxref,fondref,pixmaxref";
     1630usage += "\n-           xref,yref,fluxref,fondref,pixmaxref,_nl";
    16301631#endif
    16311632usage += "\n  ------ Other parameters -------- ";
     
    16351636usage += "\n        projh1d projh2d  projprof fillvec fillmtx ";
    16361637usage += "\n        fillnt fillgd1 fillgd2 ntloop exptovec ... ";
    1637 mpiac->RegisterCommand(kw, usage, NULL, "Expr. Plotting");
     1638grp = "Expr. Plotting";
     1639mpiac->RegisterHelp(kw, usage, grp);
    16381640kw = "plot2d";
    16391641usage = "Plots (2D) Y=g(Object) vs. X=f(Object) --- Object Variable names (double) :";
  • trunk/SophyaPI/PIext/dlftypes.h

    r912 r2419  
    1515typedef double (* DlFunctionOfXY) (double x, double y);
    1616// ---- Fonctions pour trace d'expressions d'objets ------------
    17 typedef int (* PlotExprFunc) (double* x, double* rx, double* ry, double* rz, double* rt);
    18 typedef int (* NTLoopExprFunc) (double* x, double* rx, double* ry, double* rz,
    19                                 double* rt, int n, int nmax);
     17typedef long long int_8_exprf;
     18// ^- Doit etre le meme que dans (Services2NObjMgr::)LinkExprFunc,PrepareNTExpressionCFile
     19typedef int (* PlotExprFunc) (int_8_exprf nl, double* x, double* rx, double* ry, double* rz, double* rt);
     20typedef int (* NTLoopExprFunc) (int_8_exprf nl, double* x, double* rx, double* ry, double* rz,
     21                                double* rt, int_8_exprf nstart, int_8_exprf nend);
    2022
    2123// ---------- Fonctions UserFit ----------------
  • trunk/SophyaPI/PIext/pawexecut.cc

    r2322 r2419  
    501501
    502502// evenements a utiliser
    503 int_4 k1=0, k2=objnt->NbLines(), dk=1;
     503int_8 k1=0, k2=objnt->NbLines(), dk=1;
    504504srvo.DecodeLoopParameters(loop,k1,k2,dk);
    505505if (k1<0) k1=0;
    506506if (k2<0) k2=objnt->NbLines();
    507 if (k2>(int)objnt->NbLines()) k2=objnt->NbLines();
     507if (k2>(int_8)objnt->NbLines()) k2=objnt->NbLines();
    508508if (dk<=0) dk=1;
    509509
     
    522522  double xnt[5]={0,0,0,0,0};
    523523  double* xn;
    524   for(int_4 k=k1; k<k2; k += dk)    {
     524  for(int_8 k=k1; k<k2; k += dk)    {
    525525    xn = objnt->GetLineD(k);
    526     if(f(xn,xnt,xnt+1,xnt+2,xnt+3) != 0) {
     526    if(f((int_8_exprf)k,xn,xnt,xnt+1,xnt+2,xnt+3) != 0) {
    527527      if(fout) fprintf(fout,"%d ",k); else printf("%d ",k);
    528528      for(i=0;i<(int)varnum.size();i++) {
  • trunk/SophyaPI/PIext/piacmd.cc

    r2377 r2419  
    493493usage += "   by Auto_Ini_Ranf(int lp) \n";
    494494usage += "   Usage: autoiniranf";
    495 RegisterHelp(kw, usage, grp);
     495RegisterCommand(kw, usage, NULL, grp);
    496496
    497497kw = "shell execute";
     
    503503usage += "  > shell myfile.csh [arg1] [arg2] [...]\n";
    504504usage += "    (where the first line of \"myfile.csh\" is \"#!/bin/csh\")\n";
    505 RegisterHelp(kw, usage, grp);
     505RegisterCommand(kw, usage, NULL, grp);
    506506
    507507kw = "exitpiapp";
    508508usage = "To end the piapp session (Interpreter's command)";
    509 RegisterHelp(kw, usage, grp);
     509RegisterCommand(kw, usage, NULL, grp);
    510510
    511511basexec = new PIABaseExecutor(this, omg, app);
  • trunk/SophyaPI/PIext/servnobjm.cc

    r2322 r2419  
    909909mImgapp->RedirectStdOutErr(false);
    910910
    911 int k1,k2,dk;
     911int_8 k1,k2,dk;
    912912k1 = 0;  k2 = objnt->NbLines();  dk = 1;
    913913DecodeLoopParameters(loop, k1, k2, dk);
    914914if (k1 < 0) k1 = 0;
    915915if (k2 < 0) k2 = objnt->NbLines();
    916 if (k2 > (int_4)objnt->NbLines()) k2 = objnt->NbLines();
     916if (k2 > (int_8)objnt->NbLines()) k2 = objnt->NbLines();
    917917if (dk <= 0) dk = 1;
    918918
    919919try  {
    920920  double* xn;
    921   int kmax = k2;
    922   for(k=k1; k<kmax; k+=dk)    {
     921  int_8 kstart = k1, kend = k2;
     922  for(k=kstart; k<kend; k+=dk)    {
    923923    xn = objnt->GetLineD(k);
    924     if (f(xn, xnt, xnt+1, xnt+2, xnt+3, k, kmax) != 0) {
     924    if (f((int_8_exprf)k, xn, xnt, xnt+1, xnt+2, xnt+3, (int_8_exprf)kstart,(int_8_exprf) kend) != 0) {
    925925      if (nt) {
    926          for(i=0; i<4; i++) fxnt[i] = xnt[i];
     926         for(int i=0; i<4; i++) fxnt[i] = xnt[i];
    927927         nt->Fill(fxnt);
    928928         }
     
    989989
    990990fputs("/* ------ Compare bits on double --------- */ \n", fip);
    991 fputs("typedef long long int_8;\n", fip);
    992 fputs("int_8 BitCmp64(double v,int_8 flg)\n", fip);
    993 fputs("{return ((int_8)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip);
     991fputs("typedef long long int_8_exprf;\n", fip);
     992fputs("int_8_exprf BitCmp64(double v,int_8_exprf flg)\n", fip);
     993fputs("{return ((int_8_exprf)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip);
    994994fputs("/* ------ Some random number generators --------- */ \n", fip);
    995995fputs("#if defined(__ppc__) && defined(__MACH__) \n",fip);
     
    10111011fputs("#define gaurand() NorRand() \n\n", fip);
    10121012
    1013 fputs("/* NTupleInterface Variable declaration - Generated by piapp  \n", fip);
    1014 fputs("      -- Services2NObjMgr::PrepareNTExpressionCFile()  --     */ \n\n", fip);
    1015 fprintf(fip,"int %s(double* _xnti_, double* _rx_, double* _ry_, double* _rz_, \n",
     1013fputs("/* NTupleInterface Variable declaration - Generated by piapp    */\n", fip);
     1014fputs("/*    -- Services2NObjMgr::PrepareNTExpressionCFile()  --       */ \n", fip);
     1015fputs("/* _nl line number or sequential index : _nstart <= _nl < _nend */ \n\n", fip);
     1016fprintf(fip,"int %s(int_8_exprf _nl, double* _xnti_, double* _rx_, double* _ry_, double* _rz_, \n",
    10161017        funcname.c_str());
    1017 fprintf(fip,"       double* _rt_, int _n_, int _nmax_) \n");
     1018fprintf(fip,"       double* _rt_, int_8_exprf _nstart, int_8_exprf _nend) \n");
    10181019fprintf(fip, "{ \n %s \n", vardec.c_str());
    10191020fputs("  if (!1) { /* Cut Expression failed */ \n", fip);
     
    11781179float  fxnt[10];
    11791180
    1180 int i,k;
    1181 for(i=0; i<10; i++) xnt[i] = 0.;
    1182 int k1,k2,dk;
     1181int_8 k;
     1182for(k=0; k<10; k++) xnt[k] = 0.;
     1183int_8 k1,k2,dk;
    11831184k1 = 0;  k2 = objnt->NbLines();  dk = 1;
    11841185DecodeLoopParameters(loop, k1, k2, dk);
    11851186if (k1 < 0) k1 = 0;
    11861187if (k2 < 0) k2 = objnt->NbLines();
    1187 if (k2 > (int_4)objnt->NbLines()) k2 = objnt->NbLines();
     1188if (k2 > (int_8)objnt->NbLines()) k2 = objnt->NbLines();
    11881189if (dk <= 0) dk = 1;
    11891190
     
    11921193  for(k=k1; k<k2; k += dk)    {
    11931194    xn = objnt->GetLineD(k);
    1194     if (f(xn, xnt, xnt+1, xnt+2, xnt+3) != 0) {
     1195    if (f((int_8_exprf)k,xn, xnt, xnt+1, xnt+2, xnt+3) != 0) {
    11951196      if (nt) {
    1196          for(i=0; i<4; i++) fxnt[i] = xnt[i];
     1197         for(int i=0; i<4; i++) fxnt[i] = xnt[i];
    11971198         nt->Fill(fxnt);
    11981199         }
     
    12511252
    12521253fputs("/* ------ Compare bits on double --------- */ \n", fip);
    1253 fputs("typedef long long int_8;\n", fip);
    1254 fputs("int_8 BitCmp64(double v,int_8 flg)\n", fip);
    1255 fputs("{return ((int_8)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip);
     1254fputs("typedef long long int_8_exprf;\n", fip);
     1255fputs("int_8_exprf BitCmp64(double v,int_8_exprf flg)\n", fip);
     1256fputs("{return ((int_8_exprf)((v<0.) ? v-0.1 : v+0.1))&flg;}\n", fip);
    12561257fputs("/* ------ Some random number generators --------- */ \n", fip);
    12571258fputs("#if defined(__ppc__) && defined(__MACH__) \n",fip);
     
    12731274fputs("#define gaurand() NorRand() \n\n", fip);
    12741275
    1275 fputs("int expf_pia_dl_func(double* _zz6qi_, double* _rx_6q_, double* _ry_6q_, double* _rz_6q_, double* _rt_6q_) \n{\n", fip);
     1276fputs("int expf_pia_dl_func(int_8_exprf _nl, double* _zz6qi_, double* _rx_6q_, double* _ry_6q_, double* _rz_6q_, double* _rt_6q_) \n{\n", fip);
    12761277fprintf(fip,"%s \n", vardec.c_str());
    12771278fprintf(fip, "if (!(%s)) { *_rx_6q_ = *_ry_6q_ = *_rz_6q_ = *_rt_6q_ = 0.;  return(0); } \n", cut.c_str());
     
    13231324// Fonction static
    13241325/* --Methode-- */
    1325 void Services2NObjMgr::DecodeLoopParameters(string& loop, int& i1, int& i2, int& di)
     1326void Services2NObjMgr::DecodeLoopParameters(string& loop, int_8& i1, int_8& i2, int_8& di)
    13261327{
    13271328// Decode des paramatres de boucle for(int i=i1; i<i2; i+=di) specifies
     
    13311332if (l < 1) return;
    13321333size_t p = loop.find(':');
    1333 if (p >= l) { i1 = atoi(loop.c_str()); return; }
    1334 i1 = atoi(loop.substr(0, p).c_str());
     1334if (p >= l) { i1 = atol(loop.c_str()); return; }
     1335i1 = atol(loop.substr(0, p).c_str());
    13351336string aa = loop.substr(p+1);
    13361337p = aa.find(':');
    13371338if (p < aa.length() ) {
    1338   i2 = atoi(aa.substr(0,p).c_str());
    1339   di = atoi(aa.substr(p+1).c_str());
    1340   }
    1341 else i2 = atoi(aa.c_str());
     1339  i2 = atol(aa.substr(0,p).c_str());
     1340  di = atol(aa.substr(p+1).c_str());
     1341  }
     1342else i2 = atol(aa.c_str());
    13421343// cout << "-> I1= " << i1 << " I2= " << i2 << " DI= " << di << endl;
    13431344return;
  • trunk/SophyaPI/PIext/servnobjm.h

    r2180 r2419  
    115115
    116116// Utilitaires divers
    117   static void   DecodeLoopParameters(string& loop, int& i1, int& i2, int& di);
     117  static void   DecodeLoopParameters(string& loop, int_8& i1, int_8& i2, int_8& di);
    118118  string        FileName2Name(string const & fn);
    119119  char*         PClassIdToClassName(int cid);
Note: See TracChangeset for help on using the changeset viewer.