ATLAS Offline Software
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 
22 namespace Trk {
23 
37  public:
39  TrapezoidSegmentation(std::shared_ptr<const Trk::TrapezoidBounds>,
40  size_t numCellsX, size_t numCellsY=1);
41 
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 
143  double TrapezoidSegmentation::sinStereoLocal(const Amg::Vector2D &localPos) const {
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
Trk::TrapezoidSegmentation::numCellsY
size_t numCellsY() const
Return the simple binning parameters.
Definition: TrapezoidSegmentation.h:113
Trk::TrapezoidSegmentation::radius
double radius() const
Return the radius correponding to the given module.
Definition: TrapezoidSegmentation.h:138
TrapezoidBounds.h
Trk::y
@ y
Definition: ParamDefs.h:56
Trk::TrapezoidSegmentation::m_activeBounds
std::shared_ptr< const TrapezoidBounds > m_activeBounds
Definition: TrapezoidSegmentation.h:102
Trk::TrapezoidSegmentation::cellT
const DigitizationCell cellT(const T &position) const
Definition: TrapezoidSegmentation.h:115
Trk::locX
@ locX
Definition: ParamDefs.h:37
Trk::locY
@ locY
local cartesian
Definition: ParamDefs.h:38
Trk::TrapezoidSegmentation::~TrapezoidSegmentation
virtual ~TrapezoidSegmentation()
Virtual Destructor.
Definition: TrapezoidSegmentation.cxx:43
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
Trk::SurfaceBounds
Definition: SurfaceBounds.h:47
Trk::TrapezoidSegmentation::numCellsX
size_t numCellsX() const
Return the simple binning parameters.
Definition: TrapezoidSegmentation.h:111
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
BinUtility.h
Trk::TrapezoidSegmentation::cellPosition
const Amg::Vector2D cellPosition(const DigitizationCell &cId) const override
calculate the cell Position from the Id
Definition: TrapezoidSegmentation.cxx:135
Trk::TrapezoidSegmentation::m_binUtility
BinUtility * m_binUtility
Definition: TrapezoidSegmentation.h:103
Trk::DigitizationCell
std::pair< size_t, size_t > DigitizationCell
Definition: DigitizationCell.h:18
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Trk::TrapezoidSegmentation::cell
const DigitizationCell cell(const Amg::Vector3D &position) const override
Get the digitization cell from a 3D position - ignores the shift.
Definition: TrapezoidSegmentation.h:124
GeoPrimitives.h
Trk::TrapezoidSegmentation::TrapezoidSegmentation
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)
Definition: TrapezoidSegmentation.cxx:22
Trk::TrapezoidSegmentation::TrapezoidSegmentation
TrapezoidSegmentation(const TrapezoidSegmentation &)=delete
TODO contructor from BinUtilities for more complex readouts.
drawFromPickle.tan
tan
Definition: drawFromPickle.py:36
Trk::DigitizationStep
Definition: DigitizationCell.h:21
Trk::BinUtility
Definition: BinUtility.h:39
Trk
Ensure that the ATLAS eigen extensions are properly loaded.
Definition: FakeTrackBuilder.h:9
Trk::TrapezoidSegmentation::createSegmenationSurfaces
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.
Definition: TrapezoidSegmentation.cxx:48
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Trk::TrapezoidSegmentation::projectLocX
double projectLocX(const Amg::Vector2D &localPos) const
Return the projected x value on the y=0.
Definition: TrapezoidSegmentation.h:159
Trk::TrapezoidSegmentation::moduleBounds
const SurfaceBounds & moduleBounds() const override
return the surface bounds by reference
Definition: TrapezoidSegmentation.h:109
Trk::TrapezoidSegmentation::digitizationStep
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...
Definition: TrapezoidSegmentation.cxx:145
DigitizationCell.h
Trk::TrapezoidSegmentation::operator=
TrapezoidSegmentation & operator=(const TrapezoidSegmentation &)=delete
Trk::TrapezoidSegmentation::sinStereoLocal
double sinStereoLocal(const Amg::Vector2D &localPos) const
Return the local sinStereo
Definition: TrapezoidSegmentation.h:143
Trk::BinUtility::bin
size_t bin(const Amg::Vector3D &position, size_t ba=0) const
Bin from a 3D vector (already in binning frame)
Definition: BinUtility.h:136
Segmentation.h
Trk::x
@ x
Definition: ParamDefs.h:55
Trk::TrapezoidSegmentation
Definition: TrapezoidSegmentation.h:36
Trk::TrapezoidSegmentation::m_binsX
size_t m_binsX
Definition: TrapezoidSegmentation.h:104
readCCLHist.float
float
Definition: readCCLHist.py:83
Trk::TrapezoidSegmentation::m_binsY
size_t m_binsY
Definition: TrapezoidSegmentation.h:105
Trk::TrapezoidSegmentation::PitchX
double PitchX(const Amg::Vector2D &localPos) const
Return the local pitch X
Definition: TrapezoidSegmentation.h:152
Trk::Segmentation
Definition: Segmentation.h:39