examples/cpp_root


A distribution comes with the directory:

    examples/cpp_root

As for examples/py_root (see the Python section), here are the original examples (found in examples/f77_hbook) but where the examples using COMIS, as the mandel.f for the pawex10.kumac example, is replaced with a C version (mandel.c). In this case gopaw will attempt to do an on the fly compilation and loading of the C file. If using this feature you must take care of tuning properly the scripts:

    <install_path>/gopaw/<version>/res/gopaw/scripts/sh/makcdll
 for Windows:
    <install_path>\gopaw\<version>\res\gopaw\scripts\DOS\makcdll.bat

Obviously a compiler must be available, along material to build a plugin. On Linux and macOS, if you have the g++ (c++) command available on your prompt you will have nothing to do. On a Windows, you must have "source setup" VisualC++ so that the commands CL.EXE and LINK.exe be available from your DOS prompt.

If all is ok, you execute the pawex10.kumac C/C++ version with:

    UNIX> cd <some_path>/examples/cpp_root  # have a local copy.
    UNIX> <start gopaw> 
 on Windows:
     DOS> cd <some_path>\examples\cpp_root  # have a local copy
     DOS> <start gopaw> 
   GOPAW> exec pawex10
pawex10.png

We put here mandel.c:

/*function*/ double mandel(double XP,double YP) {

  double X,Y,XX,YY,TT;
  int NMAX = 30;
  int N;

  X=XP;
  Y=YP;
  XX=0.;
  YY=0.;
  for(N=1;N<=NMAX;N++) {
    TT=XX*XX-YY*YY+X;
    YY=2.*XX*YY+Y;
    XX=TT;
    if(4.<(XX*XX+YY*YY)) break;
  }

  return ((float)N)/((float)NMAX);
}

(In py_root, the _root comes from the fact that manipulation of .hbook files had been replaced with manipulation of .root files).