ECCE @ 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 
11 #include <vector>
13 
14 namespace Acts {
18  public:
21  struct State {
22  // Points to current temperature value in m_cfg.setOfTemperatures
23  unsigned int currentTemperatureIndex{0};
24 
25  // Checks if equilibrium is reached
26  bool equilibriumReached{false};
27  };
28 
30  struct Config {
31  // Config constructor with default temperature list: {64.,16.,4.,2.,1.5,1.}
32  Config(const std::vector<double>& temperatures = {64., 16., 4., 2., 1.5,
33  1.})
34  : setOfTemperatures(temperatures) {}
35 
36  // Insensitivity of calculated weight at cutoff
37  double cutOff{9.};
38 
39  // Set of temperatures, annealing starts at setOfTemperatures[0]
40  // and anneals towards setOfTemperatures[last]
41  std::vector<double> setOfTemperatures;
42  };
43 
45  AnnealingUtility(const Config& cfg = Config()) : m_cfg(cfg) {}
46 
48  void anneal(State& state) const;
49 
58  double getWeight(State& state, double chi2,
59  const std::vector<double>& allChi2) const;
60 
66  double getWeight(State& state, double chi2) const;
67 
68  private:
71 };
72 } // namespace Acts