Commit 9d05a14f authored by Tobias Bisanz's avatar Tobias Bisanz
Browse files

Allows to set visualisation viewpoint angles from config

parent 61aa05f5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ This module requires an installation of Geant4.
* `macro_init` : Optional Geant4 macro to execute during initialization. Whenever possible, the configuration parameters above should be used instead of this option.
* `display_limit` : Sets the `displayListLimit` of the visualization GUI, in case the geometry which has to be loaded is too complex for the GUI to be displayed with the current size Display List. Defaults to 1000000.
* `line_segments` : Sets the number of line segments to approximate a circle with. This parameter can be used when simulating radial detectors to visualize their curved edges with more precision. Defaults to 250.
* `viewpoint_thetaphi` : Sets the theta and phi angles for the viewpoint. Defaults to -70deg 20deg.

## Usage
An example configuration providing a wireframe viewing style with the same color for every particle and displaying the result after every event for 2s is provided below:
+5 −2
Original line number Diff line number Diff line
@@ -56,7 +56,6 @@ VisualizationGeant4Module::VisualizationGeant4Module(Configuration& config, Mess
    // Set to accumulate all hits and display at the end by default
    config_.setDefault("accumulate", true);
    config_.setDefault("simple_view", true);

    mode_ = config_.get<ViewingMode>("mode");
}
/**
@@ -282,7 +281,11 @@ void VisualizationGeant4Module::set_visualization_settings() {
    }

    // Set default viewer orientation
    UI->ApplyCommand("/vis/viewer/set/viewpointThetaPhi -70 20");
    auto viewpoint_angles =
        config_.getArray<double>("viewpoint_thetaphi", {Units::get<double>(-70, "deg"), Units::get<double>(20, "deg")});
    auto viewpoint_cmd = "/vis/viewer/set/viewpointThetaPhi " + std::to_string(Units::convert(viewpoint_angles[0], "deg")) +
                         " " + std::to_string(Units::convert(viewpoint_angles[1], "deg"));
    UI->ApplyCommand(viewpoint_cmd);

    // Do auto refresh if not accumulating and start viewer already
    if(!accumulate) {