EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AnnealingUtility.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file AnnealingUtility.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
12 
13 #include <vector>
14 
15 namespace Acts {
19  public:
22  struct State {
23  // Points to current temperature value in m_cfg.setOfTemperatures
24  unsigned int currentTemperatureIndex{0};
25 
26  // Checks if equilibrium is reached
27  bool equilibriumReached{false};
28  };
29 
31  struct Config {
32  // Config constructor with default temperature list: {64.,16.,4.,2.,1.5,1.}
33  Config(const std::vector<double>& temperatures = {64., 16., 4., 2., 1.5,
34  1.})
35  : setOfTemperatures(temperatures) {}
36 
37  // Insensitivity of calculated weight at cutoff
38  double cutOff{9.};
39 
40  // Set of temperatures, annealing starts at setOfTemperatures[0]
41  // and anneals towards setOfTemperatures[last]
42  std::vector<double> setOfTemperatures;
43  };
44 
46  AnnealingUtility(const Config& cfg = Config()) : m_cfg(cfg) {}
47 
49  void anneal(State& state) const;
50 
59  double getWeight(State& state, double chi2,
60  const std::vector<double>& allChi2) const;
61 
67  double getWeight(State& state, double chi2) const;
68 
69  private:
72 };
73 } // namespace Acts