MCPL hooks in McStas
MCPL input or output from McStas is handled via two components, MCPL_input and MCPL_output, which users can activate by adding entries at relevant points in their instrument files. Please refer to the MCPL paper (section 3.3) for a more detailed discussion of these.
How to use the components
MCPL_input
In its most simple form, users can add the following lines to their instrument files in order to inject particles from an MCPL file into their instrument simulations:
COMPONENT vin = MCPL_input( filename="myfile.mcpl" )
AT(0,0,0) RELATIVE Origin
The initial position of the particles will be given by the coordinates found in the MCPL file, relative to the position of the MCPL_input component in the instrument. In the example above, the particle coordinates will thus be interpreted as being relative to the Origin component.
For further details, refer to the MCPL paper (section 3.3) and/or bring up documentation specific to the actual version of MCPL_input being used by typing:
mcdoc MCPL_input
MCPL_output
In its most simple form, users can add the following lines to their instrument files at a given point in order to capture a snapshot of particles at that point in their instrument simulations and store them in an MCPL file:
COMPONENT mcplout = MCPL_output( filename="myoutput.mcpl" )
AT(0,0,0) RELATIVE PREVIOUS
The coordinates of the stored particle will be relative to the MCPL_output
component itself. Thus, the above lines captures particles relative to the
previous component. This could for instance make sense if the previous component
was the sample component, and you need the coordinates to be written to be
relative to the sample position. If instead you need the coordinates to be
absolute, you could either specify ABSOLUTE
or the Origin
component:
COMPONENT mcplout = MCPL_output( filename="myoutput.mcpl" )
AT(0,0,0) RELATIVE ABSOLUTE
For further details, refer to the MCPL paper (section 3.3) and/or bring up documentation specific to the actual version of MCPL_output being used by typing:
mcdoc MCPL_output