cylinder


\documentclass[margin=10pt]{standalone}
\usepackage{amssymb}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{xcolor}

\colorlet{darkred}{red!70!black}
\colorlet{darkerred}{red!40!black}
\colorlet{lightred}{red!80!black}

\tikzset{>=latex}
\tikzstyle{vector}=[->,thick,line cap=round]
\tikzstyle{line} = [line cap=round]
\tikzstyle{cylinder}=[thick,draw=darkerred,rotate around z=\ang]
\tikzstyle{cylinder surface}=[red!60!black!60,opacity=0.06,rotate around z=\ang]

\newcommand*{\vv}[1]{\vec{\mkern0mu#1}} % vector arrow


\begin{document}

\tdplotsetmaincoords{70}{125}
\begin{tikzpicture}[scale=2,tdplot_main_coords,rotate around x=90]
  
  % VARIABLES
  \def\rvec{(\L-0.33)/cos(\thetavec)}
  \def\thetavec{28}
  \def\phivec{60}
  \def\L{1.75}     % cylinder length
  \def\R{0.75}    % cylinder cylinder radius
  \def\l{4.1}     % beam pipe length
  \def\r{0.04}    % beam pipe radius
  \def\rt{0.042}  % beam pipe radius + line thickness
  \def\zmin{-1.05} % minimum z axis
  \def\zmax{\L+0.6}  % maximum z axis
  \coordinate (O) at (0,0,0);
  \coordinate (Z) at (0,0,\L);
  \tdplotsetcoord{O'}{0.8*\rvec}{\thetavec}{\phivec} % shifted origin
  \tdplotsetcoord{O''}{0.018}{90}{\phivec} % shifted origin
  \tdplotsetcoord{P}{\rvec}{\thetavec}{\phivec};
  \tdplotsetcoord{T}{0.5}{90}{-30};
  \tdplotsetcoord{T'}{0.9}{60}{-30};

  
  % Draw cylinder sides (the two parallel lines)
  \def\ang{20}
  \fill[top color=red!50!black!4,bottom color=red!60!black!2,rotate around z=\ang] (0,\R,\L) --++ (0,0,-\L) arc(90:270:\R) --++ (0,0,\L) arc(270:90:\R) -- cycle;
  \draw[cylinder] (0,0,0)++(90:\R) --++ (0,0,\L);
  \draw[cylinder] (0,0,0)++(-90:\R) --++ (0,0,\L);
  
  % Draw the plane of the lid at Z=L and its two arcs
  \fill[cylinder surface] (0,\rt,\L) --++ (0,\R-\rt,0) arc(90:-90:\R) --++ (0,\R-\rt,0) arc(-90:90:\rt);
  \fill[cylinder surface] (0,0,\L) --++ (0,\R,0) arc(90:270:\R) -- cycle;
  \tdplotdrawarc[cylinder,thin]{(0,0,\L)}{\R}{0}{360}{}{}
  \tdplotdrawarc[cylinder]{(0,0,\L)}{\R}{-90}{90}{}{}
 
  % Draw the plane of the lid at Z=0 and its two arcs
  \draw[cylinder] (90-\ang:\R) arc (90-\ang:270:\R);
  \tdplotdrawarc[cylinder]{(0,0,0)}{\R}{0}{360}{}{}

  
  % Draw the axis of the cylinder
  \draw[line] (0,0,0) -- (0,0,\zmax);
  \draw[line,-] (0,0,\zmin) -- (0,0,-0.020);

  
  % Draw vectors and lines
  \draw[line, dashed] (T') -- (T);
  \draw[line, thick] (T') --++($(T')-(T)$) --++($(T')-(T)$) node[below=0.5mm, left] {$\lessdot$};
  \draw[line, thick] (T) --++($(T)-(T')$) --++($(T)-(T')$);
  \draw[dashed,darkred] (O'')  -- node[right]{$r$} (Pxy);
  \draw[dashed,darkred] (P)  -- node[above=1mm, right=2mm]{\tiny$h_p$} (Pxy);
  \draw[dashed,darkred] (P) -- (Pz);
  \draw[->, black, thick] (O) -- ($(O)+(0,0,0.75)$) node[above]{$\vv{a}$};
  \draw[vector] (O) -- ($(Z)-(0,0,0.33)$);
  
  % Draw the points
  \fill[black] (T) circle(0.5pt) node[right=1,below=1] {$t$};
  \fill[black] (T') circle(0.5pt) node[above=1] {$t'$};
  \fill[lightred] ($(Z)-(0,0,0.33)$) circle(0.5pt) node[left=4mm, below] {\tiny{$(c_0 + h_p\vv{a})$}};

  \fill[lightred] (O) circle(0.5pt) node[right=1,below=1] {$c_0$};
  \fill[lightred] (P) circle(0.5pt) node[above] {p};


\end{tikzpicture}
\end{document}