aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/pattern_sim.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/pattern_sim.c b/src/pattern_sim.c
index f9d8126d..bd97ead7 100644
--- a/src/pattern_sim.c
+++ b/src/pattern_sim.c
@@ -223,6 +223,27 @@ static int random_ncells(double len, double min_m, double max_m)
}
+static void fixup_geom(struct detector *det)
+{
+ int i;
+
+ for ( i=0; i<det->n_panels; i++ ) {
+ det->panels[i].clen += det->panels[i].coffset;
+ }
+}
+
+
+static int geom_contains_references(struct detector *det)
+{
+ int i;
+
+ for ( i=0; i<det->n_panels; i++ ) {
+ if ( det->panels[i].clen_from != NULL ) return 1;
+ }
+ return 0;
+}
+
+
int main(int argc, char *argv[])
{
int c;
@@ -554,6 +575,13 @@ int main(int argc, char *argv[])
ERROR("The value given on the command line "
"(with --photon-energy) will be used instead.\n");
}
+ if ( geom_contains_references(image.det) ) {
+ ERROR("Geometry file contains a reference to an HDF5 location"
+ " for the camera length. Change it to a numerical value "
+ " and try again.\n");
+ return 1;
+ }
+ fixup_geom(image.det);
if ( spectrum_str == NULL ) {
STATUS("You didn't specify a spectrum type, so"