CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Attributes
DeterministicAnnealing Class Reference

#include <DeterministicAnnealing.h>

Inheritance diagram for DeterministicAnnealing:
AnnealingSchedule

Classes

class  A
 

Public Member Functions

void anneal () override
 
DeterministicAnnealingclone () const override
 
double currentTemp () const override
 
double cutoff () const override
 
void debug () const override
 
 DeterministicAnnealing (float cutoff=3.0)
 
 DeterministicAnnealing (const std::vector< float > &sched, float cutoff=3.0)
 
double initialTemp () const override
 
bool isAnnealed () const override
 
double phi (double chi2) const override
 
void resetAnnealing () override
 
double weight (double chi2) const override
 
- Public Member Functions inherited from AnnealingSchedule
virtual ~AnnealingSchedule ()
 

Private Attributes

double theChi2cut
 
unsigned int theIndex
 
bool theIsAnnealed
 
std::vector< float > theTemperatures
 

Detailed Description

Definition at line 7 of file DeterministicAnnealing.h.

Constructor & Destructor Documentation

◆ DeterministicAnnealing() [1/2]

DeterministicAnnealing::DeterministicAnnealing ( float  cutoff = 3.0)

Definition at line 10 of file DeterministicAnnealing.cc.

◆ DeterministicAnnealing() [2/2]

DeterministicAnnealing::DeterministicAnnealing ( const std::vector< float > &  sched,
float  cutoff = 3.0 
)

Member Function Documentation

◆ anneal()

void DeterministicAnnealing::anneal ( )
overridevirtual

Implements AnnealingSchedule.

Definition at line 16 of file DeterministicAnnealing.cc.

References theIndex, theIsAnnealed, and theTemperatures.

16  {
17  if (theIndex < (theTemperatures.size() - 1)) {
18  theIndex++;
19  } else {
20  theIsAnnealed = true;
21  };
22 }
std::vector< float > theTemperatures

◆ clone()

DeterministicAnnealing* DeterministicAnnealing::clone ( void  ) const
inlineoverridevirtual

Implements AnnealingSchedule.

Definition at line 48 of file DeterministicAnnealing.h.

48 { return new DeterministicAnnealing(*this); };
DeterministicAnnealing(float cutoff=3.0)

◆ currentTemp()

double DeterministicAnnealing::currentTemp ( ) const
overridevirtual

Implements AnnealingSchedule.

Definition at line 50 of file DeterministicAnnealing.cc.

References theIndex, and theTemperatures.

50 { return theTemperatures[theIndex]; }
std::vector< float > theTemperatures

◆ cutoff()

double DeterministicAnnealing::cutoff ( ) const
overridevirtual

Returns phi(chi2) / ( phi(cutoff^2) + sum_i { phi(chi2s[i]) } )

Implements AnnealingSchedule.

Definition at line 48 of file DeterministicAnnealing.cc.

References mathSSE::sqrt(), and theChi2cut.

48 { return sqrt(theChi2cut); }
T sqrt(T t)
Definition: SSEVec.h:19

◆ debug()

void DeterministicAnnealing::debug ( ) const
overridevirtual

Implements AnnealingSchedule.

Definition at line 56 of file DeterministicAnnealing.cc.

References gather_cfg::cout, mps_fire::i, and theTemperatures.

56  {
57  cout << "[DeterministicAnnealing] schedule=";
58  for (vector<float>::const_iterator i = theTemperatures.begin(); i != theTemperatures.end(); ++i) {
59  cout << *i << " ";
60  };
61  cout << endl;
62 }
std::vector< float > theTemperatures

◆ initialTemp()

double DeterministicAnnealing::initialTemp ( ) const
overridevirtual

Implements AnnealingSchedule.

Definition at line 52 of file DeterministicAnnealing.cc.

References theTemperatures.

52 { return theTemperatures[0]; }
std::vector< float > theTemperatures

◆ isAnnealed()

bool DeterministicAnnealing::isAnnealed ( ) const
overridevirtual

is it annealed yet?

Implements AnnealingSchedule.

Definition at line 54 of file DeterministicAnnealing.cc.

References theIsAnnealed.

◆ phi()

double DeterministicAnnealing::phi ( double  chi2) const
inlineoverridevirtual

◆ resetAnnealing()

void DeterministicAnnealing::resetAnnealing ( )
overridevirtual

Implements AnnealingSchedule.

Definition at line 41 of file DeterministicAnnealing.cc.

References theIndex, and theIsAnnealed.

41  {
42  theIndex = 0;
43  theIsAnnealed = false;
44 }

◆ weight()

double DeterministicAnnealing::weight ( double  chi2) const
overridevirtual

Returns phi(chi2) / ( phi(cutoff^2) + phi(chi2) ),

Implements AnnealingSchedule.

Definition at line 24 of file DeterministicAnnealing.cc.

References nano_mu_local_reco_cff::chi2, edm::isNotFinite(), phi(), and theChi2cut.

24  {
25  long double mphi = phi(chi2);
26  /*
27  if ( mphi < std::numeric_limits<double>::epsilon() ) return 0.;
28  return 1. / ( 1. + phi ( theChi2cut * theChi2cut ) / mphi );
29  */
30  // return mphi / ( mphi + phi ( theChi2cut ) );
31  long double newtmp = mphi / (mphi + phi(theChi2cut));
32  if (edm::isNotFinite(newtmp)) {
33  if (chi2 < theChi2cut)
34  newtmp = 1.;
35  else
36  newtmp = 0.;
37  }
38  return newtmp;
39 }
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
double phi(double chi2) const override

Member Data Documentation

◆ theChi2cut

double DeterministicAnnealing::theChi2cut
private

Definition at line 53 of file DeterministicAnnealing.h.

Referenced by cutoff(), and weight().

◆ theIndex

unsigned int DeterministicAnnealing::theIndex
private

Definition at line 52 of file DeterministicAnnealing.h.

Referenced by anneal(), currentTemp(), phi(), and resetAnnealing().

◆ theIsAnnealed

bool DeterministicAnnealing::theIsAnnealed
private

Definition at line 54 of file DeterministicAnnealing.h.

Referenced by anneal(), isAnnealed(), and resetAnnealing().

◆ theTemperatures

std::vector<float> DeterministicAnnealing::theTemperatures
private

Definition at line 48 of file DeterministicAnnealing.h.

Referenced by anneal(), currentTemp(), debug(), initialTemp(), and phi().