[user/user-gui-mbs.tex]
\label{user-gui-mbs-chapter}
\lsection[MBS event building]{user:mbs}{\mbs\ event building}
\subsection[MBS setup]{\mbs\ setup}
Any \mbs\ system can be controlled by the \dabc\ GUI.
It can run in two operation modes: with \mbs\ event builder or \dabc\ event builder
(see \paref{user:mbsapp}).
The first case means a standard \mbs\ system.

To control a standard \mbs\ nothing has to be done by the user on the \mbs\ side.\\
\strong{Except}
\bbul
\item The node running the GUI must get granted \verba{rsh} access at least to the
\mbs\ node where the prompter or dispatcher shall run. This means that the node name and user name of the GUI node must be in 
the \verba{.rhosts} file in the Lynx home directory 
\item The node name of the Lynx node itself also must be in \verba{.rhosts}.
\item In the user's \mbs\ startup file (typically \verba{startup.scom}) the \verba{m\_daq\_rate} task must be started as last task (this is probably the case already).
This task calculates the rates. The GUI waits for this task after execution of
the startup file. Because \mbs\ has no states there is no other way to
know when the startup has finished.
\ebul
Of cause, the \mbs\ itself must have been built with the DIM option (since version v5.1).
Central log file is written as usual.
Optionally one can provide a text file with specifications which parameters
shall be published by DIM (see \paref{user:MbsDimconfig}).

For the standard \mbs\ control one needs no \dabc\ installation.
The GUI jar file is sufficient. DIM must be installed.
See installation guide on the download page.

\lsubsection[MBS control panel]{user:controlMbs}{\mbs\ control panel}
\figpng{user-gui-pan-mbs}{MBS controller.}{htb}{0}{0.6}
Fig. \paref{fig:user-gui-pan-mbs} shows the panel to be used to control
a standard \mbs.
The values are restored from file {\tt MbsControl.xml} (default, may be saved to other file,
see \paref{user:guiSaveRestore}).
The file {\tt MbsControl.xml} can be created easily in the GUI itself
by filling the input fields of the control panel and save.

{\small \begin{verbatim}
<?xml version="1.0" encoding="utf-8"?>
<MbsLaunch>
<MbsMaster prompt="MBS Master" value="node-xx" />
<MbsUserPath prompt="MBS User path" value="myMbsDir" />
<MbsSystemPath prompt="MBS system path" value="/mbs/v51" />
<MbsStartup prompt="MBS startup" value="startup.scom"/>
<MbsShutdown prompt="MBS shutdown" value="shutdown.scom"/>
<MbsCommand prompt="Script command" value="whatever command" />
<MbsServers prompt="%Number of needed DIM servers%" value="3" />
</MbsLaunch>
\end{verbatim}
}
\bdes
\item[MbsMaster]: Lynx node where the \mbs\ prompter is started.
\item[MbsUserPath]: \mbs\ user working directory. The GUI need not to have
access to that filesystem.
\item[MbsSystemPath]:  Path on Lynx where the \mbs\ is installed. GUI needs no access to this path.
\item[MbsStartup]: The user specific \mbs\ startup command procedure, typically \verba{startup.scom},
located on user path.
\item[MbsShutdown]: The user specific \mbs\ shutdown command procedure, typically \verba{shutdown.scom},
located on user path.
\item[MbsCommand]: With \keyw{RET} an \mbs\ command in executed (on current node).
The shell script button executes this string as \verba{rsh} command on master node.
\item[MbsServers]: Number of nodes plus prompter. This information
is minimum for the GUI to know when all \mbs\ nodes are up. The GUI waits until
this number of DIM servers is up and running.
\edes
That file can be created from within the GUI in the \mbs\  controller panel.
Enter all values necessary, and store them. 

\subsubsection[MBS controller buttons]{\mbs\  controller buttons}
\icon{savewin} Save panel settings, see \paref{user:guiSaveRestore}.\\
\icon{connprm}  Execute script \verba{prmstartup.sc} at master node.
Starts prompter, dispatchers and message loggers and waits until they are up.
Trigger the main \keyw{Update}.
A progress panel pops up during that time (see \paref{user:guiProgress}).\\
\icon{conndsp} Execute script \verba{dimstartup.sc} at master node.
Starts dispatcher and message logger for single node \mbs.
Trigger the main \keyw{Update}.\\
\icon{dabcconfig} Configure. Execute user's \mbs\ startup procedure in prompter (dispatcher).
Wait for all \verba{m\_daq\_rate} tasks are running. Trigger the main \keyw{Update}.\\
\icon{dabcstart} Start acquisition. Execute \comm{Start acquisition}. Wait for all
acquisition states go into \keyw{Running}.\\
\icon{dabcstop} Pause acquisition. Execute \comm{Stop acquisition}. Wait for all
acquisition states go into \keyw{Stopped}.\\
\icon{mbsstop} Halt acquisition. Execute user's \mbs\ shutdown procedure in prompter.
Prompter, dispatcher and message loggers should still be running.\\
\icon{disconn} Shut down all. Execute script \verba{prmshutdown.sc} at master node.
After 2 seconds trigger the main \keyw{Update}.\\
\icon{info} \comm{Show acquisition}. Output in log panel.\\
\icon{controlmbs} Shell script executes command on master node.
\subsection[MBS command panel]{\mbs\ command panel}
\figpng{user-gui-pan-cmd-mbs}{Command panel.}{htb}{0}{0.9}
Fig. \paref{fig:user-gui-pan-cmd-mbs} shows
on the left side the command tree. Double click (or \keyw{RETURN}) on a command
executes the command. The top tree level is the executing \mbs\ task,
below that are the commands, and the master node (prompter node) is the only node
below each command. However,
command is sent to the prompter node, but executed on the current node 
which is displayed in the info panel
(see Fig. \paref{fig:user-gui-pan-cmd-mbs2}).
Click on a command opens at the right side the argument panel.
Entering argument values and \keyw{RETURN} executes the command.
\figpng{user-gui-pan-cmd-mbs1}{Info and command panel.}{htb}{0}{0.7}

Only the \mbs\ commands of the running tasks are shown. 
Fig. \paref{fig:user-gui-pan-cmd-mbs1} shows that only dispatcher and prompter are up
and therefore only their commands are seen.
\figpng{user-gui-pan-cmd-mbs2}{Info and command panel.}{htb}{0}{0.7}
Fig. \paref{fig:user-gui-pan-cmd-mbs2} shows in addition the commands
of util and transport after configuration.

\section[MBS DIM parameters]{\mbs\ DIM parameters}
\subsection[MBS states]{\mbs\ states}
\bdes
\item[Acquisition/State] \keyw{Running} | \keyw{Stopped} 
\item[BuildingMode/State] \keyw{Delayed} | \keyw{Immediate}
\item[EventBuilding/State] \keyw{Working} | \keyw{Suspended}
\item[FileOpen/State] \keyw{File open} | \keyw{File closed}
\item[RunMode/State] \keyw{DABC connected} | \keyw{MBS to DABC} | \keyw{Transport client} | \keyw{MBS standalone}
\item[SpillOn/State] \keyw{Spill ON} | \keyw{Spill OFF}
\item[TriggerMode/State] \keyw{Master} | \keyw{Slave}
\edes
\subsection[MBS rates]{\mbs\ rates}
\bdes
\item[MSG/DataRateKb] KByte/s
\item[MSG/DataTrendKb] KBytes/s as trend
\item[MSG/EventRate] Events/s
\item[MSG/EventTrend] Events/s as trend
\item[MSG/EvSizeRateB] Event size sample in bytes
\item[MSG/EvSizeTrendB] Event size sample in bytes
\item[MSG/StreamRateKb] Stream server Kbyte/s
\item[MSG/StreamTrendKb] Stream server Kbyte/s as trend
\item[MSG/FileFilled] File filled in percent
\item[MSG/StreamsFull] Number of full streams in percent
\item[MSG/TriggerRate] Trigger/s of readout tasks
\item[MSG/TriggernnRate] (nn=01...15) Trigger/s type nn of readout tasks
\edes
\subsection[MBS histograms]{\mbs\ histograms}
Shown in histo window.
\bdes
\item[MSG/TrigCountHis] Histogram with 16 channels for counts of trigger types (0 = total)
as seen by the readout task.
\item[MSG/TrigRateHis] Histogram with 16 channels for count rates of trigger types (0 = total)
as seen by the readout task.
\edes
\subsection[MBS infos]{\mbs\ infos}
Shown in info window.
\bdes
\item[MSG/eFile] Name of file.
\item[MSG/ePerform] Events, MBytes, Events/s and MBytes/s.
\item[MSG/eSetup] Name of setup file loaded.
\item[PRM/Current] Current command execution node (master node only).
\item[PRM/NodeList] List of nodes (master node only).
\edes
\subsection[MBS tasks]{\mbs\ tasks}
Task list is shown in info window (name slightly different):

 Dispatch  Msg\_Log  Read\_Meb  Collector  Transport  Event\_Serv  
 Util  Read\_Cam  Esone\_Serv  Stream\_Serv 
 Histogram  Prompt  Rate  SMI  Sender  Receiver  Asynch\_Receiver  Rising  Time\_Order  Vme\_Serv 
\subsection[MBS text]{\mbs\ text}
\bdes
\item[MSG/GuiNode] Node where GUI runs
\item[MSG/Date] Date as written in file header
\item[MSG/Run] Run ID  as written in file header
\item[MSG/Experiment] Experiment as written in file header
\item[MSG/User] Lynx user name as written in file header
\item[MSG/Platform] CPU platform
\edes
\subsection[MBS numbers]{\mbs\ numbers}
\bdes
\item[MSG/BufferSize]
\item[MSG/Buffers] collected so far.
\item[MSG/Events] collected so far.
\item[MSG/FileMbytes] written in file.
\item[MSG/FlushTime]
\item[MSG/MBytes] collected so far.
\item[MSG/StreamKeep] 
\item[MSG/StreamMbytes]
\item[MSG/StreamScale]
\item[MSG/StreamSync]
\item[MSG/UserVal\_nn] (nn=00...15) These values can be set in the user readout function.
\item[MSG/TriggernnCount] (nn=01...15) Trigger counts type nn of readout tasks.
\edes
\section{Working directories}
\lsubsection[MBS configuration of DIM]{user:MbsDimconfig}{\mbs\ configuration of DIM}
Optional text file \verba{dimsetup} in the \mbs\ working directory
specifies which rate meters, histograms or states shall appear
in the GUI. Upper limits of the rate meters can be specified.
This file can be copied from \verba{\$MBSROOT/set/dimsetup}. Only the
parameters which are in this file are optional.

\strong{Note}, that a file name of an open lmd file is only displayed when
either \keyw{FileOpen} or \keyw{FileFilled} is selected for this node. 
{\small {\begin{verbatim}
## This file controls the rate meter and state appearance.
## File name must be dimsetup and in the MBS working directory.
## The value numbers are the maximum values for rate meters
## Colons only if value is specified!
## Node names must be uppercase, * wildcards all

##========= All nodes:
##---- Rates:
* EventRate     : 10000.
#* EventTrend    : 10000.
* DataRateKb    : 16000.
#* DataTrendKb   : 16000.
#* StreamRateKb  : 16000.
#* StreamTrendKb : 16000.
#* EvSizeRateB   : 128.
#* EvSizeTrendB  : 128.
# ++ File filling status in percent, typically only on one node (transport)
#* FileFilled   :   100.
#* StreamsFull   :   100.
#* TriggerRate : 10000.
# ++ Trigger rates for the individual triggers: 01...15
#* Trigger01Rate : 10000.

##---- States:
# ++ Delayed or immediate event building:
* BuildingMode
# ++ Current eventbuilding running or suspended:
* EventBuilding
# ++ Shows spill signal:
#* SpillOn
# ++ Shows if file is open, typically only on one node (transport)
#* FileOpen
# ++ Show trigger master
#* TriggerMode

##---- User integers from daqst, 00...15
# can be set by f_ut_set_daqst_user(index,value);
#* UserVal_00
#* TriggerCount
# ++ Trigger counts for the individual triggers: 01...15
#* Trigger01Count

##---- Histograms
#* TrigCountHis
#* TrigRateHis

##======== Node XXX (uppercase)
#XXX EventRate   : 10000.
#XXX DataRateKb  : 16000.
#XXX FileOpen
#XXX FileFilled  :   100.
#XXX SpillOn
#XXX EventTrend  : 10000.
#XXX DataTrendKb : 16000.
#XXX TriggerMode
\end{verbatim}
}

