21 size_t numCellsX,
size_t numCellsY) :
22 m_activeBounds(std::move(mBounds)),
23 m_binUtility(nullptr),
34 (*m_binUtility) += yBinUtility;
42 m_activeBounds(std::move(mBounds)),
43 m_binUtility(nullptr),
53 int numCellsYinChip =
numCellsY/numberOfChip;
56 std::vector<float> boundaries;
58 boundaries.push_back(
begin);
60 for (
int i = 0;
i< numberOfChip;
i++){
64 boundaries.insert(boundaries.end(), SmallBinUtility.
binningData().at(0).boundaries.begin(), SmallBinUtility.
binningData().at(0).boundaries.end());
65 boundaries.push_back(
end);
74 throw std::runtime_error(
"RectangularSegmentation: invalid numCellsY");
79 (*m_binUtility) += yBinUtility;
94 std::vector< std::shared_ptr< const Trk::Surface> >& segmentationSurfacesX,
95 std::vector< std::shared_ptr< const Trk::Surface> >& segmentationSurfacesY,
98 double lorentzAngle)
const
101 double lorentzAngleTan =
std::tan(lorentzAngle);
102 double lorentzPlaneShiftX = halfThickness*lorentzAngleTan;
108 std::shared_ptr<Trk::SurfaceBounds> moduleBounds = std::make_shared<Trk::RectangleBounds>(m_activeBounds->halflengthX(),m_activeBounds->halflengthY());
113 std::shared_ptr<Trk::SurfaceBounds> readoutPlaneBounds = moduleBounds;
114 std::shared_ptr<Trk::SurfaceBounds> counterPlaneBounds(
nullptr);
116 readoutPlaneTransform.translation() =
Amg::Vector3D(0.,0.,readoutDirection*halfThickness);
118 if (lorentzAngle == 0.){
119 counterPlaneBounds = moduleBounds;
120 counterPlaneTransform.translation() =
Amg::Vector3D(0.,0.,-readoutDirection*halfThickness);
123 double lorentzReducedHalfX = m_activeBounds->halflengthX() - std::abs(lorentzPlaneShiftX);
124 std::shared_ptr<Trk::SurfaceBounds> lorentzReducedBounds(std::make_shared<Trk::RectangleBounds>(lorentzReducedHalfX,m_activeBounds->halflengthY()));
125 counterPlaneBounds = lorentzReducedBounds;
127 double counterPlaneShift = -readoutDirection*lorentzPlaneShiftX;
128 counterPlaneTransform.translation() =
Amg::Vector3D(counterPlaneShift,0.,-readoutDirection*halfThickness);
131 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(readoutPlaneTransform,readoutPlaneBounds));
132 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(counterPlaneTransform,counterPlaneBounds));
136 double pitchX = 2.*m_activeBounds->halflengthX()/m_binsX;
139 std::shared_ptr<Trk::SurfaceBounds> xBinBounds(std::make_shared<Trk::RectangleBounds>(m_activeBounds->halflengthY(),halfThickness));
141 double lorentzPlaneHalfX = std::abs(halfThickness/
std::cos(lorentzAngle));
143 std::shared_ptr<Trk::SurfaceBounds> lorentzPlaneBounds = (lorentzAngle==0.) ? xBinBounds :
144 std::shared_ptr<Trk::SurfaceBounds>(std::make_shared<Trk::RectangleBounds>(m_activeBounds->halflengthY(),lorentzPlaneHalfX));
148 xBinRotationMatrix.col(0) = Amg::Vector3D::UnitY();
149 xBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
150 xBinRotationMatrix.col(2) = Amg::Vector3D::UnitX();
153 xBinRotationMatrix *
Amg::AngleAxis3D(lorentzAngle, Amg::Vector3D::UnitX()) : xBinRotationMatrix;
156 segmentationSurfacesX.reserve(m_binsX);
157 for (
size_t ibinx = 0; ibinx <= m_binsX; ++ibinx){
159 double cPosX = -m_activeBounds->halflengthX()+ibinx*pitchX;
161 if (!ibinx || ibinx == m_binsX){
163 bool boundaryStraight = (lorentzAngle == 0. || (!ibinx && readoutDirection*lorentzAngle > 0.) || (ibinx==m_binsX && readoutDirection*lorentzAngle < 0));
166 const Amg::RotationMatrix3D& boundaryXRotation = boundaryStraight ? xBinRotationMatrix : lorentzPlaneRotationMatrix;
170 std::shared_ptr<Trk::SurfaceBounds> boundaryXBounds = boundaryStraight ? xBinBounds : lorentzPlaneBounds;
172 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(boundaryXTransform,boundaryXBounds));
176 Amg::Vector3D lorentzPlanePosition(cPosX-readoutDirection*lorentzPlaneShiftX, 0., 0.);
179 segmentationSurfacesX.push_back(std::make_shared<Trk::PlaneSurface>(lorentzPlaneTransform,lorentzPlaneBounds));
186 yBinRotationMatrix.col(0) = Amg::Vector3D::UnitX();
187 yBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
191 std::shared_ptr<Trk::SurfaceBounds> yBinBounds(std::make_shared<Trk::RectangleBounds>(m_activeBounds->halflengthX(),halfThickness));
193 segmentationSurfacesY.reserve(m_binsY);
194 for (
size_t ibiny = 0; ibiny <= m_binsY; ++ibiny){
197 double binPosY = m_binUtility->binningData().at(1).boundaries[ibiny];
201 if (ibiny == 0 || ibiny == m_binsY)
202 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(binTransform,yBinBounds));
204 segmentationSurfacesY.push_back(std::make_shared<const Trk::PlaneSurface>(binTransform,yBinBounds));
213 double bX = m_binsX ? m_binUtility->binPosition(dCell.first,0.,0) : 0.;
214 double bY = m_binsY ? m_binUtility->binPosition(dCell.second,0.,1) : 0.;
222 double halfThickness,
223 int readoutDirection,
224 double lorentzAngle)
const
229 double driftInZ = halfThickness-readoutDirection*stepCenter.z();
231 double driftLength = driftInZ/
cos(lorentzAngle);
233 double lorentzDeltaX = readoutDirection*driftInZ*
tan(lorentzAngle);
235 Amg::Vector2D stepCenterProjected(stepCenter.x()+lorentzDeltaX,stepCenter.y());
240 return Trk::DigitizationStep((endStep-startStep).
mag(),driftLength,dCell,startStep,endStep,stepCenterProjected,cellCenter);