\documentclass[a4paper,11pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage{ucs}
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{labelfig}
\usepackage{epsf}
\usepackage{float}
\usepackage{url}
\usepackage{fancyhdr}
\usepackage{verbatim}
\usepackage{color,listings}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{natbib}
\usepackage[all]{xy}
\usepackage{graphicx}
\usepackage{graphics}
\usepackage{multirow}

%\makeatletter
%\def\@xobeysp{}
%\makeatother
%\setlength{\textwidth}{14cm}
\author{Tran Hoai Nam}
\title{Short report on Geant4 simulation for proton measurements at PSI}

\begin{document}

\maketitle
%\tableofcontents
%\listoffigures
%\listoftables

\section{Set up}
The geometry for the simulation is shown in Figure~\ref{fig:geo}, and
parameters of each component are listed in Table~\ref{tb:para}. Each dE/dx
package consists of:
\begin{itemize}
	\item one dE detector: silicon, 65 $\mu$m thick
	\item one E detector: silicon, 1500 $\mu$m thick
	\item charged particles veto counter: plastic scintillator, 1 mm thick
\end{itemize}
 There is
a small gap of 1 mm between the detectors in each dE/dx package, and distance
from the beam counter to beam window is 5 mm. The germanium detector
I used is just a simple cylinder. Some parameters of the germanium detector are
in this note of Frederik:
\url{https://muon.npl.washington.edu/elog/mu2e/Capture2012/79}

Physics list in use is the LHEP\_EMV because it is the fastest one. (see page
5 in this presentation:
	\url{http://geant4.slac.stanford.edu/SLACTutorial09/ChoosingPhysicsList.pdf})

\begin{figure}[htpb]
	\centering
	\includegraphics[width=0.55\textwidth]{figs/geo_cut}\includegraphics[width=0.45\textwidth]{figs/geo_top}
	\caption{Geometry used in the simulation, left: cut view, right: top view}
	\label{fig:geo}
\end{figure}

\begin{table}[htb]
	\centering
	\caption{Parameters used in simulation}
	\vskip1ex
	\label{tb:para}
	\begin{tabularx}{0.9\textwidth}{lll}
		\toprule
		Items & Material & Dimensions  \\
		\midrule
		Vacuum chamber 	& Stainless steel & H = 380 mm 				 \\
										& 								& $\Phi$ = 310 mm 	 \\
										& 								& 5 mm thick wall 	 \\
   	\midrule
		Beam window 		& Mylar 					& 200 $\mu$m thick ($2\times 100$ $\mu$m,\\
										& 								& not shown in fig)\\
		\midrule
		Muon counter    & Plastic 			  & 5$\times$5 cm$^2$  \\
		and muon veto   & scintillator 		& 0.5 mm thick 				 \\
		\midrule
		dE counter 			& Silicon 				& 5$\times$5 cm$^2$ \\
		 								& 								& 65 $\mu$m thick 	 \\
		\midrule
		E counter 			& Silicon 				& 5$\times$5 cm$^2$ \\
		 								& 								& 1500 $\mu$m thick   \\
		\midrule
		Charged particle& Plastic 				& 5$\times$5 cm$^2$ \\
		veto						& scintillator		& 1 mm thick   \\
		\midrule
		Target 					& Si/Al 					& 5$\times$5 cm$^2$ \\
										& 								& various thickness 50 $-$ 200 $\mu$m  \\
		\midrule
		Ge detector			& Germanium				& H = 30 mm \\
										& 								& $\Phi$ = 30 mm  	 \\
		\midrule
		Lead shield			& Lead 						& 5$\times$5 cm$^2$  \\
										& 								& 2 mm thick  	 \\

		\bottomrule
	\end{tabularx}
\end{table}

%\begin{figure}[htpb]
	%\centering
	%\includegraphics[width=0.6\textwidth]{figs/geo_top}
	%\caption{Top view of the geometry}
	%\label{fig:topview}
%\end{figure}

\section{Choosing initial muon momentum}

Initial muon momentum is varied to maximize muon stopping ratio in the target,
the muon momentum at the target, after passing through the beam counter and the
chamber window is plotted in the Figure~\ref{fig:mu_at_target}.
Other parameters of the muon beam are:
\begin{itemize}
	\item muon momentum spread 2 \%
	\item Gaussian spatial spread, $\sigma_x = \sigma_y = 5$ mm
\end{itemize}

\begin{figure}[!htpb]
	\centering
	\includegraphics[width=\textwidth]{figs/mu_at_target}
	\caption{Momentum of muons at the target with different initial momentum}
	\label{fig:mu_at_target}
\end{figure}

I also set the target area to be 15$\times$15 cm$^2$ to see where the muons are
scattered after the chamber window. The results are shown in
Figure~\ref{fig:mu_hit_pos_200um}.
\begin{figure}[!htpb]
	\centering
	\includegraphics[width=\textwidth]{figs/mu_hit_pos_200um_target}
	\caption{Hit position of muons on target with different initial muon
	momentum, the red box is the actual area of the $5\times5$ cm$^2$ target}
	\label{fig:mu_hit_pos_200um}
\end{figure}

Muon stopping ratio for different target thicknesses are listed in the
Table~\ref{tb:stpratio}.

\begin{table}[htb]
	\begin{center}
		\caption{Muon stopping ratio (\%) in target when adjusting initial muon
		momentum}
		\label{tb:stpratio}  
		\vskip1ex
		%\scalebox{0.75}{
		\begin{tabular}{ccccc}
			\toprule
			  	& 50 $\mu$m 	& 100 $\mu$m 	& 150 $\mu$m 	& 200 $\mu$m \\
			\midrule
			30 MeV/c &  7.8    & -      & -    	& -   \\ 
			29 MeV/c & 40.2    & 6.7 		& -   	& -  \\ 
			28 MeV/c & 51.7    & 38.7  	& 4.2 	& -  \\ 
			27 MeV/c & 43.0    & 38.5 	& 33.1 	& 1.3  \\ 
			26 MeV/c & 31.4    & 31.4 	& 31.3 	& 22.5  \\ 
			25 MeV/c & 8.1     & 8.0 		& 8.1 	& 8.0  \\ 
			\bottomrule
		\end{tabular}
		%}
		\end{center}
	\end{table}

%%%%%%%%%%%%%%%%%%%%
\section{Rate estimation}
I have run the simulation with different thickness of the target: 50, 100, 150
and 200 $\mu m$, initial momentum of muons is chosen from
Table~\ref{tb:stpratio}.
4$\times 10^6$ muons were generated in each run.
The result of rate estimation for 10$^4$ muons/sec is shown in
Table~\ref{tb:rates}. Some notes: 
\begin{itemize}
	\item triggered event: has hit on beam counter, AND no hit on veto counter
	\item stopped muon event: triggered, AND muon actually stopped inside the
		target. This is obtained by tracking the original muon, and seeing that it
		really stopped inside the target.
	\item hit on dE/dx package: coincidence with dE and E counters, AND no hit on
		charged particle veto.
\end{itemize}

%\begin{table}[htb]
	%\centering
	%\caption{Rate for 10$^4$ muons/sec}
	%\vskip1ex
	%\label{tb:rate}
	%\begin{tabular}{ccccccccc}
	%\begin{tabularx}{\textwidth}{ccccccccc}
		%\toprule
		%Target 			& Triggered & Stopped &\multicolumn{3}{c}{Rate dE/dx
		%1 (s$^{-1}$)}& 
		%\multicolumn{3}{c}{Rate dE/dx 2 (s$^{-1}$)}\\
		%\cline{4-9}
		%thickness		& \% 				& \% 			& All &Proton&$\mu$ & All &Proton&$\mu$ \\
		%\midrule
		%200 $\mu m$	& 98.7			& 41.9		& 19.8&2.9   &0.2   & 126.9& 6.7 &104.7\\
		%150 $\mu m$	& 96.5			& 34.9		& 17.1&2.7   &0.2   & 124.7& 7.5 &105.2\\
		%100 $\mu m$	& 87.3			&  8.6		&  7.9&1.7   &0.2   & 122.8& 5.1 &114.6\\
		 %50 $\mu m$	& 77.7			&  0.2		&  4.5&1.0   &0.1   & 100.1& 2.9 &96.7\\
		%\bottomrule
	%\end{tabularx}
	%\end{tabular}
%\end{table}
\begin{table}[htb]
	\begin{center}
		\caption{Estimated event rates for various targets of different
		thickness. Incoming $10^{4}$ muons/sec and proton
		emission rate of 
		0.15 per muon capture are assumed. The efficiency of
		Si detector of 100 \% is also assumed.  } 
		\label{tb:rates}
		\vskip1ex
		\scalebox{0.85}{
		\begin{tabular}{ccccc}
			\toprule
			Target 						& Muon momentum &\% Stopping & Event rate (Hz) & Event rate (Hz) \\  
			thickness ($\mu$m)& (MeV/c) &in target & All particles
		& Protons \\  
			\midrule
			50  & 26 & 22.2   & 34.8 	& 4.6   \\ 
			100 & 27 & 32.9 	& 48.5 	& 5.4  \\ 
			150 & 28 & 38.5  	& 54.5 & 4.8  \\ 
			200 & 28 & 51.2 	& 47.7 & 4.5  \\ 

			%50  & 26 & 22.2   & 14.8 	& 2.3   \\ 
			%100 & 27 & 32.9 	& 18.5 	& 2.1  \\ 
			%150 & 28 & 38.5  	& 16.6 & 1.7  \\ 
			%200 & 28 & 51.2 	& 19.8 & 2.0  \\ 
			\bottomrule
		\end{tabular}
		}
		\end{center}
	\end{table}

%The reasons why stopping ratio is very small compares to trigger ratio are:
%\begin{itemize}
	%\item some muons stopped inside the beam counter,
	%\item and, some muons that passed the beam counter are scattered off the
		%target (the distance from the beam counter to the target is 210 mm).
%\end{itemize}

%To investigate those effects, I fixed the target thickness to 200 $\mu m$, and
%varied the thickness of beam counter from 0.7 mm to 1.5 mm. Fraction of muons
%stopped in the beam counter, fraction that goes to the target are shown in
%Table~\ref{tb:stop}. Some figures on momentum of original muons, and muons that
%hit the target, and spatial distribution of muons that hit target are presented.

Note:
\begin{itemize}
	\item \% get to target = $\frac{\text{number of muons hit the target}}
		{\text{total number of muons generated}}$
	\item \% stop in target = $\frac{\text{number of muons stopped inside target}}
		{\text{number of muons hit target}}$
	\item \% total stopping efficiency = $\frac{\text{number of muons stopped inside
		target}}{\text{total number of muons generated}}$
\end{itemize}
%\begin{table}[htb]
	%\centering
	%\caption{Percentage of stopping muon}
	%\vskip1ex
	%\label{tb:stop}
	%\begin{tabular}{ccccc}
		%\toprule
		%Beam counter 	& \% stop in 	& \% get to 	& \% stop in  & \% total stopping \\
		%thickness & beam counter& target 			& target 			& efficiency\\
		%\midrule
		%0.7 mm 		& 0.02 				& 64 					& 34 					& 42 \\
		%0.8 mm		& 0.04 				& 57 					&	66 					& 40 \\
		%0.9 mm		& 0.06 				& 51 					&	89 					& 45 \\
		%1.0 mm		& 0.09 				& 43 					&	98 					& 42 \\
		%1.1 mm		& 0.2 				& 35 					&	99.4 				& 35 \\
		%1.2 mm		& 1.4 				& 24 					&	99.7 				& 24 \\
		%1.3 mm		& 12 					& 12 					&	99.7 				& 12 \\
		%1.4 mm		& 43 					& 3  					& 99.8 				& 3 \\
		%1.5 mm		& 79 					& 0.5					&	99.9 				& 0.5 \\
		%\bottomrule
	%\end{tabular}
%\end{table}

%\begin{figure}[!htpb]
	%\centering
	%\includegraphics[width=\textwidth]{figs/mu_at_target}
	%\caption{Momentum of muons when entered target at different thickness of beam
	%counter}
	%\label{fig:mom}
%\end{figure}
%\begin{figure}[!htpb]
	%\centering
	%\includegraphics[width=\textwidth]{figs/mu_at_target_all}
	%\caption{Momentum of muons when entered target at different thickness of beam
	%counter, in comparison with original muon momentum}
	%\label{fig:mom_aio}
%\end{figure}
%\begin{figure}[!htpb]
	%\centering
	%\includegraphics[width=\textwidth]{figs/xy_target}
	%\caption{Spatial of muon hits on target when changing beam counter thickness}
	%\label{fig:xy}
%\end{figure}

\section{Side notes on structure of the output ROOT file}
I used ROOT TObject to construct the output of the simulation (this is not
really convenient for analysing).  An event contains following information:
\begin{itemize}
	\item event id,
	\item deposited energies in all detectors and target,
	\item a flag to show if there is a muon stopped inside the target,
	\item hits on each detectors, each hit has:
		\begin{itemize}
			\item type of the hit: initial muon stopped in the target, a particle
				entered or exited a detector, or a new particle is spawned in
				a detector
			\item a detector id,
			\item particle info: name, energy, hit position, time
		\end{itemize}
\end{itemize}

\section{To do}
\begin{itemize}
	\item optimization of geometry
	\item digitization of output data, feeding to DAQ and analyzer, if possible
\end{itemize}
\end{document}
