#pragma rtGlobals=1 // Use modern global access method. Function cBNcorrectINT(twothetawave, intwave, diamondh) // takes wave with 2theta, wave with intensity, and diamond thickness variable // applies intensity correction for cBN seat of standard dimensions // the incoming wave should have background correction before the correction is applied Wave twothetawave Wave intwave Variable diamondh // standard dimensions of Duffy Lab cBN seat Variable cBNh=5.5 Variable cBNholer=0.4 Variable cBNconer=1.95 Variable coneangle=atan((cBNconer-cBNholer)/cBNh) // absorption coefficient @ 37 keV Variable cBNmu=0.0863460 // diamond is negligible // Variable diamondmu= 0.00462948 // three regimes: // 1. center - no absorption by cbn // 2. falloff - beam goes through the cone, but not through the whole thickness of the seat yet // 3. shoulders - beam goes through the whole thickness of the seat. Variable centermaxangle=atan(cBNholer/diamondh) Variable shoulderminangle=atan(cBNconer/(diamondh+cBNh)) // walk through the waves Variable counter Variable wavelength=numpnts(twothetawave) Variable tcBN Duplicate/O intwave,corrintwave Variable twothetanow for(counter=0; counter