
	HOW TO GET STARTED WITH THE DD SYSTEM
-----------------------------------------------------



1. What to check/modify before one can make the dd_test program:
==============================================================
1. Makefile:
	check compiler flags etc.
	Most of the debugging is done on SGI, one might
	have to change some of the flags for other 
	platforms. Look at the file
	flags.mk to see where platform dependent flags
	are added.
	The Makefile assumes gnumake (because of 
	flags.mk).
2. setup.com:
	In order to define the environment variables,
	one has to source the file setup.com
	in the top dd directory. One might want to
	change that setup.com file (modelled after
	D.Quarrie's original setup.com utility)
	to its own preference.
	In particular you have to define
	$DD_COMMANDS to point to the top directory
	of the DD software (the directory where setup.com
	resides). If you do not have the setup
	utility installed you have to source
	the file setup.com by hand (or modify it
	to your own taste).
3. debug facility: debug on/off switches on/off the
	debug flags (and sets $DBG_PREFIX) such that
	one can automatically link to debug on/off 
	libraries
4. cleanup  to delete the processes and shm and sem
	(I clobbered something together).


2. Make the DD files:
======================
Puts the executables and library file into
$dd_bin which is dd/vX.Y/bin/IRIX (or whatever
platform one has).


3. dd_test :
============
Simple test program for running the DD system:
Minimum configuration: 3 processes:
1. dd_ui
2. a producer process (dd_test OR dd_test_p)
3. a consumer process (dd_test OR dd_test_c)

3.1. dd_ui:
------------
How to start it:
	Type $dd_bin/dd_ui
	in pulldown menu ctl select "attach" or "create" 
	the other commands in ctl menu  are  of no
	importance to this simple test setup. (They
	are used for coordinating processes at 
	BOR and EOR in the E787 DAQ).

Menu Monitor: for starting fifo and process monitor

Menu show: for showing fifos, proc and semaphores

Note: You can enter command in the textfield at the
	bottom right and it knows the "help" command.

3.2. dd_test:
-------------

How to start it:
	Type $dd_bin/dd_test
	(if default producer just type $dd_bin/dd_test_p
	and there will be no questions).

	Then it asks you a few questions. The answer
	differs whether you are producer or consumer:

3.2.1. producer:
----------------
do you want to have the default dummy consumer? (y/n) no
 enter fifo name INPUT
 enter fifo mode 0
 enter fifo prescale factor 1
 enter fifo wait 0
 enter 4 control words -1 -1 -1 -1
 enter brc_flag 0
ddu_init status 0 

you are now in a loop, type "help" to see what's
available. To act as a producer type "put n"
n = number of events.


3.2.2. consumer:
-----------------
Version with no questions: $dd_bin/dd_test_c

do you want to have the default dummy consumer? (y/n)
n
 enter fifo name CONS1
 enter fifo mode 0
 enter fifo prescale factor 1
 enter fifo wait 0
 enter 4 control words -1 -1 -1 -1 
enter brc_flag
0
ddu_init status 0 

to start getting events: type "get n" 

3.2.3. Variations in the consumer:
----------------------------------
(what are the fifi mode, prescale, wait and brcflag??)
(see also db.h and fifo.h in $ONLINE_INCLUDE)

FIFO_MODE: 0 = ALL events
           1 = conditional only (depending on the values
			of the 4 control words)
		In this stupid test program we assume
		we have 4 event types (1,2,3,4)
		If you set mode to conditional then 	
		only fev.w1 is tested (in the 4 control
		words -1 -1 -1 -1 set the first word
		to 1,2,3,4 = the others are irrelevant
		and should be set to -1).
		Then the consumer should get only
		every forth event that requests say
		value 2 should only get every forth event.
	   2 = get only an event if you ask for one
		you will then be asked for the request count r:
		This is the number of events that will
		be kept ready for your process in your
		fifo. Enter whatever and see the effect on the
		fifo monitor window (becomes only visible
		if you have several consumers competing
		for events).
				

FIFO_PRESCALE: !=1 --> gets only a prescaled fraction of
		events

FIFO WAIT: 0 == process falls asleep when there is no
	event available
	  !=0 == process returns with a >0 status from
		ddu_get_fev IF there is no event
		available



Consumer that share events: 
---------------------------
Just give them the same fifo name and they share the
events on a round robin bases.
 
Try the above scenario with several consumers and producers.
A consumer can also be a producer, but a producers doesn't
make sense as a consumer (he just takes the events
out of the INPUT fifo).


What is NOT contained in the little dd_test program??
------------------------------------------------------
1. The control words can also work bitwise
	(bit set ==> take that event)

2. broadcast/syncronization of events:
	broadcast can be done but is only useful
	in a real DAQ in which processes have
	to be syncronized.

3. DD connection over the network: a producer/consumer
	can also go over the network. For this
	one has to modify the inet demon conf file
	WORK IN PROGRESS - will be started after the 
	Rio conference.

Sept 5, 1995



