00001 #include "RecoVertex/ConfigurableVertexReco/interface/ConfigurableAnnealing.h" 00002 #include "RecoVertex/VertexTools/interface/GeometricAnnealing.h" 00003 #include "RecoVertex/VertexTools/interface/DeterministicAnnealing.h" 00004 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00005 #include <string> 00006 00007 using namespace std; 00008 00009 ConfigurableAnnealing::ConfigurableAnnealing ( const edm::ParameterSet & m ) : 00010 theImpl( 0 ) 00011 { 00012 string type = m.getParameter<string>("annealing"); 00013 // edm::LogWarning("ConfigurableAnnealing") << "below one code ist still here."; 00014 if ( type == "below" ) 00015 { 00016 edm::LogError("ConfigurableAnnealing") << "below one annealing employed!"; 00017 vector < float > sched; 00018 double final = m.getParameter<double>("Tfinal"); 00019 sched.push_back ( 256. ); 00020 sched.push_back ( 64. ); 00021 sched.push_back ( 16. ); 00022 sched.push_back ( 4. ); 00023 sched.push_back ( 1. ); 00024 sched.push_back ( final ); 00025 theImpl = new DeterministicAnnealing( sched, m.getParameter<double>("sigmacut")); 00026 } else if ( type =="geom" ) { 00027 theImpl = new GeometricAnnealing( 00028 m.getParameter<double>("sigmacut"), 00029 m.getParameter<double>("Tini"), 00030 m.getParameter<double>("ratio") ); 00031 } else { 00032 edm::LogError("ConfigurableAnnealing") << "annealing type " << type << " is not known."; 00033 exit(-1); 00034 } 00035 } 00036 00037 ConfigurableAnnealing::ConfigurableAnnealing ( const ConfigurableAnnealing & o ) : 00038 theImpl ( o.theImpl->clone() ) 00039 {} 00040 00041 ConfigurableAnnealing * ConfigurableAnnealing::clone() const 00042 { 00043 return new ConfigurableAnnealing ( *this ); 00044 } 00045 00046 ConfigurableAnnealing::~ConfigurableAnnealing() 00047 { 00048 delete theImpl; 00049 } 00050 00051 void ConfigurableAnnealing::debug() const 00052 { 00053 theImpl->debug(); 00054 } 00055 00056 void ConfigurableAnnealing::anneal() 00057 { 00058 theImpl->anneal(); 00059 } 00060 00061 double ConfigurableAnnealing::weight ( double chi2 ) const 00062 { 00063 return theImpl->weight ( chi2 ); 00064 } 00065 00066 void ConfigurableAnnealing::resetAnnealing() 00067 { 00068 theImpl->resetAnnealing(); 00069 } 00070 00071 inline double ConfigurableAnnealing::phi( double chi2 ) const 00072 { 00073 return theImpl->phi ( chi2 ); 00074 } 00075 00076 double ConfigurableAnnealing::cutoff() const 00077 { 00078 return theImpl->cutoff(); 00079 } 00080 00081 double ConfigurableAnnealing::currentTemp() const 00082 { 00083 return theImpl->currentTemp(); 00084 } 00085 00086 double ConfigurableAnnealing::initialTemp() const 00087 { 00088 return theImpl->initialTemp(); 00089 } 00090 00091 bool ConfigurableAnnealing::isAnnealed() const 00092 { 00093 return theImpl->isAnnealed(); 00094 }