C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ subroutine get_boundary_testcryo(x,y,z,n,ires) c Fills ires with 1 (for front) or 2 (for rear) implicit none real slope(9),amp(9),offset(9) data offset/2.1, 2.1, 2.1, 2.1, 2.4, 2.1, 2.1, 2.1, 2.1/ data amp/.14,.14,.14,.14,.14,.14,.14,.14,.14/ C 2001 Jan 29: New "release 1" slope values: -- cPbL data slope / .45, .12, .18, .33, .37, .43, .44, .44, .38 / real*4 x,y,z Integer n,ires real z_adjust(9) real centx(9),centy(9) real dx,r,theta,from_front,seg common/adjust/z_adjust common/centers/centx,centy dx = x-centx(n) if (dx .eq. 0.) then dx = .00001 endif r = sqrt((x-centx(n))**2. + (y-centy(n))**2.) theta = atan((y-centy(n))/dx) c Find absolute z locaiton of front of detector: c MARS in HESSI: 20 c CCMT in MARS: -27.1175 c module in CCMT: 5.671+0.381+0.0762 c 4.5 must be the distance from the front of the detector to the middle of CCMT c c z_adjust, defined in spectrometer.for, are on the order of 0.1 from_front = 8.5-4. - (z-(5.671+.381+.0762)+27.1175-20.) . - z_adjust(n) seg = (r-0.75) * (-(slope(n)) + amp(n) * + sin(2. * theta)) + offset(n) if (from_front .gt. seg) then ires = 2 else ires = 1 endif return end CC++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ C