5 #ifndef L1Trigger_L1TMuonEndCap_L1TLossFunctions 6 #define L1Trigger_L1TMuonEndCap_L1TLossFunctions 28 virtual Double_t
fit(std::vector<emtf::Event*>&
v) = 0;
49 Double_t
fit(std::vector<emtf::Event*>&
v)
54 for(
unsigned int i=0;
i<v.size();
i++)
86 Double_t
fit(std::vector<emtf::Event*>&
v)
89 if(v.size()==0)
return 0;
90 std::vector<Double_t> residuals(v.size());
93 for(
unsigned int i=0;
i<v.size();
i++)
100 int median_loc = (residuals.size()-1)/2;
103 if(residuals.size()%2 != 0)
105 std::nth_element(residuals.begin(), residuals.begin()+median_loc, residuals.end());
106 return residuals[median_loc];
112 std::nth_element(residuals.begin(), residuals.begin()+median_loc, residuals.end());
113 Double_t low = residuals[median_loc];
114 std::nth_element(residuals.begin()+median_loc+1, residuals.begin()+median_loc+1, residuals.end());
115 Double_t high = residuals[median_loc+1];
116 return (high + low)/2;
120 int id(){
return 2; }
146 Double_t
fit(std::vector<emtf::Event*>&
v)
150 quantile = calculateQuantile(v, 0.7);
151 residual_median = calculateQuantile(v, 0.5);
154 for(
unsigned int i=0;
i<v.size();
i++)
158 double diff = residual - residual_median;
162 return (residual_median + x/v.size());
167 int id(){
return 3; }
172 std::vector<Double_t> residuals(v.size());
175 for(
unsigned int i=0;
i<v.size();
i++)
181 std::sort(residuals.begin(), residuals.end());
182 unsigned int quantile_location = whichQuantile*(residuals.size()-1);
183 return residuals[quantile_location];
203 Double_t
fit(std::vector<emtf::Event*>&
v)
209 Double_t SUMbottom = 0;
211 for(
unsigned int i=0;
i<v.size();
i++)
218 return SUMtop/SUMbottom;
221 int id(){
return 4; }
virtual std::string name()=0
Double_t target(emtf::Event *e)
Double_t target(emtf::Event *e)
Double_t target(emtf::Event *e)
Double_t fit(std::vector< emtf::Event * > &v)
virtual ~L1TLossFunction()=default
Double_t fit(std::vector< emtf::Event * > &v)
double calculateQuantile(std::vector< emtf::Event * > &v, double whichQuantile)
virtual Double_t target(emtf::Event *e)=0
Double_t target(emtf::Event *e)
Double_t fit(std::vector< emtf::Event * > &v)
virtual Double_t fit(std::vector< emtf::Event * > &v)=0
Double_t fit(std::vector< emtf::Event * > &v)