51 namespace EventDataView3DTest {
55 std::normal_distribution<double>
gauss(0., 1.);
68 std::vector<const Surface*>& surfaces,
69 std::shared_ptr<const TrackingGeometry>&
detector,
70 const size_t nSurfaces = 7) {
71 using namespace UnitLiterals;
74 throw std::invalid_argument(
"At least 1 surfaces needs to be created.");
79 double rotationAngle = 90_degree;
80 Vector3 xPos(cos(rotationAngle), 0., sin(rotationAngle));
82 Vector3 zPos(-sin(rotationAngle), 0., cos(rotationAngle));
83 rotation.col(0) = xPos;
84 rotation.col(1) = yPos;
85 rotation.col(2) = zPos;
93 const auto surfaceMaterial =
94 std::make_shared<HomogeneousSurfaceMaterial>(matProp);
97 std::vector<Vector3> translations;
98 translations.reserve(nSurfaces);
99 for (
unsigned int i = 0;
i < nSurfaces;
i++) {
100 translations.push_back({
i * 100_mm - 300_mm, 0., 0.});
104 std::vector<CuboidVolumeBuilder::LayerConfig> lConfs;
105 lConfs.reserve(nSurfaces);
106 for (
unsigned int i = 0;
i < translations.size();
i++) {
111 sConf.
surMat = surfaceMaterial;
116 const std::shared_ptr<const RectangleBounds>&
bounds,
122 lConfs.push_back(lConf);
128 vConf.length = {1.2_m, 1._m, 1._m};
129 vConf.layerCfg = lConfs;
130 vConf.name =
"Tracker";
135 conf.length = {1.2_m, 1._m, 1._m};
136 conf.volumeCfg = {vConf};
139 std::cout <<
"Build the detector" << std::endl;
144 [=](
const auto& context,
const auto& inner,
const auto& vb) {
145 return cvb.trackingVolume(context, inner, vb);
151 surfaces.reserve(nSurfaces);
154 std::cout <<
"surface " << surface->
geometryId() <<
" placed at: ("
155 << surface->
center(tgContext).transpose() <<
" )" << std::endl;
156 surfaces.push_back(surface);
159 std::cout <<
"There are " << surfaces.size() <<
" surfaces" << std::endl;
168 std::stringstream ss;
174 auto identity = Transform3::Identity();
177 auto rectangle = std::make_shared<RectangleBounds>(15., 15.);
180 double momentumScale = 0.005;
181 double localErrorScale = 10.;
182 double directionErrorScale = 1000.;
186 std::array<double, 6> pars_array = {
187 {-0.1234, 4.8765, 0.45, 0.128, 0.001, 21.}};
190 BoundTrackParameters::ParametersVector::Zero();
191 pars << pars_array[0], pars_array[1], pars_array[2], pars_array[3],
192 pars_array[4], pars_array[5];
195 cov << 0.25, 0.0042, -0.00076, 6.156e-06, -2.11e-07, 0, 0.0042, 0.859,
196 -0.000173, 0.000916, -4.017e-08, 0, -0.00076, -0.000173, 2.36e-04,
197 -2.76e-07, 1.12e-08, 0, 6.15e-06, 0.000916, -2.76e-07, 8.84e-04,
198 -2.85e-11, 0, -2.11 - 07, -4.017e-08, 1.123e-08, -2.85 - 11, 1.26e-10, 0,
205 gctx, momentumScale, localErrorScale, directionErrorScale, pcolor,
208 helper.
write(
"EventData_BoundAtPlaneParameters");
220 using namespace UnitLiterals;
221 std::stringstream ss;
227 const size_t nSurfaces = 7;
228 std::vector<const Surface*> surfaces;
229 std::shared_ptr<const TrackingGeometry>
detector;
234 std::cout <<
"Creating measurements:" << std::endl;
235 std::vector<Test::TestSourceLink> sourcelinks;
236 sourcelinks.reserve(nSurfaces);
237 Vector2 lPosCenter{5_mm, 5_mm};
238 Vector2 resolution{200_um, 150_um};
239 SquareMatrix2 cov2D = resolution.cwiseProduct(resolution).asDiagonal();
240 for (
const auto&
surface : surfaces) {
249 double localErrorScale = 100.;
254 std::cout <<
"Draw the measurements" << std::endl;
256 for (
auto& singleMeasurement : sourcelinks) {
257 auto cov = singleMeasurement.covariance;
258 auto lposition = singleMeasurement.parameters;
260 auto surf =
detector->findSurface(singleMeasurement.m_geometryId);
264 localErrorScale, mcolor);
267 helper.
write(
"EventData_Measurement");
279 using namespace UnitLiterals;
280 std::stringstream ss;
288 const size_t nSurfaces = 7;
289 std::vector<const Surface*> surfaces;
290 std::shared_ptr<const TrackingGeometry>
detector;
295 std::cout <<
"Creating measurements:" << std::endl;
296 std::vector<Acts::SourceLink> sourcelinks;
297 sourcelinks.reserve(nSurfaces);
298 Vector2 lPosCenter{5_mm, 5_mm};
299 Vector2 resolution{200_um, 150_um};
300 SquareMatrix2 cov2D = resolution.cwiseProduct(resolution).asDiagonal();
301 for (
const auto&
surface : surfaces) {
311 std::cout <<
"Construct KalmanFitter and perform fit" << std::endl;
313 cfg.resolvePassive =
false;
314 cfg.resolveMaterial =
true;
315 cfg.resolveSensitive =
true;
319 auto bField = std::make_shared<ConstantBField>(
Vector3(0., 0., 0.));
321 RecoStepper rStepper(
bField);
323 RecoPropagator rPropagator(rStepper, rNavigator);
327 cov << std::pow(100_um, 2), 0., 0., 0., 0., 0., 0., std::pow(100_um, 2), 0.,
328 0., 0., 0., 0., 0., 0.0025, 0., 0., 0., 0., 0., 0., 0.0025, 0., 0., 0.,
329 0., 0., 0., 0.01, 0., 0., 0., 0., 0., 0., 1.;
348 .connect<&Test::testSourceLinkCalibrator<VectorMultiTrajectory>>();
358 .connect<&Test::TestSourceLink::SurfaceAccessor::operator()>(
368 auto fitRes = kFitter.
fit(sourcelinks.begin(), sourcelinks.end(), rStart,
370 if (not fitRes.ok()) {
371 std::cout <<
"Fit failed" << std::endl;
374 auto& track = *fitRes;
377 std::cout <<
"Draw the fitted track" << std::endl;
378 double momentumScale = 10;
379 double localErrorScale = 100.;
380 double directionErrorScale = 100000;
394 momentumScale, localErrorScale, directionErrorScale, scolor, mcolor,
395 ppcolor, fpcolor, spcolor);
397 helper.
write(
"EventData_MultiTrajectory");