; NAME:
;	background
; PURPOSE:
;       This function calculates the background density for a given field. 
;	It uses diffmag database to calculate a mag. dependent background
;	It also calculates a straight forward background density from
;	the totd vector (no. candidates compared to no. sources)
; CALLING SEQUENCE:
;	background(totd,no_obj[,dbase,mags,stars,gals,noise,all])
; INPUTS:
;	dbase: if provided, should be a database containing cumulative 
;	magnitude counts to be used as background values. the program 
;	converts them from no/square deg to no/square ". They are then stored 
;	in the next 5 parameters (mag,stars,gals,noise,all) which the user 
;	should set to named variables to use later.
; OPTIONAL INPUT PARAMETERS:
;	totd: array containg the great circle distance to each object out to
;		100 arcsecs.
;	no_obj: no of xmm sources
; OPTIONAL OUTPUT PARAMETERS:
;	mags, stars, gals, all: as described above
;	bg: straight forward background density from totd & no_obj
; RESTRICTIONS:
;	UNTESTED
; CALLED PROCEDURES:
;	
; MODIFICATION HISTORY:
;	11-Dec-2000  Original by S. Aigrain
;	27-Feb-2001  S. Aigrain: Suffled around the arguments

(See /home/xmmssc/soft/idl/pro/lhr/background.pro)


Suzanne Aigrain <visitor2@ast.cam.ac.uk>
Last modified: Tue Feb 27 12:07:24 2001