	subroutine drizle
c	calculates cross-section for 10 gev energy bins
c
	include '/u1/gcf/e350/crystal/cb/clouds'
	include '/u1/gcf/e350/crystal/cb/datbin'
	include '/u1/gcf/e350/crystal/cb/abssiz'
	include '/u1/gcf/e350/crystal/cb/fixbin'
	include '/u1/gcf/e350/crystal/cb/parms'
	include '/u1/rgk/icicle/cb/ztpltc'
	dimension css(14),errcss(14),elimln(14),elimhn(14),eluse(14),
& 	ehuse(14),ilow(14)
c
	data elimln/59.999,69.999,79.999,89.999,99.999,109.999,
&	119.999,129.999,139.999,149.999,159.999,169.999,179.999,189.999/
	data elimhn/70.001,80.001,90.001,100.001,110.001,120.001,
&	130.001,140.001,150.001,160.001,170.001,180.001,190.001,203.001/
	data fixbin/.false./,iufix/2*0/,ibegin/0/
c
100	format(' xsections for trigger no 'i2' for energies '
& 	' between 'f7.2' and 'f7.2' is'1pg11.3' +-'1pg11.3)
101	format(' average xsection for energies between 'f7.2
&	' and'f7.2' is'1pg11.3' +-'1pg11.3)
103	format(' reference energy ='f10.3' lowest points ='7i3)
c
200	format(2f4.2,f8.5,8(1pe8.2))
c
	if (ibegin.eq.0) goto 50
30	if (.not.onebin) goto 57
c	eend and estart for case of onebin need to be inserted by hand
	eluse(1)=estart
	ehuse(1)=eend
57	fudm=fdmicr/abs(tlo-thi)
c	cycle over energy binnings
	do 2 kk=1,iter
	css(kk)=1.e-10
	errcss(kk)=1.e-10
	elimlw=eluse(kk)
	if (ere.gt.elimlw+0.002) goto 2
	elimhg=ehuse(kk)
c
c	loop over triggers
	bt=0.
	dt=0.
	do 16 it=1,notrig
	if (fixbin.and.it.ne.iufix(1)) goto 16
	noet=noe(it)
	e=elow(it)
	if (e+float(noet-1)*de(it).lt.elimlw) goto 16
	counte=0.
	ebb=0.
	ekmax=1.e20
	ncnt=0
	do 1 i=1,noet
	if(e.lt.elimlw) go to 1
	if (e+de(it).gt.elimhg) goto 7
	if (i.lt.ie1(it).or.i.gt.ie2(it)) goto 16
	counte=counte+binb(i,it)
	if (binb(i,it).le.0.) goto 20
	ncnt=ncnt+1
	ebb=ebb+1./ebinb(i,it)**2
20	if (ebinb(i,it).gt.0.) ekmax=amin1(ekmax,1./ebinb(i,it))
1	e=e+de(it)
7	if (i.eq.1) goto 16
	if (ekmax.gt.1.e19) call abort
	crosse=amax1(0.,counte*fudm)
	if (ncnt.ge.1) errore=sqrt(ebb)*fudm
	if (ncnt.eq.0) errore=ekmax*fudm
	print 100,it,elimlw,elimhg,crosse,errore
	if (errore.le.0.) goto 16
	bt=bt+crosse/(errore**2)
	dt=dt+1./(errore**2)
16	continue
	if (dt.eq.0.) goto 3
	ca=bt/dt
	errca=1./sqrt(dt)
	print 101,elimlw,elimhg,ca,errca
	goto 4
3	ca=1.e-10
	errca=1.e-10
4	css(kk)=amax1(ca,0.)
	errcss(kk)=errca
2	continue
	ilg=min0(4,iter)
	write(8,200) -tlo,-thi,-avt,(css(ik),errcss(ik),ik=1,ilg)
	if (iter.le.4) return
	ilg=min0(8,iter)
	write(8,200) -tlo,-thi,-avt,(css(ik),errcss(ik),ik=5,ilg)
	if (iter.le.8) return
	ilg=min0(12,iter)
	write(8,200) -tlo,-thi,-avt,(css(ik),errcss(ik),ik=9,ilg)
	if (iter.le.12) return
	ilg=min0(16,iter)
	write(8,200) -tlo,-thi,-avt,(css(ik),errcss(ik),ik=13,ilg)
	if (iter.gt.16) call abort
	return
cccc	call monson(css,errcss,iter,-tlo,-thi,1)
c
c	initialization
50	ibegin=1
	ere=999.
	do 11 i=1,notrig
	if (elow(i).gt.ere) goto 11
	ere=elow(i)
11	continue
	do 14 i=1,notrig
14	ilow(i)=(elow(i)-ere)/de(i)
	print 103,ere,(ilow(i),i=1,notrig)
	open(8,file='crsplot',access='sequential',form='formatted')
	rewind(8)
	if (onebin) goto 56
	iter=10
	do 53 i=1,iter
	eluse(i)=elimln(i+4)
53	ehuse(i)=elimhn(i+4)
	goto 30
56	iter=1
	goto 30
c
	end
