*
*	quicky KUMAC to get decay spectra from GEANT simulations
*	(GEANT_LEMSR.KUMAC)
*
*	TP,	03-Feb-1999,	PSI
*
*	[1]	Geant Runnumber; for histogram titles
*
*
*	decay spectra, only 1 detector has hit, e+ e- bit required
*----------------------------------------------------------------------
*
	if ( [1] .eq. ' ' .or. [1] .eq. '?' .or. [1] .eq. '!') then
		mess
		mess Missing GEANT RunNumber as parameter.
		mess Needed for Histogram titles.
		mess
		mess Syntax:
		mess
		mess GEANT_DOHIST RunNo
		mess
		exitm
	endif
	runno = [1]
*
*	cuts for e+ and e- and gammas
*
	cut $20 btest(int(partcode),0).and.btest(int(partcode),4) |require gamma in both detec.
	cut $21 btest(int(partcode),1).and.btest(int(partcode),5) |require e+ in both detec.
	cut $22 btest(int(partcode),2).and.btest(int(partcode),6) |require e- in both detec.
*
	cut $11 p0>30.
	cut $10 desci>0.and.desco>0
	cut $1 de_left_i>0.and.de_left_o>0
	cut $2 de_top_i>0.and.de_top_o>0
	cut $3 de_rite_i>0.and.de_rite_o>0
	cut $4 de_bot_i>0.and.de_bot_o>0
*
cut $5 btest(int(volno),0).and.btest(int(volno),4) | bits for left in and out
cut $6 btest(int(volno),1).and.btest(int(volno),5) | bits for top in and out
cut $7 btest(int(volno),2).and.btest(int(volno),6) | bits for right in and out
cut $8 btest(int(volno),3).and.btest(int(volno),7) | bits for bottom in and out
*
	1d 614 'GEANT '//[runno]//' only left  , e+ or e- bit, de gt 0, 50ns bins' 220 0. 11000.
	1d 616 'GEANT '//[runno]//' only top   , e+ or e- bit, de gt 0, 50ns bins' 220 0. 11000.
	1d 617 'GEANT '//[runno]//' only right , e+ or e- bit, de gt 0, 50ns bins' 220 0. 11000.
	1d 618 'GEANT '//[runno]//' only bottom, e+ or e- bit, de gt 0, 50ns bins' 220 0. 11000.


mess NTPlot left id=614
nt/pl 111.tsci $1.and.$5.and.($21.or.$22).and.volno.eq.17 -614
mess NTPlot top id=616
nt/pl 111.tsci $2.and.$6.and.($21.or.$22).and.volno.eq.34 -616
mess NTPlot rite id=617
nt/pl 111.tsci $3.and.$7.and.($21.or.$22).and.volno.eq.68 -617
mess NTPlot bot id=618
nt/pl 111.tsci $4.and.$8.and.($21.or.$22).and.volno.eq.136 -618

