17 std::unique_ptr<const Acts::Logger> logger)
18 : m_cfg(cfg), m_logger(std::move(logger)) {}
24 std::lock_guard<std::mutex> alignmentLock(m_alignmentMutex);
27 unsigned int iov = context.
eventNumber / m_cfg.iovSize;
29 if (m_cfg.randomNumberSvc !=
nullptr) {
31 if (m_iovStatus.size() == 0 or m_iovStatus.size() < iov or
33 auto cios = m_iovStatus.size();
35 <<
", emulate new alignment.");
37 << iov <<
", curently valid: " << cios);
39 for (
unsigned int ic = cios; ic <= iov; ++ic) {
40 m_iovStatus.push_back(
false);
44 RandomEngine rng = m_cfg.randomNumberSvc->spawnGenerator(context);
45 std::normal_distribution<double>
gauss(0., 1.);
48 for (
auto& lstore : m_cfg.detectorStore) {
49 for (
auto& ldet : lstore) {
51 auto& tForm = ldet->nominalTransform(context.
geoContext);
53 auto atForm = std::make_unique<Acts::Transform3D>(tForm);
54 if (iov != 0 or not m_cfg.firstIovNominal) {
56 double tx = m_cfg.gSigmaX != 0 ? m_cfg.gSigmaX *
gauss(rng) : 0.;
57 double ty = m_cfg.gSigmaY != 0 ? m_cfg.gSigmaY *
gauss(rng) : 0.;
58 double tz = m_cfg.gSigmaZ != 0 ? m_cfg.gSigmaZ *
gauss(rng) : 0.;
60 if (tx != 0. or ty != 0. or tz != 0.) {
61 const auto& tMatrix = atForm->matrix();
62 auto colX = tMatrix.block<3, 1>(0, 0).transpose();
63 auto colY = tMatrix.block<3, 1>(0, 1).transpose();
64 auto colZ = tMatrix.block<3, 1>(0, 2).transpose();
66 tx * colX + ty * colY + tz * colZ;
67 atForm->translation() = newCenter;
70 if (m_cfg.aSigmaX != 0.) {
72 Acts::Vector3D::UnitX());
74 if (m_cfg.aSigmaY != 0.) {
76 Acts::Vector3D::UnitY());
78 if (m_cfg.aSigmaZ != 0.) {
80 Acts::Vector3D::UnitZ());
84 ldet->addAlignedTransform(std::move(atForm), iov);
89 m_iovStatus[iov] =
true;
94 std::make_any<AlignedDetectorElement::ContextType>(alignedContext);