ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::TrapezoidSegmentation Class Reference

#include <TrapezoidSegmentation.h>

Inheritance diagram for Trk::TrapezoidSegmentation:
Collaboration diagram for Trk::TrapezoidSegmentation:

Public Member Functions

 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)
 TrapezoidSegmentation (const TrapezoidSegmentation &)=delete
 TODO contructor from BinUtilities for more complex readouts.
TrapezoidSegmentationoperator= (const TrapezoidSegmentation &)=delete
virtual ~TrapezoidSegmentation ()
 Virtual Destructor.
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.
const DigitizationCell cell (const Amg::Vector3D &position) const override
 Get the digitization cell from a 3D position - ignores the shift.
const DigitizationCell cell (const Amg::Vector2D &position) const override
 Get the digitization cell from a position.
const Amg::Vector2D cellPosition (const DigitizationCell &cId) const override
 calculate the cell Position from the Id
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 needed.
const SurfaceBoundsmoduleBounds () const override
 return the surface bounds by reference
size_t numCellsX () const
 Return the simple binning parameters.
size_t numCellsY () const
 Return the simple binning parameters.

Private Member Functions

template<class T>
const DigitizationCell cellT (const T &position) const
double PitchX (const Amg::Vector2D &localPos) const
 Return the local pitch 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.
double radius () const
 Return the radius correponding to the given module.

Private Attributes

std::shared_ptr< const TrapezoidBoundsm_activeBounds
BinUtilitym_binUtility
size_t m_binsX
size_t m_binsY

Detailed Description

Definition at line 36 of file TrapezoidSegmentation.h.

Constructor & Destructor Documentation

◆ TrapezoidSegmentation() [1/2]

Trk::TrapezoidSegmentation::TrapezoidSegmentation ( std::shared_ptr< const Trk::TrapezoidBounds > mBounds,
size_t numCellsX,
size_t numCellsY = 1 )

Constructor for all same-size pixels or strips (in case numCellsY is set to 1)

Definition at line 21 of file TrapezoidSegmentation.cxx.

22 :
23 m_activeBounds(std::move(mBounds)),
24 m_binUtility(nullptr),
27{
28 // first the x dimension if needed
29 if (numCellsX > 1) {
30 m_binUtility = new Trk::BinUtility(numCellsX, -0.5*(m_activeBounds->minHalflengthX()+m_activeBounds->maxHalflengthX()), 0.5*(m_activeBounds->minHalflengthX()+m_activeBounds->maxHalflengthX()), Trk::open, Trk::binX);
31 }
32 // use y dimension if needed
33 if (numCellsY > 1){
34 Trk::BinUtility yBinUtility(numCellsY, -m_activeBounds->halflengthY(), m_activeBounds->halflengthY(), Trk::open, Trk::binY);
35 if (m_binUtility)
36 (*m_binUtility) += yBinUtility;
37 else
38 m_binUtility = new Trk::BinUtility(yBinUtility);
39 }
40}
size_t numCellsY() const
Return the simple binning parameters.
size_t numCellsX() const
Return the simple binning parameters.
std::shared_ptr< const TrapezoidBounds > m_activeBounds
@ open
Definition BinningType.h:40
@ binX
Definition BinningType.h:47
@ binY
Definition BinningType.h:48

◆ TrapezoidSegmentation() [2/2]

Trk::TrapezoidSegmentation::TrapezoidSegmentation ( const TrapezoidSegmentation & )
delete

TODO contructor from BinUtilities for more complex readouts.

◆ ~TrapezoidSegmentation()

Trk::TrapezoidSegmentation::~TrapezoidSegmentation ( )
virtual

Virtual Destructor.

Definition at line 42 of file TrapezoidSegmentation.cxx.

43{
44 delete m_binUtility;
45}

Member Function Documentation

◆ cell() [1/2]

const DigitizationCell Trk::TrapezoidSegmentation::cell ( const Amg::Vector2D & position) const
inlineoverridevirtual

Get the digitization cell from a position.

Implements Trk::Segmentation.

Definition at line 130 of file TrapezoidSegmentation.h.

130 {
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 }
const DigitizationCell cellT(const T &position) const
double projectLocX(const Amg::Vector2D &localPos) const
Return the projected x value on the y=0.
Eigen::Matrix< double, 2, 1 > Vector2D
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37

◆ cell() [2/2]

const DigitizationCell Trk::TrapezoidSegmentation::cell ( const Amg::Vector3D & position) const
inlineoverridevirtual

Get the digitization cell from a 3D position - ignores the shift.

Implements Trk::Segmentation.

Definition at line 124 of file TrapezoidSegmentation.h.

124 {
125 Amg::Vector3D CorrPosition = position;
126 CorrPosition.x() = projectLocX(Amg::Vector2D(CorrPosition.x(), CorrPosition.y()));
127 return cellT<Amg::Vector3D>(CorrPosition);
128 }
Eigen::Matrix< double, 3, 1 > Vector3D

◆ cellPosition()

const Amg::Vector2D Trk::TrapezoidSegmentation::cellPosition ( const DigitizationCell & cId) const
overridevirtual

calculate the cell Position from the Id

Implements Trk::Segmentation.

Definition at line 134 of file TrapezoidSegmentation.cxx.

135{
136 // use the bin utility for this job
137 double bX = (m_binsX>1) ? m_binUtility->binPosition(projectLocX(Amg::Vector2D(dCell.first, dCell.second)),0.,0) : 0.;
138 double bY = (m_binsY>1) ? m_binUtility->binPosition(dCell.second,0.,1) : 0.;
139 return Amg::Vector2D(bX,bY);
140}

◆ cellT()

template<class T>
const DigitizationCell Trk::TrapezoidSegmentation::cellT ( const T & position) const
private

Definition at line 115 of file TrapezoidSegmentation.h.

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 }
std::pair< size_t, size_t > DigitizationCell

◆ createSegmenationSurfaces()

void Trk::TrapezoidSegmentation::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
overridevirtual

Create the segmentation surfaces in X.

Implements Trk::Segmentation.

Definition at line 47 of file TrapezoidSegmentation.cxx.

53{
54 // The Lorentz angle is not taken into account for trapezoidal segmentation
55 // (A) --- top/bottom surfaces -----------------------------------------------------------
56 // let's create the top/botten surfaces first - we call them readout / counter readout
57 // there are some things to consider
58 // - they share only the readout surface, then the segmentation surfaces are tilted and cannot be shared on the same module
59 std::shared_ptr<Trk::TrapezoidBounds> readoutPlaneBounds =
60 std::make_shared<Trk::TrapezoidBounds>(m_activeBounds->minHalflengthX(),
61 m_activeBounds->maxHalflengthX(),
62 m_activeBounds->halflengthY());
63 // - they are separated by half a thickness in z
64 Amg::Transform3D readoutPlaneTransform(Amg::Transform3D::Identity());
65 Amg::Transform3D counterPlaneTransform(Amg::Transform3D::Identity());
66 // readout and counter readout bounds, the bounds of the readout plane are like the active ones
67 // the transform of the readout plane is always centric
68 readoutPlaneTransform.translation() = Amg::Vector3D(0.,0.,readoutDirection*halfThickness);
69 // no lorentz angle and everything is straight-forward
70 std::shared_ptr<Trk::TrapezoidBounds> counterPlaneBounds = readoutPlaneBounds;
71 counterPlaneTransform.translation() = Amg::Vector3D(0.,0.,-readoutDirection*halfThickness);
72
73 // - build the readout & counter readout surfaces
74 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(readoutPlaneTransform,readoutPlaneBounds));
75 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(counterPlaneTransform,counterPlaneBounds));
76
77 // (B) - bin X -----------------------------------------------------------
78 // easy stuff first, constant pitch size and
79 double pitchX = 2.*(m_activeBounds->maxHalflengthX()+m_activeBounds->minHalflengthX())*0.5/m_binsX;
80
81 // now the rotation matrix for the xBins
82 Amg::RotationMatrix3D xBinRotationMatrix;
83 xBinRotationMatrix.col(0) = Amg::Vector3D::UnitY();
84 xBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
85 xBinRotationMatrix.col(2) = Amg::Vector3D::UnitX();
86
87 // reserve, it's always (number of bins-1) as the boundaries are within the boundarySurfaces
88 segmentationSurfacesX.reserve(m_binsX);
89 for (size_t ibinx = 0; ibinx <= m_binsX; ++ibinx){
90 // the current step x position
91 double cPosX = -(m_activeBounds->minHalflengthX()+m_activeBounds->maxHalflengthX())*0.5+ibinx*pitchX;
92
93 // set position & rotation for all (boundaries and segmentations) --> Then you separate between them
94 Amg::Vector3D xPosition = Amg::Vector3D(cPosX, 0.,0.);
95 double stereoLocal = asin(sinStereoLocal(Amg::Vector2D(cPosX, 0.)));
96 const Amg::RotationMatrix3D xRotation = xBinRotationMatrix*Amg::AngleAxis3D(stereoLocal, Amg::Vector3D::UnitY());
97 // build the rotation from it
98 Amg::Transform3D binTransform(Amg::getTransformFromRotTransl(xRotation, xPosition));
99 // the correct bounds for this
100 auto xBinBounds = std::make_shared<Trk::RectangleBounds>(m_activeBounds->halflengthY()/cos(stereoLocal),halfThickness);
101 // these are the boundaries
102 if (ibinx==0 || ibinx == m_binsX) // (i) this is the low/high boundary --- ( ibin == 0/m_binsX )
103 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(binTransform, xBinBounds));
104 else // these are the bin boundaries
105 segmentationSurfacesX.push_back(std::make_shared<Trk::PlaneSurface>(binTransform, xBinBounds));
106 }
107
108 // (C) - bin Y surfaces - everything is defined -----------------------------------------------------------
109 // now the rotation matrix for the yBins - anticyclic
110 Amg::RotationMatrix3D yBinRotationMatrix;
111 yBinRotationMatrix.col(0) = Amg::Vector3D::UnitX();
112 yBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
113 yBinRotationMatrix.col(2) = Amg::Vector3D(0.,-1.,0.);
114 // easy stuff first, constant pitch in Y
115 double pitchY = 2.*m_activeBounds->halflengthY()/m_binsY;
116 // reserve, it's always (number of bins-1) as the boundaries are within the boundarySurfaces
117 segmentationSurfacesY.reserve(m_binsY);
118 for (size_t ibiny = 0; ibiny <= m_binsY; ++ibiny){
119 // the position of the bin surface
120 double binPosY = -m_activeBounds->halflengthY()+ibiny*pitchY;
121 Amg::Vector3D binSurfaceCenter(0.,binPosY,0.);
122 double localPitchX = PitchX(Amg::Vector2D(0., binPosY));
123 auto yBinBounds = std::make_shared<Trk::RectangleBounds>(localPitchX*m_binsX*0.5,halfThickness);
124 Amg::Transform3D binTransform(Amg::getTransformFromRotTransl(yBinRotationMatrix,binSurfaceCenter));
125 // these are the boundaries
126 if (ibiny == 0 || ibiny == m_binsY)
127 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(binTransform,yBinBounds));
128 else // these are the bin boundaries
129 segmentationSurfacesY.push_back(std::make_shared<const Trk::PlaneSurface>(binTransform,yBinBounds));
130 }
131}
double PitchX(const Amg::Vector2D &localPos) const
Return the local pitch X.
double sinStereoLocal(const Amg::Vector2D &localPos) const
Return the local sinStereo.
Eigen::AngleAxisd AngleAxis3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Amg::Transform3D getTransformFromRotTransl(Amg::RotationMatrix3D rot, Amg::Vector3D transl_vec)
Eigen::Affine3d Transform3D

◆ digitizationStep()

const Trk::DigitizationStep Trk::TrapezoidSegmentation::digitizationStep ( const Amg::Vector3D & start,
const Amg::Vector3D & end,
double halfThickness,
int readoutDirection = 1,
double lorentzAngle = 0. ) const
overridevirtual

Fill the associated digitisation cell from this start and end position, correct for lorentz effect if needed.

Get the digitization cell from 3D position, it used the projection to the readout surface to estimate the 2D positon.

Implements Trk::Segmentation.

Definition at line 144 of file TrapezoidSegmentation.cxx.

149{
150
151 Amg::Vector3D stepCenter = 0.5*(startStep+endStep);
152 // project to parameter surface
153 double lorentzDeltaX = -readoutDirection*stepCenter.z()*std::tan(lorentzAngle);
154 // take the full drift length
155 double driftInZ = (halfThickness-readoutDirection*stepCenter.z());
156 double driftLength = std::abs(driftInZ/std::cos(lorentzAngle));
157 // the projected center
158 Amg::Vector2D stepCenterProjected(stepCenter.x()+lorentzDeltaX,stepCenter.y());
159 // the cell & its center
160 Trk::DigitizationCell dCell = cell(stepCenterProjected);
161 Amg::Vector2D cellCenter = cellPosition(dCell);
162 // we are ready to return what we have
163 return Trk::DigitizationStep((endStep-startStep).mag(),driftLength,dCell,startStep,endStep,stepCenterProjected,cellCenter);
164}
Scalar mag() const
mag method
const Amg::Vector2D cellPosition(const DigitizationCell &cId) const override
calculate the cell Position from the Id
const DigitizationCell cell(const Amg::Vector3D &position) const override
Get the digitization cell from a 3D position - ignores the shift.

◆ moduleBounds()

const SurfaceBounds & Trk::TrapezoidSegmentation::moduleBounds ( ) const
inlineoverridevirtual

return the surface bounds by reference

Implements Trk::Segmentation.

Definition at line 109 of file TrapezoidSegmentation.h.

109{ return (*(m_activeBounds.get())); }

◆ numCellsX()

size_t Trk::TrapezoidSegmentation::numCellsX ( ) const
inline

Return the simple binning parameters.

Definition at line 111 of file TrapezoidSegmentation.h.

111{ return m_binsX; }

◆ numCellsY()

size_t Trk::TrapezoidSegmentation::numCellsY ( ) const
inline

Return the simple binning parameters.

Definition at line 113 of file TrapezoidSegmentation.h.

113{ return m_binsY; }

◆ operator=()

TrapezoidSegmentation & Trk::TrapezoidSegmentation::operator= ( const TrapezoidSegmentation & )
delete

◆ PitchX()

double Trk::TrapezoidSegmentation::PitchX ( const Amg::Vector2D & localPos) const
private

Return the local pitch X.

Definition at line 152 of file TrapezoidSegmentation.h.

152 {
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 }
double radius() const
Return the radius correponding to the given module.

◆ projectLocX()

double Trk::TrapezoidSegmentation::projectLocX ( const Amg::Vector2D & localPos) const
private

Return the projected x value on the y=0.

Definition at line 159 of file TrapezoidSegmentation.h.

159 {
160 return -radius()*tan(asin(sinStereoLocal(localPos)));
161 }

◆ radius()

double Trk::TrapezoidSegmentation::radius ( ) const
private

Return the radius correponding to the given module.

Definition at line 138 of file TrapezoidSegmentation.h.

139 {
140 return m_activeBounds->halflengthY()/(m_activeBounds->maxHalflengthX() - m_activeBounds->minHalflengthX())*(m_activeBounds->maxHalflengthX() + m_activeBounds->minHalflengthX());
141 }

◆ sinStereoLocal()

double Trk::TrapezoidSegmentation::sinStereoLocal ( const Amg::Vector2D & localPos) const
private

Return the local sinStereo.

Definition at line 143 of file TrapezoidSegmentation.h.

143 {
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 }
@ x
Definition ParamDefs.h:55
@ y
Definition ParamDefs.h:56

Member Data Documentation

◆ m_activeBounds

std::shared_ptr<const TrapezoidBounds> Trk::TrapezoidSegmentation::m_activeBounds
private

Definition at line 102 of file TrapezoidSegmentation.h.

◆ m_binsX

size_t Trk::TrapezoidSegmentation::m_binsX
private

Definition at line 104 of file TrapezoidSegmentation.h.

◆ m_binsY

size_t Trk::TrapezoidSegmentation::m_binsY
private

Definition at line 105 of file TrapezoidSegmentation.h.

◆ m_binUtility

BinUtility* Trk::TrapezoidSegmentation::m_binUtility
private

Definition at line 103 of file TrapezoidSegmentation.h.


The documentation for this class was generated from the following files: