CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GeometricAnnealing.cc
Go to the documentation of this file.
3 #include <cmath>
4 #include <iostream>
5 #include <limits>
6 
8  const double cutoff, const double T, const double ratio ) :
9  theT0(T), theT(T), theChi2cut(cutoff*cutoff), theRatio( ratio )
10 {}
11 
13 {
14  theT=1+(theT-1)*theRatio;
15 }
16 
17 double GeometricAnnealing::weight ( double chi2 ) const
18 {
19  double mphi = phi ( chi2 );
20  long double newtmp = mphi / ( mphi + phi ( theChi2cut ) );
21  if ( edm::isNotFinite(newtmp) )
22  {
23  if ( chi2 < theChi2cut ) newtmp=1.;
24  else newtmp=0.;
25  }
26  return newtmp;
27 }
28 
30 {
31  theT=theT0;
32 }
33 
34 double GeometricAnnealing::phi( double chi2 ) const
35 {
36  return exp ( -.5 * chi2 / theT );
37 }
38 
40 {
41  // std::cout << "[GeometricAnnealing] cutoff called!" << std::endl;
42  return sqrt(theChi2cut);
43 }
44 
46 {
47  return theT;
48 }
49 
51 {
52  return theT0;
53 }
54 
56 {
57  return ( theT < 1.02 );
58 }
59 
61 {
62  std::cout << "[GeometricAnnealing] chi2_cut=" << theChi2cut << ", Tini="
63  << theT0 << ", ratio=" << theRatio << std::endl;
64 }
double cutoff() const
double weight(double chi2) const
bool isNotFinite(T x)
Definition: isFinite.h:10
T sqrt(T t)
Definition: SSEVec.h:48
GeometricAnnealing(const double cutoff=3.0, const double T=256.0, const double annealing_ratio=0.25)
double phi(double chi2) const
bool isAnnealed() const
double initialTemp() const
theChi2cut(cutoff *cutoff)
double currentTemp() const
tuple cout
Definition: gather_cfg.py:121
long double T