test: add rearwall contribution compare

This commit is contained in:
2026-01-20 13:06:01 +03:00
parent 62f9d8522b
commit 636f774177

View File

@@ -0,0 +1,108 @@
package ru.inr.mass.scripts
import kotlinx.html.br
import kotlinx.html.p
import ru.inr.mass.models.*
import ru.inr.mass.models.NBkgSpectrum.Companion.bkg
import ru.inr.mass.models.NBkgSpectrum.Companion.norm
import ru.inr.mass.models.NumassBeta.e0
import ru.inr.mass.models.NumassBeta.mnu2
import ru.inr.mass.models.NumassBeta.msterile2
import ru.inr.mass.models.NumassBeta.u2
import ru.inr.mass.models.NumassTransmission.Companion.thickness
import ru.inr.mass.models.NumassTransmission.Companion.trap
import ru.inr.mass.workspace.buffer
import space.kscience.kmath.expressions.Symbol
import space.kscience.kmath.real.step
import space.kscience.plotly.*
import space.kscience.plotly.models.ScatterMode
fun main() {
val trapInterpolator = TrapModel.FINE_5DAY
val wallInterpolator = WallModel.TSV_2025_12_01
val range = 2000.0..18600.0 step 50.0
val args: Map<Symbol, Double> = mapOf(
norm to 492346.83,
bkg to 0.0,
mnu2 to 0.0,
e0 to 18478.14,
msterile2 to 0.0,
u2 to 0.0,
thickness to 0.1,
trap to 2.1051,
rearWall to 0.00
)
val rwall1 = args.toMutableMap();
rwall1[rearWall] = 1.0
val rwall2 = args.toMutableMap();
rwall2[rearWall] = 2.0
val rwall3 = args.toMutableMap();
rwall3[rearWall] = 3.0
val spectrumC: NBkgSpectrum = CustomSterileNeutrinoSpectrum(
fss = null,
transmission = NumassTransmission(
trapFunc = { ei, ef, _ ->
val delta = ei - ef
trapInterpolator.value(ei, delta)
},
adjustX = false,
),
wallFunc = wallInterpolator,
resolution = NumassResolution(1.7e-4, tailFunction = {
e,u -> AdiabaticityModel.vasya(e,u)
})
).withNBkg()
Plotly.page {
plot {
scatter {
name = "rwall=${args[rearWall]}"
mode = ScatterMode.lines
x.buffer = range
y.numbers = x.doubles.map { spectrumC(it, args) }
}
listOf(rwall1, rwall2, rwall3).forEach { rwall ->
scatter {
name = "rwall=${rwall[rearWall]}"
mode = ScatterMode.lines
x.buffer = range
y.numbers = x.doubles.map { spectrumC(it, rwall) }
}
}
layout {
title = "Rear Wall Contribution"
// yaxis.type = AxisType.log
}
}
p {
+"command args = $args"
}
br()
p {
+"trapping model = $trapInterpolator"
}
br()
p {
+"wall model = $wallInterpolator"
}
br()
}.makeFile()
println("HV\trwall=${args[rearWall]}\trwall=${rwall1[rearWall]}\trwall=${rwall2[rearWall]}\trwall=${rwall3[rearWall]}")
range.iterator().forEach {
val r0 = spectrumC(it, args)
val r1 = spectrumC(it, rwall1)
val r2 = spectrumC(it, rwall2)
val r3 = spectrumC(it, rwall3)
println("${it}\t${spectrumC(it, args)}\t${spectrumC(it, rwall1)}\t${spectrumC(it, rwall2)}\t${spectrumC(it, rwall3)}")
}
}