	program drifting
c  calculate drift time in a gas - CNB 09/09
c for a cylindrical prop tube
c all dimensions in cm, microsec and KV
c
c Data of electron velocity versus field follows:
c     velocity (vl) in cm/microsec, field (f) in kV/cm
c     approximated by straight lines
	dimension vl(10),f(10),v(26),e(26),r(26)
c data for A-5%CH4 (Sauli Peisert 1984 Fig63)
c	data vl/0.0,3.2,3.7,3.8,3.7,3.5,2.8,2.6,2.1,1.5/
c	data  f/0.0,.04,.07,.10,.14,.20,.30,0.4,0.8,10./
c data for A-2.1%CO2 (Sauli Peisert 1984 Fig32)
c	data vl/0.0,1.0,2.0,3.0,3.2,3.0,2.7,2.6,2.5,1.5/
c	data  f/0.0,.06,.10,.16,0.2,.28,0.4,0.5,0.6,10./
c data for A-5%CO2 (Sauli Peisert 1984 Fig32)
c	data vl/0.0,0.8,2.1,3.6,3.8,4.3,4.8,4.8,4.6,4.0/
c	data  f/0.0,0.1,0.2,0.3,0.4,0.5,0.6,1.0,3.0,10./
c data for A-10%CO2 (Sauli Peisert 1984 Fig32+34)
	data vl/0.0,0.8,2.1,3.0,3.5,4.5,4.8,5.0,5.1,4.0/
	data  f/0.0,0.2,0.4,0.5,0.6,.75,1.0,1.7,3.0,10./
c
 	wiredia=0.002
	wirerad=wiredia/2.
	tubeid=2.5
	voltage=2.1
	print 23, wiredia,tubeid,voltage
 23	format(' wiredia=',f7.4,'  tubeid=',f6.3,'  voltage=',f6.3)
	c=-alog(wirerad/tubeid)
	print 22
 22	format('    r(cm)  f(KV/cm)  V(KV)   velocity   dt     totalt')
	ttot=0.
c now calculate the field and it's derivative at 25 equal intervals .
	dr=(tubeid-wirerad)/25
	do 1, i=1,26
	r(i)=(i-1.)*dr+wirerad
	e(i)=voltage/(c*r(i))
	v(i)=-voltage*alog(r(i)/tubeid)/c
 1	continue
c	print 222,r,e,v,i,it
 222	format(f9.3,2f9.4,27x,2i4)
c now interpolate the velocity in middle of each interval
 	do 11 i=1,25
	emid=voltage/(c*(r(i)+dr/2.))
c	print *,emid
	do 4, it=1,9
	if(f(it+1).lt.emid)go to 4
	vel=vl(it)+(vl(it+1)-vl(it))*(emid-f(it))/(f(it+1)-f(it))
c now calculate the drift time across this interval
	t=dr/vel
	ttot=ttot+t
	print 2,r(i),e(i),v(i),vel,t,ttot
  2	format(f9.3,5f9.3,i4)
 	go to 11
  4 	continue
  11	continue
c now print drift time and values at inside edge of tube
	print 223,r(26),e(26),v(26),ttot
 223	format(f9.3,2f9.3,1x,' total drift in microsec',f9.3)
 	stop
	end
	


	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
