Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-26 08:22:19

0001 /** TRACCC library, part of the ACTS project (R&D line)
0002  *
0003  * (c) 2022-2023 CERN for the benefit of the ACTS project
0004  *
0005  * Mozilla Public License Version 2.0
0006  */
0007 
0008 #pragma once
0009 
0010 #include <optional>
0011 #include <string>
0012 #include <vector>
0013 
0014 #include <traccc/definitions/primitives.hpp>
0015 #include <traccc/edm/particle.hpp>
0016 
0017 namespace traccc {
0018 /**
0019  * @brief Abstract track matching descriptor.
0020  *
0021  * This abstract class represents a methodology for matching seeds to
0022  * particles.
0023  */
0024 struct track_matcher {
0025   /**
0026    * @brief Return a human-readable name for this matching method.
0027    */
0028   virtual std::string get_name() const = 0;
0029 
0030   /**
0031    * @brief Determine the most likely particle, if any, for a given seed.
0032    *
0033    * @param v A vector of sets of particle identifiers, such that the outer
0034    * vector represents the list of spacepoints in a seed, and the inner sets
0035    * represent the particles that match that spacepoint (usually only one).
0036    *
0037    * @return The matched particle identifier, or nothing if no particle
0038    * matches.
0039    */
0040   virtual std::optional<uint64_t> operator()(
0041       const std::vector<std::vector<uint64_t>>& v) const = 0;
0042   /**
0043    * @brief Default destructor
0044    */
0045   virtual ~track_matcher() = default;
0046 };
0047 
0048 /**
0049  * @brief Matcher based on minimum majority size.
0050  *
0051  * This matcher matches a seed to the track with the greatest number of
0052  * matching spacepoints, with a minimum percentage-defined size of the
0053  * majority.
0054  */
0055 struct stepped_percentage : track_matcher {
0056   /**
0057    * @brief Construct a new particle matcher.
0058    *
0059    * @param r The minimum ratio in [0, 1] of spacepoints that must belong to
0060    * the same particle.
0061    */
0062   stepped_percentage(scalar r);
0063 
0064   virtual std::string get_name() const override final;
0065 
0066   virtual std::optional<uint64_t> operator()(
0067       const std::vector<std::vector<uint64_t>>&) const override final;
0068 
0069  private:
0070   scalar m_min_ratio;
0071 };
0072 
0073 /**
0074  * @brief Matcher requiring exact particle matching.
0075  *
0076  * This matcher matches a seed to a track iff all spacepoints in the seed map
0077  * onto the same particle.
0078  */
0079 struct exact : track_matcher {
0080   exact();
0081 
0082   virtual std::string get_name() const override final;
0083 
0084   virtual std::optional<uint64_t> operator()(
0085       const std::vector<std::vector<uint64_t>>&) const override final;
0086 };
0087 }  // namespace traccc