	subroutine loadit(val,err,ptoe,elow,dele,ignore,ncom,corr,nume,
&	fuds,itad)
c	err contains error-squared
c
	include '/u1/gcf/e350/crystal/cb/clouds'
	include '/u1/gcf/e350/crystal/cb/parms'
	common/ecs/ecs(100000),necs
	include '/u1/gcf/e350/crystal/cb/type'
	include '/u1/gcf/e350/crystal/cb/foxin'
	include '/u1/gcf/e350/crystal/cb/foxxie'
c
	dimension val(1),err(1),ptoe(1),fuds(1)
	logical ignore
c
	elow=e1b(iwset)
	dele=deb(iwset)
	nume=numbe(iwset)
	if(nume.le.0) return
	do 1 i=1,nume
	fuds(i)=1.
	val(i)=0.
	ptoe(i)=0.
1	err(i)=0.
c
	itu1=it1+itad
	itu2=it2+itad
c	print 100,itu1,itu2
100	format(' using t bins numbers'i3' - 'i3)
	if(itu1.gt.itu2) call abort
c
	iee=0
	if (iwset.eq.1) goto 15
	iwsetm=iwset-1
	do 14 i=1,iwsetm
14	iee=iee+numbe(i)*numbt(i)
15	i1=iee*3*noi
	i2=i1+nume*noi*numbt(iwset)
	i3=i2+nume*noi*numbt(iwset)
	indegy=nume
c
	do 2 it=itu1,itu2
	indt=noi*(it-1)
	do 3 imask=1,noi
	iadd=(imask+indt-1)*indegy
	do 4 ie=1,nume
	e=ecs(ie+iadd+i2)
	if (e.lt.-10.) goto 16
	val(ie)=val(ie)+ecs(ie+iadd+i1)
	err(ie)=err(ie)+e
	ptoe(ie)=ptoe(ie)+ecs(ie+iadd+i3)
	if (abs(ptoe(ie)).gt.abs(val(ie))) print 102,ecs(ie+iadd+i1),
&	e,ecs(ie+iadd+i3),iwset,ie,iadd,i1,i2,i3
102	format(' pperp/e too big  val err ptoe'3g11.4
&	' iwset ie iadd i1 i2 i3'3i3,3i7)
	goto 4
16	print 101,ecs(ie+iadd+i1),e,ecs(ie+iadd+i3),iwset,ie,it,iadd,
&	i1,i2,i3
101	format(' negative error  val err ptoe'3g11.4' iwset ie it iadd'
&	' i1 i2 i3'7i4)
	fuds(ie)=-5.+fuds(ie)
4	continue
3	continue
2	continue
c
c	set average minus t
	if (.not.ignore) avt=0.5*(tlo+thi)
c
c	set ptoe as pt/e not sigma wgt * pt/e
	call trnado(val,err,ptoe,dele,ncom,nume,fuds)
	do 90 ie=1,nume
	if (fuds(ie).le.0.) goto 90
	err(ie)=amax1(err(ie),val(ie))
90	continue
	do 5 ie=1,nume
	if (val(ie).gt.1.e-5) goto 6
	eint=(elow+dele*(ie-.5))*corr
	ppin=pinc*corr
	pto=eint**2-am2i-.25*(avt-am2i-am2j+2.*eint*sqrt(ppin**2+am2j))**2
& 	/ppin**2
	if (pto.le.0.) goto 17
	ptoe(ie)=sqrt(pto)/eint
	goto 5
17	av=0.5*(tlo+thi)
	pto=eint**2-am2i-0.25*(avt-am2i-am2j+2.*eint*sqrt(ppin**2+am2j))
& 	**2/ppin**2
	if (pto.le.0.) ptoe(ie)=-100.
	if (pto.gt.0.) ptoe(ie)=sqrt(pto)/eint
	goto 5
6	ptoe(ie)=ptoe(ie)/val(ie)
5	continue
c
	end
