|
|
|||
File indexing completed on 2026-07-26 08:18:25
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/Utilities/Logger.hpp" 0012 0013 #include <cstdint> 0014 #include <memory> 0015 #include <optional> 0016 #include <string> 0017 #include <unordered_map> 0018 #include <unordered_set> 0019 #include <vector> 0020 0021 namespace Acts::Experimental { 0022 0023 /// Layer connection training tool for 0024 /// creating layer map for GBTS 0025 class GbtsLayerConnectionTool { 0026 public: 0027 /// Struct to hold r and z bounds for a given detector layer 0028 struct LayerDescription { 0029 /// Constructor for filling detector layer information 0030 /// @param minR_ minimum radius of layer 0031 /// @param maxR_ maximum radius of layer 0032 /// @param minZ_ minimum z coordinate of layer 0033 /// @param maxZ_ maximum z coordinate of layer 0034 /// @param gbtsId_ GBTS id of layer 0035 LayerDescription(float minR_, float maxR_, float minZ_, float maxZ_, 0036 std::int32_t gbtsId_); 0037 0038 /// Minimum radius 0039 float minR{}; 0040 /// Maximum radius 0041 float maxR{}; 0042 /// Minimum z coordinate 0043 float minZ{}; 0044 /// Maximum z coordinate 0045 float maxZ{}; 0046 /// layer ID 0047 std::int32_t gbtsId{}; 0048 }; 0049 0050 /// Configuration for the layer connection tool 0051 struct Config { 0052 /// List of detector layers 0053 std::vector<LayerDescription> detectorGeometry{}; 0054 0055 // tolerances used for assigning layer ID's 0056 0057 /// Tolerance on minimum z value 0058 float zMinTol = 0.2340f; 0059 /// Tolerance on maximum z value 0060 float zMaxTol = 0.2340f; 0061 /// Tolerance on minimum radius value 0062 float rMinTol = 2.5337f; 0063 /// Tolerance on maximum radius value 0064 float rMaxTol = 2.5337f; 0065 0066 /// Symmeterize layer connection table 0067 bool doSymmetrization = false; 0068 /// Minimum probability cut applied to layer transitions 0069 float probThreshold = -1; 0070 }; 0071 0072 /// Container for track layer hit information 0073 struct HitCoordinates { 0074 /// Radius value of hit 0075 float r{}; 0076 /// z value of hit 0077 float z{}; 0078 }; 0079 0080 /// pair of layer transitions 0081 using LayerIdPair = std::pair<std::int32_t, std::int32_t>; 0082 0083 /// Hash id used for unordered sets and maps 0084 struct LayerIdPairHash { 0085 /// operator to allow the lookup of std::pair objects 0086 /// in unordered maps or sets 0087 /// @param pair Layer transition pair 0088 /// @return hash id 0089 std::size_t operator()(const LayerIdPair& pair) const noexcept { 0090 const auto h1 = std::hash<std::int32_t>{}(pair.first); 0091 const auto h2 = std::hash<std::int32_t>{}(pair.second); 0092 0093 return h1 ^ (h2 << 1); 0094 } 0095 }; 0096 0097 /// Container of pairs of layer transitions 0098 using LayerIdPairs = std::unordered_set<LayerIdPair, LayerIdPairHash>; 0099 /// Map of layer pair transitions, quantifying the amount of times they occur 0100 using LayerIdPairMap = 0101 std::unordered_map<LayerIdPair, std::uint32_t, LayerIdPairHash>; 0102 0103 /// Constructor for layer connection training tool 0104 /// @param config The training tool config 0105 /// @param logger The Acts logger 0106 explicit GbtsLayerConnectionTool( 0107 const Config& config, 0108 std::unique_ptr<const Logger> logger = 0109 getDefaultLogger("GbtsLayerConnectionTool", Logging::Level::INFO)); 0110 0111 /// converts layer hits to layer transitions 0112 /// @param track the layer hits of a particle 0113 void addTrack(const std::vector<HitCoordinates>& track); 0114 0115 /// Creates the connection table 0116 /// @param outputFileLocation the location for the layer connection table 0117 /// @return layer pairs 0118 GbtsLayerConnectionTool::LayerIdPairs createConnectionTable( 0119 const std::string& outputFileLocation) const; 0120 0121 private: 0122 /// returns the Acts logger 0123 const Logger& logger() const { return *m_logger; } 0124 0125 /// Finds the Gbts Coordinate of a given hits coordinate 0126 /// @param hit the coordinates of the particle hit on a layer 0127 /// @return gbts coordinate 0128 std::optional<std::int32_t> findGbtsIdByCoord( 0129 const HitCoordinates& hit) const; 0130 0131 /// gets the index to the vector of detector layers via an GBTS id 0132 /// @param gbtsId Gbts Id of layer 0133 /// @return detector layer index 0134 std::uint32_t getIndexByGbtsId(std::int32_t gbtsId) const; 0135 0136 /// finds the opposide layer of a symmetrical detector with a given reference 0137 /// layer 0138 /// @param layer the detector layer 0139 /// @return oppsite side layers gbts id 0140 std::optional<std::int32_t> oppositeSideLayer(std::int32_t layer) const; 0141 0142 /// Config for layer connection tool 0143 Config m_cfg; 0144 /// Acts logger 0145 std::unique_ptr<const Acts::Logger> m_logger; 0146 /// map of layer transition pairs 0147 LayerIdPairMap m_layerPairs{}; 0148 /// total number of tracks used to train the table on 0149 std::uint32_t m_totalTracks = 0; 0150 }; 0151 0152 } // namespace Acts::Experimental
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|