CKM Jlab Testbeam software - Peter Cooper Fri Sep 20 18:26:17 CDT 2002 ---------------------------- Contents *** 1. INTRODUCTION *** 2. DAQ Account Structure *** 3. DAQ Package *** 4. Documentation *** 5. Offline Package *** 6. Scalers Package *** 7. setup file *** 8. sjyLX CAMAC Package *** 9. Trigger Package ***10. Software maintanence ***11. High Voltage Control ***12. Cold start procedures *** 1. INTRODUCTION The software for the CKM VVS prototype in Hall B at Jlab resides on the online DAQ computer ckm10.fnal.gov [131.225.54.198] when at FNAL. This same computer when at Jlab will be: Name: ckm-1.jlab.org Address: 129.57.160.63 Gateway: 129.57.160.1 Subnet Mask: 255.255.252.0 DNS server: 129.57.32.100 Logon to ckm-1 from off the jlab site requires two passwords and ssh tunneling: e.g.: ssh -t pcooper@jlab.org ssh daq@ckm-1 A copy of the entire software suite is kept in the ckm group account on the Fermilab ckm Linux cluster (~ckm/daq from any machine) *** 2. DAQ Account Structure There is a separate user account daq for these packages. Login is via the usual ckm access method. The daq account has the following directory structure and contents daq/ | daq account home area bin/ | executables ckm/ | ckm testbeam packages daq/ | DAQ Package bin/ | executables include/ | include files src/ | source codes doc/ | Documentation with local website offline/ | Offline Analysis Package bin/ | executables include/ | include files src/ | source codes scalers/ | Scaler Daq and Display Package bin/ | executables include/ | include files src/ | source codes setup | environment variable setup sjyLX/ | sjyLX Jorway 73a Camac package ABSTRACT_sjylx README | doc/ | documentation example | example codes and scripts include/ | include files lib | libraries src/ | source codes ups | ups distribution trigger/ bin/ | executables doc/ | documentation include/ | include files src/ | source codes selex/ | Original Selex trigger Package t917/ | Original T917 DAQ Package with sjylX *** 3. DAQ Package ckm_daq is a Fortran program to readout ckm event data from CAMAC and write those events to a disk Fortran unformated disk file. The data readout are 2- 2249a ADC modules of 12 channels each and 4 - 32 channel 3377 TDC modules. Events are readout on an event interrupt (actually a polled LAM in the RFD-02 module), the tdc_are unpacked, the event is optionally dumped to stdout and the event is written to the output file. tdc_unpack reads the scaler definition file $CKM_SCALERS as a configuration file. If a .setup has not been done it can't find this file and will fail. In the daq account the setup is done automaticaly at login time. An event consists of: ndata4 I*4 | self exclusive longword event length run I*4 | run number (from command line) event I*4 | event number begining at 1 time I*4 | Unix time for this event (seconds since 1/1/70 UTC) data I*2 | CAMAC data, leading self inclusive shortword count Usage of the routine is: ~/ckm/daq/bin/ckm_daq +-----------------------------------------------------------+ | CKM DAQ Code for JLAB VVS Test Data psc v1.0 | +-----------------------------------------------------------+ Usage: ckm_daq <-r run[1]> run number <-d ndump[4]> events to dump <-i init CAMAC> DON'T DO THIS! <-f [$CKM_DATA]> to get a ouput file <-n events[inf]> events before stopping <-A suppress adcs> don't readout ADCs <-T suppress tdcs> don't readout TDCs The code is kept in the daq/ckm/daq/src directory. There are 2 Fortran routines, ckm_daq.F, the main program and tdc_unpack.F. The code is rebuilt with the build script in /src. *** 4. Documentation All the documentation, includign this README file, resides in the ~/daq/ckm/doc direcotry on ckm-1. This is the homepage for the mozilla web browser on ckm-1. Please not taht this is set of file. We are NOT running a website from ckm-1 (apache is not running). There is a clone of this "website" (a copy of all the files on whichever day it was last updated. The page is linked to the CKM homepage is is on the web. The log-book file is linked to this page. *** 5. Offline Package ~/ckm/offline/bin/ckm_anal +-----------------------------------------------------------+ | CKM Analysis Code for JLAB VVS Test Data psc v1.0 | +-----------------------------------------------------------+ Usage: ckm_anal <-r run[1]> run number <-d ndump[0]> events to dump <-f [$CKM_DATA]> dir to read data from <-h [ckm_anal.hbk]> hbook output file name <-n events[inf]> events before stopping routines in /src ckm_anal.F | main program ckm_hist.F | histogram booking / filling tdc_unpack.F | does what is says - in /daq/src build | ./build to rebuild *** 6. Scalers Package The scaler package consists of a fortran program, scaler_read which runs in the background reading a set of scalers once per second. It writes the resulting scaler files to a text file "spill_scalers" and stdout. The configuration file is $CKM_SCALERS(usually /home/daq/ckm/scalers/ckm_scalers) to start the scaler daq 1. cd $CKM_SCALER | go to scaler directory 2. scaler_read <$CKM_SCALERS >>$CKM_SCALER_DATA & This runs the scaler daq job in the background. The data is appended to the run_scalers file in the scaler directory. 3. display_scalers ckm.pg | start a default scaler display to check that the scalers are being read: ps axf | grep scaler_read to checkpoint the scaler out put file (which is BIG) killall scaler_read | stop scaler_read cd $CKM_DATA | go to where we keep the scaler ls run_scalers-* | look at old files mv $CKM_SCALER_DATA run_scalers- | rename the fileto be next one gzip run_scalers- | gzip it (typically 97% compression) cd $CKM_SCALER | go to scaler directory scaler_read <$CKM_SCALERS >>$CKM_SCALER_DATA & | restart scaler daq I am writting a script to automate this but it is not ready yet. display_scaler Displays a page of scalers from the once a second file written by scaler_read. It updates every 2 seconds. page files a simple text files. See examples in $CKM_SCALER/*pg and the script's documentation (below). # display SELEX spill scalers # Usage: display_scalers page_file [update_time (sec) / print] # Display spill scalers periodically from the run_scaler file. # Scaler values and ratios of scaler values can be displayed. Each # output line is divided into 4 fields each of which can contain a # scaler value. A ratio, summ or diference (/,+,-) of two scalers requires # 2 adjacent field on the same line. The scalers and ratios to be displayed # are defined in a page_file. A detailed example is given in # ~/selex/scaler/README_scalers # Page File Langauge Defintion # # Each line in a page fille produces one line on the corresponding display. # # Each "item" on page file line produces a 19 column wide output field. # If the output will not fit in one field two are used. An item which begins # wit "$" produces no output. 4 output fields fit on an 80 column display. # # The format for an item is: # # general case # <<$>new_label=>label_1<[+,-,*,/]label_2> # $ suppresses output # new_label= defines and saves a new scaler which can be used # latter. output uses the new label. New labels # may NOT contain the following characters [/*+-=$]. # [+,-,*,/] All operation are binary - they require 2 and only 2 # operands. # special cases # - ! output a blank 19 column field # # ! a comment line to be reproduce in the output # ! write a blank line to the output # # examples [all from the page and output above] # # T0 ! output the scaler labeled T0 in 1 field # T1+NOT_T1 ! output the sum of 2 scalers # 2orN2=T2+NOT_T2 ! output the sum of 2 scalers with a new label # ! The new value is displayed and saved under the # ! new label for future use. # $12.23=12*23 ! As above but suppress output. Calculation done # ! with previously calculated values. # # S logic outputs ! comment line # - ! leave a blank field # Note that the "-' leaves a blank field. A new scaler may be defined # with the syntax new=old or new=old1/old2, etc. Once defined a new # scaler is can be used just like any other. This allow new labels and # complicated arithmetic by a sequence of binary operations. A new scaler # prefixed with a $ is calculated but not displayed (eg:$new=old1+old2). # If a page_file exists in the directory from which display_scaler was # launched then that file is used. If that page_file is not found a # file of the same name in /usr/products/trigger/scaler/ is tried. # The default update period is 2 seconds # The print option waits until the last [10th] slice in the present spill, # produces one output and then quits. To print the scalers using a page # do either: # # display_scaler page print | flpr -P p781a ! text on laser printer # display_scaler page print | a2ps | flpr -P p781a_ps ! PS on laser printer # display_scaler page print | a2ps > file ! to text file ocs2paw - convert a scaler text data file in Selex OCS format to a PAW nutple Usage: ocs2paw scaler_file ntup_file *** 7. setup file /daq/ckm/setup Usage: setup [ckm directory] <[data directory]> example from ckm account on ckm cluster - in .bashrc . daq/ckm/setup daq/ckm jlab-data/ | *** 8. sjyLX CAMAC Package *** 9. Trigger Package *clear_busy Usage: clear_busy - disable RFD02 inputs and clear busy *load_2323 Usage: load_2323 slot [1000] [wa] slot - Camac slot for this module [1000] - width in [nsec] for A channel [wa] - width in [nsec] for B channel *load_3377 Usage: load_3377 slot [00] slot - Camac slot for this module [00] - Header id: 2 hex digits default 00 *read_3377 Usage: read_3377 slot slot - Camac slot for this module *test_3377 Usage: test_3377 slot slot - Camac slot for this module *load_rfd01 Usage: load_rdf01 slot first[0x00] slot - Camac slot for this module first - inital output level pattern last - final output level pattern *start_clock Usage: start clock - stop and restart 222 1KHz oscillator *load_plu - the Fortran trigger code in ckm/trigger/src - see code * sample code fragment: if(unit.eq.0) then ! PLU section 0 Trig = (H1.or.H2.or.H3) .and. (F1.or.F2) ! out(1) if(switch .eq. 'cosmics ') Trig = Vor out(2) = Trig.and..not.Vor out(3) = Vor out(4) = Vor out(5) = F out(6) = F out(7) = F out(8) = H1.and.H2 else if(unit.eq.1) then ! PLU section 1 out(1) =.not.(V1L .or. V1R .or. V2L .or. V2R) out(2) =(V1L .or. V1R .or. V2L .or. V2R) out(3) =(V1L.and.V2L) out(4) = F out(5) = F out(6) = F out(7) = F if(switch .eq. 'pulser ') out(7) = clk out(8) =(V1L .or. V1R .or. V2L .or. V2R) if(switch .eq. 'cosmics ') out(8) = out(3) end if *trigger_load - load the whole trigger Usage: trigger_load [-] : : pulser - trigger using LED pulser cosmic - comsic ray trigger ***10. Software maintanence The primary copy of this software suite is kept on ckm-1 at jlab. Copying it elsewhere off the jlab site is a two step process: 1. copy from ckm-1 to jlab.org. e.g. from ckm-1:~daq/ckm/offline/src scp -p -C ckm_anal.F pcooper@jlab.org:/scratch/pcooper/ 2. copy from jlab.org offsite: e.g. from ckm06 (psc desktop machine) scp -p -C pcooper@jlab.org:/scratch/pcooper/ckm_anal.F . ***11. High Voltage Control The high voltage to run all the counters, save the PbG block [D0] is provided by CLAS's LRS 1458 HV distribution system. These High voltages are controls using a gui supported by Arne Freyberger on the CLAS coumpters. The procedure is: 1. Logon to the clasrun account on a CLAS online computer. For me (psc) to do this from offsite ssh -t pcooper@jlab.org ssh clasrun@clon01 2. Start the ckm HV gui. This complains about fonts and can take sereral minutes. Ignore the error messages and just wait ckm_epics 3. in the CM screens window - when it appears - click "CKM HV" 4. Set-to voltages at entered in the "Input V" column with a carriage return. individual channels are turned on and off with the Ena / Dis buttons for each counter. The PbG high voltage is controled by a Fluke HV power supply in the CKM rack (The old base draws too much current for the 1458 system). Contro is purely manual. An HV trip on the counter means an access. ***12. Cold start procedures The cold start procedure from the webpage is reproduced here: cold-start_procedures psc Thu Sep 12 17:03:35 CDT 2002 I. Power on A. CAMAC crate B. Nim crate C. Oscilloscope D. Fluke HV PS power on standby ==> HV on II. Reboot the computer A. Push power button on front panel B. WAIT!!! - If there was a power failure it can take up to 30 - minutes to check and rebult the file systems on all the disks C. Success is a logon box on the screen III. Restart the software A. login as user=daq with the usual ckm password B. open a terminal window C. login as root - we need to load the scsi driver 1. ckm-1> su | login as superuser 2. | no root passwords on the web 3. ~daq/bin/scsi_reset xxx | this loads the scsi driver 4. exit | logoff as root - back to daq D. load the trigger (which initalizes all CAMAC) 1. cz 1 1 1 | issue a camac Z normal response is CMSG called from cz: , data=0 2. trigger_load pulser | reload the pulser trigger E. Start the scaler daq 1. cd ckm/scalers | go to scaler directory 2. scaler_read <$CKM_SCALERS >>$CKM_SCALER_DATA & This runs the scaler daq job in the background. The data is appended to the run_scalers file in the scaler directory. 3. display_scalers ckm.pg | start a default scaler display F. Start the event daq 1. cd ~/ckm/daq | go to daq directory 2. ckm_daq | follow usage instructions