ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PayloadDecorator.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PayloadDecorator.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
10 
13 
16  std::unique_ptr<const Acts::Logger> logger)
17  : m_cfg(cfg), m_logger(std::move(logger)) {
18  if (m_cfg.trackingGeometry != nullptr) {
19  // parse and populate
21  }
22 }
23 
26  // Start with the nominal map
27  std::vector<Acts::Transform3D> aStore = m_nominalStore;
28 
29  ACTS_VERBOSE("New IOV detected, emulate new alignment");
30  if (context.eventNumber % m_cfg.iovSize) {
31  for (auto& tf : aStore) {
32  tf *= Acts::AngleAxis3D(m_cfg.rotationStep * context.eventNumber,
33  Acts::Vector3D::UnitY());
34  }
35  // This creates a full payload context, i.e. the nominal store
36  PayloadDetectorElement::ContextType alignableGeoContext;
37  alignableGeoContext.alignmentStore = std::move(aStore);
38  context.geoContext =
39  std::make_any<PayloadDetectorElement::ContextType>(alignableGeoContext);
40  }
41  return ProcessCode::SUCCESS;
42 }
43 
46  // Double-visit - first count
47  size_t nTransforms = 0;
48  tGeometry.visitSurfaces([&nTransforms](const auto*) { ++nTransforms; });
49 
51 
52  // Collect the surfacas into the nominal store
53  std::vector<Acts::Transform3D> aStore(nTransforms,
54  Acts::Transform3D::Identity());
55 
56  auto fillTransforms = [&aStore, &nominalCtx](const auto* surface) -> void {
57  auto alignableElement = dynamic_cast<const PayloadDetectorElement*>(
58  surface->associatedDetectorElement());
59  aStore[alignableElement->identifier()] = surface->transform(nominalCtx);
60  };
61 
62  tGeometry.visitSurfaces(fillTransforms);
63  m_nominalStore = std::move(aStore);
64 }