ATLAS Offline Software
Loading...
Searching...
No Matches
TrapezoidSegmentation.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6// TrapezoidSegmentation.h, ATLAS Detector software
8
9#ifndef TRKDIGEVENT_TRAPEZOIDSEGMENTATION_H
10#define TRKDIGEVENT_TRAPEZOIDSEGMENTATION_H
11
12// GeoPrimitives
14// Trk includes
19// STL
20#include <memory>
21
22namespace Trk {
23
37 public:
39 TrapezoidSegmentation(std::shared_ptr<const Trk::TrapezoidBounds>,
40 size_t numCellsX, size_t numCellsY=1);
41
43
46
47
49 virtual ~TrapezoidSegmentation();
50
51
53 void createSegmenationSurfaces(std::vector< std::shared_ptr< const Surface> >& boundarySurfaces,
54 std::vector< std::shared_ptr< const Surface> >& segmentationSurfacesX,
55 std::vector< std::shared_ptr< const Surface> >& segmentationSurfacesY,
56 double halfThickness,
57 int readoutDirection=1.,
58 double lorentzAngle=0.) const override;
59
61 const DigitizationCell cell(const Amg::Vector3D& position) const override;
62
64 const DigitizationCell cell(const Amg::Vector2D& position) const override;
65
67 const Amg::Vector2D cellPosition(const DigitizationCell& cId) const override;
68
71 const Amg::Vector3D& end,
72 double halfThickness,
73 int readoutDirection=1,
74 double lorentzAngle=0.) const override;
75
76
78 const SurfaceBounds& moduleBounds() const override;
79
81 size_t numCellsX() const;
82
84 size_t numCellsY() const;
85
86 private:
87
88 template <class T> const DigitizationCell cellT(const T& position) const;
89
91 double PitchX(const Amg::Vector2D &localPos) const;
92
94 double sinStereoLocal(const Amg::Vector2D &localPos) const;
95
97 double projectLocX(const Amg::Vector2D &localPos) const;
98
100 double radius() const;
101
102 std::shared_ptr<const TrapezoidBounds> m_activeBounds;
104 size_t m_binsX;
105 size_t m_binsY;
106
107 };
108
109 inline const SurfaceBounds& TrapezoidSegmentation::moduleBounds() const { return (*(m_activeBounds.get())); }
110
111 inline size_t TrapezoidSegmentation::numCellsX() const { return m_binsX; }
112
113 inline size_t TrapezoidSegmentation::numCellsY() const { return m_binsY; }
114
115 template <class T> const DigitizationCell TrapezoidSegmentation::cellT(const T& position) const
116 {
117 if (m_binsX == 1)
118 return DigitizationCell(0, m_binUtility->bin(position,0));
119 else if (m_binsY == 1 )
120 return DigitizationCell(m_binUtility->bin(position,0), 0);
121 return DigitizationCell(m_binUtility->bin(position,0), m_binUtility->bin(position,1));
122 }
123
124 inline const DigitizationCell TrapezoidSegmentation::cell(const Amg::Vector3D& position) const {
125 Amg::Vector3D CorrPosition = position;
126 CorrPosition.x() = projectLocX(Amg::Vector2D(CorrPosition.x(), CorrPosition.y()));
127 return cellT<Amg::Vector3D>(CorrPosition);
128 }
129
130 inline const DigitizationCell TrapezoidSegmentation::cell(const Amg::Vector2D& position) const {
131 using Trk::locX;
132 using Trk::locY;
133 Amg::Vector2D CorrPosition = position;
134 CorrPosition[Trk::locX] = projectLocX(Amg::Vector2D(CorrPosition[Trk::locX], CorrPosition[Trk::locY]));
135 return cellT<Amg::Vector2D>(CorrPosition);
136 }
137
139 {
140 return m_activeBounds->halflengthY()/(m_activeBounds->maxHalflengthX() - m_activeBounds->minHalflengthX())*(m_activeBounds->maxHalflengthX() + m_activeBounds->minHalflengthX());
141 }
142
144 using Trk::locX;
145 using Trk::locY;
146 double oneOverRadius = 1./radius();
147 double x = localPos[Trk::locX];
148 double y = localPos[Trk::locY];
149 return -x*oneOverRadius / sqrt( (1+y*oneOverRadius)*(1+y*oneOverRadius) + x*oneOverRadius*x*oneOverRadius );
150 }
151
152 double TrapezoidSegmentation::PitchX(const Amg::Vector2D &localPos) const {
153 using Trk::locY;
154 double tanPhi = (m_activeBounds->maxHalflengthX()-m_activeBounds->minHalflengthX())/m_activeBounds->halflengthY();
155 double lengthXatHit = (radius()+localPos[Trk::locY])*tanPhi;
156 return lengthXatHit/float(m_binsX);
157 }
158
159 double TrapezoidSegmentation::projectLocX(const Amg::Vector2D& localPos) const {
160 return -radius()*tan(asin(sinStereoLocal(localPos)));
161 }
162
163
164}
165
166#endif // end of TRKDIGEVENT_TRAPEZOIDSEGMENTATION_H
A generic symmetric BinUtility, for fully symmetric binning in terms of binning grid and binning type...
Definition BinUtility.h:39
Segementation class for generic pixel, strixels and strip segmentations on a rectangle shape.
Abstract base class for surface bounds to be specified.
const DigitizationCell cellT(const T &position) const
const SurfaceBounds & moduleBounds() const override
return the surface bounds by reference
double PitchX(const Amg::Vector2D &localPos) const
Return the local pitch X.
virtual ~TrapezoidSegmentation()
Virtual Destructor.
TrapezoidSegmentation(std::shared_ptr< const Trk::TrapezoidBounds >, size_t numCellsX, size_t numCellsY=1)
Constructor for all same-size pixels or strips (in case numCellsY is set to 1)
size_t numCellsY() const
Return the simple binning parameters.
double radius() const
Return the radius correponding to the given module.
void createSegmenationSurfaces(std::vector< std::shared_ptr< const Surface > > &boundarySurfaces, std::vector< std::shared_ptr< const Surface > > &segmentationSurfacesX, std::vector< std::shared_ptr< const Surface > > &segmentationSurfacesY, double halfThickness, int readoutDirection=1., double lorentzAngle=0.) const override
Create the segmentation surfaces in X.
double sinStereoLocal(const Amg::Vector2D &localPos) const
Return the local sinStereo.
double projectLocX(const Amg::Vector2D &localPos) const
Return the projected x value on the y=0.
size_t numCellsX() const
Return the simple binning parameters.
TrapezoidSegmentation & operator=(const TrapezoidSegmentation &)=delete
const Amg::Vector2D cellPosition(const DigitizationCell &cId) const override
calculate the cell Position from the Id
std::shared_ptr< const TrapezoidBounds > m_activeBounds
TrapezoidSegmentation(const TrapezoidSegmentation &)=delete
TODO contructor from BinUtilities for more complex readouts.
const DigitizationStep digitizationStep(const Amg::Vector3D &start, const Amg::Vector3D &end, double halfThickness, int readoutDirection=1, double lorentzAngle=0.) const override
Fill the associated digitisation cell from this start and end position, correct for lorentz effect if...
const DigitizationCell cell(const Amg::Vector3D &position) const override
Get the digitization cell from a 3D position - ignores the shift.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
Ensure that the ATLAS eigen extensions are properly loaded.
std::pair< size_t, size_t > DigitizationCell
@ locY
local cartesian
Definition ParamDefs.h:38
@ x
Definition ParamDefs.h:55
@ locX
Definition ParamDefs.h:37
@ y
Definition ParamDefs.h:56