ECCE @ 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 
11 #include <memory>
18 
19 namespace Acts {
20 
41  public:
48  CartesianSegmentation(const std::shared_ptr<const PlanarBounds>& mBounds,
49  size_t numCellsX, size_t numCellsY = 1);
50 
54  // it will define the RectangleBounds if none are provided
60  CartesianSegmentation(std::shared_ptr<const BinUtility> bUtility,
61  std::shared_ptr<const PlanarBounds> mBounds = nullptr);
62 
64  ~CartesianSegmentation() override;
65 
70  void createSegmentationSurfaces(SurfacePtrVector& boundarySurfaces,
71  SurfacePtrVector& segmentationSurfacesX,
72  SurfacePtrVector& segmentationSurfacesY,
73  double halfThickness,
74  int readoutDirection = 1.,
75  double lorentzAngle = 0.) const final;
76 
78  DigitizationCell cell(const Vector3D& position) const final;
79 
81  DigitizationCell cell(const Vector2D& position) const final;
82 
84  Vector2D cellPosition(const DigitizationCell& dCell) const final;
85 
91  const Vector3D& endStep,
92  double halfThickness,
93  int readoutDirection = 1,
94  double lorentzAngle = 0.) const final;
95 
98  const PlanarBounds& moduleBounds() const final;
99 
102  const BinUtility& binUtility() const final;
103 
105  std::pair<double, double> pitch() const;
106 
107  private:
108  template <class T>
109  DigitizationCell cellT(const T& position) const;
110 
111  std::shared_ptr<const PlanarBounds> m_activeBounds;
112  std::shared_ptr<const BinUtility> m_binUtility;
113 };
114 
116  return (*(m_activeBounds.get()));
117 }
118 
120  return (*(m_binUtility.get()));
121 }
122 
123 template <class T>
125  return DigitizationCell(m_binUtility->bin(position, 0),
126  m_binUtility->bin(position, 1));
127 }
128 
130  const Vector3D& position) const {
131  return cellT<Vector3D>(position);
132 }
133 
135  const Vector2D& position) const {
136  return cellT<Vector2D>(position);
137 }
138 
139 inline std::pair<double, double> CartesianSegmentation::pitch() const {
140  auto boundingBox = m_activeBounds->boundingBox();
141  auto values = boundingBox.values();
142  double pitchX = 2. * values[0] / m_binUtility->bins(0);
143  double pitchY = 2. * values[1] / m_binUtility->bins(1);
144  return std::pair<double, double>(pitchX, pitchY);
145 }
146 
147 } // namespace Acts