CMS 3D CMS Logo

DeterministicAnnealing Class Reference

A very simple class that returns the association probabilty of a (any) chi2 value, given a cutoff. More...

#include <RecoVertex/VertexTools/interface/DeterministicAnnealing.h>

Inheritance diagram for DeterministicAnnealing:

AnnealingSchedule

List of all members.

Public Member Functions

void anneal ()
DeterministicAnnealingclone () const
double currentTemp () const
double cutoff () const
 Returns phi(chi2) / ( phi(cutoff^2) + sum_i { phi(chi2s[i]) } ).
void debug () const
 DeterministicAnnealing (const std::vector< float > &sched, float cutoff=3.0)
 DeterministicAnnealing (float cutoff=3.0)
double initialTemp () const
bool isAnnealed () const
 is it annealed yet?
double phi (double chi2) const
 phi ( chi2 ) = e^( -.5*chi2 / T )
void resetAnnealing ()
double weight (double chi2) const
 Returns phi(chi2) / ( phi(cutoff^2) + phi(chi2) ),.

Private Attributes

double theChi2cut
unsigned int theIndex
bool theIsAnnealed


Detailed Description

A very simple class that returns the association probabilty of a (any) chi2 value, given a cutoff.

Default schedule is 256 64 16 4 2 1 Note that cutoff is given "sigma-like", i.e. as a sqrt ( chi2 )!!

Definition at line 7 of file DeterministicAnnealing.h.


Constructor & Destructor Documentation

DeterministicAnnealing::DeterministicAnnealing ( float  cutoff = 3.0  ) 

Definition at line 13 of file DeterministicAnnealing.cc.

References temperatures.

Referenced by clone().

00013                                                               :
00014   theIndex(0), theChi2cut ( cutoff*cutoff ), theIsAnnealed ( false )
00015 {
00016   temperatures.push_back(256);
00017   temperatures.push_back(64);
00018   temperatures.push_back(16);
00019   temperatures.push_back(4);
00020   temperatures.push_back(2);
00021   temperatures.push_back(1);
00022 }

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


Member Function Documentation

void DeterministicAnnealing::anneal (  )  [virtual]

Implements AnnealingSchedule.

Definition at line 30 of file DeterministicAnnealing.cc.

References temperatures, theIndex, and theIsAnnealed.

00031 {
00032   if ( theIndex < ( temperatures.size() - 1 ) )
00033   {
00034     theIndex++; 
00035   } else {
00036     theIsAnnealed = true;
00037   };
00038 }

DeterministicAnnealing* DeterministicAnnealing::clone ( void   )  const [inline, virtual]

Implements AnnealingSchedule.

Definition at line 51 of file DeterministicAnnealing.h.

References DeterministicAnnealing().

00052   {
00053     return new DeterministicAnnealing ( * this );
00054   };

double DeterministicAnnealing::currentTemp (  )  const [virtual]

Implements AnnealingSchedule.

Definition at line 73 of file DeterministicAnnealing.cc.

References temperatures, and theIndex.

00074 {
00075   return temperatures[theIndex];
00076 }

double DeterministicAnnealing::cutoff (  )  const [virtual]

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

Implements AnnealingSchedule.

Definition at line 68 of file DeterministicAnnealing.cc.

References funct::sqrt(), and theChi2cut.

00069 {
00070   return sqrt(theChi2cut);
00071 }

void DeterministicAnnealing::debug (  )  const [virtual]

Implements AnnealingSchedule.

Definition at line 88 of file DeterministicAnnealing.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), i, and temperatures.

00089 {
00090   cout << "[DeterministicAnnealing] schedule=";
00091   for ( vector< float >::const_iterator i=temperatures.begin(); 
00092         i!=temperatures.end() ; ++i )
00093   {
00094     cout << *i << " ";
00095   };
00096   cout << endl;
00097 }

double DeterministicAnnealing::initialTemp (  )  const [virtual]

Implements AnnealingSchedule.

Definition at line 78 of file DeterministicAnnealing.cc.

References temperatures.

00079 {
00080   return temperatures[0];
00081 }

bool DeterministicAnnealing::isAnnealed (  )  const [virtual]

is it annealed yet?

Implements AnnealingSchedule.

Definition at line 83 of file DeterministicAnnealing.cc.

References theIsAnnealed.

00084 {
00085   return theIsAnnealed;
00086 }

double DeterministicAnnealing::phi ( double  chi2  )  const [inline, virtual]

phi ( chi2 ) = e^( -.5*chi2 / T )

Implements AnnealingSchedule.

Definition at line 63 of file DeterministicAnnealing.cc.

References funct::exp(), temperatures, and theIndex.

Referenced by weight().

00064 {
00065   return exp ( -.5 * chi2 / temperatures[theIndex] );
00066 }

void DeterministicAnnealing::resetAnnealing (  )  [virtual]

Implements AnnealingSchedule.

Definition at line 57 of file DeterministicAnnealing.cc.

References theIndex, and theIsAnnealed.

00058 {
00059   theIndex=0;
00060   theIsAnnealed = false;
00061 }

double DeterministicAnnealing::weight ( double  chi2  )  const [virtual]

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

Implements AnnealingSchedule.

Definition at line 40 of file DeterministicAnnealing.cc.

References phi(), and theChi2cut.

00041 {
00042   long double mphi = phi ( chi2 );
00043   /*
00044   if ( mphi < std::numeric_limits<double>::epsilon() ) return 0.;
00045   return 1. / ( 1. + phi ( theChi2cut * theChi2cut ) / mphi );
00046   */
00047   // return mphi / ( mphi + phi ( theChi2cut ) );
00048   long double newtmp = mphi / ( mphi + phi ( theChi2cut ) );
00049   if ( !finite(newtmp ) )
00050   {
00051     if ( chi2 < theChi2cut ) newtmp=1.;
00052     else newtmp=0.;
00053   }
00054   return newtmp;
00055 }


Member Data Documentation

double DeterministicAnnealing::theChi2cut [private]

Definition at line 58 of file DeterministicAnnealing.h.

Referenced by cutoff(), and weight().

unsigned int DeterministicAnnealing::theIndex [private]

Definition at line 54 of file DeterministicAnnealing.h.

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

bool DeterministicAnnealing::theIsAnnealed [private]

Definition at line 59 of file DeterministicAnnealing.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:23 2009 for CMSSW by  doxygen 1.5.4