JuliaPhysics / SolidStateDetectors.jl

Solid state detector field and charge drift simulation in Julia
Other
82 stars 32 forks source link

Geometry plotting #92

Closed leenderthayen closed 3 years ago

leenderthayen commented 4 years ago

Hello everyone,

I was wondering whether it's possible to add the plotting of the full geometry rather than just the contacts. We want to implement a somewhat more involved geometry and debugging correct positions is quite tricky without visualization or boundary checking methods. I assume defining everything as a contact for debugging would be considered bad practice, but something like that would be of great help.

Thanks!

lmh91 commented 4 years ago

This is possible. Though, not in one line. We went for only plotting the positive primitives of all contacts for reasons of clarity.

All Primitives are stored in your SolidStateDetector-object (sim.detector). The SolidStateDetector struct has the fields semiconductors, contacts and passives (and virtual_drift_volumes). These are vectors of objects of type Semiconductor, Contact and Passive. These all have fields geometry. But also two fields, geometry_positive and geometry_negative, which are vectors of primitive which you can be plotted via our recipes.

fhagemann commented 3 years ago

In our new release (v0.6.0), we also added plot recipes for all objects. However, plot(sim.detector) will still only plot contacts and not the semiconductor.

For our example detector with configuration file at SSD_examples[:CGD]:

plot(sim.detector)

det

plot(sim.detector)
plot!(sim.detector.semiconductor)

det+semiconductor

Note that geometry_positive and geometry_negative do not longer exist in the new release v0.6.0. Feel free to have a look through our updated documentation and report all kinds of bugs that you might find! ;)