From 914740a5077cfa4f0e1ec2fecf6c56c45667a6e9 Mon Sep 17 00:00:00 2001 From: Luis Antonio Obis Aparicio Date: Mon, 7 Oct 2024 00:04:45 +0200 Subject: [PATCH] neutron shielding --- .../main/kotlin/BabyIAXO/ShieldingNeutrons.kt | 185 +++++++++--------- 1 file changed, 96 insertions(+), 89 deletions(-) diff --git a/generator/src/main/kotlin/BabyIAXO/ShieldingNeutrons.kt b/generator/src/main/kotlin/BabyIAXO/ShieldingNeutrons.kt index 8fcfd43..2ea180b 100644 --- a/generator/src/main/kotlin/BabyIAXO/ShieldingNeutrons.kt +++ b/generator/src/main/kotlin/BabyIAXO/ShieldingNeutrons.kt @@ -5,14 +5,17 @@ import Geometry import space.kscience.gdml.* open class ShieldingNeutrons( - open val copperBox: Boolean = true, + open val innerVetoes: Boolean = false, ) : Geometry() { companion object Parameters { const val vetoOuterThickness: Double = 100.0 const val vetoInnerThickness: Double = 50.0 + const val vetoInnerSpacing = 50.0 + const val shieldingThicknessBase: Double = 200.0 + + const val shieldingThickness: Double = shieldingThicknessBase + vetoInnerThickness - const val shieldingThickness: Double = 200.0 + vetoInnerThickness const val chamberHoleXY: Double = 200.0 const val chamberHoleZ: Double = 150.0 @@ -29,8 +32,7 @@ open class ShieldingNeutrons( const val OffsetZ: Double = DetectorToShieldingSeparation + Chamber.Height / 2 + Chamber.ReadoutKaptonThickness + Chamber.BackplateThickness - val vetoInnerSpacing = 50.0 - val vetoInnerLength = shieldingThickness + chamberHoleZ + vetoInnerSpacing + const val vetoInnerLength = shieldingThickness + chamberHoleZ + vetoInnerSpacing } override fun generate(gdml: Gdml): GdmlRef { @@ -108,59 +110,63 @@ open class ShieldingNeutrons( position(z = SizeZ / 2 - ShaftLongSide / 2) { unit = LUnit.MM } } - val leadShieldingVolumeHoleInnerVetoes1 = - gdml.solids.subtraction( - leadBoxWithShaftSolid, - vetoInnerBoxLateralSolid, - "leadShieldingVolumeHoleInnerVetoes1" - ) { - position( - y = vetoInnerThickness / 2 + chamberHoleXY / 2 + vetoInnerSpacing, - x = vetoInnerThickness / 2, - z = -vetoInnerLength / 2 + SizeZ / 2 - ) { unit = LUnit.MM } - } - val leadShieldingVolumeHoleInnerVetoes2 = - gdml.solids.subtraction( - leadShieldingVolumeHoleInnerVetoes1, - vetoInnerBoxLateralSolid, - "leadShieldingVolumeHoleInnerVetoes2" - ) { - position( - y = -vetoInnerThickness / 2 - chamberHoleXY / 2 - vetoInnerSpacing, - x = -vetoInnerThickness / 2, - z = -vetoInnerLength / 2 + SizeZ / 2 - ) { unit = LUnit.MM } - } - val leadShieldingVolumeHoleInnerVetoes3 = - gdml.solids.subtraction( - leadShieldingVolumeHoleInnerVetoes2, - vetoInnerBoxLateralSolid, - "leadShieldingVolumeHoleInnerVetoes3" - ) { - rotation(z = 90.0) { unit = AUnit.DEGREE } - position( - x = -vetoInnerThickness / 2 - chamberHoleXY / 2 - vetoInnerSpacing, - y = vetoInnerThickness / 2, - z = -vetoInnerLength / 2 + SizeZ / 2 - ) { unit = LUnit.MM } - } - val leadShieldingVolumeHoleInnerVetoes4 = - gdml.solids.subtraction( - leadShieldingVolumeHoleInnerVetoes3, - vetoInnerBoxLateralSolid, - "leadShieldingVolumeHoleInnerVetoes4" - ) { - rotation(z = 90.0) { unit = AUnit.DEGREE } - position( - x = vetoInnerThickness / 2 + chamberHoleXY / 2 + vetoInnerSpacing, - y = -vetoInnerThickness / 2, - z = -vetoInnerLength / 2 + SizeZ / 2 - ) { unit = LUnit.MM } - } - val leadShieldingVolume = + val leadShieldingVolume = if (innerVetoes) { + val leadShieldingVolumeHoleInnerVetoes1 = + gdml.solids.subtraction( + leadBoxWithShaftSolid, + vetoInnerBoxLateralSolid, + "leadShieldingVolumeHoleInnerVetoes1" + ) { + position( + y = vetoInnerThickness / 2 + chamberHoleXY / 2 + vetoInnerSpacing, + x = vetoInnerThickness / 2, + z = -vetoInnerLength / 2 + SizeZ / 2 + ) { unit = LUnit.MM } + } + val leadShieldingVolumeHoleInnerVetoes2 = + gdml.solids.subtraction( + leadShieldingVolumeHoleInnerVetoes1, + vetoInnerBoxLateralSolid, + "leadShieldingVolumeHoleInnerVetoes2" + ) { + position( + y = -vetoInnerThickness / 2 - chamberHoleXY / 2 - vetoInnerSpacing, + x = -vetoInnerThickness / 2, + z = -vetoInnerLength / 2 + SizeZ / 2 + ) { unit = LUnit.MM } + } + val leadShieldingVolumeHoleInnerVetoes3 = + gdml.solids.subtraction( + leadShieldingVolumeHoleInnerVetoes2, + vetoInnerBoxLateralSolid, + "leadShieldingVolumeHoleInnerVetoes3" + ) { + rotation(z = 90.0) { unit = AUnit.DEGREE } + position( + x = -vetoInnerThickness / 2 - chamberHoleXY / 2 - vetoInnerSpacing, + y = vetoInnerThickness / 2, + z = -vetoInnerLength / 2 + SizeZ / 2 + ) { unit = LUnit.MM } + } + val leadShieldingVolumeHoleInnerVetoes4 = + gdml.solids.subtraction( + leadShieldingVolumeHoleInnerVetoes3, + vetoInnerBoxLateralSolid, + "leadShieldingVolumeHoleInnerVetoes4" + ) { + rotation(z = 90.0) { unit = AUnit.DEGREE } + position( + x = vetoInnerThickness / 2 + chamberHoleXY / 2 + vetoInnerSpacing, + y = -vetoInnerThickness / 2, + z = -vetoInnerLength / 2 + SizeZ / 2 + ) { unit = LUnit.MM } + } + gdml.structure.volume(Materials.Lead.ref, leadShieldingVolumeHoleInnerVetoes4, "shieldingVolume") + } else { + gdml.structure.volume(Materials.Lead.ref, leadBoxWithShaftSolid, "shieldingVolume") + } return@lazy gdml.structure.assembly { name = "shielding" @@ -213,43 +219,44 @@ open class ShieldingNeutrons( } } - // inner veto - physVolume(vetoInnerBoxLateralVolume, name = "vetoInnerTop") { - position( - y = vetoInnerThickness / 2 + chamberHoleXY / 2 + vetoInnerSpacing, - x = vetoInnerThickness / 2, - z = -OffsetZ - vetoInnerLength / 2 + SizeZ / 2 - ) { - unit = LUnit.MM + if (innerVetoes) { + physVolume(vetoInnerBoxLateralVolume, name = "vetoInnerTop") { + position( + y = vetoInnerThickness / 2 + chamberHoleXY / 2 + vetoInnerSpacing, + x = vetoInnerThickness / 2, + z = -OffsetZ - vetoInnerLength / 2 + SizeZ / 2 + ) { + unit = LUnit.MM + } } - } - physVolume(vetoInnerBoxLateralVolume, name = "vetoInnerBottom") { - position( - y = -vetoInnerThickness / 2 - chamberHoleXY / 2 - vetoInnerSpacing, - x = -vetoInnerThickness / 2, - z = -OffsetZ - vetoInnerLength / 2 + SizeZ / 2 - ) { - unit = LUnit.MM + physVolume(vetoInnerBoxLateralVolume, name = "vetoInnerBottom") { + position( + y = -vetoInnerThickness / 2 - chamberHoleXY / 2 - vetoInnerSpacing, + x = -vetoInnerThickness / 2, + z = -OffsetZ - vetoInnerLength / 2 + SizeZ / 2 + ) { + unit = LUnit.MM + } } - } - physVolume(vetoInnerBoxLateralVolume, name = "vetoInnerRight") { - rotation(z = 90.0) { unit = AUnit.DEGREE } - position( - x = -vetoInnerThickness / 2 - chamberHoleXY / 2 - vetoInnerSpacing, - y = vetoInnerThickness / 2, - z = -OffsetZ - vetoInnerLength / 2 + SizeZ / 2 - ) { - unit = LUnit.MM + physVolume(vetoInnerBoxLateralVolume, name = "vetoInnerRight") { + rotation(z = 90.0) { unit = AUnit.DEGREE } + position( + x = -vetoInnerThickness / 2 - chamberHoleXY / 2 - vetoInnerSpacing, + y = vetoInnerThickness / 2, + z = -OffsetZ - vetoInnerLength / 2 + SizeZ / 2 + ) { + unit = LUnit.MM + } } - } - physVolume(vetoInnerBoxLateralVolume, name = "vetoInnerLeft") { - rotation(z = 90.0) { unit = AUnit.DEGREE } - position( - x = vetoInnerThickness / 2 + chamberHoleXY / 2 + vetoInnerSpacing, - y = -vetoInnerThickness / 2, - z = -OffsetZ - vetoInnerLength / 2 + SizeZ / 2 - ) { - unit = LUnit.MM + physVolume(vetoInnerBoxLateralVolume, name = "vetoInnerLeft") { + rotation(z = 90.0) { unit = AUnit.DEGREE } + position( + x = vetoInnerThickness / 2 + chamberHoleXY / 2 + vetoInnerSpacing, + y = -vetoInnerThickness / 2, + z = -OffsetZ - vetoInnerLength / 2 + SizeZ / 2 + ) { + unit = LUnit.MM + } } } }