Back to home page

EIC code displayed by LXR

 
 

    


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

0001 SIMOUTDIR="sim_output/beamline/"
0002 ANALYSISDIR=SIMOUTDIR+"analysis/"
0003 
0004 ##########################################################################################
0005 ### Rules for checking the steering of the electron beam through the magnets
0006 ##########################################################################################
0007 
0008 rule beamline_steering_sim:
0009     input:
0010         warmup="warmup.edm4hep.root",
0011         macro=workflow.source_path("beamlineGPS.mac"),
0012         geometry_lib=find_epic_libraries(),
0013     output:
0014         SIMOUTDIR+"beamlineTest{CAMPAIGN}.edm4hep.rnt.root",
0015     params:
0016         DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0017         NPSIM_HASH=get_spack_package_hash("npsim"),
0018     cache: True
0019     singularity: EIC_SINGULARITY_CONTAINER,
0020     shell:
0021         """
0022             exec npsim \
0023             --runType run \
0024             --random.seed 1 \
0025             --enableG4GPS \
0026             --macroFile {input.macro} \
0027             --compactFile $DETECTOR_PATH/epic_ip6_extended.xml \
0028             --printLevel WARNING \
0029             --outputConfig.useRNTuple true \
0030             --outputFile {output} \
0031             --physics.rangecut 100*m
0032         """
0033 
0034 rule beamline_steering_analysis:
0035     input:
0036         warmup="warmup.edm4hep.root",
0037         script=workflow.source_path("beamlineAnalysis.C"),
0038         header=workflow.source_path("shared_functions.h"),
0039         data=SIMOUTDIR+"beamlineTest{CAMPAIGN}.edm4hep.rnt.root",
0040     output:
0041         rootfile=ANALYSISDIR+"beamlineTestAnalysis{CAMPAIGN}.root",
0042         beamspot_canvas=ANALYSISDIR+"beamspot_{CAMPAIGN}.png",
0043         x_px_canvas=ANALYSISDIR+"x_px_{CAMPAIGN}.png",
0044         y_py_canvas=ANALYSISDIR+"y_py_{CAMPAIGN}.png",
0045         fitted_position_means_stdevs_canvas=ANALYSISDIR+"fitted_position_means_stdevs_{CAMPAIGN}.png",
0046         fitted_momentum_means_stdevs_canvas=ANALYSISDIR+"fitted_momentum_means_stdevs_{CAMPAIGN}.png",
0047         pipe_parameter_canvas=ANALYSISDIR+"pipe_parameter_{CAMPAIGN}.png",
0048     params:
0049         xml=os.getenv("DETECTOR_PATH")+"/epic_ip6_extended.xml",
0050     singularity: EIC_SINGULARITY_CONTAINER,
0051     shell:
0052         """
0053             root -l -b -q '{input.script}+("{input.data}", "{output.rootfile}", "{params.xml}",
0054             "{output.beamspot_canvas}", "{output.x_px_canvas}", "{output.y_py_canvas}",
0055             "{output.fitted_position_means_stdevs_canvas}", "{output.fitted_momentum_means_stdevs_canvas}",
0056             "{output.pipe_parameter_canvas}")'
0057         """
0058 
0059 ##########################################################################################
0060 ### Rules for checking the acceptance of electrons at each stage of the beamline
0061 ##########################################################################################
0062 
0063 rule beamline_acceptance_sim:
0064     input:
0065         warmup="warmup.edm4hep.root",
0066         macro=workflow.source_path("acceptanceGPS.mac"),
0067         geometry_lib=find_epic_libraries(),
0068     output:
0069         SIMOUTDIR+"acceptanceTest{CAMPAIGN}.edm4hep.rnt.root",
0070     params:
0071         DD4HEP_HASH=get_spack_package_hash("dd4hep"),
0072         NPSIM_HASH=get_spack_package_hash("npsim"),
0073     cache: True
0074     singularity: EIC_SINGULARITY_CONTAINER,
0075     shell:
0076         """
0077             exec npsim \
0078             --runType run \
0079             --random.seed 1 \
0080             --enableG4GPS \
0081             --macroFile {input.macro} \
0082             --compactFile $DETECTOR_PATH/epic_ip6_extended.xml \
0083             --printLevel WARNING \
0084             --outputConfig.useRNTuple true \
0085             --outputFile {output} \
0086             --physics.rangecut 100*m
0087         """
0088 
0089 rule beamline_acceptance_analysis:
0090     input:
0091         warmup="warmup.edm4hep.root",
0092         script=workflow.source_path("acceptanceAnalysis.C"),
0093         header=workflow.source_path("shared_functions.h"),
0094         data=SIMOUTDIR+"acceptanceTest{CAMPAIGN}.edm4hep.rnt.root",
0095     output:
0096         rootfile=ANALYSISDIR+"acceptanceTestAnalysis{CAMPAIGN}.root",
0097         beampipe_canvas=ANALYSISDIR+"acceptance_in_beampipe_{CAMPAIGN}.png",
0098         etheta_canvas=ANALYSISDIR+"acceptance_energy_theta_{CAMPAIGN}.png",
0099         etheta_acceptance_canvas=ANALYSISDIR+"acceptance_energy_theta_acceptance_{CAMPAIGN}.png",
0100         entries_canvas=ANALYSISDIR+"acceptance_entries_{CAMPAIGN}.png",
0101     params:
0102         xml=os.getenv("DETECTOR_PATH")+"/epic_ip6_extended.xml",
0103     singularity: EIC_SINGULARITY_CONTAINER,
0104     shell:
0105         """
0106             root -l -b -q '{input.script}+("{input.data}", "{output.rootfile}", "{params.xml}", "{output.beampipe_canvas}","{output.etheta_canvas}","{output.etheta_acceptance_canvas}",
0107             "{output.entries_canvas}")'
0108         """
0109 
0110 ##########################################################################################
0111 # Combine results
0112 ##########################################################################################
0113 rule beamline:
0114     input:
0115         ANALYSISDIR+"beamlineTestAnalysis{CAMPAIGN}.root",
0116         ANALYSISDIR+"beamspot_{CAMPAIGN}.png",
0117         ANALYSISDIR+"x_px_{CAMPAIGN}.png",
0118         ANALYSISDIR+"y_py_{CAMPAIGN}.png",
0119         ANALYSISDIR+"fitted_position_means_stdevs_{CAMPAIGN}.png",
0120         ANALYSISDIR+"fitted_momentum_means_stdevs_{CAMPAIGN}.png",
0121         ANALYSISDIR+"pipe_parameter_{CAMPAIGN}.png",
0122         ANALYSISDIR+"acceptanceTestAnalysis{CAMPAIGN}.root",
0123         ANALYSISDIR+"acceptance_in_beampipe_{CAMPAIGN}.png",
0124         ANALYSISDIR+"acceptance_energy_theta_{CAMPAIGN}.png",
0125         ANALYSISDIR+"acceptance_energy_theta_acceptance_{CAMPAIGN}.png",
0126         ANALYSISDIR+"acceptance_entries_{CAMPAIGN}.png"
0127     output:
0128         directory("results/beamline/steering_{CAMPAIGN}/")
0129     singularity: EIC_SINGULARITY_CONTAINER,
0130     shell:
0131         """
0132             mkdir {output}
0133             cp -r {input} {output}
0134         """
0135 
0136 ##########################################################################################
0137 # Defualt running
0138 ##########################################################################################
0139 rule beamline_local:
0140     input:
0141         "results/beamline/steering_local/"