Skip to content
Snippets Groups Projects
Commit ac74bc6b authored by Dmitry Kalinkin's avatar Dmitry Kalinkin
Browse files

zdc_*: enable caching

parent d87ae97d
Branches
No related tags found
No related merge requests found
rule zdc_lambda_generate:
input:
script="benchmarks/zdc_lambda/analysis/gen_lambda_decay.cxx",
params:
NEVENTS_GEN=1000,
output:
GEN_FILE="sim_output/zdc_lambda/lambda_decay_{P}GeV.hepmc"
GEN_FILE="sim_output/zdc_lambda/lambda_decay_{P}GeV.hepmc",
params:
N_EVENTS=1000,
shell:
"""
root -l -b -q '{input.script}({params.NEVENTS_GEN},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})'
root -l -b -q '{input.script}({params.N_EVENTS},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})'
"""
rule zdc_lambda_simulate:
input:
GEN_FILE="sim_output/zdc_lambda/lambda_decay_{P}GeV.hepmc",
warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
params:
PHYSICS_LIST="FTFP_BERT"
geometry_lib=find_epic_libraries(),
output:
SIM_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_sim_lambda_dec_{P}GeV_{INDEX}.edm4hep.root"
SIM_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_sim_lambda_dec_{P}GeV_{INDEX}.edm4hep.root",
params:
N_EVENTS=200,
PHYSICS_LIST="FTFP_BERT",
DETECTOR_PATH=os.environ["DETECTOR_PATH"],
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
DD4HEP_HASH=get_spack_package_hash("dd4hep"),
NPSIM_HASH=get_spack_package_hash("npsim"),
cache: True
shell:
"""
NEVENTS_SIM=200
# Running simulation
npsim \
--compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
--skipNEvents $(( $NEVENTS_SIM * {wildcards.INDEX} )) \
--numberOfEvents $NEVENTS_SIM \
--compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
--skipNEvents $(( {params.N_EVENTS} * {wildcards.INDEX} )) \
--numberOfEvents {params.N_EVENTS} \
--physicsList {params.PHYSICS_LIST} \
--inputFiles {input.GEN_FILE} \
--outputFile {output.SIM_FILE}
......@@ -33,13 +39,18 @@ npsim \
rule zdc_lambda_recon:
input:
SIM_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_sim_lambda_dec_{P}GeV_{INDEX}.edm4hep.root"
SIM_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_sim_lambda_dec_{P}GeV_{INDEX}.edm4hep.root",
output:
REC_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_rec_lambda_dec_{P}GeV_{INDEX}.edm4eic.root"
REC_FILE="sim_output/zdc_lambda/{DETECTOR_CONFIG}_rec_lambda_dec_{P}GeV_{INDEX}.edm4eic.root",
params:
N_EVENTS=200,
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
EICRECON_HASH=get_spack_package_hash("eicrecon"),
cache: True
shell:
"""
NEVENTS_REC=200
eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_files=$DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml -Ppodio:output_collections=MCParticles,HcalFarForwardZDCClusters,HcalFarForwardZDCRecHits,HcalFarForwardZDCSubcellHits -Pjana:nevents=$NEVENTS_REC
env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalFarForwardZDCClusters,HcalFarForwardZDCRecHits,HcalFarForwardZDCSubcellHits -Pjana:nevents={params.N_EVENTS}
"""
rule zdc_lambda_analysis:
......
......@@ -20,18 +20,24 @@ rule zdc_lyso_sim:
input:
hepmcfile="data/{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.hepmc",
warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
geometry_lib=find_epic_libraries(),
output:
"sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.root",
log:
"sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.edm4hep.root.log",
params:
num_events=1000,
DETECTOR_PATH=os.environ["DETECTOR_PATH"],
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
DD4HEP_HASH=get_spack_package_hash("dd4hep"),
NPSIM_HASH=get_spack_package_hash("npsim"),
cache: True
shell:
"""
npsim \
--runType batch \
-v WARNING \
--compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
--compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
--numberOfEvents {params.num_events} \
--inputFiles {input.hepmcfile} \
--outputFile {output}
......@@ -45,10 +51,14 @@ rule zdc_lyso_reco:
"sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.tree.edm4eic.root",
log:
"sim_output/zdc_lyso/{DETECTOR_CONFIG}_{PARTICLE}_{BEAM_ENERGY}GeV_theta_{THETA_MIN}deg_thru_{THETA_MAX}deg.eicrecon.tree.edm4eic.root.log",
params:
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
EICRECON_HASH=get_spack_package_hash("eicrecon"),
cache: True
shell:
"""
eicrecon -Ppodio:output_collections=HcalFarForwardZDCRawHits,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,EcalFarForwardZDCRawHits,EcalFarForwardZDCRecHits,EcalFarForwardZDCClusters,MCParticles {input}
mv podio_output.root {output}
env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
eicrecon -Ppodio:output_file={output} -Ppodio:output_collections=HcalFarForwardZDCRawHits,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,EcalFarForwardZDCRawHits,EcalFarForwardZDCRecHits,EcalFarForwardZDCClusters,MCParticles {input}
"""
......
......@@ -2,7 +2,7 @@ sim:zdc_neutron:
extends: .det_benchmark
stage: simulate
script:
- snakemake --cache --cores 1 sim_output/zdc_neutron/epic_craterlake/fwd_neutrons.edm4eic.root
- snakemake $SNAKEMAKE_FLAGS --cores 5 sim_output/zdc_neutron/epic_craterlake/fwd_neutrons.edm4eic.root
retry:
max: 2
when:
......@@ -14,7 +14,7 @@ bench:zdc_neutron:
needs:
- ["sim:zdc_neutron"]
script:
- snakemake --cores 1 results/zdc_neutron/epic_craterlake/fwd_neutrons_geant.pdf
- snakemake $SNAKEMAKE_FLAGS --cores 1 results/zdc_neutron/epic_craterlake/fwd_neutrons_geant.pdf
collect_results:zdc_neutron:
extends: .det_benchmark
......@@ -24,7 +24,7 @@ collect_results:zdc_neutron:
script:
- ls -lrht
- mv results{,_save}/ # move results directory out of the way to preserve it
- snakemake --cores 1 --delete-all-output results/zdc_neutron/epic_craterlake/fwd_neutrons_geant.pdf
- snakemake $SNAKEMAKE_FLAGS --cores 1 --delete-all-output results/zdc_neutron/epic_craterlake/fwd_neutrons_geant.pdf
- mv results{_save,}/
# convert to png
- |
......
rule zdc_photon_generate:
input:
script="benchmarks/zdc_photon/analysis/gen_particles.cxx",
output:
GEN_FILE="sim_output/zdc_photon/zdc_photon_{P}GeV.hepmc",
params:
th_max=0.23,
th_min=0
output:
GEN_FILE="sim_output/zdc_photon/zdc_photon_{P}GeV.hepmc"
th_min=0,
N_EVENTS=1000,
shell:
"""
NEVENTS_GEN=200
mkdir -p sim_output/zdc_photon
root -l -b -q '{input.script}('$NEVENTS_GEN',"{output.GEN_FILE}", "gamma", {params.th_min}, {params.th_max}, 0., 360., {wildcards.P})'
root -l -b -q '{input.script}('{params.N_EVENTS}',"{output.GEN_FILE}", "gamma", {params.th_min}, {params.th_max}, 0., 360., {wildcards.P})'
"""
rule zdc_photon_simulate:
input:
GEN_FILE="sim_output/zdc_photon/zdc_photon_{P}GeV.hepmc",
warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
params:
PHYSICS_LIST="FTFP_BERT"
geometry_lib=find_epic_libraries(),
output:
SIM_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_sim_zdc_photon_{P}GeV_{INDEX}.edm4hep.root"
SIM_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_sim_zdc_photon_{P}GeV_{INDEX}.edm4hep.root",
params:
N_EVENTS=200,
PHYSICS_LIST="FTFP_BERT",
DETECTOR_PATH=os.environ["DETECTOR_PATH"],
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
DD4HEP_HASH=get_spack_package_hash("dd4hep"),
NPSIM_HASH=get_spack_package_hash("npsim"),
cache: True
shell:
"""
# Running simulation
NEVENTS_SIM=200
npsim \
--compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
--compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
--physicsList {params.PHYSICS_LIST} \
--skipNEvents $(( $NEVENTS_SIM * {wildcards.INDEX} )) \
--numberOfEvents $NEVENTS_SIM \
--skipNEvents $(( {params.N_EVENTS} * {wildcards.INDEX} )) \
--numberOfEvents {params.N_EVENTS} \
--inputFiles {input.GEN_FILE} \
--outputFile {output.SIM_FILE}
"""
......@@ -39,10 +45,15 @@ rule zdc_photon_recon:
SIM_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_sim_zdc_photon_{P}GeV_{INDEX}.edm4hep.root"
output:
REC_FILE="sim_output/zdc_photon/{DETECTOR_CONFIG}_rec_zdc_photon_{P}GeV_{INDEX}.edm4eic.root"
params:
N_EVENTS=200,
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
EICRECON_HASH=get_spack_package_hash("eicrecon"),
cache: True
shell:
"""
NEVENTS_REC=200
eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_files=$DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml -Ppodio:output_collections=MCParticles,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,HcalFarForwardZDCSubcellHits -Pjana:nevents=$NEVENTS_REC
env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,HcalFarForwardZDCSubcellHits -Pjana:nevents={params.N_EVENTS}
"""
rule zdc_photon_analysis:
......
rule zdc_pi0_generate:
input:
script="benchmarks/zdc_pi0/analysis/gen_pi0_decay.cxx",
params:
NEVENTS_GEN=1000,
output:
GEN_FILE="sim_output/zdc_pi0/zdc_pi0_{P}GeV.hepmc"
GEN_FILE="sim_output/zdc_pi0/zdc_pi0_{P}GeV.hepmc",
params:
N_EVENTS=1000,
shell:
"""
mkdir -p sim_output/zdc_pi0
root -l -b -q '{input.script}({params.NEVENTS_GEN},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})'
root -l -b -q '{input.script}({params.N_EVENTS},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})'
"""
rule zdc_pi0_simulate:
input:
GEN_FILE="sim_output/zdc_pi0/zdc_pi0_{P}GeV.hepmc",
warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
params:
PHYSICS_LIST="FTFP_BERT"
geometry_lib=find_epic_libraries(),
output:
SIM_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_sim_zdc_pi0_{P}GeV_{INDEX}.edm4hep.root"
SIM_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_sim_zdc_pi0_{P}GeV_{INDEX}.edm4hep.root",
params:
N_EVENTS=200,
PHYSICS_LIST="FTFP_BERT",
DETECTOR_PATH=os.environ["DETECTOR_PATH"],
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
DD4HEP_HASH=get_spack_package_hash("dd4hep"),
NPSIM_HASH=get_spack_package_hash("npsim"),
cache: True
shell:
"""
NEVENTS_SIM=200
# Running simulation
npsim \
--compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
--skipNEvents $(( $NEVENTS_SIM * {wildcards.INDEX} )) \
--numberOfEvents $NEVENTS_SIM \
--compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
--skipNEvents $(( {params.N_EVENTS} * {wildcards.INDEX} )) \
--numberOfEvents {params.N_EVENTS} \
--physicsList {params.PHYSICS_LIST} \
--inputFiles {input.GEN_FILE} \
--outputFile {output.SIM_FILE}
......@@ -34,13 +40,18 @@ npsim \
rule zdc_pi0_recon:
input:
SIM_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_sim_zdc_pi0_{P}GeV_{INDEX}.edm4hep.root"
SIM_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_sim_zdc_pi0_{P}GeV_{INDEX}.edm4hep.root",
output:
REC_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_rec_zdc_pi0_{P}GeV_{INDEX}.edm4eic.root"
REC_FILE="sim_output/zdc_pi0/{DETECTOR_CONFIG}_rec_zdc_pi0_{P}GeV_{INDEX}.edm4eic.root",
params:
N_EVENTS=200,
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
EICRECON_HASH=get_spack_package_hash("eicrecon"),
cache: True
shell:
"""
NEVENTS_REC=200
eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_files=$DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml -Ppodio:output_collections=MCParticles,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,HcalFarForwardZDCSubcellHits -Pjana:nevents=$NEVENTS_REC
env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalFarForwardZDCRecHits,HcalFarForwardZDCClusters,HcalFarForwardZDCSubcellHits -Pjana:nevents={params.N_EVENTS}
"""
rule zdc_pi0_analysis:
......
rule zdc_sigma_generate:
input:
script="benchmarks/zdc_sigma/analysis/gen_sigma_decay.cxx",
params:
NEVENTS_GEN=100000,
output:
GEN_FILE="sim_output/zdc_sigma/sigma_decay_{P}GeV.hepmc"
GEN_FILE="sim_output/zdc_sigma/sigma_decay_{P}GeV.hepmc",
params:
N_EVENTS=100000,
shell:
"""
root -l -b -q '{input.script}({params.NEVENTS_GEN},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})'
root -l -b -q '{input.script}({params.N_EVENTS},0,"{output.GEN_FILE}",{wildcards.P},{wildcards.P})'
"""
rule zdc_sigma_simulate:
input:
GEN_FILE="sim_output/zdc_sigma/sigma_decay_{P}GeV.hepmc",
warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
params:
PHYSICS_LIST="FTFP_BERT"
geometry_lib=find_epic_libraries(),
output:
SIM_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_sim_sigma_dec_{P}GeV_{INDEX}.edm4hep.root"
SIM_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_sim_sigma_dec_{P}GeV_{INDEX}.edm4hep.root",
params:
N_EVENTS=200,
PHYSICS_LIST="FTFP_BERT",
DETECTOR_PATH=os.environ["DETECTOR_PATH"],
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
DD4HEP_HASH=get_spack_package_hash("dd4hep"),
NPSIM_HASH=get_spack_package_hash("npsim"),
cache: True
shell:
"""
NEVENTS_SIM=200
# Running simulation
npsim \
--compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
--skipNEvents $(( $NEVENTS_SIM * {wildcards.INDEX} )) \
--numberOfEvents $NEVENTS_SIM \
--compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
--skipNEvents $(( {params.N_EVENTS} * {wildcards.INDEX} )) \
--numberOfEvents {params.N_EVENTS} \
--physicsList {params.PHYSICS_LIST} \
--inputFiles {input.GEN_FILE} \
--outputFile {output.SIM_FILE}
......@@ -33,13 +39,18 @@ npsim \
rule zdc_sigma_recon:
input:
SIM_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_sim_sigma_dec_{P}GeV_{INDEX}.edm4hep.root"
SIM_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_sim_sigma_dec_{P}GeV_{INDEX}.edm4hep.root",
output:
REC_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_rec_sigma_dec_{P}GeV_{INDEX}.edm4eic.root"
REC_FILE="sim_output/zdc_sigma/{DETECTOR_CONFIG}_rec_sigma_dec_{P}GeV_{INDEX}.edm4eic.root",
params:
N_EVENTS=200,
DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
EICRECON_HASH=get_spack_package_hash("eicrecon"),
cache: True
shell:
"""
NEVENTS_REC=200
eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Pdd4hep:xml_files=$DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml -Ppodio:output_collections=MCParticles,HcalFarForwardZDCClusters,HcalFarForwardZDCRecHits,HcalFarForwardZDCSubcellHits -Pjana:nevents=$NEVENTS_REC
env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalFarForwardZDCClusters,HcalFarForwardZDCRecHits,HcalFarForwardZDCSubcellHits -Pjana:nevents={params.N_EVENTS}
"""
rule zdc_sigma_analysis:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment