# Lead nucleus & Pb-Pb collisions

Nucleus of a (lead) isotope:Lead-lead (PbPb) collisions at the LHC with electromagnetic fields (note Lorentz-contraction):Indicating the impact parameter:

# Main idea

At first I tried randomly assigning an angle and radius (sampling sqrt((rand+1)/2) for uniform distribution along the radius):This did not fill up so evenly as I wanted, so I tried to generate the nucleons uniformly on ring layers using polar coordinates:Adding a bit of random offsets to the angle and radius in the polar coordinate:Randomly shuffling the nucleons along the rings so the overlap of consecutive balls is not regular, and the even/odd coloring looks more random:The rings have constant distance between them because each ring's radius is set with a simple linear equation of the form r=R*i/N. To make the nucleus look more like a 3D sphere, we can gradually pull the outers rings closer together by reducing the ring radius quadratically: r'=r-C*r^2 for some tunable parameter C ~ 0.2:
% Author: Izaak Neutelings (March 2024)
\documentclass[border=3pt,tikz]{standalone}
\usepackage{amsmath}
\usepackage{listofitems} % to create arrays with \readlist
\usepackage{ifthen} % for \whiledo
%\usetikzlibrary{arrows.meta} % for arrow size

% COLORS
\colorlet{myred}{red!75!black}
\colorlet{myblue}{blue!70!black}

% STYLES
\tikzset{
>=latex, % for LaTeX arrow head
ball/.style={ultra thin,draw=black,fill=\getcol{#1},
circle,inner sep=1pt,minimum size=15pt,scale=0.8},
ball/.default=1,
}
\def\getcol#1{\ifodd#1 blue!20 \else red!20 \fi}
\def\drawgrid#1{
\pgfmathsetmacro\xmax{ceil(#1)+0.6}
\pgfmathsetmacro\xmin{0.3-\xmax}
\draw[black!20] (\xmin,\xmin) grid (\xmax,\xmax);
\draw[thick,->] (\xmin,0) -- (\xmax,0);
\draw[thick,->] (0,\xmin) -- (0,\xmax);
\draw[black!20] (0,0) circle(#1);
}

\begin{document}

% NUCLEUS - random radius & angle
\def\R{2.0}
\def\Nlay{5} % number of rings/layers
\def\N{100}
\begin{tikzpicture}
\drawgrid{\R}

% NUCLEUS
\foreach \i [evaluate={
\a=180*rand % ball angle
}] in {1,...,\N}{
\node[ball=\i] at (\a:\r) {\i};
}

\end{tikzpicture}

% NUCLEUS - uniform rings
\begin{tikzpicture}
\message{^^JNucleus with uniform rings}
\drawgrid{\R}

% NUCLEUS
\foreach \lay [evaluate={
\Nring=int(round(2*\lay*\N/(\Nlay*(\Nlay+1)))) % number of balls per ring
}] in {\Nlay,...,1}{
\message{^^J N=\N, Nlay=\Nlay, Nring=\Nring, r=\r}
\foreach \i [evaluate={
\a=360*(\i/\Nring); % ball angle
}] in {1,...,\Nring}{
\node[ball=\i] at (\a:\r) {\i};
}
}

\end{tikzpicture}

% NUCLEUS - uniform rings + random offset
\begin{tikzpicture}
\message{^^JNucleus with uniform rings + random offset}
%\def\R{1.8}
\drawgrid{\R}

% NUCLEUS
\foreach \lay [evaluate={
\aR=3*rand; % angular offset
\Nring=int(round(2*\lay*\N/(\Nlay*(\Nlay+1)))) % number of balls per ring
}] in {\Nlay,...,1}{
\message{^^J N=\N, Nlay=\Nlay, Nring=\Nring, r=\r}
\foreach \i [evaluate={
\aB=\aR+360*(\i/\Nring)+2*rand/\Nring; % ball angle plus random offset
}] in {1,...,\Nring}{
\node[ball=\i] at (\aB:\rB) {\i};
%\fill[red] ({\aR+360*(\i/\Nring)}:\r) circle(0.5pt);
}
}

\end{tikzpicture}

% NUCLEUS - shuffle balls
\def\shufflelist#1{
%\message{^^JShuffle list}
\pgfmathsetmacro\tmplist{random(1,#1)} % first random item
\newboolean{unique}
\whiledo{\shuffledlistlen<#1}{ % try until list is of length \N=#1
\pgfmathsetmacro\rx{random(1,#1)} % generate new random item
\setboolean{unique}{true}
\foreachitem \x \in \shuffledlist{ % loop over previous elements
\ifnum \x=\rx % look if new number in list
\breakforeach
\fi
}
\ifthenelse{\boolean{unique}}{ % found unique item !
\xdef\tmplist{\tmplist,\rx} % add new unique item
}{}
}
}
\begin{tikzpicture}[xscale=1]
\message{^^JNucleus with shuffling balls}
%\def\R{1.8}
\drawgrid{\R}
\pgfmathsetseed{1234567890}

% NUCLEUS
\foreach \lay [evaluate={
\aR=3*rand; % angular offset
\Nring=int(round(2*\lay*\N/(\Nlay*(\Nlay+1)))) % number of balls per ring
}] in {\Nlay,...,1}{
\message{^^J N=\N, Nlay=\Nlay, Nring=\Nring, r=\r}
\shufflelist{\Nring} % get shuffled list of sequence 1,...,\Nring
\foreach \i [evaluate={
\is=int(\shuffledlist[\i]); % shuffled index
\aB=\aR+360*(\is/\Nring)+2*rand/\Nring; % ball angle plus random offset
}] in {1,...,\Nring}{
\message{^^J is=\is, i=\i, a=\aB}
\node[ball=\i] at (\aB:\rB) {\i};
%\fill[red] ({\aR+360*(\i/\Nring)}:\r) circle(0.5pt);
}
}
\node[ball=\i] at (0,0) {0}; % cover hole

\end{tikzpicture}

% NUCLEUS - 3D effect
\begin{tikzpicture}[xscale=1]
\message{^^JNucleus with 3D effect}
%\def\R{1.8}
\drawgrid{\R}
\pgfmathsetseed{1234567890}

% NUCLEUS
\pgfmathsetmacro\C{min(1/(4*\R),0.11)} % put balls at edges closer in to create 3D ball effect
\pgfmathsetmacro\D{1-4*\C*\R} % discriminant
\message{^^J R=\R, C=\C, D=1-4cR=\D (must be >0)}
\foreach \lay [evaluate={
\rC=\r-\C*\r*\r; % reduce outer radii to create 3D effect
\aR=3*rand; % angular offset
\Nring=int(round(2*\rC*\N/(\Rs*(\Nlay+1)*(1-\C*\Rs*(2*\Nlay+1)/(3*\Nlay))))) % number of balls on this ring
}] in {\Nlay,...,1}{
\message{^^J N=\N, Nlay=\Nlay, Nring=\Nring, r=\r}
\shufflelist{\Nring} % get shuffled list of sequence 1,...,\Nring
\foreach \i [evaluate={
\is=int(\shuffledlist[\i]); % shuffled index
\aB=\aR+360*(\is/\Nring)+2*rand/\Nring; % ball angle plus random offset
}] in {1,...,\Nring}{
\message{^^J is=\is, i=\i, a=\aB}
\node[ball=\i] at (\aB:\rB) {\i};
%\fill[red] ({\aR+360*(\i/\Nring)}:\r) circle(0.5pt);
}
}
\node[ball=\i] at (0,0) {0}; % cover hole

\end{tikzpicture}

\end{document}

# Full code

Edit and compile if you like:

% Author: Izaak Neutelings (March 2024)
% Inspiration: https://arxiv.org/abs/2010.07855
\documentclass[border=3pt,tikz]{standalone}
\usepackage{listofitems} % to create arrays with \readlist
\usepackage{ifthen} % for \whiledo
\usepackage{siunitx} % for \SI
\usetikzlibrary{decorations.pathmorphing} % for snake, coil, zigzag

% COLORS
\colorlet{protoncol}{red!68!black!80}
\colorlet{neutroncol}{green!68!black!80}
\colorlet{photoncol}{yellow!85!orange!95!black}

% STYLES
\tikzset{
>=latex, % for LaTeX arrow head
vector/.style={->,thick,green!60!black},
photon/.style={->,line width=0.7,line cap=round,photoncol,decorate,decoration={
snake,amplitude=.4mm,segment length=2.2mm,post length=1.5mm}
},
ball/.style={
circle,draw=none,ball color=#1,postaction={
fill=#1,fill opacity=0.8,draw=#1!40!black,line width=0.04}
},
ball/.default=protroncol,
pics/nucleus/.style={%
code={%
\fill[protoncol] (0,0) circle(0.86*\R); % background to fill any holes
\pgfmathsetmacro\C{min(1/(4*\Rcorr),0.24)} % put balls at edges closer in to create 3D ball effect
\pgfmathsetmacro\D{1-4*\C*\Rcorr} % discriminant
\message{^^J R=\R, R=\Rcorr, Rs=\Rs, C=\C, D=1-4cR=\D (must be >0)}
\foreach \lay [evaluate={
\rC=\r-\C*\r*\r; % reduce outer radii to create 3D effect
\aR=3*rand; % random angular offset
\Nring=int(round(2*\rC*\N/(\Rs*(\Nlay+1)*(1-\C*\Rs*(2*\Nlay+1)/(3*\Nlay))))) % number of balls on this ring
}] in {\Nlay,...,1}{
\message{^^J N=\N, Nlay=\Nlay, Nring=\Nring, r=\r}
\shufflelist{\Nring} % get shuffled list of sequence 1,...,\Nring
\foreach \i [evaluate={
\p=(rand+1)/2<0.39?1:0; % 0: neutron, 1: proton
\is=int(\shuffledlist[\i]); % shuffled index
\aB=\aR+360*(\is/\Nring)+2*rand/\Nring; % ball angle plus random offset
}] in {1,...,\Nring}{
%\message{^^J is=\is, i=\i, a=\aB, p=\p}
\fill[ball=\ifodd\p protoncol\else neutroncol\fi]
(\aB:\rB) circle(\Rball);
}
}
\fill[ball=protoncol] (0,0) circle(\Rball);
\foreach \ang in {0,60,90,120,180,-60,-90,-120}{
\coordinate (-\ang) at (\ang:\R+1.3*\Rball);
}
}
}
}
\def\shufflelist#1{ % get shuffled list of sequence 1,...,#1
%\message{^^JShuffle list}
\pgfmathsetmacro\tmplist{random(1,#1)} % first random item
\newboolean{unique}
\whiledo{\shuffledlistlen<#1}{ % try until list is of length = #1
\pgfmathsetmacro\rx{random(1,#1)} % generate new random item
\setboolean{unique}{true}
\foreachitem \x \in \shuffledlist{ % loop over previous elements
\ifnum \x=\rx % look if new number in list
\breakforeach % stop looking and try again in next iteration
\fi
}
\ifthenelse{\boolean{unique}}{ % found unique item !
\xdef\tmplist{\tmplist,\rx} % add new unique item
}{}
}
}

\begin{document}

% Pb nucleus
\def\N{85} % number of nucleons
\def\Nlay{5} % number of rings/layers
\begin{tikzpicture}
\message{^^J Pb nucleus}

% NUCLEUS
\pic {nucleus};

\end{tikzpicture}

% Pb-Pb collision
\def\xs{0.25} % horizontally scale
\def\Rp{0.92} % length photon
\def\D{3.7} % horizontal distance between nuclei
\pgfmathsetmacro\H{2.30*\R} % vertical distance between nuclei
\pgfmathsetmacro\v{0.25*\D} % length vector
\begin{tikzpicture}
\message{^^J PbPb collision}

% NUCLEUS
\pic[xscale=\xs] (L) at (-\D/2, \H/2) {nucleus};
\pic[xscale=\xs] (R) at ( \D/2,-\H/2) {nucleus};

% VELOCITY VECTORS
\draw[vector] (L-0)++(2pt,0) --++ (\v,0) node[above=2pt] {$v\approx c$};
\draw[vector] (R-180)++(-2pt,0) --++ (-\v,0) node[above=2pt] {$v\approx c$};

% PHOTONS
\foreach \ang in {60,90,120,-60,-90,-120}{
\draw[photon] (L-\ang) --++ (\ang:\Rp);
\draw[photon] (R-\ang) --++ (\ang:\Rp);
}

\end{tikzpicture}

% Pb-Pb collision with impact parameter
\begin{tikzpicture}
\message{^^J PbPb collision with impact parameter}

% NUCLEUS
\pic[xscale=\xs] (L) at (-\D/2, \H/2) {nucleus};
\pic[xscale=\xs] (R) at ( \D/2,-\H/2) {nucleus};

% VELOCITY VECTORS
\draw[vector] (L-0)++(2pt,0) --++ (\v,0); %node[above=2pt] {$v\approx c$};
\draw[vector] (R-180)++(-2pt,0) --++ (-\v,0); %node[above=2pt] {$v\approx c$};

% PHOTONS
\foreach \ang in {60,90,120,-60,-90,-120}{
\draw[photon] (L-\ang) --++ (\ang:\Rp);
\draw[photon] (R-\ang) --++ (\ang:\Rp);
}

% MEASURES
\draw[<->,thick]
(R-0)++(0.3*\R,0) --++ (0,\R) node[midway,right] {$R\sim\SI{7}{fm}$};
\draw[<->,thick]
(0,-\H/2) -- (0,\H/2) node[midway,right] {$b$};
\node at (0.3*\D,0.7*\H) {$b > 2R$};

\end{tikzpicture}

\end{document}

Open in Overleaf: PbPb_collisions.tex.

## 2 Replies to “Lead nucleus & Pb-Pb collisions”

Dear authors,

I want to reuse this figure along with a few others with minor modifications in my thesis paper. How can I cite them in bibtex ?

Thank you very much.

Regards,
 @misc{cms_coordinate_system,   author = "{Neutelings, Izaak}",   title  = {{CMS coordinate system -- TikZ.net}},   year   = {2021},   url    = {https://tikz.net/axis3d_cms/},   note   = {(Retrieved May 28, 2024)} } 
And add the reference at the end of the figure caption with something like "Taken from Ref.~\cite{...}." or "Courtesy of Izaak Neutelings~\cite{...}.". If you make some nontrivial changes to the figures, perhaps you can write Adapted from Ref.~\cite{...}.".