	function ai2(edet)
c
	include '/u1/gcf/e350/crystal/cb/clouds'
c
	include '/u1/gcf/e350/crystal/cb/abssiz'
c
	include '/u1/gcf/e350/crystal/cb/igr'
c
	include '/u1/gcf/e350/crystal/cb/beam'
c
	dimension xpt(16),csst(26,16),tpt(26)
	data xpt/0.6,0.65,0.7,0.75,0.8,0.85,0.9,0.91,0.92,0.93,0.94,0.95,
&	0.96,0.97,0.98,0.99/,nept/16/,ntpt/26/
	data tpt/0.01,0.03,0.05,0.07,0.09,0.11,0.13,0.15,0.17,0.19,
&	0.21,0.23,0.25,0.27,0.29,0.31,0.33,0.35,0.37,0.39,0.41,0.43,
&	0.45,0.47,0.49,0.51/
c	note - for 100 gev code said last point at .53 (????)
c
c	following numbers are for 100 gev analysis - the i=1 - i=2 interference
c	term was not included in the calculation
c	data (csst(j,1),j=1,26)/
c&	3.30,3.12,2.85,2.44,2.24,2.03,1.77,1.46,1.29,1.13,0.97,0.82,0.73,
c&	0.65,0.58,0.52,0.48,0.44,0.41,0.39,0.36,.351,.324,.325,.3004,.3059/
c	data (csst(j,2),j=1,26)/
c&	3.46,3.20,2.81,2.49,2.19,1.88,1.62,1.46,1.17,0.98,0.86,0.76,0.62,
c&	0.54,0.49,0.44,0.37,.334,.317,.293,.259,.244,.236,.230,.2139,.2068/
c	data (csst(j,3),j=1,26)/
c&	3.71,3.32,2.99,2.68,2.20,1.90,1.54,1.30,1.10,0.92,0.76,0.64,0.55,
c&	0.46,0.39,0.34,.297,.256,.221,.203,.188,.171,.156,.153,.1522,.1432/
c	data (csst(j,4),j=1,26)/
c&	3.81,3.46,2.97,2.59,2.09,1.78,1.40,1.22,0.96,0.84,0.63,0.56,0.44,
c&	0.40,.301,.270,.214,.196,.159,.145,.123,.120,.107,.103,.0964,.1071/
c	data (csst(j,5),j=1,26)/
c&	3.78,3.32,2.96,2.36,1.89,1.61,1.18,1.06,0.84,0.69,0.52,0.46,0.36,
c&	0.29,.221,.200,.157,.132,.104,.096,.084,.081,.068,.064,.0675,.0770/
c	data (csst(j,6),j=1,26)/
c&	3.87,3.15,2.61,2.11,1.64,1.34,0.99,0.81,0.66,0.54,0.39,0.31,0.25,
c&	.202,.146,.122,.095,.078,.062,.058,.044,.042,.039,.041,.0313,.0343/
c	data (csst(j,7),j=1,26)/
c&	3.35,2.61,1.92,1.59,1.17,0.85,0.75,0.51,0.40,0.28,0.24,.162,.127,
c&	.091,.078,.053,.045,.033,.0287,.0221,.021,.0173,.0156,.0140,
c&	.0141,.0133/
c	data (csst(j,8),j=1,26)/
c&	3.24,2.49,1.89,1.52,1.11,0.82,0.62,0.45,0.36,0.26,.191,.139,.109,
c&	.080,.060,.046,.037,.029,.0232,.0192,.0164,.0149,.0126,.0122,
c&	.0108,.0108/
c	data (csst(j,9),j=1,26)/
c&	3.02,2.27,1.71,1.18,0.98,0.76,0.54,0.40,0.30,.223,.160,.116,.087,
c&	.066,.049,.037,.029,.0227,.0183,.0145,.0129,.0109,.0100,.0087,
c&	.0087,.0078/
c	data (csst(j,10),j=1,26)/
c&	2.80,2.03,1.44,1.09,0.81,0.54,0.41,0.34,.229,.153,.116,.095,.067,
c&	.046,.036,.030,.0222,.0162,.0133,.0120,.0094,.0079,.0071,.0073,
c&	.0061,.0056/
c	data (csst(j,11),j=1,26)/
c&	2.38,1.72,1.29,0.94,0.63,0.45,0.34,.228,.163,.119,.092,.064,.046,
c&	.035,.0279,.0207,.0154,.0120,.0104,.0083,.0069,.0057,.0054,.0046,
c&	.0046,.0039/
c	data (csst(j,12),j=1,26)/
c&	2.08,1.43,0.94,0.70,0.45,0.34,.224,.162,.110,.083,.058,.043,.031,
c&	.0235,.0177,.0135,.0102,.0081,.0065,.0052,.0044,.0039,.0034,
c&	.0030,.0028,.0027/
c	data (csst(j,13),j=1,26)/
c&	1.49,1.04,0.75,0.42,0.30,.188,.131,.099,.067,.045,.033,.0255,.0185,
c&	.0133,.0103,.0078,.0062,.0046,.0039,.0030,.0027,.0021,.0019,.0017,
c&	.0017,.0014/
c	data (csst(j,14),j=1,26)/
c&	1.00,0.65,0.35,0.25,.158,.102,.066,.045,.032,.0232,.0161,.0119,
c&	.0086,.0067,.0049,.0038,.0028,.0023,.0019,.0015,.0012,.0011,.0010,
c&	.0009,.0008,.0007/
c	data (csst(j,15),j=1,26)/
c&	0.44,0.24,.125,.067,.047,.026,.0195,.0121,.0091,.0058,.0046,.0031,
c&	.0024,.0016,.0013,.0010,.0008,.0006,.0005,.0005,.0004,.0003,.0003,
c&	.0003,.0003,.0002/
c	data (csst(j,16),j=1,26)/
c&	.0114,.0045,.0017,.0008,.0005,.0002,3*.0001,17*0./
c
c	following numbers are for 200 gev analysis (used beam energy of
c	197.3 gev)
	data (csst(j,1),j=1,26)/
&	3.42,3.13,2.84,2.56,2.33,2.02,1.79,1.53,1.33,1.15,.953,.848,.761,
&	.654,.562,.512,.467,.478,.402,.351,.354,.335,.316,.304,.291,.306/
	data (csst(j,2),j=1,26)/
&	3.46,3.13,2.80,2.47,2.15,1.87,1.59,1.37,1.15,1.01,.881,.735,.644,
&	.560,.461,.423,.386,.353,.315,.274,.262,.252,.237,.225,.214,.208/
	data (csst(j,3),j=1,26)/
&	3.59,3.21,2.82,2.46,2.15,1.79,1.53,1.27,1.07,.880,.742,.600,.547,
&	.468,.390,.331,.289,.255,.221,.215,.178,.163,.149,.143,.137,.142/
	data (csst(j,4),j=1,26)/
&	3.60,3.18,2.76,2.35,2.01,1.63,1.40,1.11,.960,.736,.654,.538,.437,
&	.351,.316,.257,.221,.177,.152,.133,.122,.108,.103,.098,.096,.095/
	data (csst(j,5),j=1,26)/
&	3.51,3.00,2.54,2.12,1.84,1.43,1.21,.956,.796,.599,.538,.430,.348,
&	.288,.226,.185,.151,.124,.104,.087,.074,.070,.065,.061,.057,.059/
	data (csst(j,6),j=1,26)/
&	3.56,2.93,2.37,1.90,1.55,1.21,.991,.773,.628,.458,.375,.290,.213,
&	.190,.138,.113,.083,.073,.062,.048,.043,.040,.036,.035,.033,.031/
	data (csst(j,7),j=1,26)/
&	3.00,2.33,1.79,1.38,1.03,.824,.601,.482,.345,.299,.202,.162,.125,
&	.087,.072,.054,.040,.032,.027,.0214,.0202,.0162,.0151,.0144,
&	.0138,.0134/
	data (csst(j,8),j=1,26)/
&	2.90,2.20,1.69,1.31,.991,.773,.566,.441,.316,.232,.171,.122,.090,
&	.070,.056,.044,.032,.0265,.0206,.0169,.0152,.0123,.0113,.0104,
&	.0107,.0097/
	data (csst(j,9),j=1,26)/
&	2.70,2.04,1.55,1.18,.921,.671,.513,.369,.278,.196,.143,.104,.078,
&	.057,.049,.032,.0268,.0209,.0160,.0138,.0118,.0102,.0086,.0083,
&	.0077,.0066/
	data (csst(j,10),j=1,26)/
&	2.46,1.82,1.35,.997,.668,.532,.355,.281,.188,.140,.117,.080,.060,
&	.046,.034,.0239,.0184,.0149,.0117,.0099,.0090,.0078,.0067,.0059,
&	.0056,.0056/
	data (csst(j,11),j=1,26)/
&	2.16,1.54,1.10,.788,.577,.399,.292,.202,.149,.113,.079,.055,.039,
&	.028,.0246,.0178,.0130,.0106,.0084,.0073,.0064,.0051,.0047,.0039,
&	.0036,.0035/
	data (csst(j,12),j=1,26)/
&	1.75,1.24,0.871,.607,.435,.290,.207,.141,.102,.071,.053,.039,.028,
&	.0220,.0149,.0123,.0089,.0070,.0055,.0045,.0038,.0031,.0027,.0025,
&	.0025,.0022/
	data (csst(j,13),j=1,26)/
&	1.42,.950,.627,.412,.260,.182,.119,.086,.058,.041,.031,.0228,
&	.0160,.0122,.0091,.0070,.0054,.0042,.0032,.0028,.0022,.0019,
&	.0017,.0014,.0013,.0013/
	data (csst(j,14),j=1,26)/
&	.982,.608,.369,.227,.139,.092,.056,.042,.029,.0200,.0142,.0108,
&	.0075,.0057,.0043,.0033,.0027,.0020,.0016,.0013,.0010,.0009,
&	2*.0008,.0007,.0006/
	data (csst(j,15),j=1,26)/
&	.419,.212,.114,.066,.038,.025,.0184,.0111,.0075,.0055,.0039,.0028,
&	.0021,.0016,.0011,.0008,.0007,.0006,.0005,.0004,4*.0003,2*.0002/
	data (csst(j,16),j=1,26)/
&	.026,.011,.0051,.0027,.0018,.0010,.0007,.0004,.0003,.0002,.0001,
&	2*.0001,13*.0000/
c
c
c     find nearest energies
	xdet=edet/ebm(nobeam/2+1)
	do 3 ie=1,nept
	if (xdet.lt.xpt(ie)) goto 4
3	continue
	ie=nept
4	ie=max0(ie,2)
	rate=(xpt(ie)-xdet)/(xpt(ie)-xpt(ie-1))
	ai2=1.e3*(rate*amax1(0.,vol(-tlo,-thi,csst(1,ie-1),ntpt,tpt))
& 	+(1.-rate)*amax1(0.,vol(-tlo,-thi,csst(1,ie),ntpt,tpt)))/
& 	(fdmicr*enhigh((nobeam+1)/2))
	ai2=amax1(ai2,0.)
	return
	end
