Back to home page

EIC code displayed by LXR

 
 

    


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

0001 rule nhcal_pion_rejection_simulate:
0002     output:
0003         "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.root",
0004     params:
0005         N_EVENTS=1000,
0006         SEED=lambda wildcards: "1" + wildcards.INDEX,
0007         DETECTOR_PATH=os.environ["DETECTOR_PATH"],
0008         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0009         DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0010         NPSIM_HASH=get_spack_package_hash("npsim"),
0011     wildcard_constraints:
0012         INDEX = r"\d+",
0013     cache: True
0014     shell:
0015         """
0016 exec npsim \
0017     --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0018     --numberOfEvents {params.N_EVENTS} \
0019     --random.seed {params.SEED} \
0020     --enableGun \
0021     -v WARNING \
0022     --gun.particle pi- \
0023     --gun.thetaMin 120*degree \
0024     --gun.thetaMax 180*degree \
0025     --gun.distribution uniform \
0026     --gun.momentumMin "1*GeV" \
0027     --gun.momentumMax "18*GeV" \
0028     --outputFile {output}
0029 """
0030 
0031 rule nhcal_pion_rejection_recon:
0032     input:
0033         "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.edm4hep.root"
0034     output:
0035         "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.eicrecon.edm4hep.root"
0036     params:
0037         DETECTOR_CONFIG = lambda wildcards: wildcards.DETECTOR_CONFIG,
0038     cache: True
0039     shell: 
0040         """
0041 exec env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0042           eicrecon {input} \
0043           -Ppodio:output_file={output} \
0044           
0045 """
0046 
0047 rule nhcal_pion_rejection_combine:
0048     input:
0049         lambda wildcards: expand(
0050             "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}.{INDEX}.eicrecon.edm4hep.root",
0051             DETECTOR_CONFIG=wildcards.DETECTOR_CONFIG,
0052             INDEX=range(int(wildcards.N)),
0053         )
0054     output:
0055         "sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}_{N}files.eicrecon.edm4hep.root",
0056     wildcard_constraints:
0057         N = r"\d+",
0058     shell:
0059         """
0060 hadd -f {output} {input} 
0061 """
0062 
0063 rule nhcal_pion_rejection_analysis:
0064     input:
0065         combined="sim_output/nhcal_pion_rejection/sim_{DETECTOR_CONFIG}_{N}files.eicrecon.edm4hep.root",
0066         script="benchmarks/nhcal_pion_rejection/scripts/pion_rejection_analysis.cxx",
0067     output:
0068         png="results/nhcal_pion_rejection/analysis_{DETECTOR_CONFIG}_{N}files.png",
0069         pdf="results/nhcal_pion_rejection/analysis_{DETECTOR_CONFIG}_{N}files.pdf",
0070     params:
0071         DETECTOR_PATH   = os.environ["DETECTOR_PATH"],
0072         DETECTOR_CONFIG = lambda wildcards: f"{wildcards.DETECTOR_CONFIG}.xml",
0073     shell:
0074         """
0075     root -l -b -q '{input.script}+("{input.combined}","{output.pdf}","{output.png}","{params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}")'
0076 """