Commit 61f62570 authored by Radek Privara's avatar Radek Privara
Browse files

VisG4: Interpret transparency as opacity using setAlias

parent 1fc8488d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -422,8 +422,8 @@ An example configuration with some useful parameters is given below:
# Use the Qt gui
mode = "gui"

# Set transparency of the detector models (in percent)
transparency = 0.4
# Set opacity of the detector models (in percent)
opacity = 0.4
# Set viewing style (alternative is 'wireframe')
view_style = "surface"

+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ This module requires an installation of Geant4.
* `simple_view` : Determines if the visualization should be simplified, not displaying the pixel matrix and other parts which are replicated multiple times. Default value is true. This parameter should normally not be changed as it will cause a considerable slowdown of the visualization for a sensor with a typical number of channels.
* `background_color` : Color of the background of the viewer. Defaults to *white*.
* `view_style` : Style to use to display the elements in the geometry. Options are **wireframe** and **surface**. By default, all elements are displayed as solid surface.
* `transparency` : Default transparency percentage of all detector elements, only used if the *view_style* is set to display solid surfaces. The default value is 0.4, giving a moderate amount of transparency.
* `opacity` : Default opacity percentage of all detector elements, only used if the *view_style* is set to display solid surfaces. The default value is 0.4, giving a moderate amount of opacity.
* `display_trajectories` : Determines if the trajectories of the primary and secondary particles should be displayed. Defaults to *true*.
* `hidden_trajectories` : Determines if the trajectories should be hidden inside the detectors. Only used if the *display_trajectories* is enabled. Default value of the parameter is true.
* `trajectories_color_mode` : Configures the way, trajectories are colored. Options are either **generic** which colors all trajectories in the same way, **charge** which bases the color on the particle's charge, or **particle** which colors the trajectory based on the type of the particle. The default setting is *charge*.
+7 −4
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@ using namespace allpix;

VisualizationGeant4Module::VisualizationGeant4Module(Configuration& config, Messenger*, GeometryManager* geo_manager)
    : Module(config), geo_manager_(geo_manager), has_run_(false), session_param_ptr_(nullptr) {
    // Interpret transparency parameter as opacity for backwards-compatibility
    config_.setAlias("opacity", "transparency", 1);

    // Set default mode and driver for display
    config_.setDefault("mode", "gui");
    config_.setDefault("driver", "OGL");
@@ -300,11 +303,11 @@ void VisualizationGeant4Module::set_visualization_settings() {
 * - Sensor: Blackish
 */
void VisualizationGeant4Module::set_visualization_attributes() {
    // To add some transparency in the solids, set to 0.4. 0 means opaque.
    // Transparency can be switched off in the visualisation.
    auto alpha = 1 - config_.get<double>("transparency", 0.4);
    // To add some opacity in the solids, set to 0.4. 1 means fully opaque.
    // Opacity can be switched off in the visualisation.
    auto alpha = config_.get<double>("opacity", 0.4);
    if(alpha <= 0 || alpha > 1) {
        throw InvalidValueError(config_, "transparency", "transparency level should be between 0 and 1");
        throw InvalidValueError(config_, "opacity", "opacity level should be between 0 and 1");
    }

    // Wrapper