@@ -8,6 +8,11 @@ void checkEnergyDistribution(const Rays& rays, double photonEnergy, double energ
88 for (const auto energy : rays.energy ) { CHECK_IN (energy, photonEnergy - energySpread, photonEnergy + energySpread); }
99}
1010
11+ void checkEnergyDistributionWindow (const Rays& rays, double minEnergy, double maxEnergy) {
12+ CHECK (rays.energy .size () > 0 );
13+ for (const auto energy : rays.energy ) { CHECK_IN (energy, minEnergy, maxEnergy); }
14+ }
15+
1116void checkZDistribution (const Rays& rays, double center, double spread) {
1217 CHECK (rays.position_z .size () > 0 );
1318 for (const auto position_z : rays.position_z ) { CHECK_IN (position_z, center - spread, center + spread); }
@@ -51,6 +56,10 @@ TEST_F(TestSuite, MatrixSourceTracedRayUI) {
5156
5257TEST_F (TestSuite, PointSourceHardEdge) { checkEnergyDistribution (traceRml (" PointSourceHardEdge" , RayAttrMask::Energy), 120.97 , 12.1 ); }
5358
59+ TEST_F (TestSuite, PointSourceHardEdgePercentUnit) {
60+ checkEnergyDistributionWindow (traceRml (" PointSourceHardEdgePercent" , RayAttrMask::Energy), 95.0 , 105.0 );
61+ }
62+
5463TEST_F (TestSuite, PointSourceSoftEdge) { checkEnergyDistribution (traceRml (" PointSourceSoftEdge" , RayAttrMask::Energy), 151 , 6 ); }
5564
5665TEST_F (TestSuite, MatrixSourceEnergyDistribution) { checkEnergyDistribution (traceRml (" PointSourceSoftEdge" , RayAttrMask::Energy), 151 , 6 ); }
@@ -61,6 +70,10 @@ TEST_F(TestSuite, DipoleSourcePosition) {
6170
6271TEST_F (TestSuite, DipoleEnergyDistribution) { checkEnergyDistribution (traceRml (" dipole_energySpread" , RayAttrMask::Energy), 1000 , 23000 ); }
6372
73+ TEST_F (TestSuite, DipoleEnergyDistributionPercentUnit) {
74+ checkEnergyDistributionWindow (traceRml (" dipole_energySpread_percent" , RayAttrMask::Energy), 950.0 , 1050.0 );
75+ }
76+
6477TEST_F (TestSuite, PixelPositionTest) {
6578 const auto [beamline, rays] =
6679 loadBeamlineAndTrace (" PixelSource" , RayAttrMask::PositionX | RayAttrMask::PositionY | RayAttrMask::DirectionX | RayAttrMask::DirectionZ);
0 commit comments