Skip to content

Commit

Permalink
Adapt client justfile to new n4::run_manager interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jacg committed Sep 6, 2023
2 parents 0bcde11 + 65ff0c8 commit 9630b60
Show file tree
Hide file tree
Showing 25 changed files with 356 additions and 500 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,5 @@ jobs:
- name: Run compile-time tests
run: nix develop .#${{ matrix.devshell }} -c just test-compile-time

- name: Run nain4 examples
run: nix develop .#${{ matrix.devshell }} -c just test-examples

- name: Run G4 examples
run: nix develop .#${{ matrix.devshell }} -c just g4-examples/run-examples-that-work
27 changes: 17 additions & 10 deletions doc/src/how-to/build-a-minimal-nain4-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

## Building the app

The most basic example of a nain4 app can be found in [examples/00-basic/n4app.cc](../../../examples/00-basic/n4app.cc). Here is the full file:
One of the most basic examples of a nain4 app can be found in [templates/basic/src/n4app.cc](../../../templates/basic/src/n4app.cc). Here is the full file:

```c++
{{#include ../../../examples/00-basic/n4app.cc:full_file}}
{{#include ../../../templates/basic/src/n4app.cc:full_file}}
```
Now, let's split it into bite-sized portions. First we create a simple program that reads the number of events from CLI:
```c++
{{#include ../../../examples/00-basic/n4app.cc:pick_cli_arguments}}
{{#include ../../../examples/00-basic/n4app.cc:closing_bracket}}
{{#include ../../../templates/basic/src/n4app.cc:pick_cli_arguments}}
{{#include ../../../templates/basic/src/n4app.cc:closing_bracket}}
```

In order to run a simulation we need to create a run manager:
```c++
{{#include ../../../examples/00-basic/n4app.cc:create_run_manager}}
{{#include ../../../templates/basic/src/n4app.cc:create_run_manager}}
```
The run manager needs to be initialized with 3 attributes:
Expand All @@ -28,25 +28,32 @@ To build the action set we need to provide a primary generator action. Other act
Note that the physics list must be instantiated and given to the run manager before the primary generator is instantiated. We provide the run manager with these attributes:
```c++
{{#include ../../../examples/00-basic/n4app.cc:build_minimal_framework}}
{{#include ../../../templates/basic/src/n4app.cc:build_minimal_framework}}
```

here, `my_geometry`, and `my_generator` are the two functions we need to provide to run our simulation:

```c++
{{#include ../../../examples/00-basic/n4app.cc:my_geometry}}
{{#include ../../../templates/basic/src/n4app.cc:my_geometry}}

{{#include ../../../examples/00-basic/n4app.cc:my_generator}}
{{#include ../../../templates/basic/src/n4app.cc:my_generator}}
```
and `create_actions` is defined as:
```c++
{{#include ../../../templates/basic/src/n4app.cc:create_actions}}
```


With this, our setup is ready, and we can start the simulation with
```c++
{{#include ../../../examples/00-basic/n4app.cc:run}}
{{#include ../../../templates/basic/src/n4app.cc:run}}
```
Don't forget to add the relevant includes
```c++
{{#include ../../../examples/00-basic/n4app.cc:includes}}
{{#include ../../../templates/basic/src/n4app.cc:includes}}
```

## Compiling the app
Expand Down
57 changes: 0 additions & 57 deletions examples/00-basic/CMakeLists.txt

This file was deleted.

15 changes: 0 additions & 15 deletions examples/00-basic/justfile

This file was deleted.

30 changes: 0 additions & 30 deletions examples/00-basic/macs/run.mac

This file was deleted.

84 changes: 0 additions & 84 deletions examples/00-basic/macs/vis.mac

This file was deleted.

106 changes: 0 additions & 106 deletions examples/00-basic/n4app.cc

This file was deleted.

13 changes: 0 additions & 13 deletions examples/justfile

This file was deleted.

Loading

0 comments on commit 9630b60

Please sign in to comment.