-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into add_lowq2_benchmarks
- Loading branch information
Showing
34 changed files
with
1,390 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Mirror and Trigger EICweb | ||
|
||
on: | ||
push: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: mirror | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build: | ||
name: Mirror and Trigger EICweb | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: write | ||
contents: read | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Push to EICweb | ||
uses: eic/gitlab-sync@master | ||
with: | ||
url: https://eicweb.phy.anl.gov/EIC/benchmarks/detector_benchmarks.git/ | ||
token: ${{ secrets.GITLAB_TOKEN }} | ||
username: ${{ secrets.GITLAB_USERNAME }} | ||
ciskip: true | ||
- name: Trigger EICweb | ||
uses: eic/trigger-gitlab-ci@v2 | ||
with: | ||
url: https://eicweb.phy.anl.gov | ||
project_id: 399 | ||
token: ${{ secrets.EICWEB_DETECTOR_BENCHMARKS_TRIGGER }} | ||
ref_name: ${{ github.event.pull_request.head.ref || github.ref }} | ||
variables: | ||
GITHUB_REPOSITORY=${{ github.repository }} | ||
GITHUB_SHA=${{ github.event.pull_request.head.sha || github.sha }} | ||
GITHUB_PR=${{ github.event.pull_request.number }} | ||
PIPELINE_NAME=${{ github.event.pull_request.title }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
configfile: "config.yaml" | ||
|
||
if config["remote"] == "S3": | ||
from snakemake.remote.S3 import RemoteProvider as S3RemoteProvider | ||
provider = S3RemoteProvider( | ||
endpoint_url="https://eics3.sdcc.bnl.gov:9000", | ||
access_key_id=os.environ["S3_ACCESS_KEY"], | ||
secret_access_key=os.environ["S3_SECRET_KEY"], | ||
) | ||
remote_path = lambda path: f"eictest/{path}" | ||
elif config["remote"] == "XRootD": | ||
from snakemake.remote.XRootD import RemoteProvider as XRootDRemoteProvider | ||
provider = XRootDRemoteProvider( | ||
stay_on_remote=False, | ||
) | ||
remote_path = lambda path: f"root://dtn-eic.jlab.org//work/eic2/{path}" | ||
else: | ||
raise ValueError(f"Unexpected config[\"remote\"] = {config['remote']}") | ||
|
||
include: "benchmarks/backgrounds/Snakefile" | ||
include: "benchmarks/barrel_ecal/Snakefile" | ||
include: "benchmarks/ecal_gaps/Snakefile" | ||
include: "benchmarks/material_scan/Snakefile" | ||
|
||
|
||
rule warmup_run: | ||
output: | ||
"warmup/{DETECTOR_CONFIG}.edm4hep.root", | ||
message: "Ensuring that calibrations/fieldmaps are available for {wildcards.DETECTOR_CONFIG}" | ||
shell: """ | ||
ddsim \ | ||
--runType batch \ | ||
--numberOfEvents 1 \ | ||
--compactFile "$DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml" \ | ||
--outputFile "{output}" \ | ||
--enableGun | ||
""" | ||
|
||
|
||
rule matplotlibrc: | ||
output: | ||
".matplotlibrc", | ||
run: | ||
with open(output[0], "wt") as fp: | ||
fp.write("backend: Agg\n") | ||
# interactive mode prevents plt.show() from blocking | ||
fp.write("interactive : True\n") | ||
|
||
|
||
rule org2py: | ||
input: | ||
notebook=workflow.basedir + "/{NOTEBOOK}.org", | ||
converter=workflow.source_path("benchmarks/common/org2py.awk"), | ||
output: | ||
"{NOTEBOOK}.py" | ||
shell: | ||
""" | ||
awk -f {input.converter} {input.notebook} > {output} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import os | ||
import shutil | ||
|
||
|
||
rule backgrounds_get_beam_gas_electron: | ||
input: | ||
provider.remote(remote_path("EPIC/EVGEN/BACKGROUNDS/BEAMGAS/electron/beam_gas_ep_10GeV_foam_emin10keV_10Mevt_vtx.hepmc")), | ||
output: | ||
"input/backgrounds/beam_gas_electron.hepmc", | ||
run: | ||
shutil.move(input[0], output[0]) | ||
|
||
|
||
rule backgrounds_get_beam_gas_proton: | ||
input: | ||
provider.remote(remote_path("EPIC/EVGEN/BACKGROUNDS/BEAMGAS/proton/ProtonBeamGasEvents/100GeV/100GeV_1.hepmc")), | ||
output: | ||
"input/backgrounds/beam_gas_proton.hepmc", | ||
run: | ||
shutil.move(input[0], output[0]) | ||
|
||
|
||
rule backgrounds_get_DIS: | ||
input: | ||
provider.remote(remote_path("EPIC/EVGEN/DIS/NC/{BEAM}/minQ2={MINQ2}/pythia8NCDIS_{BEAM}_minQ2={MINQ2}_{SUFFIX}.hepmc")), | ||
wildcard_constraints: | ||
BEAM="\d+x\d+", | ||
MINQ2="\d+", | ||
output: | ||
"input/backgrounds/pythia8NCDIS_{BEAM}_minQ2={MINQ2}_{SUFFIX}.hepmc", | ||
run: | ||
shutil.move(input[0], output[0]) | ||
|
||
|
||
rule backgrounds_sim: | ||
input: | ||
hepmc="input/backgrounds/{NAME}.hepmc", | ||
warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root", | ||
output: | ||
"sim_output/{DETECTOR_CONFIG}/backgrounds/{NAME}.edm4hep.root", | ||
log: | ||
"sim_output/{DETECTOR_CONFIG}/backgrounds/{NAME}.edm4hep.root.log", | ||
params: | ||
N_EVENTS=100 | ||
shell: | ||
""" | ||
ddsim \ | ||
--runType batch \ | ||
--part.minimalKineticEnergy 100*GeV \ | ||
--filter.tracker edep0 \ | ||
-v WARNING \ | ||
--numberOfEvents {params.N_EVENTS} \ | ||
--compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \ | ||
--inputFiles {input.hepmc} \ | ||
--outputFile {output} | ||
""" | ||
|
||
|
||
DETECTOR_CONFIG=os.environ["DETECTOR_CONFIG"] | ||
|
||
rule backgrounds_ecal_backwards: | ||
input: | ||
matplotlibrc=".matplotlibrc", | ||
script="benchmarks/backgrounds/ecal_backwards.py", | ||
electron_beam_gas_gen="input/backgrounds/beam_gas_electron.hepmc", | ||
electron_beam_gas_sim="sim_output/" + DETECTOR_CONFIG + "/backgrounds/beam_gas_electron.edm4hep.root", | ||
physics_signal_sim="sim_output/" + DETECTOR_CONFIG + "/backgrounds/pythia8NCDIS_10x100_minQ2=1_beamEffects_xAngle=-0.025_hiDiv_1.edm4hep.root", | ||
proton_beam_gas_gen="input/backgrounds/beam_gas_proton.hepmc", | ||
proton_beam_gas_sim="sim_output/" + DETECTOR_CONFIG + "/backgrounds/beam_gas_proton.edm4hep.root", | ||
output: | ||
directory("results/backgrounds/backwards_ecal") | ||
threads: workflow.cores | ||
shell: | ||
""" | ||
PORT=$RANDOM | ||
dask scheduler --port $PORT & | ||
export DASK_SCHEDULER=localhost:$PORT | ||
SCHEDULER_PID=$! | ||
dask worker tcp://$DASK_SCHEDULER --nworkers {threads} --nthreads 1 & | ||
WORKER_PID=$! | ||
env \ | ||
MATPLOTLIBRC={input.matplotlibrc} \ | ||
ELECTRON_BEAM_GAS_GEN=$(realpath {input.electron_beam_gas_gen}) \ | ||
ELECTRON_BEAM_GAS_SIM=$(realpath {input.electron_beam_gas_sim}) \ | ||
PHYSICS_PROCESS_SIM=$(realpath {input.physics_signal_sim}) \ | ||
PROTON_BEAM_GAS_GEN=$(realpath {input.proton_beam_gas_gen}) \ | ||
PROTON_BEAM_GAS_SIM=$(realpath {input.proton_beam_gas_sim}) \ | ||
OUTPUT_DIR={output} \ | ||
python {input.script} | ||
kill $WORKER_PID $SCHEDULER_PID | ||
""" |
Oops, something went wrong.