File indexing completed on 2025-01-18 09:11:31
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "Acts/Utilities/AnnealingUtility.hpp"
0010
0011 #include "Acts/Utilities/AlgebraHelpers.hpp"
0012
0013 namespace {
0014
0015
0016
0017
0018
0019
0020
0021 double computeAnnealingWeight(double chi2, double invTemp) {
0022 return Acts::safeExp(-chi2 * invTemp);
0023 }
0024 }
0025
0026 Acts::AnnealingUtility::Config::Config() = default;
0027
0028 void Acts::AnnealingUtility::anneal(State& state) const {
0029 if (state.currentTemperatureIndex < m_cfg.setOfTemperatures.size() - 1) {
0030 ++state.currentTemperatureIndex;
0031 } else {
0032 state.equilibriumReached = true;
0033 }
0034 }
0035
0036 double Acts::AnnealingUtility::getWeight(
0037 State& state, double chi2, const std::vector<double>& allChi2) const {
0038 unsigned int idx = state.currentTemperatureIndex;
0039
0040 const double currentInvTemp = 1. / (2. * m_cfg.setOfTemperatures[idx]);
0041
0042 double num = computeAnnealingWeight(chi2, currentInvTemp);
0043
0044 double denom = m_gaussCutTempVec[idx];
0045
0046 for (double val : allChi2) {
0047 denom += computeAnnealingWeight(val, currentInvTemp);
0048 }
0049
0050 return num / denom;
0051 }
0052
0053 double Acts::AnnealingUtility::getWeight(State& state, double chi2) const {
0054
0055 const double currentInvTemp =
0056 1. / (2 * m_cfg.setOfTemperatures[state.currentTemperatureIndex]);
0057
0058 return 1. /
0059 (1. + computeAnnealingWeight(m_cfg.cutOff - chi2, currentInvTemp));
0060 }