Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:12:12

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/TrackParametrization.hpp"
0013 
0014 #include <unordered_set>
0015 #include <utility>
0016 
0017 namespace ActsFatras {
0018 
0019 /// A single cell definition: index, cell central value
0020 using Cell = std::pair<unsigned int, double>;
0021 
0022 /// A channel definition: Cell identification, readout word, links
0023 ///
0024 /// @tparam signal_t Type of the signal, requires += operator
0025 /// @tparam kSize Number of channel coordinates
0026 template <typename signal_t, std::size_t kSize>
0027 struct Channel {
0028   /// The cell identification in sizeof..(kParameters) dimensions
0029   std::array<Cell, kSize> cellId;
0030   /// The signal value, as complex as possible,
0031   /// but need += operator and double() cast for the weight
0032   signal_t value = 0;
0033   /// The potential (truth) links
0034   std::unordered_set<unsigned int> links = {};
0035 
0036   /// Channel constructor
0037   ///
0038   /// @param cellId_ The Cell identification and position
0039   /// @param value_ The Cell value
0040   /// @param links_ The (optional) links to e.g. truth indices
0041   Channel(std::array<Cell, kSize> cellId_, signal_t value_,
0042           std::unordered_set<unsigned int> links_ = {})
0043       : cellId(cellId_), value(value_), links(std::move(links_)) {}
0044 
0045   Channel() = delete;
0046 };
0047 
0048 /// A (simulated) cluster with its constituents.
0049 ///
0050 /// @tparam signal_t Type of the signal carried, see above
0051 /// @tparam kSize Number of cluster coordinates
0052 template <typename signal_t, std::size_t kSize>
0053 struct Cluster {
0054   using ParametersVector = Acts::ActsVector<kSize>;
0055   using CovarianceMatrix = Acts::ActsSquareMatrix<kSize>;
0056 
0057   /// Measured parameters.
0058   ParametersVector parameters = ParametersVector::Zero();
0059   /// Measurement covariance.
0060   CovarianceMatrix covariance = CovarianceMatrix::Zero();
0061   /// The resulting cluster size along each channel dimension.
0062   std::array<unsigned int, kSize> clusterSize;
0063   /// The constituating signal channels.
0064   std::vector<Channel<signal_t, kSize>> channels;
0065 
0066   /// Cluster constructor
0067   ///
0068   /// @param p Measured parameters
0069   /// @param c Measurement covariance
0070   /// @param cSize The cluster size definition
0071   /// @param cChannels The channel
0072   template <typename parameters_t, typename covariance_t>
0073   Cluster(const Eigen::MatrixBase<parameters_t>& p,
0074           const Eigen::MatrixBase<covariance_t>& c,
0075           std::array<unsigned int, kSize> cSize,
0076           std::vector<Channel<signal_t, kSize>> cChannels)
0077       : parameters(p), covariance(c), clusterSize(cSize), channels(cChannels) {}
0078 
0079   Cluster() = delete;
0080 };
0081 
0082 }  // namespace ActsFatras