Changeset 974 for sans/XOP_Dev/MonteCarlo/MonteCarlo_Main.c
- Timestamp:
- Jan 19, 2016 11:48:55 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/XOP_Dev/MonteCarlo/MonteCarlo_Main.c
r834 r974 15 15 #include "MonteCarlo.h" 16 16 #include "DebyeSpheres.h" 17 #include "Metropolis.h" 17 18 18 19 … … 33 34 34 35 36 // corrected Feb 2013 to return values in [0,127] rather than detector coordinates (which are passed in) 37 // -- also corrected the pixel calculation 35 38 int 36 39 FindPixel(double testQ, double testPhi, double lam, double yg_d, double sdd, 37 40 double pixSize, double xCtr, double yCtr, long *xPixel, long *yPixel) { 38 41 39 double theta,dy,dx,qx,qy,pi; 40 pi = 4.0*atan(1.0); 42 // double theta,dy,dx,qx,qy,pi; 43 double pi,two_theta,dist,dx,dy; 44 45 pi = 4.0*atan(1.0); 46 47 /* OLD way 41 48 //decompose to qx,qy 42 49 qx = testQ*cos(testPhi); … … 57 64 // *xPixel = lround(xCtr + dx/pixSize); 58 65 *xPixel = MC_round(xCtr + dx/pixSize); 66 67 */ 68 69 // corrected way Feb 2013 70 two_theta = 2.0*asin(testQ*lam/4.0/pi); 71 dist = sdd*tan(two_theta); //hypot in det plane 72 73 dx = dist*cos(testPhi); 74 dy = dist*sin(testPhi); 75 *xPixel = MC_round(dx/pixSize + xCtr); 76 *yPixel = MC_round(dy/pixSize + yCtr + yg_d/pixSize); //shift down due to gravity 77 78 // to array coordinates rather than detector coordinates 79 *xPixel -= 1; 80 *yPixel -= 1; 81 59 82 60 83 //if on detector, return xPix and yPix values, otherwise -1 … … 387 410 return((long)binSLDDistanceX); 388 411 break; 412 case 9: // 413 return((long)MetropolisX); 414 break; 389 415 } 390 416 return(NIL);
Note: See TracChangeset
for help on using the changeset viewer.