EIC 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 po = boost::program_options;
18 
19 namespace ActsExamples {
20 
21 namespace Options {
22 
28 template <typename aopt_t>
29 void addObjWriterOptions(aopt_t& opt) {
30  opt.add_options()("obj-precision", po::value<int>()->default_value(6),
31  "Floating number output precission.")(
32  "obj-scalor", po::value<double>()->default_value(1.),
33  "Optional scaling from Acts units to ouput units.")(
34  "obj-container-view",
35  po::value<read_series>()->multitoken()->default_value(
36  {0, 220, 220, 220, 0}),
37  "View configuration of container volumes (vis/novis, r, g, b, trimesh).")(
38  "obj-volume-view",
39  po::value<read_series>()->multitoken()->default_value(
40  {1, 220, 220, 0, 0}),
41  "View configuration of navigation volumes (vis/novis, r, g, b, "
42  "trimesh).")(
43  "obj-layer-view",
44  po::value<read_series>()->multitoken()->default_value(
45  {1, 100, 180, 240, 0}),
46  "View configuration of layer structures (vis/novis, r, g, b, trimesh).")(
47  "obj-sensitive-view",
48  po::value<read_series>()->multitoken()->default_value(
49  {1, 0, 180, 240, 0}),
50  "View configuration of sensitive surfaces (vis/novis, r, g, b, "
51  "trimesh).")("obj-passive-view",
52  po::value<read_series>()->multitoken()->default_value(
53  {1, 240, 280, 0, 0}),
54  "View configuration of sensitive surfaces (vis/novis, r, g, "
55  "b, trimesh).")(
56  "obj-grid-view",
57  po::value<read_series>()->multitoken()->default_value({1, 220, 0, 0, 0}),
58  "View configuration of grid structures (vis/novis, r, g, b, trimesh).")(
59  "obj-grid-offset", po::value<double>()->default_value(0.),
60  "View offset of grid values.")("obj-grid-thickness",
61  po::value<double>()->default_value(0.5),
62  "Thickness of grid objects.");
63 }
64 
66 template <class amap_t>
69  const amap_t& vm, const std::string& name,
71  ActsExamples::ObjTrackingGeometryWriter::Config objTgConfig(name, loglevel);
72 
73  objTgConfig.outputPrecision = vm["obj-precision"].template as<int>();
74  objTgConfig.outputScalor = vm["obj-scalor"].template as<double>();
75 
76  auto setView = [&](const std::string& vname,
77  Acts::ViewConfig& viewCfg) -> void {
78  read_series cview = vm[vname].template as<read_series>();
79  if (not cview.empty()) {
80  if (cview[0] == 0) {
81  viewCfg.visible = false;
82  } else if (cview.size() > 3) {
83  viewCfg.color = {cview[1], cview[2], cview[3]};
84  if (cview.size() > 4 and cview[4] != 0) {
85  viewCfg.triangulate = true;
86  }
87  }
88  }
89  };
90 
91  setView("obj-container-view", objTgConfig.containerView);
92  setView("obj-volume-view", objTgConfig.containerView);
93  setView("obj-sensitive-view", objTgConfig.sensitiveView);
94  setView("obj-passive-view", objTgConfig.passiveView);
95  setView("obj-grid-view", objTgConfig.gridView);
96  objTgConfig.gridView.offset = vm["obj-grid-offset"].template as<double>();
97  objTgConfig.gridView.lineThickness =
98  vm["obj-grid-thickness"].template as<double>();
99 
100  return objTgConfig;
101 }
102 
103 } // namespace Options
104 } // namespace ActsExamples