
5. CONTROL THE DETECTOR
The PILATUS3 detector can be controlled from the delivered detector server or via the socket connection. Below these
ways are described in detail.
5.1. From the Detector Server (Stand-Alone Operation)
To use the detector as a stand-alone system follow the instructions in the Quick Start Guide (chapter 4).
The runtvx command is a shell script which starts the actual programs: Camserver and TVX. It also handles the log-files.
During the Camserver startup a connection to the detector is established and verified. TVX automatically connects to Cam-
server and configures the detector via the startup procedure defined in default.gl. This is a so-called glossary file (*.gl), which
is a convention used for files which are processed by TVX. This default.gl file (stored in /home/det/tvx/config) makes several
definitions (short cuts), which can be used further on in TVX.
For example the exposem command makes an endless loop and writes images in a temporary file (see also chapter 11).
This is a simple live-view tool of TVX.
At the end of the startup glossary three more glossaries are called. The first one (det_spec.gl) loads detector specific
parameters such as camera size and number of modules. The second one (user.gl) is used to enter user short cuts if you
define your own ones. The last one (startup.gl) sets voltages on the actual X-ray sensitive elements and carries out a test
of the digital part and the analog part of each pixel. The last two tests are done with the TVX definitions rbd (read back
detector) and calibdet, respectively. The results are shown in a green (digital test with 1000 counts loaded into the counter
of each pixel) and a blue (analog test with 100 simulated pulses fed into each pixel) image. These two images show up
automatically at the end of the startup procedure and verify the full functionality of the detector.
5.2. From a Specific Environment (via Socket Connection)
In the previous section the stand alone operation is shown. However, often there is a need to integrate the detector into an
existing environment.
The PILATUS3 detector can be easily integrated into any environment. To do this, one has to send commands through
a socket connection to Camserver. Any client can connect to Camserver via a socket connection, and issue plain text
commands. However, only the first connection will get full control and can execute commands. All following connections
will only have read access. The command syntax (see chapter 13) over the socket is identical to the syntax to be typed
directly in the Camserver window. Thus, direct typing is helpful for testing.
The reply from Camserver (acknowledgement) consists of a command index number, followed by a space and either ”OK”
or ”ERR”, followed by another space and possibly a message. The acknowledgement arrives after the requested action is
completed, typically in 1-2 ms; some commands, such as trimming commands (e.g. SetCu), take longer, especially for a
big detector. All acknowledgements end in 0x18 (ASCII ’CAN’) without a newline; there may be internal newlines in long
messages. Since there is no terminating linefeed, MS Windows sockets must be opened in binary mode; this is not a
consideration for UNIX-like systems.
Because of the socket connection protocol, the camera hardware and server can reside on a different machine from the
high-level controller.
Camserver implements a token mechanism to prevent more than one outside process from having control over the hard-
ware. The Camserver window has full control at all times.
There is a debug facility to help with setting up the interface. If you type dbglvl 5, the file camdbg.out will contain many mes-
sages, including the exact contents of socket messages. Be sure to set dbglvl 1 (the default) before doing real work, else
camdbg.out can grow without limit. If you encounter problems with the detector, a run with dbglvl 6 reproducing the error
can be helpful for diagnosis. Simply capture camdbg.out and send it including a description of the issue to DECTRIS support.
The Camserver program of the PILATUS3 detector provides a simple to use interface for either EPICS or SPEC. Several
clients for these protocols have been written at the Swiss Light Source (SLS) at the Paul Scherrer Institute (PSI) and by Mark
Rivers of the University of Chicago:
http://cars.uchicago.edu/software/epics/areaDetector.html//
PILATUS3 R/S/X User Manual v1.1.0 12 | 48