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