43void GridMedianBackgroundEstimator::set_particles(
const vector<PseudoJet> & particles) {
44 vector<double> scalar_pt(n_tiles(), 0.0);
46 assert(all_tiles_equal_area());
49 _cached_estimate.reset();
50 _cached_estimate.set_has_sigma(
true);
51 _cached_estimate.set_mean_area(mean_tile_area());
58 vector<double> scalar_dt(n_tiles(), 0.0);
60 for (
unsigned i = 0; i < particles.size(); i++) {
61 int j = tile_index(particles[i]);
63 pt = particles[i].pt();
64 dt = particles[i].mt() - pt;
65 if (_rescaling_class == 0){
69 double r = (*_rescaling_class)(particles[i]);
76 sort(scalar_dt.begin(), scalar_dt.end());
80 double p50 = _percentile(scalar_dt, 0.5);
81 _cached_estimate.set_has_rho_m(
true);
82 _cached_estimate.set_rho_m(p50 / mean_tile_area());
83 _cached_estimate.set_sigma_m((p50-_percentile(scalar_dt, (1.0-0.6827)/2.0))/sqrt(mean_tile_area()));
87 for (
unsigned i = 0; i < particles.size(); i++) {
88 int j = tile_index(particles[i]);
90 if (_rescaling_class == 0){
91 scalar_pt[j] += particles[i].pt();
93 scalar_pt[j] += particles[i].pt()/(*_rescaling_class)(particles[i]);
105 if (n_good_tiles() != n_tiles()) {
107 for (
unsigned i = 0; i < scalar_pt.size(); i++) {
108 if (tile_is_good(i)) {
111 std::swap(scalar_pt[i],scalar_pt[newn]);
115 scalar_pt.resize(newn);
121 sort(scalar_pt.begin(), scalar_pt.end());
127 double p50 = _percentile(scalar_pt, 0.5);
128 _cached_estimate.set_rho(p50 / mean_tile_area());
129 _cached_estimate.set_sigma((p50-_percentile(scalar_pt, (1.0-0.6827)/2.0))/sqrt(mean_tile_area()));
131 _cache_available =
true;