diff --git a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp index eaf2cfc9caf..d54a75b941d 100644 --- a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp +++ b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp @@ -34,11 +34,14 @@ enum class TelescopeSurfaceType { /// /// @param gctx is the detector element dependent geometry context /// @param detectorStore is the store for the detector element -/// @param positions is the offset w of different layers in the longitudinal -/// direction +/// @param positions are the positions of different layers in the longitudinal +/// direction +/// @param stereoAngles are the stereo angles of different layers, which are +/// rotation angles around the longitudinal (normal) +/// direction /// @param offsets is the offset (u, v) of the layers in the transverse plane /// @param bounds is the surface bound values, i.e. halfX and halfY if plane -/// surface, and minR and maxR if disc surface +/// surface, and minR and maxR if disc surface /// @param thickness is the material thickness of each layer /// @param surfaceType is the detector surface type /// @param binValue indicates which axis the detector surface normals are @@ -46,9 +49,10 @@ enum class TelescopeSurfaceType { std::unique_ptr buildDetector( const typename TelescopeDetectorElement::ContextType& gctx, std::vector>& detectorStore, - const std::vector& positions, const std::array& offsets, - const std::array& bounds, double thickness, - TelescopeSurfaceType surfaceType, + const std::vector& positions, + const std::vector& stereoAngles, + const std::array& offsets, const std::array& bounds, + double thickness, TelescopeSurfaceType surfaceType, Acts::BinningValue binValue = Acts::BinningValue::binZ); } // end of namespace Telescope diff --git a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp index 1869094d60b..e1d94db9604 100644 --- a/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp +++ b/Examples/Detectors/TelescopeDetector/include/ActsExamples/TelescopeDetector/TelescopeDetector.hpp @@ -45,6 +45,7 @@ struct TelescopeDetector { struct Config { std::vector positions{{0, 30, 60, 120, 150, 180}}; + std::vector stereos{{0, 0, 0, 0, 0, 0}}; std::array offsets{{0, 0}}; std::array bounds{{25, 100}}; double thickness{80_um}; diff --git a/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp b/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp index 85328c82aba..ce0d834cea3 100644 --- a/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp +++ b/Examples/Detectors/TelescopeDetector/src/BuildTelescopeDetector.cpp @@ -40,9 +40,10 @@ ActsExamples::Telescope::buildDetector( std::vector< std::shared_ptr>& detectorStore, - const std::vector& positions, const std::array& offsets, - const std::array& bounds, double thickness, - ActsExamples::Telescope::TelescopeSurfaceType surfaceType, + const std::vector& positions, + const std::vector& stereoAngles, + const std::array& offsets, const std::array& bounds, + double thickness, ActsExamples::Telescope::TelescopeSurfaceType surfaceType, Acts::BinningValue binValue) { using namespace Acts::UnitLiterals; @@ -80,8 +81,14 @@ ActsExamples::Telescope::buildDetector( for (unsigned int i = 0; i < nLayers; ++i) { // The translation without rotation yet Acts::Translation3 trans(offsets[0], offsets[1], positions[i]); - // The transform + // The entire transformation (the coordinate system, whose center is defined + // by trans, will be rotated as well) Acts::Transform3 trafo(rotation * trans); + + // rotate around local z axis by stereo angle + auto stereo = stereoAngles[i]; + trafo *= Acts::AngleAxis3(stereo, Acts::Vector3::UnitZ()); + // Create the detector element std::shared_ptr detElement = nullptr; if (surfaceType == TelescopeSurfaceType::Plane) { diff --git a/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp b/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp index ceb76c5bf62..2bc269f48ab 100644 --- a/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp +++ b/Examples/Detectors/TelescopeDetector/src/TelescopeDetector.cpp @@ -35,16 +35,23 @@ auto ActsExamples::Telescope::TelescopeDetector::finalize( "The minR should be smaller than the maxR for disc surface bounds."); } + if (cfg.positions.size() != cfg.stereos.size()) { + throw std::invalid_argument( + "The number of provided positions must match the number of " + "provided stereo angles."); + } + config = cfg; // Sort the provided distances std::vector positions = cfg.positions; + std::vector stereos = cfg.stereos; std::sort(positions.begin(), positions.end()); /// Return the telescope detector TrackingGeometryPtr gGeometry = ActsExamples::Telescope::buildDetector( - nominalContext, detectorStore, positions, cfg.offsets, cfg.bounds, - cfg.thickness, + nominalContext, detectorStore, positions, stereos, cfg.offsets, + cfg.bounds, cfg.thickness, static_cast( cfg.surfaceType), static_cast(cfg.binValue)); diff --git a/Examples/Python/src/Detector.cpp b/Examples/Python/src/Detector.cpp index 677daab9555..524aa867383 100644 --- a/Examples/Python/src/Detector.cpp +++ b/Examples/Python/src/Detector.cpp @@ -81,6 +81,7 @@ void addDetector(Context& ctx) { py::class_(td, "Config") .def(py::init<>()) .def_readwrite("positions", &Config::positions) + .def_readwrite("stereos", &Config::stereos) .def_readwrite("offsets", &Config::offsets) .def_readwrite("bounds", &Config::bounds) .def_readwrite("thickness", &Config::thickness) diff --git a/Examples/Python/tests/test_detectors.py b/Examples/Python/tests/test_detectors.py index f5d76095235..1a01809e5dd 100644 --- a/Examples/Python/tests/test_detectors.py +++ b/Examples/Python/tests/test_detectors.py @@ -44,6 +44,7 @@ def test_telescope_geometry(): detector, geo, contextDecorators = acts.examples.TelescopeDetector.create( bounds=[100, 100], positions=[10 * i for i in range(n_surfaces)], + stereos=[0] * n_surfaces, binValue=0, ) diff --git a/Examples/Run/Common/src/TelescopeDetectorOptions.cpp b/Examples/Run/Common/src/TelescopeDetectorOptions.cpp deleted file mode 100644 index 72eea3444a4..00000000000 --- a/Examples/Run/Common/src/TelescopeDetectorOptions.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// This file is part of the Acts project. -// -// Copyright (C) 2020-2021 CERN for the benefit of the Acts project -// -// This Source Code Form is subject to the terms of the Mozilla Public -// License, v. 2.0. If a copy of the MPL was not distributed with this -// file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#include "ActsExamples/TelescopeDetector/TelescopeDetectorOptions.hpp" - -#include "ActsExamples/Utilities/Options.hpp" - -#include - -void ActsExamples::Options::addTelescopeGeometryOptions( - ActsExamples::Options::Description& desc) { - using boost::program_options::value; - auto opt = desc.add_options(); - opt("geo-tele-positions", - value()->default_value({{0, 30, 60, 120, 150, 180}}), - "Telescope detector Input: the layers positions in the longidutinal " - "direction in mm"); - opt("geo-tele-offsets", value>()->default_value({{0, 0}}), - "Telescope detector Input: the layers offsets in the transverse plane in " - "mm. Same values for " - "all layers"); - opt("geo-tele-bounds", value>()->default_value({{25, 100}}), - "Telescope detector Input: the values for surface bounds in mm: " - "(halfX, halfY) - plane surface, (minR, maxR) - disc surface"); - opt("geo-tele-thickness", value()->default_value(80), - "Telescope detector Input: the silicon material thickness of " - "each layer in um. Same value for all layers"); - opt("geo-tele-surface", value()->default_value(0), - "Telescope detector Input: the detector surface type: 0 - plane surface, " - "1 - disc surface"); - opt("geo-tele-alignaxis", value()->default_value(2), - "Telescope detector Input: the detector is placed along which " - "axis: 0 - x axis, 1 - y axis, 2 - z axis"); -} diff --git a/Examples/Run/Common/src/TelescopeDetectorWithOptions.cpp b/Examples/Run/Common/src/TelescopeDetectorWithOptions.cpp index ab7c8e7da9a..7d0665ad789 100644 --- a/Examples/Run/Common/src/TelescopeDetectorWithOptions.cpp +++ b/Examples/Run/Common/src/TelescopeDetectorWithOptions.cpp @@ -24,6 +24,11 @@ void TelescopeDetectorWithOptions::addOptions( value()->default_value({{0, 30, 60, 120, 150, 180}}), "Telescope detector Input: the layers positions in the longidutinal " "direction in mm"); + opt("geo-tele-stereos", + value()->default_value({{0, 0, 0, 0, 0, 0}}), + "Telescope detector Input: the layers stereo angle around the " + "longitudinal " + "direction in rad"); opt("geo-tele-offsets", value>()->default_value({{0, 0}}), "Telescope detector Input: the layers offsets in the transverse plane " "in " @@ -53,6 +58,9 @@ auto TelescopeDetectorWithOptions::finalize( cfg.positions = vm["geo-tele-positions"] .template as() .values; + cfg.stereos = vm["geo-tele-stereos"] + .template as() + .values; cfg.offsets = vm["geo-tele-offsets"].template as>(); // The bounds values are taken as (halfX, halfY) for plane surface and diff --git a/Examples/Scripts/Python/truth_tracking_telescope.py b/Examples/Scripts/Python/truth_tracking_telescope.py index 87df981b8bd..b179fb9afa7 100755 --- a/Examples/Scripts/Python/truth_tracking_telescope.py +++ b/Examples/Scripts/Python/truth_tracking_telescope.py @@ -11,19 +11,19 @@ if "__main__" == __name__: detector, trackingGeometry, decorators = acts.examples.TelescopeDetector.create( - bounds=[200, 200], positions=[30, 60, 90, 120, 150, 180, 210, 240, 270] + bounds=[200, 200], + positions=[30, 60, 90, 120, 150, 180, 210, 240, 270], + stereos=[0] * 9, ) - digiConfigFile = ( - Path(__file__).resolve().parent.parent.parent.parent - / "Examples/Algorithms/Digitization/share/default-smearing-config-telescope.json", - ) + srcdir = Path(__file__).resolve().parent.parent.parent.parent field = acts.ConstantBField(acts.Vector3(0, 0, 2 * u.T)) runTruthTrackingKalman( trackingGeometry, field, - digiConfigFile=digiConfigFile, + digiConfigFile=srcdir + / "Examples/Algorithms/Digitization/share/default-smearing-config-telescope.json", outputDir=Path.cwd(), ).run()