Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TelescopeDetector.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TelescopeDetector.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020-2021 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 
10 
15 
16 #include <algorithm>
17 #include <stdexcept>
18 
20  const Config& cfg, const std::shared_ptr<const Acts::IMaterialDecorator>&
21  /*mdecorator*/) -> std::pair<TrackingGeometryPtr, ContextDecorators> {
22  DetectorElement::ContextType nominalContext;
23 
24  if (cfg.surfaceType > 1) {
25  throw std::invalid_argument(
26  "The surface type could either be 0 for plane surface or 1 for disc "
27  "surface.");
28  }
29  if (cfg.binValue > 2) {
30  throw std::invalid_argument("The axis value could only be 0, 1, or 2.");
31  }
32  // Check if the bounds values are valid
33  if (cfg.surfaceType == 1 and cfg.bounds[0] >= cfg.bounds[1]) {
34  throw std::invalid_argument(
35  "The minR should be smaller than the maxR for disc surface bounds.");
36  }
37 
38  if (cfg.positions.size() != cfg.stereos.size()) {
39  throw std::invalid_argument(
40  "The number of provided positions must match the number of "
41  "provided stereo angles.");
42  }
43 
44  config = cfg;
45 
46  // Sort the provided distances
47  std::vector<double> positions = cfg.positions;
48  std::vector<double> stereos = cfg.stereos;
49  std::sort(positions.begin(), positions.end());
50 
53  nominalContext, detectorStore, positions, stereos, cfg.offsets,
54  cfg.bounds, cfg.thickness,
55  static_cast<ActsExamples::Telescope::TelescopeSurfaceType>(
56  cfg.surfaceType),
57  static_cast<Acts::BinningValue>(cfg.binValue));
58  ContextDecorators gContextDecorators = {};
59  // return the pair of geometry and empty decorators
60  return std::make_pair<TrackingGeometryPtr, ContextDecorators>(
61  std::move(gGeometry), std::move(gContextDecorators));
62 }