* macro to calc drift time to distance map *find x,y for each drifttime histogram (one per plane) *first chamber x,y vect/create wc1x1x(138) vect/create wc1x1y(138) vect/create wc1y1x(138) vect/create wc1y1y(138) vect/create wc1u1x(138) vect/create wc1u1y(138) vect/create wc1v1x(138) vect/create wc1v1y(138) vect/create wc1y2x(138) vect/create wc1y2y(138) vect/create wc1x2x(138) vect/create wc1x2y(138) *second chamber x,y vect/create wc2x1x(138) vect/create wc2x1y(138) vect/create wc2y1x(138) vect/create wc2y1y(138) vect/create wc2u1x(138) vect/create wc2u1y(138) vect/create wc2v1x(138) vect/create wc2v1y(138) vect/create wc2y2x(138) vect/create wc2y2y(138) vect/create wc2x2x(138) vect/create wc2x2y(138) *dummy x,y fpr errors vect/create ex(138) vect/create ey(138) vect/create dummy(1) * dumping contents of histograms into 2 vectors x,y * if number of bins changes, then the numbers will have to * change to match the number of bins. * the current numbers (138,38,175) assume 200 bins from -100 to 300 * The drift map uses 138 bins from t=-24ns to t=+250ns * 138 bins, from bin 38 (-24ns) to bin 175(250ns) hist/get_vect/rebin dtime_hdc1x1 wc1x1x wc1x1y ex ey 138 38 175 hist/get_vect/rebin dtime_hdc1y1 wc1y1x wc1y1y ex ey 138 38 175 hist/get_vect/rebin dtime_hdc1u1 wc1u1x wc1u1y ex ey 138 38 175 hist/get_vect/rebin dtime_hdc1v1 wc1v1x wc1v1y ex ey 138 38 175 hist/get_vect/rebin dtime_hdc1y2 wc1y2x wc1y2y ex ey 138 38 175 hist/get_vect/rebin dtime_hdc1x2 wc1x2x wc1x2y ex ey 138 38 175 hist/get_vect/rebin dtime_hdc2x1 wc2x1x wc2x1y ex ey 138 38 175 hist/get_vect/rebin dtime_hdc2y1 wc2y1x wc2y1y ex ey 138 38 175 hist/get_vect/rebin dtime_hdc2u1 wc2u1x wc2u1y ex ey 138 38 175 hist/get_vect/rebin dtime_hdc2v1 wc2v1x wc2v1y ex ey 138 38 175 hist/get_vect/rebin dtime_hdc2y2 wc2y2x wc2y2y ex ey 138 38 175 hist/get_vect/rebin dtime_hdc2x2 wc2x2x wc2x2y ex ey 138 38 175 * application sigma allows the use of advanced vector functions * vsum is the sum of all the components of a vector * sumv is the running sum of the componets of a vector and is a vector * itself * the time to distance map is then sumv/vsum * the elements of the map will range from 0 to 1 application sigma wc1x1r=sumv(wc1x1y)/vsum(wc1x1y) wc1y1r=sumv(wc1y1y)/vsum(wc1y1y) wc1u1r=sumv(wc1u1y)/vsum(wc1u1y) wc1v1r=sumv(wc1v1y)/vsum(wc1v1y) wc1y2r=sumv(wc1y2y)/vsum(wc1y2y) wc1x2r=sumv(wc1x2y)/vsum(wc1x2y) wc2x1r=sumv(wc2x1y)/vsum(wc2x1y) wc2y1r=sumv(wc2y1y)/vsum(wc2y1y) wc2u1r=sumv(wc2u1y)/vsum(wc2u1y) wc2v1r=sumv(wc2v1y)/vsum(wc2v1y) wc2y2r=sumv(wc2y2y)/vsum(wc2y2y) wc2x2r=sumv(wc2x2y)/vsum(wc2x2y) exit * dump vectors to output file for CTP param file inclusion * it is necessary for some minor editing of the file for ctp inclusion * ctp must also have 138 elements for this map to work properly vector/write wc1x1r(1:8) hms.driftmap "hwc1x1fract=",(7(f6.4,","),f6.4) 'o' vector/write wc1x1r(9:138) hms.driftmap (9(f6.4,","),f6.4) ' ' vector/write wc1y1r(1:8) hms.driftmap "hwc1y1fract=",(7(f6.4,","),f6.4) ' ' vector/write wc1y1r(9:138) hms.driftmap (9(f6.4,","),f6.4) ' ' vector/write wc1u1r(1:8) hms.driftmap "hwc1u1fract=",(7(f6.4,","),f6.4) ' ' vector/write wc1u1r(9:138) hms.driftmap (9(f6.4,","),f6.4) ' ' vector/write wc1v1r(1:8) hms.driftmap "hwc1v1fract=",(7(f6.4,","),f6.4) ' ' vector/write wc1v1r(9:138) hms.driftmap (9(f6.4,","),f6.4) ' ' vector/write wc1y2r(1:8) hms.driftmap "hwc1y2fract=",(7(f6.4,","),f6.4) ' ' vector/write wc1y2r(9:138) hms.driftmap (9(f6.4,","),f6.4) ' ' vector/write wc1x2r(1:8) hms.driftmap "hwc1x2fract=",(7(f6.4,","),f6.4) ' ' vector/write wc1x2r(9:138) hms.driftmap (9(f6.4,","),f6.4) ' ' vector/write wc2x1r(1:8) hms.driftmap "hwc2x1fract=",(7(f6.4,","),f6.4) ' ' vector/write wc2x1r(9:138) hms.driftmap (9(f6.4,","),f6.4) ' ' vector/write wc2y1r(1:8) hms.driftmap "hwc2y1fract=",(7(f6.4,","),f6.4) ' ' vector/write wc2y1r(9:138) hms.driftmap (9(f6.4,","),f6.4) ' ' vector/write wc2u1r(1:8) hms.driftmap "hwc2u1fract=",(7(f6.4,","),f6.4) ' ' vector/write wc2u1r(9:138) hms.driftmap (9(f6.4,","),f6.4) ' ' vector/write wc2v1r(1:8) hms.driftmap "hwc2v1fract=",(7(f6.4,","),f6.4) ' ' vector/write wc2v1r(9:138) hms.driftmap (9(f6.4,","),f6.4) ' ' vector/write wc2y2r(1:8) hms.driftmap "hwc2y2fract=",(7(f6.4,","),f6.4) ' ' vector/write wc2y2r(9:138) hms.driftmap (9(f6.4,","),f6.4) ' ' vector/write wc2x2r(1:8) hms.driftmap "hwc2x2fract=",(7(f6.4,","),f6.4) ' ' vector/write wc2x2r(9:138) hms.driftmap (9(f6.4,","),f6.4) 'c'