22 size_t numCellsX,
size_t numCellsY) :
23 m_activeBounds(std::move(mBounds)),
24 m_binUtility(nullptr),
36 (*m_binUtility) += yBinUtility;
48 std::vector< std::shared_ptr< const Trk::Surface> >& segmentationSurfacesX,
49 std::vector< std::shared_ptr< const Trk::Surface> >& segmentationSurfacesY,
59 std::unique_ptr<Trk::TrapezoidBounds> moduleTrapBounds(
new Trk::TrapezoidBounds(m_activeBounds->minHalflengthX(),m_activeBounds->maxHalflengthX(),m_activeBounds->halflengthY()));
60 std::shared_ptr<const Trk::SurfaceBounds> moduleBounds(&*moduleTrapBounds);
65 const std::shared_ptr<const Trk::SurfaceBounds>& readoutPlaneBounds = moduleBounds;
66 std::shared_ptr<const Trk::SurfaceBounds> counterPlaneBounds(
nullptr);
68 readoutPlaneTransform.translation() =
Amg::Vector3D(0.,0.,readoutDirection*halfThickness);
70 counterPlaneBounds = moduleBounds;
71 counterPlaneTransform.translation() =
Amg::Vector3D(0.,0.,-readoutDirection*halfThickness);
74 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(readoutPlaneTransform,readoutPlaneBounds));
75 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(counterPlaneTransform,counterPlaneBounds));
79 double pitchX = 2.*(m_activeBounds->maxHalflengthX()+m_activeBounds->minHalflengthX())*0.5/m_binsX;
83 xBinRotationMatrix.col(0) = Amg::Vector3D::UnitY();
84 xBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
85 xBinRotationMatrix.col(2) = Amg::Vector3D::UnitX();
88 segmentationSurfacesX.reserve(m_binsX);
89 for (
size_t ibinx = 0; ibinx <= m_binsX; ++ibinx){
91 double cPosX = -(m_activeBounds->minHalflengthX()+m_activeBounds->maxHalflengthX())*0.5+ibinx*pitchX;
95 double stereoLocal = asin(sinStereoLocal(
Amg::Vector2D(cPosX, 0.)));
100 auto xBinBounds = std::make_unique<Trk::RectangleBounds>(m_activeBounds->halflengthY()/
cos(stereoLocal),halfThickness);
102 if (ibinx==0 || ibinx == m_binsX)
103 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(binTransform,&*xBinBounds));
105 segmentationSurfacesX.push_back(std::make_shared<const Trk::PlaneSurface>(binTransform,&*xBinBounds));
111 yBinRotationMatrix.col(0) = Amg::Vector3D::UnitX();
112 yBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
115 double pitchY = 2.*m_activeBounds->halflengthY()/m_binsY;
117 segmentationSurfacesY.reserve(m_binsY);
118 for (
size_t ibiny = 0; ibiny <= m_binsY; ++ibiny){
120 double binPosY = -m_activeBounds->halflengthY()+ibiny*pitchY;
123 auto yBinBounds = std::make_unique<Trk::RectangleBounds>(localPitchX*m_binsX*0.5,halfThickness);
126 if (ibiny == 0 || ibiny == m_binsY)
127 boundarySurfaces.push_back(std::make_shared<Trk::PlaneSurface>(binTransform,&*yBinBounds));
129 segmentationSurfacesY.push_back(std::make_shared<Trk::PlaneSurface>(binTransform,&*yBinBounds));
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.;
146 double halfThickness,
147 int readoutDirection,
148 double lorentzAngle)
const
153 double lorentzDeltaX = -readoutDirection*stepCenter.z()*
std::tan(lorentzAngle);
155 double driftInZ = (halfThickness-readoutDirection*stepCenter.z());
156 double driftLength = std::abs(driftInZ/
std::cos(lorentzAngle));
158 Amg::Vector2D stepCenterProjected(stepCenter.x()+lorentzDeltaX,stepCenter.y());
163 return Trk::DigitizationStep((endStep-startStep).
mag(),driftLength,dCell,startStep,endStep,stepCenterProjected,cellCenter);