Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-04 07:47:50

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.
0008 
0009 #pragma once
0010 
0011 #include "Acts/Definitions/Algebra.hpp"
0012 #include "Acts/Definitions/Units.hpp"
0013 #include "Acts/Utilities/Logger.hpp"
0014 #include "Acts/Utilities/Result.hpp"
0015 #include "Acts/Vertexing/FsmwMode1dFinder.hpp"
0016 #include "Acts/Vertexing/IVertexFinder.hpp"
0017 #include "Acts/Vertexing/ImpactPointEstimator.hpp"
0018 #include "Acts/Vertexing/Vertex.hpp"
0019 #include "Acts/Vertexing/VertexingOptions.hpp"
0020 
0021 #include <unordered_map>
0022 
0023 namespace Acts {
0024 
0025 /// @class ZScanVertexFinder
0026 ///
0027 /// @brief Implements a vertex finder based on the mode of z0 values:
0028 /// 1. Determines the mode value of all input track z0 values
0029 /// 2. If no constraint is given, returns (0,0, z0_mode) as vertex position
0030 /// 3. If vertex constraint is given with x=x_constr and y=y_constr,
0031 ///    the returned vertex position will be (x_constr, y_constr, z0_mode).
0032 class ZScanVertexFinder final : public IVertexFinder {
0033  public:
0034   /// Configuration struct
0035   struct Config {
0036     /// @brief Finder configuration
0037     ///
0038     /// @param ipEst ImpactPointEstimator
0039     explicit Config(const ImpactPointEstimator& ipEst) : ipEstimator(ipEst) {}
0040 
0041     /// Impact point estimator for vertex finding
0042     ImpactPointEstimator ipEstimator;
0043 
0044     /// Mode finder for 1D z-position determination
0045     FsmwMode1dFinder mode1dFinder;
0046 
0047     /// Flag to disable all weights, set all weights to 1
0048     bool disableAllWeights = false;
0049     /// Constraint cutoff parameter for vertex fitting
0050     float constraintcutoff = 9.;
0051     /// Constraint temperature parameter for annealing
0052     float constrainttemp = 1.;
0053     /// Flag to use log(pT) for track weighting
0054     bool useLogPt = true;
0055     /// Flag to use pT for track weighting
0056     bool usePt = false;
0057     /// Minimum pT threshold for track selection
0058     double minPt = 0.4 * UnitConstants::GeV;
0059     /// Exponent used for pT weighting when usePt is enabled
0060     double expPt = 1.;
0061     /// Minimum required weight for track inclusion
0062     double minWeight = 0.01;
0063 
0064     /// Function to extract parameters from InputTrack
0065     InputTrack::Extractor extractParameters;
0066   };
0067 
0068   /// State struct for fulfilling interface
0069   struct State {};
0070 
0071   /// @brief Constructor for user-defined InputTrack type
0072   ///
0073   /// @param cfg Configuration object
0074   /// @param logger Logging instance
0075   explicit ZScanVertexFinder(const Config& cfg,
0076                              std::unique_ptr<const Logger> logger =
0077                                  getDefaultLogger("ZScanVertexFinder",
0078                                                   Logging::INFO));
0079 
0080   /// @brief Function that determines single vertex,
0081   /// based on z0 values of input tracks,
0082   /// using a Half Sample Mode algorithm
0083   ///
0084   /// @param trackVector Input track collection
0085   /// @param vertexingOptions Vertexing options
0086   /// @param state State for fulfilling correct interface
0087   ///
0088   /// @return Vector of vertices, filled with a single
0089   ///         vertex (for consistent interfaces)
0090   Result<std::vector<Vertex>> find(const std::vector<InputTrack>& trackVector,
0091                                    const VertexingOptions& vertexingOptions,
0092                                    IVertexFinder::State& state) const override;
0093 
0094   IVertexFinder::State makeState(
0095       const Acts::MagneticFieldContext& /*mctx*/) const override {
0096     return IVertexFinder::State{State{}};
0097   }
0098 
0099   void setTracksToRemove(
0100       IVertexFinder::State& /*state*/,
0101       const std::vector<InputTrack>& /*removedTracks*/) const override {
0102     // Nothing to do here
0103   }
0104 
0105  private:
0106   Config m_cfg;
0107 
0108   /// Logging instance
0109   std::unique_ptr<const Logger> m_logger;
0110 
0111   /// Private access to logging instance
0112   const Logger& logger() const { return *m_logger; }
0113 };
0114 
0115 }  // namespace Acts