Notes on starsim / agml build system

Typical calling sequence:

MACRO kuip4ever

   DETP GEOM y2020q field=-5.0
   GEXEC [path]/geometry.so
   GCLOS all
 
RETURN

where [path] is the path to the library being loaded.  The [path] can be either $STAR_LIB/ or .$STAR_HOST_SYS/lib/, pointing to the geometry compiled as part of the library release or pointing to a locally built copy of the library.  In both cases, ALL symbols (i.e. all STAR detectors) must be present in the library, or an error will occur when the library is linked into the executable. 

An alternative to the GEXEC command is the MAKE command, which builds the geometry based on the source code in CVS.


MACRO kuip4ever

   DETP GEOM y2020q field=-5.0
   MAKE geometry
   GCLOS all
 
RETURN

This command will first try to build the code locally in ./pams/geometry.  If that directory exists, then it must contain all geometry files.  If not, it won't build.  If that directory doesn't exist, it will build the code in $STAR/pams/geometry. 


Proposed directory layout for AgML:

StarVMC/Geometry/Geometry.h           # Master AgML/ROOT geometry file
StarVMC/Geometry/Geometry.cxx   

StarVMC/Geometry/BbcmGeo/BbcmGeo.xml  # Directories containing XML files for geometries
...
StarVMC/Geometry/ZcalGeo/ZcalGeo.xml
StarVMC/Geometry/Compat               # Starsim compatability directory containing dummy modules described below...

Two passes will be performed to build the starsim library "xgeometry.so", and the VMC library "StarGeometry.so".

Pass 1 : xgeometry.so (libxgeometry.so)

When cons sees an XML file in the StarVMC/Geometry area, it will run mgr/agmlParser.py --file=$XMLFILE --export=Mortran, piping the result into a ".g" file in the build area.

When it sees a ".g" file in the StarVMC/Geometry area, it will copy it to the build area.

It will then compile using agetof, followed by gfortran... i.e. it will follow the same build procedure which occurs in pams/geometry.

Pass 2: StarGeometry.so (libStarGeometry.so)

When cons sees an XML file, it will run mgr/agmlParser.py --file=$XMLFILE --export=AgROOT --module=$XMLFILE:s/.xml// --path=$BUILD

When cons sees any other type of file, it ignores it

It then compiles using standard c++ / rootcint build.


For starsim integration:

gexec [path]/xgeometry.so

Works if we add a dummy XML module for every ".g" file which needs to be included...

<Export language="Mortran">
#include "pams/geometry/geometry/geometry.g"
</Export>
<!-- with a special interface for geometry.g -->
<Module name="xgeometry" comment="XML geometry initialization for starsim">
<Export language="Mortran">
   call geometry()
</Export>
</Module>