Back to home page

EIC code displayed by LXR

 
 

    


Warning, /detector_benchmarks/benchmarks/backgrounds/Snakefile is written in an unsupported language. File is not indexed.

0001 import os
0002 import shutil
0003 
0004 
0005 rule backgrounds_sim:
0006     input:
0007         warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
0008     output:
0009         "sim_output/{DETECTOR_CONFIG}/backgrounds/{PATH}.edm4hep.root",
0010     log:
0011         "sim_output/{DETECTOR_CONFIG}/backgrounds/{PATH}.edm4hep.root.log",
0012     params:
0013         N_EVENTS=100,
0014         hepmc=lambda wildcards: get_remote_path(f"{wildcards.PATH}.hepmc3.tree.root"),
0015     shell:
0016         """
0017 set -m # monitor mode to prevent lingering processes
0018 exec ddsim \
0019   --runType batch \
0020   --part.minimalKineticEnergy 100*GeV  \
0021   --filter.tracker edep0 \
0022   -v WARNING \
0023   --numberOfEvents {params.N_EVENTS} \
0024   --compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
0025   --inputFiles {params.hepmc} \
0026   --outputFile {output}
0027 """
0028 
0029 
0030 DETECTOR_CONFIG=os.environ["DETECTOR_CONFIG"]
0031 
0032 rule backgrounds_ecal_backwards:
0033     input:
0034         matplotlibrc=".matplotlibrc",
0035         script="benchmarks/backgrounds/ecal_backwards.py",
0036         electron_beam_gas_sim="sim_output/" + DETECTOR_CONFIG + "/backgrounds/EPIC/EVGEN/BACKGROUNDS/BEAMGAS/electron/GETaLM1.0.0-1.0/10GeV/GETaLM1.0.0-1.0_ElectronBeamGas_10GeV_foam_emin10keV_run001.edm4hep.root",
0037         physics_signal_sim="sim_output/" + DETECTOR_CONFIG + "/backgrounds/EPIC/EVGEN/DIS/NC/10x100/minQ2=1/pythia8NCDIS_10x100_minQ2=1_beamEffects_xAngle=-0.025_hiDiv_1.edm4hep.root",
0038         proton_beam_gas_sim="sim_output/" + DETECTOR_CONFIG + "/backgrounds/EPIC/EVGEN/BACKGROUNDS/BEAMGAS/proton/pythia8.306-1.0/100GeV/pythia8.306-1.0_ProtonBeamGas_100GeV_run001.edm4hep.root",
0039     output:
0040         directory("results/backgrounds/backwards_ecal")
0041     threads: workflow.cores
0042     shell:
0043         """
0044 set -m # monitor mode to prevent lingering processes
0045 cleanup() {{
0046   echo Cleaning up
0047   kill $WORKER_PID $SCHEDULER_PID
0048 }}
0049 trap cleanup EXIT
0050 
0051 PORT=$RANDOM
0052 dask scheduler --port $PORT &
0053 export DASK_SCHEDULER=localhost:$PORT
0054 SCHEDULER_PID=$!
0055 dask worker tcp://$DASK_SCHEDULER --nworkers {threads} --nthreads 1 &
0056 WORKER_PID=$!
0057 env \
0058 MATPLOTLIBRC={input.matplotlibrc} \
0059 ELECTRON_BEAM_GAS_GEN=root://dtn-eic.jlab.org//work/eic2/EPIC/EVGEN/BACKGROUNDS/BEAMGAS/electron/GETaLM1.0.0-1.0/10GeV/GETaLM1.0.0-1.0_ElectronBeamGas_10GeV_foam_emin10keV_run001.hepmc3.tree.root \
0060 ELECTRON_BEAM_GAS_SIM=$(realpath {input.electron_beam_gas_sim}) \
0061 PHYSICS_PROCESS_SIM=$(realpath {input.physics_signal_sim}) \
0062 PROTON_BEAM_GAS_GEN=root://dtn-eic.jlab.org//work/eic2/EPIC/EVGEN/BACKGROUNDS/BEAMGAS/proton/pythia8.306-1.0/100GeV/pythia8.306-1.0_ProtonBeamGas_100GeV_run001.hepmc3.tree.root \
0063 PROTON_BEAM_GAS_SIM=$(realpath {input.proton_beam_gas_sim}) \
0064 OUTPUT_DIR={output} \
0065 python {input.script}
0066 """