Skip to content

Commit

Permalink
Merge branch 'master' of github.com:iaxo/iaxo-geometry
Browse files Browse the repository at this point in the history
* 'master' of github.com:iaxo/iaxo-geometry:
  add xenon material, fix typo
  • Loading branch information
lobis committed Aug 19, 2023
2 parents 121e81b + 7a1472e commit 142128a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
9 changes: 7 additions & 2 deletions generator/src/main/kotlin/BabyIAXO/Chamber.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package BabyIAXO

import Geometry
import Materials

import space.kscience.gdml.*

open class Chamber : Geometry() {
open class Chamber(
val useXenon: Boolean = false,
) : Geometry() {
companion object Parameters {
// Body
const val Height: Double = 30.0
Expand Down Expand Up @@ -184,7 +187,9 @@ open class Chamber : Geometry() {
gdml.solids.subtraction(gasSolidAux, cathodeWindowSolid, "gasSolid") {
position(z = Height / 2 - CathodeWindowThickness / 2) { unit = LUnit.MM }
}
val gasVolume = gdml.structure.volume(Materials.Gas.ref, gasSolid, "gasVolume")
val gasMaterialRef = if (useXenon) Materials.GasXenon.ref else Materials.GasArgon.ref

val gasVolume = gdml.structure.volume(gasMaterialRef, gasSolid, "gasVolume")

return@lazy gdml.structure.assembly {
name = "Chamber"
Expand Down
4 changes: 3 additions & 1 deletion generator/src/main/kotlin/BabyIAXO/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ private const val worldSizeZ = 1450.0

fun completeGeometry(
vetoSystem: VetoSystem = VetoSystem(),
useXenon: Boolean = false,
): Gdml {
return Gdml {
loadMaterialsFromUrl(materialsUrl) /* This adds all materials form the URL (we do not need them all) */

val chamberVolume = Chamber().generate(this)
val chamberVolume = Chamber(useXenon = useXenon).generate(this)
val detectorPipeVolume = DetectorPipe().generate(this)
val shieldingVolume = Shielding().generate(this)
val vetoSystemVolume = vetoSystem.generate(this)
Expand All @@ -38,6 +39,7 @@ fun completeGeometry(

val geometries = mapOf(
"Default" to completeGeometry(),
"DefaultXenon" to completeGeometry(useXenon = true),
"CompleteVeto1Layers" to completeGeometry(vetoSystem = VetoSystem(numberOfLayers = 1)),
"CompleteVeto2Layers" to completeGeometry(vetoSystem = VetoSystem(numberOfLayers = 2)),
"CompleteVeto3Layers" to completeGeometry(vetoSystem = VetoSystem(numberOfLayers = 3)),
Expand Down
1 change: 1 addition & 0 deletions generator/src/main/kotlin/IAXO-D1/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ fun completeGeometry(

val geometries = mapOf(
"Default" to completeGeometry(),
"DefaultXenon" to BabyIAXO.completeGeometry(useXenon = true),
"CompleteVeto1Layers" to completeGeometry(vetoSystem = VetoSystem(numberOfLayers = 1)),
"CompleteVeto2Layers" to completeGeometry(vetoSystem = VetoSystem(numberOfLayers = 2)),
"CompleteVeto3Layers" to completeGeometry(vetoSystem = VetoSystem(numberOfLayers = 3)),
Expand Down
2 changes: 1 addition & 1 deletion generator/src/main/kotlin/IAXO-D1/VetoSystem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class VetoLayerFront(private val numberOfLayers: Int = 3) : Geometry() {
val vetoLayerVolume: GdmlRef<GdmlAssembly> by lazy {
return@lazy gdml.structure.assembly {
for (i in 1..numberOfLayers) {
physVolume(vetoLayer, name = "vetoLayerBack$i") {
physVolume(vetoLayer, name = "vetoLayerFront$i") {
position(
z = (Veto.FullThickness + 20) * (i - 1)
) { unit = LUnit.MM }
Expand Down
2 changes: 1 addition & 1 deletion generator/src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fun main() {

for ((name, gdml) in geometries) {
File("$outputDirectoryName/$geometryName/$name.gdml")
.writeText(gdml.removeUnusedMaterials().encodeToString())
.writeText(gdml.encodeToString()) // do not use removeUnusedMaterials() here
}
}
}
3 changes: 2 additions & 1 deletion generator/src/main/kotlin/Materials.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ fun resolveMaterialByRef(material: Materials): GdmlMaterial {

enum class Materials(val ref: GdmlRef<GdmlMaterial>) {
Air(resolve("G4_AIR")),
Gas(resolve("GasMixture-Argon2%Isobutane1.4Bar")),
GasArgon(resolve("GasMixture-Argon2%Isobutane1.4Bar")),
GasXenon(resolve("GasMixture-XenonNeon2.3%Isobutane1.05Bar")),
Vacuum(resolve("G4_Galactic")),
Copper(resolve("G4_Cu")),
Teflon(resolve("G4_TEFLON")),
Expand Down

0 comments on commit 142128a

Please sign in to comment.