Skip to content

Conversation

@fhagemann
Copy link
Collaborator

Addressing #552: since #489, the plots for Box did not work properly (vertices were swapped and there is one line for sample surface, adding a Point to a Vector instead of a Vector to a Point).

This should work now.

import SolidStateDetectors.ConstructiveSolidGeometry as CSG
path_to_example_primitives_config_files = joinpath(dirname(dirname(pathof(SolidStateDetectors))), "examples", "example_primitive_files")
cfn = joinpath(path_to_example_primitives_config_files, "Box.yaml")
box = CSG.Geometry(T, cfn)
plot(box)
image

HOWEVER: all samplesurface plots appear empty in their default implementation, so something with auto_strokewidth or auto_markersize does not seems to work well. This still needs to be revisited.i

@fhagemann fhagemann added the bug Something isn't working label Nov 4, 2025
@fhagemann
Copy link
Collaborator Author

The latest commit to fix the Downgrade tests was needed because the newest versions of NearestNeighbors are not compatible with older versions of StaticArrays.

@fhagemann fhagemann merged commit a8518b6 into main Nov 12, 2025
10 checks passed
@fhagemann fhagemann deleted the plots branch November 12, 2025 16:29
@fhagemann
Copy link
Collaborator Author

Just to have this documented: this PR also fixed the following issue:

SolidStateDetectors.cluster_detector_hits did not work if the positions are CartesianPoint
(which is now the output of Geant4).

MWE:

using SolidStateDetectors, Geant4, Unitful
sim = Simulation{Float32}(SSD_examples[:InvertedCoax])
source = IsotopeSource(90, 228, 0.0, 0.0, CartesianPoint(0.05,0,0.05))
app = G4JLApplication(sim, source)
t = run_geant4_simulation(app, 1_000)
tc = SolidStateDetectors.cluster_detector_hits(t, 20u"μm")
ERROR: MethodError: no method matching cluster_detector_hits(::Vector{Int32}, ::Vector{Quantity{…}}, ::Vector{CartesianPoint{…}}, ::Quantity{Int64, 𝐋, Unitful.FreeUnits{…}})
The function `cluster_detector_hits` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  cluster_detector_hits(::AbstractVector{<:Integer}, ::AbstractVector{TT}, ::AbstractVector{<:StaticArraysCore.StaticArray{Tuple{3}, PT, 1}}, ::Union{Real, Unitful.AbstractQuantity{<:Real}}) where {TT<:Union{Real, Unitful.AbstractQuantity{<:Real}}, PT<:Union{Real, Unitful.AbstractQuantity{<:Real}}}
   @ SolidStateDetectors ~/Software/SolidStateDetectors.jl/src/ChargeClustering/ChargeClustering.jl:7
  cluster_detector_hits(::TypedTables.Table, ::Union{Real, Unitful.AbstractQuantity{<:Real}})
   @ SolidStateDetectors ~/Software/SolidStateDetectors.jl/src/ChargeClustering/ChargeClustering.jl:58

Stacktrace:
 [1] (::SolidStateDetectors.var"#213#214"{Quantity{…}})(evt::@NamedTuple{evtno::Int32, detno::Vector{…}, thit::Vector{…}, edep::Vector{…}, pos::Vector{…}})
   @ SolidStateDetectors ~/Software/SolidStateDetectors.jl/src/ChargeClustering/ChargeClustering.jl:63
 [2] iterate
   @ ./generator.jl:48 [inlined]
 [3] _collect
   @ ./array.jl:811 [inlined]
 [4] collect_similar
   @ ./array.jl:720 [inlined]
 [5] map
   @ ./abstractarray.jl:3371 [inlined]
 [6] cluster_detector_hits(table::TypedTables.Table{@NamedTuple{…}, 1, @NamedTuple{…}}, cluster_radius::Quantity{Int64, 𝐋, Unitful.FreeUnits{…}})
   @ SolidStateDetectors ~/Software/SolidStateDetectors.jl/src/ChargeClustering/ChargeClustering.jl:62
 [7] top-level scope
   @ REPL[7]:1
Some type information was truncated. Use `show(err)` to see complete types.

This is fixed now.

@fhagemann fhagemann linked an issue Nov 20, 2025 that may be closed by this pull request
@fhagemann fhagemann added this to the v0.11.0 milestone Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Operations with CartesianPoints not supported and causing errors

3 participants