aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/detgeom.h
blob: 99355a38991fdc902b644108f53d21f324699010 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 * detgeom.h
 *
 * Detector geometry structure
 *
 * Copyright © 2012-2020 Deutsches Elektronen-Synchrotron DESY,
 *                       a research centre of the Helmholtz Association.
 * Copyright © 2012 Richard Kirian
 *
 * Authors:
 *   2009-2020 Thomas White <taw@physics.org>
 *   2011-2012 Richard Kirian <rkirian@asu.edu>
 *   2014      Valerio Mariani
 *   2011      Andrew Aquila
 *
 * This file is part of CrystFEL.
 *
 * CrystFEL is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * CrystFEL is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with CrystFEL.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef DETGEOM_H
#define DETGEOM_H

#ifdef __cplusplus
extern "C" {
#endif

/**
 * \file detgeom.h
 * Detector geometry structure and related functions.
 */


/**
 * Represents one panel of a detector
 */
struct detgeom_panel
{
	/** Text name for panel */
	char *name;

	/** \name Location of corner in units of the pixel size of this panel, \
	 *  measured from the interaction point. */
	/**@{*/
	double      cnx;
	double      cny;
	double      cnz;
	/**@}*/

	/** Pixel size in metres */
	double      pixel_pitch;

	/** Number of detector intensity units per photon (or electron, etc) */
	double      adu_per_photon;

	/** Treat pixel as unreliable if higher than this */
	double      max_adu;

	/** \name Transformation matrix from pixel coordinates to lab frame */
	/*@{*/
	double      fsx;
	double      fsy;
	double      fsz;
	double      ssx;
	double      ssy;
	double      ssz;
	/*@}*/

	/** \name Width and height of panel */
	/*@{*/
	int         w;
	int         h;
	/*@}*/
};


struct detgeom
{
	struct detgeom_panel *panels;
	int                   n_panels;
};

extern void detgeom_transform_coords(struct detgeom_panel *p,
                                     double fs, double ss,
                                     double wavelength,
                                     double *r);

extern void detgeom_free(struct detgeom *detgeom);

extern double detgeom_max_resolution(struct detgeom *detgeom,
                                     double wavelength);

#ifdef __cplusplus
}
#endif

#endif	/* DETGEOM_H */