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 "benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis_cxx.so",
0020 "benchmarks/tracking_performances_dis/analysis/vtx_dis_plots_cxx.so",
0021
0022 # Process the generated HepMC files through the simulation
0023 rule trk_dis_sim:
0024 input:
0025 warmup="warmup/{DETECTOR_CONFIG}.edm4hep.root",
0026 output:
0027 "sim_output/tracking_performances_dis/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_{INDEX}.edm4hep.root",
0028 params:
0029 N_EVENTS=200,
0030 shell:
0031 """
0032 ddsim \
0033 --runType batch \
0034 --part.minimalKineticEnergy 1000*GeV \
0035 --filter.tracker edep0 \
0036 -v WARNING \
0037 --numberOfEvents {params.N_EVENTS} \
0038 --compactFile $DETECTOR_PATH/{wildcards.DETECTOR_CONFIG}.xml \
0039 --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 \
0040 --outputFile {output}
0041 """
0042
0043 # Process the files produced in the previous step through EICRecon
0044 rule trk_dis_reco:
0045 input:
0046 "sim_output/tracking_performances_dis/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_{INDEX}.edm4hep.root",
0047 output:
0048 "sim_output/tracking_performances_dis/{DETECTOR_CONFIG}/pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_{INDEX}.edm4eic.root",
0049 shell:
0050 """
0051 set -m # monitor mode to prevent lingering processes
0052 exec env DETECTOR_CONFIG={wildcards.DETECTOR_CONFIG} \
0053 eicrecon {input} -Ppodio:output_file={output} \
0054 -Ppodio:output_collections=MCParticles,ReconstructedChargedParticles,ReconstructedTruthSeededChargedParticles,CentralCKFTrackAssociations,CentralCKFTruthSeededTrackAssociations,CentralTrackVertices
0055 """
0056
0057 # Process the files -- either from the campaign or local running -- through the analysis script
0058 rule dis_analysis:
0059 input:
0060 script_trk="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis.cxx",
0061 script_trk_compiled="benchmarks/tracking_performances_dis/analysis/trk_dis_analysis_cxx.so",
0062 script_vtx="benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis.cxx",
0063 script_vtx_compiled="benchmarks/tracking_performances_dis/analysis/vtx_dis_analysis_cxx.so",
0064 data="sim_output/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_beamEffects_xAngle=-0.025_hiDiv_{INDEX}.edm4eic.root",
0065 output:
0066 config_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/config.json",
0067 hists_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/hists.root",
0068 config_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/config.json",
0069 hists_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_{INDEX}/hists.root",
0070 wildcard_constraints:
0071 PREFIX= ".*",
0072 EBEAM=r"\d+",
0073 PBEAM=r"\d+",
0074 MINQ2=r"\d+",
0075 INDEX=r"\d+",
0076 shell:
0077 """
0078 cat > {output.config_trk} <<EOF
0079 {{
0080 "rec_file": "{input.data}",
0081 "detector": "{wildcards.DETECTOR_CONFIG}",
0082 "ebeam": {wildcards.EBEAM},
0083 "pbeam": {wildcards.PBEAM},
0084 "Min_Q2": {wildcards.MINQ2},
0085 "output_prefix": "$(dirname "{output.hists_trk}")/hists"
0086 }}
0087 EOF
0088 root -l -b -q '{input.script_trk}+("{output.config_trk}")'
0089
0090 cat > {output.config_vtx} <<EOF
0091 {{
0092 "rec_file": "{input.data}",
0093 "detector": "{wildcards.DETECTOR_CONFIG}",
0094 "ebeam": {wildcards.EBEAM},
0095 "pbeam": {wildcards.PBEAM},
0096 "Min_Q2": {wildcards.MINQ2},
0097 "output_prefix": "$(dirname "{output.hists_vtx}")/hists"
0098 }}
0099 EOF
0100 root -l -b -q '{input.script_vtx}+("{output.config_vtx}")'
0101 """
0102
0103 #Merge all the files produced in the previous step
0104 rule dis_combine:
0105 input:
0106 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)],
0107 lambda wildcards: [f"results/vertexing_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)],
0108 output:
0109 config_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
0110 hists_trk="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/hists.root",
0111 config_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
0112 hists_vtx="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/hists.root",
0113 wildcard_constraints:
0114 PREFIX= ".*",
0115 EBEAM=r"\d+",
0116 PBEAM=r"\d+",
0117 MINQ2=r"\d+",
0118 NUM_FILES=r"\d+",
0119 shell:
0120 """
0121 cat > {output.config_trk} <<EOF
0122 {{
0123 "hists_file": "{output.hists_trk}",
0124 "detector": "{wildcards.DETECTOR_CONFIG}",
0125 "ebeam": {wildcards.EBEAM},
0126 "pbeam": {wildcards.PBEAM},
0127 "Min_Q2": {wildcards.MINQ2},
0128 "nfiles": {wildcards.NUM_FILES},
0129 "output_prefix": "$(dirname "{output.hists_trk}")/plots"
0130 }}
0131 EOF
0132 hadd {output.hists_trk} {input}
0133
0134 cat > {output.config_vtx} <<EOF
0135 {{
0136 "hists_file": "{output.hists_vtx}",
0137 "detector": "{wildcards.DETECTOR_CONFIG}",
0138 "ebeam": {wildcards.EBEAM},
0139 "pbeam": {wildcards.PBEAM},
0140 "Min_Q2": {wildcards.MINQ2},
0141 "nfiles": {wildcards.NUM_FILES},
0142 "output_prefix": "$(dirname "{output.hists_vtx}")/plots"
0143 }}
0144 EOF
0145 hadd {output.hists_vtx} {input}
0146 """
0147
0148 #Process the merged file through the plotting script
0149 rule trk_dis_plots:
0150 input:
0151 script="benchmarks/tracking_performances_dis/analysis/trk_dis_plots.cxx",
0152 script_compiled="benchmarks/tracking_performances_dis/analysis/trk_dis_plots_cxx.so",
0153 config="results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
0154 output:
0155 "results/tracking_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/plots.pdf"
0156 wildcard_constraints:
0157 PREFIX= ".*",
0158 EBEAM=r"\d+",
0159 PBEAM=r"\d+",
0160 MINQ2=r"\d+",
0161 NUM_FILES=r"\d+",
0162 shell:
0163 """
0164 root -l -b -q '{input.script}+("{input.config}")'
0165 """
0166
0167 rule vtx_dis_plots:
0168 input:
0169 script="benchmarks/tracking_performances_dis/analysis/vtx_dis_plots.cxx",
0170 script_compiled="benchmarks/tracking_performances_dis/analysis/vtx_dis_plots_cxx.so",
0171 config="results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/config.json",
0172 output:
0173 "results/vertexing_performances_dis/{DETECTOR_CONFIG}/{PREFIX}pythia8NCDIS_{EBEAM}x{PBEAM}_minQ2={MINQ2}_combined_{NUM_FILES}/plots.pdf"
0174 wildcard_constraints:
0175 PREFIX= ".*",
0176 EBEAM=r"\d+",
0177 PBEAM=r"\d+",
0178 MINQ2=r"\d+",
0179 NUM_FILES=r"\d+",
0180 shell:
0181 """
0182 root -l -b -q '{input.script}+("{input.config}")'
0183 """
0184
0185 #Examples of invocation
0186 rule trk_dis_run_locally:
0187 input:
0188 "results/tracking_performances_dis/" + os.environ["DETECTOR_CONFIG"] + "/pythia8NCDIS_18x275_minQ2=1_combined_5/plots.pdf",
0189 message:
0190 "See output in {input[0]}"
0191
0192 rule vtx_dis_run_locally:
0193 input:
0194 "results/vertexing_performances_dis/" + os.environ["DETECTOR_CONFIG"] + "/pythia8NCDIS_18x275_minQ2=1_combined_5/plots.pdf",
0195 message:
0196 "See output in {input[0]}"
0197
0198
0199 rule trk_dis_run_locally_trk_only:
0200 input:
0201 "results/tracking_performances_dis/epic_craterlake_tracking_only/pythia8NCDIS_18x275_minQ2=1_combined_5/plots.pdf",
0202 message:
0203 "See output in {input[0]}"
0204
0205
0206 rule vtx_dis_run_locally_trk_only:
0207 input:
0208 "results/vertexing_performances_dis/epic_craterlake_tracking_only/pythia8NCDIS_18x275_minQ2=1_combined_5/plots.pdf",
0209 message:
0210 "See output in {input[0]}"