Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-07-06 07:52:01

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     // ImpactPointEstimator
0043     ImpactPointEstimator ipEstimator;
0044 
0045     // FsmwMode1dFinder
0046     FsmwMode1dFinder mode1dFinder;
0047 
0048     // disables all weights, set all weights to 1.
0049     bool disableAllWeights = false;
0050     // constraint parameters
0051     float constraintcutoff = 9.;
0052     float constrainttemp = 1.;
0053     // use LogPt for weighting
0054     bool useLogPt = true;
0055     // use pt for weighting
0056     bool usePt = false;
0057     // minimum pt
0058     double minPt = 0.4 * UnitConstants::GeV;
0059     // exponent used for weighting if usePt
0060     double expPt = 1.;
0061     // minimum required weight
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