EIC 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 <memory>
19 
20 namespace Acts {
21 
42  public:
49  CartesianSegmentation(const std::shared_ptr<const PlanarBounds>& mBounds,
50  size_t numCellsX, size_t numCellsY = 1);
51 
55  // it will define the RectangleBounds if none are provided
61  CartesianSegmentation(std::shared_ptr<const BinUtility> bUtility,
62  std::shared_ptr<const PlanarBounds> mBounds = nullptr);
63 
65  ~CartesianSegmentation() override;
66 
71  void createSegmentationSurfaces(SurfacePtrVector& boundarySurfaces,
72  SurfacePtrVector& segmentationSurfacesX,
73  SurfacePtrVector& segmentationSurfacesY,
74  double halfThickness,
75  int readoutDirection = 1.,
76  double lorentzAngle = 0.) const final;
77 
79  DigitizationCell cell(const Vector3D& position) const final;
80 
82  DigitizationCell cell(const Vector2D& position) const final;
83 
85  Vector2D cellPosition(const DigitizationCell& dCell) const final;
86 
92  const Vector3D& endStep,
93  double halfThickness,
94  int readoutDirection = 1,
95  double lorentzAngle = 0.) const final;
96 
99  const PlanarBounds& moduleBounds() const final;
100 
103  const BinUtility& binUtility() const final;
104 
106  std::pair<double, double> pitch() const;
107 
108  private:
109  template <class T>
110  DigitizationCell cellT(const T& position) const;
111 
112  std::shared_ptr<const PlanarBounds> m_activeBounds;
113  std::shared_ptr<const BinUtility> m_binUtility;
114 };
115 
117  return (*(m_activeBounds.get()));
118 }
119 
121  return (*(m_binUtility.get()));
122 }
123 
124 template <class T>
126  return DigitizationCell(m_binUtility->bin(position, 0),
127  m_binUtility->bin(position, 1));
128 }
129 
131  const Vector3D& position) const {
132  return cellT<Vector3D>(position);
133 }
134 
136  const Vector2D& position) const {
137  return cellT<Vector2D>(position);
138 }
139 
140 inline std::pair<double, double> CartesianSegmentation::pitch() const {
141  auto boundingBox = m_activeBounds->boundingBox();
142  auto values = boundingBox.values();
143  double pitchX = 2. * values[0] / m_binUtility->bins(0);
144  double pitchY = 2. * values[1] / m_binUtility->bins(1);
145  return std::pair<double, double>(pitchX, pitchY);
146 }
147 
148 } // namespace Acts