1313* Position-sensitive, linear Q monitor.
1414*
1515* %D
16+ * One-dimensional Q-monitor. Calculates Q from "measured" time-of-flight,
17+ * i.e. not from particle velocity parameters.
18+ *
1619* Adapted from Kim Lefmann's TOF_cylPSDmonitor and PSD_monitors
1720* An n pixel Q-monitor based on measured Time of Flight detection.
1821* This component may also be used as a beam
1922* detector.
2023*
2124* Example: TOF_PSDmonitor_toQ(xmin=-0.1, xmax=0.1, ymin=-0.1, ymax=0.1,
22- * ny=90, nchan =100, TOFmin=0.0, TOFmax=20000.0, filename="Output.psd")
25+ * ny=90, nqbin =100, TOFmin=0.0, TOFmax=20000.0, filename="Output.psd")
2326*
2427* %P
2528* INPUT PARAMETERS:
3033* yheight: [m] height of detector opening
3134* ymin: [m] Lower y bound of detector opening
3235* ymax: [m] Upper y bound of detector opening
33- * ny: [1] Number of y bins (unsused?)
36+ * ny: [1] Number of y bins (for discretisation of
3437* filename: [str] Name of file in which to store the detector image
3538* nowritefile: [1] If set, detector will skip writing to disk
3639* tmin: [mu-s] Beginning TOF window
@@ -56,6 +59,7 @@ DECLARE
5659 %}
5760INITIALIZE
5861 %{
62+
5963 if (xwidth > 0) { xmax = xwidth/2; xmin = -xmax; }
6064 if (yheight > 0) { ymax = yheight/2; ymin = -ymax; }
6165
128132 %}
129133
130134FINALLY %{
131- destroy_darr2d (Q_N);
132- destroy_darr2d (Q_p);
133- destroy_darr2d (Q_p2);
135+ destroy_darr1d (Q_N);
136+ destroy_darr1d (Q_p);
137+ destroy_darr1d (Q_p2);
134138%}
135139
136140MCDISPLAY
@@ -141,6 +145,13 @@ MCDISPLAY
141145 (double)xmax, (double)ymax, 0.0,
142146 (double)xmin, (double)ymax, 0.0,
143147 (double)xmin, (double)ymin, 0.0);
148+ double dy=(ymax-ymin)/(ny);
149+ int j;
150+ double ytmp=ymin;
151+ for(j=0; j<ny; j++) {
152+ multiline(2, xmin, ytmp, 0.0, xmax, ytmp, 0.0);
153+ ytmp+=dy;
154+ }
144155%}
145156
146157END
0 commit comments