Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ObjWriterOptions.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ObjWriterOptions.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2017-2018 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
14 
15 #include <iostream>
16 
17 namespace ActsExamples {
18 
19 namespace Options {
20 
26 void addObjWriterOptions(boost::program_options::options_description& opt) {
27  namespace po = boost::program_options;
28  opt.add_options()("obj-precision", po::value<int>()->default_value(6),
29  "Floating number output precision.")(
30  "obj-scalor", po::value<double>()->default_value(1.),
31  "Optional scaling from Acts units to output units.")(
32  "obj-container-view",
33  po::value<Integers<5>>()->default_value({{0, 220, 220, 220, 0}}),
34  "View configuration of container volumes (vis/novis, r, g, b, trimesh).")(
35  "obj-volume-view",
36  po::value<Integers<5>>()->default_value({{1, 220, 220, 0, 0}}),
37  "View configuration of navigation volumes (vis/novis, r, g, b, "
38  "trimesh).")(
39  "obj-layer-view",
40  po::value<Integers<5>>()->default_value({{1, 100, 180, 240, 0}}),
41  "View configuration of layer structures (vis/novis, r, g, b, trimesh).")(
42  "obj-sensitive-view",
43  po::value<Integers<5>>()->default_value({{1, 0, 180, 240, 0}}),
44  "View configuration of sensitive surfaces (vis/novis, r, g, b, "
45  "trimesh).")(
46  "obj-passive-view",
47  po::value<Integers<5>>()->default_value({{1, 240, 280, 0, 0}}),
48  "View configuration of sensitive surfaces (vis/novis, r, g, "
49  "b, trimesh).")(
50  "obj-grid-view",
51  po::value<Integers<5>>()->default_value({{1, 220, 0, 0, 0}}),
52  "View configuration of grid structures (vis/novis, r, g, b, trimesh).")(
53  "obj-grid-offset", po::value<double>()->default_value(0.),
54  "View offset of grid values.")("obj-grid-thickness",
55  po::value<double>()->default_value(0.5),
56  "Thickness of grid objects.");
57 }
58 
62  const boost::program_options::variables_map& vm) {
63  namespace po = boost::program_options;
65 
66  objTgConfig.outputPrecision = vm["obj-precision"].template as<int>();
67  objTgConfig.outputScalor = vm["obj-scalor"].template as<double>();
68 
69  auto setView = [&](const std::string& vname,
70  Acts::ViewConfig& viewCfg) -> void {
71  auto cview = vm[vname].template as<Integers<5>>();
72  if (not cview.empty()) {
73  if (cview[0] == 0) {
74  viewCfg.visible = false;
75  } else if (cview.size() > 3) {
76  viewCfg.color = {cview[1], cview[2], cview[3]};
77  if (cview.size() > 4 and cview[4] != 0) {
78  viewCfg.triangulate = true;
79  }
80  }
81  }
82  };
83 
84  setView("obj-container-view", objTgConfig.containerView);
85  setView("obj-volume-view", objTgConfig.containerView);
86  setView("obj-sensitive-view", objTgConfig.sensitiveView);
87  setView("obj-passive-view", objTgConfig.passiveView);
88  setView("obj-grid-view", objTgConfig.gridView);
89  objTgConfig.gridView.offset = vm["obj-grid-offset"].template as<double>();
90  objTgConfig.gridView.lineThickness =
91  vm["obj-grid-thickness"].template as<double>();
92 
93  return objTgConfig;
94 }
95 
96 } // namespace Options
97 } // namespace ActsExamples