Create the segmentation surfaces in X.
95{
96
97 double lorentzAngleTan = std::tan(lorentzAngle);
98 double lorentzPlaneShiftX = halfThickness*lorentzAngleTan;
99
100
101
102
103
105
108
109 std::shared_ptr<Trk::SurfaceBounds> readoutPlaneBounds =
moduleBounds;
110 std::shared_ptr<Trk::SurfaceBounds> counterPlaneBounds(nullptr);
111
112 readoutPlaneTransform.translation() =
Amg::Vector3D(0.,0.,readoutDirection*halfThickness);
113
114 if (lorentzAngle == 0.){
116 counterPlaneTransform.translation() =
Amg::Vector3D(0.,0.,-readoutDirection*halfThickness);
117 } else {
118
119 double lorentzReducedHalfX =
m_activeBounds->halflengthX() - std::abs(lorentzPlaneShiftX);
120 std::shared_ptr<Trk::SurfaceBounds> lorentzReducedBounds(std::make_shared<Trk::RectangleBounds>(lorentzReducedHalfX,
m_activeBounds->halflengthY()));
121 counterPlaneBounds = std::move(lorentzReducedBounds);
122
123 double counterPlaneShift = -readoutDirection*lorentzPlaneShiftX;
124 counterPlaneTransform.translation() =
Amg::Vector3D(counterPlaneShift,0.,-readoutDirection*halfThickness);
125 }
126
127 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(readoutPlaneTransform,readoutPlaneBounds));
128 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(counterPlaneTransform,counterPlaneBounds));
129
130
131
133
134
135 std::shared_ptr<Trk::SurfaceBounds> xBinBounds(std::make_shared<Trk::RectangleBounds>(
m_activeBounds->halflengthY(),halfThickness));
136
137 double lorentzPlaneHalfX = std::abs(halfThickness/std::cos(lorentzAngle));
138
139 std::shared_ptr<Trk::SurfaceBounds> lorentzPlaneBounds = (lorentzAngle==0.) ? xBinBounds :
140 std::shared_ptr<
Trk::SurfaceBounds>(std::make_shared<
Trk::RectangleBounds>(
m_activeBounds->halflengthY(),lorentzPlaneHalfX));
141
142
144 xBinRotationMatrix.col(0) = Amg::Vector3D::UnitY();
145 xBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
146 xBinRotationMatrix.col(2) = Amg::Vector3D::UnitX();
147
149 xBinRotationMatrix *
Amg::AngleAxis3D(lorentzAngle, Amg::Vector3D::UnitX()) : xBinRotationMatrix;
150
151
152 segmentationSurfacesX.reserve(
m_binsX);
153 for (
size_t ibinx = 0; ibinx <=
m_binsX; ++ibinx){
154
156
157 if (!ibinx || ibinx ==
m_binsX){
158
159 bool boundaryStraight = (lorentzAngle == 0. || (!ibinx && readoutDirection*lorentzAngle > 0.) || (ibinx==
m_binsX && readoutDirection*lorentzAngle < 0));
160
162 const Amg::RotationMatrix3D& boundaryXRotation = boundaryStraight ? xBinRotationMatrix : lorentzPlaneRotationMatrix;
163
165
166 std::shared_ptr<Trk::SurfaceBounds> boundaryXBounds = boundaryStraight ? xBinBounds : lorentzPlaneBounds;
167
168 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(boundaryXTransform,boundaryXBounds));
169
170 } else {
171
172 Amg::Vector3D lorentzPlanePosition(cPosX-readoutDirection*lorentzPlaneShiftX, 0., 0.);
174
175 segmentationSurfacesX.push_back(std::make_shared<Trk::PlaneSurface>(lorentzPlaneTransform,lorentzPlaneBounds));
176 }
177 }
178
179
180
182 yBinRotationMatrix.col(0) = Amg::Vector3D::UnitX();
183 yBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
185
186
187 std::shared_ptr<Trk::SurfaceBounds> yBinBounds(std::make_shared<Trk::RectangleBounds>(
m_activeBounds->halflengthX(),halfThickness));
188
189 segmentationSurfacesY.reserve(
m_binsY);
190 for (
size_t ibiny = 0; ibiny <=
m_binsY; ++ibiny){
191
192
193 double binPosY =
m_binUtility->binningData().at(1).boundaries[ibiny];
196
197 if (ibiny == 0 || ibiny ==
m_binsY)
198 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(binTransform,yBinBounds));
199 else
200 segmentationSurfacesY.push_back(std::make_shared<const Trk::PlaneSurface>(binTransform,yBinBounds));
201 }
202}
const SurfaceBounds & moduleBounds() const override
return the surface bounds by reference
Eigen::AngleAxisd AngleAxis3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Amg::Transform3D getTransformFromRotTransl(Amg::RotationMatrix3D rot, Amg::Vector3D transl_vec)
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D