Commit dfbb3ad3 authored by Tobias Bisanz's avatar Tobias Bisanz Committed by Simon Spannagel
Browse files

Allows to set visualisation viewpoint angles from config

(cherry picked from commit 9d05a14f)
parent 7d6fc57d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ This module requires an installation of Geant4.
* `draw_hits` : Determines if hits in the detector should be displayed. Defaults to false. Option is only useful if Geant4 hits are generated in a module.
* `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.
* `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
@@ -51,7 +51,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");
}
/**
@@ -277,7 +276,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) {