Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-19 09:23:37

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2022 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/EventData/MultiTrajectory.hpp"
0012 #include "Acts/Geometry/GeometryContext.hpp"
0013 #include "Acts/MagneticField/MagneticFieldContext.hpp"
0014 #include "Acts/Propagator/MultiEigenStepperLoop.hpp"
0015 #include "Acts/Propagator/Propagator.hpp"
0016 #include "Acts/TrackFitting/detail/VoidFitterComponents.hpp"
0017 #include "Acts/Utilities/CalibrationContext.hpp"
0018 #include "Acts/Utilities/Delegate.hpp"
0019 #include "Acts/Utilities/Logger.hpp"
0020 
0021 namespace Acts {
0022 
0023 /// @enum ComponentMergeMethod
0024 ///
0025 /// Available reduction methods for the reduction of a Gaussian mixture
0026 enum class ComponentMergeMethod { eMean, eMaxWeight };
0027 
0028 /// @struct GsfComponent
0029 ///
0030 /// Encapsulates a component of a Gaussian mixture as used by the GSF
0031 struct GsfComponent {
0032   ActsScalar weight = 0;
0033   BoundVector boundPars = BoundVector::Zero();
0034   BoundSquareMatrix boundCov = BoundSquareMatrix::Identity();
0035 };
0036 
0037 namespace GsfConstants {
0038 constexpr std::string_view kFinalMultiComponentStateColumn =
0039     "gsf-final-multi-component-state";
0040 using FinalMultiComponentState =
0041     std::optional<Acts::MultiComponentBoundTrackParameters>;
0042 constexpr std::string_view kFwdSumMaterialXOverX0 =
0043     "gsf-fwd-sum-material-x-over-x0";
0044 constexpr std::string_view kFwdMaxMaterialXOverX0 =
0045     "gsf-fwd-max-material-x-over-x0";
0046 }  // namespace GsfConstants
0047 
0048 /// The extensions needed for the GSF
0049 template <typename traj_t>
0050 struct GsfExtensions {
0051   using TrackStateProxy = typename traj_t::TrackStateProxy;
0052   using ConstTrackStateProxy = typename traj_t::ConstTrackStateProxy;
0053 
0054   using Calibrator =
0055       Delegate<void(const GeometryContext &, const CalibrationContext &,
0056                     const SourceLink &, TrackStateProxy)>;
0057 
0058   using Updater = Delegate<Result<void>(
0059       const GeometryContext &, TrackStateProxy, Direction, const Logger &)>;
0060 
0061   using OutlierFinder = Delegate<bool(ConstTrackStateProxy)>;
0062 
0063   using ComponentReducer =
0064       Delegate<void(std::vector<GsfComponent> &, std::size_t, const Surface &)>;
0065 
0066   /// The Calibrator is a dedicated calibration algorithm that allows
0067   /// to calibrate measurements using track information, this could be
0068   /// e.g. sagging for wires, module deformations, etc.
0069   Calibrator calibrator;
0070 
0071   /// The updater incorporates measurement information into the track parameters
0072   Updater updater;
0073 
0074   /// Determines whether a measurement is supposed to be considered as an
0075   /// outlier
0076   OutlierFinder outlierFinder;
0077 
0078   /// Retrieves the associated surface from a source link
0079   SourceLinkSurfaceAccessor surfaceAccessor;
0080 
0081   /// Takes a vector of components and reduces its number
0082   ComponentReducer mixtureReducer;
0083 
0084   /// Default constructor which connects the default void components
0085   GsfExtensions() {
0086     calibrator.template connect<&detail::voidFitterCalibrator<traj_t>>();
0087     updater.template connect<&detail::voidFitterUpdater<traj_t>>();
0088     outlierFinder.template connect<&detail::voidOutlierFinder<traj_t>>();
0089     surfaceAccessor.connect<&detail::voidSurfaceAccessor>();
0090     mixtureReducer
0091         .template connect<&detail::voidComponentReducer<GsfComponent>>();
0092   }
0093 };
0094 
0095 template <typename traj_t>
0096 struct GsfOptions {
0097   std::reference_wrapper<const GeometryContext> geoContext;
0098   std::reference_wrapper<const MagneticFieldContext> magFieldContext;
0099   std::reference_wrapper<const CalibrationContext> calibrationContext;
0100 
0101   GsfExtensions<traj_t> extensions;
0102 
0103   PropagatorPlainOptions propagatorPlainOptions;
0104 
0105   const Surface *referenceSurface = nullptr;
0106 
0107   std::size_t maxComponents = 4;
0108 
0109   double weightCutoff = 1.e-4;
0110 
0111   bool abortOnError = false;
0112 
0113   bool disableAllMaterialHandling = false;
0114 
0115   std::string_view finalMultiComponentStateColumn = "";
0116 
0117   ComponentMergeMethod componentMergeMethod = ComponentMergeMethod::eMaxWeight;
0118 
0119 #if __cplusplus < 202002L
0120   GsfOptions() = delete;
0121 #endif
0122 };
0123 
0124 }  // namespace Acts