File indexing completed on 2025-08-05 08:09:35
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include "Acts/Digitization/DigitizationModule.hpp"
0014
0015 #include <cmath>
0016 #include <cstddef>
0017 #include <utility>
0018
0019 Acts::DigitizationModule::DigitizationModule(
0020 std::shared_ptr<const Segmentation> moduleSegmentation,
0021 double halfThickness, int readoutDirection, double lorentzAngle,
0022 double energyThreshold, bool analogue)
0023 :
0024
0025 m_halfThickness(halfThickness),
0026 m_readoutDirection(readoutDirection),
0027 m_lorentzAngle(lorentzAngle),
0028 m_tanLorentzAngle(tan(lorentzAngle)),
0029 m_energyThreshold(energyThreshold),
0030 m_analogue(analogue),
0031 m_segmentation(std::move(moduleSegmentation)),
0032 m_boundarySurfaces(),
0033 m_segmentationSurfacesX(),
0034 m_segmentationSurfacesY() {
0035 m_segmentation->createSegmentationSurfaces(
0036 m_boundarySurfaces, m_segmentationSurfacesX, m_segmentationSurfacesY,
0037 halfThickness, readoutDirection, lorentzAngle);
0038 }
0039
0040 const Acts::SurfacePtrVector Acts::DigitizationModule::segmentationSurfaces(
0041 const Acts::DigitizationCell& entryCids,
0042 const Acts::DigitizationCell& exitCids) const {
0043 SurfacePtrVector sSurfaces;
0044
0045 auto startbinX = entryCids.channel0;
0046 auto endbinX = exitCids.channel0;
0047
0048 if (startbinX > endbinX) {
0049 std::swap(startbinX, endbinX);
0050 }
0051
0052 for (; startbinX <= endbinX; ++startbinX) {
0053 sSurfaces.push_back(m_segmentationSurfacesX[startbinX]);
0054 }
0055
0056
0057 auto startbinY = entryCids.channel1;
0058 auto endbinY = exitCids.channel1;
0059
0060 if (startbinY > endbinY) {
0061 std::swap(startbinY, endbinY);
0062 }
0063
0064 for (; startbinY <= endbinY; ++startbinY) {
0065 sSurfaces.push_back(m_segmentationSurfacesY[startbinY]);
0066 }
0067
0068
0069 return sSurfaces;
0070 }
0071
0072 Acts::SurfacePtrVector Acts::DigitizationModule::stepSurfaces(
0073 const Vector3& start, const Vector3& end) const {
0074
0075 SurfacePtrVector stepSurfaces;
0076
0077 const DigitizationCell startCell = m_segmentation->cell(start);
0078 const DigitizationCell endCell = m_segmentation->cell(end);
0079
0080
0081 std::size_t sCellX = startCell.channel0;
0082 std::size_t eCellX = endCell.channel0;
0083 if (sCellX > eCellX) {
0084 std::swap(sCellX, eCellX);
0085 }
0086
0087 if (sCellX > 0) {
0088 --sCellX;
0089 }
0090 ++eCellX;
0091
0092 std::size_t sCellY = startCell.channel1;
0093 std::size_t eCellY = endCell.channel1;
0094 if (sCellY > eCellY) {
0095 std::swap(sCellY, eCellY);
0096 }
0097
0098 stepSurfaces.reserve((eCellY - sCellY) + (eCellX - sCellX) + 2);
0099
0100 for (; sCellX <= eCellX && sCellX < m_segmentationSurfacesX.size();
0101 ++sCellX) {
0102 stepSurfaces.push_back(m_segmentationSurfacesX[sCellX]);
0103 }
0104
0105 for (; sCellY <= eCellY && sCellY < m_segmentationSurfacesY.size();
0106 ++sCellY) {
0107 stepSurfaces.push_back(m_segmentationSurfacesY[sCellY]);
0108 }
0109
0110 return stepSurfaces;
0111 }