Create the segmentation surfaces in X.
99{
100
101 double lorentzAngleTan = std::tan(lorentzAngle);
102 double lorentzPlaneShiftX = halfThickness*lorentzAngleTan;
103
104
105
106
107
109
112
113 std::shared_ptr<Trk::SurfaceBounds> readoutPlaneBounds =
moduleBounds;
114 std::shared_ptr<Trk::SurfaceBounds> counterPlaneBounds(nullptr);
115
116 readoutPlaneTransform.translation() =
Amg::Vector3D(0.,0.,readoutDirection*halfThickness);
117
118 if (lorentzAngle == 0.){
120 counterPlaneTransform.translation() =
Amg::Vector3D(0.,0.,-readoutDirection*halfThickness);
121 } else {
122
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;
126
127 double counterPlaneShift = -readoutDirection*lorentzPlaneShiftX;
128 counterPlaneTransform.translation() =
Amg::Vector3D(counterPlaneShift,0.,-readoutDirection*halfThickness);
129 }
130
131 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(readoutPlaneTransform,readoutPlaneBounds));
132 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(counterPlaneTransform,counterPlaneBounds));
133
134
135
137
138
139 std::shared_ptr<Trk::SurfaceBounds> xBinBounds(std::make_shared<Trk::RectangleBounds>(
m_activeBounds->halflengthY(),halfThickness));
140
141 double lorentzPlaneHalfX = std::abs(halfThickness/std::cos(lorentzAngle));
142
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));
145
146
148 xBinRotationMatrix.col(0) = Amg::Vector3D::UnitY();
149 xBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
150 xBinRotationMatrix.col(2) = Amg::Vector3D::UnitX();
151
153 xBinRotationMatrix *
Amg::AngleAxis3D(lorentzAngle, Amg::Vector3D::UnitX()) : xBinRotationMatrix;
154
155
156 segmentationSurfacesX.reserve(
m_binsX);
157 for (
size_t ibinx = 0; ibinx <=
m_binsX; ++ibinx){
158
160
161 if (!ibinx || ibinx ==
m_binsX){
162
163 bool boundaryStraight = (lorentzAngle == 0. || (!ibinx && readoutDirection*lorentzAngle > 0.) || (ibinx==
m_binsX && readoutDirection*lorentzAngle < 0));
164
166 const Amg::RotationMatrix3D& boundaryXRotation = boundaryStraight ? xBinRotationMatrix : lorentzPlaneRotationMatrix;
167
169
170 std::shared_ptr<Trk::SurfaceBounds> boundaryXBounds = boundaryStraight ? xBinBounds : lorentzPlaneBounds;
171
172 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(boundaryXTransform,boundaryXBounds));
173
174 } else {
175
176 Amg::Vector3D lorentzPlanePosition(cPosX-readoutDirection*lorentzPlaneShiftX, 0., 0.);
178
179 segmentationSurfacesX.push_back(std::make_shared<Trk::PlaneSurface>(lorentzPlaneTransform,lorentzPlaneBounds));
180 }
181 }
182
183
184
186 yBinRotationMatrix.col(0) = Amg::Vector3D::UnitX();
187 yBinRotationMatrix.col(1) = Amg::Vector3D::UnitZ();
189
190
191 std::shared_ptr<Trk::SurfaceBounds> yBinBounds(std::make_shared<Trk::RectangleBounds>(
m_activeBounds->halflengthX(),halfThickness));
192
193 segmentationSurfacesY.reserve(
m_binsY);
194 for (
size_t ibiny = 0; ibiny <=
m_binsY; ++ibiny){
195
196
197 double binPosY =
m_binUtility->binningData().at(1).boundaries[ibiny];
200
201 if (ibiny == 0 || ibiny ==
m_binsY)
202 boundarySurfaces.push_back(std::make_shared<const Trk::PlaneSurface>(binTransform,yBinBounds));
203 else
204 segmentationSurfacesY.push_back(std::make_shared<const Trk::PlaneSurface>(binTransform,yBinBounds));
205 }
206}
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