Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:00

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2019 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/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     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   ZScanVertexFinder(const Config& cfg,
0076                     std::unique_ptr<const Logger> logger =
0077                         getDefaultLogger("ZScanVertexFinder", Logging::INFO));
0078 
0079   /// @brief Function that determines single vertex,
0080   /// based on z0 values of input tracks,
0081   /// using a Half Sample Mode algorithm
0082   ///
0083   /// @param trackVector Input track collection
0084   /// @param vertexingOptions Vertexing options
0085   /// @param state State for fulfilling correct interface
0086   ///
0087   /// @return Vector of vertices, filled with a single
0088   ///         vertex (for consistent interfaces)
0089   Result<std::vector<Vertex>> find(const std::vector<InputTrack>& trackVector,
0090                                    const VertexingOptions& vertexingOptions,
0091                                    IVertexFinder::State& state) const override;
0092 
0093   IVertexFinder::State makeState(
0094       const Acts::MagneticFieldContext& /*mctx*/) const override {
0095     return IVertexFinder::State{State{}};
0096   }
0097 
0098   void setTracksToRemove(
0099       IVertexFinder::State& /*state*/,
0100       const std::vector<InputTrack>& /*removedTracks*/) const override {
0101     // Nothing to do here
0102   }
0103 
0104  private:
0105   Config m_cfg;
0106 
0107   /// Logging instance
0108   std::unique_ptr<const Logger> m_logger;
0109 
0110   /// Private access to logging instance
0111   const Logger& logger() const { return *m_logger; }
0112 };
0113 
0114 }  // namespace Acts