From af2539eed2333cf438ab3caddb09de5cf4093b9f Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sat, 30 Sep 2023 20:13:08 +0300 Subject: [PATCH] BM@N and fixes --- .../commonMain/kotlin/ru/mipt/npm/root/BMN.kt | 3 ++ .../kotlin/{rootParser.kt => BmnDemo.kt} | 30 ++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) rename demo/playground/src/jvmMain/kotlin/{rootParser.kt => BmnDemo.kt} (64%) diff --git a/cern-root-loader/src/commonMain/kotlin/ru/mipt/npm/root/BMN.kt b/cern-root-loader/src/commonMain/kotlin/ru/mipt/npm/root/BMN.kt index 78053d1d..5ae1671c 100644 --- a/cern-root-loader/src/commonMain/kotlin/ru/mipt/npm/root/BMN.kt +++ b/cern-root-loader/src/commonMain/kotlin/ru/mipt/npm/root/BMN.kt @@ -4,6 +4,7 @@ import kotlinx.serialization.Serializable import kotlinx.serialization.builtins.ListSerializer import kotlinx.serialization.json.Json import kotlinx.serialization.json.JsonArray +import space.kscience.visionforge.solid.Float32Vector3D @Serializable @@ -16,6 +17,8 @@ public data class FairTrackParam( val fQp: Double, ) +public fun FairTrackParam.toVector(): Float32Vector3D = Float32Vector3D(fX,fY,fZ) + @Serializable public data class CbmStsTrack( val fParamFirst: FairTrackParam, diff --git a/demo/playground/src/jvmMain/kotlin/rootParser.kt b/demo/playground/src/jvmMain/kotlin/BmnDemo.kt similarity index 64% rename from demo/playground/src/jvmMain/kotlin/rootParser.kt rename to demo/playground/src/jvmMain/kotlin/BmnDemo.kt index 04aa71f7..8f38af59 100644 --- a/demo/playground/src/jvmMain/kotlin/rootParser.kt +++ b/demo/playground/src/jvmMain/kotlin/BmnDemo.kt @@ -4,16 +4,14 @@ import ru.mipt.npm.root.BMN import ru.mipt.npm.root.DGeoManager import ru.mipt.npm.root.rootGeo import ru.mipt.npm.root.serialization.TGeoManager +import ru.mipt.npm.root.toVector import space.kscience.dataforge.meta.Meta import space.kscience.dataforge.meta.get import space.kscience.dataforge.meta.isLeaf import space.kscience.dataforge.meta.string import space.kscience.visionforge.Colors import space.kscience.visionforge.html.ResourceLocation -import space.kscience.visionforge.solid.Solids -import space.kscience.visionforge.solid.ambientLight -import space.kscience.visionforge.solid.invoke -import space.kscience.visionforge.solid.solid +import space.kscience.visionforge.solid.* import java.util.zip.ZipInputStream import kotlin.io.path.Path import kotlin.io.path.writeText @@ -52,6 +50,30 @@ fun main() { rootGeo(geo,"BM@N", ignoreRootColors = true).also { Path("data/BM@N.vf.json").writeText(Solids.encodeToString(it)) } + + solidGroup("cbmStsTracks") { + events.cbmTracks.forEach { track -> + polyline( + track.fParamFirst.toVector(), + track.fParamLast.toVector() + ) { + thickness = 2.0 + color(Colors.blue) + } + } + } + + solidGroup("bmnGlobalTracks") { + events.bmnGlobalTracks.forEach { track -> + polyline( + track.fParamFirst.toVector(), + track.fParamLast.toVector() + ) { + thickness = 2.0 + color(Colors.red) + } + } + } } } }