diff options
author | Rick Kirian <rkirian@asu.edu> | 2011-03-25 14:44:08 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2012-02-22 15:27:23 +0100 |
commit | 2c09002652b107e4e5cc85cd75df298c09ce9a4e (patch) | |
tree | f6957f3442bb2ecc8e85c72623875ad00d861cf8 | |
parent | 36e8507fe373a466b2e5245fd2e523378f28d254 (diff) |
detector.c: add function find_panel_number
-rw-r--r-- | src/detector.c | 17 | ||||
-rw-r--r-- | src/detector.h | 2 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/detector.c b/src/detector.c index c542a5a1..a202d5a3 100644 --- a/src/detector.c +++ b/src/detector.c @@ -280,6 +280,23 @@ struct panel *find_panel(struct detector *det, double fs, double ss) } +int find_panel_number(struct detector *det, int fs, int ss) +{ + int p; + + for ( p=0; p<det->n_panels; p++ ) { + if ( (fs >= det->panels[p].min_fs) + && (fs <= det->panels[p].max_fs) + && (ss >= det->panels[p].min_ss) + && (ss <= det->panels[p].max_ss) ) { + return p; + } + } + + return -1; +} + + void fill_in_values(struct detector *det, struct hdfile *f) { int i; diff --git a/src/detector.h b/src/detector.h index 0ceff341..79c61761 100644 --- a/src/detector.h +++ b/src/detector.h @@ -93,6 +93,8 @@ extern void record_image(struct image *image, int do_poisson); extern struct panel *find_panel(struct detector *det, double fs, double ss); +extern int find_panel_number(struct detector *det, int fs, int ss); + extern struct detector *get_detector_geometry(const char *filename); extern void free_detector_geometry(struct detector *det); |