Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
src
RecoVertex
VertexTools
src
DeterministicAnnealing.cc
Go to the documentation of this file.
1
#include "
RecoVertex/VertexTools/interface/DeterministicAnnealing.h
"
2
#include <cmath>
3
#include <vector>
4
#include <iostream>
5
#include <limits>
6
7
using namespace
std;
8
9
DeterministicAnnealing::DeterministicAnnealing
(
float
cutoff
) :
10
theTemperatures({256,64,16,4,2,1}),
11
theIndex
(0),
theChi2cut
(
cutoff
*
cutoff
),
theIsAnnealed
(
false
)
12
{
13
}
14
15
DeterministicAnnealing::DeterministicAnnealing
(
const
vector < float > & sched,
float
cutoff
) :
16
theTemperatures(sched),
theIndex
(0),
theChi2cut
( cutoff*cutoff ),
theIsAnnealed
(
false
)
17
{
18
}
19
20
void
DeterministicAnnealing::anneal
()
21
{
22
if
(
theIndex
< (
theTemperatures
.size() - 1 ) )
23
{
24
theIndex
++;
25
}
else
{
26
theIsAnnealed
=
true
;
27
};
28
}
29
30
double
DeterministicAnnealing::weight
(
double
chi2 )
const
31
{
32
long
double
mphi =
phi
( chi2 );
33
/*
34
if ( mphi < std::numeric_limits<double>::epsilon() ) return 0.;
35
return 1. / ( 1. + phi ( theChi2cut * theChi2cut ) / mphi );
36
*/
37
// return mphi / ( mphi + phi ( theChi2cut ) );
38
long
double
newtmp = mphi / ( mphi +
phi
(
theChi2cut
) );
39
if
(
std::isinf
(newtmp ) )
40
{
41
if
( chi2 <
theChi2cut
) newtmp=1.;
42
else
newtmp=0.;
43
}
44
return
newtmp;
45
}
46
47
void
DeterministicAnnealing::resetAnnealing
()
48
{
49
theIndex
=0;
50
theIsAnnealed
=
false
;
51
}
52
53
inline
double
DeterministicAnnealing::phi
(
double
chi2 )
const
54
{
55
return
exp
( -.5 * chi2 /
theTemperatures
[
theIndex
] );
56
}
57
58
double
DeterministicAnnealing::cutoff
()
const
59
{
60
return
sqrt
(
theChi2cut
);
61
}
62
63
double
DeterministicAnnealing::currentTemp
()
const
64
{
65
return
theTemperatures
[
theIndex
];
66
}
67
68
double
DeterministicAnnealing::initialTemp
()
const
69
{
70
return
theTemperatures
[0];
71
}
72
73
bool
DeterministicAnnealing::isAnnealed
()
const
74
{
75
return
theIsAnnealed
;
76
}
77
78
void
DeterministicAnnealing::debug
()
const
79
{
80
cout
<<
"[DeterministicAnnealing] schedule="
;
81
for
( vector< float >::const_iterator
i
=
theTemperatures
.begin();
82
i
!=
theTemperatures
.end() ; ++
i
)
83
{
84
cout
<< *
i
<<
" "
;
85
};
86
cout
<< endl;
87
}
i
int i
Definition:
DBlmapReader.cc:9
create_public_lumi_plots.exp
tuple exp
Definition:
create_public_lumi_plots.py:1087
DeterministicAnnealing::weight
double weight(double chi2) const
Definition:
DeterministicAnnealing.cc:30
CommonUtils::isinf
bool isinf(T value)
Definition:
CommonUtils.h:7
DeterministicAnnealing::theIndex
unsigned int theIndex
Definition:
DeterministicAnnealing.h:58
theIndex
theIndex(0)
DeterministicAnnealing::currentTemp
double currentTemp() const
Definition:
DeterministicAnnealing.cc:63
DeterministicAnnealing::resetAnnealing
void resetAnnealing()
Definition:
DeterministicAnnealing.cc:47
DeterministicAnnealing.h
DeterministicAnnealing::theChi2cut
double theChi2cut
Definition:
DeterministicAnnealing.h:59
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:48
DeterministicAnnealing::isAnnealed
bool isAnnealed() const
Definition:
DeterministicAnnealing.cc:73
prof2calltree.cutoff
tuple cutoff
Definition:
prof2calltree.py:22
theIsAnnealed
theIsAnnealed(false)
Definition:
DeterministicAnnealing.cc:11
DeterministicAnnealing::initialTemp
double initialTemp() const
Definition:
DeterministicAnnealing.cc:68
DeterministicAnnealing::cutoff
double cutoff() const
Definition:
DeterministicAnnealing.cc:58
DeterministicAnnealing::debug
void debug() const
Definition:
DeterministicAnnealing.cc:78
DeterministicAnnealing::theIsAnnealed
bool theIsAnnealed
Definition:
DeterministicAnnealing.h:60
theChi2cut
theChi2cut(cutoff *cutoff)
DeterministicAnnealing::anneal
void anneal()
Definition:
DeterministicAnnealing.cc:20
DeterministicAnnealing::DeterministicAnnealing
DeterministicAnnealing(float cutoff=3.0)
Definition:
DeterministicAnnealing.cc:9
gather_cfg.cout
tuple cout
Definition:
gather_cfg.py:121
DeterministicAnnealing::theTemperatures
std::vector< float > theTemperatures
Definition:
DeterministicAnnealing.h:54
edm::false
volatile std::atomic< bool > shutdown_flag false
Definition:
UnixSignalHandlers.cc:22
DeterministicAnnealing::phi
double phi(double chi2) const
Definition:
DeterministicAnnealing.cc:53
Generated for CMSSW Reference Manual by
1.8.5