Changeset 758 for sans/XOP_Dev/MonteCarlo/MonteCarlo_Main.c
 Timestamp:
 Oct 26, 2010 3:32:14 PM (12 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sans/XOP_Dev/MonteCarlo/MonteCarlo_Main.c
r711 r758 16 16 #include "DebyeSpheres.h" 17 17 18 19 // this function is here simply because MS visual studio does not contain lround() or round() in math.h 20 // rounds away from zero 21 //  only used in FindPixel 22 long MC_round(double x) 23 { 24 if(x == 0) { 25 return (long)(0); 26 } 27 if(x > 0) { 28 return (long)(x + 0.5f); 29 } else { // x < 0 30 return (long)(x  0.5f); 31 } 32 } 33 34 18 35 int 19 36 FindPixel(double testQ, double testPhi, double lam, double sdd, … … 29 46 theta = 2.0*asin(qy*lam/4.0/pi); 30 47 dy = sdd*tan(theta); 31 *yPixel = lround(yCtr + dy/pixSize); //corrected 7/2010 to round away from zero, to avoid 2x counts in row 0 and column 0 48 // *yPixel = lround(yCtr + dy/pixSize); //corrected 7/2010 to round away from zero, to avoid 2x counts in row 0 and column 0 49 *yPixel = MC_round(yCtr + dy/pixSize); //corrected 7/2010 to round away from zero, to avoid 2x counts in row 0 and column 0 32 50 33 51 theta = 2.0*asin(qx*lam/4.0/pi); 34 52 dx = sdd*tan(theta); 35 *xPixel = lround(xCtr + dx/pixSize); 53 // *xPixel = lround(xCtr + dx/pixSize); 54 *xPixel = MC_round(xCtr + dx/pixSize); 36 55 37 56 //if on detector, return xPix and yPix values, otherwise 1
Note: See TracChangeset
for help on using the changeset viewer.