48 namespace EventDataView3DTest {
55 std::normal_distribution<double>
gauss(0., 1.);
70 auto identity = Transform3D::Identity();
73 auto rectangle = std::make_shared<RectangleBounds>(15., 15.);
76 double momentumScale = 0.005;
77 double localErrorScale = 10.;
78 double directionErrorScale = 100.;
82 std::array<double, 6> pars_array = {
83 {-0.1234, 4.8765, 0.45, 0.128, 0.001, 21.}};
86 BoundTrackParameters::ParametersVector::Zero();
87 pars << pars_array[0], pars_array[1], pars_array[2], pars_array[3],
88 pars_array[4], pars_array[5];
91 cov << 0.25, 0.0042, -0.00076, 6.156e-06, -2.11e-07, 0, 0.0042, 0.859,
92 -0.000173, 0.000916, -4.017e-08, 0, -0.00076, -0.000173, 2.36e-04,
93 -2.76e-07, 1.12e-08, 0, 6.15e-06, 0.000916, -2.76e-07, 8.84e-04,
94 -2.85e-11, 0, -2.11 - 07, -4.017e-08, 1.123e-08, -2.85 - 11, 1.26e-10, 0,
99 momentumScale, localErrorScale, directionErrorScale, pcolor, scolor);
101 helper.
write(
"EventData_BoundAtPlaneParameters");
108 std::stringstream ss;
117 double rotationAngle = 90_degree;
118 Vector3D xPos(
cos(rotationAngle), 0., sin(rotationAngle));
120 Vector3D zPos(-sin(rotationAngle), 0.,
cos(rotationAngle));
121 rotation.col(0) = xPos;
122 rotation.col(1) = yPos;
123 rotation.col(2) = zPos;
127 std::make_shared<const RectangleBounds>(
RectangleBounds(0.1_m, 0.1_m));
131 const auto surfaceMaterial =
132 std::make_shared<HomogeneousSurfaceMaterial>(matProp);
135 std::vector<Vector3D> translations;
136 translations.reserve(6);
137 translations.push_back({-500_mm, 0., 0.});
138 translations.push_back({-300_mm, 0., 0.});
139 translations.push_back({-100_mm, 0., 0.});
140 translations.push_back({100_mm, 0., 0.});
141 translations.push_back({300_mm, 0., 0.});
142 translations.push_back({500_mm, 0., 0.});
145 std::vector<CuboidVolumeBuilder::LayerConfig> lConfs;
148 for (i = 0; i < translations.size(); i++) {
153 sConf.
surMat = surfaceMaterial;
158 std::shared_ptr<const RectangleBounds> bounds,
double thickness) {
163 lConfs.push_back(lConf);
169 vConf.
length = {1.2_m, 1._m, 1._m};
171 vConf.
name =
"Tracker";
176 conf.
length = {1.2_m, 1._m, 1._m};
180 std::cout <<
"Build the detector" << std::endl;
185 [=](
const auto& context,
const auto& inner,
const auto& vb) {
189 std::shared_ptr<const TrackingGeometry>
detector =
193 std::vector<const Surface*> surfaces;
197 std::cout <<
"surface " << surface->
geometryId() <<
" placed at: ("
198 << surface->
center(tgContext).transpose() <<
" )" << std::endl;
199 surfaces.push_back(surface);
202 std::cout <<
"There are " << surfaces.size() <<
" surfaces" << std::endl;
206 std::cout <<
"Creating measurements:" << std::endl;
207 std::vector<FittableMeasurement<SourceLink>> measurements;
208 measurements.reserve(6);
210 std::array<double, 2> resolution = {30_um, 50_um};
214 for (
const auto& surface : surfaces) {
221 measurements.push_back(std::move(m01));
225 std::vector<SourceLink> sourcelinks;
227 std::back_inserter(sourcelinks),
231 std::cout <<
"Construct KalmanFitter and perform fit" << std::endl;
240 RecoStepper rStepper(bField);
242 RecoPropagator rPropagator(rStepper, rNavigator);
246 cov << std::pow(100_um, 2), 0., 0., 0., 0., 0., 0., std::pow(100_um, 2), 0.,
247 0., 0., 0., 0., 0., 0.025, 0., 0., 0., 0., 0., 0., 0.025, 0., 0., 0., 0.,
248 0., 0., 0.01, 0., 0., 0., 0., 0., 0., 1.;
268 auto fitRes = kFitter.
fit(sourcelinks, rStart, kfOptions);
269 if (not fitRes.ok()) {
270 std::cout <<
"Fit failed" << std::endl;
273 auto& fittedTrack = *fitRes;
276 std::cout <<
"Draw the fitted track" << std::endl;
277 double momentumScale = 15;
278 double localErrorScale = 100.;
279 double directionErrorScale = 500000;
292 helper, fittedTrack.fittedStates, fittedTrack.trackTip, tgContext,
293 momentumScale, localErrorScale, directionErrorScale, scolor, mcolor,
294 ppcolor, fpcolor, spcolor);
296 helper.
write(
"EventData_MultiTrajectory");