CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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< Event * > &v)
 
int id ()
 
 LeastSquares ()
 
std::string name ()
 
Double_t target (Event *e)
 
 ~LeastSquares ()
 

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< Event * > &  v)
inlinevirtual

Implements L1TLossFunction.

Definition at line 49 of file LossFunctions.h.

References alignCSCRings::e, i, Event::predictedValue, SUM, and 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  Event* e = v[i];
57  SUM += e->trueValue - e->predictedValue;
58  }
59 
60  return SUM/v.size();
61  }
Double_t predictedValue
Definition: Event.h:20
int i
Definition: DBlmapReader.cc:9
Definition: Event.h:16
#define SUM(A, B)
Double_t trueValue
Definition: Event.h:19
int LeastSquares::id ( void  )
inlinevirtual

Implements L1TLossFunction.

Definition at line 63 of file LossFunctions.h.

63 { return 1; }
std::string LeastSquares::name ( void  )
inlinevirtual
Double_t LeastSquares::target ( Event e)
inlinevirtual

Implements L1TLossFunction.

Definition at line 43 of file LossFunctions.h.

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

44  {
45  // Each tree fits the residuals when using LeastSquares.
46  return e->trueValue - e->predictedValue;
47  }
Double_t predictedValue
Definition: Event.h:20
Double_t trueValue
Definition: Event.h:19