![]() |
|
|||
File indexing completed on 2025-08-06 08:10:15
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 0013 #include <cmath> 0014 #include <vector> 0015 0016 namespace Acts { 0017 /// @brief Implements a deterministic thermodynamic annealing scheme 0018 /// Ref. (1): CERN-THESIS-2010-027 0019 class AnnealingUtility { 0020 public: 0021 /// @brief The annealing state 0022 /// Resetting the state is done by just creating a new instance 0023 struct State { 0024 // Points to current temperature value in m_cfg.setOfTemperatures 0025 unsigned int currentTemperatureIndex{0}; 0026 0027 // Checks if equilibrium is reached 0028 bool equilibriumReached{false}; 0029 }; 0030 0031 /// @brief The configuration struct 0032 struct Config { 0033 Config(); 0034 0035 // Insensitivity of calculated weight at cutoff 0036 double cutOff{9.}; 0037 0038 // Set of temperatures, annealing starts at setOfTemperatures[0] 0039 // and anneals towards setOfTemperatures[last] 0040 std::vector<double> setOfTemperatures{64., 16., 4., 2., 1.5, 1.}; 0041 }; 0042 0043 /// Constructor 0044 AnnealingUtility(const Config& cfg = Config()) : m_cfg(cfg) { 0045 // Set Gaussian cut-off terms for each temperature 0046 for (double temp : cfg.setOfTemperatures) { 0047 m_gaussCutTempVec.push_back(std::exp(-cfg.cutOff / (2. * temp))); 0048 } 0049 } 0050 0051 /// Does the actual annealing step 0052 void anneal(State& state) const; 0053 0054 /// @brief Weight access 0055 /// 0056 /// @param state The state object 0057 /// @param chi2 Chi^2 for e.g. current track, i.e. compatibility 0058 /// of track to current vertex candidate 0059 /// @param allChi2 Vector of all chi^2 values, i.e. e.g. compatibilities 0060 /// of current track to all vertices it is currently attached to 0061 /// 0062 /// @return Calculated weight according to Eq.(5.46) in Ref.(1) 0063 double getWeight(State& state, double chi2, 0064 const std::vector<double>& allChi2) const; 0065 0066 /// @brief Weight access 0067 /// 0068 /// @param state The state object 0069 /// @param chi2 Chi^2 0070 /// 0071 /// @return Calculated weight 0072 double getWeight(State& state, double chi2) const; 0073 0074 private: 0075 /// Configuration object 0076 Config m_cfg; 0077 0078 // For each temperature, a Gaussian term with the chi2 cut-off value 0079 // is calculated and stored here 0080 std::vector<double> m_gaussCutTempVec; 0081 }; 0082 } // namespace Acts
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |