Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:45

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.size() != m_cfg.stereos.size()) {
0036     throw std::invalid_argument(
0037         "The number of provided positions must match the number of "
0038         "provided stereo angles.");
0039   }
0040 
0041   m_nominalGeometryContext = Acts::GeometryContext();
0042 
0043   m_trackingGeometry = buildTelescopeDetector(
0044       m_nominalGeometryContext, m_detectorStore, m_cfg.positions, m_cfg.stereos,
0045       m_cfg.offsets, m_cfg.bounds, m_cfg.thickness,
0046       static_cast<TelescopeSurfaceType>(m_cfg.surfaceType),
0047       static_cast<Acts::AxisDirection>(m_cfg.binValue));
0048 }
0049 
0050 }  // namespace ActsExamples