Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:28:24

0001 #ifndef DeterministicAnnealing_H
0002 #define DeterministicAnnealing_H
0003 
0004 #include "RecoVertex/VertexTools/interface/AnnealingSchedule.h"
0005 #include <vector>
0006 
0007 class DeterministicAnnealing : public AnnealingSchedule {
0008 public:
0009   /**
0010    *  \class DeterministicAnnealing.
0011    *  A very simple class that returns the association probabilty of a (any)
0012    *  chi2 value, given a cutoff. Default schedule is 256 64 16 4 2 1
0013    *  Note that cutoff is given "sigma-like", i.e. as a sqrt ( chi2 )!!
0014    */
0015 
0016   DeterministicAnnealing(float cutoff = 3.0);
0017   DeterministicAnnealing(const std::vector<float>& sched, float cutoff = 3.0);
0018 
0019   void anneal() override;          //< One annealing step. theT *= theRatio.
0020   void resetAnnealing() override;  //< theT = theT0.
0021 
0022   /**
0023    *  phi ( chi2 ) = e^( -.5*chi2 / T )
0024    */
0025   double phi(double chi2) const override;
0026 
0027   /**
0028    *  Returns phi(chi2) / ( phi(cutoff^2) + phi(chi2) ),
0029    */
0030   double weight(double chi2) const override;
0031 
0032   /**
0033    * is it annealed yet?
0034    */
0035   bool isAnnealed() const override;
0036 
0037   void debug() const override;
0038 
0039   /**
0040    *  Returns phi(chi2) / ( phi(cutoff^2) + sum_i { phi(chi2s[i]) } )
0041    */
0042   // double weight ( double chi2, const vector < double > & chi2s ) const;
0043 
0044   double cutoff() const override;
0045   double currentTemp() const override;
0046   double initialTemp() const override;
0047 
0048   DeterministicAnnealing* clone() const override { return new DeterministicAnnealing(*this); };
0049 
0050 private:
0051   std::vector<float> theTemperatures;
0052   unsigned int theIndex;
0053   double theChi2cut;
0054   bool theIsAnnealed;
0055 };
0056 
0057 #endif