5 #ifndef L1Trigger_L1TMuonEndCap_emtf_LossFunctions 6 #define L1Trigger_L1TMuonEndCap_emtf_LossFunctions 31 virtual double fit(std::vector<Event*>&
v) = 0;
53 double fit(std::vector<Event*>&
v)
override 58 for(
unsigned int i=0;
i<v.size();
i++)
67 int id()
override{
return 1; }
90 double fit(std::vector<Event*>&
v)
override 93 if(v.empty())
return 0;
94 std::vector<double> residuals(v.size());
97 for(
unsigned int i=0;
i<v.size();
i++)
104 int median_loc = (residuals.size()-1)/2;
107 if(residuals.size()%2 != 0)
109 std::nth_element(residuals.begin(), residuals.begin()+median_loc, residuals.end());
110 return residuals[median_loc];
116 std::nth_element(residuals.begin(), residuals.begin()+median_loc, residuals.end());
117 double low = residuals[median_loc];
118 std::nth_element(residuals.begin()+median_loc+1, residuals.begin()+median_loc+1, residuals.end());
119 double high = residuals[median_loc+1];
120 return (high + low)/2;
124 int id()
override{
return 2; }
150 double fit(std::vector<Event*>&
v)
override 154 quantile = calculateQuantile(v, 0.7);
155 residual_median = calculateQuantile(v, 0.5);
158 for(
unsigned int i=0;
i<v.size();
i++)
162 double diff = residual - residual_median;
166 return (residual_median + x/v.size());
171 int id()
override{
return 3; }
176 std::vector<double> residuals(v.size());
179 for(
unsigned int i=0;
i<v.size();
i++)
185 std::sort(residuals.begin(), residuals.end());
186 unsigned int quantile_location = whichQuantile*(residuals.size()-1);
187 return residuals[quantile_location];
207 double fit(std::vector<Event*>&
v)
override 213 double SUMbottom = 0;
215 for(
unsigned int i=0;
i<v.size();
i++)
222 return SUMtop/SUMbottom;
225 int id()
override{
return 4; }
double fit(std::vector< Event * > &v) override
std::string name() override
std::string name() override
double target(Event *e) override
virtual double fit(std::vector< Event * > &v)=0
double target(Event *e) override
std::string name() override
virtual std::string name()=0
double fit(std::vector< Event * > &v) override
Abs< T >::type abs(const T &t)
double target(Event *e) override
~PercentErrorSquared() override
double fit(std::vector< Event * > &v) override
virtual double target(Event *e)=0
std::string name() override
double fit(std::vector< Event * > &v) override
double target(Event *e) override
~AbsoluteDeviation() override
double calculateQuantile(std::vector< Event * > &v, double whichQuantile)
virtual ~LossFunction()=default