aboutsummaryrefslogtreecommitdiff
path: root/src/detector.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2009-11-13 17:13:11 +0100
committerThomas White <taw@physics.org>2009-11-13 17:13:11 +0100
commit26bf7df5817d1df238698dc8f63e4543e746c7c1 (patch)
tree8be24b25c07844dbb143d8376cbbe6343467ef5e /src/detector.c
parentebe633dab856ae1ea857a3c07c6f284c30899874 (diff)
Solid angle stuff
Diffstat (limited to 'src/detector.c')
-rw-r--r--src/detector.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/detector.c b/src/detector.c
index 2b0c12d4..339ff626 100644
--- a/src/detector.c
+++ b/src/detector.c
@@ -26,26 +26,32 @@ void record_image(struct image *image)
{
int x, y;
double ph_per_e;
+ double twotheta_max, np, sa_per_pixel;
/* How many photons are scattered per electron? */
ph_per_e = PULSE_ENERGY_DENSITY * pow(THOMSON_LENGTH, 2.0)
/ image->xray_energy;
-
printf("%e photons are scattered per electron\n", ph_per_e);
+ twotheta_max = image->twotheta[0];
+
+ np = sqrt(pow(image->x_centre, 2.0) + pow(image->y_centre, 2.0));
+ sa_per_pixel = pow(2.0 * twotheta_max / np, 2.0);
+ printf("sa per pixel=%e\n", sa_per_pixel);
+
image->data = malloc(image->width * image->height * sizeof(uint16_t));
for ( x=0; x<image->width; x++ ) {
for ( y=0; y<image->height; y++ ) {
- uint16_t counts;
+ double counts;
double val, intensity;
double sa;
val = image->sfacs[x + image->width*y];
/* What solid angle is subtended by this pixel? */
- sa = 1.0;
+ sa = sa_per_pixel * cos(image->twotheta[x + image->width*y]);
intensity = pow(val, 2.0);
counts = intensity * ph_per_e * sa;