22 size_t numCellsX,
size_t numCellsY) :
23 m_activeBounds(std::move(mBounds)),
24 m_binUtility(nullptr),
35 (*m_binUtility) += yBinUtility;
43 m_activeBounds(std::move(mBounds)),
44 m_binUtility(nullptr),
54 int numCellsYinChip =
numCellsY/numberOfChip;
57 std::vector<float> boundaries;
59 boundaries.push_back(
begin);
61 for (
int i = 0;
i< numberOfChip;
i++){
65 boundaries.insert(boundaries.end(), SmallBinUtility.
binningData().at(0).boundaries.begin(), SmallBinUtility.
binningData().at(0).boundaries.end());
66 boundaries.push_back(
end);
75 throw std::runtime_error(
"RectangularSegmentation: invalid numCellsY");
80 (*m_binUtility) += yBinUtility;
95 std::vector< std::shared_ptr< const Trk::Surface> >& segmentationSurfacesX,
96 std::vector< std::shared_ptr< const Trk::Surface> >& segmentationSurfacesY,
99 double lorentzAngle)
const
102 double lorentzAngleTan =
std::tan(lorentzAngle);
103 double lorentzPlaneShiftX = halfThickness*lorentzAngleTan;
117 readoutPlaneTransform.translation() =
Amg::Vector3D(0.,0.,readoutDirection*halfThickness);
119 if (lorentzAngle == 0.){
120 counterPlaneBounds = moduleBounds;
121 counterPlaneTransform.translation() =
Amg::Vector3D(0.,0.,-readoutDirection*halfThickness);
124 double lorentzReducedHalfX = m_activeBounds->halflengthX() - std::abs(lorentzPlaneShiftX);
126 counterPlaneBounds = lorentzReducedBounds;
128 double counterPlaneShift = -readoutDirection*lorentzPlaneShiftX;
129 counterPlaneTransform.translation() =
Amg::Vector3D(counterPlaneShift,0.,-readoutDirection*halfThickness);
132 boundarySurfaces.push_back(std::make_shared<Trk::PlaneSurface>(readoutPlaneTransform,readoutPlaneBounds));
133 boundarySurfaces.push_back(std::make_shared<Trk::PlaneSurface>(counterPlaneTransform,counterPlaneBounds));
137 double pitchX = 2.*m_activeBounds->halflengthX()/m_binsX;
142 double lorentzPlaneHalfX = std::abs(halfThickness/
std::cos(lorentzAngle));
149 xBinRotationMatrix.col(0) = Amg::Vector3D::UnitY();
150 xBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
151 xBinRotationMatrix.col(2) = Amg::Vector3D::UnitX();
154 xBinRotationMatrix *
Amg::AngleAxis3D(lorentzAngle, Amg::Vector3D::UnitX()) : xBinRotationMatrix;
157 segmentationSurfacesX.reserve(m_binsX);
158 for (
size_t ibinx = 0; ibinx <= m_binsX; ++ibinx){
160 double cPosX = -m_activeBounds->halflengthX()+ibinx*pitchX;
162 if (!ibinx || ibinx == m_binsX){
164 bool boundaryStraight = (lorentzAngle == 0. || (!ibinx && readoutDirection*lorentzAngle > 0.) || (ibinx==m_binsX && readoutDirection*lorentzAngle < 0));
167 const Amg::RotationMatrix3D& boundaryXRotation = boundaryStraight ? xBinRotationMatrix : lorentzPlaneRotationMatrix;
173 boundarySurfaces.push_back(std::shared_ptr<const Trk::PlaneSurface>(
new Trk::PlaneSurface(boundaryXTransform,boundaryXBounds)));
177 Amg::Vector3D lorentzPlanePosition(cPosX-readoutDirection*lorentzPlaneShiftX, 0., 0.);
180 segmentationSurfacesX.push_back(std::make_shared<Trk::PlaneSurface>(lorentzPlaneTransform,lorentzPlaneBounds));
187 yBinRotationMatrix.col(0) = Amg::Vector3D::UnitX();
188 yBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
194 segmentationSurfacesY.reserve(m_binsY);
195 for (
size_t ibiny = 0; ibiny <= m_binsY; ++ibiny){
198 double binPosY = m_binUtility->binningData().at(1).boundaries[ibiny];
202 if (ibiny == 0 || ibiny == m_binsY)
203 boundarySurfaces.push_back(std::make_shared<Trk::PlaneSurface>(binTransform,yBinBounds));
205 segmentationSurfacesY.push_back(std::make_shared<Trk::PlaneSurface>(binTransform,yBinBounds));
214 double bX = m_binsX ? m_binUtility->binPosition(dCell.first,0.,0) : 0.;
215 double bY = m_binsY ? m_binUtility->binPosition(dCell.second,0.,1) : 0.;
223 double halfThickness,
224 int readoutDirection,
225 double lorentzAngle)
const
230 double driftInZ = halfThickness-readoutDirection*stepCenter.z();
232 double driftLength = driftInZ/
cos(lorentzAngle);
234 double lorentzDeltaX = readoutDirection*driftInZ*
tan(lorentzAngle);
236 Amg::Vector2D stepCenterProjected(stepCenter.x()+lorentzDeltaX,stepCenter.y());
241 return Trk::DigitizationStep((endStep-startStep).
mag(),driftLength,dCell,startStep,endStep,stepCenterProjected,cellCenter);