5 #ifndef L1Trigger_L1TMuonEndCap_emtf_LossFunctions 6 #define L1Trigger_L1TMuonEndCap_emtf_LossFunctions 30 virtual double fit(std::vector<Event*>&
v) = 0;
52 double fit(std::vector<Event*>&
v)
override 57 for(
unsigned int i=0;
i<v.size();
i++)
66 int id()
override{
return 1; }
89 double fit(std::vector<Event*>&
v)
override 92 if(v.empty())
return 0;
93 std::vector<double> residuals(v.size());
96 for(
unsigned int i=0;
i<v.size();
i++)
103 int median_loc = (residuals.size()-1)/2;
106 if(residuals.size()%2 != 0)
108 std::nth_element(residuals.begin(), residuals.begin()+median_loc, residuals.end());
109 return residuals[median_loc];
115 std::nth_element(residuals.begin(), residuals.begin()+median_loc, residuals.end());
116 double low = residuals[median_loc];
117 std::nth_element(residuals.begin()+median_loc+1, residuals.begin()+median_loc+1, residuals.end());
118 double high = residuals[median_loc+1];
119 return (high + low)/2;
123 int id()
override{
return 2; }
149 double fit(std::vector<Event*>&
v)
override 153 quantile = calculateQuantile(v, 0.7);
154 residual_median = calculateQuantile(v, 0.5);
157 for(
unsigned int i=0;
i<v.size();
i++)
161 double diff = residual - residual_median;
165 return (residual_median + x/v.size());
170 int id()
override{
return 3; }
175 std::vector<double> residuals(v.size());
178 for(
unsigned int i=0;
i<v.size();
i++)
184 std::sort(residuals.begin(), residuals.end());
185 unsigned int quantile_location = whichQuantile*(residuals.size()-1);
186 return residuals[quantile_location];
206 double fit(std::vector<Event*>&
v)
override 212 double SUMbottom = 0;
214 for(
unsigned int i=0;
i<v.size();
i++)
221 return SUMtop/SUMbottom;
224 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
virtual ~AbsoluteDeviation()
Abs< T >::type abs(const T &t)
double target(Event *e) override
double fit(std::vector< Event * > &v) override
virtual double target(Event *e)=0
virtual ~PercentErrorSquared()
std::string name() override
double fit(std::vector< Event * > &v) override
double target(Event *e) override
double calculateQuantile(std::vector< Event * > &v, double whichQuantile)
virtual ~LossFunction()=default