|
| 1 | +rule far_forward_dvcs_compile: |
| 2 | + input: |
| 3 | + "benchmarks/far_forward_dvcs/analysis/analyze_DVCS_eicrecon_cxx.so", |
| 4 | + |
| 5 | +# Process the generated HepMC files through the simulation |
| 6 | +rule far_forward_dvcs_sim: |
| 7 | + input: |
| 8 | + warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root", |
| 9 | + geometry_lib=find_epic_libraries(), |
| 10 | + output: |
| 11 | + "sim_output/far_forward_dvcs/{DETECTOR_CONFIG}/DVCS.{INDEX}.ab.hiAcc.{EBEAM}x{PBEAM}.edm4hep.root", |
| 12 | + params: |
| 13 | + N_EVENTS=1000, |
| 14 | + EBEAM=lambda wildcards: wildcards.EBEAM, |
| 15 | + INDEX=lambda wildcards: wildcards.INDEX, |
| 16 | + PBEAM=lambda wildcards: wildcards.PBEAM, |
| 17 | + SEED=lambda wildcards: "1" + wildcards.INDEX, |
| 18 | + DETECTOR_PATH=os.environ["DETECTOR_PATH"], |
| 19 | + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, |
| 20 | + DD4HEP_HASH=get_spack_package_hash("dd4hep"), |
| 21 | + NPSIM_HASH=get_spack_package_hash("npsim"), |
| 22 | + cache: True |
| 23 | + shell: |
| 24 | + """ |
| 25 | +npsim \ |
| 26 | + --runType batch \ |
| 27 | + --part.minimalKineticEnergy 1000*GeV \ |
| 28 | + --random.seed {params.SEED} \ |
| 29 | + --filter.tracker edep0 \ |
| 30 | + -v WARNING \ |
| 31 | + --numberOfEvents {params.N_EVENTS} \ |
| 32 | + --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \ |
| 33 | + --inputFiles root://dtn-eic.jlab.org//volatile/eic/EPIC/EVGEN/EXCLUSIVE/DVCS_ABCONV/{params.EBEAM}x{params.PBEAM}/DVCS.{params.INDEX}.ab.hiAcc.{params.EBEAM}x{params.PBEAM}.hepmc3.tree.root \ |
| 34 | + --outputFile {output} |
| 35 | +""" |
| 36 | + |
| 37 | +rule foo: |
| 38 | + input: |
| 39 | + 'sim_output/far_forward_dvcs/epic_craterlake_10x100/DVCS.1.ab.hiAcc.10x100.edm4hep.root' |
| 40 | + |
| 41 | +# Process the files produced in the previous step through EICRecon |
| 42 | +rule far_forward_dvcs_reco: |
| 43 | + input: |
| 44 | + sim="sim_output/far_forward_dvcs/{DETECTOR_CONFIG}/DVCS.{INDEX}.ab.hiAcc.{EBEAM}x{PBEAM}.edm4hep.root", |
| 45 | + warmup=ancient("warmup/{DETECTOR_CONFIG}.edm4hep.root"), |
| 46 | + output: |
| 47 | + "sim_output/far_forward_dvcs/{DETECTOR_CONFIG}/DVCS.{INDEX}.ab.hiAcc.{EBEAM}x{PBEAM}.eicrecon.edm4eic.root", |
| 48 | + params: |
| 49 | + DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG, |
| 50 | + EBEAM=lambda wildcards: wildcards.EBEAM, |
| 51 | + PBEAM=lambda wildcards: wildcards.PBEAM, |
| 52 | + INDEX=lambda wildcards: wildcards.INDEX, |
| 53 | + EICRECON_HASH=get_spack_package_hash("eicrecon"), |
| 54 | + cache: True |
| 55 | + shell: |
| 56 | + """ |
| 57 | +set -m # monitor mode to prevent lingering processes |
| 58 | +exec env DETECTOR_CONFIG={wildcards.DETECTOR_CONFIG} \ |
| 59 | + eicrecon {input.sim} -Ppodio:output_file={output} \ |
| 60 | + -Ppodio:output_collections=B0ECalClusters,B0TrackerHits,B0TrackerRecHits,EcalEndcapPTruthClusters,ForwardOffMRecParticles,ForwardRomanPotRecParticles,MCParticles,MCParticlesHeadOnFrameNoBeamFX,ReconstructedChargedParticles,ReconstructedTruthSeededChargedParticles,ZDCEcalClusters |
| 61 | +""" |
| 62 | + |
| 63 | +#Process the merged file through the plotting script |
| 64 | +rule far_forward_dvcs_plots: |
| 65 | + input: |
| 66 | + workflow.source_path("analysis/render.hpp"), |
| 67 | + workflow.source_path("analysis/detectorResolution.hpp"), |
| 68 | + script="benchmarks/far_forward_dvcs/analysis/analyze_DVCS_eicrecon.cxx", |
| 69 | + script_compiled="benchmarks/far_forward_dvcs/analysis/analyze_DVCS_eicrecon_cxx.so", |
| 70 | + reco="sim_output/far_forward_dvcs/{DETECTOR_CONFIG}/DVCS.1.ab.hiAcc.{EBEAM}x{PBEAM}.eicrecon.edm4eic.root", |
| 71 | + output: |
| 72 | + dir=directory("results/far_forward_dvcs/{DETECTOR_CONFIG}/{EBEAM}x{PBEAM}"), |
| 73 | + list=temp("results/far_forward_dvcs/{DETECTOR_CONFIG}/{EBEAM}x{PBEAM}.lst"), |
| 74 | + wildcard_constraints: |
| 75 | + EBEAM=r"\d+", |
| 76 | + PBEAM=r"\d+", |
| 77 | + shell: |
| 78 | + """ |
| 79 | +mkdir -p "{output.dir}" |
| 80 | +echo "{input.reco}" > "{output.list}" |
| 81 | +root -l -b -q '{input.script}+("{output.list}", "{output.dir}")' |
| 82 | +""" |
| 83 | + |
| 84 | +#Examples of invocation |
| 85 | +rule far_forward_dvcs_run_locally: |
| 86 | + input: |
| 87 | + "results/far_forward_dvcs/epic_craterlake_10x100/10x100/", |
| 88 | + message: |
| 89 | + "See output in {input[0]}" |
0 commit comments