diff --git a/src/Vts/MonteCarlo/Detectors/dMCdROfRhodMuaDetector.cs b/src/Vts/MonteCarlo/Detectors/dMCdROfRhodMuaDetector.cs
index 80717038..04a99d14 100644
--- a/src/Vts/MonteCarlo/Detectors/dMCdROfRhodMuaDetector.cs
+++ b/src/Vts/MonteCarlo/Detectors/dMCdROfRhodMuaDetector.cs
@@ -155,16 +155,15 @@ public void Initialize(ITissue tissue, Random rng)
/// absorption weighting type
protected void SetAbsorbAction(AbsorptionWeightingType awt)
{
- // AbsorptionWeightingType.Analog cannot have derivatives so not a case
- switch (awt)
+ // AbsorptionWeightingType.Analog cannot have derivatives so exception
+ _absorbAction = awt switch
{
// note: pMC is not applied to analog processing, only DAW and CAW
- case AbsorptionWeightingType.Continuous:
- case AbsorptionWeightingType.Discrete:
- default:
- _absorbAction = AbsorbContinuousOrDiscrete;
- break;
- }
+ AbsorptionWeightingType.Continuous => AbsorbContinuousOrDiscrete,
+ AbsorptionWeightingType.Discrete => AbsorbContinuousOrDiscrete,
+ AbsorptionWeightingType.Analog => throw new ArgumentException(@"Analog is not allowed with this detector", nameof(awt)),
+ _ => throw new ArgumentOutOfRangeException(typeof(AbsorptionWeightingType).ToString())
+ };
}
///
diff --git a/src/Vts/MonteCarlo/Detectors/dMCdROfRhodMusDetector.cs b/src/Vts/MonteCarlo/Detectors/dMCdROfRhodMusDetector.cs
index 05e2404e..8f14c7cd 100644
--- a/src/Vts/MonteCarlo/Detectors/dMCdROfRhodMusDetector.cs
+++ b/src/Vts/MonteCarlo/Detectors/dMCdROfRhodMusDetector.cs
@@ -154,16 +154,15 @@ public void Initialize(ITissue tissue, Random rng)
/// absorption weighting type
protected void SetAbsorbAction(AbsorptionWeightingType awt)
{
- // AbsorptionWeightingType.Analog cannot have derivatives so not a case
- switch (awt)
+ // AbsorptionWeightingType.Analog cannot have derivatives so exception
+ _absorbAction = awt switch
{
// note: pMC is not applied to analog processing, only DAW and CAW
- case AbsorptionWeightingType.Continuous:
- case AbsorptionWeightingType.Discrete:
- default:
- _absorbAction = AbsorbContinuousOrDiscrete;
- break;
- }
+ AbsorptionWeightingType.Continuous => AbsorbContinuousOrDiscrete,
+ AbsorptionWeightingType.Discrete => AbsorbContinuousOrDiscrete,
+ AbsorptionWeightingType.Analog => throw new ArgumentException(@"Analog is not allowed with this detector", nameof(awt)),
+ _ => throw new ArgumentOutOfRangeException(typeof(AbsorptionWeightingType).ToString())
+ };
}
///