CMS 3D CMS Logo

List of all members | Public Member Functions
emtf::PercentErrorSquared Class Reference

#include <LossFunctions.h>

Inheritance diagram for emtf::PercentErrorSquared:
emtf::LossFunction

Public Member Functions

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

Detailed Description

Definition at line 176 of file LossFunctions.h.

Constructor & Destructor Documentation

◆ PercentErrorSquared()

emtf::PercentErrorSquared::PercentErrorSquared ( )
inline

Definition at line 178 of file LossFunctions.h.

178 {}

◆ ~PercentErrorSquared()

emtf::PercentErrorSquared::~PercentErrorSquared ( )
inlineoverride

Definition at line 179 of file LossFunctions.h.

179 {}

Member Function Documentation

◆ fit()

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

Implements emtf::LossFunction.

Definition at line 186 of file LossFunctions.h.

186  {
187  // The average of the weighted residuals minimizes the squared percent error.
188  // Weight(i) = 1/true(i)^2.
189 
190  double SUMtop = 0;
191  double SUMbottom = 0;
192 
193  for (unsigned int i = 0; i < v.size(); i++) {
194  Event* e = v[i];
195  SUMtop += (e->trueValue - e->predictedValue) / (e->trueValue * e->trueValue);
196  SUMbottom += 1 / (e->trueValue * e->trueValue);
197  }
198 
199  return SUMtop / SUMbottom;
200  }

References MillePedeFileConverter_cfg::e, mps_fire::i, and findQualityFiles::v.

Referenced by trackingPlots.Iteration::modules().

◆ id()

int emtf::PercentErrorSquared::id ( void  )
inlineoverridevirtual

Implements emtf::LossFunction.

Definition at line 202 of file LossFunctions.h.

202 { return 4; }

◆ name()

std::string emtf::PercentErrorSquared::name ( void  )
inlineoverridevirtual

Implements emtf::LossFunction.

Definition at line 201 of file LossFunctions.h.

201 { return "Percent_Error"; }

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

◆ target()

double emtf::PercentErrorSquared::target ( Event e)
inlineoverridevirtual

Implements emtf::LossFunction.

Definition at line 181 of file LossFunctions.h.

181  {
182  // The gradient of the squared percent error.
183  return (e->trueValue - e->predictedValue) / (e->trueValue * e->trueValue);
184  }

References MillePedeFileConverter_cfg::e.

mps_fire.i
i
Definition: mps_fire.py:428
findQualityFiles.v
v
Definition: findQualityFiles.py:179
Event
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37