*
*	quicky KUMAC to get energy loss spectra from GEANT simulations
*	(GEANT_ELOSS.KUMAC)
*
*	TP,	03-Feb-1999,	PSI
*
*	[1]	Geant Runnumber; for histogram titles
*
*----------------------------------------------------------------------
*
	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) | bits for gamma's
	cut $21 btest(int(partcode),1).and.btest(int(partcode),5) | bits for e+
	cut $22 btest(int(partcode),2).and.btest(int(partcode),6) | bits for e-
*	cut $30 partcode=17	| only gammas
*
*	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  100 'GEANT '//[runno]//' desci gt 0' 200 0. 10.
	1d  101 'GEANT '//[runno]//' descie+ gt 0' 200 0. 10.
	1d  102 'GEANT '//[runno]//' descie- gt 0' 200 0. 10.
	1d  103 'GEANT '//[runno]//' desciga gt 0' 200 0. 1.
	1d  110 'GEANT '//[runno]//' desci gt 0, require e+ or e- bits' 200 0. 10.

	1d  200 'GEANT '//[runno]//' desco gt 0' 200 0. 10.
	1d  201 'GEANT '//[runno]//' descoe+ gt 0' 200 0. 10.
	1d  202 'GEANT '//[runno]//' descoe- gt 0' 200 0. 10.
	1d  203 'GEANT '//[runno]//' descoga gt 0' 200 0. 1.
	1d  210 'GEANT '//[runno]//' desco gt 0, require e+ or e- bits' 200 0. 10.
*
*	inner detectors
*

mess Plot 100=Desci gt 0
nt/pl 111.desci desci>0 -100

mess Plot 101=Descie+ gt 0
nt/pl 111.descipos descipos>0 -101

mess Plot 102=Descie- gt 0
nt/pl 111.desciele desciele>0 -102

mess Plot 103=Descigamma gt 0
nt/pl 111.descigam descigam>0 -103

mess Plot 110=Desci gt 0, e+ or e- bits required
nt/pl 111.desci desci>0.and.($21.or.$22) -110

*
*	outer detectors
*

mess Plot 200=Desco gt 0
nt/pl 111.desco desco>0 -200

mess Plot 201=Descoe+ gt 0
nt/pl 111.descopos descopos>0 -201

mess Plot 202=Descoe- gt 0
nt/pl 111.descoele descoele>0 -202

mess Plot 203=Descogamma gt 0
nt/pl 111.descogam descogam>0 -203

mess Plot 210=Desco gt 0, e+ or e- bits required
nt/pl 111.desco desco>0.and.($21.or.$22) -210


