File indexing completed on 2025-01-31 09:16:52
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "ActsExamples/ContextualDetector/AlignedDetector.hpp"
0010
0011 #include "Acts/Geometry/GeometryContext.hpp"
0012 #include "Acts/Utilities/Logger.hpp"
0013 #include "ActsExamples/ContextualDetector/AlignmentDecorator.hpp"
0014 #include "ActsExamples/ContextualDetector/ExternalAlignmentDecorator.hpp"
0015 #include "ActsExamples/ContextualDetector/ExternallyAlignedDetectorElement.hpp"
0016 #include "ActsExamples/ContextualDetector/InternalAlignmentDecorator.hpp"
0017 #include "ActsExamples/ContextualDetector/InternallyAlignedDetectorElement.hpp"
0018 #include "ActsExamples/Framework/RandomNumbers.hpp"
0019 #include "ActsExamples/GenericDetector/BuildGenericDetector.hpp"
0020
0021 #include <memory>
0022
0023 namespace ActsExamples {
0024
0025 AlignedDetector::AlignedDetector(const Config& cfg)
0026 : Detector(Acts::getDefaultLogger("AlignedDetector", cfg.logLevel)),
0027 m_cfg(cfg) {
0028 if (m_cfg.mode == Config::Mode::External) {
0029 InternallyAlignedDetectorElement::ContextType nominalContext;
0030 m_nominalGeometryContext = Acts::GeometryContext(nominalContext);
0031 } else {
0032 InternallyAlignedDetectorElement::ContextType nominalContext;
0033 nominalContext.nominal = true;
0034 m_nominalGeometryContext = Acts::GeometryContext(nominalContext);
0035 }
0036
0037
0038 RandomNumbers::Config randomNumberConfig;
0039 randomNumberConfig.seed = m_cfg.seed;
0040 auto randomNumberSvc = std::make_shared<RandomNumbers>(randomNumberConfig);
0041
0042 auto fillDecoratorConfig = [&](AlignmentDecorator::Config& config) {
0043 config.iovSize = m_cfg.iovSize;
0044 config.flushSize = m_cfg.flushSize;
0045 config.doGarbageCollection = m_cfg.doGarbageCollection;
0046
0047
0048 config.gSigmaX = m_cfg.sigmaInPlane;
0049 config.gSigmaY = m_cfg.sigmaInPlane;
0050 config.gSigmaZ = m_cfg.sigmaOutPlane;
0051 config.aSigmaX = m_cfg.sigmaOutRot;
0052 config.aSigmaY = m_cfg.sigmaOutRot;
0053 config.aSigmaZ = m_cfg.sigmaInRot;
0054 config.randomNumberSvc = randomNumberSvc;
0055 config.firstIovNominal = m_cfg.firstIovNominal;
0056 };
0057
0058 if (m_cfg.mode == Config::Mode::External) {
0059 ExternalAlignmentDecorator::Config agcsConfig;
0060 fillDecoratorConfig(agcsConfig);
0061
0062 std::vector<std::vector<std::shared_ptr<ExternallyAlignedDetectorElement>>>
0063 specificDetectorStore;
0064
0065 m_trackingGeometry =
0066 Generic::buildDetector<ExternallyAlignedDetectorElement>(
0067 m_nominalGeometryContext, specificDetectorStore, m_cfg.buildLevel,
0068 m_cfg.materialDecorator, m_cfg.buildProto, m_cfg.surfaceLogLevel,
0069 m_cfg.layerLogLevel, m_cfg.volumeLogLevel);
0070 agcsConfig.trackingGeometry = m_trackingGeometry;
0071
0072
0073 for (auto& lstore : specificDetectorStore) {
0074 for (auto& ldet : lstore) {
0075 m_detectorStore.push_back(ldet);
0076 }
0077 }
0078
0079 m_contextDecorators.push_back(std::make_shared<ExternalAlignmentDecorator>(
0080 std::move(agcsConfig),
0081 Acts::getDefaultLogger("AlignmentDecorator", m_cfg.decoratorLogLevel)));
0082 } else {
0083 InternalAlignmentDecorator::Config agcsConfig;
0084 fillDecoratorConfig(agcsConfig);
0085
0086 m_trackingGeometry =
0087 Generic::buildDetector<InternallyAlignedDetectorElement>(
0088 m_nominalGeometryContext, agcsConfig.detectorStore,
0089 m_cfg.buildLevel, m_cfg.materialDecorator, m_cfg.buildProto,
0090 m_cfg.surfaceLogLevel, m_cfg.layerLogLevel, m_cfg.volumeLogLevel);
0091
0092
0093 for (auto& lstore : agcsConfig.detectorStore) {
0094 for (auto& ldet : lstore) {
0095 m_detectorStore.push_back(ldet);
0096 }
0097 }
0098
0099 m_contextDecorators.push_back(std::make_shared<InternalAlignmentDecorator>(
0100 std::move(agcsConfig),
0101 Acts::getDefaultLogger("AlignmentDecorator", m_cfg.decoratorLogLevel)));
0102 }
0103 }
0104
0105 }