diff options
author | Thomas White <taw@physics.org> | 2010-02-04 19:04:20 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2010-02-04 19:04:20 +0100 |
commit | a162a01f988a86f38d10a1b507d524637670566e (patch) | |
tree | 401f12e5878d8ca150b51bca5835cae627eabc6e /src/peaks.c | |
parent | c85a8a308ec7ab50545255530da6a31b841be3ed (diff) |
Improved framework for detector geometry
Diffstat (limited to 'src/peaks.c')
-rw-r--r-- | src/peaks.c | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/peaks.c b/src/peaks.c index 31de2a79..56fa6931 100644 --- a/src/peaks.c +++ b/src/peaks.c @@ -432,7 +432,11 @@ void dump_peaks(struct image *image) double q, rx, ry, rz; int x, y; + double rcx = 0.0; + double rcy = 0.0; + int found = 0; struct imagefeature *f; + int p; f = image_get_feature(image->features, i); if ( f == NULL ) continue; @@ -440,16 +444,24 @@ void dump_peaks(struct image *image) x = f->x; y = f->y; - if ( f->y >=512 ) { - /* Top half of CCD */ - map_position(image, f->x-UPPER_CX, f->y-UPPER_CY, - &rx, &ry, &rz); - } else { - /* Lower half of CCD */ - map_position(image, f->x-LOWER_CX, f->y-LOWER_CY, - &rx, &ry, &rz); + for ( p=0; p<image->det.n_panels; p++ ) { + if ( (x >= image->det.panels[p].min_x) + && (x <= image->det.panels[p].max_x) + && (y >= image->det.panels[p].min_y) + && (y <= image->det.panels[p].max_y) ) { + rcx = ((double)x - image->det.panels[p].cx) + / image->resolution; + rcy = ((double)y - image->det.panels[p].cy) + / image->resolution; + found = 1; + } + } + if ( !found ) { + ERROR("No mapping found for %i,%i\n", x, y); + continue; } + map_position(image, rcx, rcy, &rx, &ry, &rz); q = modulus(rx, ry, rz); printf("%i\t%i\t%f\t%i\n", x, y, q/1.0e9, |