diff options
author | Valerio Mariani <valerio.mariani@desy.de> | 2015-11-02 15:33:30 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2015-11-03 10:23:09 +0100 |
commit | 832374fb4578ed5252bd3bcbdf699833115088f9 (patch) | |
tree | a4540d970b09ed38920d1a1091862438344a9514 | |
parent | 45e5f791a7e9325dbb8f7aef4331d32be17f080c (diff) |
Corrected logical mistake in computing panel distances
-rw-r--r-- | src/geoptimiser.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/geoptimiser.c b/src/geoptimiser.c index 29c439b2..0ac59ddf 100644 --- a/src/geoptimiser.c +++ b/src/geoptimiser.c @@ -2380,21 +2380,25 @@ int check_and_enforce_cspad_dist(struct geoptimiser_params *gparams, for ( np=0; np<det->n_panels; np = np+2 ) { double dist2; + double cnx2, cny2; struct panel *ep = &det->panels[np]; struct panel *op = &det->panels[np+1]; - dist2 = (( ep->cnx - op->cnx )*( ep->cnx - op->cnx ) + - ( ep->cny - op->cny )*( ep->cny - op->cny )); + cnx2 = ep->cnx + 197.0*ep->fsx; + cny2 = ep->cny + 197.0*ep->fsy; - if ( dist2 > (dist_to_check+tol)*(dist_to_check+tol) || - dist2 < (dist_to_check-tol)*(dist_to_check-tol) ) { + dist2 = (( cnx2 - op->cnx )*( cnx2 - op->cnx ) + + ( cny2 - op->cny )*( cny2 - op->cny )); + + if ( dist2 > (tol*tol)) { num_errors_found += 1; STATUS("Warning: distance between panels %s and %s " - "is outside acceptable margins.\n", ep->name, - op->name); + "is outside acceptable margins (Corners are " + "more than 0.2 pixels away: %3.2f).\n", ep->name, + op->name, sqrt(dist2)); if ( gparams->enforce_cspad_layout ) { |