test
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.
2 #include <cmath>
3 #include <iostream>
4 #include <limits>
5 
7  const double cutoff, const double T, const double ratio ) :
8  theT0(T), theT(T), theChi2cut(cutoff*cutoff), theRatio( ratio )
9 {}
10 
12 {
13  theT=1+(theT-1)*theRatio;
14 }
15 
16 double GeometricAnnealing::weight ( double chi2 ) const
17 {
18  double mphi = phi ( chi2 );
19  long double newtmp = mphi / ( mphi + phi ( theChi2cut ) );
20  if ( std::isinf(newtmp) )
21  {
22  if ( chi2 < theChi2cut ) newtmp=1.;
23  else newtmp=0.;
24  }
25  return newtmp;
26 }
27 
29 {
30  theT=theT0;
31 }
32 
33 double GeometricAnnealing::phi( double chi2 ) const
34 {
35  return exp ( -.5 * chi2 / theT );
36 }
37 
39 {
40  // std::cout << "[GeometricAnnealing] cutoff called!" << std::endl;
41  return sqrt(theChi2cut);
42 }
43 
45 {
46  return theT;
47 }
48 
50 {
51  return theT0;
52 }
53 
55 {
56  return ( theT < 1.02 );
57 }
58 
60 {
61  std::cout << "[GeometricAnnealing] chi2_cut=" << theChi2cut << ", Tini="
62  << theT0 << ", ratio=" << theRatio << std::endl;
63 }
bool isinf(T value)
Definition: CommonUtils.h:7
double cutoff() const
double weight(double chi2) const
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