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     log:
0042         scheduler=".logs/results/backgrounds/backwards_ecal/scheduler.log",
0043         worker=".logs/results/backgrounds/backwards_ecal/worker.log",
0044     threads: workflow.cores
0045     shell:
0046         """
0047 set -m # monitor mode to prevent lingering processes
0048 cleanup() {{
0049   echo Cleaning up
0050   kill $WORKER_PID $SCHEDULER_PID
0051 }}
0052 trap cleanup EXIT
0053 
0054 PORT=$RANDOM
0055 dask scheduler --port $PORT 2>{log.scheduler} &
0056 export DASK_SCHEDULER=localhost:$PORT
0057 SCHEDULER_PID=$!
0058 dask worker tcp://$DASK_SCHEDULER --nworkers {threads} --nthreads 1 2>{log.worker} &
0059 WORKER_PID=$!
0060 env \
0061 MATPLOTLIBRC={input.matplotlibrc} \
0062 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 \
0063 ELECTRON_BEAM_GAS_SIM=$(realpath {input.electron_beam_gas_sim}) \
0064 PHYSICS_PROCESS_SIM=$(realpath {input.physics_signal_sim}) \
0065 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 \
0066 PROTON_BEAM_GAS_SIM=$(realpath {input.proton_beam_gas_sim}) \
0067 OUTPUT_DIR={output} \
0068 python {input.script}
0069 """