Skip to content
Snippets Groups Projects
Commit 687234f6 authored by Giacomo De Pietro's avatar Giacomo De Pietro :goat:
Browse files

Merge branch 'feature/fix-readme' into 'main'

Fix readme

See merge request !3
parents 7073b947 5c63ac9d
No related branches found
No related tags found
1 merge request!3Fix readme
......@@ -5,14 +5,15 @@ Just a YAML and some conviniece functions, to manage multiple beambackgrounds fo
The YAML maps beambackgroundfiles to different locations and adds some metadata.
## Installation
1. Get repo.
1. Clone the repository.
2. Set the `BEAMBACKGROUND_JSON` enviroment variable. For ETP this is `/work/jeppelt/etpackground/beambackgrounds.json`
- If you are not running at ETP, you are responsible to keep the JSON file up to date.
## Usage
### A single package of beambackgrounds
```
import basf2 as b2
import simulation as si
import os
......@@ -25,34 +26,37 @@ for gt in bbs.global_tags:
print(gt)
b2.conditions.append_globaltag(gt)
path = b2.create_path()
path = b2.Path()
evt_info = b2.register_module('EventInfoSetter',
evtNumList= [10],
expList=bbs.expList,
runList=bbs.run,
path.add_module('EventInfoSetter',
evtNumList= [10],
expList=bbs.expList,
runList=bbs.run
)
path.add_module(evt_info)
si.add_simulation(path, bkgfiles=bbs.get_file_list("ceph"))
si.add_simulation(path,
bkgfiles=bbs.get_file_list("ceph")
)
path.add_module("Progress")
b2.process(path)
```
### Running in different places
Currently files can be read from these three locations:
- KEKCC (only if on KEKCC), use `kek` keyword
- Ceph@ETP (only if on ETP), use `ceph` keyword
- ETP Belle2 Storage @ GridKA (only if `X509_USER_PROXY` is set), use `gridka` keyword
### Example
```python
Python:
```
beambackgrounds = get_beam_background_by_key("experiment22_run30")
add_simulation(basf2_path, bkgfiles=beambackgrouns.gridka_file_list)
```
### Editing the JSON file
To update entries in the json file or add new entries, you simply create an `BeambackgroundMetadata` with the desired values. Then call its `update_json_entry` function. Be aware, that this will update the JSON file for everybody, so update with care. If you want to have a special version of a certain entry, create a new entry by setting the `key` property.
\ No newline at end of file
To update entries in the json file or add new entries, you simply create a `BeambackgroundMetadata` instance with the desired values. Then call its `update_json_entry` function. Be aware, that this will update the JSON file for everybody, so update with care. If you want to have a special version of a certain entry, create a new entry by setting the `key` property.
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment