<?xml version="1.0"?>
<Project>
<Beams type="prop">
	<None type="flat"></None>
	<GSourceBeamGlobal type="flat"></GSourceBeamGlobal>
	<LaminarGratingBeamGlobal type="flat"></LaminarGratingBeamGlobal>
	<LaminarGratingBeamLocal type="flat"></LaminarGratingBeamLocal>
	<LGScreenBeamLocal type="flat"></LGScreenBeamLocal>
	<SphericalGratingBeamGlobal type="flat"></SphericalGratingBeamGlobal>
	<SphericalGratingBeamLocal type="flat"></SphericalGratingBeamLocal>
	<SGScreenBeamLocal type="flat"></SGScreenBeamLocal>
</Beams>
<Materials type="prop">
	<Si type="value">
		<properties type="prop">
			<elements type="param">Si</elements>
			<quantities type="param">None</quantities>
			<kind type="param">grating</kind>
			<rho type="param">2.3</rho>
			<t type="param">None</t>
			<table type="param">Chantler total</table>
			<efficiency type="param">None</efficiency>
			<efficiencyFile type="param">None</efficiencyFile>
			<name type="param">None</name>
		</properties>
		<_object type="object">xrt.backends.raycing.materials.Material</_object>
	</Si>
</Materials>
<beamLine type="value">
	<properties type="prop">
		<azimuth type="param">0.0</azimuth>
		<height type="param">0.0</height>
		<alignE type="param">9000.0</alignE>
	</properties>
	<_object type="object">xrt.backends.raycing.BeamLine</_object>
	<GSource type="value">
		<properties type="prop">
			<bl type="param">beamLine</bl>
			<name type="param">None</name>
			<center type="param">(0, 0, 0)</center>
			<pitch type="param">0</pitch>
			<yaw type="param">0</yaw>
			<nrays type="param">100000</nrays>
			<distx type="param">normal</distx>
			<dx type="param">0.32</dx>
			<disty type="param">None</disty>
			<dy type="param">0</dy>
			<distz type="param">normal</distz>
			<dz type="param">0.018</dz>
			<distxprime type="param">normal</distxprime>
			<dxprime type="param">0.001</dxprime>
			<distzprime type="param">normal</distzprime>
			<dzprime type="param">0.0001</dzprime>
			<distE type="param">flat</distE>
			<energies type="param">(1000.0, 10000)</energies>
			<polarization type="param">horizontal</polarization>
			<filamentBeam type="param">False</filamentBeam>
			<uniformRayDensity type="param">False</uniformRayDensity>
		</properties>
		<_object type="object">xrt.backends.raycing.sources.GeometricSource</_object>
		<shine type="prop">
			<parameters type="prop">
				<toGlobal type="param">True</toGlobal>
				<withAmplitudes type="param">False</withAmplitudes>
				<accuBeam type="param">None</accuBeam>
			</parameters>
			<_object type="object">xrt.backends.raycing.sources.GeometricSource.shine</_object>
			<output type="prop">
				<beamGlobal type="param">GSourceBeamGlobal</beamGlobal>
			</output>
		</shine>
	</GSource>
	<LaminarGrating type="value">
		<properties type="prop">
			<bl type="param">beamLine</bl>
			<name type="param">None</name>
			<center type="param">[0, 1000, 0]</center>
			<pitch type="param">1deg</pitch>
			<roll type="param">0</roll>
			<yaw type="param">0</yaw>
			<positionRoll type="param">0</positionRoll>
			<extraPitch type="param">0</extraPitch>
			<extraRoll type="param">0</extraRoll>
			<extraYaw type="param">0</extraYaw>
			<rotationSequence type="param">RzRyRx</rotationSequence>
			<extraRotationSequence type="param">RzRyRx</extraRotationSequence>
			<surface type="param">None</surface>
			<material type="param">Si</material>
			<alpha type="param">None</alpha>
			<limPhysX type="param">[-1000.0, 1000.0]</limPhysX>
			<limOptX type="param">None</limOptX>
			<limPhysY type="param">[-1000.0, 1000.0]</limPhysY>
			<limOptY type="param">None</limOptY>
			<isParametric type="param">False</isParametric>
			<shape type="param">rect</shape>
			<gratingDensity type="param">['y', 300, 1, 0 ,0]</gratingDensity>
			<order type="param">np.linspace(-2, 2, 5)</order>
			<shouldCheckCenter type="param">False</shouldCheckCenter>
			<alarmLevel type="param">None</alarmLevel>
			<targetOpenCL type="param">None</targetOpenCL>
			<precisionOpenCL type="param">float64</precisionOpenCL>
		</properties>
		<_object type="object">xrt.backends.raycing.oes.OE</_object>
		<reflect type="prop">
			<parameters type="prop">
				<beam type="param">GSourceBeamGlobal</beam>
				<needLocal type="param">True</needLocal>
				<noIntersectionSearch type="param">False</noIntersectionSearch>
				<returnLocalAbsorbed type="param">None</returnLocalAbsorbed>
			</parameters>
			<_object type="object">xrt.backends.raycing.oes.OE.reflect</_object>
			<output type="prop">
				<beamGlobal type="param">LaminarGratingBeamGlobal</beamGlobal>
				<beamLocal type="param">LaminarGratingBeamLocal</beamLocal>
			</output>
		</reflect>
	</LaminarGrating>
	<LGScreen type="value">
		<properties type="prop">
			<bl type="param">beamLine</bl>
			<name type="param">None</name>
			<center type="param">[0, 2000, auto]</center>
			<x type="param">auto</x>
			<z type="param">auto</z>
			<compressX type="param">None</compressX>
			<compressZ type="param">None</compressZ>
		</properties>
		<_object type="object">xrt.backends.raycing.screens.Screen</_object>
		<expose type="prop">
			<parameters type="prop">
				<beam type="param">LaminarGratingBeamGlobal</beam>
			</parameters>
			<_object type="object">xrt.backends.raycing.screens.Screen.expose</_object>
			<output type="prop">
				<beamLocal type="param">LGScreenBeamLocal</beamLocal>
			</output>
		</expose>
	</LGScreen>
	<SphericalGrating type="value">
		<properties type="prop">
			<bl type="param">beamLine</bl>
			<name type="param">None</name>
			<center type="param">[0, 3000, 0]</center>
			<pitch type="param">1 deg</pitch>
			<roll type="param">0</roll>
			<yaw type="param">0</yaw>
			<positionRoll type="param">0</positionRoll>
			<extraPitch type="param">0</extraPitch>
			<extraRoll type="param">0</extraRoll>
			<extraYaw type="param">0</extraYaw>
			<rotationSequence type="param">RzRyRx</rotationSequence>
			<extraRotationSequence type="param">RzRyRx</extraRotationSequence>
			<surface type="param">None</surface>
			<material type="param">Si</material>
			<alpha type="param">None</alpha>
			<limPhysX type="param">[-15.0, 15.0]</limPhysX>
			<limOptX type="param">None</limOptX>
			<limPhysY type="param">[-25.0, 50.0]</limPhysY>
			<limOptY type="param">None</limOptY>
			<isParametric type="param">False</isParametric>
			<shape type="param">rect</shape>
			<gratingDensity type="param">['y', 1200, 1, 0 ,0]</gratingDensity>
			<order type="param">np.linspace(-2, 2, 5)</order>
			<shouldCheckCenter type="param">False</shouldCheckCenter>
			<R type="param">10000</R>
			<r type="param">1000</r>
			<alarmLevel type="param">None</alarmLevel>
			<targetOpenCL type="param">None</targetOpenCL>
			<precisionOpenCL type="param">float64</precisionOpenCL>
		</properties>
		<_object type="object">xrt.backends.raycing.oes.ToroidMirror</_object>
		<reflect type="prop">
			<parameters type="prop">
				<beam type="param">GSourceBeamGlobal</beam>
				<needLocal type="param">True</needLocal>
				<noIntersectionSearch type="param">False</noIntersectionSearch>
				<returnLocalAbsorbed type="param">None</returnLocalAbsorbed>
			</parameters>
			<_object type="object">xrt.backends.raycing.oes.ToroidMirror.reflect</_object>
			<output type="prop">
				<beamGlobal type="param">SphericalGratingBeamGlobal</beamGlobal>
				<beamLocal type="param">SphericalGratingBeamLocal</beamLocal>
			</output>
		</reflect>
	</SphericalGrating>
	<SGScreen type="value">
		<properties type="prop">
			<bl type="param">beamLine</bl>
			<name type="param">None</name>
			<center type="param">[0, 5000, 0]</center>
			<x type="param">auto</x>
			<z type="param">auto</z>
			<compressX type="param">None</compressX>
			<compressZ type="param">None</compressZ>
		</properties>
		<_object type="object">xrt.backends.raycing.screens.Screen</_object>
		<expose type="prop">
			<parameters type="prop">
				<beam type="param">SphericalGratingBeamGlobal</beam>
			</parameters>
			<_object type="object">xrt.backends.raycing.screens.Screen.expose</_object>
			<output type="prop">
				<beamLocal type="param">SGScreenBeamLocal</beamLocal>
			</output>
		</expose>
	</SGScreen>
</beamLine>
<plots type="value">
</plots>
<run_ray_tracing type="prop">
	<_object type="object">xrt.runner.run_ray_tracing</_object>
	<plots type="param">plots</plots>
	<repeats type="param">1</repeats>
	<updateEvery type="param">1</updateEvery>
	<pickleEvery type="param">None</pickleEvery>
	<energyRange type="param">None</energyRange>
	<backend type="param">raycing</backend>
	<beamLine type="param">beamLine</beamLine>
	<threads type="param">1</threads>
	<processes type="param">1</processes>
	<generator type="param">None</generator>
	<generatorArgs type="param">[]</generatorArgs>
	<generatorKWargs type="param">auto</generatorKWargs>
	<globalNorm type="param">0</globalNorm>
	<afterScript type="param">None</afterScript>
	<afterScriptArgs type="param">[]</afterScriptArgs>
	<afterScriptKWargs type="param">{}</afterScriptKWargs>
</run_ray_tracing>
<description>Grating diffraction in rays
________

In this example we demonstrate how to define Gratings, that perform energy dispersion in rays (no efficiency calculation).

.. imagezoom:: _images/exp02_glow.png
   :scale: 10%

Two gratings recieve the same beam from the Geometrical Source.
Both set to 1 degree pitch angle.

1) See the *pitch* definition in degrees.
2) Set realistic physical size for curved elements, otherwise the beam can be blocked by the front surface.
3) Set the grating density, in this case the spacing is constant.
4) Specify the orders of diffraction to consider.


.. imagezoom:: _images/exp02_p01.png
   :scale: 60%

Material properties can only be regarded as mirror reflection. Material kind is set to "grating" in this example, but stay "auto" as well, since the material kind will be set to "grating" automatically in the presence of valid *gratingDensity* property.


.. imagezoom:: _images/exp02_p02.png
   :scale: 60%

</description>
</Project>
