Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CartesianSegmentation.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CartesianSegmentation.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2016-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 
17 
18 #include <cstddef>
19 #include <memory>
20 #include <utility>
21 #include <vector>
22 
23 namespace Acts {
24 
45  public:
52  CartesianSegmentation(const std::shared_ptr<const PlanarBounds>& mBounds,
53  size_t numCellsX, size_t numCellsY = 1);
54 
58  // it will define the RectangleBounds if none are provided
64  CartesianSegmentation(std::shared_ptr<const BinUtility> bUtility,
65  std::shared_ptr<const PlanarBounds> mBounds = nullptr);
66 
68  ~CartesianSegmentation() override;
69 
74  void createSegmentationSurfaces(SurfacePtrVector& boundarySurfaces,
75  SurfacePtrVector& segmentationSurfacesX,
76  SurfacePtrVector& segmentationSurfacesY,
77  double halfThickness,
78  int readoutDirection = 1.,
79  double lorentzAngle = 0.) const final;
80 
82  DigitizationCell cell(const Vector3& position) const final;
83 
85  DigitizationCell cell(const Vector2& position) const final;
86 
88  Vector2 cellPosition(const DigitizationCell& dCell) const final;
89 
95  double halfThickness,
96  int readoutDirection = 1,
97  double lorentzAngle = 0.) const final;
98 
101  const PlanarBounds& moduleBounds() const final;
102 
105  const BinUtility& binUtility() const final;
106 
108  std::pair<double, double> pitch() const;
109 
110  private:
111  template <class T>
112  DigitizationCell cellT(const T& position) const;
113 
114  std::shared_ptr<const PlanarBounds> m_activeBounds;
115  std::shared_ptr<const BinUtility> m_binUtility;
116 };
117 
119  return (*(m_activeBounds.get()));
120 }
121 
123  return (*(m_binUtility.get()));
124 }
125 
126 template <class T>
128  return DigitizationCell(m_binUtility->bin(position, 0),
129  m_binUtility->bin(position, 1));
130 }
131 
133  const Vector3& position) const {
134  return cellT<Vector3>(position);
135 }
136 
138  const Vector2& position) const {
139  return cellT<Vector2>(position);
140 }
141 
142 inline std::pair<double, double> CartesianSegmentation::pitch() const {
143  auto boundingBox = m_activeBounds->boundingBox();
144  auto values = boundingBox.values();
145  double pitchX = 2. * values[0] / m_binUtility->bins(0);
146  double pitchY = 2. * values[1] / m_binUtility->bins(1);
147  return std::pair<double, double>(pitchX, pitchY);
148 }
149 
150 } // namespace Acts