Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-23 08:20:27

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "ActsExamples/TelescopeDetector/TelescopeDetector.hpp"
0010 
0011 #include "Acts/Geometry/GeometryContext.hpp"
0012 #include "ActsExamples/TelescopeDetector/BuildTelescopeDetector.hpp"
0013 
0014 #include <stdexcept>
0015 
0016 namespace ActsExamples {
0017 
0018 TelescopeDetector::TelescopeDetector(const Config& cfg)
0019     : Detector(Acts::getDefaultLogger("TelescopeDetector", cfg.logLevel)),
0020       m_cfg(cfg) {
0021   if (m_cfg.surfaceType > 1) {
0022     throw std::invalid_argument(
0023         "The surface type could either be 0 for plane surface or 1 for disc "
0024         "surface.");
0025   }
0026   if (m_cfg.binValue > 2) {
0027     throw std::invalid_argument("The axis value could only be 0, 1, or 2.");
0028   }
0029   // Check if the bounds values are valid
0030   if (m_cfg.surfaceType == 1 && m_cfg.bounds[0] >= m_cfg.bounds[1]) {
0031     throw std::invalid_argument(
0032         "The minR should be smaller than the maxR for disc surface bounds.");
0033   }
0034 
0035   if (m_cfg.positions.empty()) {
0036     throw std::invalid_argument("At least one surface position is required.");
0037   }
0038 
0039   if (m_cfg.positions.size() != m_cfg.stereos.size()) {
0040     throw std::invalid_argument(
0041         "The number of provided positions must match the number of "
0042         "provided stereo angles.");
0043   }
0044 
0045   m_nominalGeometryContext =
0046       Acts::GeometryContext::dangerouslyDefaultConstruct();
0047   m_trackingGeometry = buildTelescopeDetector(
0048       m_nominalGeometryContext, m_detectorStore, m_cfg.positions, m_cfg.stereos,
0049       m_cfg.offsets, m_cfg.bounds, m_cfg.thickness,
0050       static_cast<TelescopeSurfaceType>(m_cfg.surfaceType),
0051       static_cast<Acts::AxisDirection>(m_cfg.binValue));
0052 }
0053 
0054 TelescopeDetector::TelescopeDetector(const Config& cfg, NoBuildTag /*unused*/)
0055     : Detector(Acts::getDefaultLogger("TelescopeDetector", cfg.logLevel)),
0056       m_cfg(cfg) {
0057   if (m_cfg.surfaceType > 1) {
0058     throw std::invalid_argument(
0059         "The surface type could either be 0 for plane surface or 1 for disc "
0060         "surface.");
0061   }
0062   if (m_cfg.binValue > 2) {
0063     throw std::invalid_argument("The axis value could only be 0, 1, or 2.");
0064   }
0065   // Check if the bounds values are valid
0066   if (m_cfg.surfaceType == 1 && m_cfg.bounds[0] >= m_cfg.bounds[1]) {
0067     throw std::invalid_argument(
0068         "The minR should be smaller than the maxR for disc surface bounds.");
0069   }
0070 
0071   if (m_cfg.positions.empty()) {
0072     throw std::invalid_argument("At least one surface position is required.");
0073   }
0074 
0075   if (m_cfg.positions.size() != m_cfg.stereos.size()) {
0076     throw std::invalid_argument(
0077         "The number of provided positions must match the number of "
0078         "provided stereo angles.");
0079   }
0080 }
0081 
0082 }  // namespace ActsExamples