\documentclass{chowto}

\title{BCM Calibration}
\howtotype{expert} % ``expert'', ``user'', ``reference''
%\experiment{Name of experiment} % Optional
\author{Dave Mack, Stephen A. Wood}
\category{general} % Subject area of this document
\maintainer{Stephen A. Wood} % Optional
\date{April 18, 2003} % Can use \today as the argument

\begin{document}
The Hall C Beam Current Monitors (BCMs) are calibrated using an Unser monitor
located in Hall C as a reference.  These
calibrations are used both in the EPICS system which displays the BCM1 and
BCM2 currents and in data analysis.  This document describes how to make these calibrations
\begin{abstract}

\end{abstract}

\section{Background}
This section will contain background information on how the Unser monitor,
and BCM's work as well as the electronics that are used.

In summary:

There are three devices used in current measurement in the
Hall.  Once calibrated, the two BCM's are stable and linear over a wide
current range.  However, the BCM's, being cavity resonant devices are only
sensitive to CW beam and so can not be bench calibrated with known current
sources.  Thus the BCM's are cross-calibrated with an Unser Monitor\cite{bi:unser}
(Direct Current Transformer).  The Unser Monitor has been calibrated with
known currents in wires, however, the ``offset'' on the calibration is
noisy and the time average offset drifts in unpredictable ways.  By
measuring a series of currents over a short period of time, this drift can
be minimized so that calibrations can be transferred to the BCM's.

The outputs of the front end electronics for these three devices are small
voltages.  These voltages are digitized by the use of V/F (voltage to
frequency) converters.  Scalers are used both in the control system
(EPICS) and in the data acquisition to record these digitized signals.

\section{Obtaining a BCM Calibration}

Obtaining a BCM calibration consists of two steps that cross calibrate the
BCM's to the Unser Monitor.  First the response of the Unser and the BCM's
is measured at a series of beam currents that cover the range of beam
currents to the current experiment.  Second those measurements are
analyzed to produce calibration constants for the BCM's.


\subsection{Data Collection}

The following is the recommended method of acquiring BCM calibration
data.  This procedure was designed for the Spring 2003 Hall C running.  
For other
experiments the procedure may be modified, depending on the range of
currents required by the experiment, but the procedure will be similar.

\begin{description}
\item[Goal] The goal is to perform a current monitor calibration over the range
10 to 100 $\mu$A.

\item[Estimated Duration] 1 hour

\item[When] Soon after startup, but reliable high current beam is needed.

\item[Impact on other halls]  The calibration is normally invasive because, without
turning off the other Hall lasers, it is the only sure way to get the required
0.000 microA needed for the Unser zero offset measurements. 
\end{description}

\begin{enumerate}

\item The Run Coordinator needs to make pre-arrangements with the other
halls since we're shutting them off for one hour.

\item Put in either of the 4 cm cryotargets. The choice of target isn't
critical, but these are least likely to trip off the beam due to 
excessive dose rates in the ion chambers. 

\item Find out if the MCC can deliver 100 microA. If they can't, the Run
Coordinator needs to decide whether it's worth proceeding. 

\item Make sure our data acquisition is working, and that BCM and CLOCK
scalers are counting. Prescale away most spectrometer triggers so the daq is 
less likely to crash in the middle of the calibration.

\item Ask the operator to turn off non-Hall C lasers.

\item Start a "BCM Calibration Run" now before you forget. 


\item Tell the operator your nominal current cycle will be:

0, 10, 0, 20, 0, 30, 0, 40, 0, 50, 0, 60, 0, 70, 0, 80, 0, 90, 0, 100,

and should then be repeated. Each current setting should be 1.5-2 minutes
duration. 

If the green light is flashing on the scaler crate, you're probably taking
data. The files are usually small enough to fit in the daq buffer, so the 
output .log file will be nearly empty until you finally stop the run. 

\item (FINAL): After the calibration run is over, please replay completely, 
taking care to output the charge scalers \verb|via charge####.txt|. 

\end{enumerate}

\subsection{Data Analysis}
At this point, data analysis must be done by a BCM expert (Dave Mack).

The basic principle of the analysis is as follows.  The Unser monitor has
a well known calibration, but it has an offset that is both noisy and
drifts with time.  In taking the calibration data, each different beam
current is bracketed by a period of beam off so that the drifting offset
can be well determined for each different beam current used in the
cabibration.  With these offsets determined, the average current for each
nominal current is well determined and the unser calibration can be
trasnferred to the BCM's.  The BCM's are not linearly, particularly at
small currents, so the calibration fit is made using only currents over
the range that is required by the experiment.  Typically this means that
zero current is excluded from the fit.

\section{Using the BCM calibration}

The result of the BCM calibration is a straight line fit, a gain and a
slope, that converts the V/F frequencies or total counts measured by DAQ or controls
scalers into current or total charge.  (Usually the unit is
microamps/microcoulombs, but some experiments may prefer nano
amps/coulombs.)

\subsection{EPICS}

The EPICS variables for Hall C beam current are \verb|ibcm1| and
\verb|ibcm2| (Accelerator also has copies of the signals known as
\verb|hallc:bcm1| and \verb|hallc:bcm2|.  The beam currents are
calculated by the EPICS IOC \verb|vmec15|.

Changing the EPICS BCM calibration should be done only at the request of
the Run Coordinator or a BCM expert.  To change the EPICS calibrations,
logon to \verb|cvxwrks@cdaqs1| and do the following.
\begin{verbatim}
  cd $EPBCM/db/sr/vmec15
  emacs part_scaler.hw
\end{verbatim}
Once editing that file, find the line:
\begin{verbatim}
PV: ibcm1    Type: ai
\end{verbatim}
and scroll down to find lines that look like:
\begin{verbatim}
AOFF 250553
ASLO 0.0000856942
\end{verbatim}
These two lines are the Offset and Slope (Gain).  Replace the numbers
there with the numbers from the calibration for BCM1.  Then find:
\begin{verbatim}
PV: ibcm2    Type: ai
\end{verbatim}
and replace the corresponding \verb|AOFF| and \verb|ASLO| parameters
there.

After saving this file, do the following:
\begin{verbatim}
cat part_*.hw > CaenScalervmec15.hw
mv CaenScalervmec15.hw ..
cd $EPBCM/sch
make
\end{verbatim}
At this point, reboot \verb|vmec15| using the reboot
panel\cite{howto:rebootpanel}.

\subsection{On and Off-line Analysis}
To impliment new BCM calibration constants in the On and Off line
analyzer, consult the analysis expert for your experiment.

\end{document}

% Revision history:
% $Log: bcm_calibration.tex,v $
% Revision 1.3  2004/10/06 14:14:50  saw
% Update path of EPICS database file
%
% Revision 1.2  2003/06/12 16:19:19  saw
% Minor Change
%
% Revision 1.1  2003/04/18 20:43:35  saw
% First Draft
%
