Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-11-03 08:57:22

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