User Tools

Site Tools


latex:exampe_eta

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
latex:exampe_eta [2017/09/11 15:45] iwnlatex:exampe_eta [2022/12/02 15:44] (current) iwn
Line 6: Line 6:
  // //  // //
 </WRAP><WRAP column 42%> </WRAP><WRAP column 42%>
-{{ latex: theta_eta.png ? 0x1000 }}+{{ latex:tikz:axis2d_pseudorapidity.png ? 0x1000 }}
 </WRAP><WRAP column 2%> </WRAP><WRAP column 2%>
  // //  // //
 </WRAP></WRAP> </WRAP></WRAP>
  
 +Pseudorapidity. For more, please visit https://tikz.net/category/physics/particle-physics/.
  
- +<file latex theta-eta.tex> 
-<file latex eta-theta.tex> +% Author: Izaak Neutelings (June 2017) 
-% Author: Izaak Neutelings (July 2017) +% Updated: December 2022 
- +\documentclass[border=3pt,tikz]{standalone}
-\documentclass{article} +
-\usepackage{amsmath} % for \text +
-\usepackage{tikz}+
 \tikzset{>=latex} % for LaTeX arrow head \tikzset{>=latex} % for LaTeX arrow head
-\definecolor{mylightred}{RGB}{255,200,200} 
-\definecolor{mylightblue}{RGB}{172,188,63} 
-\definecolor{mylightgreen}{RGB}{150,220,150} 
- 
-% split figures into pages 
-\usepackage[active,tightpage]{preview} 
-\PreviewEnvironment{tikzpicture} 
-\setlength\PreviewBorder{1pt}% 
  
 \begin{document} \begin{document}
  
  
 +% SIMPLE FOR-LOOP
 \begin{tikzpicture}[scale=3] \begin{tikzpicture}[scale=3]
      
-  % limits +  % setting
-  \def\N{4}+
   \def\R{1.2}   \def\R{1.2}
      
   % axis labels   % axis labels
-  \node[scale=0.8,below left=1pt] at (0,\R) {$y$}; +  \node[below=5pt,left=2pt] at (0,\R) {$y$}; 
-  \node[scale=0.8,below left=1pt] at (\R,0) {$z$};+  \node[left=5pt,below=2pt] at (\R,0) {$z$};
      
   % lines   % lines
Line 53: Line 42:
  
  
 +% PSEUDORAPIDITY with manual for-loop over theta, eta
 \begin{tikzpicture}[scale=3] \begin{tikzpicture}[scale=3]
      
-  % limits +  % setting 
-  \def\N{4} +  \def\R{1.2} % radius/length of lines
-  \def\R{1.2}+
      
   % axis labels   % axis labels
-  \node[scale=0.8,below left=1pt] at (0,\R) {$y$}; +  \node[scale=1,below left=1] at (0,\R) {$y$}; % y axis 
-  \node[scale=0.8,below left=1pt] at (\R,0) {$z$};+  \node[scale=1,below left=1] at (\R,0) {$z$}; % z axis
      
   % lines   % lines
-  \foreach \t/\e in {90/0,60/0.55,45/0.88,30/1.32,10/2.44,0/\infty}{ +  \foreach \t/\e in {90/0,60/0.55,45/0.88,30/1.32,10/2.43,0/+\infty}{ % loop over theta/eta 
-    \draw[->,black!60!red,thick] %samples=\N,variable=\x,domain=0:1+    \pgfkeys{/pgf/number format/precision=2} 
-      (0,0) -- ({\R*cos(\t)},{\R*sin(\t)}) +    \draw[->,black!60!red,thick,line cap=round% eta lines 
-      %plot({\x*\R*cos(\t)},{\x*\R*sin(\t)}) % alternative way with plotting a linear function +      (0,0) -- (\t:\R) node[anchor=180+\t,black] {$\eta=\e$} 
-      node[anchor=180+\t,black] {$\eta=\e$}; +      node[black,pos=0.7,fill=white,scale=0.8,inner sep=1.5pt] {$\theta=\t^\circ$};
-    \node[fill=white,scale=0.8] at ({0.8*cos(\t)},{0.8*sin(\t)}) {$\theta=\t^\circ$};+
   }   }
-    +  %\draw[black!60!red,thick] (0,0.1*\R) |- (0.1*\R,0) ; % overlap in corner 
 +  
 \end{tikzpicture} \end{tikzpicture}
  
 +
 +% PSEUDORAPIDITY with automatic calculation of eta
 +\begin{tikzpicture}[scale=3]
 +  
 +  % setting
 +  \def\R{1.2} % radius/length of lines
 +  
 +  % axis labels
 +  \node[scale=1,below left=1] at (0,\R) {$y$}; % y axis
 +  \node[scale=1,below left=1] at (\R,0) {$z$}; % z axis
 +  
 +  % lines
 +  \pgfkeys{/pgf/number format/precision=2} % two decimals
 +  \foreach \t in {90,60,45,30,10,0}{ % loop over theta
 +    \ifnum \t = 0
 +      \def\e{+\infty} % infinity symbol
 +    \else
 +      \pgfmathparse{-ln(tan(\t/2))} % pseudorapidity
 +      %\pgfmathroundto{\pgfmathresult} % round without traling zeroes
 +      \pgfmathroundtozerofill{\pgfmathresult} % round with trailing zeroes
 +      \pgfmathsetmacro\e{\t==90?0:\pgfmathresult} % no trailing zeroes for theta = 0
 +    \fi
 +    \draw[->,black!60!red,thick,line cap=round] % eta lines
 +      (0,0) -- (\t:\R) node[anchor=180+\t,black] {$\eta=\e$}
 +      node[black,pos=0.7,fill=white,scale=0.8,inner sep=1.5pt] {$\theta=\t^\circ$};
 +  }
 +  %\draw[black!60!red,thick] (0,0.1*\R) |- (0.1*\R,0) ; % overlap in corner
 +  
 +\end{tikzpicture}
  
  
 \end{document} \end{document}
 </file> </file>
latex/exampe_eta.1505137520.txt.gz · Last modified: 2017/09/11 15:45 by iwn