*
*	paw$dir:geant_part.kumac
*
*	KUMAC to copy first 400 ns of GEANT decay spectra to
*	histogram. 
*
*	[1]	ID of left histogram; other ID's will be reconstructed
*
*	TP,	23-feb-1999
*
*----------------------------------------------------------------------------
*
	if ( [1] .eq. ' ' .or. [1] .eq. '?' .or. [1] .eq. '!' ) then
		mess
		mess GEANT_PART IDleft
		mess
		mess Copies first 400ns of existing GEANT decay spectra
		mess to new IDs; NewID = OldID+1000
		mess
		exitm
	endif
	idl  = [1]
	idt  = [idl]+2
	idr  = [idt]+1
	idb  = [idr]+1
	idln = [idl]+1000
	idtn = [idt]+1000
	idrn = [idr]+1000
	idbn = [idb]+1000
*
	upp  = 400.	  | upper bin center of new histograms
*
	if ( $vexist(data) ) then
		v/de data
	endif
*
*	get histo information
*
	if ( $hexist([idl]) .eq. 0 ) then
		mess
		mess Left Histogram ID = [idl] does not exist !
		mess
		exitm
	endif
	if ( $hexist([idt]) .eq. 0 ) then
		mess
		mess Top Histogram ID = [idt] does not exist !
		mess
		exitm
	endif
	if ( $hexist([idr]) .eq. 0 ) then
		mess
		mess Right Histogram ID = [idr] does not exist !
		mess
		exitm
	endif
	if ( $hexist([idb]) .eq. 0 ) then
		mess
		mess Bottom Histogram ID = [idb] does not exist !
		mess
		exitm
	endif
*
*----------------------------------------------------------------------------
*
*	L E F T
*
	xmin = $hinfo([idl], 'XMIN')
	xmax = $hinfo([idl], 'XMAX')
	nbin = $hinfo([idl], 'XBINS')
	bin  = ([xmax] - [xmin])/[nbin]
*
	mess Left ID = [idl] with bin size [bin]
*
*	copy histogram to vector
*
	v/cre data([nbin]
	get_vec/con [idl] data
*
*	construct new upper limit
*
	nbin = [upp]/[bin] + 1
	xmax = [xmin] + [nbin]*[bin]
	mess New LeftId = [idln] with xmax = [xmax] and nbin = [nbin]
*
*	book histogram
*	
	if ( $hexist([idln]) ) then
		hi/de [idln]
	endif
	1d [idln] 'part of left, id = '//[idl] [nbin] [xmin] [xmax]
	put_vec/con [idln] data(1:[nbin])
	v/de data
*
*---------------------------------------------------------------------------
*
*	T O P
*
	xmin = $hinfo([idt], 'XMIN')
	xmax = $hinfo([idt], 'XMAX')
	nbin = $hinfo([idt], 'XBINS')
	bin  = ([xmax] - [xmin])/[nbin]
*
	mess Top ID = [idt] with bin size [bin]
*
*	copy histogram to vector
*
	v/cre data([nbin]
	get_vec/con [idt] data
*
*	construct new upper limit
*
	nbin = [upp]/[bin] + 1
	xmax = [xmin] + [nbin]*[bin]
	mess New TopId = [idtn] with xmax = [xmax] and nbin = [nbin]
*
*	book histogram
*	
	if ( $hexist([idtn]) ) then
		hi/de [idtn]
	endif
	1d [idtn] 'part of top, id = '//[idt] [nbin] [xmin] [xmax]
	put_vec/con [idtn] data(1:[nbin])
	v/de data
*
*---------------------------------------------------------------------------
*
*	Right
*
	xmin = $hinfo([idr], 'XMIN')
	xmax = $hinfo([idr], 'XMAX')
	nbin = $hinfo([idr], 'XBINS')
	bin  = ([xmax] - [xmin])/[nbin]
*
	mess Right ID = [idr] with bin size [bin]
*
*	copy histogram to vector
*
	v/cre data([nbin]
	get_vec/con [idr] data
*
*	construct new upper limit
*
	nbin = [upp]/[bin] + 1
	xmax = [xmin] + [nbin]*[bin]
	mess New RightId = [idrn] with xmax = [xmax] and nbin = [nbin]
*
*	book histogram
*	
	if ( $hexist([idrn]) ) then
		hi/de [idrn]
	endif
	1d [idrn] 'part of Right, id = '//[idr] [nbin] [xmin] [xmax]
	put_vec/con [idrn] data(1:[nbin])
	v/de data
*
*------------------------------------------------------------------------------
*
*	Bottom
*
	xmin = $hinfo([idb], 'XMIN')
	xmax = $hinfo([idb], 'XMAX')
	nbin = $hinfo([idb], 'XBINS')
	bin  = ([xmax] - [xmin])/[nbin]
*
	mess Bottom ID = [idb] with bin size [bin]
*
*	copy histogram to vector
*
	v/cre data([nbin]
	get_vec/con [idb] data
*
*	construct new upper limit
*
	nbin = [upp]/[bin] + 1
	xmax = [xmin] + [nbin]*[bin]
	mess New BottomId = [idbn] with xmax = [xmax] and nbin = [nbin]
*
*	book histogram
*	
	if ( $hexist([idbn]) ) then
		hi/de [idbn]
	endif
	1d [idbn] 'part of Bottom, id = '//[idb] [nbin] [xmin] [xmax]
	put_vec/con [idbn] data(1:[nbin])
	v/de data
*
*------------------------------------------------------------------------------
*
	zone 2 2
	hi/pl [idln]
	hi/pl [idtn]
	hi/pl [idrn]
	hi/pl [idbn]
	zone
*
