Back to home page

EIC code displayed by LXR

 
 

    


Warning, /tutorial-developing-benchmarks/episodes/05-making_useful_figures.md is written in an unsupported language. File is not indexed.

0001 ---
0002 title: "Exercise 5: Making Useful Figures"
0003 teaching: 10
0004 exercises: 10
0005 ---
0006 
0007 ::::::::::::::::::::::::::::::::::::::::::::::: questions
0008 
0009 - How does one make useful benchmark figures?
0010 
0011 :::::::::::::::::::::::::::::::::::::::::::::::
0012 
0013 ::::::::::::::::::::::::::::::::::::::::::::::: objectives
0014 
0015 - Learn what information is useful to ePIC in developing benchmark artifacts and figures
0016 
0017 :::::::::::::::::::::::::::::::::::::::::::::::
0018 
0019 We've discussed how to plug your analysis script into GitLab's CI, and monitor it using pipelines. We'll now briefly discuss how to make figures for your benchmark that are useful to both yourself and to others. 
0020 
0021 ## Making benchmark figures
0022 
0023 The plots created in a benchmark should be designed to be legible not only to yourself, but to those working on detector and software development. This means benchmark plots should be clearly labeled with
0024 
0025 - beam settings if any (ep, eAu, ... and \(5 \times 41\), \(10 \times 100\) GeV, ...)
0026 - event generator used
0027 - kinematic cuts ($x$, $Q^2$, $W$)
0028 - EPIC label
0029 - legible axis labels
0030 
0031 Ideally, benchmark designers should aim to design paper-ready figures labeled with large clear text and a [perceptual color palette](https://root.cern/blog/rainbow-color-map/). Remember that we want to create figures that can be used as-is in the TDR, in conference presentations, and in evaluating detector and software performance.
0032 
0033 An example figure from the u-channel rho benchmark is shown here:
0034 
0035 <img src="fig/example_benchfig.png" alt="Example benchmark figure" width="800" style="box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);">
0036 
0037 In this example, the plot is labeled with the collision system and other details:
0038 
0039 ```c++
0040 TLatex* beamLabel       = new TLatex(0.18, 0.91, "ep 10#times100 GeV");
0041 TLatex* epicLabel       = new TLatex(0.9,0.91, "#bf{EPIC}");
0042 TLatex* kinematicsLabel = new TLatex(0.53, 0.78, "10^{-3}<Q^{2}<10 GeV^{2}, W>2 GeV");
0043 TLatex* generatorLabel  = new TLatex(0.5, 0.83, ""+vm_label+" #rightarrow "+daug_label+" eSTARlight");
0044 ```
0045 
0046 The axis labels and titles were scaled for clarity:
0047 
0048 ```c++
0049 histogram->GetYaxis()->SetTitleSize(histogram->GetYaxis()->GetTitleSize()*1.5);
0050 histogram->GetYaxis()->SetLabelSize(histogram->GetYaxis()->GetLabelSize()*1.5);
0051 ```
0052 
0053 The number of axis divisions was decreased to reduce visual clutter:
0054 
0055 ```c++
0056 histogram->GetXaxis()->SetNdivisions(5);
0057 ```
0058 
0059 And margins were increased to allow for more space for larger axis labels:
0060 
0061 ```c++
0062 virtualPad->SetBottomMargin(0.2);
0063 ```
0064 
0065 ## Describing your benchmark figures
0066 
0067 Even a well-labeled figure will still be ambiguous as to what is being plotted. For example, how you define efficiency may differ from another analyzer. It will be useful to include with your benchmark an explainer of each of the various plots that are produced:
0068 
0069 <img src="fig/benchmarkplots_explained.png" alt="Benchmark explainer" width="800" style="box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);">
0070 
0071 This document may be written in LaTeX, exported as a PDF, and then uploaded to [GitHub under your benchmark](https://github.com/eic/physics_benchmarks/blob/pr/u_channel_sweger/benchmarks/u_rho/BenchmarkPlotsExplained.pdf).
0072 
0073 The way most users will interact with your benchmark is at the level of the artifacts it produces. When others are looking through the plots produced by your benchmark, this description of your figures should be readily available as an artifact itself. To achieve this, you can use this template tex document:
0074 
0075 ```tex
0076 %====================================================================%
0077 %                  BENCH.TEX                                       %
0078 %           Written by YOUR NAME                                   %
0079 %====================================================================%
0080 \documentclass{bench}
0081 
0082 % A useful Journal macro
0083 \def\Journal#1#2#3#4{{#1} {\bf #2}, #3 (#4)}
0084 \NewDocumentCommand{\codeword}{v}{\texttt{\textcolor{black}{#1}}}
0085 % Some other macros used in the sample text
0086 \def\st{\scriptstyle}
0087 \def\sst{\scriptscriptstyle}
0088 \def\epp{\epsilon^{\prime}}
0089 \def\vep{\varepsilon}
0090 \def\vp{{\bf p}}
0091 \def\be{\begin{equation}}
0092 \def\ee{\end{equation}}
0093 \def\bea{\begin{eqnarray}}
0094 \def\eea{\end{eqnarray}}
0095 \def\CPbar{\hbox{{\rm CP}\hskip-1.80em{/}}}
0096 
0097 \begin{document}
0098 \title{YOUR BENCHMARK NAME Benchmark Figures}
0099 \maketitle
0100 
0101 \codeword{benchmark_plot1.pdf}:
0102 This figure shows...
0103 
0104 \end{document}
0105 ```
0106 
0107 Create this `bench.tex` file at the top of your benchmark (`physics_benchmarks/benchmarks/your_bench/`). Also copy [`bench.cls`](files/bench.cls) to the same location to define the `bench` document class.
0108 
0109 Finally, add a rule to the `Snakefile` to compile the tex file, and create output in the `results` directory. This ensures the resulting pdf will be included as an artifact.
0110 
0111 ```snakemake
0112 rule yourbench_compile_manual:
0113     input:
0114         cls=workflow.source_path("bench.cls"),
0115         tex=workflow.source_path("bench.tex"),
0116     output:
0117         temp("tectonic"),
0118         cls_tmp=temp("bench.cls"),
0119         pdf="results/bench.pdf",
0120     shell: """
0121 wget https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%400.15.0/tectonic-0.15.0-x86_64-unknown-linux-musl.tar.gz
0122 tar zxf tectonic-0.15.0-x86_64-unknown-linux-musl.tar.gz
0123 cp {input.cls} {output.cls_tmp} # copy to local directory
0124 ./tectonic {input.tex} --outdir="$(dirname {output.pdf})"
0125 """
0126 ```
0127 
0128 And make sure that the `your_benchmark:results` job in your `config.yml` calls the snakemake compilation rule:
0129 
0130 ```yaml
0131     - snakemake --cores 1 yourbench_compile_manual
0132 ```
0133 
0134 After pushing these changes, check [GitLab's pipelines](https://eicweb.phy.anl.gov/EIC/benchmarks/physics_benchmarks/-/pipelines). View the artifacts for this push, and make sure `bench.pdf` is visible in the `results` directory:
0135 
0136 <img src="fig/benchmark_explainer_artifact.png" alt="Benchmark explainer artifact" width="1000" style="box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);">
0137 
0138 ## Conclusion
0139 
0140 We've discussed ways to make benchmark figures legible and useful to others.
0141 
0142 Analyzers should aim to make paper-ready figures that others can use and easily understand.
0143 
0144 Analyzers should consider including an explainer artifact which describes each figure in detail. To do this:
0145 
0146 - Copy [`bench.tex`](files/bench.tex) and [`bench.cls`](files/bench.cls) to your benchmark: `physics_benchmarks/benchmarks/your_bench/`
0147 - Edit `bench.tex` with descriptions of each benchmark figure
0148 - Add a rule (shown above) to your `Snakefile` to compile `bench.tex`
0149 - Check [GitLab's pipelines](https://eicweb.phy.anl.gov/EIC/benchmarks/physics_benchmarks/-/pipelines) for the pdf.
0150 
0151 ::::::::::::::::::::::::::::::::::::::::::::::: keypoints
0152 
0153 - Create paper-ready benchmark figures whenever possible
0154 - Clearly label plots with simulation details, and large axis labels and legends
0155 - If possible, augment the benchmark with an additional explainer document which describes figures in greater detail
0156 
0157 :::::::::::::::::::::::::::::::::::::::::::::::