CMS 3D CMS Logo

List of all members | Public Member Functions
LeastSquares Class Reference

#include <LossFunctions.h>

Inheritance diagram for LeastSquares:
L1TLossFunction

Public Member Functions

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

Detailed Description

Definition at line 37 of file LossFunctions.h.

Constructor & Destructor Documentation

LeastSquares::LeastSquares ( )
inline

Definition at line 40 of file LossFunctions.h.

40 {}
LeastSquares::~LeastSquares ( )
inline

Definition at line 41 of file LossFunctions.h.

41 {}

Member Function Documentation

Double_t LeastSquares::fit ( std::vector< emtf::Event * > &  v)
inlinevirtual

Implements L1TLossFunction.

Definition at line 49 of file LossFunctions.h.

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

Referenced by trackingPlots.Iteration::modules().

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

Implements L1TLossFunction.

Definition at line 63 of file LossFunctions.h.

63 { return 1; }
std::string LeastSquares::name ( void  )
inlinevirtual

Implements L1TLossFunction.

Definition at line 62 of file LossFunctions.h.

Referenced by config.CFG::__str__(), validation.Sample::digest(), and VIDSelectorBase.VIDSelectorBase::initialize().

62 { return "Least_Squares"; }
Double_t LeastSquares::target ( emtf::Event e)
inlinevirtual

Implements L1TLossFunction.

Definition at line 43 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  }
Double_t trueValue
Definition: Event.h:19
Double_t predictedValue
Definition: Event.h:20