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