CMS 3D CMS Logo

GeometricAnnealing.cc
Go to the documentation of this file.
3 #include <cmath>
4 #include <iostream>
5 #include <limits>
6 
7 GeometricAnnealing::GeometricAnnealing(const double cutoff, const double T, const double ratio)
8  : theT0(T), theT(T), theChi2cut(cutoff * cutoff), theRatio(ratio) {}
9 
10 void GeometricAnnealing::anneal() { theT = 1 + (theT - 1) * theRatio; }
11 
12 double GeometricAnnealing::weight(double chi2) const {
13  double mphi = phi(chi2);
14  long double newtmp = mphi / (mphi + phi(theChi2cut));
15  if (edm::isNotFinite(newtmp)) {
16  if (chi2 < theChi2cut)
17  newtmp = 1.;
18  else
19  newtmp = 0.;
20  }
21  return newtmp;
22 }
23 
25 
26 double GeometricAnnealing::phi(double chi2) const { return exp(-.5 * chi2 / theT); }
27 
29  // std::cout << "[GeometricAnnealing] cutoff called!" << std::endl;
30  return sqrt(theChi2cut);
31 }
32 
33 double GeometricAnnealing::currentTemp() const { return theT; }
34 
35 double GeometricAnnealing::initialTemp() const { return theT0; }
36 
37 bool GeometricAnnealing::isAnnealed() const { return (theT < 1.02); }
38 
40  std::cout << "[GeometricAnnealing] chi2_cut=" << theChi2cut << ", Tini=" << theT0 << ", ratio=" << theRatio
41  << std::endl;
42 }
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
GeometricAnnealing::initialTemp
double initialTemp() const override
Definition: GeometricAnnealing.cc:35
gather_cfg.cout
cout
Definition: gather_cfg.py:144
GeometricAnnealing::weight
double weight(double chi2) const override
Definition: GeometricAnnealing.cc:12
GeometricAnnealing::theT0
double theT0
Definition: GeometricAnnealing.h:42
hltPixelTracks_cff.chi2
chi2
Definition: hltPixelTracks_cff.py:25
GeometricAnnealing::GeometricAnnealing
GeometricAnnealing(const double cutoff=3.0, const double T=256.0, const double annealing_ratio=0.25)
Definition: GeometricAnnealing.cc:7
GeometricAnnealing::phi
double phi(double chi2) const override
Definition: GeometricAnnealing.cc:26
HLT_FULL_cff.cutoff
cutoff
Definition: HLT_FULL_cff.py:6630
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
GeometricAnnealing::theChi2cut
double theChi2cut
Definition: GeometricAnnealing.h:47
particleFlowDisplacedVertex_cfi.ratio
ratio
Definition: particleFlowDisplacedVertex_cfi.py:93
GeometricAnnealing.h
GeometricAnnealing::cutoff
double cutoff() const override
Definition: GeometricAnnealing.cc:28
GeometricAnnealing::debug
void debug() const override
Definition: GeometricAnnealing.cc:39
GeometricAnnealing::currentTemp
double currentTemp() const override
Definition: GeometricAnnealing.cc:33
GeometricAnnealing::anneal
void anneal() override
Definition: GeometricAnnealing.cc:10
isFinite.h
T
long double T
Definition: Basic3DVectorLD.h:48
GeometricAnnealing::theRatio
double theRatio
Definition: GeometricAnnealing.h:48
GeometricAnnealing::isAnnealed
bool isAnnealed() const override
Definition: GeometricAnnealing.cc:37
GeometricAnnealing::theT
double theT
Definition: GeometricAnnealing.h:46
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
GeometricAnnealing::resetAnnealing
void resetAnnealing() override
Definition: GeometricAnnealing.cc:24