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 questions:
0006 - "How does one make useful benchmark figures?"
0007 objectives:
0008 - "Learn what information is useful to ePIC in developing benchmark artifacts and figures"
0009 keypoints:
0010 - "Create paper-ready benchmark figures whenever possible"
0011 - "Clearly label plots with simulation details, and large axis labels and legends"
0012 - "If possible, augment the benchmark with an additional explainer document which describes figures in greater detail"
0013 ---
0014 
0015 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. 
0016 
0017 ## Making benchmark figures
0018 
0019 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
0020 
0021 - beam settings if any (ep, eAu, ... and \(5 \times 41\), \(10 \times 100\) GeV, ...)
0022 - event generator used
0023 - kinematic cuts ($x$, $Q^2$, $W$)
0024 - EPIC label
0025 - legible axis labels
0026 
0027 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.
0028 
0029 An example figure from the u-channel rho benchmark is shown here:
0030 
0031 <img src="{{ page.root }}/fig/example_benchfig.png" alt="Example benchmark figure" width="800" style="box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);">
0032 
0033 In this example, the plot is labeled with the collision system and other details:
0034 ```c++
0035 TLatex* beamLabel       = new TLatex(0.18, 0.91, "ep 10#times100 GeV");
0036 TLatex* epicLabel       = new TLatex(0.9,0.91, "#bf{EPIC}");
0037 TLatex* kinematicsLabel = new TLatex(0.53, 0.78, "10^{-3}<Q^{2}<10 GeV^{2}, W>2 GeV");
0038 TLatex* generatorLabel  = new TLatex(0.5, 0.83, ""+vm_label+" #rightarrow "+daug_label+" eSTARlight");
0039 ```
0040 The axis labels and titles were scaled for clarity:
0041 ```c++
0042 histogram->GetYaxis()->SetTitleSize(histogram->GetYaxis()->GetTitleSize()*1.5);
0043 histogram->GetYaxis()->SetLabelSize(histogram->GetYaxis()->GetLabelSize()*1.5);
0044 ```
0045 The number of axis divisions was decreased to reduce visual clutter:
0046 ```c++
0047 histogram->GetXaxis()->SetNdivisions(5);
0048 ```
0049 And margins were increased to allow for more space for larger axis labels:
0050 ```c++
0051 virtualPad->SetBottomMargin(0.2);
0052 ```
0053 
0054 ## Describing your benchmark figures
0055 
0056 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:
0057 
0058 <img src="{{ page.root }}/fig/benchmarkplots_explained.png" alt="Benchmark explainer" width="800" style="box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);">
0059 
0060 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).
0061 
0062 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:
0063 
0064 ```tex
0065 {% raw %}
0066 %====================================================================%
0067 %                  BENCH.TEX                                       %
0068 %           Written by YOUR NAME                                   %
0069 %====================================================================%
0070 \documentclass{bench}
0071 
0072 % A useful Journal macro
0073 \def\Journal#1#2#3#4{{#1} {\bf #2}, #3 (#4)}
0074 \NewDocumentCommand{\codeword}{v}{\texttt{\textcolor{black}{#1}}}
0075 % Some other macros used in the sample text
0076 \def\st{\scriptstyle}
0077 \def\sst{\scriptscriptstyle}
0078 \def\epp{\epsilon^{\prime}}
0079 \def\vep{\varepsilon}
0080 \def\vp{{\bf p}}
0081 \def\be{\begin{equation}}
0082 \def\ee{\end{equation}}
0083 \def\bea{\begin{eqnarray}}
0084 \def\eea{\end{eqnarray}}
0085 \def\CPbar{\hbox{{\rm CP}\hskip-1.80em{/}}}
0086 
0087 \begin{document}
0088 \title{YOUR BENCHMARK NAME Benchmark Figures}
0089 \maketitle
0090 
0091 \codeword{benchmark_plot1.pdf}:
0092 This figure shows...
0093 
0094 \end{document}
0095 {% endraw %}
0096 ```
0097 
0098 Create this `bench.tex` file at the top of your benchmark (`physics_benchmarks/benchmarks/your_bench/`). Also copy [`bench.cls`](https://github.com/eic/tutorial-developing-benchmarks/blob/gh-pages/files/bench.cls) to the same location to define the `bench` document class.
0099 
0100 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.
0101 
0102 ```snakemake
0103 rule yourbench_compile_manual:
0104     input:
0105         cls=workflow.source_path("bench.cls"),
0106         tex=workflow.source_path("bench.tex"),
0107     output:
0108         temp("tectonic"),
0109         cls_tmp=temp("bench.cls"),
0110         pdf="results/bench.pdf",
0111     shell: """
0112 wget https://github.com/tectonic-typesetting/tectonic/releases/download/tectonic%400.15.0/tectonic-0.15.0-x86_64-unknown-linux-musl.tar.gz
0113 tar zxf tectonic-0.15.0-x86_64-unknown-linux-musl.tar.gz
0114 cp {input.cls} {output.cls_tmp} # copy to local directory
0115 ./tectonic {input.tex} --outdir="$(dirname {output.pdf})"
0116 """
0117 ```
0118 
0119 And make sure that the `your_benchmark:results` job in your `config.yml` calls the snakemake compilation rule:
0120 
0121 ```yml
0122     - snakemake --cores 1 yourbench_compile_manual
0123 ```
0124 
0125 
0126 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:
0127 
0128 <img src="{{ page.root }}/fig/benchmark_explainer_artifact.png" alt="Benchmark explainer artifact" width="1000" style="box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);">
0129 
0130 
0131 ## Conclusion
0132 
0133 We've discussed ways to make benchmark figures legible and useful to others.
0134 
0135 Analyzers should aim to make paper-ready figures that others can use and easily understand.
0136 
0137 Analyzers should consider including an explainer artifact which describes each figure in detail. To do this:
0138 - Copy [`bench.tex`](https://github.com/eic/tutorial-developing-benchmarks/blob/gh-pages/files/bench.tex) and [`bench.cls`](https://github.com/eic/tutorial-developing-benchmarks/blob/gh-pages/files/bench.cls) to your benchmark: `physics_benchmarks/benchmarks/your_bench/`
0139 - Edit `bench.tex` with descriptions of each benchmark figure
0140 - Add a rule (shown above) to your `Snakefile` to compile `bench.tex`
0141 - Check [GitLab's pipelines](https://eicweb.phy.anl.gov/EIC/benchmarks/physics_benchmarks/-/pipelines) for the pdf.