Back to home page

EIC code displayed by LXR

 
 

    


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

0001 rule insert_neutron_generate:
0002     input:
0003         script="benchmarks/insert_neutron/analysis/gen_particles.cxx",
0004     output:
0005         GEN_FILE="sim_output/insert_neutron/neutron_{P}GeV.hepmc",
0006     params:
0007         NEVENTS_GEN=1000,
0008         th_max=5.7,
0009         th_min=2.0,
0010         P=lambda wildcards: wildcards.P,
0011     shell:
0012         """
0013 mkdir -p sim_output/insert_neutron
0014 root -l -b -q '{input.script}({params.NEVENTS_GEN},"{output.GEN_FILE}", "neutron", {params.th_min}, {params.th_max}, 0., 360., {params.P})'
0015 """
0016 
0017 rule insert_neutron_simulate:
0018     input:
0019         GEN_FILE="sim_output/insert_neutron/neutron_{P}GeV.hepmc",
0020         warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
0021         geometry_lib=find_epic_libraries(),
0022     output:
0023         SIM_FILE="sim_output/insert_neutron/{DETECTOR_CONFIG}_sim_neutron_{P}GeV_{INDEX}.edm4hep.root",
0024     params:
0025         INDEX=lambda wildcards: wildcards.INDEX,
0026         PHYSICS_LIST="FTFP_BERT",
0027         DETECTOR_PATH=os.environ["DETECTOR_PATH"],
0028         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0029         DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0030         NPSIM_HASH=get_spack_package_hash("npsim"),
0031     cache: True
0032     shell:
0033         """
0034 NEVENTS_SIM=200
0035 # Running simulation
0036 npsim \
0037    --compactFile {params.DETECTOR_PATH}/{params.DETECTOR_CONFIG}.xml \
0038    --skipNEvents $(( $NEVENTS_SIM * {params.INDEX} )) \
0039    --numberOfEvents $NEVENTS_SIM \
0040    --physicsList {params.PHYSICS_LIST} \
0041    --inputFiles {input.GEN_FILE} \
0042    --outputFile {output.SIM_FILE}
0043 """
0044 
0045 rule insert_neutron_recon:
0046     input:
0047         SIM_FILE="sim_output/insert_neutron/{DETECTOR_CONFIG}_sim_neutron_{P}GeV_{INDEX}.edm4hep.root",
0048     output:
0049         REC_FILE="sim_output/insert_neutron/{DETECTOR_CONFIG}_rec_neutron_{P}GeV_{INDEX}.edm4eic.root",
0050     params:
0051         DETECTOR_CONFIG=lambda wildcards: wildcards.DETECTOR_CONFIG,
0052         EICRECON_HASH=get_spack_package_hash("eicrecon"),
0053     cache: True
0054     shell:
0055         """
0056 NEVENTS_REC=200
0057 env DETECTOR_CONFIG={params.DETECTOR_CONFIG} \
0058   eicrecon {input.SIM_FILE} -Ppodio:output_file={output.REC_FILE} -Ppodio:output_collections=MCParticles,HcalEndcapPInsertRecHits,HcalEndcapPInsertClusters,HcalEndcapPInsertSubcellHits,EcalEndcapPInsertRecHits,EcalEndcapPInsertClusters  -Pjana:nevents=$NEVENTS_REC
0059 """
0060 
0061 rule insert_neutron_analysis:
0062     input:
0063         expand("sim_output/insert_neutron/{DETECTOR_CONFIG}_rec_neutron_{P}GeV_{INDEX}.edm4eic.root",
0064             P=[20, 30, 40, 50, 60, 70, 80],
0065             DETECTOR_CONFIG=["{DETECTOR_CONFIG}"],
0066             INDEX=range(5),
0067         ),
0068         script="benchmarks/insert_neutron/analysis/neutron_plots.py",
0069     output:
0070         results_dir=directory("results/{DETECTOR_CONFIG}/insert_neutron"),
0071     shell:
0072         """
0073 mkdir -p {output.results_dir}
0074 python {input.script} {output.results_dir}
0075 """