|
1 | 1 | # Fortran process for CepGen
|
2 | 2 | This repository provides a simple skeletton of an implementation of a Fortran process in CepGen.
|
3 | 3 |
|
4 |
| -Running `make` will build a shared library containing all requirements to define a process in CepGen's runtime environment. |
| 4 | +As for other CepGen-derived projects, the build system is [CMake](https://cmake.org/), and its "standard recipe". |
5 | 5 |
|
6 |
| -This `.so` or `.dll` library can then be imported through the `-a` argument of CepGen's main executable, or using the `cepgen::loadLibrary` statement in user-defined executables. |
| 6 | +If you are not using a precompiled version of CepGen (i.e. your version of CepGen is [built from sources](https://cepgen.hepforge.org/install)), the `CEPGEN_PATH` environment variable should be set to the base source directory: |
7 | 7 |
|
8 |
| -A working version of CepGen is obviously required on the building system. |
9 |
| -The default search paths for this installation are: |
10 |
| -* `/usr/local/lib64` for library objects (only the `CepGen` shared library is required), and |
11 |
| -* `/usr/local/include` for development headers. |
| 8 | +```bash |
| 9 | +export CEPGEN_PATH=/path/to/cepgen/sources |
| 10 | +``` |
12 | 11 |
|
13 |
| -These two search paths can be overriden by setting the `$(CEPGEN_LIBS_DIR)` and `$(CEPGEN_INCLUDE_DIR)` environment variables prior to running `make`. |
| 12 | +Then, the usual CMake build recipe can be used: |
14 | 13 |
|
15 |
| -For instance, if a local source-build of CepGen is used, these two can take the value: |
16 | 14 | ```bash
|
17 |
| -export CEPGEN_LIBS_DIR=<path/to/cepgen/sources>/build |
18 |
| -export CEPGEN_INCLUDE_DIR=<path/to/cepgen/sources> |
| 15 | +mkdir build |
| 16 | +cd build |
| 17 | +cmake .. |
| 18 | +make [-j] |
19 | 19 | ```
|
20 | 20 |
|
21 |
| -In this example, the `dummy_process` Fortran double-precision typed function is built from the `*.f` source files (here, only [dummy_process.f](dummy_process.f), and registered using the [ProcessesWrapper.cpp](ProcessesWrapper.cpp) file. |
| 21 | +The resulting object is a shared library containing all requirements to define a process in CepGen's runtime environment. |
| 22 | +By default, the library name is set to `CepGenFortranProcess`. |
| 23 | +However you can override it using the `PROCESS_NAME` CMake variable, i.e. adding the flag `-DPROCESS_NAME=MyProcessName` in the `cmake` command. |
| 24 | + |
| 25 | +This `.so` or `.dll` library can then be imported through the `-a` argument of CepGen's main executable, or using the `cepgen::loadLibrary` statement in custom user-defined executables. |
| 26 | + |
| 27 | +In this example, the `dummy_process` Fortran double-precision typed function is built from the `*.f` source files (here, only [dummy_process.f](src/dummy_process.f), and registered using the [ProcessesWrapper.cpp](ProcessesWrapper.cpp) file. |
22 | 28 | This latter acts as a link between the CepGen runtime environment and this new process definition.
|
23 | 29 |
|
24 | 30 | In this file, two functions are respectively declaring the main matrix element, and registering it into the runtime database:
|
25 |
| -* `DECLARE_FORTRAN_FUNCTION( dummy_process )` takes the F77 name of the function as an argument ; |
26 |
| -* `REGISTER_FORTRAN_PROCESS( dummy, "A dummy Fortran process", dummy_process )` links this function to a new CepGen process named `dummy`, described with the second argument. |
| 31 | +* `DECLARE_FORTRAN_FUNCTION(dummy_process)` takes the F77 name of the function as an argument ; |
| 32 | +* `REGISTER_FORTRAN_PROCESS(dummy, "A dummy Fortran process", dummy_process)` links this function to a new CepGen process named `dummy`, described with the second argument. |
27 | 33 |
|
28 | 34 | Once compiled and linked into a shared library, it can be loaded into the CepGen runtime environment and added into the processes collection.
|
29 | 35 | For the latter, the main CepGen executable can be steered when providing an extra `-a` flag linking to this library, i.e.
|
30 | 36 | ```bash
|
31 |
| -$CEPGEN_PATH/bin/cepgen -a $PATH_TO/libCepGenUserProcess.so -i $PATH_TO/dummy_cfg.py |
| 37 | +$CEPGEN_PATH/bin/cepgen -a libCepGenFortranProcess.so -i cards/dummy_cfg.py |
32 | 38 | ```
|
| 39 | + |
| 40 | +All steering cards (conventionally, for backward compatibility, new ones should be following [the Python format](https://cepgen.hepforge.org/cards-python)) stored in the [cards/](cards) directory are copied into a new directory in the build directory, for simplicity. |
0 commit comments