****************************************************************** * macro tdcfit n1=0 n2=279 dir_in=tdc_data dir_out=tdc_par * * Written by Andrey Lebedev * * This macro does fits to ADC-TDC data, taking the averaged data * from [dir_in] and outputting fit parameters to [dir_out] * One needs to be careful with initial parameters, and their limits, * which may need to be adjusted depending on the type of a counter. * ******************************************************************* do i=[n1], [n2] if [i]<10 then ve/re tdc,adc,err_tdc,err_adc [dir_in]/tdc00[i].dat elseif [i]<100 then ve/re tdc,adc,err_tdc,err_adc [dir_in]/tdc0[i].dat else ve/re tdc,adc,err_tdc,err_adc [dir_in]/tdc[i].dat endif mess ........... Doing TDC #[i] ............ * p(1) is TDC offset, p(2) is the power to which the x is raised (has * to be negative), p(3) is the multiplicative constant for the function, * p(4) is the ADC offset. ve/cr p(4) R 0. -1.1 2500. 0. ve/cr pmin(4) R -10. -3.5 0. -1000. ve/cr pmax(4) R 10. -0.1 50000. 200. ve/cr step(4) R 0.01 0.01 1. 1. ve/cr perr(4) R 1000. 1000. 1000. 1000. ve/fit adc tdc err_tdc die.for BNOQ 4 p step pmin pmax perr if [i]<10 then ve/wr p,perr [dir_out]/tdc00[i].par elseif [i]<100 then ve/wr p,perr [dir_out]/tdc0[i].par else ve/wr p,perr [dir_out]/tdc[i].par endif ve/de p,pmin,pmax,step,perr,tdc,adc,err_tdc,err_adc enddo return