Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:09:58

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2020 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/EventData/SourceLink.hpp"
0012 #include "Acts/Geometry/GeometryIdentifier.hpp"
0013 
0014 #include <vector>
0015 
0016 namespace Acts {
0017 
0018 /// Source link to connect digitization clusters back to truth information.
0019 class DigitizationSourceLink final {
0020  public:
0021   /// Constructor from geometry identifier and truth indices.
0022   ///
0023   /// @param gid is the geometry identifier
0024   /// @param indices are the truth indices
0025   DigitizationSourceLink(GeometryIdentifier gid,
0026                          std::vector<std::size_t> indices = {})
0027       : m_geometryId(gid), m_indices(std::move(indices)) {}
0028 
0029   /// Construct and invalid source link. Must be default constructible to
0030   /// satisfy SourceLinkConcept.
0031   DigitizationSourceLink() = default;
0032   DigitizationSourceLink(const DigitizationSourceLink&) = default;
0033   DigitizationSourceLink(DigitizationSourceLink&&) = default;
0034   DigitizationSourceLink& operator=(const DigitizationSourceLink&) = default;
0035   DigitizationSourceLink& operator=(DigitizationSourceLink&&) = default;
0036 
0037   /// Access all associated truth indices.
0038   const std::vector<std::size_t>& indices() const { return m_indices; }
0039 
0040   GeometryIdentifier geometryId() const { return m_geometryId; }
0041 
0042  private:
0043   GeometryIdentifier m_geometryId;
0044   /// Associated truth indices.
0045   std::vector<std::size_t> m_indices;
0046 };
0047 
0048 inline bool operator==(const DigitizationSourceLink& lhs,
0049                        const DigitizationSourceLink& rhs) {
0050   return (lhs.geometryId() == rhs.geometryId()) &&
0051          (lhs.indices() == rhs.indices());
0052 }
0053 inline bool operator!=(const DigitizationSourceLink& lhs,
0054                        const DigitizationSourceLink& rhs) {
0055   return !(lhs == rhs);
0056 }
0057 
0058 }  // namespace Acts