CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions
emtf::LeastSquares Class Reference

#include <LossFunctions.h>

Inheritance diagram for emtf::LeastSquares:
emtf::LossFunction

Public Member Functions

double fit (std::vector< Event * > &v) override
 
int id () override
 
 LeastSquares ()
 
std::string name () override
 
double target (Event *e) override
 
 ~LeastSquares () override
 
- Public Member Functions inherited from emtf::LossFunction
virtual ~LossFunction ()=default
 

Detailed Description

Definition at line 39 of file LossFunctions.h.

Constructor & Destructor Documentation

emtf::LeastSquares::LeastSquares ( )
inline

Definition at line 41 of file LossFunctions.h.

41 {}
emtf::LeastSquares::~LeastSquares ( )
inlineoverride

Definition at line 42 of file LossFunctions.h.

42 {}

Member Function Documentation

double emtf::LeastSquares::fit ( std::vector< Event * > &  v)
inlineoverridevirtual

Implements emtf::LossFunction.

Definition at line 49 of file LossFunctions.h.

References alignCSCRings::e, mps_fire::i, emtf::Event::predictedValue, SUM, and emtf::Event::trueValue.

Referenced by trackingPlots.Iteration::modules().

49  {
50  // The average of the residuals minmizes the Loss Function for LS.
51 
52  double SUM = 0;
53  for (unsigned int i = 0; i < v.size(); i++) {
54  Event* e = v[i];
55  SUM += e->trueValue - e->predictedValue;
56  }
57 
58  return SUM / v.size();
59  }
#define SUM(A, B)
int emtf::LeastSquares::id ( void  )
inlineoverridevirtual

Implements emtf::LossFunction.

Definition at line 61 of file LossFunctions.h.

61 { return 1; }
std::string emtf::LeastSquares::name ( void  )
inlineoverridevirtual
double emtf::LeastSquares::target ( Event e)
inlineoverridevirtual

Implements emtf::LossFunction.

Definition at line 44 of file LossFunctions.h.

References emtf::Event::predictedValue, and emtf::Event::trueValue.

44  {
45  // Each tree fits the residuals when using LeastSquares.
46  return e->trueValue - e->predictedValue;
47  }