Warning, /detector_benchmarks/benchmarks/tracking_performances_dis/Snakefile is written in an unsupported language. File is not indexed.
0001 import os
0002
0003 rule compile_analysis:
0004 input:
0005 "{path}/{filename}.cxx",
0006 output:
0007 "{path}/{filename}_cxx.d",
0008 "{path}/{filename}_cxx.so",
0009 "{path}/{filename}_cxx_ACLiC_dict_rdict.pcm",
0010 shell:
0011 """
0012 root -l -b -q -e '.L {input}+'
0013 """
0014
0015 rule trk_dis_compile:
0016 input:
0017 "benchmarks/tracking_performances_dis/analysis/trk_dis_analysis_cxx.so",
0018 "benchmarks/tracking_performances_dis/analysis/trk_dis_plots_cxx.so"
0019
0020 # Process the generated HepMC files through the simulation
0021 rule trk_dis_sim:
0022 input:
0023 warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
0024 output:
0025 "sim_output/tracking_performances_dis/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_{INDEX}.edm4hep.root",
0026 params:
0027 N_EVENTS=200,
0028 shell:
0029 """
0030 ddsim \
0031 --runType batch \
0032 --part.minimalKineticEnergy 1000*GeV \
0033 --filter.tracker edep0 \
0034 -v WARNING \
0035 --numberOfEvents {params.N_EVENTS} \
0036 --compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
0037 --inputFiles root://dtn-eic.jlab.org//work/eic2/EPIC/EVGEN/DIS/NC/{wildcards.EBEAM}x{wildcards.PBEAM}/minQ2={wildcards.MINQ2}/pythia8NCDIS_{wildcards.EBEAM}x{wildcards.PBEAM}_minQ2={wildcards.MINQ2}_beamEffects_xAngle=-0.025_hiDiv_vtxfix_{wildcards.INDEX}.hepmc3.tree.root \
0038 --outputFile {output}
0039 """
0040
0041 # Process the files produced in the previous step through EICRecon
0042 rule trk_dis_reco:
0043 input:
0044 "sim_output/tracking_performances_dis/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_{INDEX}.edm4hep.root",
0045 output:
0046 "sim_output/tracking_performances_dis/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_{INDEX}.edm4eic.root",
0047 shell:
0048 """
0049 set -m # monitor mode to prevent lingering processes
0050 exec env DETECTOR_CONFIG={wildcards.DETECTOR_CONFIG} \
0051 eicrecon {input} -Ppodio:output_file={output} \
0052 -Ppodio:output_collections=MCParticles,ReconstructedChargedParticles,ReconstructedTruthSeededChargedParticles,CentralCKFTrackAssociations,CentralCKFTruthSeededTrackAssociations
0053 """
0054
0055 # Process the files -- either from the campaign or local running -- through the analysis script
0056 rule trk_dis_analysis:
0057 input:
0058 script="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis.cxx",
0059 script_compiled="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis_cxx.so",
0060 data="sim_output/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_{INDEX}.edm4eic.root",
0061 output:
0062 config="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/config.json",
0063 hists="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/hists.root",
0064 wildcard_constraints:
0065 PREFIX= ".*",
0066 EBEAM="\d+",
0067 PBEAM="\d+",
0068 MINQ2="\d+",
0069 INDEX="\d+",
0070 shell:
0071 """
0072 cat > {output.config} <<EOF
0073 {{
0074 "rec_file": "{input.data}",
0075 "detector": "{wildcards.DETECTOR_CONFIG}",
0076 "ebeam": {wildcards.EBEAM},
0077 "pbeam": {wildcards.PBEAM},
0078 "Min_Q2": {wildcards.MINQ2},
0079 "output_prefix": "$(dirname "{output.hists}")/hists"
0080 }}
0081 EOF
0082 root -l -b -q '{input.script}+("{output.config}")'
0083 """
0084
0085 #Merge all the files produced in the previous step
0086 rule trk_dis_combine:
0087 input:
0088 lambda wildcards: [f"results/tracking_performances_dis/{wildcards.DETECTOR_CONFIG}/{wildcards.PREFIX}pythia8NCDIS_{wildcards.EBEAM}x{wildcards.PBEAM}_minQ2={wildcards.MINQ2}_{ix}/hists.root" for ix in range(1,int(wildcards.NUM_FILES)+1)],
0089 output:
0090 config="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
0091 hists="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/hists.root",
0092 wildcard_constraints:
0093 PREFIX= ".*",
0094 EBEAM="\d+",
0095 PBEAM="\d+",
0096 MINQ2="\d+",
0097 NUM_FILES="\d+",
0098 shell:
0099 """
0100 cat > {output.config} <<EOF
0101 {{
0102 "hists_file": "{output.hists}",
0103 "detector": "{wildcards.DETECTOR_CONFIG}",
0104 "ebeam": {wildcards.EBEAM},
0105 "pbeam": {wildcards.PBEAM},
0106 "Min_Q2": {wildcards.MINQ2},
0107 "nfiles": {wildcards.NUM_FILES},
0108 "output_prefix": "$(dirname "{output.hists}")/plots"
0109 }}
0110 EOF
0111 hadd {output.hists} {input}
0112 """
0113
0114 #Process the merged file through the plotting script
0115 rule trk_dis_plots:
0116 input:
0117 script="benchmarks/tracking_performances_dis/analysis/trk_dis_plots.cxx",
0118 script_compiled="benchmarks/tracking_performances_dis/analysis/trk_dis_plots_cxx.so",
0119 config="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
0120 output:
0121 "results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/plots.pdf"
0122 wildcard_constraints:
0123 PREFIX= ".*",
0124 EBEAM="\d+",
0125 PBEAM="\d+",
0126 MINQ2="\d+",
0127 NUM_FILES="\d+",
0128 shell:
0129 """
0130 root -l -b -q '{input.script}+("{input.config}")'
0131 """
0132
0133
0134 #Examples of invocation
0135 rule trk_dis_run_locally:
0136 input:
0137 "results/tracking_performances_dis/" + os.environ["DETECTOR_CONFIG"] + "/pythia8NCDIS_18x275_minQ2=1_combined_5/plots.pdf",
0138 message:
0139 "See output in {input[0]}"
0140
0141
0142 rule trk_dis_run_locally_trk_only:
0143 input:
0144 "results/tracking_performances_dis/epic_craterlake_tracking_only/pythia8NCDIS_18x275_minQ2=1_combined_5/plots.pdf",
0145 message:
0146 "See output in {input[0]}"
0147
0148