First things first
This primer will not teach you how to write
Floyd) scripts. For that, buy a TCL/TK book with examples
and work through them.
Floyd is an extension of TCL (windowless) and
is an extension of TCL/TK (X11 windows) - both programs are distributed by
the HERMES collaboration.
Pink/Floyd extend TCL/TK by adding
How the database works
A server running in the background listens for connections from database clients. It is the server that manages the database disk files, which are in the CERN RZ format (random access). I have the server configured to respond to TCP/IP connections, so with a little work anyone from a remote host can access the database.
For speed, I run the database in a mode that is a hybrid of the so-called "booking" and "updating" modes. In HERMES terminology, "booking" means adding new information into the database, and "updating" means replacing existing data with new data using timestamps for setting validity periods. As examples, I book to the Bor table, but I update the Eos table. The difference? If I booked the Eos table each row is considered valid (in a timewise fashion) and each time a client connects and fetches the Eos table thousands of rows would be sent across! In update mode only the last row is sent.
For the remainder of this primer, I will be using
Floyd would require a different set of commands I will
point this out. For demonstration purposes, I will illustrate the
How to create an executable script
The best (i.e. most portable) way to create a
is to start the file off with the following lines:
sh is invoked and will execute
floyd will be passed the command line parameters and will ignore
any lines beginning with "#" (the backslash "\" is interpreted as a line
continuation character in TCL/TK) and thus will ignore the exec line and
continue executing the remaining script. If you prefer
then substitute "
pink -f" for "
At this point I should point out that
floyd are large programs. If you don't intend on reading
lots of tables, or fooling with ADAMO GAF files, I suggest using
floydy instead. They are
considerably smaller in size.
The scan script
scan starts up, it fetches a copy of the EvtPar table from
the database. The EvtPar table is a convenient way to query data by name
from the database; to date, evtpars consist of epicure data and scaler data.
In the following example, I will show how to fetch the EvtPar table and query
its elements (you type what is in blue):
Whoa! What just happened here? You just got a copy of the EvtPar table. We connected to the EvtparStream (which happens to contain the EvtPar table) using dadConnect and created the evt "object" with which we can operate on the stream; we next created a PinK "object" for referring to the table using grabobj; and requested the currently valid evtpars using Update and the Pink/Floyd utility function gettime. We cleaned up after ourselves by disconnecting from the server using Disconnect, as we don't need to access the EvtparStream anymore.
In the meantime, you can refer to http://hermes.desy.de/pink/ to read the formal documentation. Feel free to hack around - you can't really hurt anything as you have to be a "chief" to WRITE to the database. If you're reading this, you probably aren't a "chief" :).