\section[Particle Identification]{Particle Identification\footnote{K.~L.~He,
J.~F.~Hu, B.~Huang, G.~Qin, S.~S.~Sun, Y.~H.~Zheng}}
\label{sec:pid}


\subsection{Introduction}
\label{sec:pid:introduction}


Particle identification (PID) will play an essential role in most
\bes3 physics analyses~\cite{ref:bes3_det_tdr}. Good $\mu/\pi$
separation is required for precision $f_{D}/f_{D_{s}}$ measurements.
Excellent electron identification will help to improve the 
accracy of the CKM elements $|V_{\textrm{cs}}|$ and $|V_{\textrm{cd}}|$. 
The identification of hadronic ($\pi/K/p$) particles 
will be a commonly used tool in \bes3 physics analysis, and often 
the most crucial item to be considered.

Each part of the \bes3 detector executes its 
specific functions and
provides information that can be used to determine the
particle identity.  The PID capabilities 
are quite different for each sub-detector 
and for each different momentum range. To
improve the PID performance, a powerful technique is required to
combine the available information in the most optimal way, 
especially when  some of the inputs are highly correlated. 
In recent years, various PID algorithms, such as the likelihood
method~\cite{ref:pid_likelihood}, the Fisher
discriminator~\cite{ref:pid_kfd}, the H-Matrix
estimator~\cite{ref:pid_hmatrix}, artificial neural
networks~\cite{ref:pid_ann}, and the boosted decision
tree~\cite{ref:pid_bdt}, have been developed. 
Most of the PID requirements in the \bes3
physics program involve high quality
 $e/\pi$, $\mu/\pi$ and $\pi/K$ separation.

\subsection{The PID system of \bes3}
\label{sec:pid_sys}

The \bes3 detector~\cite{ref:bes3_det_tdr} consists of
a main drift chamber (MDC), Time-Of-Flight (TOF) counters, a CsI(Tl)
crystal calorimeter, and a muon identifier. All of them contribute 
to particle identification. 

\subsubsection{The $dE/dx$ measurements}
\label{sec:pid_dedx}

The main drift chamber (MDC) consists of 43 layers of sensitive
wires and operates with a $60\%/40\%$
$\textrm{He}/\textrm{C}_{3}\textrm{H}_{8}$ gas mixture. The expected
momentum resolution $\sigma_{p}/p$ is about 0.5\% at 1 GeV/c. The
energy loss in the drift chamber provides valuable information
for particle identification. The normalized pulse height, which is
proportional to the energy loss of incident particles in the drift
chamber, is a function of $\beta\gamma=p/m$, where $p$ and $m$ are
the momentum and mass of a charged particle.
\figurename~\ref{fig:tof_dedx}(a) shows the normalized pulse height
variation with momentum for different particle species. From the figure,
it is evident that electrons,
muons and pions with momenta around 0.2~GeV/c cannot be well 
separated  by $dE/dx$ pulse height measurements. 
Similarly, the $dE/dx$ pulse heights will not
discriminate electrons from kaons in the 0.5--0.6 GeV/c
momentum range.

There are a number of factors that can effect the $dE/dx$
performance~\cite{ref:bes3_dedx}: the number of hits, the average
path lengths in a cell, space charge and saturation effects,
electric field non-uniformities etc.  After
calibration, the $dE/dx$ measurement resolution is expected to be
between 6\% and 7\%. Using $dE/dx$ information, 3$\sigma$ $K/\pi$ 
separation can be achieved for momentum below 0.6 GeV/c; 
good $e/\pi$ separation can be obtained for all momenta
above 0.4 GeV/c.

\subsubsection{The TOF counter}
\label{pid_tof}

Radially outside of the MDC is the TOF system, which is 
specialized  for particle
identification. It consists of a two-layer barrel array and one
layer endcap array. There are two readout PMTs on each barrel
scintillator and one on each endcap scintillator. The expected time
resolution for the two layers combined 
is between 100 and 110~ps for $K$'s and $\pi$'s,
providing 2$\sigma$ K/$\pi$ separation up to 0.9 GeV/c.


The TOF system measures the flight time of
charged particle. The velocity ($\beta c$) and mass ($m$) of the
charged particle can be calculated from
\begin{equation}
\displaystyle\beta = \frac{L}{c\times\tmea},\quad
m^{2}=p^{2}\times\frac{1-\beta^{2}}{\beta^{2}}, \label{eq:tof_m2}
\end{equation}
where $\tmea$ is the measured time-of-flight, $L$ and $p$ are the
corresponding flight path and momentum of the charged particle given
by MDC measurements, and $c$ is the velocity of light in vacuum.
The typical mass square distributions for electrons, pions, kaons
and protons in different momentum ranges are shown in
\figurename~\ref{fig:tof_dedx}(b).

The PID capability relies on good time resolution ($\sigma_{t}$) of the
TOF system.  $\sigma_{t}$ depends on the pulse height, hit
position, and the beam status.  Usually the value of $\sigma_{t}$
varies for different TOF counters due to different performance 
of the scintillator, PMT, and electronics. Since the TOF
measurements are correlated due to the common event start time, the
weighted time-of-flight for two layers is obtained by a correlation
analysis discussed below and in in Ref.~\cite{ref:bes3_tof}.

\BegFig
%\includegraphics[width=6cm]{./Part1/fig-pid/dedx_ph.eps}\quad
%\includegraphics[width=6cm]{./Part1/fig-pid/tof_m2.eps}
\includegraphics[width=14cm]{./Part1/fig-pid/dedx_tof.eps}
\caption{(a) The normalized pulse heights ($dE/dx$) vs. momentum of
charged particles; (b) The mass square distribution from TOF
measurements.} \label{fig:tof_dedx} \EndFig

\subsubsection{The CsI(Tl) Calorimeter}
\label{sec:pid_emc}

The CsI(Tl) crystal electromagnetic calorimeter (EMC) contains 6240
crystals, and is used to measure the energy of photons precisely.
The energy and spatial resolutions are 2.5\% and 0.6~cm at
1~GeV, respectively. The characteristics of an electromagnetic shower is
distinctive for the electron, muon and hadron, thus the energy deposited 
and the shape of the shower in the calorimeter can be used as 
discrimination variables for PID.

The energy deposited 
by minimum ionizing
charged particles passing at normal incidence
through the EMC crystals without interacting is about 0.165~GeV.
Electrons and positrons lose all of their 
energies in
the calorimeter by producing electromagnetic showers, the ratio
of deposited energy to the track momentum ($E/p$) will be
approximately unity. Sometimes the energy deposited by hadrons will
have an $E/p$ ratio higher than that of the expected by ionization
due to the nuclear interactions in the CsI material.
\figurename~\ref{fig:energy_deposit}(a) shows the energy deposited 
{\it versus}
momentum for $e$, $\mu$ and $\pi$ in the EMC.

\BegFig
%\includegraphics[width=6cm]{./Part1/fig-pid/energy.eps}\quad
%\includegraphics[width=6cm]{./Part1/fig-pid/shape1.eps}\\
%\includegraphics[width=6cm]{./Part1/fig-pid/shape2.eps}\quad
%\includegraphics[width=6cm]{./Part1/fig-pid/shape3.eps}
\includegraphics[width=14cm]{./Part1/fig-pid/emu_pion.eps}
\caption{(a) Energy deposit in the EMC vs. the momentum for $e$, $\mu$
and $\pi$; (b) ratio of $\eseed/\ethree$ for $e$, $\mu$ and $\pi$;
(c) ratio of $\ethree/\efive$ for $e$, $\mu$ and $\pi$; (d)
second-moment  distributions for $e$, $\mu$ and $\pi$.}
\label{fig:energy_deposit} \EndFig

The ``shape'' of the shower can be characterized by the three energies:
$\eseed$, the energy deposited in the central crystal; $\ethree$,
the energy deposited in the central $3\times3$ crystal array; and
$\efive$, the energy deposited in the central $5\times5$ crystal
array.  The ratios of $\eseed/\ethree$ and $\ethree/\efive$ for $e$,
$\mu$ and $\pi$ at 1 GeV/c are plotted in
\Figs.~\ref{fig:energy_deposit}(b) and~\ref{fig:energy_deposit}(c),
respectively.

The second-moment $S$ is defined as
\begin{equation}
\displaystyle S=\frac{\sum_{i}{E_{i}\cdot
d_{i}^{2}}}{\sum_{i}{E_{i}}},
\end{equation}
where $E_{i}$ is the energy deposited in the  $i^{\rm th}$ crystal, and
$d_{i}$ is the distance between the  $i^{\rm th}$ crystal and the center
position of reconstructed shower. The original idea of $S$ was
developed by the Crystal Ball experiment~\cite{ref:cb_secondmoment}
to distinguish clusters generated by $\pi^{0}$'s and $\gamma$'s. The
$S$ distributions for $e$, $\mu$ and $\pi$ at 1 GeV/c are shown in
\figurename~\ref{fig:energy_deposit}(d).

\subsubsection{The muon system}
\label{sec:pid_muc}

The magnet return yoke has nine layers of Resistive Plate Chambers
(RPC) in the barrel and eight layers in the endcap to form a muon
identifier. The spatial resolution is about 16.6~mm.

\BegFig
\includegraphics[width=6cm]{./Part1/fig-pid/depth.eps}\quad
\includegraphics[width=6cm]{./Part1/fig-pid/maxhits.eps}
\caption{(a)The travel depth of $\mu$ and $\pi$ in muon counter; (b)
The maximum number of hits for $\mu$ and $\pi$ in all RPC layers.}
\label{fig:muon vars} \EndFig

An electron's energy is exhausted in the calorimeter and  cannot
reach the muon counter. On the other hand
most of the hadrons pass through the material of
calorimeter and magnet coil, and are absorbed somewhere in the iron yoke.
Muons have a  strong penetrating probability and usually 
produce one hit in each layer. Hadrons can produce many hits in 
the layer near to where an interaction occurs. The distances 
between muon hits and
the extrapolated positions of an MDC track are used to reduce
hadron contamination to a low level, since the hits generated
by secondary muons from  $\pi/K$ decay will not match the
inner track very well. \figurename~\ref{fig:muon vars} shows the
distributions of penetration depth and the maximum number of hits in all
RPC layers for $\mu$'s and charged $\pi$'s with momentum  
in the range 0.8--1.5~GeV/c.

\subsection{The Likelihood Method}

Relative likelihoods (likelihood ratios) provide the most
powerful discrimination between particle identification 
hypotheses, and  the statistical significance
gives a measure of the consistency between data and the selected
hypotheses.

\subsubsection{Probability Density Functions}

The response of a detector to each particle species is given by a
probability density function (PDF), which, written as
${\cal{P}}(x;p, H)$, describes the probability that a particle of
species $H=e^{\pm},\mu^{\pm},\pi^{\pm}, K^{\pm},p,\bar{p}$ leaves a
signature $x$ described by a vector of measurements($dE/dx$, TOF,
$e/p$, ...). ${\cal{P}}(x;p,H)dx$ is the probability for the
detector to respond to a track of momentum $p$ and type $H$ with a
measurement in the range $(x, x+dx)$. As with any PDF, the integral
over all possible values is unity, $\int{\cal{P}}(x;p,H)dx=1$. Note
that the momentum is treated as part of the hypothesis for the PDF
and therefore is placed to the right of semicolon. Drift chamber
momentum measurements are usually of sufficient precision that they
can be treated as a given quantity. In borderline cases when the
precision is marginally sufficient, the PDF is 
sometimes smeared by the assumption
that the momentum is perfectly measured. 

The vector $x$ may describe a single measurement in one detector,
several measurements in one detector, or several measurements in
several detectors. The measurements may be correlated for a single
hypothesis. An example of correlated measurements within a single
device is $E/p$ and the shower shape of electrons in the EMC. An example
of correlated measurements in different detectors is the energy
deposited in the EMC and the muon chambers by charged
pions. In many cases the correlations are reasonably
small and the overall PDF can be determined as a product of the PDFs
for indivdual detectors. For example, the specific ionization
deposited by a charged track as it traverses the drift chamber has
almost no influence on time-of-flight measurements in the TOF.

The challenge of PID analysis is to determine the PDFs and their
correlations (if any) as well as to understand the uncertainties of these
distributions.

\subsubsection{Likelihood}

Given the relevant PDFs, the likelihood that a track with
measurement vector $x$ is a particle of species $H$ is denoted by
${\cal{L}}(H;p,x)$. Although the functional forms of
the PDFs and the
corresponding likelihood function are identical,
%\begin{equation}
%{\cal{L}}(H;p,x)\equiv{\cal{P}}(x;p,H)
%\end{equation}
the difference between ${\cal{L}}(H;p,x)$ and ${\cal{P}}(x;p, H)$ is
subtle: probability is a function of the measurable quantities $(x)$
for a fixed hypothesis $(p, H)$; likelihood is a function of
particle type $(H)$ for a fixed momentum $p$ and the measured value
$(x)$. Therefore, an observed track for which $x$ has been measured
has a likelihood for each particle type. Competing particle type
hypotheses should be compared using the ratio of their likelihoods.
Other variables having a one-to-one mapping onto the likelihood
ratio are equivalent. Two commonly used mappings of the likelihood
ratios are the difference of log-likelihoods and a normalized likelihood
ratio, sometimes called the likelihood fraction. For example, to
distinguish between the $K^{+}$ and $\pi^{+}$ hypotheses for a track
with measurements $x_{\textrm{obs}}$, these three quantities would
be written as:
\begin{equation}
{\cal{L}}(K^{+};p_{\textrm{obs}},
x_{\textrm{obs}})/{\cal{L}}(\pi^{+};p_{\textrm{obs}},
x_{\textrm{obs}}) \label{eq_likeli_ratio}
\end{equation}
\begin{equation}
\log\left({\cal{L}}(K^{+};p_{\textrm{obs}},
x_{\textrm{obs}})\right)-\log\left({\cal{L}}(\pi^{+};p_{\textrm{obs}},
x_{\textrm{obs}})\right)\label{eq_likeli_log}
\end{equation}
\begin{equation}
\frac{{\cal{L}}(K^{+};p_{\textrm{obs}},
x_{\textrm{obs}})}{{\cal{L}}(K^{+};p_{\textrm{obs}},
x_{\textrm{obs}})+{\cal{L}}(\pi^{+};p_{\textrm{obs}},
x_{\textrm{obs}})}\label{eq_likeli_frac}
\end{equation}
It can be shown rigorously that the likelihood ratio
(Eq.~\eqref{eq_likeli_ratio} and its equivalents
Eq.~\eqref{eq_likeli_log} and Eq.~\eqref{eq_likeli_frac})
discriminate between hypotheses most powerfully. For any particular
cut on the likelihood ratio, there exists no other set of cuts or
selection procedure that gives a higher signal efficiency for the
same background rejection.

There has been an implicit assumption made so far that there is
perfect knowledge of the PDF describing the detector. In the real
world, there are often tails on distributions due to track
confusion, nonlinearities in detector response, and many other
experimental sources that are imperfectly described by the PDFs. 
While deviations from the expected distribution can be determined 
from control samples of real data, the tails of these distributions 
are often associated with fake or badly 
reconstructed tracks. That is why additional consistency
tests should be made. 

\subsubsection{Weighted Likelihood}

In the case (such as particle identification) that the {\it a priori}
probabilities of competing hypotheses are known numbers,
${\cal{P_{A}}}(H)$, likelihood can be used to calculate the expected
purities of given selection criteria. Consider the case of $K/\pi$
separation, the fraction of kaons in a sample with measurement
vector $x$ is given by
\begin{equation}
{\cal{F}}(K;x)=\frac{{\cal{L}}(K;x)\cdot{\cal{P_{A}}}(K)}
{{\cal{L}}(\pi;x)\cdot{\cal{P_{A}(\pi)}}+{\cal{L}}(K;x)\cdot{\cal{P_{A}}}(K)}
\label{eq_wt_likeli}.
\end{equation}
This can be considered as a weighted likelihood ratio where the
weighting factors are {\it a priori} probabilities. The ${\cal{F}}(K;x)$
are also called {\it posteriori} probabilities, 
relative probabilities, or
conditional probabilities, and their calculation according to
Eq.~\eqref{eq_wt_likeli} is an application of Bayes' theorem. The
purity, {\it i.e.}, the fraction of kaons in a sample selected with,
say, ${\cal{F}}(K;x)>0.9$, is determined by calculating the number
of kaons observed in the relevant range of values of ${\cal{F}}$ and
normalizing to the total number of tracks observed there, {\it
e.g.},
\begin{equation}
\displaystyle \textrm{fraction}({\cal{F}}_H>0.9)=\frac
{\int_{0.9}^{1}\frac{dN}{d{\cal{F}}(H;x)}{\cal{F}}(H;x)d{\cal{F}}(H;x)}
{\int_{0.9}^{1}\frac{dN}{d{\cal{F}}(H;x)}d{\cal{F}}(H;x)}  ,
\end{equation}
where the integration variable is the value of ${\cal{F}}(H;x)$.

\subsubsection{An example of TOF and $dE/dx$ PID}

At \bes3, TOF and $dE/dx$ are most essential for hadron separation.
In the TOF detector, the time-of-flight $t$ is measured with
a Gaussian resolution $\sigma_{t}$ that is assumed to be a
constant($\sim 100$~ps). Similarly, the energy loss in the drift chamber
($dE/dx$) also has a Gaussian distribution with a resolution of
$\sigma_{E}\sim6.5\%$. If all incident particles are known to be
either pions, kaons and protons at some fixed momentum, then the
distributions of $t$ and $dE/dx$ will consist of the superposition of
three Gaussian distributions, centered at the central values of 
($t_{\pi}$, $t_{K}$,$t_{p}$ ) and ($(dE/dx)_{\pi}$, $(dE/dx)_{K}$,
$(dE/dx)_{p}$) for pions, kaons and protons. The PDF for the pion
hypothesis is the normalized probability function
\begin{equation}
\begin{matrix}
\displaystyle{\cal{P}}(t;\pi)=\frac{1}{\sqrt{2\pi}\sigma_{t}}
\exp\left[-\frac{1}{2}\left(\frac{t-t_{\pi}}{\sigma_{t}}\right)^{2}\right]\\
\displaystyle{\cal{P}}(\textrm{dE/dx};\pi)=\frac{1}{\sqrt{2\pi}\sigma_{E}}
\exp\left[-\frac{1}{2}\left(\frac{\textrm{dE/dx}-\textrm{(dE/dx)}_{\pi}}{\sigma_{E}}\right)^{2}\right] 
.
\end{matrix}
\end{equation}
The PDFs for the kaon and proton hypotheses have similar forms. Using 
the
observed time of flight $t$ and $dE/dx$ information, the likelihoods
for pion, kaon and proton can be constructed from
\begin{equation}
\begin{matrix}
{\cal{L}}(\pi)={\cal{L}}(\pi;t,\textrm{dE/dx})={\cal{P}}(t;\pi)\cdot{\cal{P}}(\textrm{dE/dx};\pi) 
 ,\\
{\cal{L}}(K)={\cal{L}}(K;t,\textrm{dE/dx})={\cal{P}}(t;K)\cdot{\cal{P}}(\textrm{dE/dx};K) 
 ,\\
{\cal{L}}(p){\cal{L}}(p;t,\textrm{dE/dx})={\cal{P}}(t;p)\cdot{\cal{P}}(\textrm{dE/dx};p)  
.
\end{matrix}
\end{equation}

We consider $K/\pi$ separation in a sample that consists of 80\%
pions and 20\% kaons. Using the observed time of flight $t$ and
energy loss in the drift chamber, it is possible to calculate the
relative probabilities of pions and kaons for these measured $t$ and 
$dE/dx$ values:
\begin{equation}
\begin{matrix}
 \displaystyle {\cal{F}}(\pi)=
\frac{{\cal{P_A}}(\pi){\cal{L}}(\pi)}{{\cal{P_A}}(\pi){\cal{L}}(\pi)+{\cal{P_A}}(K){\cal{L}}(K)} 
,\\
 \displaystyle {\cal{F}}(K)=
\frac{{\cal{P_A}}(K){\cal{L}}(K)}{{\cal{P_A}}(\pi){\cal{L}}(\pi)+{\cal{P_A}}(K){\cal{L}}(K)} 
.
\end{matrix}
\end{equation}
By  construction, ${\cal{F}}(\pi)+{\cal{F}}(K)=1$.  The
calculation of relative probabilities are illustrated in
\figurename~\ref{fig_lh_tofpid}. As shown in
\figurename~\ref{fig_lh_tofpid}, the $K/\pi$ separation at 0.6 GeV
is better than it is at 1 GeV. \BegFig
%\includegraphics[width=6cm]{./Part1/fig-pid/tofdx_06.eps}\quad
%\includegraphics[width=6cm]{./Part1/fig-pid/tofdx_08.eps} \\
%\includegraphics[width=6cm]{./Part1/fig-pid/tofdx_10.eps}\quad
%\includegraphics[width=6cm]{./Part1/fig-pid/tofdx_12.eps}
\includegraphics[width=14cm]{./Part1/fig-pid/lh.eps}
\caption{The relative likelihood constructed by combining the TOF
and $dE/dx$ information for track momenta of 0.6, 0.8 , 1.0 and
1.2 GeV/c. The time of flight distribution is calculated for a 1.0 m
flight distance.} \label{fig_lh_tofpid} \EndFig

\subsubsection{Cell analysis}

In the example presented above no correlations are assumed
between the particle identification provided by TOF and that
provided by $dE/dx$. This is an acceptable approach if 
the TOF is a purely
passive detector and there are no other sources of correlation. An
approach that takes into account all correlations explicitly is cell
analysis. Basically, you make a multi-dimensional histogram of all
relevant variables and compute the fraction of tracks that land in
each cell for each hypothesis. You can then use these fractions as
the likelihood. The result is optimal with all correlations
completely accounted for, if the cells are small enough.

The trouble with this approach is that as the number of variables
becomes larger, the number of cells quickly gets out of control. It
becomes impossible to find enough ``training events" to map out the cell
distributions with adequate statistics. Still, it is a viable
approach for a small number of variables and is well suited to a
problem such as combining $E/p$ and event shape in calorimeter. This
would, in principle, involve three variables: $E/p$, shape, and 
the dip angle,
and one might get by with relatively large cells. A judicious choice
of cells that uses our knowledge of the underlying physics can
greatly reduce the number of cells needed. {\it e.g.}, the dip angle
might be eliminated as a variable if a dip-corrected shape variable
could be
devised. If groups of highly correlated variables can be treated
together, we might be able to construct a set of relatively
uncorrelated likelihoods. It may be necessary to combine information
from several detectors to construct some of these variables.




\subsection{A correlation analysis of TOF PID}
\label{sec:corr_tofpid}

A charged particle passing through the barrel array of
scintillators  will produce signals in one or two layers of the TOF
counter, corresponding to two or four 
time-of-flight measurements. 
However, at \bes3 the problem of averaging 
more
than one TOF measurement is complicated because the different
measurements are correlated due to the common event start time. A better
choice would be a weighted average of the different measurements.

\subsubsection{General algorithm}

For the covariance matrix elements given by
$(V_{t})_{ij}=\langle\delta t_{i}\delta t_{j}\rangle$, where $\delta
t_{i} = t_{i}-\overline{t}$, $\overline{t}$ is the average of
$t_{i}$,  the definition of the standard deviation is 
\begin{equation}
\sigma^{2}_{\overline{t}}=\sum_{ij}{w_{i}w_{j}(V_{t})_{ij}},
\label{eq:sigma_weight}
\end{equation}
\noindent
where $\overline{t}=\sum_{i}w_{i}t_{i}$ and $\sum_{i}{w_{i}}=1$.
Using standard Lagrange multiplier techniques, we obtain: 
\begin{equation}
\displaystyle
w_{i}=\frac{\sum_{k}(V_{t}^{-1})_{ik}}{\sum_{jk}(V_{t}^{-1})_{jk}}.
\label{eq:weight_solution}
\end{equation}

\subsubsection{Errors and correlations of TOF measurements}

The TOF time resolution ($\sigma_t$) can be factorized into
the product $\sigma_{t}(Q)\cdot\sigma_{t}(z)$, where
$\sigma_{t}(Q)$ and $\sigma_{t}(z)$ are functions of the pulse
height $Q$ and the hit position $z$~\cite{ref:tof_correction}. The
function $\sigma_{t}(Q)$ is complicated, and 
needs further study based on 
on real data. On the other hand, the $z$-dependent time
resolution $\sigma_{t}(z)$ is known and 
similar for electrons, muons and
hadrons~\cite{ref:tof_correction}.
\figurename~\ref{fig:z_error_onelayer}(a) shows a typical variation
of $\sigma_{t}(z)$ from one readout unit as a function of $z$ for
Bhabha events. The time resolution becomes poorer when the hit
position is far from the readout end.

For a given barrel TOF counter,
the $\tmea$ in the left-end and the right-end readout units can be
decomposed as
\begin{equation}
  t_{1} = t_{c} + (t_{D})_{1},\quad
  t_{2} = t_{c} + (t_{D})_{2},
\label{eq:t12}
\end{equation}
where $t_{1}$ and $t_{2}$ represent the $\tmea$'s in two readout
PMTs, $t_{c}$ represents the common part of $t_{1}$ and
$t_{2}$ including the common start time, and 
$(t_{D})_{1}$ and $(t_{D})_{2}$ represent the uncorrelated
parts of $t_{1}$ and $t_{2}$.  The covariance matrix for $t_{1}$ and
$t_{2}$ can be expressed as
\begin{equation}
V_{t}=\begin{pmatrix}
\sigma^{2}_{1} &\sigma^{2}_{c} \\
\sigma^{2}_{c} &\sigma^{2}_{2}
\end{pmatrix},
\label{eq:two_end_cov}
\end{equation}
where $\sigma_{1}$ and $\sigma_{2}$ are the time resolution in the
left-end and the right-end readout units, and $\sigma_{c}$ is the
uncertainty in $t_{c}$. 
According to the definition of the covariance
matrix, we have the following expressions
\begin{equation}
\begin{matrix}
\displaystyle \sigma_{1}^{2}=\langle\delta t_{1}\delta
t_{1}\rangle=\langle\delta t_{c}\delta
t_{c}\rangle+\langle\delta(t_{D})_{1}\delta(t_{D})_{1}\rangle,\\
\displaystyle \sigma_{2}^{2}=\langle\delta t_{2}\delta
t_{2}\rangle=\langle\delta t_{c}\delta
t_{c}\rangle+\langle\delta(t_{D})_{2}\delta(t_{D})_{2}\rangle, \\
\displaystyle \sigma_{c}^{2}=\langle\delta t_{1}\delta
t_{2}\rangle=\langle\delta t_{c}\delta t_{c}\rangle,
\end{matrix}
\label{eq:cov_matrix_elem}
\end{equation}
where we have used the fact that the correlations $\langle\delta
t_{c}\delta(t_{D})_{1}\rangle=0$, $\langle\delta
t_{c}\delta(t_{D})_{2}\rangle=0$ and
$\langle\delta(t_{D})_{1}\delta(t_{D})_{2}\rangle\approx 0$.


To get $\sigma_{c}$ conveniently, we define two new time
variables
\begin{equation}
\displaystyle t_{+}=\frac{t_{1}+t_{2}}{2},\quad \displaystyle
t_{-}=\frac{t_{1}-t_{2}}{2}. \label{eq:tpm}
\end{equation}
The fluctuations of $t_{+}$ and $t_{-}$ can be expressed as
\begin{equation}
\begin{matrix}
\displaystyle \sigma_{+}^{2} = \langle\delta t_{+}\delta
t_{+}\rangle =
\frac{\sigma_{1}^{2}+\sigma_{2}^{2}}{4}+\frac{\sigma_{c}^{2}}{2},\\
\displaystyle \sigma_{-}^{2} = \langle\delta t_{-}\delta
t_{-}\rangle=\frac{\sigma_{1}^{2}+\sigma_{2}^{2}}{4}-\frac{\sigma_{c}^{2}}{2},
\end{matrix}
\label{eq:res_tpm}
\end{equation}
where $\sigma_{+}$ and $\sigma_{-}$ are the time resolution of
$t_{+}$ and $t_{-}$. The value of $\sigma_{c}$ can be directly 
extracted as
$\sigma_{c}=\sqrt{\sigma^{2}_{+}-\sigma^{2}_{-}}$.
\figurename~\ref{fig:z_error_onelayer}(b) shows the distributions of
$\sigma_{+}(z)$, $\sigma_{-}(z)$ and $\sigma_{c}(z)$, where
$\sigma_{c}(z)$ is approximately a constant.
Substituting the expression of Eq.~\eqref{eq:two_end_cov}
into Eqs.~\eqref{eq:sigma_weight}$-$\eqref{eq:weight_solution}, we
get
\begin{equation}
\displaystyle
w_{1}=\frac{\sigma^{2}_{2}-\sigma^{2}_{c}}{\sigma^{2}_{1}+\sigma^{2}_{2}-2\sigma^{2}_{c}},\quad
w_{2}=\frac{\sigma^{2}_{1}-\sigma^{2}_{c}}{\sigma^{2}_{1}+\sigma^{2}_{2}-2\sigma^{2}_{c}},
\label{eq:sol_w12}
\end{equation}
and
\begin{equation}
 \displaystyle \sigma^{2}_{\overline{t}} =
\frac{\sigma^{2}_{1}\cdot\sigma^{2}_{2}-\sigma^{4}_{c}}{\sigma^{2}_{1}+\sigma^{2}_{2}-2\sigma^{2}_{c}}.
\label{eq:sol_sigma}
\end{equation}
The resulting $\sigma_{ \overline{t}}$ as a function of $z$ is shown in
\figurename~\ref{fig:z_error_onelayer}.  

\BegFig
\includegraphics[width=9cm]{./Part1/fig-pid/z_error_single_end.eps}\\
\includegraphics[width=9cm]{./Part1/fig-pid/z_corr_two_end.eps}\quad
\includegraphics[width=9cm]{./Part1/fig-pid/z_corr_two_layer.eps}

\caption{(a)~The variation of $\sigma_{t}(z)$ for the left-end and
the right-end readout unit in a barrel TOF counter; (b)~Time resolution
of $t_{+}$, $t_{-}$, $t_{c}$ and the weighted time $\bar{t}$ for a
one-layer TOF measurement; (c)~The correlations between the two 
TOF layer measurements, where
$\sigma_{L_{c}}(z)=\sqrt{\sigma^{2}_{+}(z)-\sigma^{2}_{-}(z)}$.}
\label{fig:z_error_onelayer} \EndFig

\subsubsection{Combining the time-of-flight from two-layer
measurements}


Similar to the method adopted for the one-layer
measurement, we can construct the covariance matrix for
the two-layer
measurement case as follows
\begin{equation}
V_{t}=\begin{pmatrix}
      \sigma^{2}_{L_{1}} &\sigma^{2}_{L_{c}} \\
      \sigma^{2}_{L_{c}} &\sigma^{2}_{L_{2}}
      \end{pmatrix} ,
\label{eq:two_layer_cov}
\end{equation}
where $\sigma_{L_{c}}$ is the correlation between two-layer
measurements.
Substituting $t_{1}$, $t_{2}$ with $t_{L1}$, $t_{L2}$ in
Eqs.~\eqref{eq:t12} and \eqref{eq:tpm}, we get the corresponding
errors and correlations. 
The weighted time-of-flight of two-layer measurements is easily
obtained by applying the covariance matrix of
Eq.~\eqref{eq:two_layer_cov} in Eq.~\eqref{eq:sol_w12}. The
resulting $\tmea-\texp$ are shown in
\figurename~\ref{fig:delt_tof}(a). 

\BegFig
\includegraphics[width=10cm]{./Part1/fig-pid/delt_tof.eps}
\caption{$\Delta t=\tmea-\texp$ distributions: (a)~$\bar{t}$ is
weighted by $\bar{t}_{L_{i}}(i=1,2)$, $\bar{t}_{L_{i}}$'s are the
average time in each layer and are weighted by $t_{E_{i}}(i=1,2)$,
$t_{E_{i}}$'s are the TOF measurements in each end of readout units;
(b)~$\bar{t}$ is directly weighted by $t_{E_{i}}(i=1,2,\ldots,4)$,
$t_{E_{i}}$'s are the TOF measurements in the four-end of readout
units.} \label{fig:delt_tof} \EndFig

The apparatus of barrel TOF array can be considered as providing
four independent measurements of the time-of-flight for
a charged particle. The covariance matrix of TOF measurements can be
constructed as
\begin{equation}
V_{t}=\begin{pmatrix}
       \sigma^{2}_{1} &\sigma^{2}_{c} &\sigma^{2}_{c}
       &\sigma^{2}_{c} \\
       \sigma^{2}_{c} &\sigma^{2}_{2} &\sigma^{2}_{c}
       &\sigma^{2}_{c} \\
       \sigma^{2}_{c} &\sigma^{2}_{c} &\sigma^{2}_{3}
       &\sigma^{2}_{c} \\
       \sigma^{2}_{c} &\sigma^{2}_{c} &\sigma^{2}_{c}
       &\sigma^{2}_{4}
       \end{pmatrix}.
\label{eq:four_end_cov}
\end{equation}
In Eq.~\eqref{eq:four_end_cov}, $\sigma_{i}(i=1,2,\ldots,4)$ are the
resolutions of all readout units, the correlations ($\sigma_{c}$)
between the two-end of readout units in each layer,
and the correlation between two-layer measurements are in fact the same.
Employing the covariance matrix Eq.~\eqref{eq:four_end_cov} in
Eqs.~\eqref{eq:sigma_weight}$-$\eqref{eq:weight_solution}, the weight
factors $w_{i}(i=1,2,\ldots,4)$ can be easily calculated. The
resulting $\tmea-\texp$ distribution is shown in
\figurename~\ref{fig:delt_tof}(b).

As shown in \figurename s~\ref{fig:delt_tof}(a) and
\ref{fig:delt_tof}(b), the resulting time resolutions from two
weighting methods are consistent. The standard weighted method
adopted in the TOF calibration/reconstruction software
will be in two steps: combining the two-end TOF measurements in each
layer; calculating the weighted time from the two-layer
measurements.




\subsection{Applying the ANN technique in PID algorithm at \bes3}
\label{bes3_pid}

If the variables are not highly correlated, multiplying  the
likelihood associated with each variable should suffice. If
correlations are simple enough, a change of variables or a cell
analysis may suffice. If the variables are highly correlated, neural
nets and other opaque boxes might construct near-optimal
discrimination variables. The PDFs for the resulting variables can 
be used as the basis for a likelihood analysis. Using the same
formalism for neural network outputs as for conventional likelihood
analyses allows modular design of analysis software with no loss of
information and optimal discrimination between hypotheses.

At present, a class of Multilayer Perceptrons
(MLP)\cite{ref:root_nn} neural network has been applied to 
the \bes3 PID
algorithm and is implemented in ROOT~\cite{ref:root}. The PID
variables described in Section~{\ref{sec:pid_emc}} and
Section~\ref{sec:pid_muc} are correlated each other. With no loss of
information, a cell analysis may not be sufficient for the
likelihood method to get an optimal result. Since the
correlations of PID variables among sub-detectors are reasonably
small and can be ignored, the neural networks can be configured 
sequentially. 

\subsubsection{ Brief description of the artificial neural network  }
\label{sec:ann}

An artificial neural network~\cite{ref:pid_ann} is a computational
structure inspired by the study of biological neural processing.
Feed-forward neural networks, also known as multilayered
perceptrons, are most popular and widely used. The output of a
feed-forward neural network trained by minimizing, for example, the
mean square error function, directly approximates the Bayesian
posterior probability without the need to estimate the
class-conditional probabilities separately. A feed-forward neural
network (NN) is shown schematically in
\figurename~\ref{fig:mlp_neural}. Such networks provide a general
framework for estimating non-linear functional mapping between a set
of input variables {\bf x}($x_{1}$, $x_{2}$, $\ldots$, $x_{N}$) and
an output variable $O({\bf x})$ (or a set of output variables)
without requiring a prior mathematical description of how the output
formally depends on the inputs.

\BegFig
\includegraphics[width=12cm]{./Part1/fig-pid/mlp_neural.eps}
\caption{The schematic structure of a multilayered perceptrons'
neural network: the input layer contains $N$  neurons as input
variables ($x^{0}_{i=1, 2, \ldots, N}$); the output layer contains
(two) neurons for signal and background event classes; in between
the input and output layers are a number of $k$ hidden layers with
arbitrary number of neurons ($x^{k}_{j=1, 2, \ldots, M_{k}}$). }
\label{fig:mlp_neural} \EndFig

The network is made of neurons characterized by a bias and weighted
links in between, the links are called synapses. A layer of
neurons makes independent computations on the data, and so it
receives and passes the results to another layer. The next layer may
in turn make its independent computations and pass on the results to
yet another layer. Finally, the processed results of the network can
be determined from the output neurons. As indicated in the sketch,
all neuron inputs to a layer are linear combinations of the neuron
output of the previous layer. For a given neuron $j$ in layer $k$,
we have the following equation
\begin{equation}
\displaystyle x^{k}_{j}= A\left(w^{k}_{0j}+
\displaystyle \sum_{i=1}^{M_{k-1}}{w^{k}_{ij}\cdot x^{k-1}_{i}}\right),
\label{eq:nn_transfer}
\end{equation}
where $x^{k-1}_{i}(i=1, 2, \ldots, M_{k-1})$ represents the input
signal from the previous layer $k-1$, $M_{k-1}$ is the total number
of neurons in layer $k-1$, $w^{k}_{ij}$'s represent the synaptic
weights of neuron $j$, the bias term $w^{k}_{0j}$ (not shown in
\figurename~\ref{fig:mlp_neural}) is acquired by adding a new
synapse to neuron $j$ whose input is $x^{k-1}_{0j}=1$. The transfer
from input to output within a neuron is performed by means of an
``activation function'' $A(x)$. In general, the activation function
of a neuron can be zero (deactivated), one (linear), or non-linear.
For a hidden layer, a typical activation function used in
Eq.~\eqref{eq:nn_transfer} is a sigmoid
\begin{equation}
\displaystyle A(x)=\frac{1}{1+e^{-x}}. \label{eq:nn_sigmoid}
\end{equation}
The transfer function of the output layer is usually linear. As a
consequence: a neural network without a hidden layer should give
identical discrimination power as a linear discriminant analysis
like the Fisher discriminator. In case of one hidden layer, the
neural network computes a linear combination of sigmoids.

The number of parameters (the synaptic weights $w^{k}_{ij}$'s in
Eq.~\eqref{eq:nn_transfer}) need to grow only as the complexity of
the problem grows. The parameters are determined by minimizing an
error function, usually the mean square error between the actual
output $O^{p}$ and the desired (target) output $t^{p}$,
\begin{equation}
\displaystyle E=\frac{1}{2N_{p}}\sum_{p=1}^{N}(O^{p}-t^{p})^{2},
\label{rq:nn_error}
\end{equation}
with respect to the parameters. Here $p$ denotes a feature vector or
pattern. The stochastic optimization algorithm used in learning
enables the model to be improved a little bit for each data point in
the training sample. Neural networks provide a very practical tool
because of the relatively small computational times required in
their training. Their fast convergence as well as their robustness in
supervised learning of multilayered perceptrons are due to the efficient
and powerful algorithms that have been developed in recent years.


\subsubsection{The configuration of PID networks}


The PID variables selected from each sub-detector together with the
incident momentum and the transverse momentum have been grouped and
trained separately, each sub-detector (the barrel part and the
endcap part) has one output. In this step, the neural network for each
sub-detector is quite simple. Almost all sub-networks are configured
with one hidden layer containing 2$N$ hidden neurons, where $N$ is
the number of the input neurons. A total of 50,000 single track events for 
each particle species with momentum ranging from 0.1 GeV/c to 1.6 GeV/c
and $-0.83<\cos\theta<0.83$ are trained for this neural network, where
$\theta$ is the incident polar angle. The output values are
constrained to be 1, 2, 3, 4 and 5 for electron, muon, pion, kaon
and proton, respectively. The training results for each sub-detector
are shown in
\Figs~\ref{fig:detector_performance}(a)--\ref{fig:detector_performance}(d).
%Since the offline software system for some of the endcap detectors
%are not well established now, here and below we just show the
%training results for the barrel part of detectors.

The muon and pion bands are merged into one single peak (around
2.5) in the $dE/dx$, TOF and EMC outputs. The  EMC
and MUC information is not very applicable
for kaon and proton identification;
the EMC output
does provide some muon- pion discrimination. The MUC output
can separate muons from hadrons quite clearly.

\BegFig
%\includegraphics[width=6cm]{./Part1/fig-pid/val_dedx.eps}\quad
%\includegraphics[width=6cm]{./Part1/fig-pid/val_tof.eps}\\
%\includegraphics[width=6cm]{./Part1/fig-pid/val_emc.eps}\quad
%\includegraphics[width=6cm]{./Part1/fig-pid/val_muc.eps}
\includegraphics[width=14cm]{./Part1/fig-pid/dedx-color.eps}
\caption{NN outputs of sub-detectors. (a)~$dE/dx$ output; (b) TOF
output; (c) EMC output; (d) MUC output.}
\label{fig:detector_performance} \EndFig

The neural network outputs from the sub-detectors can be combined in
several ways to get near-optimal discrimination variables. For
example, the probability density functions (PDF) for the resulting
variables can be used as the basis for a likelihood analysis, or can
be used as the input variables for a sequential network. At present,
a conventional likelihood analysis based on the neural network output
variables and a sequential neural network analysis are applied in parallel
to the \bes3 PID algorithm. The sequential neural networks consists of
two input momentum variables and four input PID variables. The
momentum variables are the incident momentum and the transverse
momentum. The PID variables include the neural outputs from $dE/dx$
($\odedx$), TOF ($\otof$), EMC ($\oemc$) and MUC ($\omuc$) system
(the barrel part and the endcap part separately). The neural network is
configured with one hidden layer of ten hidden neurons.
Electron, muon, and hadron separations are studied with several
simulated Monte Carlo samples through different configurations of
networks. Cuts are put on the output of final discrimination
variables (the output of sequential network $\oseq$).


\subsubsection{Muon identification}

Muon candidates are required to have some response in the 
$\mu-$identifier.
The sequential neural network is trained with two PID variables: the
$\omuc$ and the $\oemc$. The $\mu-$ID abilities are studied in
different momentum partitions by comparing the discrimination
results from $\omuc$ and $\oseq$. \Figs~\ref{fig:pid_eff}(a) and
\ref{fig:pid_eff}(b) show the variations of the muon identification
efficiency and pion contamination rate as functions of incident
track momentum, where the track momentum is required to be greater
than a cut-off threshold ($\sim$500 MeV/c). Above 0.8 GeV/c, the
muon identification efficiency is around 90\%, and the pion
contamination rate is about 5\%. Additional information from the EMC
may help improve the $\mu-$ID ability.

As experienced in the BaBar experiment~\cite{ref:babar_muid}, the
additional variables, {\it e.g.}, the goodness of muon track fit and the
goodness of the muon track matching to the extrapolation position
from inner track system, may help reduce the background
contamination rates. These inputs will be studied at \bes3 in
the future.



\subsubsection{Electron identification}

\figurename~\ref{fig:pid_eff}(c) shows the variations of electron
identification efficiency and pion misidentification rate in
different momentum intervals as a function of cuts on $\oemc$. Above 0.6
GeV/c, one can see that the electron-ID efficiency is greater than
95\% while the pion contamination rate can be as low as $\sim 10^{-3}$.
On the other hand, with  $\oemc$ alone,
the $e/\pi$ separation is quite poor for low momentum 
tracks ({\it i.e.} less than 0.4 GeV/c).

\BegFig
\includegraphics[width=5cm]{./Part1/fig-pid/mupi1.eps}\quad
\includegraphics[width=5cm]{./Part1/fig-pid/mupi2.eps} \quad
\includegraphics[width=5cm]{./Part1/fig-pid/eepi1.eps}\\
\includegraphics[width=5cm]{./Part1/fig-pid/eepi2.eps} \quad
\includegraphics[width=5cm]{./Part1/fig-pid/kkpi1.eps}\quad
\includegraphics[width=5cm]{./Part1/fig-pid/kkpi2.eps}
\caption{PID efficiencies and contamination rates in different momentum
partitions. (a)~$\mu/\pi$ separation with $\omuc$; (b)~$\mu/\pi$
separation with $\omuc$ and $\oemc$; (c)~$e/\pi$ separation with
$\oemc$; (d)~$e/\pi$ separation with $\oemc$, $\otof$ and $\odedx$;
(e)~$K/\pi$ separation with the likelihood method; 
(f)~$K/\pi$ separation
with neural networks. In (c) and (d), the pion contamination rates are
enlarged by a factor of ten.} \label{fig:pid_eff} \EndFig

Both $\odedx$ and $\oemc$ are good discrimination variables to
separate electrons from pions above 0.4 GeV/c. $\otof$ can
separate $e/\pi$ quite effectively below 0.3 GeV/c. The neural network
trained with $\odedx$, $\otof$ and $\oemc$, shown in
\figurename~\ref{fig:pid_eff}(d), offers a nearly
uniform acceptance and background contamination between 0.25 GeV/c
and 1.6 GeV/c. It is interesting to note that the acceptance hole
between 0.2~GeV/c and 0.4 ~GeV/c almost vanishes after 
the application of an appropriate cut, 
even though no detector has clear discrimination power
for electrons in this region. 
The system is obviously making the inference that the
particle has to be an electron if it is not one of the others. This
is the combined contribution from the sub-detectors.


\subsubsection{ $\pi/K$ separation}

It is  generally believed that proton identification 
will be extremely good using the 
TOF and $dE/dx$ information at \bes3. Hence, only the
$K/\pi$ separation is focused on here. As discussed in Section
{\ref{sec:pid_sys}}, the $dE/dx$ can identify $K$'s and $\pi$'s very 
effectively below 0.6~GeV/c; the two-layer TOF can 
separate $K/\pi$ up to momenta of 0.9~GeV/c.

Traditionally, a likelihood method that combines the TOF and $dE/dx$
information is applied to hadron identification. To
construct the PDFs, data are divided into several bins in momentum
and $\cos\theta$ partitions to obtain the corresponding resolutions
and offsets. \figurename~\ref{fig:pid_eff}(e) shows the variation
of kaon identification efficiency and pion contamination rate as a
functions of momentum. In the real world, there are often tails on
distributions due to track confusion, nonlinearities in detector
response, and other experimental sources that are imperfectly
described in the PDFs. In light of this, it is helpful to apply 
the NN technique to hadron separation.

The network is
trained with two PID variables: $\otof$ and $\odedx$. The
PID ability is studied as a function of cuts on the output of 
the sequential
neural network $\oseq$.   The results are shown in
\figurename~\ref{fig:pid_eff}(f). Both the likelihood method and the
neural network method give similar results. Below 1~GeV/c, one
can see that the kaon-ID efficiency is greater than 95\% while the
pion contamination rate is less than 10\%. The $K/\pi$ separation is
extremely good for low momentum tracks ({\it i.e.}, less than 0.8 GeV/c).

\subsection{Future PID algorithms for \bes3}

The shapes of the PID variables from the EMC and MUC systems are 
complicated and there may exist non-linear correlations between 
between.
It is difficult for the likelihood method to construct the PDFs
analytically and handle these correlations properly. From our studies,
good electron-ID and muon-ID can be easily achieved from the neural
network at \bes3 with full detector information. In a simple
application, {\it e.g.}, for hadron separation, we get similar results
from the the neural network and the likelihood methods, where the PID
variables in TOF and $dE/dx$ systems are quasi-Gaussian, and the
correlation between two-layer TOF measurements is approximately
linear. Hence a flexible configuration of PID neural 
networks is employed
for both simple and complicated applications.

There are still a lot of factors that have to be taken into account
while applying the artificial neural network techniques to
particle identification at \bes3. For example, one or several input
variables may have to be removed due to the imperfect consistency
between data and Monte Carlo simulation. Impurities in the training
samples may introduce additional systematical uncertainties. More
detailed studies are needed in the future. Now the likelihood and
the artificial neural network PID algorithms are 
being studied in parallel.
The final \bes3 PID algorithm will definitely be a combination
of all the methods such as, for example, using the likelihood
method to combine the neural network outputs from sub-detectors. 
