Skip to content

Commit 0fdcc11

Browse files
authored
Merge pull request #2428 from willend/main
Expand Monitor_nD to 10 uservars + other work on monitors
2 parents 0f5ee32 + 669c690 commit 0fdcc11

27 files changed

Lines changed: 2856 additions & 222 deletions

docs/manuals/mcstas/comp_abstract.tex

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,6 @@ \section{A short overview of the \MCS component library}
188188
% covers the whole cylinder (360 degrees). \\
189189
%PSDlin\_monitor & Rectangular 1D PSD, measuring intensity vs.
190190
% vertical position, x. \\
191-
PreMonitor\_nD & This component is a PreMonitor that is to be
192-
used with one Monitor\_nD,
193-
in order to record some neutron parameter correlations. \\
194191
TOFLambda\_monitor & Time-of-flight vs. wavelength monitor. \\
195192
%TOF\_cylPSD\_monitor & Cylindrical (2pi) PSD Time-of-flight monitor. \\
196193
TOF\_monitor & Rectangular Time-of-flight monitor. \\

docs/manuals/mcstas/monitors/Monitor_nD.tex

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -342,27 +342,38 @@ \subsubsection{Example: Number of neutron bounces in a guide}
342342
(...)
343343
\end{lstlisting}
344344

345-
\subsection{Monitoring neutron parameter correlations, PreMonitor\_nD}
345+
\subsection{Monitoring neutron parameter correlations via USERVARS}
346346

347-
The first imediate usage of the Monitor\_nD component is when one requires to identify cross-correlations between some neutron parameters, e.g. position and divergence (\textit{aka} phase-space diagram). This latter monitor would be merely obtained with:\index{Monitors!Neutron parameter correlations, PreMonitor\_nD}
347+
The first imediate usage of the Monitor\_nD component is when one requires to identify cross-correlations between some neutron parameters, e.g. position and divergence (\textit{aka} phase-space diagram).
348348
\begin{lstlisting}
349349
options="x dx, auto", bins=30
350350
\end{lstlisting}
351351
This example records the correlation between position and divergence of neutrons at a given instrument location.
352352

353-
\component{PreMonitor\_nD}{System, E. Farhi}{comp}{}{}
353+
But it is also possible to search for cross-correlation between two part of the instrument simulation. One example is the acceptance phase-diagram, which shows the neutron caracteristics at the input required to reach the end of the simulation. This \emph{spatial} correlation may be revealed using \index{Monitors!Neutron parameter correlations, USERVARS}\ref{s:monnd:user} initialised in an \textbf{EXTEND} block of an earlier component. \textbf{USERVARS} may store neutron parameters at a given instrument location, to be used with a later Monitor\_nD location for monitoring:
354354

355-
But it is also possible to search for cross-correlation between two part of the instrument simulation. One example is the acceptance phase-diagram, which shows the neutron caracteristics at the input required to reach the end of the simulation. This \emph{spatial} correlation may be revealed using the \textbf{PreMonitor\_nD} component. This latter stores the neutron parameters at a given instrument location, to be used at an other Monitor\_nD location for monitoring.
356-
357-
The only parameter of \textbf{PreMonitor\_nD} is the name of the associated Monitor\_nD instance, which should use the \verb+premonitor+ option, as in the following example:
358355
\begin{lstlisting}
359-
COMPONENT CorrelationLocation = PreMonitor_nD(comp = CorrelationMonitor)
356+
USERVARS \%{
357+
double x_in;
358+
double xdiv_in;
359+
\%}
360+
361+
TRACE
362+
363+
COMPONENT CorrelationLocation = Arm()
360364
AT (...)
365+
EXTEND \%{
366+
x_in=x;
367+
// Calculate divergence wrt. z
368+
xdiv_in = RAD2DEG * atan2 (vx, vz);
369+
\%}
361370

362371
(... e.g. a guide system )
363372

364-
COMPONENT CorrelationMonitor = Monitor_nD(
365-
options="x dx, auto, all bins=30, premonitor")
373+
COMPONENT CorrelationMonitor = Monitor_nD(
374+
user1=''x_in'', user2=''xdiv_in'',
375+
username1=''Upstream pos'', username2=''Upstream div''
376+
options="user1 user2, auto, all bins=30")
366377
AT (...)
367378
\end{lstlisting}
368-
which performs the same monitoring as the previous example, but with a spatial correlation constrain. Indeed, it records the position \textit{vs} the divergence of neutrons at the correlation location, but only if they reach the monitoring position. All usual Monitor\_nD variables may be used, except the user variables. These latter may be defined as described in section \ref{s:monnd:user} in an EXTEND block.
379+
which performs the same monitoring as the previous example, but with a spatial correlation constrain. Indeed, it records the position \textit{vs} the divergence of neutrons at the correlation location, but only if they reach the monitoring position.

docs/manuals/mcxtrace/comp_abstract.tex

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ \section{A short overview of the \MCX\ component library}
138138
% covers the whole cylinder (360 degrees). \\
139139
%PSDlin\_monitor & Rectangular 1D PSD, measuring intensity vs.
140140
% vertical position, x. \\
141-
PreMonitor\_nD & This component is a PreMonitor that is to be
142-
used with one Monitor\_nD,
143-
in order to record some photon parameter correlations. \\
144141
TOFLambda\_monitor & Time-of-flight vs. wavelength monitor. \\
145142
%TOF\_cylPSD\_monitor & Cylindrical (2pi) PSD Time-of-flight monitor. \\
146143
TOF\_monitor & Rectangular Time-of-flight monitor. \\

docs/manuals/mcxtrace/monitors/PreMonitor_nD.tex

Lines changed: 0 additions & 41 deletions
This file was deleted.

docs/manuals/mcxtrace/monitors/monitors.tex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,3 @@ \chapter{Monitors and detectors}
6363

6464
\newpage
6565
\input{monitors/Monitor_nD}
66-
\input{monitors/PreMonitor_nD}

docs/manuals/mcxtrace/monitors/mxdoc_index

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ EPSD_monitor
33
L_monitor
44
Monitor
55
Monitor_nD
6-
PreMonitor_nD
76
PSD_monitor_4PI
87
PSD_monitor_coh
98
PSD_monitor

0 commit comments

Comments
 (0)