This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
| latex:tikz [2018/06/23 14:50] – [Flowchart] iwn | latex:tikz [2022/03/27 16:10] – [3D axis with spherical coordinates & CMS coordinate system] iwn | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| '' | '' | ||
| - | * [[https:// | + | * [[https:// |
| - | * [[https:// | + | * [[https:// |
| - | * [[http:// | + | * [[http:// |
| - | * [[http:// | + | * The examples below and many more are also available on [[https:// |
| - | + | * [[http:// | |
| + | * For Feynman diagrams, please see [[latex: | ||
| ===== Control regions ===== | ===== Control regions ===== | ||
| Line 110: | Line 110: | ||
| ===== Sets ===== | ===== Sets ===== | ||
| - | Example | + | Another simple example |
| <WRAP group>< | <WRAP group>< | ||
| Line 146: | Line 146: | ||
| ===== Flowchart ===== | ===== Flowchart ===== | ||
| - | Another simple example | + | Example |
| <WRAP group>< | <WRAP group>< | ||
| Line 176: | Line 176: | ||
| \draw[sarrow] | \draw[sarrow] | ||
| \draw[arrow] | \draw[arrow] | ||
| - | \draw[arrow] | + | \draw[sarrow] (D) -- (Cl); |
| - | \draw[arrow,< | + | \draw[sarrow,<-] (Cl) -- (Bl) node[fscale=-2, |
| - | \draw[arrow] | + | \draw[sarrow] (C) -- (Bl); |
| \draw[sarrow] | \draw[sarrow] | ||
| \draw[sarrow] | \draw[sarrow] | ||
| Line 190: | Line 190: | ||
| \\ \\ \\ \\ | \\ \\ \\ \\ | ||
| </ | </ | ||
| + | |||
| + | |||
| + | |||
| + | Example of a node with arrows to text below it ([[latex: | ||
| + | |||
| + | <WRAP group>< | ||
| + | <code latex> | ||
| + | \begin{tikzpicture}[yscale=0.8, | ||
| + | | ||
| + | % FIRST COLUMN | ||
| + | \node[anchor=west, | ||
| + | \node (L1) at (0.5,3) {\strut$jj\nu\nu$}; | ||
| + | \node (L2) at (0.5,2) {\strut bb$\nu\nu$}; | ||
| + | \node (L3) at (0.5,1) {\strut tt$\nu\nu$}; | ||
| + | \draw[->, | ||
| + | \draw[->, | ||
| + | \draw[->, | ||
| + | | ||
| + | % SECOND COLUMN | ||
| + | \begin{scope}[shift={(2.5, | ||
| + | \node[draw=myblue, | ||
| + | \node (M1) at (0.5,3) {\strut$jj\mu\mu$}; | ||
| + | \node (M2) at (0.5,2) {\strut bb$\tau\tau$, | ||
| + | \node (M3) at (0.5,1) {\strut tt$\tau\tau$}; | ||
| + | \draw[->, | ||
| + | \draw[->, | ||
| + | \draw[->, | ||
| + | \end{scope} | ||
| + | | ||
| + | % THIRD COLUMN | ||
| + | \begin{scope}[shift={(5.0, | ||
| + | \node[draw=myblue, | ||
| + | \node (R1) at (0.5,3) {\strut$jj\mu\nu$}; | ||
| + | \draw[->, | ||
| + | \end{scope} | ||
| + | | ||
| + | \end{tikzpicture} | ||
| + | </ | ||
| + | </ | ||
| + | \\ \\ \\ \\ | ||
| + | {{ latex: | ||
| + | \\ \\ \\ \\ | ||
| + | </ | ||
| + | |||
| + | |||
| ===== Atom models ===== | ===== Atom models ===== | ||
| Line 754: | Line 799: | ||
| ===== 3D axis with spherical coordinates & CMS coordinate system ===== | ===== 3D axis with spherical coordinates & CMS coordinate system ===== | ||
| - | This piece of code is based on [[https:// | + | This piece of code is based on [[https:// |
| <WRAP group>< | <WRAP group>< | ||
| Line 792: | Line 837: | ||
| - | An example of rotating the 3D axes with the CMS conventional coordinate system by using the option '' | + | An example of rotating the 3D axes with the CMS conventional coordinate system by using the option '' |
| <WRAP group>< | <WRAP group>< | ||
| Line 862: | Line 907: | ||
| \end{tikzpicture} | \end{tikzpicture} | ||
| </ | </ | ||
| - | |||
| - | |||
| - | |||
| - | |||
| Line 873: | Line 914: | ||
| ===== Tau lepton decay signatures ===== | ===== Tau lepton decay signatures ===== | ||
| - | Inspiration from [[http:// | + | Inspiration from [[http:// |
| \\ | \\ | ||
| Line 929: | Line 970: | ||
| \\ | \\ | ||
| </ | </ | ||
| + | |||
| + | |||
| + | |||
| ===== Higgs decay planes ===== | ===== Higgs decay planes ===== | ||
| - | Decay planes of Higgs decay to measure the Higgs boson' | + | Decay planes of Higgs decay to measure the Higgs boson' |
| <WRAP group>< | <WRAP group>< | ||
| Line 946: | Line 990: | ||
| + | |||
| + | ===== Impact parameters ===== | ||
| + | |||
| + | Examples of defining impact parameters in proton collisions ([[https:// | ||
| + | |||
| + | <WRAP group>< | ||
| + | {{latex: | ||
| + | </ | ||
| + | {{latex: | ||
| + | </ | ||
| + | {{latex: | ||
| + | </ | ||
| ===== Timelines and scales ===== | ===== Timelines and scales ===== | ||
| - | Examples of a simple time or energy scale with labels and arrows ([[latex:tikz:timescales|full code]]). | + | Examples of a simple time or energy scale with labels and arrows ([[https://tikz.net/ |
| <WRAP group>< | <WRAP group>< | ||
| Line 966: | Line 1022: | ||
| \\ | \\ | ||
| </ | </ | ||
| - | |||
| Line 972: | Line 1027: | ||
| ===== Jets cones ===== | ===== Jets cones ===== | ||
| - | Two examples of cones. Full code can be found [[latex:tikz:jet_cones|here]]. | + | Two examples of cones. Full code can be found [[https://tikz.net/ |
| Line 1076: | Line 1131: | ||
| \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ | \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ | ||
| </ | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||
| + | ===== Top jets === | ||
| + | |||
| + | The full code can be found [[https:// | ||
| + | |||
| + | <WRAP group>< | ||
| + | {{ latex: | ||
| + | </ | ||
| + | {{latex: | ||
| + | </ | ||
| + | \\ \\ \\ \\ \\ | ||
| + | {{latex: | ||
| + | </ | ||
| + | |||
| + | <code latex> | ||
| + | \newcommand\jetcone[5][blue]{{ | ||
| + | \pgfmathanglebetweenpoints{\pgfpointanchor{# | ||
| + | \edef\ang{# | ||
| + | \edef\e{#5} | ||
| + | \edef\vang{\pgfmathresult} % angle of vector OV | ||
| + | \tikzmath{ | ||
| + | coordinate \C; | ||
| + | \C = (#2)-(#3); | ||
| + | \x = veclen(\Cx, | ||
| + | \y = tan(\ang)*(veclen(\Cx, | ||
| + | \a = veclen(\Cx, | ||
| + | \b = veclen(\Cx, | ||
| + | \angb = acos(sqrt(\e)*sin(\ang)); | ||
| + | } | ||
| + | \coordinate (tmpL) at ($(# | ||
| + | \draw[thin,# | ||
| + | (#3) ellipse({\a pt} and {\b pt}); | ||
| + | \draw[thin,# | ||
| + | (tmpL) arc(180-\angb: | ||
| + | -- ($(# | ||
| + | }} | ||
| + | |||
| + | \begin{tikzpicture} | ||
| + | \def\R{2.5} | ||
| + | \coordinate (O) at (0,0); | ||
| + | \coordinate (BJ) at ( 65:1.1*\R); % b jet 1 | ||
| + | \coordinate (J1) at ( 15:1.0*\R); % q jet 1 | ||
| + | \coordinate (J2) at (-20: | ||
| + | \jetcone[green!80!black]{O}{BJ}{14}{0.10} | ||
| + | \jetcone{O}{J1}{16}{0.08} | ||
| + | \jetcone{O}{J2}{16}{0.10} | ||
| + | \node[green!50!black] at (65: | ||
| + | \node[blue!80!black, | ||
| + | \end{tikzpicture} | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Jet vectors ===== | ||
| + | |||
| + | One can do some projections of jet and MET vectors to construct variables like MT2 in SUSY searches. The full code can be found [[https:// | ||
| + | |||
| + | <WRAP group>< | ||
| + | {{ latex: | ||
| + | </ | ||
| + | {{latex: | ||
| + | </ | ||
| + | |||
| + | <code latex> | ||
| + | \newcommand\jetcone[4]{ | ||
| + | \pgfmathanglebetweenpoints{\pgfpointanchor{# | ||
| + | \edef\tmpang{\pgfmathresult} | ||
| + | \coordinate (tmpC) at ($(# | ||
| + | \coordinate (tmpL) at ($(tmpC)+(\tmpang+90:# | ||
| + | \coordinate (tmpR) at ($(tmpC)+(\tmpang-90:# | ||
| + | \draw[cone, | ||
| + | %(tmpR) arc(90: | ||
| + | (tmpC) ellipse({# | ||
| + | \begin{scope} | ||
| + | \clip[rotate=\tmpang] (tmpR) -- (#1) -- (tmpL) arc(90: | ||
| + | \draw[vector] (#1) -- (#2); | ||
| + | \end{scope} | ||
| + | \draw[cone, | ||
| + | (tmpL) arc(90: | ||
| + | } | ||
| + | |||
| + | % MT2 | ||
| + | \begin{tikzpicture} | ||
| + | \def\R{2.8} | ||
| + | \coordinate (O) at (0,0); | ||
| + | \coordinate (J1) at (170:\R); % jet 1 pT | ||
| + | \coordinate (J2) at (-35:\R); % jet 2 pT | ||
| + | \coordinate (M1) at (130: | ||
| + | \coordinate (M2) at (-10: | ||
| + | \coordinate (M) at ($(M1)+(M2)$); | ||
| + | | ||
| + | % PTMISS | ||
| + | \draw[ptmiss, | ||
| + | \draw[ptmiss] (O) -- (M1) node[left=2, | ||
| + | \draw[ptmiss] (O) -- (M2) node[right=0] {$\ptmissX{2}$}; | ||
| + | \draw[ptmiss] (O) -- (M) node[above right=-1] {$\ptmiss$}; | ||
| + | | ||
| + | % JET CONES | ||
| + | %\draw[vector] (O) -- (J1); | ||
| + | %\draw[vector] (O) -- (J2); | ||
| + | %\cone{O}{J1}{0.3}{0.15} | ||
| + | \jetcone{O}{J1}{0.4}{0.08} | ||
| + | \jetcone{O}{J2}{0.4}{0.10} | ||
| + | \node[vector, | ||
| + | \node[vector, | ||
| + | | ||
| + | % CURLY BRACE | ||
| + | \draw[line width=0.5, | ||
| + | ($(J1)+(195: | ||
| + | \draw[line width=0.5, | ||
| + | ($(M2)+(10: | ||
| + | | ||
| + | \end{tikzpicture} | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Tangent to a circle or ellipse ===== | ||
| + | |||
| + | Some different methods of finding the tangent to a circle or ellipse in TikZ. | ||
| + | Using these methods a nice cone can be made. | ||
| + | The full code can be found [[https:// | ||
| + | |||
| + | |||
| + | <WRAP group>< | ||
| + | {{ latex: | ||
| + | </ | ||
| + | {{latex: | ||
| + | </ | ||
| + | |||
| + | <WRAP group>< | ||
| + | {{ latex: | ||
| + | </ | ||
| + | {{latex: | ||
| + | </ | ||
| + | |||
| + | <code latex> | ||
| + | % TANGENT to CIRCLE - known: r, q | ||
| + | \begin{tikzpicture} | ||
| + | \def\r{1.5} % radius | ||
| + | \def\q{4} % distance center-external point q = |OQ| | ||
| + | \def\x{{\r^2/ | ||
| + | \def\y{{\r*sqrt(1-(\r/ | ||
| + | \coordinate (O) at (0,0); % circle center O | ||
| + | \coordinate (Q) at (\q,0); % external point Q | ||
| + | \coordinate (P) at (\x,\y); % point of tangency, P | ||
| + | \draw[-> | ||
| + | \draw[-> | ||
| + | \draw[dashed] (\x,0) |- (0,\y); | ||
| + | \draw[myblue, | ||
| + | \draw[mygreen, | ||
| + | \draw[mygreen, | ||
| + | \rightAngle{Q}{P}{O}{0.40} | ||
| + | \fill[myred] (O) circle(0.05) node[below right] {O}; | ||
| + | \fill[myred] (Q) circle(0.05) node[below left] {Q}; | ||
| + | \fill[myred] (P) circle(0.05) node[above=3, | ||
| + | \end{tikzpicture} | ||
| + | |||
| + | % TANGENT to ELLIPSE - known: a, b, q | ||
| + | \begin{tikzpicture} | ||
| + | \def\a{1.5} % horizontal radius | ||
| + | \def\b{1.0} % vertical radius | ||
| + | \def\q{4} % distance center-external point q = |OQ| | ||
| + | \def\x{{\a^2/ | ||
| + | \def\y{{\b*sqrt(1-(\a/ | ||
| + | \coordinate (O) at (0,0); % circle center O | ||
| + | \coordinate (Q) at (\q,0); % external point Q | ||
| + | \coordinate (P) at (\x,\y); % point of tangency, P | ||
| + | \draw[-> | ||
| + | \draw[-> | ||
| + | \draw[dashed] (\x,0) |- (0,\y); | ||
| + | \draw[myblue, | ||
| + | \draw[mygreen, | ||
| + | \draw[mygreen, | ||
| + | \fill[myred] (O) circle(0.05) node[below right] {O}; | ||
| + | \fill[myred] (Q) circle(0.05) node[below left] {Q}; | ||
| + | \fill[myred] (P) circle(0.05) node[above=3, | ||
| + | \end{tikzpicture} | ||
| + | |||
| + | </ | ||